aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoopa Prabhu <roprabhu@cisco.com>2011-08-15 21:28:43 -0700
committerStefan Berger <stefanb@us.ibm.com>2011-08-16 11:59:00 -0400
commit03172265d37b1d2bb45d728acc0a6b202ad1796c (patch)
treec94b698352d3916bc5dc32dca44933ee302f0530 /src/node_device/node_device_udev.c
parentmaint: ignore generated file (diff)
downloadlibvirt-03172265d37b1d2bb45d728acc0a6b202ad1796c.tar.gz
libvirt-03172265d37b1d2bb45d728acc0a6b202ad1796c.tar.bz2
libvirt-03172265d37b1d2bb45d728acc0a6b202ad1796c.zip
pci: Move some pci sriov helper code out of node device driver to util/pci
This patch moves some of the sriov related pci code from node_device driver to src/util/pci.[ch]. Some functions had to go thru name and argument list change to accommodate the move. Signed-off-by: Roopa Prabhu <roprabhu@cisco.com> Signed-off-by: Christian Benvenuti <benve@cisco.com> Signed-off-by: David Wang <dwang2@cisco.com>
Diffstat (limited to 'src/node_device/node_device_udev.c')
-rw-r--r--src/node_device/node_device_udev.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 2c5d0160e..badf2416d 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -37,6 +37,7 @@
#include "uuid.h"
#include "util.h"
#include "buf.h"
+#include "pci.h"
#define VIR_FROM_THIS VIR_FROM_NODEDEV
@@ -480,8 +481,13 @@ static int udevProcessPCI(struct udev_device *device,
goto out;
}
- get_physical_function(syspath, data);
- get_virtual_functions(syspath, data);
+ if (!pciGetPhysicalFunction(syspath, &data->pci_dev.physical_function))
+ data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION;
+
+ if (!pciGetVirtualFunctions(syspath, &data->pci_dev.virtual_functions,
+ &data->pci_dev.num_virtual_functions) ||
+ data->pci_dev.num_virtual_functions > 0)
+ data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
ret = 0;