Skip to content

Commit ba4b202

Browse files
net: macb: gate TX stall watchdog on netif_carrier_ok, use warn_ratelimited
Commit 79dc190 ("net: macb: add TX stall watchdog as defence-in-depth safety net") added a per-queue 1 Hz delayed_work that fires macb_tx_restart() if tx_tail has not advanced. Two operational follow-ups: 1. Boot-time false positive. Between macb_open() and link autoneg completion, queue->tx_head can advance from kernel-queued packets while tx_tail stays at 0 because no TCOMPs have arrived yet. The first watchdog tick at +1000 ms then trips its head!=tail check and fires a spurious TX-stall warning + re-kick. Observed at ~25% rate during fleet rolling reboots (6 of 24 nodes, all tail=0 head=5-7). The re-kick itself is harmless on a healthy ring (macb_tx_restart() verifies TBQP vs head before re-asserting TSTART), but the warning is noise and confuses operators who read it as a real silent-stall event. Gate the stall check on netif_carrier_ok(). No carrier means no completion is possible, so skipping the check is safe; the watchdog still ticks so it picks up immediately once carrier comes up. 2. netdev_warn_once() limits visibility to one event per netdev lifetime, which is fine for a warn-once defensive log but defeats any operator accounting of real stall events on long-running nodes. Switch to pr_warn_ratelimited() with an explicit netdev_name() prefix: bounded log noise, the events stay visible in the journal for accounting, and it avoids netdev_warn_ratelimited() which is not available in this tree. This is the rpi-6.18.y portion of the v2 follow-up to the netdev RFC submission; the mainline v2 is on lore: https://lore.kernel.org/netdev/cover.1777064117.git.lukasz@raczylo.com/T/ Co-authored-by: John Laur <johnlaur@gmail.com> Signed-off-by: Lukasz Raczylo <lukasz@raczylo.com>
1 parent 2c929ca commit ba4b202

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,6 +2075,16 @@ static void macb_tx_stall_watchdog(struct work_struct *work)
20752075
if (!netif_running(bp->dev))
20762076
return;
20772077

2078+
/* No carrier => no completion is possible. Skip the stall
2079+
* check (otherwise queue->tx_head can advance from kernel-
2080+
* queued packets between macb_open() and link autoneg
2081+
* completion while tx_tail stays unchanged, tripping a false
2082+
* positive), but keep the watchdog ticking so it picks up
2083+
* once carrier comes up.
2084+
*/
2085+
if (!netif_carrier_ok(bp->dev))
2086+
goto reschedule;
2087+
20782088
spin_lock_irqsave(&queue->tx_ptr_lock, flags);
20792089
cur_tail = queue->tx_tail;
20802090
cur_head = queue->tx_head;
@@ -2084,13 +2094,14 @@ static void macb_tx_stall_watchdog(struct work_struct *work)
20842094
spin_unlock_irqrestore(&queue->tx_ptr_lock, flags);
20852095

20862096
if (stalled) {
2087-
netdev_warn_once(bp->dev,
2088-
"TX stall detected on queue %u (tail=%u head=%u); re-kicking TSTART\n",
2089-
(unsigned int)(queue - bp->queues),
2090-
cur_tail, cur_head);
2097+
pr_warn_ratelimited("%s: TX stall detected on queue %u (tail=%u head=%u); re-kicking TSTART\n",
2098+
netdev_name(bp->dev),
2099+
(unsigned int)(queue - bp->queues),
2100+
cur_tail, cur_head);
20912101
macb_tx_restart(queue);
20922102
}
20932103

2104+
reschedule:
20942105
schedule_delayed_work(&queue->tx_stall_watchdog_work,
20952106
msecs_to_jiffies(MACB_TX_STALL_INTERVAL_MS));
20962107
}

0 commit comments

Comments
 (0)