Commit 55d7b4e6 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Jeff Garzik

sky2: carrier management

Make sky2 handle carrier similar to other drivers,
eliminate some possible races in carrier state transistions.
Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent c59697e0
...@@ -1265,6 +1265,8 @@ static int sky2_up(struct net_device *dev) ...@@ -1265,6 +1265,8 @@ static int sky2_up(struct net_device *dev)
if (netif_msg_ifup(sky2)) if (netif_msg_ifup(sky2))
printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
netif_carrier_off(dev);
/* must be power of 2 */ /* must be power of 2 */
sky2->tx_le = pci_alloc_consistent(hw->pdev, sky2->tx_le = pci_alloc_consistent(hw->pdev,
TX_RING_SIZE * TX_RING_SIZE *
...@@ -1616,7 +1618,6 @@ static int sky2_down(struct net_device *dev) ...@@ -1616,7 +1618,6 @@ static int sky2_down(struct net_device *dev)
/* Stop more packets from being queued */ /* Stop more packets from being queued */
netif_stop_queue(dev); netif_stop_queue(dev);
netif_carrier_off(dev);
/* Disable port IRQ */ /* Disable port IRQ */
imask = sky2_read32(hw, B0_IMSK); imask = sky2_read32(hw, B0_IMSK);
...@@ -1668,6 +1669,8 @@ static int sky2_down(struct net_device *dev) ...@@ -1668,6 +1669,8 @@ static int sky2_down(struct net_device *dev)
sky2_phy_power(hw, port, 0); sky2_phy_power(hw, port, 0);
netif_carrier_off(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);
...@@ -1732,7 +1735,6 @@ static void sky2_link_up(struct sky2_port *sky2) ...@@ -1732,7 +1735,6 @@ static void sky2_link_up(struct sky2_port *sky2)
gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK);
netif_carrier_on(sky2->netdev); netif_carrier_on(sky2->netdev);
netif_wake_queue(sky2->netdev);
/* Turn on link LED */ /* Turn on link LED */
sky2_write8(hw, SK_REG(port, LNK_LED_REG), sky2_write8(hw, SK_REG(port, LNK_LED_REG),
...@@ -1784,7 +1786,6 @@ static void sky2_link_down(struct sky2_port *sky2) ...@@ -1784,7 +1786,6 @@ static void sky2_link_down(struct sky2_port *sky2)
gma_write16(hw, port, GM_GP_CTRL, reg); gma_write16(hw, port, GM_GP_CTRL, reg);
netif_carrier_off(sky2->netdev); netif_carrier_off(sky2->netdev);
netif_stop_queue(sky2->netdev);
/* Turn on link LED */ /* Turn on link LED */
sky2_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF); sky2_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF);
...@@ -3543,10 +3544,6 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, ...@@ -3543,10 +3544,6 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8, ETH_ALEN); memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8, ETH_ALEN);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
/* device is off until link detection */
netif_carrier_off(dev);
netif_stop_queue(dev);
return dev; return dev;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment