netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Making the NS83820 usable on IA64
@ 2004-03-17  3:57 Peter Chubb
       [not found] ` <4057D1B8.9090508@pobox.com>
  2004-03-17  5:49 ` David S. Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Chubb @ 2004-03-17  3:57 UTC (permalink / raw)
  To: linux-ia64; +Cc: linux-net, netdev


Hi Folks, 

With the current NS83820 driver and IP stack implementation,
the IA64 kernel spends 99.9% of its time in the unaligned access trap
handler when the network starts getting busy.  When I raised this
issue before, the idea of realigning the skbuf data in the driver was
scouted; therefore I submit this patch for your approval.  It makes
the driver usable, and doesn't seem to affect anything else.

The idea is to tell gcc that the IP header is 2-byte aligned,
so it can generate the right code to access it.  Otherwise, it tries
to do a 4-byte load when trying to extract the header length bitfield,
which traps.  As far as I read the C standard, gcc can do almost
whatever it wants as regarding the alignment and underlying storage
size of a bitfield, so it's free to assume 32-bit alignment if it
wants.

Tested on McKinley with gcc 3.3.x


===== linus-2.6.4/include/linux/ip.h 1.12 vs edited =====
--- 1.12/include/linux/ip.h	Fri Jan  2 07:28:33 2004
+++ edited/include/linux/ip.h	Wed Mar 17 11:58:09 2004
@@ -186,7 +186,7 @@
 	__u32	saddr;
 	__u32	daddr;
 	/*The options start here. */
-};
+} __attribute__((packed,aligned(2)));
 
 struct ip_auth_hdr {
 	__u8  nexthdr;


--
Dr Peter Chubb     http://www.gelato.unsw.edu.au  peterc@gelato.unsw.edu.au
You are lost in a maze of BitKeeper repositories,   all slightly different.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-03-17  8:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-17  3:57 Making the NS83820 usable on IA64 Peter Chubb
     [not found] ` <4057D1B8.9090508@pobox.com>
2004-03-17  4:33   ` Peter Chubb
2004-03-17  5:49 ` David S. Miller
2004-03-17  8:54   ` Peter Chubb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).