qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC v2 PATCH 4/4] virtio-net: notify guest to annouce


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC v2 PATCH 4/4] virtio-net: notify guest to annouce itself
Date: Tue, 25 Oct 2011 23:19:29 -0700

On Fri, Oct 21, 2011 at 10:39 PM, Jason Wang <address@hidden> wrote:
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index 8c2f460..7f844e7 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -95,6 +95,10 @@ static void virtio_net_set_config(VirtIODevice *vdev, 
> const uint8_t *config)
>         memcpy(n->mac, netcfg.mac, ETH_ALEN);
>         qemu_format_nic_info_str(&n->nic->nc, n->mac);
>     }
> +
> +    if (memcmp(&netcfg.status, &n->status, sizeof(n->status))) {
> +        memcpy(&n->status, &netcfg.status, sizeof(n->status));
> +    }

The memcpy() can be done unconditionally.

>  }
>
>  static bool virtio_net_started(VirtIONet *n, uint8_t status)
> @@ -227,7 +231,7 @@ static uint32_t virtio_net_get_features(VirtIODevice 
> *vdev, uint32_t features)
>  {
>     VirtIONet *n = to_virtio_net(vdev);
>
> -    features |= (1 << VIRTIO_NET_F_MAC);
> +    features |= (1 << VIRTIO_NET_F_MAC | 1 << VIRTIO_NET_F_GUEST_ANNOUNCE);
>
>     if (peer_has_vnet_hdr(n)) {
>         tap_using_vnet_hdr(n->nic->nc.peer, 1);
> @@ -983,6 +987,19 @@ static void virtio_net_cleanup(VLANClientState *nc)
>     n->nic = NULL;
>  }
>
> +static int virtio_net_announce(VLANClientState *nc)
> +{
> +    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
> +
> +    if (n->vdev.guest_features & (0x1 << VIRTIO_NET_F_GUEST_ANNOUNCE)) {
> +        n->status |= VIRITO_NET_S_ANNOUNCE;

Typo, should be VIRTIO_NET_S_ANNOUNCE.

Stefan



reply via email to

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