DPDK patches and discussions
 help / color / mirror / Atom feed
From: beilei.xing@intel.com
To: jingjing.wu@intel.com, qi.z.zhang@intel.com
Cc: dev@dpdk.org, Beilei Xing <beilei.xing@intel.com>
Subject: [PATCH] net/idpf: need to stop device when closing device
Date: Mon, 14 Nov 2022 10:39:44 +0000	[thread overview]
Message-ID: <20221114103944.65290-1-beilei.xing@intel.com> (raw)

From: Beilei Xing <beilei.xing@intel.com>

This patch stops device at the beginning of idpf_dev_close.

Fixes: 14aa6ed8f2ec ("net/idpf: support device start and stop")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/idpf/idpf_ethdev.c | 7 +++++++
 drivers/net/idpf/idpf_ethdev.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 50aac65daf..5a141ba035 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -605,6 +605,9 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
 
+	if (vport->stopped == 1)
+		return 0;
+
 	idpf_vc_ena_dis_vport(vport, false);
 
 	idpf_stop_queues(dev);
@@ -613,6 +616,8 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_vc_dealloc_vectors(vport);
 
+	vport->stopped = 1;
+
 	return 0;
 }
 
@@ -622,6 +627,8 @@ idpf_dev_close(struct rte_eth_dev *dev)
 	struct idpf_vport *vport = dev->data->dev_private;
 	struct idpf_adapter *adapter = vport->adapter;
 
+	idpf_dev_stop(dev);
+
 	idpf_vc_destroy_vport(vport);
 
 	rte_free(vport->rss_lut);
diff --git a/drivers/net/idpf/idpf_ethdev.h b/drivers/net/idpf/idpf_ethdev.h
index ccdf4abe40..bfe27a5267 100644
--- a/drivers/net/idpf/idpf_ethdev.h
+++ b/drivers/net/idpf/idpf_ethdev.h
@@ -127,6 +127,8 @@ struct idpf_vport {
 	struct idpf_chunks_info chunks_info;
 
 	uint16_t devarg_id;
+
+	bool stopped;
 };
 
 struct idpf_adapter {
-- 
2.26.2


             reply	other threads:[~2022-11-14 10:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 10:39 beilei.xing [this message]
2022-11-15  3:31 ` Zhang, Qi Z

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=20221114103944.65290-1-beilei.xing@intel.com \
    --to=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.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).