ath79: ag71xx: Fix tx queue timeouts during ifup
[openwrt/openwrt.git] / target / linux / ath79 / files / drivers / net / ethernet / atheros / ag71xx / ag71xx_main.c
index 70ca0248c35f8d8998f32d7fb6d3fc04241491f5..d809bbee802f3ffe6452c0c0129ad0aa7b6d607f 100644 (file)
@@ -805,10 +805,19 @@ err:
 
 static int ag71xx_stop(struct net_device *dev)
 {
 
 static int ag71xx_stop(struct net_device *dev)
 {
+       unsigned long flags;
        struct ag71xx *ag = netdev_priv(dev);
 
        netif_carrier_off(dev);
        phy_stop(ag->phy_dev);
        struct ag71xx *ag = netdev_priv(dev);
 
        netif_carrier_off(dev);
        phy_stop(ag->phy_dev);
+
+       spin_lock_irqsave(&ag->lock, flags);
+       if (ag->link) {
+               ag->link = 0;
+               ag71xx_link_adjust(ag);
+       }
+       spin_unlock_irqrestore(&ag->lock, flags);
+
        ag71xx_hw_disable(ag);
 
        return 0;
        ag71xx_hw_disable(ag);
 
        return 0;