summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorYu Zhao <yu.zhao@intel.com>2009-03-20 11:25:15 +0800
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-03-20 10:48:26 -0700
commitdd7cc44d0bcec5e9c42fe52e88dc254ae62eac8d (patch)
tree742b2c903580eded1e352988b068c0362eccc634 /include/linux
parent480b93b7837fb3cf0579a42f4953ac463a5b9e1e (diff)
downloadop-kernel-dev-dd7cc44d0bcec5e9c42fe52e88dc254ae62eac8d.zip
op-kernel-dev-dd7cc44d0bcec5e9c42fe52e88dc254ae62eac8d.tar.gz
PCI: add SR-IOV API for Physical Function driver
Add or remove the Virtual Function when the SR-IOV is enabled or disabled by the device driver. This can happen anytime rather than only at the device probe stage. Reviewed-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Yu Zhao <yu.zhao@intel.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pci.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8ce2f2d..c2e491e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -265,6 +265,7 @@ struct pci_dev {
unsigned int is_pcie:1;
unsigned int state_saved:1;
unsigned int is_physfn:1;
+ unsigned int is_virtfn:1;
pci_dev_flags_t dev_flags;
atomic_t enable_cnt; /* pci_enable_device has been called */
@@ -279,7 +280,10 @@ struct pci_dev {
#endif
struct pci_vpd *vpd;
#ifdef CONFIG_PCI_IOV
- struct pci_sriov *sriov; /* SR-IOV capability related */
+ union {
+ struct pci_sriov *sriov; /* SR-IOV capability related */
+ struct pci_dev *physfn; /* the PF this VF is associated with */
+ };
#endif
};
@@ -1212,5 +1216,18 @@ int pci_ext_cfg_avail(struct pci_dev *dev);
void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
+#ifdef CONFIG_PCI_IOV
+extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
+extern void pci_disable_sriov(struct pci_dev *dev);
+#else
+static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
+{
+ return -ENODEV;
+}
+static inline void pci_disable_sriov(struct pci_dev *dev)
+{
+}
+#endif
+
#endif /* __KERNEL__ */
#endif /* LINUX_PCI_H */
OpenPOWER on IntegriCloud