txgbe_dev_set_link_down() clears hw->dev_start, but the Amber-Lite
AN73 watchdog treats a down link as a recovery condition and can start
negotiation again. The setup-link alarm handler can likewise configure
the PHY after a link update or a previous setup retry.

As a result, a port brought down through rte_eth_dev_set_link_down()
can link up again without a matching rte_eth_dev_set_link_up() call.

Use hw->dev_start as the administrative link gate. Keep the AN73
watchdog armed so that monitoring resumes after link-up, but skip link
recovery while the port is administratively down. Also make the
setup-link alarm handler return before it configures the PHY in that
state.

This keeps the link down until rte_eth_dev_set_link_up() explicitly
re-enables it. The link-up path then restores the required PHY
configuration.

Fixes: 234ce0d1fa9d ("net/txgbe: fix link stability for Amber-Lite backplane 
mode")
Fixes: 6104fd11086e ("net/txgbe: fix link stability for 25G NIC")
Cc: [email protected]

Signed-off-by: Zaiyu Wang <[email protected]>
---
 drivers/net/txgbe/txgbe_ethdev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 22ca36210d..f53fd4cdde 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -3045,8 +3045,8 @@ void txgbe_dev_e56_check_bp_event(void *param)
        if (!hw->devarg.auto_neg)
                return;
 
-       /* only continue if link is down */
-       if (dev->data->dev_link.link_status)
+       /* Continue only for an administratively up port with link down. */
+       if (!hw->dev_start || dev->data->dev_link.link_status)
                goto out;
 
        value = rd32_epcs(hw, VR_AN_INTR);
@@ -3384,6 +3384,11 @@ txgbe_dev_setup_link_alarm_handler_aml(void *param)
        bool autoneg = false;
        u32 gssr = hw->phy.phy_semaphore_mask;
 
+       if (!hw->dev_start) {
+               intr->flags &= ~TXGBE_FLAG_NEED_LINK_CONFIG;
+               return;
+       }
+
        speed = hw->phy.autoneg_advertised;
        if (!speed)
                hw->mac.get_link_capabilities(hw, &speed, &autoneg);
-- 
2.55.0.windows.2

Reply via email to