Skip to content

Commit 72abf21

Browse files
harini-katakamdavem330
authored andcommitted
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: Harini Katakam <[email protected]> Signed-off-by: Michal Simek <[email protected]> Signed-off-by: Radhey Shyam Pandey <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e485f3a commit 72abf21

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,7 @@ static void macb_tx_error_task(struct work_struct *work)
10701070
{
10711071
struct macb_queue *queue = container_of(work, struct macb_queue,
10721072
tx_error_task);
1073+
bool halt_timeout = false;
10731074
struct macb *bp = queue->bp;
10741075
struct macb_tx_skb *tx_skb;
10751076
struct macb_dma_desc *desc;
@@ -1097,9 +1098,11 @@ static void macb_tx_error_task(struct work_struct *work)
10971098
* (in case we have just queued new packets)
10981099
* macb/gem must be halted to write TBQP register
10991100
*/
1100-
if (macb_halt_tx(bp))
1101-
/* Just complain for now, reinitializing TX path can be good */
1101+
if (macb_halt_tx(bp)) {
11021102
netdev_err(bp->dev, "BUG: halt tx timed out\n");
1103+
macb_writel(bp, NCR, macb_readl(bp, NCR) & (~MACB_BIT(TE)));
1104+
halt_timeout = true;
1105+
}
11031106

11041107
/* Treat frames in TX queue including the ones that caused the error.
11051108
* Free transmit buffers in upper layer.
@@ -1170,6 +1173,9 @@ static void macb_tx_error_task(struct work_struct *work)
11701173
macb_writel(bp, TSR, macb_readl(bp, TSR));
11711174
queue_writel(queue, IER, MACB_TX_INT_FLAGS);
11721175

1176+
if (halt_timeout)
1177+
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TE));
1178+
11731179
/* Now we are ready to start transmission again */
11741180
netif_tx_start_all_queues(bp->dev);
11751181
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));

0 commit comments

Comments
 (0)