This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

network buffer alignment


Hello!

I am writing an ethernet driver for coldfire architecture and I am using redboot for simple ping tests.
I had the problem of strange ethernet destination addresses on the wire for outgoing packets. This was because the controller requires the buffers for transmitting to be 4 byte aligned and the buffer in question did not has this alignment. The buffer in question is in redboot/current/src/net/enet.c in function __enet_send, the eth_hdr stack variable. I now wonder if my ethernet controller is the only one with this 4 byte aligning requirement or if other architectures had luck in gcc aligning this buffer at a 4 byte boundary by random ?
I could make it work by forcing gcc with __attribute__((aligned(4))) to the right alignment. This would make a little change in the redboot sources neccessary, but I am not sure if this applies for all the other architectures out there. If this were not the case, my only other solution is: In the driver right before sending the packet I would check for the right buffer alignment and if it is not correct, I would have to allocate memory with the alignment in place and copy the wrong buffer there. This would be a really ugly solution.


What are your opinions ?

Thanks,

Lars

Attachment: PGP.sig
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]