* [PATCH net-next] be2net: allocate more headroom in incoming skbs
@ 2012-01-25 13:56 Eric Dumazet
2012-01-26 18:51 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2012-01-25 13:56 UTC (permalink / raw)
To: David Miller
Cc: netdev, Ian Campbell, Vasundhara Volam, Sathya Perla,
Ajit Khaparde
Allocation of 64 bytes in skb headroom is not enough if we have to pull
ethernet + ipv6 + tcp headers, and/or extra tunneling header.
Its currently not noticed because netdev_alloc_skb_ip_align(64) give us
more room, thanks to power-of-two kmalloc() roundups.
Make sure we ask for 128 bytes so that side effects of upcoming patches
from Ian Campbell dont decrease benet rx performance, because of extra
skb head reallocations.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Vasundhara Volam <vasundhara.volam@emulex.com>
Cc: Sathya Perla <sathya.perla@emulex.com>
Cc: Ajit Khaparde <ajit.khaparde@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 3 +++
drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index cbdec25..5ee7cc0 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -74,6 +74,9 @@ static inline char *nic_name(struct pci_dev *pdev)
/* Number of bytes of an RX frame that are copied to skb->data */
#define BE_HDR_LEN ((u16) 64)
+/* allocate extra space to allow tunneling decapsulation without head reallocation */
+#define BE_RX_SKB_ALLOC_SIZE (BE_HDR_LEN + 64)
+
#define BE_MAX_JUMBO_FRAME_SIZE 9018
#define BE_MIN_MTU 256
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index e703d64..0fbf365 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1189,7 +1189,7 @@ static void be_rx_compl_process(struct be_adapter *adapter,
struct net_device *netdev = adapter->netdev;
struct sk_buff *skb;
- skb = netdev_alloc_skb_ip_align(netdev, BE_HDR_LEN);
+ skb = netdev_alloc_skb_ip_align(netdev, BE_RX_SKB_ALLOC_SIZE);
if (unlikely(!skb)) {
rx_stats(rxo)->rx_drops_no_skbs++;
be_rx_compl_discard(adapter, rxo, rxcp);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] be2net: allocate more headroom in incoming skbs
2012-01-25 13:56 [PATCH net-next] be2net: allocate more headroom in incoming skbs Eric Dumazet
@ 2012-01-26 18:51 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-01-26 18:51 UTC (permalink / raw)
To: eric.dumazet
Cc: netdev, Ian.Campbell, vasundhara.volam, sathya.perla,
ajit.khaparde
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 25 Jan 2012 14:56:30 +0100
> Allocation of 64 bytes in skb headroom is not enough if we have to pull
> ethernet + ipv6 + tcp headers, and/or extra tunneling header.
>
> Its currently not noticed because netdev_alloc_skb_ip_align(64) give us
> more room, thanks to power-of-two kmalloc() roundups.
>
> Make sure we ask for 128 bytes so that side effects of upcoming patches
> from Ian Campbell dont decrease benet rx performance, because of extra
> skb head reallocations.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-26 18:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-25 13:56 [PATCH net-next] be2net: allocate more headroom in incoming skbs Eric Dumazet
2012-01-26 18:51 ` 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).