aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorYu Zhao <yu.zhao@intel.com>2009-03-19 23:25:15 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-03-20 13:48:26 -0400
commitdd7cc44d0bcec5e9c42fe52e88dc254ae62eac8d (patch)
tree742b2c903580eded1e352988b068c0362eccc634 /include/linux
parent480b93b7837fb3cf0579a42f4953ac463a5b9e1e (diff)
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 8ce2f2d9ab63..c2e491e04063 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -265,6 +265,7 @@ struct pci_dev {
265 unsigned int is_pcie:1; 265 unsigned int is_pcie:1;
266 unsigned int state_saved:1; 266 unsigned int state_saved:1;
267 unsigned int is_physfn:1; 267 unsigned int is_physfn:1;
268 unsigned int is_virtfn:1;
268 pci_dev_flags_t dev_flags; 269 pci_dev_flags_t dev_flags;
269 atomic_t enable_cnt; /* pci_enable_device has been called */ 270 atomic_t enable_cnt; /* pci_enable_device has been called */
270 271
@@ -279,7 +280,10 @@ struct pci_dev {
279#endif 280#endif
280 struct pci_vpd *vpd; 281 struct pci_vpd *vpd;
281#ifdef CONFIG_PCI_IOV 282#ifdef CONFIG_PCI_IOV
282 struct pci_sriov *sriov; /* SR-IOV capability related */ 283 union {
284 struct pci_sriov *sriov; /* SR-IOV capability related */
285 struct pci_dev *physfn; /* the PF this VF is associated with */
286 };
283#endif 287#endif
284}; 288};
285 289
@@ -1212,5 +1216,18 @@ int pci_ext_cfg_avail(struct pci_dev *dev);
1212 1216
1213void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1217void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1214 1218
1219#ifdef CONFIG_PCI_IOV
1220extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1221extern void pci_disable_sriov(struct pci_dev *dev);
1222#else
1223static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1224{
1225 return -ENODEV;
1226}
1227static inline void pci_disable_sriov(struct pci_dev *dev)
1228{
1229}
1230#endif
1231
1215#endif /* __KERNEL__ */ 1232#endif /* __KERNEL__ */
1216#endif /* LINUX_PCI_H */ 1233#endif /* LINUX_PCI_H */