David S. Miller writes:
> It is real requirement, x86 works because unaligned
> access is handled transparently by cpu.
>
> But on every non-x86 csum_partial I have examined, worse than
> 2-byte aligned data start is totally not handled. It is not difficult
> to figure out why this is the case, everyone has copied by example. :-)
PPC and PPC64 are OK, I believe, since the CPU handles (almost) all
unaligned accesses in hardware. (Some PowerPC implementations trap if
the access crosses a page boundary but the newer ones even handle that
case in hardware, and if we do get the trap we fix it up.)
I notice though that if the length is odd, we (PPC) put the last byte
in the left-hand (most significant) byte of a 16-bit halfword, with
zero in the other byte, and add it in, whereas i386 puts the last byte
in the least-significant position. Hmmm... should be OK though since
I presume the result will be reduced and then converted to network
byte order before being put in the packet. And since there is an
end-around carry we should end up with the same bytes that i386 does.
Paul.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:17 EST