[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2 6/8] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vd
From: |
Jason Wang |
Subject: |
Re: [RFC PATCH v2 6/8] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail |
Date: |
Thu, 20 Oct 2022 12:35:01 +0800 |
On Wed, Oct 19, 2022 at 8:52 PM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> Since this capability is emulated by qemu shadowed CVQ cannot forward it
> to the device.
I wonder what happens for a device that has GUEST_ANNOUNCE support on its own?
> Process all that command within qemu.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
> net/vhost-vdpa.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index 3374c21b4d..5fda405a66 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -488,9 +488,18 @@ static int
> vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq,
> out.iov_len = iov_to_buf(elem->out_sg, elem->out_num, 0,
> s->cvq_cmd_out_buffer,
> vhost_vdpa_net_cvq_cmd_len());
> - dev_written = vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(status));
> - if (unlikely(dev_written < 0)) {
> - goto out;
> + if (*(uint8_t *)s->cvq_cmd_out_buffer == VIRTIO_NET_CTRL_ANNOUNCE) {
Interesting, I thought we can do better by forbidding the code that
goes into vhost-vDPA specific code, everything should be set at
virtio-net.c level.
Thanks
> + /*
> + * Guest announce capability is emulated by qemu, so dont forward to
> + * the device.
> + */
> + dev_written = sizeof(status);
> + *s->status = VIRTIO_NET_OK;
> + } else {
> + dev_written = vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(status));
> + if (unlikely(dev_written < 0)) {
> + goto out;
> + }
> }
>
> if (unlikely(dev_written < sizeof(status))) {
> --
> 2.31.1
>
- Re: [RFC PATCH v2 3/8] vhost_net: Emulate link state up if backend doesn't expose it, (continued)
- [RFC PATCH v2 1/8] vdpa: Delete duplicated vdpa_feature_bits entry, Eugenio Pérez, 2022/10/19
- [RFC PATCH v2 5/8] vdpa: Remove shadow CVQ command check, Eugenio Pérez, 2022/10/19
- [RFC PATCH v2 7/8] vhost_net: return VIRTIO_NET_S_ANNOUNCE is device model has it set, Eugenio Pérez, 2022/10/19
- [RFC PATCH v2 8/8] vdpa: Offer VIRTIO_NET_F_GUEST_ANNOUNCE feature if SVQ is enabled, Eugenio Pérez, 2022/10/19
- [RFC PATCH v2 6/8] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail, Eugenio Pérez, 2022/10/19
- Re: [RFC PATCH v2 6/8] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail,
Jason Wang <=
[RFC PATCH v2 4/8] vdpa: Expose VIRTIO_NET_F_STATUS unconditionally, Eugenio Pérez, 2022/10/19
Re: [RFC PATCH v2 0/8] Guest announce feature emulation using Shadow VirtQueue, Jason Wang, 2022/10/20