提交 51af6d7c 编写于 作者: I Ivan Vecera 提交者: David S. Miller

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.
Signed-off-by: NIvan Vecera <ivecera@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 eccc1bb8
...@@ -1076,7 +1076,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, ...@@ -1076,7 +1076,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev,
static int be_find_vfs(struct be_adapter *adapter, int vf_state) static int be_find_vfs(struct be_adapter *adapter, int vf_state)
{ {
struct pci_dev *dev, *pdev = adapter->pdev; struct pci_dev *dev, *pdev = adapter->pdev;
int vfs = 0, assigned_vfs = 0, pos, vf_fn; int vfs = 0, assigned_vfs = 0, pos;
u16 offset, stride; u16 offset, stride;
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV); pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
...@@ -1087,9 +1087,7 @@ static int be_find_vfs(struct be_adapter *adapter, int vf_state) ...@@ -1087,9 +1087,7 @@ static int be_find_vfs(struct be_adapter *adapter, int vf_state)
dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL); dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL);
while (dev) { while (dev) {
vf_fn = (pdev->devfn + offset + stride * vfs) & 0xFFFF; if (dev->is_virtfn && dev->physfn == pdev) {
if (dev->is_virtfn && dev->devfn == vf_fn &&
dev->bus->number == pdev->bus->number) {
vfs++; vfs++;
if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED)
assigned_vfs++; assigned_vfs++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册