On Tue, 19 Dec 2017 15:20:57 -0800 Jakub Kicinski <jakub.kicin...@netronome.com> wrote:
> On Tue, 19 Dec 2017 14:50:17 -0800, Stephen Hemminger wrote: > > On Tue, 19 Dec 2017 14:44:37 -0800 > > "Samudrala, Sridhar" <sridhar.samudr...@intel.com> wrote: > > > > > -static void __netvsc_vf_setup(struct net_device *ndev, > > > > - struct net_device *vf_netdev) > > > > -{ > > > > - int ret; > > > > + /* set the name of VF device based on upper device name */ > > > > + snprintf(vf_name, IFNAMSIZ, "%s_vf", ndev->name); > > > > + ret = dev_change_name(vf_netdev, vf_name); > > > > + if (ret != 0) > > > > + netdev_warn(vf_netdev, > > > > + "can not rename device: (%d)\n", ret); > > > > > > It is possible that upper device name can change after this call. I > > > noticed this > > > when i tried this approach with virtio_net. > > > > > > Also, what should happen if the upper device is unloaded? Should we rename > > > the VF name? > > > > Yes upper device can change name. So sure, netdevice could trap that > > in callback (it already has notifier) and rename VF. Will add that in V2. > > > > If upper device is unloaded then it is already decoupled from the VF. > > There is no good value to change it back to. The orignal name probably > > has been reused by then. > > Both of those issues would be solved by just exposing phys_port_name > from the VF driver, and letting systemd do its thing independent of > magic bonds. > > Reluctance to do driver work aside :/ The port name for Mellanox driver is already set in the driver as a numeric value. It indicates which port is used. This won't work.