Skip to content

vdpa net devices Rx filter change notification with Shadow VQ

Eugenio Pérez qemu-devel 6 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest21 patches 0 repliesNew
  2. v520 patches 1 replySuperseded
  3. v419 patches 4 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v319 patches3 repliesSuperseded
v219 patches22 repliesSuperseded
v122 patches2 repliesSuperseded

Changes in v6 from the cover letter

- Add vhost-vdpa-stub.c in case qemu is compiled with no virtio-net support

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21vhost: move descriptor translation to vhost_svq_vring_write_descshw/virtio/vhost-shadow-virtqueue.c+27 -110 replies
2/21virtio-net: Expose MAC_TABLE_ENTRIEShw/net/virtio-net.c include/hw/virtio/virtio-net.h+3 -10 replies
3/21virtio-net: Expose ctrl virtqueue logichw/net/virtio-net.c include/hw/virtio/virtio-net.h+53 -350 replies
4/21vdpa: Avoid compiler to squash reads to used idxhw/virtio/vhost-shadow-virtqueue.c+2 -10 replies
5/21vhost: Reorder vhost_svq_kickhw/virtio/vhost-shadow-virtqueue.c+14 -140 replies
6/21vhost: Move vhost_svq_kick call to vhost_svq_addhw/virtio/vhost-shadow-virtqueue.c+1 -10 replies
7/21vhost: Check for queue full at vhost_svq_addhw/virtio/vhost-shadow-virtqueue.c+33 -260 replies
8/21vhost: Decouple vhost_svq_add from VirtQueueElementhw/virtio/vhost-shadow-virtqueue.c+22 -110 replies
9/21vhost: Add SVQDescStatehw/virtio/vhost-shadow-virtqueue.c hw/virtio/vhost-shadow-virtqueue.h+14 -100 replies
10/21vhost: Track number of descs in SVQDescStatehw/virtio/vhost-shadow-virtqueue.c hw/virtio/vhost-shadow-virtqueue.h+8 -20 replies
11/21vhost: add vhost_svq_push_elemhw/virtio/vhost-shadow-virtqueue.c hw/virtio/vhost-shadow-virtqueue.h+19 -00 replies
12/21vhost: Expose vhost_svq_addhw/virtio/vhost-shadow-virtqueue.c hw/virtio/vhost-shadow-virtqueue.h+6 -30 replies
13/21vhost: add vhost_svq_pollhw/virtio/vhost-shadow-virtqueue.c hw/virtio/vhost-shadow-virtqueue.h+28 -00 replies
14/21vhost: Add svq avail_handler callbackhw/virtio/vhost-shadow-virtqueue.c hw/virtio/vhost-shadow-virtqueue.h hw/virtio/vhost-vdpa.c+44 -40 replies
15/21vdpa: Export vhost_vdpa_dma_map and unmap callshw/virtio/vhost-vdpa.c include/hw/virtio/vhost-vdpa.h+7 -40 replies
16/21vhost-net-vdpa: add stubs for when no virtio-net device is presentnet/meson.build net/vhost-vdpa-stub.c+23 -10 replies
17/21vdpa: manual forward CVQ buffershw/virtio/vhost-vdpa.c include/hw/virtio/vhost-vdpa.h net/vhost-vdpa.c+63 -10 replies
18/21vdpa: Buffer CVQ support on shadow virtqueuenet/vhost-vdpa.c+205 -80 replies
19/21vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairsnet/vhost-vdpa.c+20 -100 replies
20/21vdpa: Add device migration blockerhw/virtio/vhost-vdpa.c include/hw/virtio/vhost-vdpa.h+16 -00 replies
21/21vdpa: Add x-svq to NetdevVhostVDPAOptionsnet/vhost-vdpa.c qapi/net.json+77 -40 replies

Reviews trailers per patch

5 of 21 patches have a Reviewed-by or Acked-by.

PatchJason WangMarkus Armbruster
1/21A-b
2/21
3/21
4/21
5/21
6/21
7/21
8/21A-b
9/21
10/21
11/21
12/21
13/21
14/21
15/21A-b
16/21
17/21
18/21
19/21A-b
20/21
21/21A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 00/21] vdpa net devices Rx filter change notification with Shadow VQ

Control virtqueue is used by networking device for accepting various commands from the driver. It's a must to support advanced configurations.

Rx filtering event is issues by qemu when device's MAC address changed once and the previous one has not been queried by external agents.

Shadow VirtQueue (SVQ) already makes possible tracking the state of virtqueues, effectively intercepting them so qemu can track what regions of memory are dirty because device action and needs migration. However, this does not solve networking device state seen by the driver because CVQ messages, like changes on MAC addresses from the driver.

This series uses SVQ infrastructure to intercept networking control messages used by the device. This way, qemu is able to update VirtIONet device model and react to them. In particular, this series enables rx filter change notification.

This is a prerequisite to achieve net vdpa device with CVQ live migration. It's a stripped down version of [1], with error paths checked and no migration enabled.

First ten patches reorder and clean code base so its easier to apply later ones. No functional change should be noticed from these changes.

Patches from 11 to 15 enable SVQ API to make other parts of qemu to interact with it. In particular, they will be used by vhost-vdpa net to handle CVQ messages.

Patches 16 to 18 enable the update of the virtio-net device model for each CVQ message acknowledged by the device.

Last patches enable x-svq parameter, forbidding device migration since it is not restored in the destination's vdpa device yet. This will be added in later series, using this work.

They could conflict trivially with series [2].

Comments are welcome.
v6:
- Add vhost-vdpa-stub.c in case qemu is compiled with no virtio-net support

v5:
- Add a volatile access modifier to force compiler to emit the read instruction
- Fix use of undefined variable

v4:
- Add a timeout to vhost_svq_poll to not hold BQL forever

v3:
- Replace SVQElement with SVQDescState

v2:
- (Comments from series [1]).
- Active poll for CVQ answer instead of relay on async used callback
- Do not offer a new buffer to device but reuse qemu's
- Use vhost_svq_add instead of not needed vhost_svq_inject
- Delete used and detach callbacks, not needed anymore
- Embed members of SVQElement in VirtQueueElement
- Reuse the same buffers for all CVQ commands

[1] https://patchwork.kernel.org/project/qemu-devel/cover/[email protected]/
[2] https://lists.nongnu.org/archive/html/qemu-devel/2022-07/msg02984.html

Eugenio Pérez (21):
vhost: move descriptor translation to vhost_svq_vring_write_descs
virtio-net: Expose MAC_TABLE_ENTRIES
virtio-net: Expose ctrl virtqueue logic
vdpa: Avoid compiler to squash reads to used idx
vhost: Reorder vhost_svq_kick
vhost: Move vhost_svq_kick call to vhost_svq_add
vhost: Check for queue full at vhost_svq_add
vhost: Decouple vhost_svq_add from VirtQueueElement
vhost: Add SVQDescState
vhost: Track number of descs in SVQDescState
vhost: add vhost_svq_push_elem
vhost: Expose vhost_svq_add
vhost: add vhost_svq_poll
vhost: Add svq avail_handler callback
vdpa: Export vhost_vdpa_dma_map and unmap calls
vhost-net-vdpa: add stubs for when no virtio-net device is present
vdpa: manual forward CVQ buffers
vdpa: Buffer CVQ support on shadow virtqueue
vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs
vdpa: Add device migration blocker
vdpa: Add x-svq to NetdevVhostVDPAOptions

 qapi/net.json                      |   9 +-
 hw/virtio/vhost-shadow-virtqueue.h |  52 ++++-
 include/hw/virtio/vhost-vdpa.h     |   8 +
 include/hw/virtio/virtio-net.h     |   7 +
 hw/net/virtio-net.c                |  85 ++++---
 hw/virtio/vhost-shadow-virtqueue.c | 210 ++++++++++++-----
 hw/virtio/vhost-vdpa.c             |  26 ++-
 net/vhost-vdpa-stub.c              |  21 ++
 net/vhost-vdpa.c                   | 357 +++++++++++++++++++++++++++--
 net/meson.build                    |   3 +-
 10 files changed, 658 insertions(+), 120 deletions(-)
 create mode 100644 net/vhost-vdpa-stub.c
Signature · 1 line
2.31.1