Commit e7e5a403 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

niu: fix skb truesize underestimation

Add a 'truesize' argument to niu_rx_skb_append(), filled with rcr_size
by the caller to properly account frag sizes in skb->truesize
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5e6c355c
...@@ -3287,17 +3287,13 @@ static u16 tcam_get_valid_entry_cnt(struct niu *np) ...@@ -3287,17 +3287,13 @@ static u16 tcam_get_valid_entry_cnt(struct niu *np)
} }
static void niu_rx_skb_append(struct sk_buff *skb, struct page *page, static void niu_rx_skb_append(struct sk_buff *skb, struct page *page,
u32 offset, u32 size) u32 offset, u32 size, u32 truesize)
{ {
int i = skb_shinfo(skb)->nr_frags; skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags, page, offset, size);
__skb_fill_page_desc(skb, i, page, offset, size);
skb->len += size; skb->len += size;
skb->data_len += size; skb->data_len += size;
skb->truesize += size; skb->truesize += truesize;
skb_shinfo(skb)->nr_frags = i + 1;
} }
static unsigned int niu_hash_rxaddr(struct rx_ring_info *rp, u64 a) static unsigned int niu_hash_rxaddr(struct rx_ring_info *rp, u64 a)
...@@ -3480,7 +3476,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, ...@@ -3480,7 +3476,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
} else if (!(val & RCR_ENTRY_MULTI)) } else if (!(val & RCR_ENTRY_MULTI))
append_size = len - skb->len; append_size = len - skb->len;
niu_rx_skb_append(skb, page, off, append_size); niu_rx_skb_append(skb, page, off, append_size, rcr_size);
if ((page->index + rp->rbr_block_size) - rcr_size == addr) { if ((page->index + rp->rbr_block_size) - rcr_size == addr) {
*link = (struct page *) page->mapping; *link = (struct page *) page->mapping;
np->ops->unmap_page(np->device, page->index, np->ops->unmap_page(np->device, page->index,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment