[Top] [All Lists]

Re: patch to kaweth.c to align IP header

To: "Kevin D. Kissell" <>
Subject: Re: patch to kaweth.c to align IP header
From: Alan Cox <>
Date: 05 Sep 2002 12:22:42 +0100
Cc: Quinn Jensen <>,
In-reply-to: <008d01c254b5$d7398500$10eca8c0@grendel>
Original-recipient: rfc822;
References: <3D765072.60208@Lineo.COM> <> <008d01c254b5$d7398500$10eca8c0@grendel>
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

It does

> 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.

<Prev in Thread] Current Thread [Next in Thread>