From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [RFC] hv_netvsc: automatically name slave VF network device Date: Wed, 20 Dec 2017 07:41:49 +0100 Message-ID: <20171220064149.GC1916@nanopsycho> References: <20171219193537.22587-1-sthemmin@microsoft.com> <20171219145017.78b60959@xeon-e3> <20171219152057.1e19a0bc@cakuba.netronome.com> <20171219154405.5bb35eff@xeon-e3> <20171219155353.4aa0fe9b@cakuba.netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: Stephen Hemminger , "Samudrala, Sridhar" , netdev@vger.kernel.org, Stephen Hemminger To: Jakub Kicinski Return-path: Received: from mail-wr0-f193.google.com ([209.85.128.193]:41419 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932215AbdLTGlw (ORCPT ); Wed, 20 Dec 2017 01:41:52 -0500 Received: by mail-wr0-f193.google.com with SMTP id p69so12502618wrb.8 for ; Tue, 19 Dec 2017 22:41:51 -0800 (PST) Content-Disposition: inline In-Reply-To: <20171219155353.4aa0fe9b@cakuba.netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: Wed, Dec 20, 2017 at 12:53:53AM CET, jakub.kicinski@netronome.com wrote: >On Tue, 19 Dec 2017 15:44:05 -0800, Stephen Hemminger wrote: >> 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: >> > > >> > > > -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. > >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. You are right Jakub. I plan to generate phys_port_name according to the netdev flavours (vf,pf,qp,vfrep,pfrep,qprep,etc). That would resolve this.