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. Cc: [email protected] Cc: [email protected] Signed-off-by: Jie Liu <[email protected]> --- drivers/net/sxe2/sxe2_cmd_chnl.c | 2 ++ drivers/net/sxe2/sxe2_mac.c | 9 +-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/sxe2/sxe2_cmd_chnl.c b/drivers/net/sxe2/sxe2_cmd_chnl.c index 16a2c3fea4..705d259412 100644 --- a/drivers/net/sxe2/sxe2_cmd_chnl.c +++ b/drivers/net/sxe2/sxe2_cmd_chnl.c @@ -412,6 +412,7 @@ int32_t sxe2_drv_mac_link_status_get(struct sxe2_adapter *adapter) { int32_t ret = 0; struct sxe2_common_device *cdev = adapter->cdev; + struct rte_eth_dev *dev = &rte_eth_devices[adapter->dev_info.dev_data->port_id]; struct sxe2_drv_cmd_params param = {0}; struct sxe2_drv_link_info_resp resp = {0}; @@ -425,6 +426,7 @@ int32_t sxe2_drv_mac_link_status_get(struct sxe2_adapter *adapter) } adapter->link_ctxt.speed = resp.speed; adapter->link_ctxt.link_up = resp.status; + (void)sxe2_link_update(dev, 0); l_end: return ret; diff --git a/drivers/net/sxe2/sxe2_mac.c b/drivers/net/sxe2/sxe2_mac.c index 729c804ac3..7dbea92670 100644 --- a/drivers/net/sxe2/sxe2_mac.c +++ b/drivers/net/sxe2/sxe2_mac.c @@ -448,18 +448,11 @@ 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); - -l_end: return ret; } int32_t sxe2_link_update(struct rte_eth_dev *dev, __rte_unused int32_t wait_to_complete) -- 2.52.0

