lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] lwip + sam7x = udef exception


From: Goldschmidt Simon
Subject: RE: [lwip-users] lwip + sam7x = udef exception
Date: Thu, 15 Feb 2007 15:00:25 +0100

Hi Kieran,

Wow, in the last weeks, you really have been fast in answering! First of
all I have to say you make a great project leader! :-)


> I'm not sure what you mean by only applies to the IP 
> addresses and TCP sequence numbers.  Is it that as they are 
> the only 4-byte values in the headers, they're the only ones 
> for which alignment matters?

That's precisely what I mean. IP addresses are compared as addr1->addr
== addr2->addr, which won't work if the IP header is not aligned.

> Checksumming will also be more efficient if the data payload 
> is properly aligned, and while it may be up to the 
> application to deal with it, providing aligned data is 
> definitely a good thing if we can.

Not necessarily. You can always start checksumming with an u16 and after
that go on with u32's. That's how I do it, anyway.

> In the case where you can't provide the 2 byte aligned buffer 
> you're going to suffer a performance penalty whatever you do. 
>  I think it would be wrong to have a performance penalty 
> across the board to make it easier/more efficient to port to 
> some platforms.

I don't think the 4 byte aligned stuff should be the default, but I
think it is also really bad if you have to memcpy a received frame just
because your hardware and lwIP require different alignment. That's why I
think it should be an option, somehow.
What I don't know is if changing this would have an impact other than IP
addresses and TCP seqno. If not, it should not be such a big change.

> That said, if anyone else has views on this, let's hear them. 
>  If others want to change how this is done, then please let 
> us know, particularly if you've got the time to make and test 
> the changes.

I would have the time to submit a patch for this, but I don't want to
overload the patch list, as (in my opinion) there are already some
patches on that list which would need attention.

If the changes don't make it into the stack, I think the minimum change
for that should be to check alignment requirements are satisfied before
casting e.g. p->payload to struct ip_hdr.

Thanks again for your involvement and a great stack!

Simon.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]