[ovs-dev] bug fix for miimon issue with ixgbe driver that half support mii

David Hill dhill at redhat.com
Tue Aug 30 19:21:24 UTC 2016


-------------- next part --------------
Subject: bug fix for miimon issue with ixgbe driver that half support mii
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index efc9527..05aa91f 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -1426,6 +1426,33 @@ netdev_linux_do_miimon(const char *name, int cmd, const char *cmd_name,
 }
 
 static int
+netdev_linux_get_ethtool(const char *name, bool *miimon)
+{
+    struct mii_ioctl_data data;
+    int error;
+
+    *miimon = false;
+
+    struct ethtool_cmd ecmd;
+    VLOG_DBG_RL(&rl, "%s: failed to query MII, falling back to ethtool",
+                    name);
+
+    COVERAGE_INC(netdev_get_ethtool);
+    memset(&ecmd, 0, sizeof ecmd);
+    error = netdev_linux_do_ethtool(name, &ecmd, ETHTOOL_GLINK,
+                                        "ETHTOOL_GLINK");
+    if (!error) {
+        struct ethtool_value eval;
+        memcpy(&eval, &ecmd, sizeof eval)
+        *miimon = !!eval.data;
+    } else {
+        VLOG_WARN_RL(&rl, "%s: ethtool link status failed", name);
+    }
+ 
+    return error;
+}
+
+static int
 netdev_linux_get_miimon(const char *name, bool *miimon)
 {
     struct mii_ioctl_data data;
@@ -1443,28 +1470,11 @@ netdev_linux_get_miimon(const char *name, bool *miimon)
 
         if (!error) {
             *miimon = !!(data.val_out & BMSR_LSTATUS);
-        } else {
-            VLOG_WARN_RL(&rl, "%s: failed to query MII", name);
-        }
-    } else {
-        struct ethtool_cmd ecmd;
-
-        VLOG_DBG_RL(&rl, "%s: failed to query MII, falling back to ethtool",
-                    name);
-
-        COVERAGE_INC(netdev_get_ethtool);
-        memset(&ecmd, 0, sizeof ecmd);
-        error = netdev_linux_do_ethtool(name, &ecmd, ETHTOOL_GLINK,
-                                        "ETHTOOL_GLINK");
-        if (!error) {
-            struct ethtool_value eval;
-
-            memcpy(&eval, &ecmd, sizeof eval);
-            *miimon = !!eval.data;
-        } else {
-            VLOG_WARN_RL(&rl, "%s: ethtool link status failed", name);
         }
     }
+    if (error) {
+      error = netdev_linux_get_ethtool(name, miimon)
+    }
 
     return error;
 }


More information about the dev mailing list