netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dhananjay Phadke <dhananjay@netxen.com>
To: davem@davemloft.com
Cc: netdev@vger.kernel.org, Dhananjay Phadke <dhananjay@qlogic.com>
Subject: [PATCH NEXT 1/3] netxen: fix lro buffer allocation
Date: Thu,  3 Sep 2009 16:10:53 -0700	[thread overview]
Message-ID: <1252019455-30683-1-git-send-email-dhananjay@netxen.com> (raw)

From: Dhananjay Phadke <dhananjay@qlogic.com>

Alloc 12k skbuffs so that firmware can aggregate more
packets into one buffer. This doesn't raise memory
consumption since 9k skbs use 16k slab cache anyway.

Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
---
 drivers/net/netxen/netxen_nic.h      |    1 +
 drivers/net/netxen/netxen_nic_init.c |    8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 224a746..ede2fa7 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -149,6 +149,7 @@
 #define NX_P2_RX_JUMBO_BUF_MAX_LEN     (NX_MAX_ETHERHDR + P2_MAX_MTU)
 #define NX_P3_RX_JUMBO_BUF_MAX_LEN     (NX_MAX_ETHERHDR + P3_MAX_MTU)
 #define NX_CT_DEFAULT_RX_BUF_LEN	2048
+#define NX_LRO_BUFFER_EXTRA		2048
 
 #define NX_RX_LRO_BUFFER_LENGTH		(8060)
 
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 8d4aa6f..04e36f2 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -265,6 +265,10 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
 			else
 				rds_ring->dma_size =
 					NX_P2_RX_JUMBO_BUF_MAX_LEN;
+
+			if (adapter->capabilities & NX_CAP0_HW_LRO)
+				rds_ring->dma_size += NX_LRO_BUFFER_EXTRA;
+
 			rds_ring->skb_size =
 				rds_ring->dma_size + NET_IP_ALIGN;
 			break;
@@ -1217,6 +1221,7 @@ netxen_process_rcv(struct netxen_adapter *adapter,
 	if (pkt_offset)
 		skb_pull(skb, pkt_offset);
 
+	skb->truesize = skb->len + sizeof(struct sk_buff);
 	skb->protocol = eth_type_trans(skb, netdev);
 
 	napi_gro_receive(&sds_ring->napi, skb);
@@ -1278,8 +1283,7 @@ netxen_process_lro(struct netxen_adapter *adapter,
 
 	skb_put(skb, lro_length + data_offset);
 
-	skb->truesize = (skb->len + sizeof(struct sk_buff) +
-			((unsigned long)skb->data - (unsigned long)skb->head));
+	skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb);
 
 	skb_pull(skb, l2_hdr_offset);
 	skb->protocol = eth_type_trans(skb, netdev);
-- 
1.6.0.2


             reply	other threads:[~2009-09-03 23:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03 23:10 Dhananjay Phadke [this message]
2009-09-03 23:10 ` [PATCH NEXT 2/3] netxen: remove duplicate napi_add Dhananjay Phadke
2009-09-04  3:07   ` David Miller
2009-09-03 23:10 ` [PATCH NEXT 3/3] netxen: fix infinite loop on dma mapping failure Dhananjay Phadke
2009-09-04  3:07   ` David Miller
2009-09-04  3:06 ` [PATCH NEXT 1/3] netxen: fix lro buffer allocation David Miller
2009-09-04  3:14   ` Dhananjay Phadke
2009-09-04  3:15     ` David Miller
2009-09-04  3:24       ` Dhananjay Phadke
2009-09-04  3:33         ` 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=1252019455-30683-1-git-send-email-dhananjay@netxen.com \
    --to=dhananjay@netxen.com \
    --cc=davem@davemloft.com \
    --cc=dhananjay@qlogic.com \
    --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 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).