Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: Daniel Podlejski <underley@underley.eu.org>
Cc: parisc-linux@parisc-linux.org
Subject: [parisc-linux] [patch] tun.c does not correctly align skb's
Date: Wed, 18 Dec 2002 15:16:56 -0800	[thread overview]
Message-ID: <20021218231656.GN19331@tausq.org> (raw)

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/

                 reply	other threads:[~2002-12-18 23:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021218231656.GN19331@tausq.org \
    --to=randolph@tausq.org \
    --cc=parisc-linux@parisc-linux.org \
    --cc=underley@underley.eu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox