[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ODP: [lwip-devel] IP header alignment problems
From: |
Małowidzki , Marek |
Subject: |
ODP: [lwip-devel] IP header alignment problems |
Date: |
Thu, 14 Jan 2010 11:41:46 +0100 |
Thank you, Kieran & Simon, for suggestions.
We have experimented with struct packing, with no luck, but a new compiler
version has additional options here, so maybe we should re-check.
As for adding additional 2-byte MAC prefix: ingenious :) but I have studied the
docs of our Ethernet driver and I think there is no such option.
Nonetheless, if LwIP had macros to access IP src & dest addresses in the IP
header (similar to other IPH_* macros in ip.h) and used them in a consistent
manner, this (i.e., redefinition of the macros) would solve our (and maybe
someone else's) problems. In our case this would work better than Simon's
suggestion to use packing - instead of compiler-generated four byte accesses we
would use two word accesses. However, I realize that probably nobody is going
to do the hard work. (In fact, a quick check reveals that pointers to addresses
are used as well, so macros would not suffice so easily.)
By the way, I see that out Ethernet controller (and probably most others) can
work in both little and big endian mode. What happens if someone is trying to
use LwIP having little-endian Ethernet? I believe he should apply an approach
similar to ours - convert packets (at least, headers) to big endian first.
Best regards,
Marek
________________________________
Od: address@hidden w imieniu Kieran Mansley
Wysłano: Cz 2010-01-14 10:30
Do: lwip-devel
Temat: Re: [lwip-devel] IP header alignment problems
On Wed, 2010-01-13 at 15:17 +0100, Małowidzki, Marek wrote:
> Question: is any other approach possible? We would like to avoid
> modifications to LwIP (i.e., make necessary changes as small as
> possible).
Given all the restrictions you've outlined, I think your current
approach is the best one. The only other way that I can think of is if
your MAC could be persuaded to add the required 2 bytes of padding
before you DMA it, or if you can DMA from a non-aligned address (you
only mention a restriction on the destination of the DMA) and start from
2 bytes before the beginning of the frame (to introduce the 2 bytes of
padding in the pbuf) without causing problems.
Kieran
_______________________________________________
lwip-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-devel
<<winmail.dat>>