From: Jie Liu <[email protected]>

sxe2_drv_mac_link_status_get() no longer calls sxe2_link_update()
after refreshing the link context, so the ethdev link state is only
refreshed during device init (sxe2_link_update_init) and never
updated when link status is queried at runtime, including on LSC
interrupt events.

Move the sxe2_link_update() call back into
sxe2_drv_mac_link_status_get() and simplify sxe2_link_update_init()
accordingly, matching the V3 implementation.

Fixes: 1d7fd921beef ("net/sxe2: support link update")
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
 drivers/net/sxe2/sxe2_irq.c |  2 ++
 drivers/net/sxe2/sxe2_mac.c | 11 +++--------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/sxe2/sxe2_irq.c b/drivers/net/sxe2/sxe2_irq.c
index 4e5339e24b..b0e1552d5f 100644
--- a/drivers/net/sxe2/sxe2_irq.c
+++ b/drivers/net/sxe2/sxe2_irq.c
@@ -84,6 +84,7 @@ static void sxe2_event_irq_common_handler(struct sxe2_adapter 
*adapter, uint64_t
        if (oicr & RTE_BIT32(SXE2_COM_EC_LINK_CHG)) {
                PMD_DEV_LOG_INFO(adapter, DRV, "OICR=0x%" PRIx64, oicr);
                (void)sxe2_drv_mac_link_status_get(adapter);
+               (void)sxe2_link_update(dev, 0);
                if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
                        rte_eth_dev_callback_process(dev,
                                                     RTE_ETH_EVENT_INTR_LSC,
@@ -96,6 +97,7 @@ static void sxe2_event_irq_common_handler(struct sxe2_adapter 
*adapter, uint64_t
                                        continue;
                                repr_adapter = 
SXE2_DEV_PRIVATE_TO_ADAPTER(repr_eth_dev);
                                
(void)sxe2_drv_mac_link_status_get(repr_adapter);
+                               (void)sxe2_link_update(repr_eth_dev, 0);
                                if (rte_eal_process_type() == RTE_PROC_PRIMARY) 
{
                                        
rte_eth_dev_callback_process(repr_eth_dev,
                                                                     
RTE_ETH_EVENT_INTR_LSC,
diff --git a/drivers/net/sxe2/sxe2_mac.c b/drivers/net/sxe2/sxe2_mac.c
index 729c804ac3..ab9bd5355b 100644
--- a/drivers/net/sxe2/sxe2_mac.c
+++ b/drivers/net/sxe2/sxe2_mac.c
@@ -448,18 +448,13 @@ int32_t sxe2_link_update_init(struct rte_eth_dev *dev)
        int32_t ret;
 
        PMD_INIT_FUNC_TRACE();
-
        rte_spinlock_init(&adapter->link_ctxt.link_lock);
-
        ret = sxe2_drv_mac_link_status_get(adapter);
-       if (ret) {
+       if (ret)
                PMD_DEV_LOG_ERR(adapter, DRV, "Failed to get link status, 
ret=%d", ret);
-               goto l_end;
-       }
-
-       (void)sxe2_link_update(dev, 0);
+       else
+               (void)sxe2_link_update(dev, 0);
 
-l_end:
        return ret;
 }
 int32_t sxe2_link_update(struct rte_eth_dev *dev, __rte_unused int32_t 
wait_to_complete)
-- 
2.52.0

Reply via email to