net/bnxt: fix link status when port is stopped

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: c09f57b49c ("net/bnxt: add start/stop/link update operations")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
This commit is contained in:
Kalesh AP 2022-04-27 20:28:18 +05:30 committed by Ajit Khaparde
parent 9c1410bed3
commit 7b6eba8856

View File

@ -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 ||