]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
Xilinx: ARM: EmacPs: Fixed issues in Tx Timeout callback
authorAnirudha Sarangi <anirudh@xhdrdevl6.(none)>
Tue, 17 Jul 2012 06:18:33 +0000 (11:48 +0530)
committerJohn Linn <john.linn@xilinx.com>
Tue, 31 Jul 2012 00:18:55 +0000 (17:18 -0700)
The existing Tx timeout was not initializing the MAC with
correct speed and duplex settings. Because of this after
the Tx Timeout the MAC was failing to transmit and receive
ethernet traffic. This patch fixes this issue.

Signed-off-by: Anirudha <anirudh@xilinx.com>
drivers/net/ethernet/xilinx/xilinx_emacps.c

index b6edf74f69ceb9b58fe8067a9da455bcd39f6f5f..e0506a4fcc7ec59163e2495764475608996c2ae6 100755 (executable)
@@ -2189,30 +2189,45 @@ static int xemacps_close(struct net_device *ndev)
  **/
 static void xemacps_tx_timeout(struct net_device *ndev)
 {
-       unsigned long flags;
        struct net_local *lp = netdev_priv(ndev);
        int rc;
 
        printk(KERN_ERR "%s transmit timeout %lu ms, reseting...\n",
                ndev->name, TX_TIMEOUT * 1000UL / HZ);
-       lp->stats.tx_errors++;
-
-       spin_lock_irqsave(&lp->lock, flags);
-
        netif_stop_queue(ndev);
+
+       spin_lock(&lp->lock);
        napi_disable(&lp->napi);
        xemacps_reset_hw(lp);
-       xemacps_clean_rings(lp);
-       rc  = xemacps_setup_ring(lp);
-       if (rc)
-               printk(KERN_ERR "%s Unable to setup BD or rings, rc %d\n",
+       xemacps_descriptor_free(lp);
+       if (lp->phy_dev)
+               phy_stop(lp->phy_dev);
+       rc = xemacps_descriptor_init(lp);
+       if (rc) {
+               printk(KERN_ERR "%s Unable to allocate DMA memory, rc %d\n",
+               ndev->name, rc);
+               spin_unlock(&lp->lock);
+               return;
+       }
+
+       rc = xemacps_setup_ring(lp);
+       if (rc) {
+               printk(KERN_ERR "%s Unable to setup BD rings, rc %d\n",
                ndev->name, rc);
+               spin_unlock(&lp->lock);
+               return;
+       }
        xemacps_init_hw(lp);
-       ndev->trans_start = jiffies;
+
+       lp->link    = 0;
+       lp->speed   = 0;
+       lp->duplex  = -1;
+       if (lp->phy_dev)
+               phy_start(lp->phy_dev);
        napi_enable(&lp->napi);
-       netif_wake_queue(ndev);
 
-       spin_unlock_irqrestore(&lp->lock, flags);
+       spin_unlock(&lp->lock);
+       netif_start_queue(ndev);
 }
 
 /**