Re: mac80211 truesize bugs

Herbert Xu
2008-05-04T02:02:15Z

On Sun, May 04, 2008 at 03:42:34AM +0200, Johannes Berg wrote:
>
> I'm still not sure about the dependencies between LL_MAX_HEADER,
> dev->hard_header_len and similar. Why, for example, does ipip set it to
> LL_MAX_HEADER + sizeof(struct iphdr)? Because it doesn't know better
> since the packets it creates could be routed anywhere?

The difference between LL_MAX_HEADER and hard_header_len is that
the former is a system-wide hint of how big the header can be
and the latter is a device-specific value.

In other words, we use the former when we don't know where we
create a packet since we don't know where it'll end up. As such
we allocate a generous amount of header space so that hopefully
nobody will have to expand the header later. However, it would
be OK for someone to expand it but obviously it this happened
for the majority of your traffic then you've done something wrong
since expanding it wastes CPU resources by copying the data.

The value of hard_header_len on the other hand is used for two
purposes at least. First of all it is a hint of how much free
header space there should be in a packet before it goes into a
device (but don't rely on it). More importantly it's the length
of the hardware header in the packet. The definition of the
hardware header varies with each type of device.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt