From: Kalesh AP <kalesh-anakkur.pura...@broadcom.com>

Driver forces link down during port stop. But device is not obliged
link down in certain scenarios, even when forced. In that case,
subsequent link queries returns link as up.
Fixed to return link status as down when port is stopped.
Driver is already doing that for VF/NPAR/MH functions.

Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")
Cc: sta...@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.pura...@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khapa...@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.ko...@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1904db9..69f1117 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1826,6 +1826,14 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int 
wait_to_complete)
        if (bp->link_info == NULL)
                goto out;
 
+       /* Only single function PF can bring the phy down.
+        * In certain scenarios, device is not obliged link down even when 
forced.
+        * When port is stopped, report link down in those cases.
+        */
+       if (!eth_dev->data->dev_started &&
+           (!BNXT_SINGLE_PF(bp) || bnxt_force_link_config(bp)))
+               goto out;
+
        do {
                /* Retrieve link info from hardware */
                rc = bnxt_get_hwrm_link_config(bp, &new);
@@ -1843,12 +1851,6 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int 
wait_to_complete)
                rte_delay_ms(BNXT_LINK_WAIT_INTERVAL);
        } while (cnt--);
 
-       /* Only single function PF can bring phy down.
-        * When port is stopped, report link down for VF/MH/NPAR functions.
-        */
-       if (!BNXT_SINGLE_PF(bp) && !eth_dev->data->dev_started)
-               memset(&new, 0, sizeof(new));
-
 out:
        /* Timed out or success */
        if (new.link_status != eth_dev->data->dev_link.link_status ||
-- 
2.10.1

Reply via email to