aboutgitcodebugslistschat
path: root/conf.c
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2022-11-08 21:16:46 +0100
committerLaurent Vivier <lvivier@redhat.com>2024-03-12 11:54:26 +0100
commit37f457a76c8f412a0a2ceb79c77b91eea24ef341 (patch)
tree9922b7899d7c28b5995c4c6b9f750870b7c241e4 /conf.c
parentb2229bd24ffc75b2538073958221e1ae82ac0767 (diff)
downloadpasst-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.gz
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.bz2
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.lz
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.xz
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.zst
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.zip
vhost-user: add vhost-user
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@redhat.com>
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/conf.c b/conf.c
index 0a845cd..27fa44a 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
@@ -721,9 +722,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");
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");
}
info( " -F, --fd FD Use FD as pre-opened connected socket");
@@ -1109,6 +1113,7 @@ void conf(struct ctx *c, int argc, char **argv)
{"help", no_argument, NULL, 'h' },
{"socket", required_argument, NULL, 's' },
{"fd", required_argument, NULL, 'F' },
+ {"socket-path", required_argument, NULL, 's' }, /* vhost-user mandatory */
{"ns-ifname", required_argument, NULL, 'I' },
{"pcap", required_argument, NULL, 'p' },
{"pid", required_argument, NULL, 'P' },
@@ -1155,6 +1160,8 @@ void conf(struct ctx *c, int argc, char **argv)
{"config-net", no_argument, NULL, 17 },
{"no-copy-routes", no_argument, NULL, 18 },
{"no-copy-addrs", no_argument, NULL, 19 },
+ {"vhost-user", no_argument, NULL, 20 },
+ {"print-capabilities", no_argument, NULL, 21 }, /* vhost-user mandatory */
{ 0 },
};
char userns[PATH_MAX] = { 0 }, netns[PATH_MAX] = { 0 };
@@ -1314,7 +1321,6 @@ void conf(struct ctx *c, int argc, char **argv)
sizeof(c->ip6.ifname_out), "%s", optarg);
if (ret <= 0 || ret >= (int)sizeof(c->ip6.ifname_out))
die("Invalid interface name: %s", optarg);
-
break;
case 17:
if (c->mode != MODE_PASTA)
@@ -1336,6 +1342,16 @@ void conf(struct ctx *c, int argc, char **argv)
warn("--no-copy-addrs will be dropped soon");
c->no_copy_addrs = copy_addrs_opt = true;
break;
+ case 20:
+ if (c->mode == MODE_PASTA) {
+ err("--vhost-user is for passt mode only");
+ usage(argv[0]);
+ }
+ c->mode = MODE_VU;
+ break;
+ case 21:
+ vu_print_capabilities();
+ break;
case 'd':
if (c->debug)
die("Multiple --debug options given");