On Thu, 2002-09-05 at 09:23, Kevin D. Kissell wrote:
> It is true that, due to the unfortunate lack of foresight in the
> design of IP, no pre-alignment of buffers will *guarantee*
> that the address or other fields of IP headers will be aligned.
It was not done for lack of foresight. It was carefully instrumented
measured and assessed.
> But I note that a design which assumes, for non x86 CPUs,
> that unaligned references will be handled by a kernel trap
> handler had darn well better assure itself that the misaligned
> case is extemely infrequent. Otherwise, it would be a distinctly
> then using the unaligned reference trap as a crutch is a win
> only if the fields are correctly aligned roughtly 94% of the time.
With properly set up network cards (and that can be a problem some can't
DMA to half word start points) the benched numbers I got for normal use
back when we decided to go this way were that no packet appeared
unaligned unless deeply weird stuff like IPX over 802.2 without SNAP was
being used. Nevertheless there are several way users can trigger such
alignment so your code must handle them. Another case it can occur is
Hitting 94% aligned is trivially the norm.