netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: "Jon Nelson" <jnelson@jamponi.net>,
	"Jarek Poplawski" <jarkao2@o2.pl>,
	netdev@vger.kernel.org
Subject: [PATCH] via-velocity: don't oops on MTU change (resend)
Date: Wed, 28 Nov 2007 14:20:16 -0800	[thread overview]
Message-ID: <20071128142016.0eecbd2c@freepuppy.rosehill> (raw)
In-Reply-To: <cccedfc60711281402m397a37d2mda83645211633202@mail.gmail.com>

The VIA veloicty driver needs the following to allow changing MTU when down.
The buffer size needs to be computed when device is brought up, not when
device is initialized.  This also fixes a bug where the buffer size was
computed differently on change_mtu versus initial setting.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

---
This is a properly formatted version of previously submitted patch.
Please apply for 2.6.24

--- a/drivers/net/via-velocity.c	2007-11-15 20:11:12.000000000 -0800
+++ b/drivers/net/via-velocity.c	2007-11-15 20:32:14.000000000 -0800
@@ -1242,6 +1242,9 @@ static int velocity_rx_refill(struct vel
 static int velocity_init_rd_ring(struct velocity_info *vptr)
 {
 	int ret;
+	int mtu = vptr->dev->mtu;
+
+	vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
 
 	vptr->rd_info = kcalloc(vptr->options.numrx,
 				sizeof(struct velocity_rd_info), GFP_KERNEL);
@@ -1898,8 +1901,6 @@ static int velocity_open(struct net_devi
 	struct velocity_info *vptr = netdev_priv(dev);
 	int ret;
 
-	vptr->rx_buf_sz = (dev->mtu <= 1504 ? PKT_BUF_SZ : dev->mtu + 32);
-
 	ret = velocity_init_rings(vptr);
 	if (ret < 0)
 		goto out;
@@ -1978,12 +1979,6 @@ static int velocity_change_mtu(struct ne
 		velocity_free_rd_ring(vptr);
 
 		dev->mtu = new_mtu;
-		if (new_mtu > 8192)
-			vptr->rx_buf_sz = 9 * 1024;
-		else if (new_mtu > 4096)
-			vptr->rx_buf_sz = 8192;
-		else
-			vptr->rx_buf_sz = 4 * 1024;
 
 		ret = velocity_init_rd_ring(vptr);
 		if (ret < 0)

  reply	other threads:[~2007-11-28 22:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-9382-10286@http.bugzilla.kernel.org/>
2007-11-15  3:23 ` [Bugme-new] [Bug 9382] New: etting MTU > 1500 on card "cold" sigsegs the "ip" program and produces an OOPS Andrew Morton
2007-11-15  3:38   ` [PATCH] via-velocity: don't oops on MTU change Stephen Hemminger
2007-11-15  3:48     ` David Miller
2007-11-15  8:26     ` Jarek Poplawski
2007-11-15 18:20       ` Stephen Hemminger
2007-11-15 23:10         ` Jarek Poplawski
2007-11-16  2:42           ` Jon Nelson
2007-11-16  4:05             ` Stephen Hemminger
2007-11-16  4:35             ` Stephen Hemminger
2007-11-16 16:21               ` Jon Nelson
2007-11-16 16:47                 ` Stephen Hemminger
2007-11-17  0:25                   ` David Miller
2007-11-17  0:59                   ` Jon Nelson
2007-11-17 15:04                     ` Jarek Poplawski
2007-11-28 22:02               ` Jon Nelson
2007-11-28 22:20                 ` Stephen Hemminger [this message]
2007-12-01 21:36                   ` [PATCH] via-velocity: don't oops on MTU change (resend) Jeff Garzik

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=20071128142016.0eecbd2c@freepuppy.rosehill \
    --to=shemminger@linux-foundation.org \
    --cc=jarkao2@o2.pl \
    --cc=jgarzik@pobox.com \
    --cc=jnelson@jamponi.net \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).