net/idpf: need to stop device when closing device

Message ID 20221114103944.65290-1-beilei.xing@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/idpf: need to stop device when closing device |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS

Commit Message

Xing, Beilei Nov. 14, 2022, 10:39 a.m. UTC
  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(+)
  

Comments

Qi Zhang Nov. 15, 2022, 3:31 a.m. UTC | #1
> -----Original Message-----
> From: Xing, Beilei <beilei.xing@intel.com>
> Sent: Monday, November 14, 2022 6:40 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>
> Subject: [PATCH] net/idpf: need to stop device when closing device
> 
> 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>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

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 {