Skip to content

Commit

Permalink
bna: fix skb->truesize underestimation
Browse files Browse the repository at this point in the history
skb->truesize is not meant to be tracking amount of used bytes
in an skb, but amount of reserved/consumed bytes in memory.

For instance, if we use a single byte in last page fragment,
we have to account the full size of the fragment.

skb->truesize can be very different from skb->len, that has
a very specific safety purpose.

Signed-off-by: Eric Dumazet <[email protected]>
Cc: Rasesh Mody <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed Oct 18, 2014
1 parent a282054 commit f2d9da1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/brocade/bna/bnad.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ bnad_cq_setup_skb_frags(struct bna_rcb *rcb, struct sk_buff *skb,

len = (vec == nvecs) ?
last_fraglen : unmap->vector.len;
skb->truesize += unmap->vector.len;
totlen += len;

skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags,
Expand All @@ -563,7 +564,6 @@ bnad_cq_setup_skb_frags(struct bna_rcb *rcb, struct sk_buff *skb,

skb->len += totlen;
skb->data_len += totlen;
skb->truesize += totlen;
}

static inline void
Expand Down

0 comments on commit f2d9da1

Please sign in to comment.