[PATCH 1/5] Interface pools and passthrough mode patches: Moving the declaration of _pciDevice and _pciDeviceList to pci.h

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

 



Interface Pools and Passthrough mode:

Current Method:
The passthrough mode uses a macvtap “direct” connection to connect each guest to the network. The physical interface to be used is picked from among those listed in <interface> sub elements of the <forward> element.

The current specification for <forward> extends to allow 0 or more <interface> sub-elements:
Example:
<forward mode='passthrough' dev='eth10'/>
<interface dev='eth10'/>
<interface dev='eth12'/>
<interface dev='eth18'/>
<interface dev='eth20'/>
</forward>

However with an ethernet card with 64 VF's or more, the above method gets tedious on the system.

On the other hand, just parameterizing a string (eth%d) is inadequate, eg, when there are multiple non-contiguous ranges.

Proposed Method:
The 5 patches provided along with this introductory e-mail 

i) Introduce a structure to store the state of all the virtual functions attached to each physical function  
ii) Find a free virtual function given the physical function.

The forward specification will hence only mention the physical function as the interface sub element:
Example:
<forward mode='passthrough' dev='eth2'/>
<interface dev='eth2'/>
</forward>

---
 src/util/pci.c |   35 -----------------------------------
 src/util/pci.h |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/src/util/pci.c b/src/util/pci.c
index cd82b43..857078d 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -45,45 +45,10 @@
 # define MODPROBE "modprobe"
 #endif
 
-#define PCI_SYSFS "/sys/bus/pci/"
-#define PCI_ID_LEN 10   /* "XXXX XXXX" */
-#define PCI_ADDR_LEN 13 /* "XXXX:XX:XX.X" */
-
 #define SRIOV_FOUND 0
 #define SRIOV_NOT_FOUND 1
 #define SRIOV_ERROR -1
 
-struct _pciDevice {
-    unsigned      domain;
-    unsigned      bus;
-    unsigned      slot;
-    unsigned      function;
-
-    char          name[PCI_ADDR_LEN]; /* domain:bus:slot.function */
-    char          id[PCI_ID_LEN];     /* product vendor */
-    char          *path;
-    const char    *used_by;           /* The domain which uses the device */
-    int           fd;
-
-    unsigned      initted;
-    unsigned      pcie_cap_pos;
-    unsigned      pci_pm_cap_pos;
-    unsigned      has_flr : 1;
-    unsigned      has_pm_reset : 1;
-    unsigned      managed : 1;
-
-    /* used by reattach function */
-    unsigned      unbind_from_stub : 1;
-    unsigned      remove_slot : 1;
-    unsigned      reprobe : 1;
-};
-
-struct _pciDeviceList {
-    unsigned count;
-    pciDevice **devs;
-};
-
-
 /* For virReportOOMError()  and virReportSystemError() */
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/pci.h b/src/util/pci.h
index 76e37e3..8e47fc2 100644
--- a/src/util/pci.h
+++ b/src/util/pci.h
@@ -24,9 +24,43 @@
 
 # include "internal.h"
 
+#define PCI_SYSFS "/sys/bus/pci/"
+#define PCI_ID_LEN 10   /* "XXXX XXXX" */
+#define PCI_ADDR_LEN 13 /* "XXXX:XX:XX.X" */
+
 typedef struct _pciDevice pciDevice;
 typedef struct _pciDeviceList pciDeviceList;
 
+struct _pciDevice {
+    unsigned      domain;
+    unsigned      bus;
+    unsigned      slot;
+    unsigned      function;
+
+    char          name[PCI_ADDR_LEN]; /* domain:bus:slot.function */
+    char          id[PCI_ID_LEN];     /* product vendor */
+    char          *path;
+    const char    *used_by;           /* The domain which uses the device */
+    int           fd;
+
+    unsigned      initted;
+    unsigned      pcie_cap_pos;
+    unsigned      pci_pm_cap_pos;
+    unsigned      has_flr : 1;
+    unsigned      has_pm_reset : 1;
+    unsigned      managed : 1;
+
+    /* used by reattach function */
+    unsigned      unbind_from_stub : 1;
+    unsigned      remove_slot : 1;
+    unsigned      reprobe : 1;
+};
+
+struct _pciDeviceList {
+    unsigned count;
+    pciDevice **devs;
+};
+
 struct pci_config_address {
     unsigned int domain;
     unsigned int bus;
-- 
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]