[spp] [PATCH v3 10/12] shared: make sure vhost is stopped before (re)using the vhost

Itsuro Oda oda at valinux.co.jp
Fri Jan 10 00:10:24 CET 2020


It is for the case a secondary process which used the vhost
was down without stopping the eth_dev.
It makes the eth_dev stopped and available to do following
operations(ex. rte_eth_dev_configure). It is no-op if the
eth_dev is stopped.

Signed-off-by: Itsuro Oda <oda at valinux.co.jp>
---
 src/shared/secondary/add_port.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/shared/secondary/add_port.c b/src/shared/secondary/add_port.c
index b072140..d845250 100644
--- a/src/shared/secondary/add_port.c
+++ b/src/shared/secondary/add_port.c
@@ -170,6 +170,14 @@ add_vhost_pmd(int index)
 		return ret;
 	}
 
+	/* NOTE: make sure the eth_dev is stopped.
+	 * it is for the case a secondary process which used the vhost
+	 * was down without stopping the device.
+	 * note that it is still user responsibility to prevent multipul
+	 * processes use a vhost at the same time.
+	 */
+	rte_eth_dev_stop(vhost_port_id);
+
 	ret = rte_eth_dev_configure(vhost_port_id, nr_queues, nr_queues,
 		&port_conf);
 	if (ret < 0) {
-- 
2.17.1



More information about the spp mailing list