From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [RFC] hv_netvsc: automatically name slave VF network device Date: Tue, 19 Dec 2017 15:44:05 -0800 Message-ID: <20171219154405.5bb35eff@xeon-e3> References: <20171219193537.22587-1-sthemmin@microsoft.com> <20171219145017.78b60959@xeon-e3> <20171219152057.1e19a0bc@cakuba.netronome.com> 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: Jakub Kicinski Return-path: Received: from mail-pl0-f68.google.com ([209.85.160.68]:41488 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752547AbdLSXoJ (ORCPT ); Tue, 19 Dec 2017 18:44:09 -0500 Received: by mail-pl0-f68.google.com with SMTP id g2so7945812pli.8 for ; Tue, 19 Dec 2017 15:44:08 -0800 (PST) In-Reply-To: <20171219152057.1e19a0bc@cakuba.netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 19 Dec 2017 15:20:57 -0800 Jakub Kicinski wrote: > 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 r= ename > > > 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 V= 2. > >=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. =20 >=20 > 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. >=20 > 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.