netdev
[Top] [All Lists]

Re: 3c59x (was Route cache performance under stress)

To: Robert Olsson <Robert.Olsson@xxxxxxxxxxx>
Subject: Re: 3c59x (was Route cache performance under stress)
From: Andi Kleen <ak@xxxxxxx>
Date: Wed, 11 Jun 2003 12:05:20 +0200
Cc: Andi Kleen <ak@xxxxxxx>, Bogdan Costescu <bogdan.costescu@xxxxxxxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxx>, sim@xxxxxxxxxxxxx, ralph+d@xxxxxxxxx, hadi@xxxxxxxxxxxxxxxx, xerox@xxxxxxxxxx, fw@xxxxxxxxxxxxx, netdev@xxxxxxxxxxx, linux-net@xxxxxxxxxxxxxxx
In-reply-to: <16102.64602.19145.131439@xxxxxxxxxxxx>
References: <20030610.085600.71109220.davem@xxxxxxxxxx> <Pine.LNX.4.44.0306101815550.26879-100000@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <20030610164949.GB13246@xxxxxxxxxxxxx> <16102.64602.19145.131439@xxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Wed, Jun 11, 2003 at 11:54:34AM +0200, Robert Olsson wrote:
> 
> 
> Andi Kleen writes:
> 
>  > You can play some tricks with the driver to make eth_type_trans disappear
>  > from the profiles. This usually helps a lot because it avoids one
>  > full "fetch from cache cold memory" roundtrip per packet, which is slow on
>  > any CPU.
> 
> 
>  Andi!
>  Interesting. Can we get into details?

eth_type_trans checks the ethernet protocol ID and sets the broadcast/multicast/
unicast L2 type.

Some NICs have bits in the RX descriptor for most of them. They have a 
"packet is TCP or UDP or IP" bit and also a bit for unicast or sometimes
even multicast/broadcast. So when you have the RX descriptor you 
can just derive these values from there and put them into the skb
without calling eth_type_trans or looking at the cache cold header.

Then you do a prefetch on the header. When the packet reaches the 
network stack later the header has already reached cache  and it can be
processed without a memory round trip latency.

Caveats: 
On some cards it doesn't work for all packets or can be only done 
if you don't have any multicast addresses hashed (that's the case
for the e1000 if I read the header bits correctly). The lxt1001 
(old EOLed card) can do it for all packet types.

Often prefetch size is limited so you should not prefetch more
than what you can store until the packet reaches the stack.

-Andi

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