[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090206.014107.231141422.davem@davemloft.net>
Date: Fri, 06 Feb 2009 01:41:07 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: netdev@...r.kernel.org
Subject: TX pre-headers...
Some NIC hardware wants a pre-header pushed in front of the packet
data on transmit.
When routing or bridging this will cause a reallocation of skb->data
on every packet forwarded because there will only be NET_IP_ALIGN
space reserved at the head by the device receive path.
NIU is one such NIC and I only noticed this because of some things I
saw in some of Robert Olsson's routing stress test oprofile dumps.
Putting a hack into NIU is the wrong way to do this and would only fix
cases where NIU is the receiver and transmitting device. e1000 to
NIU would still be broken, for example.
I think the way to solve this is to have each device indicate how
much TX slack space it neads for it's preheaders. On device
registration we have some global "netdev_max_tx_hdr_space" that
records the maximum value seen.
We could decrease it on unregister (by walking the device list)
but I don't think that is worth it.
We also round netdev_max_tx_hdr_space up to be a multiple of 4
or something reasonable like that.
Then we get drivers to use a new interface:
struct sk_buff *netdev_alloc_rx_skb(struct net_device *dev, int size);
which is nearly identical to netdev_alloc_skb() except that it does:
size += NET_IP_ALIGN + netdev_max_tx_hdr_space;
skb = netdev_alloc_skb(dev, size);
if (skb)
skb_reserve(skb, NET_IP_ALIGN + netdev_max_tx_hdr_space);
return skb;
Seems reasonable?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists