Skip to content

Commit b93c1b5

Browse files
shemmingerdavem330
authored andcommitted
hv_netvsc: ignore devices that are not PCI
Registering another device with same MAC address (such as TAP, VPN or DPDK KNI) will confuse the VF autobinding logic. Restrict the search to only run if the device is known to be a PCI attached VF. Fixes: e8ff40d ("hv_netvsc: improve VF device matching") Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c27f1e2 commit b93c1b5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/hyperv/netvsc_drv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/netdevice.h>
3030
#include <linux/inetdevice.h>
3131
#include <linux/etherdevice.h>
32+
#include <linux/pci.h>
3233
#include <linux/skbuff.h>
3334
#include <linux/if_vlan.h>
3435
#include <linux/in.h>
@@ -2039,12 +2040,16 @@ static int netvsc_register_vf(struct net_device *vf_netdev)
20392040
{
20402041
struct net_device *ndev;
20412042
struct net_device_context *net_device_ctx;
2043+
struct device *pdev = vf_netdev->dev.parent;
20422044
struct netvsc_device *netvsc_dev;
20432045
int ret;
20442046

20452047
if (vf_netdev->addr_len != ETH_ALEN)
20462048
return NOTIFY_DONE;
20472049

2050+
if (!pdev || !dev_is_pci(pdev) || dev_is_pf(pdev))
2051+
return NOTIFY_DONE;
2052+
20482053
/*
20492054
* We will use the MAC address to locate the synthetic interface to
20502055
* associate with the VF interface. If we don't find a matching

0 commit comments

Comments
 (0)