[spp] [PATCH 01/11] shared: switch to use original vhost PMD again

Itsuro Oda oda at valinux.co.jp
Thu Apr 2 02:06:23 CEST 2020


Original vhost PMD was fixed to be used by a secondary process
in DPDK v20.02.
This patch switches to use original vhost PMD instead of SPP
dedicated vhost PMD.
This patch also modifies comment about vhost in detail more.

Signed-off-by: Itsuro Oda <oda at valinux.co.jp>
---
 src/shared/common.c             |  4 +---
 src/shared/common.h             |  1 -
 src/shared/secondary/add_port.c | 15 ++++++++++-----
 src/shared/secondary/add_port.h |  2 +-
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/shared/common.c b/src/shared/common.c
index d1c3e36..61db6ba 100644
--- a/src/shared/common.c
+++ b/src/shared/common.c
@@ -91,9 +91,7 @@ int parse_dev_name(char *dev_name, int *port_type, int *port_id)
 	} else if (strncmp(dev_name, VDEV_ETH_VHOST,
 				strlen(VDEV_ETH_VHOST)) == 0 ||
 			strncmp(dev_name, VDEV_NET_VHOST,
-				strlen(VDEV_NET_VHOST)) == 0 ||
-			strncmp(dev_name, VDEV_SPP_VHOST,
-				strlen(VDEV_SPP_VHOST)) == 0) {
+				strlen(VDEV_NET_VHOST)) == 0) {
 		dev_str_len = strlen(VDEV_NET_VHOST);
 		pid_len = dev_name_len - dev_str_len;
 		strncpy(pid_str, dev_name + strlen(VDEV_NET_VHOST),
diff --git a/src/shared/common.h b/src/shared/common.h
index fd3102c..f2909c2 100644
--- a/src/shared/common.h
+++ b/src/shared/common.h
@@ -52,7 +52,6 @@
 #define VDEV_NET_RING "net_ring"
 #define VDEV_ETH_VHOST "eth_vhost"
 #define VDEV_NET_VHOST "net_vhost"
-#define VDEV_SPP_VHOST "spp_vhost"
 #define VDEV_NET_PCAP "net_pcap"
 #define VDEV_ETH_TAP "eth_tap"
 #define VDEV_NET_TAP "net_tap"
diff --git a/src/shared/secondary/add_port.c b/src/shared/secondary/add_port.c
index a7b7261..bca18b1 100644
--- a/src/shared/secondary/add_port.c
+++ b/src/shared/secondary/add_port.c
@@ -186,11 +186,16 @@ 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.
+	/* NOTE:
+	 * A vhost PMD is shared among multi processes, but it
+	 * can be used by only one process. It is user responsibility
+	 * to prevent multipul processes use a vhost at the same time.
+	 * The same vhost interface can be used after the vhost is
+	 * deleted (and created again) or the process which used the
+	 * vhost is down.
+	 * dev_attach_by_devargs will succeed even if the device exists.
+	 * rte_eth_dev_stop is necessary to configure the device again.
+	 * It is no-op if the device is stopped.
 	 */
 	rte_eth_dev_stop(vhost_port_id);
 
diff --git a/src/shared/secondary/add_port.h b/src/shared/secondary/add_port.h
index 39feb50..d41969b 100644
--- a/src/shared/secondary/add_port.h
+++ b/src/shared/secondary/add_port.h
@@ -10,7 +10,7 @@
 #define NR_DESCS 128
 
 #define VHOST_IFACE_NAME "/tmp/sock%u"
-#define VHOST_BACKEND_NAME "spp_vhost%u"
+#define VHOST_BACKEND_NAME "eth_vhost%u"
 
 #define PCAP_PMD_DEV_NAME "eth_pcap%u"
 #define MEMIF_PMD_DEV_NAME "net_memif%u"
-- 
2.17.0



More information about the spp mailing list