Subject: Re: Tigon3 5701 PCI-X recv performance problem

From: "David S. Miller" <[email-masked]>
Date: Wed, 8 Oct 2003 12:22:23 -0700

On Wed, 8 Oct 2003 20:37:42 +0200
Andi Kleen <[email-masked]> wrote:

> Maybe you didn't want to change the core stack to use the unaligned
> access mechanism?
> 
> In that case it may be better to fix the stack with some macro
> that expands to the unaligned access on IA64 and a normal load 
> on other architectures.

I have a very strong feeling that we'd really need both options to
arrive at an optimal implementation on all platforms.

Something that makes drivers copy packets, and something else that
traps packet header accesses.

But I don't like any of these solutions (and I know Linus will never
accept a set of changes that puts netdev_get_unaligned() macro usage
all over the entire networking layer).  Instead, we should do what
you proposed long ago.  Seperating the protocol headers from the
packet data.  Then we need only align the protocol headers.

In fact, I can suggest a very efficient implementation:

1) Driver allocates paged SKBs.  There is ~128 bytes of skb->data
   buffer area, and pages are chopped up into MTU'ish sized chunks
   and hung onto SKBs in the frag list.

2) The device is given the page buffers to receive packets into.

3) On RX, align skb->data (ie. skb_reserve(skb, 2) for ethernet
   drivers) and copy the first N bytes from the head of
   the paged buffer to skb->data, point the fraglist entry for the
   page at offset "N" into the page chunk buffer.

Problem solved.