linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next][REPOST] hv_netvsc: Make netvsc/VF binding check both MAC and serial number
@ 2021-04-24  1:12 Dexuan Cui
  2021-04-26  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Dexuan Cui @ 2021-04-24  1:12 UTC (permalink / raw)
  To: davem, kuba, kys, haiyangz, stephen, sthemmin, wei.liu, liuwe,
	netdev, leon, andrew, bernd, rdunlap, shacharr
  Cc: linux-kernel, linux-hyperv, Joseph.Salisbury, Dexuan Cui

Currently the netvsc/VF binding logic only checks the PCI serial number.

The Microsoft Azure Network Adapter (MANA) supports multiple net_device
interfaces (each such interface is called a "vPort", and has its unique
MAC address) which are backed by the same VF PCI device, so the binding
logic should check both the MAC address and the PCI serial number.

The change should not break any other existing VF drivers, because
Hyper-V NIC SR-IOV implementation requires the netvsc network
interface and the VF network interface have the same MAC address.

Co-developed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Co-developed-by: Shachar Raindel <shacharr@microsoft.com>
Signed-off-by: Shachar Raindel <shacharr@microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---

This patch was posted on 4/16 as 
"[PATCH v8 net-next 1/2] hv_netvsc: Make netvsc/VF binding check both MAC and serial number".

The patchwork link says its State is "Accepted":
https://patchwork.kernel.org/project/netdevbpf/patch/20210416201159.25807-2-decui@microsoft.com/
but I don't see it in the latest net-next tree, so let me repost it.

BTW, the other patch has been in the net-next for 4 days:
"[PATCH v8 net-next 2/2] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)"


 drivers/net/hyperv/netvsc_drv.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

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,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next][REPOST] hv_netvsc: Make netvsc/VF binding check both MAC and serial number
  2021-04-24  1:12 [PATCH net-next][REPOST] hv_netvsc: Make netvsc/VF binding check both MAC and serial number Dexuan Cui
@ 2021-04-26  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-26  1:30 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: davem, kuba, kys, haiyangz, stephen, sthemmin, wei.liu, liuwe,
	netdev, leon, andrew, bernd, rdunlap, shacharr, linux-kernel,
	linux-hyperv, Joseph.Salisbury

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Fri, 23 Apr 2021 18:12:35 -0700 you wrote:
> Currently the netvsc/VF binding logic only checks the PCI serial number.
> 
> The Microsoft Azure Network Adapter (MANA) supports multiple net_device
> interfaces (each such interface is called a "vPort", and has its unique
> MAC address) which are backed by the same VF PCI device, so the binding
> logic should check both the MAC address and the PCI serial number.
> 
> [...]

Here is the summary with links:
  - [net-next,REPOST] hv_netvsc: Make netvsc/VF binding check both MAC and serial number
    https://git.kernel.org/netdev/net-next/c/64ff412ad41f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-26  1:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-24  1:12 [PATCH net-next][REPOST] hv_netvsc: Make netvsc/VF binding check both MAC and serial number Dexuan Cui
2021-04-26  1:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).