[PATCH 4/4 v2] macvtap: Fix getPhysfn to get the PF of a direct attach network interface

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

 



From: Roopa Prabhu <roprabhu@xxxxxxxxx>

This patch renames getPhysfn to getPhysfnDev and adds code to get the
Physical function and Virtual Function index of the direct attach linkdev (if
the direct attach interface is a SRIOV VF). The idea is to send the port
profile message to a PF if the direct attach interface is a SRIOV VF.

Signed-off-by: Roopa Prabhu <roprabhu@xxxxxxxxx>
Signed-off-by: Christian Benvenuti <benve@xxxxxxxxx>
Signed-off-by: David Wang <dwang2@xxxxxxxxx>
---
 src/util/macvtap.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)


diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index 0b00776..9bf7fa6 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -943,23 +943,20 @@ err_exit:
 
 # ifdef IFLA_VF_PORT_MAX
 static int
-getPhysfn(const char *linkdev,
-          int32_t *vf,
-          char **physfndev)
+getPhysfnDev(const char *linkdev,
+             int32_t *vf,
+             char **physfndev)
 {
     int rc = 0;
-    bool virtfn = false;
 
-    if (virtfn) {
+    if (ifaceIsVirtualFunction(linkdev)) {
 
-        /* XXX: if linkdev is SR-IOV VF, then set vf = VF index */
-        /* XXX: and set linkdev = PF device */
-        /* XXX: need to use get_physical_function_linux() or */
-        /* XXX: something like that to get PF */
-        /* XXX: device and figure out VF index */
-
-        rc = 1;
+        /* if linkdev is SR-IOV VF, then set vf = VF index */
+        /* and set linkdev = PF device */
 
+        rc = ifaceGetPhysicalFunction(linkdev, physfndev);
+        if (!rc)
+            rc = ifaceGetVirtualFunctionIndex(*physfndev, linkdev, vf);
     } else {
 
         /* Not SR-IOV VF: physfndev is linkdev and VF index
@@ -1003,7 +1000,7 @@ doPortProfileOp8021Qbh(const char *ifname,
     int ifindex;
     int vlanid = -1;
 
-    rc = getPhysfn(ifname, &vf, &physfndev);
+    rc = getPhysfnDev(ifname, &vf, &physfndev);
     if (rc)
         goto err_exit;
 

--
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]