[En-Nut-Discussion] IP Checksum calculation broken. Reenabled old algorithm for the meantime.

Ulrich Prinz ulrich.prinz at googlemail.com
Wed Jul 4 01:10:00 CEST 2012


Hi!
>
> On ARM and AVR32, NETBUFs are allocated by malloc with 4 byte
> alignment. The 14 byte Ethernet header is shifted by 2, resulting in
> 4 byte IP header alignment. On Cortex and AVR this doesn't make much
> sense, but shouldn't hurt.
>
> Since I introduced the current version of the checksum routine, I
> never experienced any problems with AVR/ARM7/ARM9. Considering this,
> may be either the checksum routine is still buggy on certain
> alignments or the compiler cannot handle this correctly, as Bernard
> reported.
>
> I'm not yet familiar enough with the Cortex platform. But it looks
> strange to me, that no alignment is required at all. I expected at
> least 16-bit alignment.

Cortex architecture is able to do unaligned addressing. I guess it is 
not as fast as 16 bit but it doesn't crash too.

Btw STM32 can do hardware IP CRC...

Best regards
Ulrich


More information about the En-Nut-Discussion mailing list