[PATCH 4/5] Addition of a new device structure to store the state of a Virtual Function Modifications to the Physical Device Structure to store state of its Virtual Functions

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

 



---
 src/conf/network_conf.c |   19 ++++++++++++++++++-
 src/conf/network_conf.h |   10 ++++++++++
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 10afcde..d30d757 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -43,6 +43,7 @@
 #include "buf.h"
 #include "c-ctype.h"
 #include "virfile.h"
+#include "logging.h"
 
 #define MAX_BRIDGE_ID 256
 #define VIR_FROM_THIS VIR_FROM_NETWORK
@@ -103,6 +104,12 @@ virNetworkForwardIfDefClear(virNetworkForwardIfDefPtr def)
     VIR_FREE(def->dev);
 }
 
+static void
+virNetworkForwardVfDefClear(virNetworkForwardVfDefPtr def)
+{
+    VIR_FREE(def->dev);
+}
+
 static void virNetworkIpDefClear(virNetworkIpDefPtr def)
 {
     int ii;
@@ -144,7 +151,7 @@ static void virNetworkDNSDefFree(virNetworkDNSDefPtr def)
 
 void virNetworkDefFree(virNetworkDefPtr def)
 {
-    int ii;
+    int ii, jj;
 
     if (!def)
         return;
@@ -154,6 +161,10 @@ void virNetworkDefFree(virNetworkDefPtr def)
     VIR_FREE(def->domain);
 
     for (ii = 0 ; ii < def->nForwardIfs && def->forwardIfs ; ii++) {
+        for (jj = 0 ; jj < (def->forwardIfs[ii]).nForwardVfs ; jj++) {
+            virNetworkForwardVfDefClear(&(def->forwardIfs[ii].forwardVfs[jj]));
+        }
+        VIR_FREE(def->forwardIfs[ii].forwardVfs); 
         virNetworkForwardIfDefClear(&def->forwardIfs[ii]);
     }
     VIR_FREE(def->forwardIfs);
@@ -979,6 +990,9 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
 
             if (forwardDev) {
                 def->forwardIfs[0].usageCount = 0;
+                def->forwardIfs[0].vfs_in_use_count = 0;
+                def->forwardIfs[0].nForwardVfs = 0;
+                def->forwardIfs[0].forwardVfs = NULL;
                 def->forwardIfs[0].dev = forwardDev;
                 forwardDev = NULL;
                 def->nForwardIfs++;
@@ -1011,6 +1025,9 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
                 def->forwardIfs[ii].dev = forwardDev;
                 forwardDev = NULL;
                 def->forwardIfs[ii].usageCount = 0;
+                def->forwardIfs[ii].vfs_in_use_count = 0;
+                def->forwardIfs[ii].nForwardVfs = 0;
+                def->forwardIfs[ii].forwardVfs = NULL;
                 def->nForwardIfs++;
             }
         }
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 1be20f8..d1dba94 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -112,11 +112,21 @@ struct _virNetworkIpDef {
     virSocketAddr bootserver;
    };
 
+typedef struct _virNetworkForwardVfDef virNetworkForwardVfDef;
+typedef virNetworkForwardVfDef *virNetworkForwardVfDefPtr;
+struct _virNetworkForwardVfDef {
+    char *dev;
+    int usageCount;
+};
+
 typedef struct _virNetworkForwardIfDef virNetworkForwardIfDef;
 typedef virNetworkForwardIfDef *virNetworkForwardIfDefPtr;
 struct _virNetworkForwardIfDef {
     char *dev;      /* name of device */
     int usageCount; /* how many guest interfaces are bound to this device? */
+    int vfs_in_use_count; /*if SRIOV, Are any of the Vf's on the dev in use? */
+    size_t nForwardVfs;
+    virNetworkForwardVfDefPtr forwardVfs;
 };
 
 typedef struct _virPortGroupDef virPortGroupDef;
-- 
1.7.4.4


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]