All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC v2 0/2] Vhost-vdpa Shadow Virtqueue _F_CTRL_RX_EXTRA commands support
@ 2023-07-03  6:50 Hawkins Jiawei
  2023-07-03  6:59 ` [PATCH RFC v2 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature Hawkins Jiawei
  2023-07-03  6:59 ` [PATCH RFC v2 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ Hawkins Jiawei
  0 siblings, 2 replies; 3+ messages in thread
From: Hawkins Jiawei @ 2023-07-03  6:50 UTC (permalink / raw)
  To: jasowang, mst, eperezma; +Cc: qemu-devel, yin31149, 18801353760

This series enables shadowed CVQ to intercept rx commands related to
VIRTIO_NET_F_CTRL_RX_EXTRA feature through shadowed CVQ, update the virtio
NIC device model so qemu send it in a migration, and the restore of
that rx state in the destination.

To test this patch series, one should modify the `n->parent_obj.guest_features`
value in vhost_vdpa_net_load_rx() using gdb, as the linux virtio-net
driver does not currently support the VIRTIO_NET_F_CTRL_RX_EXTRA
feature.

Note that this patch should be based on [1], which has not
been merged yet. I will submit the new viersion patch after it is merged.

[1]. https://lists.nongnu.org/archive/html/qemu-devel/2023-06/msg06559.html

Changelog
=========
v2:
  - avoid sending CVQ command in default state suggested by Eugenio

v1: https://lists.nongnu.org/archive/html/qemu-devel/2023-06/msg04956.html

Hawkins Jiawei (2):
  vdpa: Restore packet receive filtering state relative with
    _F_CTRL_RX_EXTRA feature
  vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ

 net/vhost-vdpa.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH RFC v2 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature
  2023-07-03  6:50 [PATCH RFC v2 0/2] Vhost-vdpa Shadow Virtqueue _F_CTRL_RX_EXTRA commands support Hawkins Jiawei
@ 2023-07-03  6:59 ` Hawkins Jiawei
  2023-07-03  6:59 ` [PATCH RFC v2 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ Hawkins Jiawei
  1 sibling, 0 replies; 3+ messages in thread
From: Hawkins Jiawei @ 2023-07-03  6:59 UTC (permalink / raw)
  To: jasowang, mst, eperezma; +Cc: qemu-devel, yin31149, 18801353760

This patch refactors vhost_vdpa_net_load_rx() to
restore the packet receive filtering state in relation to
VIRTIO_NET_F_CTRL_RX_EXTRA feature at device's startup.

Signed-off-by: Hawkins Jiawei <yin31149@gmail.com>
---
v2:
  - avoid sending CVQ command in default state suggested by Eugenio

v1: https://lists.nongnu.org/archive/html/qemu-devel/2023-06/msg04957.html

 net/vhost-vdpa.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 0410a52043..4919e18208 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -890,6 +890,88 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s,
         }
     }
 
+    if (virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_CTRL_RX_EXTRA)) {
+        /* Load the all-unicast mode */
+        on = n->alluni;
+        if (on != 0) {
+            /*
+             * According to virtio_net_reset(), device turns all-unicast mode
+             * off by default.
+             *
+             * Therefore, there is no need to send this CVQ command if the
+             * driver also sets all-unicast mode off, which aligns with
+             * the device's defaults.
+             *
+             * Note that the device's defaults can mismatch the driver's
+             * configuration only at live migration.
+             */
+            r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_ALLUNI, on);
+            if (r < 0) {
+                return r;
+            }
+        }
+
+        /* Load the non-multicast mode */
+        on = n->nomulti;
+        if (on != 0) {
+            /*
+             * According to virtio_net_reset(), device turns non-multicast mode
+             * off by default.
+             *
+             * Therefore, there is no need to send this CVQ command if the
+             * driver also sets non-multicast mode off, which aligns with
+             * the device's defaults.
+             *
+             * Note that the device's defaults can mismatch the driver's
+             * configuration only at live migration.
+             */
+            r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOMULTI, on);
+            if (r < 0) {
+                return r;
+            }
+        }
+
+        /* Load the non-unicast mode */
+        on = n->nouni;
+        if (on != 0) {
+            /*
+             * According to virtio_net_reset(), device turns non-unicast mode
+             * off by default.
+             *
+             * Therefore, there is no need to send this CVQ command if the
+             * driver also sets non-unicast mode off, which aligns with
+             * the device's defaults.
+             *
+             * Note that the device's defaults can mismatch the driver's
+             * configuration only at live migration.
+             */
+            r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOUNI, on);
+            if (r < 0) {
+                return r;
+            }
+        }
+
+        /* Load the non-broadcast mode */
+        on = n->nobcast;
+        if (on != 0) {
+            /*
+             * According to virtio_net_reset(), device turns non-broadcast mode
+             * off by default.
+             *
+             * Therefore, there is no need to send this CVQ command if the
+             * driver also sets non-broadcast mode off, which aligns with
+             * the device's defaults.
+             *
+             * Note that the device's defaults can mismatch the driver's
+             * configuration only at live migration.
+             */
+            r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOBCAST, on);
+            if (r < 0) {
+                return r;
+            }
+        }
+    }
+
     return 0;
 }
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH RFC v2 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ
  2023-07-03  6:50 [PATCH RFC v2 0/2] Vhost-vdpa Shadow Virtqueue _F_CTRL_RX_EXTRA commands support Hawkins Jiawei
  2023-07-03  6:59 ` [PATCH RFC v2 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature Hawkins Jiawei
@ 2023-07-03  6:59 ` Hawkins Jiawei
  1 sibling, 0 replies; 3+ messages in thread
From: Hawkins Jiawei @ 2023-07-03  6:59 UTC (permalink / raw)
  To: jasowang, mst, eperezma; +Cc: qemu-devel, yin31149, 18801353760

Enable SVQ with VIRTIO_NET_F_CTRL_RX_EXTRA feature.

Signed-off-by: Hawkins Jiawei <yin31149@gmail.com>
Acked-by: Eugenio Pérez <eperezma@redhat.com>
---
 net/vhost-vdpa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 4919e18208..e10a0128c3 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -105,6 +105,7 @@ static const uint64_t vdpa_svq_device_features =
     BIT_ULL(VIRTIO_NET_F_STATUS) |
     BIT_ULL(VIRTIO_NET_F_CTRL_VQ) |
     BIT_ULL(VIRTIO_NET_F_CTRL_RX) |
+    BIT_ULL(VIRTIO_NET_F_CTRL_RX_EXTRA) |
     BIT_ULL(VIRTIO_NET_F_MQ) |
     BIT_ULL(VIRTIO_F_ANY_LAYOUT) |
     BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR) |
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-03  7:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-03  6:50 [PATCH RFC v2 0/2] Vhost-vdpa Shadow Virtqueue _F_CTRL_RX_EXTRA commands support Hawkins Jiawei
2023-07-03  6:59 ` [PATCH RFC v2 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature Hawkins Jiawei
2023-07-03  6:59 ` [PATCH RFC v2 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ Hawkins Jiawei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.