net/octeontx2: handle link status when device stopped

Set link status to down and don't fetch link status from kernel
when device in stopped state.

Signed-off-by: Satha Rao <skoteshwar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Satha Rao 2021-07-07 12:49:15 -04:00 committed by Jerin Jacob
parent d81cea5280
commit 12e491a6b6
2 changed files with 6 additions and 1 deletions

View File

@ -2171,6 +2171,7 @@ otx2_nix_dev_stop(struct rte_eth_dev *eth_dev)
struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
struct rte_mbuf *rx_pkts[32];
struct otx2_eth_rxq *rxq;
struct rte_eth_link link;
int count, i, j, rc;
nix_lf_switch_header_type_enable(dev, false);
@ -2196,6 +2197,10 @@ otx2_nix_dev_stop(struct rte_eth_dev *eth_dev)
for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
otx2_nix_tx_queue_stop(eth_dev, i);
/* Bring down link status internally */
memset(&link, 0, sizeof(link));
rte_eth_linkstatus_set(eth_dev, &link);
return 0;
}

View File

@ -148,7 +148,7 @@ otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
RTE_SET_USED(wait_to_complete);
memset(&link, 0, sizeof(struct rte_eth_link));
if (otx2_dev_is_sdp(dev))
if (!eth_dev->data->dev_started || otx2_dev_is_sdp(dev))
return 0;
if (otx2_dev_is_lbk(dev))