diff mbox series

[v3,2/4] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it

Message ID 20221221115015.1400889-3-eperezma@redhat.com
State New
Headers show
Series Guest announce feature emulation using Shadow VirtQueue | expand

Commit Message

Eugenio Perez Martin Dec. 21, 2022, 11:50 a.m. UTC
Status part of the emulated feature. It will follow device model, so we
must copy it as long as NIC device model has it set.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
v3: Add virtio byte swapping writing net config status.
---
 hw/net/virtio-net.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jason Wang Dec. 22, 2022, 5:14 a.m. UTC | #1
On Wed, Dec 21, 2022 at 7:50 PM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> Status part of the emulated feature. It will follow device model, so we
> must copy it as long as NIC device model has it set.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>

Acked-by: Jason Wang <jasowang@redhat.com>

Thanks

> ---
> v3: Add virtio byte swapping writing net config status.
> ---
>  hw/net/virtio-net.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index b30038d130..122eac25ee 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -183,6 +183,8 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
>              memcpy(netcfg.mac, n->mac, ETH_ALEN);
>          }
>
> +        netcfg.status |= virtio_tswap16(vdev,
> +                                        n->status & VIRTIO_NET_S_ANNOUNCE);
>          memcpy(config, &netcfg, n->config_size);
>      }
>  }
> --
> 2.31.1
>
diff mbox series

Patch

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index b30038d130..122eac25ee 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -183,6 +183,8 @@  static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
             memcpy(netcfg.mac, n->mac, ETH_ALEN);
         }
 
+        netcfg.status |= virtio_tswap16(vdev,
+                                        n->status & VIRTIO_NET_S_ANNOUNCE);
         memcpy(config, &netcfg, n->config_size);
     }
 }