From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: Re: [RFC] hv_netvsc: automatically name slave VF network device Date: Tue, 19 Dec 2017 15:20:57 -0800 Message-ID: <20171219152057.1e19a0bc@cakuba.netronome.com> References: <20171219193537.22587-1-sthemmin@microsoft.com> <20171219145017.78b60959@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "Samudrala, Sridhar" , netdev@vger.kernel.org, Stephen Hemminger To: Stephen Hemminger Return-path: Received: from mail-qk0-f193.google.com ([209.85.220.193]:34765 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753379AbdLSXVB (ORCPT ); Tue, 19 Dec 2017 18:21:01 -0500 Received: by mail-qk0-f193.google.com with SMTP id d66so24660804qkg.1 for ; Tue, 19 Dec 2017 15:21:01 -0800 (PST) In-Reply-To: <20171219145017.78b60959@xeon-e3> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 19 Dec 2017 14:50:17 -0800, Stephen Hemminger wrote: > On Tue, 19 Dec 2017 14:44:37 -0800 > "Samudrala, Sridhar" wrote: >=20 > > -static void __netvsc_vf_setup(struct net_device *ndev, =20 > > > - 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 =3D dev_change_name(vf_netdev, vf_name); > > > + if (ret !=3D 0) > > > + netdev_warn(vf_netdev, > > > + "can not rename device: (%d)\n", ret); =20 > >=20 > > It is possible that upper device name can change after this call.=C2=A0= I=20 > > noticed this > > when i tried this approach with virtio_net. > >=20 > > Also, what should happen if the upper device is unloaded? Should we ren= ame > > the VF name? =20 >=20 > 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. >=20 > 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=20 magic bonds. Reluctance to do driver work aside :/