diff options
author | Ivan Vecera <ivecera@redhat.com> | 2012-09-30 21:56:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-01 16:43:17 -0400 |
commit | 2f6a02604e962295569749913081365ec9ec1372 (patch) | |
tree | 199ae83acd27e6f007f7230644d3b6b0b3556bd7 /drivers/net/ethernet | |
parent | f4b549a5ac818722fc13d789584f41f4e00d78b5 (diff) |
be2net: fix vfs enumeration
Current VFs enumeration algorithm used in be_find_vfs does not take domain
number into the match. The match found in igb/ixgbe is more elegant and
safe.
This 2nd version uses pci_physfn instead of checking dev->physfn directly.
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 6accb0c0273a..8dd42b309f38 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -1075,7 +1075,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, | |||
1075 | static int be_find_vfs(struct be_adapter *adapter, int vf_state) | 1075 | static int be_find_vfs(struct be_adapter *adapter, int vf_state) |
1076 | { | 1076 | { |
1077 | struct pci_dev *dev, *pdev = adapter->pdev; | 1077 | struct pci_dev *dev, *pdev = adapter->pdev; |
1078 | int vfs = 0, assigned_vfs = 0, pos, vf_fn; | 1078 | int vfs = 0, assigned_vfs = 0, pos; |
1079 | u16 offset, stride; | 1079 | u16 offset, stride; |
1080 | 1080 | ||
1081 | pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV); | 1081 | pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV); |
@@ -1086,9 +1086,7 @@ static int be_find_vfs(struct be_adapter *adapter, int vf_state) | |||
1086 | 1086 | ||
1087 | dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL); | 1087 | dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL); |
1088 | while (dev) { | 1088 | while (dev) { |
1089 | vf_fn = (pdev->devfn + offset + stride * vfs) & 0xFFFF; | 1089 | if (dev->is_virtfn && pci_physfn(dev) == pdev) { |
1090 | if (dev->is_virtfn && dev->devfn == vf_fn && | ||
1091 | dev->bus->number == pdev->bus->number) { | ||
1092 | vfs++; | 1090 | vfs++; |
1093 | if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) | 1091 | if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) |
1094 | assigned_vfs++; | 1092 | assigned_vfs++; |