[dpdk-dev] [RFC 2/4] test/virtual_pmd: clean rings on close

Ferruh Yigit ferruh.yigit at intel.com
Thu Jun 17 10:14:47 CEST 2021


Not cleaning the rings prevents creating devices again, which breaks to
run some unit tests multiple times.

Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 app/test/virtual_pmd.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 4d6ce302a563..17f28c5a304c 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -34,7 +34,7 @@ struct virtual_ethdev_queue {
 };
 
 static int
-virtual_ethdev_start_success(struct rte_eth_dev *eth_dev __rte_unused)
+virtual_ethdev_start_success(struct rte_eth_dev *eth_dev)
 {
 	eth_dev->data->dev_started = 1;
 
@@ -42,13 +42,13 @@ virtual_ethdev_start_success(struct rte_eth_dev *eth_dev __rte_unused)
 }
 
 static int
-virtual_ethdev_start_fail(struct rte_eth_dev *eth_dev __rte_unused)
+virtual_ethdev_start_fail(struct rte_eth_dev *eth_dev)
 {
 	eth_dev->data->dev_started = 0;
 
 	return -1;
 }
-static int  virtual_ethdev_stop(struct rte_eth_dev *eth_dev __rte_unused)
+static int  virtual_ethdev_stop(struct rte_eth_dev *eth_dev)
 {
 	void *pkt = NULL;
 	struct virtual_ethdev_private *prv = eth_dev->data->dev_private;
@@ -65,8 +65,13 @@ static int  virtual_ethdev_stop(struct rte_eth_dev *eth_dev __rte_unused)
 }
 
 static int
-virtual_ethdev_close(struct rte_eth_dev *dev __rte_unused)
+virtual_ethdev_close(struct rte_eth_dev *eth_dev)
 {
+	struct virtual_ethdev_private *prv = eth_dev->data->dev_private;
+
+	rte_ring_free(prv->rx_queue);
+	rte_ring_free(prv->tx_queue);
+
 	return 0;
 }
 
-- 
2.31.1



More information about the dev mailing list