qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Thibaut Collet <thibaut.collet@6wind.com>
Cc: jasowang@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
	quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] net: Add support of VIRTIO_NET_F_GUEST_ANNOUNCE for vhost-net/vhost-user
Date: Mon, 8 Jun 2015 12:12:47 +0200	[thread overview]
Message-ID: <20150608121022-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1433510652-13866-1-git-send-email-thibaut.collet@6wind.com>

On Fri, Jun 05, 2015 at 03:24:12PM +0200, Thibaut Collet wrote:
> Add VIRTIO_NET_F_GUEST_ANNOUNCE capability to vhost-net when netdev backend is
> vhost-user.
> 
> For netdev backend using virtio-net NIC the self announce is managed directly
> by the virtio-net NIC and not by the netdev backend itself.
> To avoid duplication of announces (once from the guest and once from QEMU) a
> bitfield is added in the NetClientState structure.
> If this bit is set self announce does not send message to the guest to request
> gratuitous ARP but let virtio-net NIC set the VIRTIO_NET_S_ANNOUNCE for
> gratuitous ARP.
> 
> Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
> ---
> v2: do not discard anymore packets send to vhost-user: it is GARP request after
>     live migration.
>     As suggested by S. Hajnoczi qemu_announce_self skips virtio-net NIC that
>     already send GARP.
> 
>  hw/net/vhost_net.c |    2 ++
>  include/net/net.h  |    1 +
>  net/vhost-user.c   |    2 ++
>  savevm.c           |   11 ++++++++---
>  4 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 426b23e..a745f97 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -82,6 +82,8 @@ static const int user_feature_bits[] = {
>      VIRTIO_NET_F_CTRL_MAC_ADDR,
>      VIRTIO_NET_F_CTRL_GUEST_OFFLOADS,
>  
> +    VIRTIO_NET_F_GUEST_ANNOUNCE,
> +
>      VIRTIO_NET_F_MQ,
>  
>      VHOST_INVALID_FEATURE_BIT
> diff --git a/include/net/net.h b/include/net/net.h
> index e66ca03..a78e9df 100644
> --- a/include/net/net.h
> +++ b/include/net/net.h
> @@ -85,6 +85,7 @@ struct NetClientState {
>      char *name;
>      char info_str[256];
>      unsigned receive_disabled : 1;
> +    unsigned self_announce_disabled : 1;
>      NetClientDestructor *destructor;
>      unsigned int queue_index;
>      unsigned rxfilter_notify_enabled:1;
> diff --git a/net/vhost-user.c b/net/vhost-user.c
> index 8d26728..b345446 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -147,6 +147,8 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
>  
>          s = DO_UPCAST(VhostUserState, nc, nc);
>  
> +        /* Self announce is managed directly by virtio-net NIC */
> +        s->nc.self_announce_disabled = 1;
>          /* We don't provide a receive callback */
>          s->nc.receive_disabled = 1;
>          s->chr = chr;
> diff --git a/savevm.c b/savevm.c
> index 3b0e222..7a134b1 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -80,11 +80,16 @@ static void qemu_announce_self_iter(NICState *nic, void *opaque)
>  {
>      uint8_t buf[60];
>      int len;
> +    NetClientState *nc;
>  
> -    trace_qemu_announce_self_iter(qemu_ether_ntoa(&nic->conf->macaddr));
> -    len = announce_self_create(buf, nic->conf->macaddr.a);
> +    nc = qemu_get_queue(nic);
>  
> -    qemu_send_packet_raw(qemu_get_queue(nic), buf, len);
> +    if (!nc->peer->self_announce_disabled) {
> +        trace_qemu_announce_self_iter(qemu_ether_ntoa(&nic->conf->macaddr));
> +        len = announce_self_create(buf, nic->conf->macaddr.a);
> +
> +        qemu_send_packet_raw(nc, buf, len);
> +    }
>  }
>  

I don't think qemu_send_packet_raw can ever work for vhost user.
What happens if you merely add VIRTIO_NET_F_GUEST_ANNOUNCE
to the feature list, and drop the rest of the patch?


> -- 
> 1.7.10.4

  parent reply	other threads:[~2015-06-08 10:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28  8:03 [Qemu-devel] [PATCH 1/1] net: fix queue's purge on VM stop Thibaut Collet
2015-05-29 13:12 ` Stefan Hajnoczi
2015-05-29 14:28   ` Thibaut Collet
2015-06-02 10:34     ` Stefan Hajnoczi
2015-06-03  7:56       ` Thibaut Collet
2015-06-03  9:42         ` Jason Wang
2015-06-03 13:40           ` Stefan Hajnoczi
2015-06-04  9:35             ` Jason Wang
2015-06-05 13:24               ` [Qemu-devel] [PATCH v2] net: Add support of VIRTIO_NET_F_GUEST_ANNOUNCE for vhost-net/vhost-user Thibaut Collet
2015-06-08  5:55                 ` Jason Wang
2015-06-08  8:21                   ` Thibaut Collet
2015-06-08  9:14                     ` Jason Wang
2015-06-08 10:01                       ` Thibaut Collet
2015-06-08 10:09                         ` Michael S. Tsirkin
2015-06-08 10:22                         ` Jason Wang
2015-06-08 13:32                     ` Stefan Hajnoczi
2015-06-08 14:05                       ` Thibaut Collet
2015-06-08 15:13                         ` Stefan Hajnoczi
2015-06-08 15:32                           ` Thibaut Collet
2015-06-09 10:38                             ` Stefan Hajnoczi
2015-06-09 10:43                             ` Stefan Hajnoczi
2015-06-08 16:13                           ` Michael S. Tsirkin
2015-06-09  2:35                             ` Jason Wang
2015-06-08 10:12                 ` Michael S. Tsirkin [this message]
2015-06-08 11:29                   ` Thibaut Collet
2015-06-08 12:45                     ` Michael S. Tsirkin
2015-06-08 13:20                       ` Thibaut Collet
2015-06-08 15:48                         ` Michael S. Tsirkin
2015-06-08 13:25                 ` Stefan Hajnoczi
2015-06-03  9:42         ` [Qemu-devel] [PATCH 1/1] net: fix queue's purge on VM stop Stefan Hajnoczi
2015-06-01  9:17 ` Jason Wang
2015-06-01 10:14   ` Thibaut Collet
2015-06-03  9:40     ` Jason Wang

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=20150608121022-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=thibaut.collet@6wind.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).