Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp402153imm; Thu, 11 Oct 2018 23:36:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV611MBN076AqNEPmWxjzqUvS3PNvmX2upR/NRs2SsdGt6RL2Y4yhvqeCwbxf+zB2ZRQdbM5E X-Received: by 2002:a63:e347:: with SMTP id o7-v6mr4431421pgj.251.1539326219107; Thu, 11 Oct 2018 23:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539326219; cv=none; d=google.com; s=arc-20160816; b=E2jgRcoJmG0Gh4DLW42+s1bKkErkQRBphFpm7kKmowknFG7xTCXxsVXycAeePLmq+j R7xnOFGGEbsnZeYZ0gCxIqqh3gL4slVqlxoWPc+EdO8kgiP7Pq0aPlAxIlzOfkKgFPX1 357MbcKTKC7PFTBR7fgYq+iUEDH+E7aexSgqX7puRHMFwMX0wnRKZLWyb//XNWyuYUHM r4g8sC9T6i++AHkBqgWDZKe1DIwlRfsHyIDV0UpFkDccnhl1VOEgBYvLwAth/Ur9l6DG PnhfgJQ5gd/2pnKdGN/rP/EjU7peEufe5EevoDitaGlPkbvU642Ytj64MxVDavY8bPNG kdRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KNtHvs7vAvkPrCqq4IxNs3TgsX+PfMKfVj5CwVpTFDo=; b=YHrQlgs91A04O8OdIBVmNXQ2122OHYK1Ilup+xTp6QxNdLzYEbilXJ4rTe45rkXCjo v3vzEE1x9m82r50yFddBMev7hxT02BThvIlON/RHZsZu/uNJftban/Og1Je+R5CDDf7U 9d5syKyJ0eBlg37CIAB2hMlniLwbCAcFjOjfR4cWeAGtnC/yw0dyyq3PkMJl8cEn1EkM byp/Y6MGl8WLTZG2KSavGOMGVyLvOx4Sktx97jIYPT5gAuH4KjqpD0xZkGELkpZ6Xg88 FpZ87Ma+plX4W9GLQ1XCpPzSgBeX1NGTfO2Sah7MhjzsZVSySHjReiUTQI7yxgiFXGe3 hhfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="tXk/cvQZ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k6-v6si321813pla.156.2018.10.11.23.36.44; Thu, 11 Oct 2018 23:36:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="tXk/cvQZ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727668AbeJLOHU (ORCPT + 99 others); Fri, 12 Oct 2018 10:07:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:44694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbeJLOHU (ORCPT ); Fri, 12 Oct 2018 10:07:20 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B00252098A; Fri, 12 Oct 2018 06:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539326183; bh=75Fm92VDvQ2i2AjPJp4Rwk/gX8rfJcm8A0TkFOxVrCU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tXk/cvQZBaTUyuJheeQCs1ELwy4+y2tMqWAIvHVkGJZn0fELMlcKSFFWwFjeCX69Z LDNEbPqQ2JkvswKtyNmYFAqvmLXU1H4zQcFs07qSN2Ry9kNkwB5sZ0h/hF5Vs4w0hj RS9EiFLNBAXLxvEl78Zmwf1Nr7NkhNCY1rDOZnVk= Date: Fri, 12 Oct 2018 08:36:20 +0200 From: Greg KH To: haiyangz@microsoft.com Cc: davem@davemloft.net, netdev@vger.kernel.org, olaf@aepfle.de, sthemmin@microsoft.com, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, vkuznets@redhat.com Subject: Re: [PATCH net-next] hv_netvsc: fix vf serial matching with pci slot info Message-ID: <20181012063620.GA20393@kroah.com> References: <20181011201434.30737-1-haiyangz@linuxonhyperv.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181011201434.30737-1-haiyangz@linuxonhyperv.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 08:14:34PM +0000, Haiyang Zhang wrote: > From: Haiyang Zhang > > The VF device's serial number is saved as a string in PCI slot's > kobj name, not the slot->number. This patch corrects the netvsc > driver, so the VF device can be successfully paired with synthetic > NIC. > > Fixes: 00d7ddba1143 ("hv_netvsc: pair VF based on serial number") > Signed-off-by: Haiyang Zhang > --- > drivers/net/hyperv/netvsc_drv.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c > index 9bcaf204a7d4..8121ce34a39f 100644 > --- a/drivers/net/hyperv/netvsc_drv.c > +++ b/drivers/net/hyperv/netvsc_drv.c > @@ -2030,14 +2030,15 @@ static void netvsc_vf_setup(struct work_struct *w) > rtnl_unlock(); > } > > -/* Find netvsc by VMBus serial number. > - * The PCI hyperv controller records the serial number as the slot. > +/* Find netvsc by VF serial number. > + * The PCI hyperv controller records the serial number as the slot kobj name. > */ > 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; > + u32 serial; > > if (!parent || !dev_is_pci(parent)) > return NULL; /* not a PCI device */ > @@ -2048,16 +2049,22 @@ static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev) > return NULL; > } > > + if (kstrtou32(pdev->slot->kobj.name, 10, &serial)) { kobject_name()? And that feels _very_ fragile to me. This is now an api that you are guaranteeing will never change? Good luck with that! greg k-h