[PATCH 0/8] net: Add passt netdev backend

Laurent Vivier posted 8 patches 5 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
hmp-commands.hx          |   3 +
hw/net/vhost_net-stub.c  |   1 -
hw/net/vhost_net.c       |  89 ++---
hw/net/virtio-net.c      |  18 +-
include/net/net.h        |  12 +
include/net/tap.h        |   3 -
include/net/vhost-user.h |  19 --
include/net/vhost-vdpa.h |   2 -
meson.build              |   6 +
meson_options.txt        |   2 +
net/clients.h            |   4 +
net/hub.c                |   3 +
net/meson.build          |   6 +-
net/net.c                |  55 ++-
net/passt.c              | 718 +++++++++++++++++++++++++++++++++++++++
net/stream.c             | 282 ++++-----------
net/stream_data.c        | 193 +++++++++++
net/stream_data.h        |  31 ++
net/tap-win32.c          |   5 -
net/tap.c                |  20 +-
net/vhost-user-stub.c    |   1 -
net/vhost-user.c         |  22 +-
net/vhost-vdpa.c         |   4 +-
qapi/net.json            | 121 +++++++
qemu-options.hx          |  18 +
25 files changed, 1293 insertions(+), 345 deletions(-)
delete mode 100644 include/net/vhost-user.h
create mode 100644 net/passt.c
create mode 100644 net/stream_data.c
create mode 100644 net/stream_data.h
[PATCH 0/8] net: Add passt netdev backend
Posted by Laurent Vivier 5 months ago
This series introduces support for passt as a new network backend for
QEMU.

passt is a modern, unprivileged, user-mode networking solution that
provides guest connectivity by launching an external helper process. This
series adds the core backend and integrates it with vhost-user for
high-performance, accelerated networking.

The series is structured to first improve the general networking code
before adding the new feature. The first patch extracts from the stream
backend the functions that will be reused in the passt backend. The
following patches are a preparatory refactoring to decouple the generic
vhost layer from specific backend implementations (tap, vhost-user, etc.).
This is achieved by replacing hardcoded type checks with a callback-based
system in NetClientInfo, making the vhost infrastructure more modular and
extensible.

With the refactoring in place, subsequent patches introduce the passt
backend itself, reusing the generic stream handling logic. The final
patch adds vhost-user support to passt, which plugs cleanly into the
newly refactored vhost layer.

Some benchmarks:

 Reference '-net user':

  -net user,hostfwd=tcp::10001-:10001

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

    [ ID] Interval           Transfer     Bitrate         Retr
    [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec    1            sender
    [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec                  receiver

 New backend '-netdev passt'

  -netdev passt,vhost-user=off,tcp-ports=10001

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

    [ ID] Interval           Transfer     Bitrate         Retr
    [  5]   0.00-60.00  sec  27.1 GBytes  3.88 Gbits/sec    0            sender
    [  5]   0.00-60.03  sec  27.1 GBytes  3.88 Gbits/sec                  receiver

  -netdev passt,vhost-user=on,tcp-ports=10001

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

    [ ID] Interval           Transfer     Bitrate         Retr
    [  5]   0.00-60.00  sec   224 GBytes  32.1 Gbits/sec    4            sender
    [  5]   0.00-60.05  sec   224 GBytes  32.0 Gbits/sec                  receiver

Thanks,
Laurent

Laurent Vivier (8):
  net: Refactor stream logic for reuse in '-net passt'
  net: Define net_client_set_link()
  net: Introduce helper to identify vhost-user clients
  net: Add get_vhost_net callback to NetClientInfo
  net: Add get_acked_features callback to NetClientInfo
  net: Add save_acked_features callback to NetClientInfo
  net: Add passt network backend
  net/passt: Implement vhost-user backend support

 hmp-commands.hx          |   3 +
 hw/net/vhost_net-stub.c  |   1 -
 hw/net/vhost_net.c       |  89 ++---
 hw/net/virtio-net.c      |  18 +-
 include/net/net.h        |  12 +
 include/net/tap.h        |   3 -
 include/net/vhost-user.h |  19 --
 include/net/vhost-vdpa.h |   2 -
 meson.build              |   6 +
 meson_options.txt        |   2 +
 net/clients.h            |   4 +
 net/hub.c                |   3 +
 net/meson.build          |   6 +-
 net/net.c                |  55 ++-
 net/passt.c              | 718 +++++++++++++++++++++++++++++++++++++++
 net/stream.c             | 282 ++++-----------
 net/stream_data.c        | 193 +++++++++++
 net/stream_data.h        |  31 ++
 net/tap-win32.c          |   5 -
 net/tap.c                |  20 +-
 net/vhost-user-stub.c    |   1 -
 net/vhost-user.c         |  22 +-
 net/vhost-vdpa.c         |   4 +-
 qapi/net.json            | 121 +++++++
 qemu-options.hx          |  18 +
 25 files changed, 1293 insertions(+), 345 deletions(-)
 delete mode 100644 include/net/vhost-user.h
 create mode 100644 net/passt.c
 create mode 100644 net/stream_data.c
 create mode 100644 net/stream_data.h

-- 
2.49.0

Re: [PATCH 0/8] net: Add passt netdev backend
Posted by Jason Wang 4 months, 3 weeks ago
On Wed, Jun 18, 2025 at 4:39 PM Laurent Vivier <lvivier@redhat.com> wrote:
>
> This series introduces support for passt as a new network backend for
> QEMU.
>
> passt is a modern, unprivileged, user-mode networking solution that
> provides guest connectivity by launching an external helper process. This
> series adds the core backend and integrates it with vhost-user for
> high-performance, accelerated networking.
>
> The series is structured to first improve the general networking code
> before adding the new feature. The first patch extracts from the stream
> backend the functions that will be reused in the passt backend. The
> following patches are a preparatory refactoring to decouple the generic
> vhost layer from specific backend implementations (tap, vhost-user, etc.).
> This is achieved by replacing hardcoded type checks with a callback-based
> system in NetClientInfo, making the vhost infrastructure more modular and
> extensible.
>
> With the refactoring in place, subsequent patches introduce the passt
> backend itself, reusing the generic stream handling logic. The final
> patch adds vhost-user support to passt, which plugs cleanly into the
> newly refactored vhost layer.
>
> Some benchmarks:
>
>  Reference '-net user':
>
>   -net user,hostfwd=tcp::10001-:10001
>
>     iperf3 -c localhost -p 10001  -t 60 -4
>
>     [ ID] Interval           Transfer     Bitrate         Retr
>     [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec    1            sender
>     [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec                  receiver
>
>  New backend '-netdev passt'
>
>   -netdev passt,vhost-user=off,tcp-ports=10001
>
>     iperf3 -c localhost -p 10001  -t 60 -4
>
>     [ ID] Interval           Transfer     Bitrate         Retr
>     [  5]   0.00-60.00  sec  27.1 GBytes  3.88 Gbits/sec    0            sender
>     [  5]   0.00-60.03  sec  27.1 GBytes  3.88 Gbits/sec                  receiver
>
>   -netdev passt,vhost-user=on,tcp-ports=10001
>
>     iperf3 -c localhost -p 10001  -t 60 -4
>
>     [ ID] Interval           Transfer     Bitrate         Retr
>     [  5]   0.00-60.00  sec   224 GBytes  32.1 Gbits/sec    4            sender
>     [  5]   0.00-60.05  sec   224 GBytes  32.0 Gbits/sec                  receiver

Do we have latency numbers of even PPS?

Thanks

>
> Thanks,
> Laurent
>
> Laurent Vivier (8):
>   net: Refactor stream logic for reuse in '-net passt'
>   net: Define net_client_set_link()
>   net: Introduce helper to identify vhost-user clients
>   net: Add get_vhost_net callback to NetClientInfo
>   net: Add get_acked_features callback to NetClientInfo
>   net: Add save_acked_features callback to NetClientInfo
>   net: Add passt network backend
>   net/passt: Implement vhost-user backend support
>
>  hmp-commands.hx          |   3 +
>  hw/net/vhost_net-stub.c  |   1 -
>  hw/net/vhost_net.c       |  89 ++---
>  hw/net/virtio-net.c      |  18 +-
>  include/net/net.h        |  12 +
>  include/net/tap.h        |   3 -
>  include/net/vhost-user.h |  19 --
>  include/net/vhost-vdpa.h |   2 -
>  meson.build              |   6 +
>  meson_options.txt        |   2 +
>  net/clients.h            |   4 +
>  net/hub.c                |   3 +
>  net/meson.build          |   6 +-
>  net/net.c                |  55 ++-
>  net/passt.c              | 718 +++++++++++++++++++++++++++++++++++++++
>  net/stream.c             | 282 ++++-----------
>  net/stream_data.c        | 193 +++++++++++
>  net/stream_data.h        |  31 ++
>  net/tap-win32.c          |   5 -
>  net/tap.c                |  20 +-
>  net/vhost-user-stub.c    |   1 -
>  net/vhost-user.c         |  22 +-
>  net/vhost-vdpa.c         |   4 +-
>  qapi/net.json            | 121 +++++++
>  qemu-options.hx          |  18 +
>  25 files changed, 1293 insertions(+), 345 deletions(-)
>  delete mode 100644 include/net/vhost-user.h
>  create mode 100644 net/passt.c
>  create mode 100644 net/stream_data.c
>  create mode 100644 net/stream_data.h
>
> --
> 2.49.0
>
>
Re: [PATCH 0/8] net: Add passt netdev backend
Posted by Laurent Vivier 4 months, 3 weeks ago
On 23/06/2025 10:03, Jason Wang wrote:
> On Wed, Jun 18, 2025 at 4:39 PM Laurent Vivier <lvivier@redhat.com> wrote:
>>
>> This series introduces support for passt as a new network backend for
>> QEMU.
>>
>> passt is a modern, unprivileged, user-mode networking solution that
>> provides guest connectivity by launching an external helper process. This
>> series adds the core backend and integrates it with vhost-user for
>> high-performance, accelerated networking.
>>
>> The series is structured to first improve the general networking code
>> before adding the new feature. The first patch extracts from the stream
>> backend the functions that will be reused in the passt backend. The
>> following patches are a preparatory refactoring to decouple the generic
>> vhost layer from specific backend implementations (tap, vhost-user, etc.).
>> This is achieved by replacing hardcoded type checks with a callback-based
>> system in NetClientInfo, making the vhost infrastructure more modular and
>> extensible.
>>
>> With the refactoring in place, subsequent patches introduce the passt
>> backend itself, reusing the generic stream handling logic. The final
>> patch adds vhost-user support to passt, which plugs cleanly into the
>> newly refactored vhost layer.
>>
>> Some benchmarks:
>>
>>   Reference '-net user':
>>
>>    -net user,hostfwd=tcp::10001-:10001
>>
>>      iperf3 -c localhost -p 10001  -t 60 -4
>>
>>      [ ID] Interval           Transfer     Bitrate         Retr
>>      [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec    1            sender
>>      [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec                  receiver
>>
>>   New backend '-netdev passt'
>>
>>    -netdev passt,vhost-user=off,tcp-ports=10001
>>
>>      iperf3 -c localhost -p 10001  -t 60 -4
>>
>>      [ ID] Interval           Transfer     Bitrate         Retr
>>      [  5]   0.00-60.00  sec  27.1 GBytes  3.88 Gbits/sec    0            sender
>>      [  5]   0.00-60.03  sec  27.1 GBytes  3.88 Gbits/sec                  receiver
>>
>>    -netdev passt,vhost-user=on,tcp-ports=10001
>>
>>      iperf3 -c localhost -p 10001  -t 60 -4
>>
>>      [ ID] Interval           Transfer     Bitrate         Retr
>>      [  5]   0.00-60.00  sec   224 GBytes  32.1 Gbits/sec    4            sender
>>      [  5]   0.00-60.05  sec   224 GBytes  32.0 Gbits/sec                  receiver
> 
> Do we have latency numbers of even PPS?

Could you propose tools and tests I can run to have these numbers?

Thanks,
Laurent


Re: [PATCH 0/8] net: Add passt netdev backend
Posted by Jason Wang 4 months, 3 weeks ago
On Mon, Jun 23, 2025 at 4:10 PM Laurent Vivier <lvivier@redhat.com> wrote:
>
> On 23/06/2025 10:03, Jason Wang wrote:
> > On Wed, Jun 18, 2025 at 4:39 PM Laurent Vivier <lvivier@redhat.com> wrote:
> >>
> >> This series introduces support for passt as a new network backend for
> >> QEMU.
> >>
> >> passt is a modern, unprivileged, user-mode networking solution that
> >> provides guest connectivity by launching an external helper process. This
> >> series adds the core backend and integrates it with vhost-user for
> >> high-performance, accelerated networking.
> >>
> >> The series is structured to first improve the general networking code
> >> before adding the new feature. The first patch extracts from the stream
> >> backend the functions that will be reused in the passt backend. The
> >> following patches are a preparatory refactoring to decouple the generic
> >> vhost layer from specific backend implementations (tap, vhost-user, etc.).
> >> This is achieved by replacing hardcoded type checks with a callback-based
> >> system in NetClientInfo, making the vhost infrastructure more modular and
> >> extensible.
> >>
> >> With the refactoring in place, subsequent patches introduce the passt
> >> backend itself, reusing the generic stream handling logic. The final
> >> patch adds vhost-user support to passt, which plugs cleanly into the
> >> newly refactored vhost layer.
> >>
> >> Some benchmarks:
> >>
> >>   Reference '-net user':
> >>
> >>    -net user,hostfwd=tcp::10001-:10001
> >>
> >>      iperf3 -c localhost -p 10001  -t 60 -4
> >>
> >>      [ ID] Interval           Transfer     Bitrate         Retr
> >>      [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec    1            sender
> >>      [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec                  receiver
> >>
> >>   New backend '-netdev passt'
> >>
> >>    -netdev passt,vhost-user=off,tcp-ports=10001
> >>
> >>      iperf3 -c localhost -p 10001  -t 60 -4
> >>
> >>      [ ID] Interval           Transfer     Bitrate         Retr
> >>      [  5]   0.00-60.00  sec  27.1 GBytes  3.88 Gbits/sec    0            sender
> >>      [  5]   0.00-60.03  sec  27.1 GBytes  3.88 Gbits/sec                  receiver
> >>
> >>    -netdev passt,vhost-user=on,tcp-ports=10001
> >>
> >>      iperf3 -c localhost -p 10001  -t 60 -4
> >>
> >>      [ ID] Interval           Transfer     Bitrate         Retr
> >>      [  5]   0.00-60.00  sec   224 GBytes  32.1 Gbits/sec    4            sender
> >>      [  5]   0.00-60.05  sec   224 GBytes  32.0 Gbits/sec                  receiver
> >
> > Do we have latency numbers of even PPS?
>
> Could you propose tools and tests I can run to have these numbers?

For latency, we can use netperf -t TCP_RR.
For PPS, we can use pktgen, kernel source has samples under
samples/pktgen, pktgen_sample03_burst_single_flow.sh could be a good
script, please make sure burst is used in the test to stress the
virtio-net as much as possible.

Thanks


>
> Thanks,
> Laurent
>
Re: [PATCH 0/8] net: Add passt netdev backend
Posted by Lei Yang 4 months, 3 weeks ago
Because of these code changes the virtio-net files, CI triggers
regression tests for it with virtio-net, everything works fine.

Tested-by: Lei Yang <leiyang@redhat.com>

On Tue, Jun 24, 2025 at 8:41 AM Jason Wang <jasowang@redhat.com> wrote:
>
> On Mon, Jun 23, 2025 at 4:10 PM Laurent Vivier <lvivier@redhat.com> wrote:
> >
> > On 23/06/2025 10:03, Jason Wang wrote:
> > > On Wed, Jun 18, 2025 at 4:39 PM Laurent Vivier <lvivier@redhat.com> wrote:
> > >>
> > >> This series introduces support for passt as a new network backend for
> > >> QEMU.
> > >>
> > >> passt is a modern, unprivileged, user-mode networking solution that
> > >> provides guest connectivity by launching an external helper process. This
> > >> series adds the core backend and integrates it with vhost-user for
> > >> high-performance, accelerated networking.
> > >>
> > >> The series is structured to first improve the general networking code
> > >> before adding the new feature. The first patch extracts from the stream
> > >> backend the functions that will be reused in the passt backend. The
> > >> following patches are a preparatory refactoring to decouple the generic
> > >> vhost layer from specific backend implementations (tap, vhost-user, etc.).
> > >> This is achieved by replacing hardcoded type checks with a callback-based
> > >> system in NetClientInfo, making the vhost infrastructure more modular and
> > >> extensible.
> > >>
> > >> With the refactoring in place, subsequent patches introduce the passt
> > >> backend itself, reusing the generic stream handling logic. The final
> > >> patch adds vhost-user support to passt, which plugs cleanly into the
> > >> newly refactored vhost layer.
> > >>
> > >> Some benchmarks:
> > >>
> > >>   Reference '-net user':
> > >>
> > >>    -net user,hostfwd=tcp::10001-:10001
> > >>
> > >>      iperf3 -c localhost -p 10001  -t 60 -4
> > >>
> > >>      [ ID] Interval           Transfer     Bitrate         Retr
> > >>      [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec    1            sender
> > >>      [  5]   0.00-60.00  sec  14.2 GBytes  2.03 Gbits/sec                  receiver
> > >>
> > >>   New backend '-netdev passt'
> > >>
> > >>    -netdev passt,vhost-user=off,tcp-ports=10001
> > >>
> > >>      iperf3 -c localhost -p 10001  -t 60 -4
> > >>
> > >>      [ ID] Interval           Transfer     Bitrate         Retr
> > >>      [  5]   0.00-60.00  sec  27.1 GBytes  3.88 Gbits/sec    0            sender
> > >>      [  5]   0.00-60.03  sec  27.1 GBytes  3.88 Gbits/sec                  receiver
> > >>
> > >>    -netdev passt,vhost-user=on,tcp-ports=10001
> > >>
> > >>      iperf3 -c localhost -p 10001  -t 60 -4
> > >>
> > >>      [ ID] Interval           Transfer     Bitrate         Retr
> > >>      [  5]   0.00-60.00  sec   224 GBytes  32.1 Gbits/sec    4            sender
> > >>      [  5]   0.00-60.05  sec   224 GBytes  32.0 Gbits/sec                  receiver
> > >
> > > Do we have latency numbers of even PPS?
> >
> > Could you propose tools and tests I can run to have these numbers?
>
> For latency, we can use netperf -t TCP_RR.
> For PPS, we can use pktgen, kernel source has samples under
> samples/pktgen, pktgen_sample03_burst_single_flow.sh could be a good
> script, please make sure burst is used in the test to stress the
> virtio-net as much as possible.
>
> Thanks
>
>
> >
> > Thanks,
> > Laurent
> >
>
>