mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
net: Pass max frags into skb_append_pagefrags()
Pass the maximum number of fragments into skb_append_pagefrags() rather than using MAX_SKB_FRAGS so that it can be used from code that wants to specify sysctl_max_skb_frags. Signed-off-by: David Howells <dhowells@redhat.com> cc: David Ahern <dsahern@kernel.org> cc: Jens Axboe <axboe@kernel.dk> cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
b841b901c4
commit
96449f9024
@ -1383,7 +1383,7 @@ static inline int skb_pad(struct sk_buff *skb, int pad)
|
||||
#define dev_kfree_skb(a) consume_skb(a)
|
||||
|
||||
int skb_append_pagefrags(struct sk_buff *skb, struct page *page,
|
||||
int offset, size_t size);
|
||||
int offset, size_t size, size_t max_frags);
|
||||
|
||||
struct skb_seq_state {
|
||||
__u32 lower_offset;
|
||||
|
@ -4188,13 +4188,13 @@ unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
|
||||
EXPORT_SYMBOL(skb_find_text);
|
||||
|
||||
int skb_append_pagefrags(struct sk_buff *skb, struct page *page,
|
||||
int offset, size_t size)
|
||||
int offset, size_t size, size_t max_frags)
|
||||
{
|
||||
int i = skb_shinfo(skb)->nr_frags;
|
||||
|
||||
if (skb_can_coalesce(skb, i, page, offset)) {
|
||||
skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], size);
|
||||
} else if (i < MAX_SKB_FRAGS) {
|
||||
} else if (i < max_frags) {
|
||||
skb_zcopy_downgrade_managed(skb);
|
||||
get_page(page);
|
||||
skb_fill_page_desc_noacc(skb, i, page, offset, size);
|
||||
|
@ -1450,7 +1450,8 @@ ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
|
||||
if (len > size)
|
||||
len = size;
|
||||
|
||||
if (skb_append_pagefrags(skb, page, offset, len)) {
|
||||
if (skb_append_pagefrags(skb, page, offset, len,
|
||||
MAX_SKB_FRAGS)) {
|
||||
err = -EMSGSIZE;
|
||||
goto error;
|
||||
}
|
||||
|
@ -2349,7 +2349,7 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page,
|
||||
newskb = NULL;
|
||||
}
|
||||
|
||||
if (skb_append_pagefrags(skb, page, offset, size)) {
|
||||
if (skb_append_pagefrags(skb, page, offset, size, MAX_SKB_FRAGS)) {
|
||||
tail = skb;
|
||||
goto alloc_skb;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user