[AMD Official Use Only - AMD Internal Distribution Only]

Acked-by: Selwin Sebastian<selwin.sebast...@amd.com>

-----Original Message-----
From: Ande, Venkat Kumar <venkatkumar.a...@amd.com>
Sent: Tuesday, May 7, 2024 6:13 PM
To: dev@dpdk.org
Cc: Sebastian, Selwin <selwin.sebast...@amd.com>; Ande, Venkat Kumar 
<venkatkumar.a...@amd.com>; sta...@dpdk.org
Subject: [PATCH v2 02/25] net/axgbe: reset link when the link never comes back

Normally, auto negotiation and reconnect should be automatically done by the 
hardware. But there seems to be an issue where auto negotiation has to be 
restarted manually. This happens because of link training and so even though 
still connected to the partner the link never "comes back".
This needs an auto-negotiation restart.

Without the fix the user will not see the link up status

Fixes: a5c7273771e8 ("net/axgbe: add phy programming APIs")
Cc: sta...@dpdk.org

Signed-off-by: Venkat Kumar Ande <venkatkumar.a...@amd.com>
---
 drivers/net/axgbe/axgbe_mdio.c     | 2 +-
 drivers/net/axgbe/axgbe_phy_impl.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/axgbe/axgbe_mdio.c b/drivers/net/axgbe/axgbe_mdio.c 
index 913ceada0d..b03bc471cb 100644
--- a/drivers/net/axgbe/axgbe_mdio.c
+++ b/drivers/net/axgbe/axgbe_mdio.c
@@ -1051,7 +1051,7 @@ static void axgbe_phy_status(struct axgbe_port *pdata)
                                                             &an_restart);
        if (an_restart) {
                axgbe_phy_config_aneg(pdata);
-               return;
+               goto adjust_link;
        }

        if (pdata->phy.link) {
diff --git a/drivers/net/axgbe/axgbe_phy_impl.c 
b/drivers/net/axgbe/axgbe_phy_impl.c
index 44ff28517c..54fe9faae0 100644
--- a/drivers/net/axgbe/axgbe_phy_impl.c
+++ b/drivers/net/axgbe/axgbe_phy_impl.c
@@ -1697,6 +1697,13 @@ static int axgbe_phy_link_status(struct axgbe_port 
*pdata, int *an_restart)
        if (reg & MDIO_STAT1_LSTATUS)
                return 1;

+       if (pdata->phy.autoneg == AUTONEG_ENABLE &&
+                       phy_data->port_mode == AXGBE_PORT_MODE_BACKPLANE) {
+               if (rte_bit_relaxed_get32(AXGBE_LINK_INIT, &pdata->dev_state)) {
+                       *an_restart = 1;
+               }
+       }
+
        /* No link, attempt a receiver reset cycle */
        if (phy_data->rrc_count++) {
                phy_data->rrc_count = 0;
--
2.34.1

Reply via email to