aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/iov.c
diff options
context:
space:
mode:
authorWilliams, Mitch A <mitch.a.williams@intel.com>2010-02-09 20:43:04 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-12 19:56:07 -0500
commitfb8a0d9d1bfd1e4355f307e86a6da7209eefd5f3 (patch)
tree99f23a4bc7c51343619f63970e5d017d75b5a66f /drivers/pci/iov.c
parent81d54ec8479a2c695760da81f05b5a9fb2dbe40a (diff)
pci: Add SR-IOV convenience functions and macros
Add and export pci_num_vf to allow other subsystems to determine how many virtual function devices are associated with an SR-IOV physical function device. Add macros dev_is_pci, dev_is_ps, and dev_num_vf to make it easier for non-PCI specific code to determine SR-IOV capabilities. Signed-off-by: Mitch Williams <mitch.a.williams@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/pci/iov.c')
-rw-r--r--drivers/pci/iov.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index b2a448e19fe6..3e5ab2bf6a5c 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -706,6 +706,21 @@ irqreturn_t pci_sriov_migration(struct pci_dev *dev)
706} 706}
707EXPORT_SYMBOL_GPL(pci_sriov_migration); 707EXPORT_SYMBOL_GPL(pci_sriov_migration);
708 708
709/**
710 * pci_num_vf - return number of VFs associated with a PF device_release_driver
711 * @dev: the PCI device
712 *
713 * Returns number of VFs, or 0 if SR-IOV is not enabled.
714 */
715int pci_num_vf(struct pci_dev *dev)
716{
717 if (!dev || !dev->is_physfn)
718 return 0;
719 else
720 return dev->sriov->nr_virtfn;
721}
722EXPORT_SYMBOL_GPL(pci_num_vf);
723
709static int ats_alloc_one(struct pci_dev *dev, int ps) 724static int ats_alloc_one(struct pci_dev *dev, int ps)
710{ 725{
711 int pos; 726 int pos;