Commit 72abf217 authored by Harini Katakam's avatar Harini Katakam Committed by David S. Miller

net: macb: Reset TX when TX halt times out

Reset TX when halt times out i.e. disable TX, clean up TX BDs,
interrupts (already done) and enable TX.
This addresses the issue observed when iperf is run at 10Mps Half
duplex where, after multiple collisions and retries, TX halts.
Signed-off-by: default avatarHarini Katakam <harini.katakam@xilinx.com>
Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
Signed-off-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e485f3a6
...@@ -1070,6 +1070,7 @@ static void macb_tx_error_task(struct work_struct *work) ...@@ -1070,6 +1070,7 @@ static void macb_tx_error_task(struct work_struct *work)
{ {
struct macb_queue *queue = container_of(work, struct macb_queue, struct macb_queue *queue = container_of(work, struct macb_queue,
tx_error_task); tx_error_task);
bool halt_timeout = false;
struct macb *bp = queue->bp; struct macb *bp = queue->bp;
struct macb_tx_skb *tx_skb; struct macb_tx_skb *tx_skb;
struct macb_dma_desc *desc; struct macb_dma_desc *desc;
...@@ -1097,9 +1098,11 @@ static void macb_tx_error_task(struct work_struct *work) ...@@ -1097,9 +1098,11 @@ static void macb_tx_error_task(struct work_struct *work)
* (in case we have just queued new packets) * (in case we have just queued new packets)
* macb/gem must be halted to write TBQP register * macb/gem must be halted to write TBQP register
*/ */
if (macb_halt_tx(bp)) if (macb_halt_tx(bp)) {
/* Just complain for now, reinitializing TX path can be good */
netdev_err(bp->dev, "BUG: halt tx timed out\n"); netdev_err(bp->dev, "BUG: halt tx timed out\n");
macb_writel(bp, NCR, macb_readl(bp, NCR) & (~MACB_BIT(TE)));
halt_timeout = true;
}
/* Treat frames in TX queue including the ones that caused the error. /* Treat frames in TX queue including the ones that caused the error.
* Free transmit buffers in upper layer. * Free transmit buffers in upper layer.
...@@ -1170,6 +1173,9 @@ static void macb_tx_error_task(struct work_struct *work) ...@@ -1170,6 +1173,9 @@ static void macb_tx_error_task(struct work_struct *work)
macb_writel(bp, TSR, macb_readl(bp, TSR)); macb_writel(bp, TSR, macb_readl(bp, TSR));
queue_writel(queue, IER, MACB_TX_INT_FLAGS); queue_writel(queue, IER, MACB_TX_INT_FLAGS);
if (halt_timeout)
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TE));
/* Now we are ready to start transmission again */ /* Now we are ready to start transmission again */
netif_tx_start_all_queues(bp->dev); netif_tx_start_all_queues(bp->dev);
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
......
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