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:53:53 -0800 Message-ID: <20171219155353.4aa0fe9b@cakuba.netronome.com> References: <20171219193537.22587-1-sthemmin@microsoft.com> <20171219145017.78b60959@xeon-e3> <20171219152057.1e19a0bc@cakuba.netronome.com> <20171219154405.5bb35eff@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-f194.google.com ([209.85.220.194]:40737 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753375AbdLSXx6 (ORCPT ); Tue, 19 Dec 2017 18:53:58 -0500 Received: by mail-qk0-f194.google.com with SMTP id q14so11940348qke.7 for ; Tue, 19 Dec 2017 15:53:57 -0800 (PST) In-Reply-To: <20171219154405.5bb35eff@xeon-e3> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 19 Dec 2017 15:44:05 -0800, Stephen Hemminger wrote: > On Tue, 19 Dec 2017 15:20:57 -0800 > Jakub Kicinski wrote: >=20 > > On Tue, 19 Dec 2017 14:50:17 -0800, Stephen Hemminger wrote: =20 > > > 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= rename > > > > 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. =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 :/ =20 >=20 > The port name for Mellanox driver is already set in the driver as a numer= ic value. > It indicates which port is used. > This won't work. You must be looking at representor ndos. I don't think MLX NIC drivers are implementing phys_port_name for normal netdevs at all today.