patch 'net/txgbe: fix SFP hotplug when auto-negotiation is on' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:04:35 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/0966e9ea37ea0b0d4006bab5dabe688662e708c7
Thanks.
Kevin
---
>From 0966e9ea37ea0b0d4006bab5dabe688662e708c7 Mon Sep 17 00:00:00 2001
From: Zaiyu Wang <zaiyuwang at trustnetic.com>
Date: Wed, 28 Oct 2026 18:33:58 +0800
Subject: [PATCH] net/txgbe: fix SFP hotplug when auto-negotiation is on
[ upstream commit 31afa8a4034ae3cb907940931a1ff648c8f930a5 ]
When a port is started before the DAC cable is plugged in,
hot-plugging the cable never brings the link up and the port has to
be stopped and started again.
The AN73 watchdog txgbe_dev_e56_check_bp_event() is armed once in
txgbe_dev_start(). Its first tick finds no module, so
txgbe_xpcs_an_enabled() returns false and the handler returns without
re-arming itself. Once the cable is inserted, nobody polls the AN73
completion any more and the link stays down.
Re-arm the watchdog from txgbe_dev_detect_sfp() once a module has
been identified, cancelling any pending instance first so that only
one of them is running at a time. On the removal path, drop the
cached SFP type and cancel the watchdog. Also sample the
module-present pin (GPIO_EXT bit 2 on 25G, bit 4 on 40G) on every
watchdog tick, so that pulling the cable is noticed even if no GPIO
interrupt is delivered.
The SFP detection alarm and the AN73 watchdog are gated on a per-port
flag, set in txgbe_dev_start() before arming and cleared in
txgbe_dev_stop() before cancelling, so a handler already running on
the alarm thread cannot re-arm on a port being stopped. The flag goes
low first because hw->adapter_stopped is only set at the end of
txgbe_dev_stop(). Cancel the AML link alarm again after joining the
link thread, which can arm it while the stop is waiting.
Fixes: 234ce0d1fa9d ("net/txgbe: fix link stability for Amber-Lite backplane mode")
Signed-off-by: Zaiyu Wang <zaiyuwang at trustnetic.com>
---
drivers/net/txgbe/txgbe_ethdev.c | 61 ++++++++++++++++++++++++++++++--
drivers/net/txgbe/txgbe_ethdev.h | 2 ++
2 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index b7a3598a57..23f5832a93 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -1750,4 +1750,5 @@ static int
txgbe_dev_start(struct rte_eth_dev *dev)
{
+ struct txgbe_adapter *adapter = TXGBE_DEV_ADAPTER(dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
struct txgbe_hw_stats *hw_stats = TXGBE_DEV_STATS(dev);
@@ -2016,4 +2017,6 @@ skip_link_setup:
/* enable uio/vfio intr/eventfd mapping */
+ rte_atomic_store_explicit(&adapter->sfp_an_alarm_enabled, 1,
+ rte_memory_order_release);
rte_intr_enable(intr_handle);
@@ -2073,4 +2076,10 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
+ rte_atomic_store_explicit(&adapter->sfp_an_alarm_enabled, 0,
+ rte_memory_order_release);
+
+ /* Stop the producer before the watchdog it can arm. */
+ rte_eal_alarm_cancel(txgbe_dev_detect_sfp, dev);
+
if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40) {
rte_eal_alarm_cancel(txgbe_dev_e56_check_bp_event, dev);
@@ -2079,7 +2088,8 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
}
- rte_eal_alarm_cancel(txgbe_dev_detect_sfp, dev);
rte_eal_alarm_cancel(txgbe_tx_queue_clear_error, dev);
txgbe_dev_wait_setup_link_complete(dev, 0);
+ if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40)
+ rte_eal_alarm_cancel(txgbe_dev_setup_link_alarm_handler_aml, hw);
/* disable interrupts */
@@ -2990,4 +3000,5 @@ void txgbe_dev_e56_check_bp_event(void *param)
{
struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+ struct txgbe_adapter *adapter = TXGBE_DEV_ADAPTER(dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
u32 an_int1 = 0, value = 0, fsm = 0;
@@ -2999,4 +3010,25 @@ void txgbe_dev_e56_check_bp_event(void *param)
return;
+ if (rte_atomic_load_explicit(&adapter->sfp_an_alarm_enabled,
+ rte_memory_order_acquire) == 0)
+ return;
+
+ /* Sample the module-present pin on every tick. When the cable is
+ * pulled, drop the cached SFP type so that txgbe_xpcs_an_enabled()
+ * turns false and this alarm stops re-arming itself.
+ */
+ if (!txgbe_is_backplane(hw)) {
+ if (hw->mac.type == txgbe_mac_aml)
+ value = rd32(hw, TXGBE_GPIOEXT) & TXGBE_SFP1_MOD_ABS_LS;
+ else if (hw->mac.type == txgbe_mac_aml40)
+ value = rd32(hw, TXGBE_GPIOEXT) & TXGBE_SFP1_MOD_PRST_LS;
+
+ if (value != 0 &&
+ hw->phy.sfp_type != txgbe_sfp_type_not_present) {
+ PMD_DRV_LOG(INFO, "SFP module removed, stop AN73 watchdog.");
+ hw->phy.sfp_type = txgbe_sfp_type_not_present;
+ }
+ }
+
if (!(txgbe_xpcs_an_enabled(hw)))
return;
@@ -3086,5 +3118,8 @@ an_status:
out:
- if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40)
+ if (rte_atomic_load_explicit(&adapter->sfp_an_alarm_enabled,
+ rte_memory_order_acquire) != 0 &&
+ (hw->mac.type == txgbe_mac_aml ||
+ hw->mac.type == txgbe_mac_aml40))
rte_eal_alarm_set(hw->bp_event_interval, txgbe_dev_e56_check_bp_event, dev);
}
@@ -3094,8 +3129,13 @@ txgbe_dev_detect_sfp(void *param)
{
struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+ struct txgbe_adapter *adapter = TXGBE_DEV_ADAPTER(dev);
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
u32 value = 0;
s32 err;
+ if (rte_atomic_load_explicit(&adapter->sfp_an_alarm_enabled,
+ rte_memory_order_acquire) == 0)
+ return;
+
if (hw->mac.type == txgbe_mac_aml40) {
value = rd32(hw, TXGBE_GPIOEXT);
@@ -3120,12 +3160,29 @@ txgbe_dev_detect_sfp(void *param)
err = hw->phy.identify_sfp(hw);
out:
+ if (rte_atomic_load_explicit(&adapter->sfp_an_alarm_enabled,
+ rte_memory_order_acquire) == 0)
+ return;
+
if (err == TXGBE_ERR_SFP_NOT_SUPPORTED) {
PMD_DRV_LOG(ERR, "Unsupported SFP+ module type was detected.");
} else if (err == TXGBE_ERR_SFP_NOT_PRESENT) {
PMD_DRV_LOG(INFO, "SFP not present.");
+ /* Module removed: drop the cached type and stop the watchdog. */
+ hw->phy.sfp_type = txgbe_sfp_type_not_present;
+ rte_eal_alarm_cancel(txgbe_dev_e56_check_bp_event, dev);
} else if (err == 0) {
hw->mac.setup_sfp(hw);
PMD_DRV_LOG(INFO, "detected SFP+: %d", hw->phy.sfp_type);
txgbe_dev_setup_link_alarm_handler(dev);
+ /* Re-arm the AN73 watchdog for the newly inserted module, so
+ * that only one instance of it is running at a time.
+ */
+ if (!hw->adapter_stopped &&
+ (hw->mac.type == txgbe_mac_aml ||
+ hw->mac.type == txgbe_mac_aml40)) {
+ rte_eal_alarm_cancel(txgbe_dev_e56_check_bp_event, dev);
+ rte_eal_alarm_set(hw->bp_event_interval,
+ txgbe_dev_e56_check_bp_event, dev);
+ }
txgbe_dev_link_update(dev, 0);
}
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index b79f51193f..f76c1d3b09 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -379,4 +379,6 @@ struct txgbe_adapter {
RTE_ATOMIC(uint32_t) link_thread_running;
+ /* SFP detection and AN73 watchdog alarm state. */
+ RTE_ATOMIC(uint32_t) sfp_an_alarm_enabled;
rte_thread_t link_thread_tid;
};
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:49.063802724 +0000
+++ 0349-net-txgbe-fix-SFP-hotplug-when-auto-negotiation-is-o.patch 2026-12-03 12:52:39.267109678 +0000
@@ -1 +1 @@
-From 31afa8a4034ae3cb907940931a1ff648c8f930a5 Mon Sep 17 00:00:00 2001
+From 0966e9ea37ea0b0d4006bab5dabe688662e708c7 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 31afa8a4034ae3cb907940931a1ff648c8f930a5 ]
+
@@ -33 +34,0 @@
-Cc: stable at dpdk.org
@@ -42 +43 @@
-index 2f513e20b9..77e8b9dea7 100644
+index b7a3598a57..23f5832a93 100644
@@ -45 +46 @@
-@@ -1696,4 +1696,5 @@ static int
+@@ -1750,4 +1750,5 @@ static int
@@ -51 +52 @@
-@@ -1962,4 +1963,6 @@ skip_link_setup:
+@@ -2016,4 +2017,6 @@ skip_link_setup:
@@ -58 +59 @@
-@@ -2019,4 +2022,10 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
+@@ -2073,4 +2076,10 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
@@ -69 +70 @@
-@@ -2025,7 +2034,8 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
+@@ -2079,7 +2088,8 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
@@ -79 +80 @@
-@@ -2918,4 +2928,5 @@ void txgbe_dev_e56_check_bp_event(void *param)
+@@ -2990,4 +3000,5 @@ void txgbe_dev_e56_check_bp_event(void *param)
@@ -85 +86 @@
-@@ -2927,4 +2938,25 @@ void txgbe_dev_e56_check_bp_event(void *param)
+@@ -2999,4 +3010,25 @@ void txgbe_dev_e56_check_bp_event(void *param)
@@ -111 +112 @@
-@@ -3014,5 +3046,8 @@ an_status:
+@@ -3086,5 +3118,8 @@ an_status:
@@ -121 +122 @@
-@@ -3022,8 +3057,13 @@ txgbe_dev_detect_sfp(void *param)
+@@ -3094,8 +3129,13 @@ txgbe_dev_detect_sfp(void *param)
@@ -135 +136 @@
-@@ -3048,12 +3088,29 @@ txgbe_dev_detect_sfp(void *param)
+@@ -3120,12 +3160,29 @@ txgbe_dev_detect_sfp(void *param)
@@ -166 +167 @@
-index 05c20fd58c..28dfa1bc5e 100644
+index b79f51193f..f76c1d3b09 100644
@@ -169 +170 @@
-@@ -369,4 +369,6 @@ struct txgbe_adapter {
+@@ -379,4 +379,6 @@ struct txgbe_adapter {
More information about the stable
mailing list