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: netdev@vger.kernel.org
Subject: [PATCH 2/2] skge: MTU changing fix
Date: Wed, 28 Nov 2007 14:25:05 -0800	[thread overview]
Message-ID: <20071128142505.2018aa73@freepuppy.rosehill> (raw)
In-Reply-To: <20071128142301.116526f4@freepuppy.rosehill>

The code to change MTU doesn't correctly handle all the chip variations
and requirements for restarting.  On Genesis chips changing MTU would just
cause receiver to hang.
Use a simpler approach of just taking link down/up if needed.

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

Please apply to 2.6.24 (upstream-fixes).

--- a/drivers/net/skge.c	2007-11-28 11:49:15.000000000 -0800
+++ b/drivers/net/skge.c	2007-11-28 11:49:48.000000000 -0800
@@ -2896,11 +2896,7 @@ static void skge_tx_timeout(struct net_d
 
 static int skge_change_mtu(struct net_device *dev, int new_mtu)
 {
-	struct skge_port *skge = netdev_priv(dev);
-	struct skge_hw *hw = skge->hw;
-	int port = skge->port;
 	int err;
-	u16 ctl, reg;
 
 	if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
 		return -EINVAL;
@@ -2910,40 +2906,13 @@ static int skge_change_mtu(struct net_de
 		return 0;
 	}
 
-	skge_write32(hw, B0_IMSK, 0);
-	dev->trans_start = jiffies;	/* prevent tx timeout */
-	netif_stop_queue(dev);
-	napi_disable(&skge->napi);
-
-	ctl = gma_read16(hw, port, GM_GP_CTRL);
-	gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA);
-
-	skge_rx_clean(skge);
-	skge_rx_stop(hw, port);
+	skge_down(dev);
 
 	dev->mtu = new_mtu;
 
-	reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF);
-	if (new_mtu > 1500)
-		reg |= GM_SMOD_JUMBO_ENA;
-	gma_write16(hw, port, GM_SERIAL_MODE, reg);
-
-	skge_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD);
-
-	err = skge_rx_fill(dev);
-	wmb();
-	if (!err)
-		skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
-	skge_write32(hw, B0_IMSK, hw->intr_mask);
-
+	err = skge_up(dev);
 	if (err)
 		dev_close(dev);
-	else {
-		gma_write16(hw, port, GM_GP_CTRL, ctl);
-
-		napi_enable(&skge->napi);
-		netif_wake_queue(dev);
-	}
 
 	return err;
 }

      reply	other threads:[~2007-11-28 23:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 19:54 [PATCH 0/6] skge update (for 2.6.24) Stephen Hemminger
2007-11-26 19:54 ` [PATCH 1/6] skge: FIFO Ram calculation error Stephen Hemminger
2007-12-01 21:33   ` Jeff Garzik
2007-11-26 19:54 ` [PATCH 2/6] skge: receive flush logic Stephen Hemminger
2007-11-26 19:54 ` [PATCH 3/6] skge: retry on MAC shutdown Stephen Hemminger
2007-11-26 19:54 ` [PATCH 4/6] skge: fiber link up/down fix Stephen Hemminger
2007-11-26 19:54 ` [PATCH 5/6] skge: increase TX threshold for Jumbo Stephen Hemminger
2007-11-26 19:54 ` [PATCH 6/6] skge version 1.13 Stephen Hemminger
2007-11-28 22:23   ` [PATCH 1/2] skge: serial mode register values Stephen Hemminger
2007-11-28 22:25     ` Stephen Hemminger [this message]

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=20071128142505.2018aa73@freepuppy.rosehill \
    --to=shemminger@linux-foundation.org \
    --cc=jgarzik@pobox.com \
    --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).