The 25G NIC offers off, RS, Base-R, and auto FEC modes. When
reconfiguring the PHY, the FEC mode must match on both sides;
otherwise, the link cannot come up. The current driver fails to
maintain this requirement, causing link instability.

Add proper FEC mode handling during PHY reconfiguration to
guarantee link establishment.

Fixes: fb6eb170dfa2 ("net/txgbe: add basic link configuration for Amber-Lite")
Cc: [email protected]

Signed-off-by: Zaiyu Wang <[email protected]>
---
 drivers/net/txgbe/base/txgbe_aml.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/txgbe/base/txgbe_aml.c 
b/drivers/net/txgbe/base/txgbe_aml.c
index 5cc8741f10..72a894c4ae 100644
--- a/drivers/net/txgbe/base/txgbe_aml.c
+++ b/drivers/net/txgbe/base/txgbe_aml.c
@@ -282,6 +282,14 @@ s32 txgbe_setup_phy_link_aml(struct txgbe_hw *hw,
            !(hw->fec_mode & hw->cur_fec_link)))
                goto out;
 
+       if (speed == TXGBE_LINK_SPEED_25GB_FULL &&
+           link_speed == TXGBE_LINK_SPEED_25GB_FULL) {
+               txgbe_e56_fec_polling(hw, &link_up);
+
+               if (link_up)
+                       goto out;
+       }
+
        rte_spinlock_lock(&hw->phy_lock);
        ret_status = txgbe_set_link_to_amlite(hw, speed);
        rte_spinlock_unlock(&hw->phy_lock);
@@ -360,7 +368,10 @@ static s32 
txgbe_setup_mac_link_multispeed_fiber_aml(struct txgbe_hw *hw,
                /* If we already have link at this speed, just jump out */
                txgbe_e56_check_phy_link(hw, &link_speed, &link_up);
 
-               if (link_speed == TXGBE_LINK_SPEED_25GB_FULL && link_up)
+               hw->cur_fec_link = txgbe_phy_fec_get(hw);
+
+               if (link_speed == TXGBE_LINK_SPEED_25GB_FULL && link_up &&
+                   hw->fec_mode & hw->cur_fec_link)
                        goto out;
 
                /* Allow module to change analog characteristics (10G -> 25G) */
-- 
2.21.0.windows.1

Reply via email to