Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] [patch] tun.c does not correctly align skb's
@ 2002-12-18 23:16 Randolph Chung
  0 siblings, 0 replies; only message in thread
From: Randolph Chung @ 2002-12-18 23:16 UTC (permalink / raw)
  To: Daniel Podlejski; +Cc: parisc-linux

Hi David,

While trying to get the tun/tap driver to work on parisc-linux, I found
that the driver does not deliver correctly aligned buffers to the
underlying layers. The attached patch fixes the problem. AIUI the +2 is
there in some net drivers to deal with the 4n+2 length of MAC headers.
Since you don't have a MAC header here the +2 is not required. In fact,
it will cause the buffers that are delivered to the checksuming routines
to be unaligned, which will either not work on some archs, or have
performance implications on others.

This was tested on 2.4.19(-pa22).

--- drivers/net/tun.c.orig	2002-12-18 15:02:45.000000000 -0800
+++ drivers/net/tun.c	2002-12-18 15:03:30.000000000 -0800
@@ -194,12 +194,11 @@
 		memcpy_fromiovec((void *)&pi, iv, sizeof(pi));
 	}
  
-	if (!(skb = alloc_skb(len + 2, GFP_KERNEL))) {
+	if (!(skb = alloc_skb(len, GFP_KERNEL))) {
 		tun->stats.rx_dropped++;
 		return -ENOMEM;
 	}
 
-	skb_reserve(skb, 2);
 	memcpy_fromiovec(skb_put(skb, len), iv, len);
 
 	skb->dev = &tun->dev;


randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-18 23:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-18 23:16 [parisc-linux] [patch] tun.c does not correctly align skb's Randolph Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox