DPDK patches and discussions
 help / color / mirror / Atom feed
From: <skoteshwar@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 3/3] net/cnxk: update link status when device stopped
Date: Wed, 7 Jul 2021 12:49:17 -0400	[thread overview]
Message-ID: <1625676557-2269-3-git-send-email-skoteshwar@marvell.com> (raw)
In-Reply-To: <1625676557-2269-1-git-send-email-skoteshwar@marvell.com>

From: Satha Rao <skoteshwar@marvell.com>

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>
---
 drivers/net/cnxk/cnxk_ethdev.c | 5 +++++
 drivers/net/cnxk/cnxk_link.c   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 7adab46..0e3652e 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -1096,6 +1096,7 @@
 	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 @@
 	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 caf35ee..3fdbdba 100644
--- a/drivers/net/cnxk/cnxk_link.c
+++ b/drivers/net/cnxk/cnxk_link.c
@@ -90,7 +90,7 @@
 	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)) {
-- 
1.8.3.1


  parent reply	other threads:[~2021-07-07 16:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 16:49 [dpdk-dev] [PATCH 1/3] net/octeontx2: handle " skoteshwar
2021-07-07 16:49 ` [dpdk-dev] [PATCH 2/3] net/octeontx2: get tm node stats after resource allocated skoteshwar
2021-07-07 16:49 ` skoteshwar [this message]
2021-07-13  9:32 ` [dpdk-dev] [PATCH 1/3] net/octeontx2: handle link status when device stopped Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1625676557-2269-3-git-send-email-skoteshwar@marvell.com \
    --to=skoteshwar@marvell.com \
    --cc=dev@dpdk.org \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).