[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 4/6] virtio-net: expose virtio_net_supported_guest_offload
From: |
Eugenio Perez Martin |
Subject: |
Re: [PATCH v3 4/6] virtio-net: expose virtio_net_supported_guest_offloads() |
Date: |
Thu, 1 Jun 2023 16:37:23 +0200 |
On Thu, Jun 1, 2023 at 3:49 PM Hawkins Jiawei <yin31149@gmail.com> wrote:
>
> To support restoring offloads state in vdpa, need to expose
> the function virtio_net_supported_guest_offloads().
> QEMU uses this function to get the guest supported offloads
> and no needs to send the corresponding CVQ command if guest
doesn't need to send?
> enables all supported features.
>
Good! I'd add the same message as the next patch's comment, to signal
it is because the device has already enabled by default:
+ * According to VirtIO standard, "Upon feature negotiation
+ * corresponding offload gets enabled to preserve
+ * backward compatibility."
+ * So we do not need to send this CVQ command if the guest
+ * also enables all supported offloads.
Thanks!
> Signed-off-by: Hawkins Jiawei <yin31149@gmail.com>
> ---
> hw/net/virtio-net.c | 2 +-
> include/hw/virtio/virtio-net.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 7b27dad6c4..7e8897a8bc 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -874,7 +874,7 @@ static uint64_t
> virtio_net_guest_offloads_by_features(uint32_t features)
> return guest_offloads_mask & features;
> }
>
> -static inline uint64_t virtio_net_supported_guest_offloads(const VirtIONet
> *n)
> +uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n)
> {
> VirtIODevice *vdev = VIRTIO_DEVICE(n);
> return virtio_net_guest_offloads_by_features(vdev->guest_features);
> diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
> index ef234ffe7e..5f5dcb4572 100644
> --- a/include/hw/virtio/virtio-net.h
> +++ b/include/hw/virtio/virtio-net.h
> @@ -227,5 +227,6 @@ size_t virtio_net_handle_ctrl_iov(VirtIODevice *vdev,
> unsigned out_num);
> void virtio_net_set_netclient_name(VirtIONet *n, const char *name,
> const char *type);
> +uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n);
>
> #endif
> --
> 2.25.1
>
- [PATCH v3 0/6] Vhost-vdpa Shadow Virtqueue Offloads support, Hawkins Jiawei, 2023/06/01
- [PATCH v3 1/6] include/hw/virtio: make some VirtIODevice const, Hawkins Jiawei, 2023/06/01
- [PATCH v3 2/6] vdpa: reuse virtio_vdev_has_feature(), Hawkins Jiawei, 2023/06/01
- [PATCH v3 3/6] hw/net/virtio-net: make some VirtIONet const, Hawkins Jiawei, 2023/06/01
- [PATCH v3 4/6] virtio-net: expose virtio_net_supported_guest_offloads(), Hawkins Jiawei, 2023/06/01
- Re: [PATCH v3 4/6] virtio-net: expose virtio_net_supported_guest_offloads(),
Eugenio Perez Martin <=
- [PATCH v3 5/6] vdpa: Add vhost_vdpa_net_load_offloads(), Hawkins Jiawei, 2023/06/01
- [PATCH v3 6/6] vdpa: Allow VIRTIO_NET_F_CTRL_GUEST_OFFLOADS in SVQ, Hawkins Jiawei, 2023/06/01
- Re: [PATCH v3 0/6] Vhost-vdpa Shadow Virtqueue Offloads support, Lei Yang, 2023/06/02