All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Vladislav Yasevich <vyasevic@redhat.com>,
	qemu-devel@nongnu.org, dgilbert@redhat.com, quintela@redhat.com
Cc: germano@redhat.com, lvivier@redhat.com, jdenemar@redhat.com,
	kashyap@redhat.com, armbru@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH 05/12] virtio-net: Allow qemu_announce_self to trigger virtio announcements
Date: Fri, 26 May 2017 12:21:50 +0800	[thread overview]
Message-ID: <af25fa79-1f05-90eb-bd61-fc22d22a2629@redhat.com> (raw)
In-Reply-To: <1495649128-10529-6-git-send-email-vyasevic@redhat.com>



On 2017年05月25日 02:05, Vladislav Yasevich wrote:
> Expose the virtio-net self annoucement capability and allow
> qemu_announce_self() to call it.
>
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
> ---
>   hw/net/virtio-net.c | 32 +++++++++++++++++++++++++++++---
>   1 file changed, 29 insertions(+), 3 deletions(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 1c65825..4adafbd 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -111,14 +111,38 @@ static bool virtio_net_started(VirtIONet *n, uint8_t status)
>           (n->status & VIRTIO_NET_S_LINK_UP) && vdev->vm_running;
>   }
>   
> +static void __virtio_net_announce(VirtIONet *net)
> +{
> +    VirtIODevice *vdev = VIRTIO_DEVICE(net);
> +
> +    net->status |= VIRTIO_NET_S_ANNOUNCE;
> +    virtio_notify_config(vdev);
> +}
> +
>   static void virtio_net_announce_timer(void *opaque)
>   {
>       VirtIONet *n = opaque;
> -    VirtIODevice *vdev = VIRTIO_DEVICE(n);
>   
>       n->announce_timer->round--;
> -    n->status |= VIRTIO_NET_S_ANNOUNCE;
> -    virtio_notify_config(vdev);
> +    __virtio_net_announce(n);
> +}
> +
> +static void virtio_net_announce(NetClientState *nc)
> +{
> +    VirtIONet *n = qemu_get_nic_opaque(nc);
> +    VirtIODevice *vdev = VIRTIO_DEVICE(n);
> +
> +    /* Make sure the virtio migration announcement timer isn't running
> +     * If it is, let it trigger announcement so that we do not cause
> +     * confusion.
> +     */
> +    if (n->announce_timer->round)
> +        return;
> +
> +    if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) &&
> +        virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) {
> +            __virtio_net_announce(n);
> +    }
>   }
>   
>   static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
> @@ -1834,6 +1858,7 @@ static NetClientInfo net_virtio_info = {
>       .receive = virtio_net_receive,
>       .link_status_changed = virtio_net_set_link_status,
>       .query_rx_filter = virtio_net_query_rxfilter,
> +    .announce = virtio_net_announce,
>   };
>   
>   static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
> @@ -1941,6 +1966,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
>       n->status = VIRTIO_NET_S_LINK_UP;
>       n->announce_timer = qemu_announce_timer_new(qemu_get_announce_params(),
>                                                   QEMU_CLOCK_VIRTUAL);
> +    n->announce_timer->round = 0;
>       n->announce_timer->tm = timer_new_ms(QEMU_CLOCK_VIRTUAL,
>                                             virtio_net_announce_timer, n);
>   

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

  reply	other threads:[~2017-05-26  4:22 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 18:05 [Qemu-devel] [PATCH 00/12] self-announce updates Vladislav Yasevich
2017-05-24 18:05 ` [Qemu-devel] [PATCH 01/12] migration: Introduce announce parameters Vladislav Yasevich
2017-05-26  4:03   ` Jason Wang
2017-05-26 13:06     ` Vlad Yasevich
2017-05-30 18:57       ` Dr. David Alan Gilbert
2017-06-01  7:02         ` Jason Wang
2017-06-01 13:45           ` Vlad Yasevich
2017-06-01 14:02             ` Dr. David Alan Gilbert
2017-05-26 13:08   ` Eric Blake
2017-05-26 13:17     ` Vlad Yasevich
2017-05-30  9:58   ` Juan Quintela
2017-05-30 13:45     ` Vlad Yasevich
2017-05-30 19:08   ` Dr. David Alan Gilbert
2017-05-24 18:05 ` [Qemu-devel] [PATCH 02/12] migration: Introduce announcement timer Vladislav Yasevich
2017-05-26  4:13   ` Jason Wang
2017-05-30 10:00   ` Juan Quintela
2017-05-24 18:05 ` [Qemu-devel] [PATCH 03/12] migration: Switch to using " Vladislav Yasevich
2017-05-26  4:16   ` Jason Wang
2017-05-26 13:01     ` Vlad Yasevich
2017-05-30 10:10   ` Juan Quintela
2017-05-30 13:46     ` Vlad Yasevich
2017-05-30 19:19   ` Dr. David Alan Gilbert
2017-05-30 19:34     ` Vlad Yasevich
2017-05-24 18:05 ` [Qemu-devel] [PATCH 04/12] net: Add a network device specific self-announcement ability Vladislav Yasevich
2017-05-26  4:17   ` Jason Wang
2017-05-24 18:05 ` [Qemu-devel] [PATCH 05/12] virtio-net: Allow qemu_announce_self to trigger virtio announcements Vladislav Yasevich
2017-05-26  4:21   ` Jason Wang [this message]
2017-05-24 18:05 ` [Qemu-devel] [PATCH 06/12] qmp: Expose qemu_announce_self as a qmp command Vladislav Yasevich
2017-05-26 13:16   ` Eric Blake
2017-05-26 13:19     ` Vlad Yasevich
2017-05-30 10:11   ` Juan Quintela
2017-05-30 13:49     ` Vlad Yasevich
2017-05-30 14:24       ` Juan Quintela
2017-05-30 14:43         ` Vlad Yasevich
2017-05-30 14:14   ` Daniel P. Berrange
2017-05-30 15:01     ` Vlad Yasevich
2017-05-24 18:05 ` [Qemu-devel] [PATCH 07/12] migration: Allow for a limited number of announce timers Vladislav Yasevich
2017-05-30 10:13   ` Juan Quintela
2017-05-30 19:31   ` Dr. David Alan Gilbert
2017-05-24 18:05 ` [Qemu-devel] [PATCH 08/12] announce_timer: Add ability to reset an existing Vladislav Yasevich
2017-05-30 10:15   ` Juan Quintela
2017-05-30 19:35   ` Dr. David Alan Gilbert
2017-05-30 20:01     ` Vlad Yasevich
2017-05-24 18:05 ` [Qemu-devel] [PATCH 09/12] hmp: add announce paraters info/set Vladislav Yasevich
2017-05-30 10:18   ` Juan Quintela
2017-05-30 13:57     ` Vlad Yasevich
2017-05-24 18:05 ` [Qemu-devel] [PATCH 10/12] hmp: Add hmp_announce_self Vladislav Yasevich
2017-05-31  9:47   ` Dr. David Alan Gilbert
2017-05-24 18:05 ` [Qemu-devel] [PATCH 11/12] tests/test-hmp: Add announce parameter tests Vladislav Yasevich
2017-05-31  9:53   ` Dr. David Alan Gilbert
2017-05-24 18:05 ` [Qemu-devel] [PATCH 12/12] tests: Add a test for qemu self announcments Vladislav Yasevich
2017-05-24 18:19 ` [Qemu-devel] [PATCH 00/12] self-announce updates no-reply
2017-05-24 18:38 ` no-reply
2017-05-24 18:40 ` no-reply
2017-05-31 10:29 ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=af25fa79-1f05-90eb-bd61-fc22d22a2629@redhat.com \
    --to=jasowang@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=germano@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=kashyap@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=vyasevic@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.