]> git.karo-electronics.de Git - linux-beck.git/commitdiff
PCI: Clear NumVFs when disabling SR-IOV in sriov_init()
authorethan.zhao <ethan.kernel@gmail.com>
Wed, 6 Nov 2013 14:49:13 +0000 (22:49 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 22 Nov 2013 21:53:27 +0000 (14:53 -0700)
When SR-IOV is disabled (VF Enable is cleared), NumVFs is not very useful,
so this patch clears it out to prevent confusing lspci output like that
below.  We already clear NumVFs in sriov_disable(), and this does the same
when we disable SR-IOV as part of parsing the SR-IOV capability.

  $ lspci -vvv -s 13:00.0
  13:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)
      Capabilities: [160 v1] Single Root I/O Virtualization (SR-IOV)
          IOVCtl: Enable- Migration- Interrupt- MSE- ARIHierarchy+
          Initial VFs: 64, Total VFs: 64, Number of VFs: 64, ...

[bhelgaas: changelog]
Signed-off-by: ethan.zhao <ethan.kernel@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/iov.c

index 1fe2d6fb19d5046ae78aaa6df3f26f37c12bf6bf..68311ec849ee5ea21da0a221800a331dcfd7a65b 100644 (file)
@@ -441,6 +441,7 @@ static int sriov_init(struct pci_dev *dev, int pos)
 
 found:
        pci_write_config_word(dev, pos + PCI_SRIOV_CTRL, ctrl);
+       pci_write_config_word(dev, pos + PCI_SRIOV_NUM_VF, 0);
        pci_read_config_word(dev, pos + PCI_SRIOV_VF_OFFSET, &offset);
        pci_read_config_word(dev, pos + PCI_SRIOV_VF_STRIDE, &stride);
        if (!offset || (total > 1 && !stride))