Thread (4 messages) flat view 4 messages, 3 authors, 2025-01-29

Re: [Patch net-next v2] hv_netvsc: Set device flags for properly indicating bonding in Hyper-V

From: Jakub Kicinski <kuba@kernel.org>
Date: 2024-12-17 02:03:01
Also in: linux-hyperv, linux-rdma, lkml

On Fri, 13 Dec 2024 12:06:01 -0800 longli@linuxonhyperv.com wrote:
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 bonded setup. RDMA uses those APIs extensively when
looking for master/slave devices. Netvsc's bonding setup with its slave
device falls into this category.

Make hv_netvsc properly indicate bonding with its slave and change the
API to reflect this bonding setup.
This is severely lacking in terms of safety analysis.
quoted hunk ↗ jump to hunk
@@ -2204,6 +2204,10 @@ static int netvsc_vf_join(struct net_device *vf_netdev,
 		goto rx_handler_failed;
 	}
 
+	vf_netdev->permanent_bond = 1;
+	ndev->permanent_bond = 1;
+	ndev->flags |= IFF_MASTER;
quoted hunk ↗ jump to hunk
@@ -2484,7 +2488,15 @@ static int netvsc_unregister_vf(struct net_device *vf_netdev)
 
 	reinit_completion(&net_device_ctx->vf_add);
 	netdev_rx_handler_unregister(vf_netdev);
+
+	/* Unlink the slave device and clear flag */
+	vf_netdev->permanent_bond = 0;
+	ndev->permanent_bond = 0;
+ *	@permanent_bond: device is permanently bonded to another device
I think we have been taught a definition of the word "permanent"
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help