[Bridge] [PATCH] net/bridge: use the maximum hard_header_len of ports for bridging device

Stephen Hemminger shemminger at linux-foundation.org
Mon Mar 23 08:51:22 PDT 2009

On Fri, 20 Mar 2009 17:04:29 +0800
Li Yang <leoli at freescale.com> wrote:

> The bridging device used a constant hard_header_len.  This will cause
> headroom shortage for ports with additional hardware header.  The patch
> makes bridging device to use the maximum value of all ports.
> Signed-off-by: Li Yang <leoli at freescale.com>
> ---

That ensures big enough header for locally generated packets, but
any drivers that need bigger headroom still must handle bridged packets
that come in with smaller space. When bridging packets, the skb comes
from the allocation by the receiving driver. Almost all drivers will
use dev_alloc_skb() which will allocate NET_SKB_PAD (16) bytes of
additional headroom. This is used to hold copy of ethernet header for
the bridge/netfilter code.

So your patch is fine as an optimization but a driver can not safely
depend on any additional headroom. The driver must check if there
is space, and if no space is available, reallocate and copy.

More information about the Bridge mailing list