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
>