Skip to content

net/virtio: fix Rx interrupts with MSI-X

Isaac Boukris dpdk-dev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest8 patches 3 repliesIn review
  2. v37 patches 0 repliesSuperseded
  3. v25 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch3 repliesSuperseded

Changes in v4 from the cover letter

- Patch 3 is new.
- Patch 2 detaches the TAP queue again when a later step of the enable fails. One comment now says when a queue is attached, and why TUNSETQUEUE is not called twice for a state (AI review).
- Patch 4 ignores a flow number that is out of range (AI review).
- Patch 5 asks for the Rx offload without checking the capability first.
- Shorter commit messages and comments in all patches. Patches 1, 6, 7 and 8 have no code change.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8net/virtio: fix Rx interrupt setup with MSI-Xdrivers/net/virtio/virtio_ethdev.c+14 -43 replies
2/8net/virtio-user: fix packet loss with unused queue pairsdrivers/net/virtio/virtio_user/vhost_kernel.c drivers/net/virtio/virtio_user/vhost_kernel_tap.c drivers/net/virtio/virtio_user/vhost_kernel_tap.h+40 -20 replies
3/8net/virtio-user: fix unaligned reads of control commandsdrivers/net/virtio/virtio_user/virtio_user_dev.c+12 -140 replies
4/8test/virtio_user: add unit test of unused queue pairsMAINTAINERS app/test/meson.build app/test/test_pmd_virtio_user.c+266 -00 replies
5/8test/virtio_user: add unit test of Rx interruptsapp/test/test_pmd_virtio_user.c+63 -00 replies
6/8app/testpmd: add Rx queue interrupts optionapp/test-pmd/parameters.c app/test-pmd/testpmd.c app/test-pmd/testpmd.h +1 more+104 -20 replies
7/8dts: support virtio PCI portsdts/framework/testbed_model/linux_session.py+8 -10 replies
8/8dts: add Rx interrupt test suitedoc/api/dts/tests.TestSuite_rx_interrupt.rst dts/api/params/types.py dts/api/testpmd/config.py +1 more+130 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/8] net/virtio: fix Rx interrupts with MSI-X

Since 26.11-rc2, a virtio-net PCI device on vfio-pci cannot be configured with Rx interrupts and an offload or RSS, nor configured a second time. l3fwd-power fails to start on it.

Patch 1 is the fix, for 26.11 and stable. The others can wait for 27.03:

- Patch 2 fixes a packet loss on virtio-user ports with vhost-net, which the unit test of v2 found. When the application uses fewer Rx queues than the port has queue pairs, the kernel still sends flows to the TAP queues of the unused pairs. The driver detached these queues before 21.11.
- Patch 3 fixes unaligned reads in virtio-user's control queue, which the sanitizer reports on the port of the unit tests.
- Patch 4 is a unit test of patch 2, on a virtio-user port with two queue pairs and one Rx queue.
- Patch 5 is a unit test of Rx interrupts on that port. It fails without the handle type check of patch 1 ("EAL: Wrong intr vector number"), which is why patch 1 has that check.
- Patch 6 adds testpmd's --rxq-interrupt. Idle forwarding lcores then sleep on the Rx queue interrupts, as l3fwd-power does. It will need a line in the 27.03 release notes.
- Patches 7 and 8 add a DTS suite that uses it. Each packet must wake the lcore up, also after the port is configured again with the same number of queues (first case), and with two queues and then one (second case, where both queues must receive packets).

Tested in a VM (QEMU 10.2, vhost-net):

- l3fwd-power in interrupt-only mode on a virtio-net PCI port fails without patch 1, as in its commit message. With it, each packet wakes its lcore up.
- The DTS suite on a virtio-net PCI port fails without patch 1 at the second configuration, and passes with it. It also passes on an emulated Intel 82576 port (igb).
- testpmd on a virtio-user port with two queue pairs and one Rx queue receives 22 of 64 UDP flows from the kernel without patch 2, and all 64 with it. A port of the TAP driver, and a virtio-net PCI port of QEMU with four queue pairs, receive all 64 on one Rx queue.
- The unit tests pass, also with ASan and UBSan. The first fails without patch 2, and the second without the handle type check of patch 1. UBSan reports the unaligned read without patch 3.

The unit tests log "Some interrupt handle is leaking an event FD" when they close their port. This series does not cause it. main logs it for any virtio-user port since commit 67813957d8 ("interrupts: warn on leaked event FDs"), because virtio-user frees its interrupt handle before it closes its call fds.

v4:
- Patch 3 is new.
- Patch 2 detaches the TAP queue again when a later step of the enable fails. One comment now says when a queue is attached, and why TUNSETQUEUE is not called twice for a state (AI review).
- Patch 4 ignores a flow number that is out of range (AI review).
- Patch 5 asks for the Rx offload without checking the capability first.
- Shorter commit messages and comments in all patches. Patches 1, 6, 7 and 8 have no code change.

v3:
- The fix of the packet loss and its unit test were new. In v2, the unit test of Rx interrupts failed on about half of the CI hosts, because the kernel sent its frame to the TAP queue of the unused queue pair.
- The unit test of Rx interrupts moved on top of them, with an IPv4 frame.
- testpmd logs an error when the interrupt of an Rx queue cannot be registered (AI review).

v2:
- Patch 1 keeps the eventfds when the number of Rx queues did not change (David Marchand). It releases them only when the number changed, and only then must an application register the Rx queue interrupts again.
- The unit test, the testpmd option and the DTS suite were new.

Patches generated with AI assistance.

Isaac Boukris (8):
net/virtio: fix Rx interrupt setup with MSI-X net/virtio-user: fix packet loss with unused queue pairs net/virtio-user: fix unaligned reads of control commands test/virtio_user: add unit test of unused queue pairs test/virtio_user: add unit test of Rx interrupts app/testpmd: add Rx queue interrupts option
dts: support virtio PCI ports
dts: add Rx interrupt test suite

 MAINTAINERS                                   |   1 +
 app/test-pmd/parameters.c                     |   8 +
 app/test-pmd/testpmd.c                        |  89 ++++-
 app/test-pmd/testpmd.h                        |   2 +
 app/test/meson.build                          |   1 +
 app/test/test_pmd_virtio_user.c               | 327 ++++++++++++++++++
 doc/api/dts/tests.TestSuite_rx_interrupt.rst  |   8 +
 doc/guides/testpmd_app_ug/run_app.rst         |   7 +
 drivers/net/virtio/virtio_ethdev.c            |  18 +-
 drivers/net/virtio/virtio_user/vhost_kernel.c |  24 +-
 .../net/virtio/virtio_user/vhost_kernel_tap.c |  14 +
 .../net/virtio/virtio_user/vhost_kernel_tap.h |   4 +
 .../net/virtio/virtio_user/virtio_user_dev.c  |  26 +-
 dts/api/params/types.py                       |   1 +
 dts/api/testpmd/config.py                     |   2 +
 dts/framework/testbed_model/linux_session.py  |   9 +-
 dts/tests/TestSuite_rx_interrupt.py           | 119 +++++++
 17 files changed, 637 insertions(+), 23 deletions(-)
 create mode 100644 app/test/test_pmd_virtio_user.c
 create mode 100644 doc/api/dts/tests.TestSuite_rx_interrupt.rst
 create mode 100644 dts/tests/TestSuite_rx_interrupt.py
Signature · 1 line
2.56.1