Subject: Re: [RFC] hv_netvsc: automatically name slave VF network device

From: Stephen Hemminger <[email-masked]>
Date: Tue, 19 Dec 2017 14:50:17 -0800

On Tue, 19 Dec 2017 14:44:37 -0800
"Samudrala, Sridhar" <[email-masked]> 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.