Message ID | 20210416201159.25807-2-decui@microsoft.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 8 of 8 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 26 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On Fri, 16 Apr 2021 13:11:58 -0700 Dexuan Cui <decui@microsoft.com> wrote: > Currently the netvsc/VF binding logic only checks the PCI serial number. > > The upcoming 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> > Signed-off-by: Dexuan Cui <decui@microsoft.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> From: Stephen Hemminger <stephen@networkplumber.org> > Sent: Monday, April 19, 2021 8:54 AM > To: Dexuan Cui <decui@microsoft.com> > ... > On Fri, 16 Apr 2021 13:11:58 -0700 > Dexuan Cui <decui@microsoft.com> wrote: > > > Currently the netvsc/VF binding logic only checks the PCI serial number. > > > > The upcoming 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> > > Signed-off-by: Dexuan Cui <decui@microsoft.com> > > Acked-by: Stephen Hemminger <stephen@networkplumber.org> Hi David, Jakub, The "2/2" patch has been in the net-next tree since Monday, but this "1/2" patch is not in -- can you please pick up this patch as well? This patch is needed by the "2/2" patch. Thanks, -- Dexuan
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,