linux-mips
[Top] [All Lists]

Re: patch to kaweth.c to align IP header

To: "Kevin D. Kissell" <kevink@mips.com>
Subject: Re: patch to kaweth.c to align IP header
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
Date: 05 Sep 2002 12:22:42 +0100
Cc: Quinn Jensen <jensenq@lineo.com>, linux-mips@linux-mips.org
In-reply-to: <008d01c254b5$d7398500$10eca8c0@grendel>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <3D765072.60208@Lineo.COM> <1031182461.3017.137.camel@irongate.swansea.linux.org.uk> <008d01c254b5$d7398500$10eca8c0@grendel>
Sender: linux-mips-bounce@linux-mips.org
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
PPP. 

Hitting 94% aligned is trivially the norm.


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