From: Jie Liu <[email protected]>
sxe2_link_update() was only called during device init, so the ethdev
link state was not refreshed when link status changed at runtime.
Call sxe2_link_update() in the link-change IRQ handler for both the
PF and its representors, so the link state is updated on LSC events.
Remove the now-redundant call from sxe2_link_update_init().
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 ba764dd5e4..4c3a29900d 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