qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC] virtio: enforce link up


From: Vincent Jardin
Subject: Re: [RFC] virtio: enforce link up
Date: Sat, 14 Oct 2023 21:06:09 +0000
User-agent: Mozilla Thunderbird

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


> 
>> ---
>>   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
> 


reply via email to

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