netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] bna: fix skb->truesize underestimation
@ 2014-10-17 19:45 Eric Dumazet
  2014-10-18  3:56 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2014-10-17 19:45 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Rasesh Mody

From: Eric Dumazet <edumazet@google.com>

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 <edumazet@google.com>
Cc: Rasesh Mody <rasesh.mody@qlogic.com>
---
 drivers/net/ethernet/brocade/bna/bnad.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 153cafac323c..c3861de9dc81 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -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,
@@ -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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] bna: fix skb->truesize underestimation
  2014-10-17 19:45 [PATCH net] bna: fix skb->truesize underestimation Eric Dumazet
@ 2014-10-18  3:56 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-10-18  3:56 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, rasesh.mody

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 17 Oct 2014 12:45:55 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> 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 <edumazet@google.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-18  3:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-17 19:45 [PATCH net] bna: fix skb->truesize underestimation Eric Dumazet
2014-10-18  3:56 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).