Skip to content

Commit

Permalink
net/bnxt: fix link status when port is stopped
Browse files Browse the repository at this point in the history
[ upstream commit 7b6eba8 ]

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: c09f57b ("net/bnxt: add start/stop/link update operations")

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>
  • Loading branch information
Kalesh AP authored and kevintraynor committed May 25, 2022
1 parent 71ab79d commit 2ff3768
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/net/bnxt/bnxt_ethdev.c
Expand Up @@ -1827,6 +1827,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);
Expand All @@ -1844,12 +1852,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 ||
Expand Down

0 comments on commit 2ff3768

Please sign in to comment.