Re: IP header alignment

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

 



> No.  There is hardware like Yukon-EC used in mac mini where the cost
> of the CPU unaligned access is trivial and the cost of copying every
> frame to shut up the stupid warning would be high.

This is correct, there are architectures that do support unaligned
access in trivial way. But there are others that will simply
mis-behave in this case. Most important here is ARM that is found in
many hand-helds. Impact is, drivers that don't align IP header on
dword will simply cease to work on hand-helds. Among drivers, most
important case is wifi ones, there we do have mix of 24/26 byte
headers. Having wifi non functional on hand-held is not a good thing.

To ensure valid operation, one can use get_unaligned/put_unaligned;
but this will introduce overhead on architectures that don't have
trivial implementation of get_unaligned  like
#define get_unaligned(ptr) (*(ptr))
#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))

Brief examination shows that among architectures in kernel tree only
these do support trivial non-aligned access:
m68k
cris
x86
s390
powerpc

What is interesting, alpha (Yukon is alpha, yes?) is not in this list;
it use generic implementation (from asm-generic) for get_unaligned;
this generic implementation is not same as trivial; it includes
intermediate structure dereferencing.

Thus, I believe, for IP stack it is wise to have IP header aligned by
drivers. I warn once, so it do not flood system log with messages.

Intention it to help driver writers to identify this problem. Perhaps,
this should be put under
#ifdef CONFIG_DEBUG_KERNEL
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux