qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] Vhost-vdpa Shadow Virtqueue _F_CTRL_RX_EXTRA commands support
@ 2023-06-23 13:26 Hawkins Jiawei
  2023-06-23 13:26 ` [PATCH RFC 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature Hawkins Jiawei
  2023-06-23 13:26 ` [PATCH RFC 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ Hawkins Jiawei
  0 siblings, 2 replies; 6+ messages in thread
From: Hawkins Jiawei @ 2023-06-23 13:26 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, I 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 v2 patch after they are merged.

[1]. https://lore.kernel.org/all/cover.1687402580.git.yin31149@gmail.com/

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 | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

-- 
2.25.1



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

* [PATCH RFC 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature
  2023-06-23 13:26 [PATCH RFC 0/2] Vhost-vdpa Shadow Virtqueue _F_CTRL_RX_EXTRA commands support Hawkins Jiawei
@ 2023-06-23 13:26 ` Hawkins Jiawei
  2023-06-25 10:54   ` Eugenio Perez Martin
  2023-06-23 13:26 ` [PATCH RFC 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ Hawkins Jiawei
  1 sibling, 1 reply; 6+ messages in thread
From: Hawkins Jiawei @ 2023-06-23 13:26 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>
---
 net/vhost-vdpa.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index ca800f97e2..9b929762c5 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -822,6 +822,36 @@ 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;
+        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;
+        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;
+        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;
+        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] 6+ messages in thread

* [PATCH RFC 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ
  2023-06-23 13:26 [PATCH RFC 0/2] Vhost-vdpa Shadow Virtqueue _F_CTRL_RX_EXTRA commands support Hawkins Jiawei
  2023-06-23 13:26 ` [PATCH RFC 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature Hawkins Jiawei
@ 2023-06-23 13:26 ` Hawkins Jiawei
  2023-06-25 10:55   ` Eugenio Perez Martin
  1 sibling, 1 reply; 6+ messages in thread
From: Hawkins Jiawei @ 2023-06-23 13:26 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>
---
 net/vhost-vdpa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 9b929762c5..cdfe8e454e 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -100,6 +100,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] 6+ messages in thread

* Re: [PATCH RFC 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature
  2023-06-23 13:26 ` [PATCH RFC 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature Hawkins Jiawei
@ 2023-06-25 10:54   ` Eugenio Perez Martin
  2023-06-26  8:55     ` Hawkins Jiawei
  0 siblings, 1 reply; 6+ messages in thread
From: Eugenio Perez Martin @ 2023-06-25 10:54 UTC (permalink / raw)
  To: Hawkins Jiawei; +Cc: jasowang, mst, qemu-devel, 18801353760

On Fri, Jun 23, 2023 at 3:26 PM Hawkins Jiawei <yin31149@gmail.com> wrote:
>
> 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>
> ---
>  net/vhost-vdpa.c | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index ca800f97e2..9b929762c5 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -822,6 +822,36 @@ 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;
> +        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;
> +        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;
> +        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;
> +        r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOBCAST, on);
> +        if (r < 0) {
> +            return r;
> +        }
> +    }
> +

Can we skip the load if the state matches the virtio defaults? by
virtio_net_reset the defaults are:
    n->promisc = 1;
    n->allmulti = 0;
    n->alluni = 0;
    n->nomulti = 0;
    n->nouni = 0;
    n->nobcast = 0;

Thanks!

>      return 0;
>  }
>
> --
> 2.25.1
>



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

* Re: [PATCH RFC 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ
  2023-06-23 13:26 ` [PATCH RFC 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ Hawkins Jiawei
@ 2023-06-25 10:55   ` Eugenio Perez Martin
  0 siblings, 0 replies; 6+ messages in thread
From: Eugenio Perez Martin @ 2023-06-25 10:55 UTC (permalink / raw)
  To: Hawkins Jiawei; +Cc: jasowang, mst, qemu-devel, 18801353760

On Fri, Jun 23, 2023 at 3:26 PM Hawkins Jiawei <yin31149@gmail.com> wrote:
>
> 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 9b929762c5..cdfe8e454e 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -100,6 +100,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	[flat|nested] 6+ messages in thread

* Re: [PATCH RFC 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature
  2023-06-25 10:54   ` Eugenio Perez Martin
@ 2023-06-26  8:55     ` Hawkins Jiawei
  0 siblings, 0 replies; 6+ messages in thread
From: Hawkins Jiawei @ 2023-06-26  8:55 UTC (permalink / raw)
  To: Eugenio Perez Martin; +Cc: jasowang, mst, qemu-devel, 18801353760

On 2023/6/25 18:54, Eugenio Perez Martin wrote:
> On Fri, Jun 23, 2023 at 3:26 PM Hawkins Jiawei <yin31149@gmail.com> wrote:
>>
>> 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>
>> ---
>>   net/vhost-vdpa.c | 30 ++++++++++++++++++++++++++++++
>>   1 file changed, 30 insertions(+)
>>
>> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
>> index ca800f97e2..9b929762c5 100644
>> --- a/net/vhost-vdpa.c
>> +++ b/net/vhost-vdpa.c
>> @@ -822,6 +822,36 @@ 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;
>> +        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;
>> +        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;
>> +        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;
>> +        r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOBCAST, on);
>> +        if (r < 0) {
>> +            return r;
>> +        }
>> +    }
>> +
>
> Can we skip the load if the state matches the virtio defaults? by
> virtio_net_reset the defaults are:
>      n->promisc = 1;
>      n->allmulti = 0;
>      n->alluni = 0;
>      n->nomulti = 0;
>      n->nouni = 0;
>      n->nobcast = 0;

Yes, you are right.

Thanks for your reminder, I forgot this part when coding. I will
refactor the patch according to your suggestion and take care of it in
the following patches for this part.

Thanks!


>
> Thanks!
>
>>       return 0;
>>   }
>>
>> --
>> 2.25.1
>>
>


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

end of thread, other threads:[~2023-06-26  8:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-23 13:26 [PATCH RFC 0/2] Vhost-vdpa Shadow Virtqueue _F_CTRL_RX_EXTRA commands support Hawkins Jiawei
2023-06-23 13:26 ` [PATCH RFC 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature Hawkins Jiawei
2023-06-25 10:54   ` Eugenio Perez Martin
2023-06-26  8:55     ` Hawkins Jiawei
2023-06-23 13:26 ` [PATCH RFC 2/2] vdpa: Allow VIRTIO_NET_F_CTRL_RX_EXTRA in SVQ Hawkins Jiawei
2023-06-25 10:55   ` Eugenio Perez Martin

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 NNTP newsgroup(s).