diff mbox

[NEXT,1/3] netxen: fix lro buffer allocation

Message ID 1252019455-30683-1-git-send-email-dhananjay@netxen.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Dhananjay Phadke Sept. 3, 2009, 11:10 p.m. UTC
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(-)

Comments

David Miller Sept. 4, 2009, 3:06 a.m. UTC | #1
From: Dhananjay Phadke <dhananjay@netxen.com>
Date: Thu,  3 Sep 2009 16:10:53 -0700

> 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>

Applied.  But allocating such huge linear buffers is asking for
guarenteed trouble.  Can't you split them up into page sized chunks
with this chip?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dhananjay Phadke Sept. 4, 2009, 3:14 a.m. UTC | #2
> Applied.  But allocating such huge linear buffers is asking for
> guarenteed trouble.  Can't you split them up into page sized chunks
> with this chip?

"chained" LRO is not enabled by firmware. Contiguous LRO requires
fewer commands (internal) from firmware to DMA engines.

-Dhananjay--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Sept. 4, 2009, 3:15 a.m. UTC | #3
From: Dhananjay Phadke <dhananjay.phadke@qlogic.com>
Date: Thu, 3 Sep 2009 20:14:01 -0700

>  
> 
>> Applied.  But allocating such huge linear buffers is asking for
>> guarenteed trouble.  Can't you split them up into page sized chunks
>> with this chip?
> 
> "chained" LRO is not enabled by firmware. Contiguous LRO requires
> fewer commands (internal) from firmware to DMA engines.

But if the page allocator can't satisfy allocation requests
it doesn't matter how many microseconds you're saving here.

I think you're priorities are backwards.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dhananjay Phadke Sept. 4, 2009, 3:24 a.m. UTC | #4
> But if the page allocator can't satisfy allocation requests
> it doesn't matter how many microseconds you're saving here.
> 
> I think you're priorities are backwards.

Ok whatever. Whether I request 9k or 12k, page allocator
is digging 16k chunks.

When there's enough memory, every cycle saved is important
for firmware. I would love to enable fragmented rx, if it's
not affecting throughput.

-Dhananjay--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Sept. 4, 2009, 3:33 a.m. UTC | #5
From: Dhananjay Phadke <dhananjay.phadke@qlogic.com>
Date: Thu, 3 Sep 2009 20:24:15 -0700

>> But if the page allocator can't satisfy allocation requests
>> it doesn't matter how many microseconds you're saving here.
>> 
>> I think you're priorities are backwards.
> 
> Ok whatever. Whether I request 9k or 12k, page allocator
> is digging 16k chunks.
> 
> When there's enough memory, every cycle saved is important
> for firmware. I would love to enable fragmented rx, if it's
> not affecting throughput.

Ok.

Just FYI I won't be surprised if SLAB/SLUB/SLQB at some point
handle this situation differently.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);