Skip to contentSkip to conversation

hv_netvsc: automatically name slave VF network device

PATCH In review Stephen Hemminger 3 participants 3 messages Dec 19, 2017 – Dec 20, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hv_netvsc: automatically name slave VF network device

Rename the VF device to ethX_vf based on the ethX as the synthetic device. This eliminates the need for delay on setup, and the PCI (udev based) naming is not reproducible on Hyper-V anyway. The name of the VF does not matter since all control operations take place the primary device. It does make the user experience better to associate the names.

Based on feedback from all.systems.go talk.

---
v2 - also handle case where synthetic device gets renamed
and the case where rename causes clash with pre-existing device name

 drivers/net/hyperv/hyperv_net.h |  1 -
 drivers/net/hyperv/netvsc_drv.c | 84 +++++++++++++++++++++--------------------
 net/core/dev.c                  |  1 +
 3 files changed, 44 insertions(+), 42 deletions(-)
drivers/net/hyperv/hyperv_net.h +0 -1
index 0db3bd1ea06f..5013189123e6 100644
@@ -762,7 +762,6 @@ struct net_device_context {
 	/* State to manage the associated VF interface. */
 	struct net_device __rcu *vf_netdev;
 	struct netvsc_vf_pcpu_stats __percpu *vf_stats;
-	struct delayed_work vf_takeover;
 
 	/* 1: allocated, serial number is valid. 0: not allocated */
 	u32 vf_alloc;
drivers/net/hyperv/netvsc_drv.c +43 -41

146 lines not on this page · raw message

net/core/dev.c +1 -0
index c7db39926769..f51358a90efa 100644
@@ -1238,6 +1238,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
 
 	return err;
 }
+EXPORT_SYMBOL(dev_change_name);
 
 /**
  *	dev_set_alias - change ifalias of a device
Signature · 1 line
2.11.0
#1 lore raw
Quoted 10 lines · Stephen Hemminger

Rename the VF device to ethX_vf based on the ethX as the synthetic device. This eliminates the need for delay on setup, and the PCI (udev based) naming is not reproducible on Hyper-V anyway. The name of the VF does not matter since all control operations take place the primary device. It does make the user experience better to associate the names.

Based on feedback from all.systems.go talk.

I think you must have hit send before seeing my last reply on v1...

maintainer
#2 lore raw
In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>
Date: Tue, 19 Dec 2017 15:59:30 -0800

Quoted 7 lines

Rename the VF device to ethX_vf based on the ethX as the synthetic device. This eliminates the need for delay on setup, and the PCI (udev based) naming is not reproducible on Hyper-V anyway. The name of the VF does not matter since all control operations take place the primary device. It does make the user experience better to associate the names.

Quoted 6 lines

Based on feedback from all.systems.go talk.

---
v2 - also handle case where synthetic device gets renamed
and the case where rename causes clash with pre-existing device name

Besides Jakub's objections (which I agree with) it is just so unexpected that changing the name of device X has the side effect of changing the name of device Y.

This is why we do this policy stuff in userspace. The kernel has no business messing with these netdev names.

This patch means that if a user decides to add his own custom udev rules for the VF (for whatever reason, it doesn't have to make sense to you or me) we're just going to undo them. That's bad.