On Fri, 2 Feb 2024 15:11:47 +0100
Laurent Vivier <lvivier(a)redhat.com> wrote:
add virtio and vhost-user functions to connect
with QEMU.
$ ./passt --vhost-user
and
# qemu-system-x86_64 ... -m 4G \
-object memory-backend-memfd,id=memfd0,share=on,size=4G \
-numa node,memdev=memfd0 \
-chardev socket,id=chr0,path=/tmp/passt_1.socket \
-netdev vhost-user,id=netdev0,chardev=chr0 \
-device virtio-net,mac=9a:2b:2c:2d:2e:2f,netdev=netdev0 \
...
Signed-off-by: Laurent Vivier <lvivier(a)redhat.com>
---
conf.c | 20 ++++++++++++++--
passt.c | 7 ++++++
passt.h | 1 +
tap.c | 73 ++++++++++++++++++++++++++++++++++++++++++---------------
tcp.c | 8 +++++--
udp.c | 6 +++--
6 files changed, 90 insertions(+), 25 deletions(-)
This would need a matching
change in the man page, passt.1, at least
documenting the --vhost-user option and adjusting descriptions about
the guest communication interface (look for "UNIX domain" there).
diff --git a/conf.c b/conf.c
index b6a2a1f0fdc3..40aa9519f8a6 100644
--- a/conf.c
+++ b/conf.c
@@ -44,6 +44,7 @@
#include "lineread.h"
#include "isolation.h"
#include "log.h"
+#include "vhost_user.h"
/**
* next_chunk - Return the next piece of a string delimited by a character
@@ -735,9 +736,12 @@ static void print_usage(const char *name, int status)
info( " -I, --ns-ifname NAME namespace interface name");
info( " default: same interface name as external one");
} else {
- info( " -s, --socket PATH UNIX domain socket path");
+ info( " -s, --socket, --socket-path PATH UNIX domain socket path");
I don't get the point of --socket-path. It's handled just like -s
anyway, right? Why can't it just be -s / --socket?
I believe the issue is
that there's an expected command line interface
for the vhost server, which uses --socket-path for, well, the socket
path. Hence adding an alias to the existing passt option.
info(
" default: probe free path starting from "
UNIX_SOCK_PATH, 1);
+ info( " --vhost-user Enable vhost-user mode");
+ info( " UNIX domain socket is provided by -s option");
+ info( " --print-capabilities print back-end capabilities in JSON
format");
Instead of introducing a new option, couldn't we have these
printed
unconditionally with debug()? I guess it's debug-level stuff anyway.
Likewise, I think this option is expected by the thing which starts
the vhost server.