提交 64ff412a 编写于 作者: D Dexuan Cui 提交者: David S. Miller

hv_netvsc: Make netvsc/VF binding check both MAC and serial number

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: NHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: NHaiyang Zhang <haiyangz@microsoft.com>
Co-developed-by: NShachar Raindel <shacharr@microsoft.com>
Signed-off-by: NShachar Raindel <shacharr@microsoft.com>
Acked-by: NStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: NDexuan Cui <decui@microsoft.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 bf7d20cd
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册