From: Satha Rao Date: Wed, 7 Jul 2021 16:49:17 +0000 (-0400) Subject: net/cnxk: update link status when device stopped X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e7bbbcb26f825aa233bdc2707a94c537cc45d6e6;p=dpdk.git net/cnxk: update 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 Acked-by: Jerin Jacob --- diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index 7adab46058..0e3652ed51 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -1096,6 +1096,7 @@ cnxk_nix_dev_stop(struct rte_eth_dev *eth_dev) struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); const struct eth_dev_ops *dev_ops = eth_dev->dev_ops; struct rte_mbuf *rx_pkts[32]; + struct rte_eth_link link; int count, i, j, rc; void *rxq; @@ -1128,6 +1129,10 @@ cnxk_nix_dev_stop(struct rte_eth_dev *eth_dev) for (i = 0; i < eth_dev->data->nb_tx_queues; i++) dev_ops->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; } diff --git a/drivers/net/cnxk/cnxk_link.c b/drivers/net/cnxk/cnxk_link.c index caf35ee1df..3fdbdba495 100644 --- a/drivers/net/cnxk/cnxk_link.c +++ b/drivers/net/cnxk/cnxk_link.c @@ -90,7 +90,7 @@ cnxk_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 (roc_nix_is_sdp(&dev->nix)) + if (!eth_dev->data->dev_started || roc_nix_is_sdp(&dev->nix)) return 0; if (roc_nix_is_lbk(&dev->nix)) {