All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Amit Salecha <amit.salecha@qlogic.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Ameen Rahman <ameen.rahman@qlogic.com>,
	Anirban Chakraborty <anirban.chakraborty@qlogic.com>,
	David Miller <davem@davemloft.net>
Subject: [PATCH net-next-2.6] qlnic: dont set skb->truesize
Date: Mon, 20 Sep 2010 14:28:59 +0200	[thread overview]
Message-ID: <1284985739.3420.284.camel@edumazet-laptop> (raw)
In-Reply-To: <1284985118.3420.270.camel@edumazet-laptop>

Le lundi 20 septembre 2010 à 14:18 +0200, Eric Dumazet a écrit :
> Le lundi 20 septembre 2010 à 06:16 -0500, Amit Salecha a écrit :
> 
> > This can be cleaned up. 
> > Though I have one doubt. We are allocating larger packets than the actual data used.
> > Doesn't it will break accounting ?
> 
> truesize accounts for the real size of buffers, not the used part in
> them.
> 
> IMHO, a driver not dealing with fragments should not touch skb->truesize
> 
> # grep truesize drivers/net/tg3.c
> <nothing>
> 
> If a driver deals with fragments, it probably should use "+=" operator
> only, not hardcoding sizeof(struct sk_buff) thing that only core network
> has to deal with.
> 
> $ find drivers/net/bnx2x|xargs grep truesize
> drivers/net/bnx2x/bnx2x_cmn.c:		skb->truesize += frag_len;
> 
> Almost all drivers are fine, they are some of them that should be
> changed.
> 
> 

I suspect following patch should be fine :

[PATCH net-next-2.6] qlnic: dont set skb->truesize

skb->truesize is set in core network.

Dont change it unless dealing with fragments.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/qlcnic/qlcnic_init.c |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index e26fa95..16dd9eb 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -1418,8 +1418,6 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
 	if (pkt_offset)
 		skb_pull(skb, pkt_offset);
 
-	skb->truesize = skb->len + sizeof(struct sk_buff);
-
 	if (unlikely(qlcnic_check_rx_tagging(adapter, skb, &vid))) {
 		adapter->stats.rxdropped++;
 		dev_kfree_skb(skb);
@@ -1491,8 +1489,6 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
 
 	skb_put(skb, lro_length + data_offset);
 
-	skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb);
-
 	skb_pull(skb, l2_hdr_offset);
 
 	if (unlikely(qlcnic_check_rx_tagging(adapter, skb, &vid))) {
@@ -1732,8 +1728,6 @@ qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
 	if (pkt_offset)
 		skb_pull(skb, pkt_offset);
 
-	skb->truesize = skb->len + sizeof(struct sk_buff);
-
 	if (!qlcnic_check_loopback_buff(skb->data))
 		adapter->diag_cnt++;
 



  reply	other threads:[~2010-09-20 12:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-17  5:14 [PATCHv2 NEXT 0/5]qlcnic: vlan rx accleration support Amit Kumar Salecha
2010-09-17  5:14 ` [PATCHv2 NEXT 1/5] qlcnic: support vlan rx accleration Amit Kumar Salecha
2010-09-17  5:29   ` Eric Dumazet
2010-09-17  9:57   ` [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2 Eric Dumazet
2010-09-17 10:53     ` Amit Salecha
2010-09-18  5:58     ` David Miller
2010-09-20 11:16     ` Amit Salecha
2010-09-20 12:18       ` Eric Dumazet
2010-09-20 12:28         ` Eric Dumazet [this message]
2010-09-20 17:09           ` [PATCH net-next-2.6] qlnic: dont set skb->truesize David Miller
2010-09-20 15:58       ` [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2 David Miller
2010-09-21  8:19         ` Amit Salecha
2010-09-21  8:34           ` Eric Dumazet
2010-09-21  8:41             ` Amit Salecha
2010-09-21  9:23               ` Eric Dumazet
2010-09-21 19:33               ` David Miller
2010-09-21 19:55                 ` [PATCH] netxen: dont set skb->truesize Eric Dumazet
2010-09-21 20:04                   ` David Miller
2010-09-17  5:14 ` [PATCHv2 NEXT 2/5] qlcnic: vlan gro support Amit Kumar Salecha
2010-09-17 18:24   ` David Miller
2010-09-17 18:25     ` David Miller
2010-09-17  5:14 ` [PATCHv2 NEXT 3/5] qlcnic: vlan lro support Amit Kumar Salecha
2010-09-17  5:14 ` [PATCHv2 NEXT 4/5] qlcnic: remove fw version check Amit Kumar Salecha
2010-09-17  5:14 ` [PATCHv2 NEXT 5/5] qlcnic: update version 5.0.10 Amit Kumar Salecha
2010-09-17 18:31 ` [PATCHv2 NEXT 0/5]qlcnic: vlan rx accleration support David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1284985739.3420.284.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=ameen.rahman@qlogic.com \
    --cc=amit.salecha@qlogic.com \
    --cc=anirban.chakraborty@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.