[spp] [PATCH 1/3] shared: add vhost-user client support

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Wed Jan 23 09:14:35 CET 2019


From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>

This update is to add client mode for vhost-user. If it is enabled,
`client` in `devargs` variable is set to `1` to activate this mode in
`add_vhost_pmd()`.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 src/shared/secondary/add_port.c | 6 +++++-
 src/shared/secondary/add_port.h | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/shared/secondary/add_port.c b/src/shared/secondary/add_port.c
index ca55a04..2841f94 100644
--- a/src/shared/secondary/add_port.c
+++ b/src/shared/secondary/add_port.c
@@ -12,6 +12,8 @@
 #include "shared/secondary/add_port.h"
 #include "shared/secondary/utils.h"
 
+int g_enable_vhost_cli;
+
 char *
 get_vhost_backend_name(unsigned int id)
 {
@@ -150,7 +152,9 @@ add_vhost_pmd(int index)
 	name = get_vhost_backend_name(index);
 	iface = get_vhost_iface_name(index);
 
-	sprintf(devargs, "%s,iface=%s,queues=%d", name, iface, nr_queues);
+	sprintf(devargs, "%s,iface=%s,queues=%d,client=%d",
+			name, iface, nr_queues, g_enable_vhost_cli);
+	RTE_LOG(DEBUG, SHARED, "devargs for vhost: '%s'\n", devargs);
 	ret = dev_attach_by_devargs(devargs, &vhost_port_id);
 	if (ret < 0)
 		return ret;
diff --git a/src/shared/secondary/add_port.h b/src/shared/secondary/add_port.h
index cfae1af..7012940 100644
--- a/src/shared/secondary/add_port.h
+++ b/src/shared/secondary/add_port.h
@@ -20,6 +20,8 @@
 
 #define RTE_LOGTYPE_SHARED RTE_LOGTYPE_USER1
 
+extern int g_enable_vhost_cli;
+
 /**
  * Get unique name used to reserve vhost interface.
  *
-- 
2.17.1



More information about the spp mailing list