After the introduction of vhost-user-bridge and libvhost-user, we
formed the convention of placing vhost-user daemons in eponymous subdirs
of contrib/. Follow this convention.
Create a contrib/vhost-user-bridge/ directory and move vhost-user-bridge
into it. Extract its build target definition from tests/meson.build into
the new directory, and include its subdir in the root-level meson.build.
Add a section about it in the "vhost-user daemons in contrib" document.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>
---
contrib/vhost-user-bridge/meson.build | 4 ++
.../vhost-user-bridge}/vhost-user-bridge.c | 0
.../devices/virtio/vhost-user-contrib.rst | 39 +++++++++++++++++++
meson.build | 1 +
tests/meson.build | 6 ---
5 files changed, 44 insertions(+), 6 deletions(-)
create mode 100644 contrib/vhost-user-bridge/meson.build
rename {tests => contrib/vhost-user-bridge}/vhost-user-bridge.c (100%)
diff --git a/contrib/vhost-user-bridge/meson.build b/contrib/vhost-user-bridge/meson.build
new file mode 100644
index 0000000000..aa58c1df20
--- /dev/null
+++ b/contrib/vhost-user-bridge/meson.build
@@ -0,0 +1,4 @@
+if have_tools and have_vhost_user and host_os == 'linux'
+ executable('vhost-user-bridge', files('vhost-user-bridge.c'),
+ dependencies: [qemuutil, vhost_user], install: false)
+endif
diff --git a/tests/vhost-user-bridge.c b/contrib/vhost-user-bridge/vhost-user-bridge.c
similarity index 100%
rename from tests/vhost-user-bridge.c
rename to contrib/vhost-user-bridge/vhost-user-bridge.c
diff --git a/docs/system/devices/virtio/vhost-user-contrib.rst b/docs/system/devices/virtio/vhost-user-contrib.rst
index 48d04d2ade..660d29a700 100644
--- a/docs/system/devices/virtio/vhost-user-contrib.rst
+++ b/docs/system/devices/virtio/vhost-user-contrib.rst
@@ -85,3 +85,42 @@ vhost-user-scsi - SCSI controller
The vhost-user-scsi daemon can proxy iSCSI devices onto a virtualized
SCSI controller.
+
+.. _vhost_user_bridge:
+
+vhost-user-bridge - Network bridge
+==================================
+
+The vhost-user-bridge daemon serves as a development tool for testing real
+internet traffic by providing a networking backend, i.e. server, for the
+vhost-user protocol.
+
+Example
+-------
+For a single QEMU instance that both runs the user-mode net stack (slirp) and
+serves as a vhost-user protocol frontend, i.e. client, simultaneously:
+
+First, start vhost-user-bridge:
+
+::
+
+ $ vhost-user-bridge -u /tmp/vubr.sock \
+ -l 127.0.0.1:4444 \
+ -r 127.0.0.1:5555
+
+Then, invoke QEMU:
+
+::
+
+ $ qemu-system-x86_64 \
+ -m 4G \
+ -object memory-backend-memfd,id=mem0,size=4G,share=on,prealloc=on \
+ -numa node,memdev=mem0 \
+ -chardev socket,id=char0,path=/tmp/vubr.sock \
+ -netdev vhost-user,id=vhost0,chardev=char0,vhostforce=on \
+ -device virtio-net-pci,netdev=vhost0 \
+ -netdev socket,id=udp0,udp=localhost:4444,localaddr=localhost:5555 \
+ -netdev user,id=user0 \
+ -netdev hubport,id=hub0,hubid=0,netdev=udp0 \
+ -netdev hubport,id=hub1,hubid=0,netdev=user0 \
+ ...
diff --git a/meson.build b/meson.build
index cc0dfed066..bca61aae65 100644
--- a/meson.build
+++ b/meson.build
@@ -4494,6 +4494,7 @@ if have_tools
if have_vhost_user
subdir('contrib/vhost-user-blk')
+ subdir('contrib/vhost-user-bridge')
subdir('contrib/vhost-user-gpu')
subdir('contrib/vhost-user-input')
subdir('contrib/vhost-user-scsi')
diff --git a/tests/meson.build b/tests/meson.build
index cbe7916241..87861b2857 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -70,12 +70,6 @@ test_deps = {
'test-qht-par': qht_bench,
}
-if have_tools and have_vhost_user and host_os == 'linux'
- executable('vhost-user-bridge',
- sources: files('vhost-user-bridge.c'),
- dependencies: [qemuutil, vhost_user])
-endif
-
subdir('decode')
if 'CONFIG_TCG' in config_all_accel
--
2.52.0