Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp462817pxb; Fri, 16 Apr 2021 09:42:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3DnLQjtAHPa80AVrkwCAdlKuSUH3srV6bBPMiI5MyhZ4HFOltfaU3nuB0FlgbhM9x9nBf X-Received: by 2002:a17:906:3549:: with SMTP id s9mr8967052eja.327.1618591332743; Fri, 16 Apr 2021 09:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618591332; cv=none; d=google.com; s=arc-20160816; b=TnzAWGaMItjLCUjjextklUGQNOUelSaetIjDpzry1KO4VzyRHuTEElgei2qJzgSMrv lTlHWBeTPYuIQQXBbUVsU/6Nrsfmq1KadF0FJnEisw7Z29iCVYm8QzWsEFdC7FWS1tsA fAI45thk00/fKox5bWKi/vOP4z8dfljbf70/R+t6uaQwjewXonkS359GNVmd49xk1HWl RfMY8oRhDNe8/XpvkWzejS277zV8jmgyXbOI5v2cVkjhy48EOiq72SwobCHVCz8yaacm JqvuEqry+fgC1hA90sbQ/d2g8wMPSiuUCGzWF7KQB5QPhpfblgm4/DfNWdqtM/UeWF0S l/RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=qBMbrSOywNmfduS/OTT3MgG5hkK1w/tlntAgfLJqoII=; b=xqVO2Z9K9oH/7L/E0xaQe3dTtF2rzXwZnEyVFABPEtNnuvKTsZim7oZ+Gy9+jq1mUp gbnRolCfja3h/cSZAFvNrUHB4NNKRKus2R/LsOPzAA48kCsCnfSfvpmGXbpxyOeAVwc3 /qRx7YSYVEc90slhA0FnMmtGKTxDiJqYc9ZprRYL+531VJ3U0IQkNTHEd0EPUQfpfQbb k8HiNf2XIa0OCFO3nF63PiZv5kiryfF6aZ9JUwFrmlstnDEAal0rmyTAHxpquId5W/t5 0eCxmLw8NDVs2ev/KDCN2+T5ZPa4532eZwdX5CCdNqwgUknGBHJOGRiRPiONpY/Ucism phOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=t7nKMlwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si4879627edu.262.2021.04.16.09.41.48; Fri, 16 Apr 2021 09:42:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=t7nKMlwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235001AbhDPQkn (ORCPT + 99 others); Fri, 16 Apr 2021 12:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233976AbhDPQkm (ORCPT ); Fri, 16 Apr 2021 12:40:42 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39242C061574 for ; Fri, 16 Apr 2021 09:40:16 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id b26so13559570pfr.3 for ; Fri, 16 Apr 2021 09:40:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qBMbrSOywNmfduS/OTT3MgG5hkK1w/tlntAgfLJqoII=; b=t7nKMlwt2xNTb0VB5O3hJidsskXOoEd+BB1LiY/DkvohgS/mG4I49FoWx/KDPdrsGs NEnjD0k2IrRndhYGwjPO0ocv4l/PR1WwYdaMupvBLARIkFqL0UCJe2To5TjDODgJr/fd Yfkygig4e4EfeFD8E6T0mDauYZ0nFZEjOFvTwY0Ok8NYTeuH1eL7gyZ3K6W+xv8xqgdi n8UaXKXQ7O0VXJJ3876gSSPZ5wa6mxYE4oUjkiTQUpof5BPnGPUgwf/TRoksXbSGUOJ5 i9KSSj50mxWvXyHPBoEWdq5yqASbmihRN4lluaTWLLYRzvaNVGECmMuBdss7TCJG+O3R P9pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qBMbrSOywNmfduS/OTT3MgG5hkK1w/tlntAgfLJqoII=; b=RQTJUTG/HxRBhpEucbP/9jgYXIDd6aEsO9srFSvW/sHjeMiIxzd/aqs3VWwW/yFuF9 zD0Vu+66BtV+YQ79Y+FybO+T8w3fZeSKCydtuWT3OUBizF8bjfr8BlEQJlVl6uY/SyxQ fgrjUTvyBY7tEK5zvR8/MidwP6L7QdnzbuBeuqUHE9Pu01DpG0ARBSKnazUp6eV2Ng6p kE1ULfcuRlNsNZ3YiaP4F+DIHBC21Utj1oLqbk4nzuOZLX35cKHmmFIKD24IZawMd+tD zURnSY7QVP/8Rw8CnCEbtBBJJ5WnT572aFZvBua9BHaie7iEAaw5vnM1SjOZ8jCHGZRC TKjQ== X-Gm-Message-State: AOAM5338FZwYjgQOyL5wISWuF9Q15Py6nVpFnkzhPlj9h4GmlvR+N5TP ewZypV9w/w7Ua3qD+j+q+b3kzHTkSFS2bg== X-Received: by 2002:a62:b412:0:b029:21f:6b06:7bdd with SMTP id h18-20020a62b4120000b029021f6b067bddmr8656780pfn.51.1618591215753; Fri, 16 Apr 2021 09:40:15 -0700 (PDT) Received: from hermes.local (76-14-218-44.or.wavecable.com. [76.14.218.44]) by smtp.gmail.com with ESMTPSA id k21sm5164664pfi.28.2021.04.16.09.40.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 09:40:15 -0700 (PDT) Date: Fri, 16 Apr 2021 09:40:06 -0700 From: Stephen Hemminger To: Dexuan Cui Cc: davem@davemloft.net, kuba@kernel.org, kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, liuwe@microsoft.com, netdev@vger.kernel.org, leon@kernel.org, andrew@lunn.ch, bernd@petrovitsch.priv.at, rdunlap@infradead.org, shacharr@microsoft.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: Re: [PATCH v7 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Message-ID: <20210416094006.70661f47@hermes.local> In-Reply-To: <20210416060705.21998-1-decui@microsoft.com> References: <20210416060705.21998-1-decui@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Apr 2021 23:07:05 -0700 Dexuan Cui wrote: > diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c > index 7349a70af083..f682a5572d84 100644 > --- a/drivers/net/hyperv/netvsc_drv.c > +++ b/drivers/net/hyperv/netvsc_drv.c > @@ -2297,6 +2297,7 @@ 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 net_device *ndev; > struct pci_dev *pdev; > u32 serial; > > @@ -2319,8 +2320,17 @@ static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev) > if (!ndev_ctx->vf_alloc) > continue; > > - if (ndev_ctx->vf_serial == serial) > - return hv_get_drvdata(ndev_ctx->device_ctx); > + if (ndev_ctx->vf_serial != serial) > + continue; > + > + ndev = hv_get_drvdata(ndev_ctx->device_ctx); > + if (ndev->addr_len != vf_netdev->addr_len || > + memcmp(ndev->perm_addr, vf_netdev->perm_addr, > + ndev->addr_len) != 0) > + continue; > + > + return ndev; > + > } > > netdev_notice(vf_netdev, This probably should be a separate patch. I think it is trying to address the case of VF discovery in Hyper-V/Azure where the reported VF from Hypervisor is bogus or confused.