On Wed, Jul 9, 2025 at 7:48 PM Eugenio Pérez
vhost-net is a kernel device that allows to read packets from a tap device using virtio queues instead of regular read(2) and write(2). This enables a more eficient packet processing, as the memory can be written directly by the kernel to the userspace and back, instead of wasting bandwith on copies, and it enables to batch many packets in a single notification (through eventfds) both tx and rx.
Namespace tx performance improves from ~26.3Gbit/s to ~36.9Gbit/s.
Namespace rx performance improves from ~16BGbit/s to ~17.26Gbit/s.
For reference, iperf without namespaces and veth both reaches ~47.8Gbit/s in both directions.
RFC: At this moment only these are supported: * Receive l2 packets from the vhost kernel to pasta * Send l4 tcp socket received data through vhost-kernel to namespace.
TODO: Add vhost zerocopy in the tests, and compare with veth. TODO: Implement at least UDP tx. Or maybe we want UDP to be write(2) because of latency? TODO: Check style for variable declarations in for loops and use of curly brackets as long as they wrap more than a line. TODO: kerneldoc style function header comments
-- v2: Add TCP tx, and integrated some comments from the previous series. Please check each patch message for details.
Eugenio Pérez (11): tap: implement vhost_call_cb tap: add die() on vhost error Replace tx tap hdr with virtio_nethdr_mrg_rxbuf tcp: export memory regions to vhost virtio: Fill .next in tx queue tap: move static iov_sock to tcp_buf_data_from_sock tap: support tx through vhost tap: add tap_free_old_xmit tcp: start conversion to circular buffer Add poll(2) to used_idx tcp_buf: adding TCP tx circular buffer
arp.c | 2 +- epoll_type.h | 4 + passt.c | 12 +- passt.h | 11 +- tap.c | 489 +++++++++++++++++++++++++++++++++++++++++++++++++-- tap.h | 13 +- tcp.c | 2 +- tcp_buf.c | 179 +++++++++++++++---- tcp_buf.h | 19 ++ udp.c | 2 +- 10 files changed, 675 insertions(+), 58 deletions(-)
-- 2.50.0