RE: [EXTERNAL] Re: [PATCH] hv_netvsc: Set device flags for properly indicating bonding
From: Long Li
Date: Tue Dec 03 2024 - 14:58:09 EST
> Subject: [EXTERNAL] Re: [PATCH] hv_netvsc: Set device flags for properly
> indicating bonding
>
> On Wed, 27 Nov 2024 11:42:50 -0800 longli@xxxxxxxxxxxxxxxxx wrote:
> > hv_netvsc uses a subset of bonding features in that the master always
> > has only one active slave. But it never properly setup those flags.
> >
> > Other kernel APIs (e.g those in "include/linux/netdevice.h") check for
> > IFF_MASTER, IFF_SLAVE and IFF_BONDING for determing if those are used
> > in a master/slave setup.
>
> I feel like this has been nacked 10 times already?
> IFF_BONDING means the bonding driver.
> There is more than one driver in the tree providing link aggregation and only
> bonding uses IFF_BONDING. If some user is buggy fix the user.
> --
> pw-bot: reject
Sorry I didn't know this has been discussed in other threads. As far as I know, this is probably the 1st time it is discussed in the context of netvsc.
My understanding is that netvsc is a special use-case of bonding which is implemented as an emulated device in drivers/net/bonding. It is the only non-emulated driver that sets IFF_MASTER and IFF_SLAVE flags on netdevs. After the master/slave devices are set up in this way, the behavior is very similar to that of the bonding device with a single active bonded slave.
There are code that use netif_is_bond_master() and netif_is_bond_slave() to decide how a netdev should be used when it is in a master/slave setup. One example is "drivers/infiniband/core/roce_gid_mgmt.c". Their use case is relevant to netvsc and its slave device setup.
I haven't found a good way to communicate the relationship of netvsc and its slave netdev to those code. The best solution I can think of is to use the IFF_BONDING, as it is the closest representation of this relationship. Another way would be adding a new IFF flag (e.g. IFF_PERMSLAVE) to netdev_priv_flags. I feel this is not needed for this special use-case in netvsc.
Thanks,
Long