[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] RFC exposing SRIOV PF<->VF relationships

It would be helpful to have an API that exposes the relationship between SR IOV physical functions (PFs) and virtual functions (VFs). I'm thinking of implementing three new API calls and adding a small amount of additional information in the node device pci device capability, as in the attached patch. Let me know what you think.

>From 6ad5d2d6f06647295cde128a6c309e645e283146 Mon Sep 17 00:00:00 2001
From: David Allan <dallan redhat com>
Date: Mon, 16 Nov 2009 16:06:00 -0500
Subject: [PATCH 1/1] Added basis of SR IOV PF<->VF relationship support

* Added three functions to node device API
* Added a little additional information to the node device PCI device capabilities to track the PF<->VFs relationships.
 src/conf/node_device_conf.h |    3 +++
 src/driver.h                |   11 +++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index 639a7e7..a130dd9 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -105,6 +105,9 @@ struct _virNodeDevCapsDef {
             unsigned class;
             char *product_name;
             char *vendor_name;
+            char *physical_function;
+            char **virtual_functions;
+            unsigned num_virtual_functions;
         } pci_dev;
         struct {
             unsigned bus;
diff --git a/src/driver.h b/src/driver.h
index 09ce8e2..c818ced 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -805,6 +805,14 @@ typedef int (*virDevMonDeviceListCaps)(virNodeDevicePtr dev,
                                        char **const names,
                                        int maxnames);

+typedef int (*virDevMonDeviceNumOfVFs)(virNodeDevicePtr dev);
+typedef int (*virDevMonDeviceListVFs)(virNodeDevicePtr dev,
+                                      char **const names,
+                                      int maxnames);
+typedef int (*virDevMonDeviceGetPF)(virNodeDevicePtr dev);
 typedef virNodeDevicePtr (*virDrvNodeDeviceCreateXML)(virConnectPtr conn,
                                                       const char *xmlDesc,
                                                       unsigned int flags);
@@ -828,6 +836,9 @@ struct _virDeviceMonitor {
     virDevMonDeviceGetParent deviceGetParent;
     virDevMonDeviceNumOfCaps deviceNumOfCaps;
     virDevMonDeviceListCaps deviceListCaps;
+    virDevMonDeviceNumOfVFs deviceNumOfVFs;
+    virDevMonDeviceListVFs deviceListVFs;
+    virDevMonDeviceGetPF deviceGetPF;
     virDrvNodeDeviceCreateXML deviceCreateXML;
     virDrvNodeDeviceDestroy deviceDestroy;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]