qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v2 7/8] vhost_net: return VIRTIO_NET_S_ANNOUNCE is device


From: Jason Wang
Subject: Re: [RFC PATCH v2 7/8] vhost_net: return VIRTIO_NET_S_ANNOUNCE is device model has it set
Date: Thu, 20 Oct 2022 12:35:54 +0800

On Wed, Oct 19, 2022 at 8:52 PM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> Temporal, as this affects other vhost backends and we must check status
> feature first.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
>  hw/net/vhost_net.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 5660606c1d..300f370e2a 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -118,6 +118,7 @@ int vhost_net_get_config(struct vhost_net *net,  uint8_t 
> *config,
>                           uint32_t config_len)
>  {
>      VirtIODevice *vdev;
> +    VirtIONet *n;
>      int r = vhost_dev_get_config(&net->dev, config, config_len, NULL);
>
>      if (unlikely(r != 0)) {
> @@ -142,6 +143,13 @@ int vhost_net_get_config(struct vhost_net *net,  uint8_t 
> *config,
>          ((struct virtio_net_config *)config)->status |= VIRTIO_NET_S_LINK_UP;
>      }
>
> +    if (!(net->dev.acked_features & BIT_ULL(VIRTIO_NET_F_GUEST_ANNOUNCE))) {
> +        return 0;
> +    }
> +
> +    n = VIRTIO_NET(vdev);
> +    ((struct virtio_net_config *)config)->status |=
> +                                           (n->status & 
> VIRTIO_NET_S_ANNOUNCE);

Similar to the previous patch, it would be better to move this to virtio-net.c.

Thanks

>      return 0;
>  }
>  int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
> --
> 2.31.1
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]