aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/iov.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index e73bdae447cc..21a7182dccd4 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -323,7 +323,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
323 323
324 if (!pdev->is_physfn) { 324 if (!pdev->is_physfn) {
325 pci_dev_put(pdev); 325 pci_dev_put(pdev);
326 return -ENODEV; 326 return -ENOSYS;
327 } 327 }
328 328
329 rc = sysfs_create_link(&dev->dev.kobj, 329 rc = sysfs_create_link(&dev->dev.kobj,
@@ -664,7 +664,7 @@ int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
664 might_sleep(); 664 might_sleep();
665 665
666 if (!dev->is_physfn) 666 if (!dev->is_physfn)
667 return -ENODEV; 667 return -ENOSYS;
668 668
669 return sriov_enable(dev, nr_virtfn); 669 return sriov_enable(dev, nr_virtfn);
670} 670}
@@ -724,7 +724,7 @@ EXPORT_SYMBOL_GPL(pci_num_vf);
724 * @dev: the PCI device 724 * @dev: the PCI device
725 * 725 *
726 * Returns number of VFs belonging to this device that are assigned to a guest. 726 * Returns number of VFs belonging to this device that are assigned to a guest.
727 * If device is not a physical function returns -ENODEV. 727 * If device is not a physical function returns 0.
728 */ 728 */
729int pci_vfs_assigned(struct pci_dev *dev) 729int pci_vfs_assigned(struct pci_dev *dev)
730{ 730{
@@ -769,12 +769,15 @@ EXPORT_SYMBOL_GPL(pci_vfs_assigned);
769 * device's mutex held. 769 * device's mutex held.
770 * 770 *
771 * Returns 0 if PF is an SRIOV-capable device and 771 * Returns 0 if PF is an SRIOV-capable device and
772 * value of numvfs valid. If not a PF with VFS, return -EINVAL; 772 * value of numvfs valid. If not a PF return -ENOSYS;
773 * if numvfs is invalid return -EINVAL;
773 * if VFs already enabled, return -EBUSY. 774 * if VFs already enabled, return -EBUSY.
774 */ 775 */
775int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) 776int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
776{ 777{
777 if (!dev->is_physfn || (numvfs > dev->sriov->total_VFs)) 778 if (!dev->is_physfn)
779 return -ENOSYS;
780 if (numvfs > dev->sriov->total_VFs)
778 return -EINVAL; 781 return -EINVAL;
779 782
780 /* Shouldn't change if VFs already enabled */ 783 /* Shouldn't change if VFs already enabled */
@@ -793,12 +796,12 @@ EXPORT_SYMBOL_GPL(pci_sriov_set_totalvfs);
793 * 796 *
794 * For a PCIe device with SRIOV support, return the PCIe 797 * For a PCIe device with SRIOV support, return the PCIe
795 * SRIOV capability value of TotalVFs or the value of driver_max_VFs 798 * SRIOV capability value of TotalVFs or the value of driver_max_VFs
796 * if the driver reduced it. Otherwise, -EINVAL. 799 * if the driver reduced it. Otherwise 0.
797 */ 800 */
798int pci_sriov_get_totalvfs(struct pci_dev *dev) 801int pci_sriov_get_totalvfs(struct pci_dev *dev)
799{ 802{
800 if (!dev->is_physfn) 803 if (!dev->is_physfn)
801 return -EINVAL; 804 return 0;
802 805
803 if (dev->sriov->driver_max_VFs) 806 if (dev->sriov->driver_max_VFs)
804 return dev->sriov->driver_max_VFs; 807 return dev->sriov->driver_max_VFs;