diff mbox series

[RFC,v2,1/8] test/virtual_pmd: clean rings on close

Message ID 20210716142800.3853651-1-ferruh.yigit@intel.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers show
Series [RFC,v2,1/8] test/virtual_pmd: clean rings on close | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ferruh Yigit July 16, 2021, 2:27 p.m. UTC
Not cleaning the rings prevents creating devices again, which breaks to
run some unit tests multiple times.

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

Patch

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 7036f401ed95..6098e633f35a 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;
 }