2005-12-22 06:36:47

by Conio sandiago

[permalink] [raw]
Subject: Un aligned addresses

Hi all
i have a embedded monta vista linux running.
i have developed a ethernet driver.
Its working Ok,
But i am facing some problem with the throughput.

After a lot of observation ,
i observed that i am getting un-aligned addresses of the data payload
from the TCP/IP stack.because of this problem i always have to do
memcpy to a word aligned buffer,because of which throughput is reduced
significantly.

Does anybody has some solution for this.
Regards
conio


2005-12-22 07:34:22

by David Miller

[permalink] [raw]
Subject: Re: Un aligned addresses

From: Conio sandiago <[email protected]>
Date: Thu, 22 Dec 2005 12:06:46 +0530

> After a lot of observation ,
> i observed that i am getting un-aligned addresses of the data payload
> from the TCP/IP stack.because of this problem i always have to do
> memcpy to a word aligned buffer,because of which throughput is reduced
> significantly.

Do skb_reserve(skb, 2), before you give the buffer at
skb->data to the chip, this will align all the headers
correctly.

2005-12-22 23:29:02

by Willy Tarreau

[permalink] [raw]
Subject: Re: Un aligned addresses

On Thu, Dec 22, 2005 at 12:06:46PM +0530, Conio sandiago wrote:
> Hi all
> i have a embedded monta vista linux running.
> i have developed a ethernet driver.
> Its working Ok,
> But i am facing some problem with the throughput.
>
> After a lot of observation ,
> i observed that i am getting un-aligned addresses of the data payload
> from the TCP/IP stack.because of this problem i always have to do
> memcpy to a word aligned buffer,because of which throughput is reduced
> significantly.
>
> Does anybody has some solution for this.

I guess your driver is not working that much OK yet. Many (most)
ethernet boards today will align the IP header on a 4 or 16 bytes boundary.
By default, the ethernet header being 14 bytes, it unaligns the IP header.
But some boards will leave a hole between those. Probably that your driver
needs to tell the hardware to do this. Or maybe you can program the DMA
to get on 4x+2 so that IP gets aligned ?

Anyway, I don't know whether I'm loosing my time because last time
you sent such a report about your driver, I asked for a little more
precisions, which I never received.

> Regards
> conio

Willy