From: "Michael S. Tsirkin" <mst@redhat.com>
To: Vincent Jardin <vincent.jardin@ekinops.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"jasowang@redhat.com" <jasowang@redhat.com>
Subject: Re: [RFC] virtio: enforce link up
Date: Sun, 15 Oct 2023 04:42:18 -0400 [thread overview]
Message-ID: <20231015034428-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <8f110502-7ab7-4db2-9702-3717cf6afc58@ekinops.com>
On Sat, Oct 14, 2023 at 09:06:09PM +0000, Vincent Jardin wrote:
> On 10/14/23 18:37, Michael S. Tsirkin wrote:
> > On Sat, Oct 14, 2023 at 06:22:34PM +0200, Vincent Jardin wrote:
> >> Using interface's settings, let's enforce an always on link up.
> >>
> >> Signed-off-by: Vincent Jardin <vincent.jardin@ekinops.com>
> >
> > What is going on here? Just don't set it down.
>
> The purpose is to have a stable vLink for the VMs that don't support
> such sysctl arp_evict_nocarrier:
> https://patchwork.kernel.org/project/netdevbpf/patch/20211101173630.300969-2-prestwoj@gmail.com/
>
> We are facing some users of vSwitches that use vhost-user and that
> disconnect and reconnect during some operations. For most of the VMs on
> their deployments with such vSwitches, those VMs' vLink should not flap.
>
> For those VMs, the flaps are critical and they can lead to some
> convergence issues.
>
> If this capability is not at the virtio-net level, should it be at
> qemu's net_vhost_user_event() ?
> For instance, from
> https://github.com/qemu/qemu/blob/63011373ad22c794a013da69663c03f1297a5c56/net/vhost-user.c#L266
> ?
>
> best regards,
> Vincent
makes sense
>
> >
> >> ---
> >> hw/net/virtio-net.c | 8 ++++++++
> >> include/hw/virtio/virtio-net.h | 2 ++
> >> 2 files changed, 10 insertions(+)
> >>
> >> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> >> index 29e33ea5ed..e731b4fdea 100644
> >> --- a/hw/net/virtio-net.c
> >> +++ b/hw/net/virtio-net.c
> >> @@ -78,6 +78,9 @@
> >> tso/gso/gro 'off'. */
> >> #define VIRTIO_NET_RSC_DEFAULT_INTERVAL 300000
> >>
> >> +/* force always link up */
> >> +#define VIRTIO_NET_LINK_UP false
> >> +
> >> #define VIRTIO_NET_RSS_SUPPORTED_HASHES (VIRTIO_NET_RSS_HASH_TYPE_IPv4 | \
> >> VIRTIO_NET_RSS_HASH_TYPE_TCPv4 | \
> >> VIRTIO_NET_RSS_HASH_TYPE_UDPv4 | \
> >> @@ -447,6 +450,9 @@ static void virtio_net_set_link_status(NetClientState *nc)
> >> else
> >> n->status |= VIRTIO_NET_S_LINK_UP;
> >>
> >> + if (n->net_conf.link_up)
> >> + n->status |= VIRTIO_NET_S_LINK_UP;
> >> +
> >> if (n->status != old_status)
> >> virtio_notify_config(vdev);
> >>
> >> @@ -3947,6 +3953,8 @@ static Property virtio_net_properties[] = {
> >> VIRTIO_NET_F_GUEST_USO6, true),
> >> DEFINE_PROP_BIT64("host_uso", VirtIONet, host_features,
> >> VIRTIO_NET_F_HOST_USO, true),
> >> + DEFINE_PROP_BOOL("link_up", VirtIONet, net_conf.link_up,
> >> + VIRTIO_NET_LINK_UP),
> >> DEFINE_PROP_END_OF_LIST(),
> >> };
> >>
> >> diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
> >> index 55977f01f0..385bebab34 100644
> >> --- a/include/hw/virtio/virtio-net.h
> >> +++ b/include/hw/virtio/virtio-net.h
> >> @@ -56,6 +56,7 @@ typedef struct virtio_net_conf
> >> char *duplex_str;
> >> uint8_t duplex;
> >> char *primary_id_str;
> >> + bool link_up; /* if set enforce link up, never down */
> >> } virtio_net_conf;
> >>
> >> /* Coalesced packets type & status */
> >> @@ -180,6 +181,7 @@ struct VirtIONet {
> >> size_t guest_hdr_len;
> >> uint64_t host_features;
> >> uint32_t rsc_timeout;
> >> + uint32_t link_up; /* if set enforce link up, never down */
> >> uint8_t rsc4_enabled;
> >> uint8_t rsc6_enabled;
> >> uint8_t has_ufo;
> >> --
> >> 2.34.1
> >
>
next prev parent reply other threads:[~2023-10-15 8:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-14 16:22 [RFC] virtio: enforce link up Vincent Jardin
2023-10-14 16:37 ` Michael S. Tsirkin
2023-10-14 21:06 ` Vincent Jardin
2023-10-15 8:42 ` Michael S. Tsirkin [this message]
2023-10-15 15:53 ` Vincent Jardin
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=20231015034428-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vincent.jardin@ekinops.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).