public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [PATCH v6 0/7] Add vhost-user support to passt. (part 3)
Date: Mon,  7 Oct 2024 16:40:46 +0200	[thread overview]
Message-ID: <20241007144054.41868-1-lvivier@redhat.com> (raw)

This series of patches adds vhost-user support to passt
and then allows passt to connect to QEMU network backend using
virtqueue rather than a socket.

With QEMU, rather than using to connect:

  -netdev stream,id=s,server=off,addr.type=unix,addr.path=/tmp/passt_1.socket

we will use:

  -chardev socket,id=chr0,path=/tmp/passt_1.socket
  -netdev vhost-user,id=netdev0,chardev=chr0
  -device virtio-net,netdev=netdev0
  -object memory-backend-memfd,id=memfd0,share=on,size=$RAMSIZE
  -numa node,memdev=memfd0

The memory backend is needed to share data between passt and QEMU.

Performance comparison between "-netdev stream" and "-netdev vhost-user":

$ iperf3 -c localhost -p 10001  -t 60 -6 -u -b 50G

socket:
[  5]   0.00-60.05  sec  95.6 GBytes  13.7 Gbits/sec  0.017 ms  6998988/10132413 (69%)  receiver
vhost-user:
[  5]   0.00-60.04  sec   237 GBytes  33.9 Gbits/sec  0.006 ms  53673/7813770 (0.69%)  receiver

$ iperf3 -c localhost -p 10001  -t 60 -4 -u -b 50G

socket:
[  5]   0.00-60.05  sec  98.9 GBytes  14.1 Gbits/sec  0.018 ms  6260735/9501832 (66%)  receiver
vhost-user:
[  5]   0.00-60.05  sec   235 GBytes  33.7 Gbits/sec  0.008 ms  37581/7752699 (0.48%)  receiver

$ iperf3 -c localhost -p 10001  -t 60 -6

socket:
[  5]   0.00-60.00  sec  17.3 GBytes  2.48 Gbits/sec    0             sender
[  5]   0.00-60.06  sec  17.3 GBytes  2.48 Gbits/sec                  receiver
vhost-user:
[  5]   0.00-60.00  sec   191 GBytes  27.4 Gbits/sec    0             sender
[  5]   0.00-60.05  sec   191 GBytes  27.3 Gbits/sec                  receiver

$ iperf3 -c localhost -p 10001  -t 60 -4

socket:
[  5]   0.00-60.00  sec  15.6 GBytes  2.24 Gbits/sec    0             sender
[  5]   0.00-60.06  sec  15.6 GBytes  2.24 Gbits/sec                  receiver
vhost-user:
[  5]   0.00-60.00  sec   189 GBytes  27.1 Gbits/sec    0             sender
[  5]   0.00-60.04  sec   189 GBytes  27.0 Gbits/sec                  receiver

v5:
  - rebase on top of 2024_09_06.6b38f07
  - rework udp_vu.c as ref.udp.v6 has been removed and we need to
    know if we receive IPv4 or IPv6 frame when we prepare the
    guest buffers for recvmsg()
  - remove vnet->hdrlen as the size is always the same with virtio-net v1
  - address comments from David and Stefano

v6:
  - rebase
  - extract 3 patches from "vhost-user: add vhost-user":
      passt: rename tap_sock_init() to tap_backend_init()
      tcp: Export headers functions
      udp: Prepare udp.c to be shared with vhost-user
  - introduce new functions vu_collect_one_frame(),
    vu_collect(), vu_set_vnethdr(), vu_flush(), vu_send_single()
    to be called from tcp_vu.c, udp_vu.c and ICMP/DHCP where vhost-user
    code was duplicated.

v4:
  - rebase on top of 2024_08_21.1d6142f
    (rebasing on top of 620e19a1b48a ("udp: Merge udp[46]_mh_recv arrays")
     introduces a regression in the measure of the latency with UDP
     because I think I don't replace correctly ref.udp.v6 that is removed
     by this commit)
  - Addressed most of the comments from David and Stefano
    (I didn't want to postpone this version to next week,
     so I'll address the remaining comments in the next version).

v3:
  - rebase on top of flow table
  - update tcp_vu.c to look like udp_vu.c (recv()/prepare()/send_frame())
  - address comments from Stefano and David on version 2

v2:
  - remove PATCH 4
  - rewrite PATCH 2 and 3 to follow passt coding style
  - move some code from PATCH 3 to PATCH 4 (previously PATCH 5)
  - partially addressed David's comment on PATCH 5

Laurent Vivier (7):
  packet: replace struct desc by struct iovec
  vhost-user: introduce virtio API
  vhost-user: introduce vhost-user API
  udp: Prepare udp.c to be shared with vhost-user
  tcp: Export headers functions
  passt: rename tap_sock_init() to tap_backend_init()
  vhost-user: add vhost-user

 Makefile       |    6 +-
 conf.c         |   22 +-
 epoll_type.h   |    4 +
 iov.c          |    1 -
 isolation.c    |   15 +-
 packet.c       |   91 +++--
 packet.h       |   22 +-
 passt.1        |   10 +-
 passt.c        |   11 +-
 passt.h        |    6 +
 pcap.c         |    1 -
 tap.c          |  128 ++++--
 tap.h          |    7 +-
 tcp.c          |   37 +-
 tcp_internal.h |   15 +
 tcp_vu.c       |  476 +++++++++++++++++++++++
 tcp_vu.h       |   12 +
 udp.c          |   84 ++--
 udp_internal.h |   34 ++
 udp_vu.c       |  332 ++++++++++++++++
 udp_vu.h       |   13 +
 util.h         |    8 +
 vhost_user.c   | 1005 ++++++++++++++++++++++++++++++++++++++++++++++++
 vhost_user.h   |  206 ++++++++++
 virtio.c       |  660 +++++++++++++++++++++++++++++++
 virtio.h       |  184 +++++++++
 vu_common.c    |  327 ++++++++++++++++
 vu_common.h    |   47 +++
 28 files changed, 3626 insertions(+), 138 deletions(-)
 create mode 100644 tcp_vu.c
 create mode 100644 tcp_vu.h
 create mode 100644 udp_internal.h
 create mode 100644 udp_vu.c
 create mode 100644 udp_vu.h
 create mode 100644 vhost_user.c
 create mode 100644 vhost_user.h
 create mode 100644 virtio.c
 create mode 100644 virtio.h
 create mode 100644 vu_common.c
 create mode 100644 vu_common.h

-- 
2.46.2



             reply	other threads:[~2024-10-07 14:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07 14:40 Laurent Vivier [this message]
2024-10-07 14:40 ` [PATCH v6 1/7] packet: replace struct desc by struct iovec Laurent Vivier
2024-10-07 14:40 ` [PATCH v6 2/7] vhost-user: introduce virtio API Laurent Vivier
2024-10-07 14:40 ` [PATCH v6 3/7] vhost-user: introduce vhost-user API Laurent Vivier
2024-10-07 14:40 ` [PATCH v6 4/7] udp: Prepare udp.c to be shared with vhost-user Laurent Vivier
2024-10-07 14:40 ` [PATCH v6 5/7] tcp: Export headers functions Laurent Vivier
2024-10-07 14:40 ` [PATCH v6 6/7] passt: rename tap_sock_init() to tap_backend_init() Laurent Vivier
2024-10-07 14:40 ` [PATCH v6 7/7] vhost-user: add vhost-user Laurent Vivier
2024-10-09  8:23   ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241007144054.41868-1-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).