From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:56044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbeJQPk6 (ORCPT ); Wed, 17 Oct 2018 11:40:58 -0400 Date: Wed, 17 Oct 2018 09:46:29 +0200 From: Greg Kroah-Hartman To: Haiyang Zhang Cc: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Stephen Hemminger , "David S. Miller" , Sasha Levin Subject: Re: [PATCH 4.18 101/135] hv_netvsc: pair VF based on serial number Message-ID: <20181017074629.GD25537@kroah.com> References: <20181016170515.447235311@linuxfoundation.org> <20181016170522.303317746@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: On Tue, Oct 16, 2018 at 07:13:12PM +0000, Haiyang Zhang wrote: > > > > -----Original Message----- > > From: linux-kernel-owner@vger.kernel.org > owner@vger.kernel.org> On Behalf Of Greg Kroah-Hartman > > Sent: Tuesday, October 16, 2018 1:06 PM > > To: linux-kernel@vger.kernel.org > > Cc: Greg Kroah-Hartman ; > > stable@vger.kernel.org; Stephen Hemminger ; > > David S. Miller ; Sasha Levin > > > > Subject: [PATCH 4.18 101/135] hv_netvsc: pair VF based on serial number > > > > 4.18-stable review patch. If anyone has any objections, please let me know. > > > > ------------------ > > > > From: Stephen Hemminger > > > > [ Upstream commit 00d7ddba1143623b31bc2c15d18216e2da031b14 ] > > > > Matching network device based on MAC address is problematic since a non VF > > network device can be creted with a duplicate MAC address causing confusion > > and problems. The VMBus API does provide a serial number that is a better > > matching method. > > > > Signed-off-by: Stephen Hemminger > > Signed-off-by: David S. Miller > > Signed-off-by: Sasha Levin > > Signed-off-by: Greg Kroah-Hartman > > --- > > drivers/net/hyperv/netvsc.c | 3 ++ > > drivers/net/hyperv/netvsc_drv.c | 58 ++++++++++++++++++++++----------------- > > - > > 2 files changed, 36 insertions(+), 25 deletions(-) > > > > --- a/drivers/net/hyperv/netvsc.c > > +++ b/drivers/net/hyperv/netvsc.c > > @@ -1203,6 +1203,9 @@ static void netvsc_send_vf(struct net_de > > > > net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated; > > net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial; > > + netdev_info(ndev, "VF slot %u %s\n", > > + net_device_ctx->vf_serial, > > + net_device_ctx->vf_alloc ? "added" : "removed"); > > } > > > > static void netvsc_receive_inband(struct net_device *ndev, > > --- a/drivers/net/hyperv/netvsc_drv.c > > +++ b/drivers/net/hyperv/netvsc_drv.c > > @@ -1794,20 +1794,6 @@ out_unlock: > > rtnl_unlock(); > > } > > > > -static struct net_device *get_netvsc_bymac(const u8 *mac) -{ > > - struct net_device_context *ndev_ctx; > > - > > - list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { > > - struct net_device *dev = hv_get_drvdata(ndev_ctx- > > >device_ctx); > > - > > - if (ether_addr_equal(mac, dev->perm_addr)) > > - return dev; > > - } > > - > > - return NULL; > > -} > > - > > static struct net_device *get_netvsc_byref(struct net_device *vf_netdev) { > > struct net_device_context *net_device_ctx; @@ -1936,26 +1922,48 > > @@ static void netvsc_vf_setup(struct work_ > > rtnl_unlock(); > > } > > > > +/* Find netvsc by VMBus serial number. > > + * The PCI hyperv controller records the serial number as the slot. > > + */ > > +static struct net_device *get_netvsc_byslot(const struct net_device > > +*vf_netdev) { > > + struct device *parent = vf_netdev->dev.parent; > > + struct net_device_context *ndev_ctx; > > + struct pci_dev *pdev; > > + > > + if (!parent || !dev_is_pci(parent)) > > + return NULL; /* not a PCI device */ > > + > > + pdev = to_pci_dev(parent); > > + if (!pdev->slot) { > > + netdev_notice(vf_netdev, "no PCI slot information\n"); > > + return NULL; > > + } > > + > > + list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { > > + if (!ndev_ctx->vf_alloc) > > + continue; > > + > > + if (ndev_ctx->vf_serial == pdev->slot->number) > > + return hv_get_drvdata(ndev_ctx->device_ctx); > > Greg, > > I had a fix to this patch. If not already, Could you include my following fix together? > hv_netvsc: fix vf serial matching with pci slot info > https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=005479556197f80139771960dda0dfdcd2d2aad5 I can not take a patch that is not "upstream" yet, sorry. Also, this really feels like a "new feature" to me. Can someone explain what bug this is fixing? thanks, greg k-h