netxen: fix lro buffer allocation
authorDhananjay Phadke <dhananjay@qlogic.com>
Thu, 3 Sep 2009 13:10:53 +0000 (13:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Sep 2009 03:01:56 +0000 (20:01 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netxen/netxen_nic.h
drivers/net/netxen/netxen_nic_init.c

index 224a74691312cdcd9d428f717e50c4a02a272217..ede2fa7477ac001baba813ec22c4bbd9007e6bf5 100644 (file)
 #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)
 
index 8d4aa6f74bffeb78d596a85a127123f09cbcc8e9..04e36f2b1a938f172fb48b38f46b4c0ac3e840ef 100644 (file)
@@ -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);