[PATCH] net/idpf: need to stop device when closing device
beilei.xing at intel.com
beilei.xing at intel.com
Mon Nov 14 11:39:44 CET 2022
From: Beilei Xing <beilei.xing at 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 at 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
More information about the dev
mailing list