Thread (6 messages) 6 messages, 3 authors, 2021-04-16

RE: [PATCH v7 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)

From: Haiyang Zhang <haiyangz@microsoft.com>
Date: 2021-04-16 17:10:56
Also in: linux-hyperv, lkml

-----Original Message-----
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: Friday, April 16, 2021 12:40 PM
To: Dexuan Cui <decui@microsoft.com>
Cc: davem@davemloft.net; kuba@kernel.org; KY Srinivasan
[off-list ref]; Haiyang Zhang [off-list ref]; Stephen
Hemminger [off-list ref]; wei.liu@kernel.org; Wei Liu
[off-list ref]; netdev@vger.kernel.org; leon@kernel.org;
andrew@lunn.ch; bernd@petrovitsch.priv.at; rdunlap@infradead.org;
Shachar Raindel [off-list ref]; 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)

On Thu, 15 Apr 2021 23:07:05 -0700
Dexuan Cui [off-list ref] wrote:
quoted
diff --git a/drivers/net/hyperv/netvsc_drv.c
b/drivers/net/hyperv/netvsc_drv.c
quoted
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)
quoted
 {
 	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)
quoted
 		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.
This is for the Multi vPorts feature of MANA driver, which allows one VF to 
create multiple vPorts (NICs). They have the same PCI device and same VF 
serial number, but different MACs. 

So we put the change in one patch to avoid distro vendors missing this 
change when backporting the MANA driver.

Thanks,
- Haiyang
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help