aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-11-28 17:25:05 -0500
committerJeff Garzik <jeff@garzik.org>2007-12-01 16:32:30 -0500
commit1a8098be987d3fa00c9fe9d2b68154675df49112 (patch)
tree3e28b7e5d2de30da8c7be5f75374a364a63b9cec
parent44c7fccec4098772b9451a252d162faea4f0cc34 (diff)
skge: MTU changing fix
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> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/skge.c35
1 files changed, 2 insertions, 33 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 53d2059a6604..186eb8ebfda6 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2896,11 +2896,7 @@ static void skge_tx_timeout(struct net_device *dev)
2896 2896
2897static int skge_change_mtu(struct net_device *dev, int new_mtu) 2897static int skge_change_mtu(struct net_device *dev, int new_mtu)
2898{ 2898{
2899 struct skge_port *skge = netdev_priv(dev);
2900 struct skge_hw *hw = skge->hw;
2901 int port = skge->port;
2902 int err; 2899 int err;
2903 u16 ctl, reg;
2904 2900
2905 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) 2901 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
2906 return -EINVAL; 2902 return -EINVAL;
@@ -2910,40 +2906,13 @@ static int skge_change_mtu(struct net_device *dev, int new_mtu)
2910 return 0; 2906 return 0;
2911 } 2907 }
2912 2908
2913 skge_write32(hw, B0_IMSK, 0); 2909 skge_down(dev);
2914 dev->trans_start = jiffies; /* prevent tx timeout */
2915 netif_stop_queue(dev);
2916 napi_disable(&skge->napi);
2917
2918 ctl = gma_read16(hw, port, GM_GP_CTRL);
2919 gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA);
2920
2921 skge_rx_clean(skge);
2922 skge_rx_stop(hw, port);
2923 2910
2924 dev->mtu = new_mtu; 2911 dev->mtu = new_mtu;
2925 2912
2926 reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); 2913 err = skge_up(dev);
2927 if (new_mtu > 1500)
2928 reg |= GM_SMOD_JUMBO_ENA;
2929 gma_write16(hw, port, GM_SERIAL_MODE, reg);
2930
2931 skge_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD);
2932
2933 err = skge_rx_fill(dev);
2934 wmb();
2935 if (!err)
2936 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
2937 skge_write32(hw, B0_IMSK, hw->intr_mask);
2938
2939 if (err) 2914 if (err)
2940 dev_close(dev); 2915 dev_close(dev);
2941 else {
2942 gma_write16(hw, port, GM_GP_CTRL, ctl);
2943
2944 napi_enable(&skge->napi);
2945 netif_wake_queue(dev);
2946 }
2947 2916
2948 return err; 2917 return err;
2949} 2918}