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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index f87fca5b19..e733514826 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -3033,8 +3033,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);
@@ -3362,6 +3362,9 @@ txgbe_dev_setup_link_alarm_handler_aml(void *param)
        if (!hw)
                return;
 
+       if (!hw->dev_start)
+               return;
+
        struct rte_eth_dev *dev = (struct rte_eth_dev *)hw->dev_back;
        struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
        u32 speed;
-- 
2.55.0.windows.2

Reply via email to