if_tap unaligned access problem

Luigi Rizzo rizzo at icir.org
Thu Apr 28 10:01:02 PDT 2005


On Thu, Apr 28, 2005 at 05:50:26PM +0100, Bruce M Simpson wrote:
...
> jmg's suggestion of bringing in the NetBSD patches to allow the entire
> network stack to be compiled with unaligned accesses (for those platforms
> which support it) is interesting because it can simplify or eliminate
> some of the acrobatics needed in network drivers to deal with the mbuf
> alignment.

very true. If a module has requirement alignments it should
solve it by itself and not put the burden on dozens of other
modules (i.e. device drivers) upstream. Beside being hard to
maintain, the result leads to all sort of inefficiencies.

E.g. some time ago when i worked on polling, i removed (only on i386)
the aligment-bcopy from the "rl" driver. People complained that
further up in the stack the misalgnment would cause a slowdown,
but it turns out that the aligmnent-bcopy (which had to operate
on unaligned data) was a lot more inefficient than the unaligned accesses
in the upper layer, as you would end up paying the overhead for all
packets and their entire size, instead of doing that only when
strictly necessary.

	cheers
	luigi


More information about the freebsd-net mailing list