提交 018d1c66 编写于 作者: S shemminger@osdl.org 提交者: Jeff Garzik

[PATCH] sky2: race with MTU change

Avoid possible race conditions when doing MTU and change and shutdown.
Signed-off-by: NStephen Hemminger <shemminger@osdl.org>
Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
上级 0a122576
...@@ -1298,8 +1298,16 @@ static int sky2_down(struct net_device *dev) ...@@ -1298,8 +1298,16 @@ static int sky2_down(struct net_device *dev)
if (netif_msg_ifdown(sky2)) if (netif_msg_ifdown(sky2))
printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
/* Stop more packets from being queued */
netif_stop_queue(dev); netif_stop_queue(dev);
/* Disable port IRQ */
local_irq_disable();
hw->intr_mask &= ~((sky2->port == 0) ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2);
sky2_write32(hw, B0_IMSK, hw->intr_mask);
local_irq_enable();
sky2_phy_reset(hw, port); sky2_phy_reset(hw, port);
/* Stop transmitter */ /* Stop transmitter */
...@@ -1346,6 +1354,8 @@ static int sky2_down(struct net_device *dev) ...@@ -1346,6 +1354,8 @@ static int sky2_down(struct net_device *dev)
/* turn off LED's */ /* turn off LED's */
sky2_write16(hw, B0_Y2LED, LED_STAT_OFF); sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);
synchronize_irq(hw->pdev->irq);
sky2_tx_clean(sky2); sky2_tx_clean(sky2);
sky2_rx_clean(sky2); sky2_rx_clean(sky2);
...@@ -1586,9 +1596,12 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1586,9 +1596,12 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
return 0; return 0;
} }
local_irq_disable();
sky2_write32(hw, B0_IMSK, 0); sky2_write32(hw, B0_IMSK, 0);
dev->trans_start = jiffies; /* prevent tx timeout */
netif_stop_queue(dev);
netif_poll_disable(hw->dev[0]);
ctl = gma_read16(hw, sky2->port, GM_GP_CTRL); ctl = gma_read16(hw, sky2->port, GM_GP_CTRL);
gma_write16(hw, sky2->port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA); gma_write16(hw, sky2->port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA);
sky2_rx_stop(sky2); sky2_rx_stop(sky2);
...@@ -1608,9 +1621,10 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1608,9 +1621,10 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
err = sky2_rx_start(sky2); err = sky2_rx_start(sky2);
gma_write16(hw, sky2->port, GM_GP_CTRL, ctl); gma_write16(hw, sky2->port, GM_GP_CTRL, ctl);
netif_poll_disable(hw->dev[0]);
netif_wake_queue(dev);
sky2_write32(hw, B0_IMSK, hw->intr_mask); sky2_write32(hw, B0_IMSK, hw->intr_mask);
sky2_read32(hw, B0_IMSK);
local_irq_enable();
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册