intel: fix a Tx hang at boot on I219 and Tx hang recovery
Subsystems (4)
cover intel: fix a Tx hang at boot on I219 and Tx hang recovery
We've been seeing some rare hangs of the I219-LM nics in some of our boards after boot. We ran some longer investigation on many test devices and found fixes for both the hang on boot and the recovery not working.
Patch 1 fixes I219 occasionally ignoring the global MAC reset.
Patch 2 fixes why such a hang, or any other e1000e Tx hang, never
recovers: since v6.12 every hang report refreshes trans_start, so dev_watchdog() never calls ndo_tx_timeout.
Patches 3 to 5 make the same change in igb, igc and e1000, which stop the queue on every hang report too. e1000 is affected like e1000e. igb and igc currently recover in most cases, because their watchdog no longer forces an interrupt every two seconds (a22ed15c99a0 and 8dcf2c212078, "Get rid of spurious interrupts"), but stable trees without those commits never recover, and with them recovery still depends on a stopped queue seeing no interrupt for 5 s.
Drivers that never recover from a Tx hang, per supported kernel:
mainline, 6.18: e1000e, e1000 6.12: e1000e, e1000, igb 6.6, 6.1: e1000e, e1000, igb, igc
The lost reset fixed by patch 1 is in all of them.
Patches 1 and 2 were tested on hardware with a kernel based on v7.2.13 and with net at 5e9b2ad9b838 (v7.4-rc2), both with PREEMPT_RT=y. Patches 3 and 4 were tested on hardware with the same net kernel, patch 5 only in QEMU.
I used an llm to both run the test series on our testracks and draft fix commits.
---
Steffen Dirkwinkel (5):
e1000e: retry a global reset the I219 didn't apply
e1000e: let dev_watchdog reset the adapter after a Tx hang
igb: let dev_watchdog reset the adapter after a Tx hang
igc: let dev_watchdog reset the adapter after a Tx hang
e1000: let dev_watchdog reset the adapter after a Tx hang
drivers/net/ethernet/intel/e1000/e1000_main.c | 9 ++++++++- drivers/net/ethernet/intel/e1000e/ich8lan.c | 27 +++++++++++++++++++++++---- drivers/net/ethernet/intel/e1000e/netdev.c | 8 ++++++-- drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++++++-- drivers/net/ethernet/intel/igc/igc_main.c | 11 +++++++++-- 5 files changed, 55 insertions(+), 11 deletions(-)
---
base-commit: af6737b9066832a2017c281159950ba92385ce00
change-id: 20261102-e1000e-tx-hang-dee96c03c7f6
Best regards,
Signature · 1 line
Steffen Dirkwinkel <[email protected]>
PATCH 1/5 e1000e: retry a global reset the I219 didn't apply
From: Steffen Dirkwinkel <[email protected]>
On the Beckhoff CB7268 (Cannon Point-LP PCH) and CB3067 (Q370 PCH) boards with an I219-LM (8086:15b7), Tx sometimes hangs for good right after boot: "Detected Hardware Unit Hang" with TDH 0 and TDT 1. This was observed in the field and reproduced in CI, where about one in 140 cold boots hung.
e1000_reset_hw_ich8lan() sets CTRL.GIO_MASTER_DISABLE through e1000e_disable_pcie_master() and relies on the global reset to clear it. On these boards the MAC occasionally ignores the reset: 20 ms later CTRL still holds its old value, GIO_MASTER_DISABLE included. A debug kernel that resets the MAC in a loop lost up to 7% of back-to-back resets and still some with 20 ms between them.
Check GIO_MASTER_DISABLE after the reset and issue the reset up to two more times. In 122 lost resets the first retry always took.
Tested by power cycling affected devices: 13 of 1816 boots hung without this change and 0 of 2830 with it, where 19 lost resets were retried.
--- drivers/net/ethernet/intel/e1000e/ich8lan.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/e1000e/ich8lan.c +23 -4
@@ -4834,9 +4834,11 @@ static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw)static s32 e1000_reset_hw_ich8lan (struct e1000_hw *hw) {struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; +struct e1000_adapter *adapter = hw->adapter;u16 kum_cfg;u32 ctrl, reg;s32 ret_val; +int tries;/* Prevent the PCI-E bus from sticking if there is no TLP connection * on the last TLP read/write transaction when MAC is reset.
@@ -4895,10 +4897,27 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)e1000_gate_hw_phy_config_ich8lan (hw, true); } ret_val =e1000_acquire_swflag_ich8lan (hw); -e_dbg ("Issuing a global reset to ich8lan\n" ); -ew32 (CTRL , (ctrl |E1000_CTRL_RST )); -/* cannot issue a flush here because it hangs the hardware */ -msleep (20 ); +for (tries =0 ; ; tries++) { +e_dbg ("Issuing a global reset to ich8lan\n" ); +ew32 (CTRL , (ctrl |E1000_CTRL_RST )); +/* cannot issue a flush here because it hangs the hardware */ +msleep (20 ); + +/* Some I219 occasionally ignore the reset of the MAC, mostly +* right after a previous reset, and CTRL keeps its value. +* GIO_MASTER_DISABLE then stays set from +* e1000e_disable_pcie_master() above, so the MAC can't fetch +* descriptors and Tx hangs. Issue the reset again. +*/ + reg =er32 (CTRL ); +if (!(reg &E1000_CTRL_GIO_MASTER_DISABLE ) || tries >=2 ) +break ; +e_warn ("Global reset not applied (CTRL 0x%08x), retrying\n" , + reg); + } +if (reg &E1000_CTRL_GIO_MASTER_DISABLE ) +e_err ("Global reset not applied after %d tries (CTRL 0x%08x)\n" , + tries +1 , reg);/* Set Phy Config Counter to 50msec */ if (hw->mac.type == e1000_pch2lan) {
Signature · 1 line
2.56.1
PATCH 2/5 e1000e: let dev_watchdog reset the adapter after a Tx hang
In reply to Steffen DirkwinkelFrom: Steffen Dirkwinkel <[email protected]>
When e1000e detects a Tx hang it stops the queue and relies on dev_watchdog() to call e1000_tx_timeout(), which resets the adapter. While the hang lasts it is reported every two seconds, and every report stops the queue again. Since commit 95ecba62e2fd ("net: fix races in netdev_tx_sent_queue()/dev_watchdog()") netif_tx_stop_queue() also writes trans_start, so the 5 s watchdog timeout never expires and a hung adapter stays offline until the link is cycled by hand.
This was observed on a laptop with an I219-LM (8086:550a) running v6.19: a Tx hang lasted 104 minutes, with 3120 hang reports and no "NETDEV WATCHDOG" message, until the link was set down and up.
Stop the queue only if it isn't stopped yet. netif_tx_stop_queue() has to write trans_start to close the race that commit fixed, so it is left as it is.
Tested with error injection: setting CTRL.GIO_MASTER_DISABLE stalls Tx. With this change, I219-LM devices (8086:15b7 and 8086:15f9) were reachable again after 11 to 17 s in 24 of 24 tries. Without it, an 8086:15b7 device stayed offline in 8 of 8.
igb, igc and e1000 stop the queue in the same way and get the same change in the following patches.
--- drivers/net/ethernet/intel/e1000e/netdev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +6 -2
@@ -1144,8 +1144,12 @@ static void e1000_print_hw_hang(struct work_struct *work)return ; } -/* Real hang detected */ -netif_stop_queue (netdev); +/* Real hang detected. The hang is reported every two seconds, but +* stop the queue only once: stopping it again would also restart +* the Tx timeout, so dev_watchdog() would never reset the adapter. +*/ +if (!netif_queue_stopped (netdev)) +netif_stop_queue (netdev);e1e_rphy (hw,MII_BMSR , &phy_status);e1e_rphy (hw,MII_STAT1000 , &phy_1000t_status);
Signature · 1 line
2.56.1
PATCH 3/5 igb: let dev_watchdog reset the adapter after a Tx hang
In reply to Steffen DirkwinkelFrom: Steffen Dirkwinkel <[email protected]>
Like e1000e, igb stops the queue on every Tx hang report and relies on dev_watchdog() to reset the adapter. Since commit 95ecba62e2fd ("net:
fix races in netdev_tx_sent_queue()/dev_watchdog()") every stop also writes trans_start, so the watchdog timeout can't expire as long as the hang is reported again in time.
Until commit a22ed15c99a0 ("igb: Get rid of spurious interrupts") the igb watchdog forced an interrupt every two seconds, so the hang was reported every two seconds and the adapter was never reset. Since then a report needs an interrupt from traffic, and the adapter is reset only if a stopped queue sees none for 5 s.
Stop the queue only if it isn't stopped yet.
Found by code inspection after the same problem in e1000e. Tested on an I210 with the Tx queues disabled through TXDCTL and that commit
reverted: without this change Tx never recovered in 8 of 8 tries, with it the watchdog reset the adapter after 15 s in 8 of 8. With unmodified interrupt handling Tx recovered with and without this change.
--- drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +9 -2
@@ -8484,8 +8484,15 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector, int napi_budget) tx_buffer->next_to_watch, jiffies, tx_buffer->next_to_watch->wb.status); -netif_stop_subqueue (tx_ring->netdev, - tx_ring->queue_index); +/* The hang is reported again on every watchdog run, +* but stop the queue only once: stopping it again +* would also restart the Tx timeout, so dev_watchdog() +* would never reset the adapter. +*/ +if (!__netif_subqueue_stopped (tx_ring->netdev, + tx_ring->queue_index)) +netif_stop_subqueue (tx_ring->netdev, + tx_ring->queue_index);/* we are about to reset, no point in enabling stuff */ return true;
Signature · 1 line
2.56.1
PATCH 4/5 igc: let dev_watchdog reset the adapter after a Tx hang
In reply to Steffen DirkwinkelFrom: Steffen Dirkwinkel <[email protected]>
Like e1000e and igb, igc stops the queue on every Tx hang report and relies on dev_watchdog() to reset the adapter. Since commit 95ecba62e2fd ("net: fix races in netdev_tx_sent_queue()/dev_watchdog()") every stop also writes trans_start, so the watchdog timeout can't expire as long as the hang is reported again in time.
Since commit 8dcf2c212078 ("igc: Get rid of spurious interrupts") a report needs an interrupt from traffic, and the adapter is reset only if a stopped queue sees none for 5 s. The 6.1 and 6.6 stable trees have the first commit but not the second: there the igc watchdog forces an interrupt every two seconds and the adapter is never reset.
Stop the queue only if it isn't stopped yet.
Found by code inspection after the same problem in e1000e. Tested on an I226-IT with the Tx queues disabled through TXDCTL and the second commit reverted: without this change Tx never recovered in 8 of 8 tries, with it the watchdog reset the adapter after 14 to 17 s in 8 of
8. With unmodified interrupt handling Tx recovered with and without this change.
--- drivers/net/ethernet/intel/igc/igc_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +9 -2
@@ -3281,8 +3281,15 @@ static bool igc_clean_tx_irq(struct igc_q_vector *q_vector, int napi_budget) tx_buffer->next_to_watch, jiffies, tx_buffer->next_to_watch->wb.status); -netif_stop_subqueue (tx_ring->netdev, - tx_ring->queue_index); +/* The hang is reported again on every watchdog run, +* but stop the queue only once: stopping it again +* would also restart the Tx timeout, so dev_watchdog() +* would never reset the adapter. +*/ +if (!__netif_subqueue_stopped (tx_ring->netdev, + tx_ring->queue_index)) +netif_stop_subqueue (tx_ring->netdev, + tx_ring->queue_index);/* we are about to reset, no point in enabling stuff */ return true;
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH iwl-net 4/5] igc: let dev_watchdog reset the adapter after a Tx hang
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] igc: permanent Tx queue deadlock in…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] igc: permanent Tx queue deadlock in igc_clean_tx_irq() [1] --
commit c5dcfb32c435e778dcb0ad6b827b371a99667e5b
Author: Steffen Dirkwinkel <[email protected]>
igc: let dev_watchdog reset the adapter after a Tx hang
This commit checks whether a Tx subqueue is already stopped before stopping it upon detecting a Tx unit hang in igc_clean_tx_irq(), so repeated hang reports do not keep resetting trans_start and preventing dev_watchdog() from resetting the adapter.
Quoted 12 lines
drivers/net/ethernet/intel/igc/igc_main.c +2
-2@@ -3281,8 +3281,15 @@ static bool igc_clean_tx_irq(struct igc_q_vector *q_vector, int napi_budget) tx_buffer->next_to_watch, jiffies, tx_buffer->next_to_watch->wb.status); -netif_stop_subqueue (tx_ring->netdev, - tx_ring->queue_index); +/* The hang is reported again on every watchdog run, +* but stop the queue only once: stopping it again
drivers/net/ethernet/intel/igc/igc_main.c static bool igc_clean_tx_irq(struct igc_q_vector *q_vector, int napi_budget) · line 3295
Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_main.c +7
-0+* would also restart the Tx timeout, so dev_watchdog() +* would never reset the adapter. +*/ +if (!__netif_subqueue_stopped (tx_ring->netdev, + tx_ring->queue_index)) +netif_stop_subqueue (tx_ring->netdev, + tx_ring->queue_index);/* we are about to reset, no point in enabling stuff */ return true;
[Severity: High]
This problem wasn't introduced by this patch, but can a stopped Tx subqueue remain permanently stalled in igc_clean_tx_irq() [1] when CONFIG_MAX_SKB_FRAGS is large (such as 45 for BIG TCP) and the ring is sized to IGC_MIN_TXD (64)?
A couple of lines below this hunk, igc_clean_tx_irq() only wakes a stopped subqueue when igc_desc_unused(tx_ring) reaches TX_WAKE_THRESHOLD:
drivers/net/ethernet/intel/igc/igc_main.c:igc_clean_tx_irq() {
...
#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
if (unlikely(total_packets &&
netif_carrier_ok(tx_ring->netdev) &&
igc_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD)) {
...
}Because DESC_NEEDED is (MAX_SKB_FRAGS + 4), CONFIG_MAX_SKB_FRAGS=45 makes TX_WAKE_THRESHOLD 98, while igc_desc_unused() on a 64-descriptor ring is at most 63. Once igc_maybe_stop_tx() stops the queue, the wake condition can never be satisfied and the queue stays stopped until a Tx watchdog timeout.
[1] https://sashiko.dev/#/bug/linux-8616c413-3d5c-4d57-9eda-b2849ebf6eb4
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Re: [PATCH iwl-net 4/5] igc: let dev_watchdog reset the adapter after a Tx hang
Quoted 36 lines · On Tue, 2026-11-24 at 09:56 +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] igc: permanent Tx queue deadlock inigc_clean_tx_irq()[1] --commit
c5dcfb32c435e778dcb0ad6b827b371a99667e5b
Author: Steffen Dirkwinkel <[email protected]>igc: let
dev_watchdogreset the adapter after a Tx hangThis commit checks whether a Tx subqueue is already stopped before stopping it upon detecting a Tx unit hang in
igc_clean_tx_irq(), so repeated hang reports do not keep resettingtrans_startand preventingdev_watchdog()from resetting the adapter.Quoted 20 lines
drivers/net/ethernet/intel/igc/igc_main.c +9
-2@@ -3281,8 +3281,15 @@ static bool igc_clean_tx_irq(struct igc_q_vector *q_vector, int napi_budget) tx_buffer->next_to_watch, jiffies, tx_buffer->next_to_watch->wb.status); -netif_stop_subqueue (tx_ring->netdev, - tx_ring->queue_index); +/* The hang is reported again on every watchdog run, +* but stop the queue only once: stopping it again +* would also restart the Tx timeout, so dev_watchdog() +* would never reset the adapter. +*/ +if (!__netif_subqueue_stopped (tx_ring->netdev, + tx_ring->queue_index)) +netif_stop_subqueue (tx_ring->netdev, + tx_ring->queue_index);
Quoted 8 lines
drivers/net/ethernet/intel/igc/igc_main.c static bool igc_clean_tx_irq(struct igc_q_vector *q_vector, int napi_budget) · line 3295
Quoted 2 lines
drivers/net/ethernet/intel/igc/igc_main.c +0
-0/* we are about to reset, no point in enabling stuff */ return true;[Severity: High]
This problem wasn't introduced by this patch, but can a stopped Tx subqueue remain permanently stalled inigc_clean_tx_irq()[1] whenCONFIG_MAX_SKB_FRAGSis large (such as 45 for BIG TCP) and the ring is sized toIGC_MIN_TXD(64)?
This is a problem and I can reproduce it on igc (I226) with CONFIG_MAX_SKB_FRAGS=45 and "ethtool -G <if> tx 64".
This isn't a default config and isn't related to the patches though. I can send a separate patch to fix it if desired.
Quoted 19 lines
A couple of lines below this hunk,
igc_clean_tx_irq()only wakes a stopped subqueue whenigc_desc_unused(tx_ring)reachesTX_WAKE_THRESHOLD:drivers/net/ethernet/intel/igc/igc_main.c:igc_clean_tx_irq() { ... #define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) if (unlikely(total_packets && netif_carrier_ok(tx_ring->netdev) && igc_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD)) { ... }Because
DESC_NEEDEDis (MAX_SKB_FRAGS+ 4),CONFIG_MAX_SKB_FRAGS=45makesTX_WAKE_THRESHOLD98, whileigc_desc_unused()on a 64-descriptor ring is at most 63. Onceigc_maybe_stop_tx()stops the queue, the wake condition can never be satisfied and the queue stays stopped until a Tx watchdog timeout.[1] https://sashiko.dev/#/bug/linux-8616c413-3d5c-4d57-9eda-b2849ebf6eb4
PATCH 5/5 e1000: let dev_watchdog reset the adapter after a Tx hang
In reply to Steffen DirkwinkelFrom: Steffen Dirkwinkel <[email protected]>
Like e1000e, e1000 stops the queue on every Tx hang report and relies on dev_watchdog() to reset the adapter. Its watchdog forces an interrupt every two seconds, so the hang is reported every two seconds. Since commit 95ecba62e2fd ("net: fix races in netdev_tx_sent_queue()/dev_watchdog()") every stop also writes trans_start, so the 5 s watchdog timeout never expires and the adapter is never reset.
Stop the queue only if it isn't stopped yet.
Found by code inspection after the same problem in e1000e. Tested in QEMU (e1000) with TCTL.EN cleared to stall Tx: without this change the device never recovered, with it the watchdog reset it after about 10 s, in 3 of 3 runs each. Not tested on hardware.
--- drivers/net/ethernet/intel/e1000/e1000_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000/e1000_main.c +8 -1
@@ -3925,7 +3925,14 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, jiffies, eop_desc->upper.fields.status);e1000_dump (adapter); -netif_stop_queue (netdev); + +/* The hang is reported again on every watchdog run, +* but stop the queue only once: stopping it again +* would also restart the Tx timeout, so dev_watchdog() +* would never reset the adapter. +*/ +if (!netif_queue_stopped (netdev)) +netif_stop_queue (netdev); } } adapter->total_tx_bytes += total_tx_bytes;
Signature · 1 line
2.56.1