From b9bd0f09fa15b9dd6c70c469b45d215f494cab97 Mon Sep 17 00:00:00 2001 From: Shahaf Shuler Date: Tue, 10 Apr 2018 09:16:31 +0300 Subject: [PATCH] ethdev: fix link status query When application works with LSC interrupts the ethdev layer skips the PMD callback and update according to the link status exists on device data. It is because it assumes the link status on the device data is the correct one since any link change is processed by the application. As multiple PMDs install the link status interrupt handler only on port start and uninstall it on port stop, the link status may be incorrect in case the query is called after port stop or before port start. Fixing the query implementation to use the PMD callback for such cases. Fixes: b77d21cc2364 ("ethdev: add link status get/set helper functions") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler Acked-by: Nelio Laranjeiro Acked-by: Thomas Monjalon --- lib/librte_ether/rte_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index a364af3408..fcc6621d69 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1789,7 +1789,8 @@ rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link) RTE_ETH_VALID_PORTID_OR_RET(port_id); dev = &rte_eth_devices[port_id]; - if (dev->data->dev_conf.intr_conf.lsc) + if (dev->data->dev_conf.intr_conf.lsc && + dev->data->dev_started) rte_eth_linkstatus_get(dev, eth_link); else { RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update); @@ -1806,7 +1807,8 @@ rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link) RTE_ETH_VALID_PORTID_OR_RET(port_id); dev = &rte_eth_devices[port_id]; - if (dev->data->dev_conf.intr_conf.lsc) + if (dev->data->dev_conf.intr_conf.lsc && + dev->data->dev_started) rte_eth_linkstatus_get(dev, eth_link); else { RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update); -- 2.20.1