netdev-linux: Don't set ethtool flags if flag is already set on netdev
authorAnoob Soman <anoob.soman@citrix.com>
Thu, 3 Sep 2015 13:53:19 +0000 (14:53 +0100)
committerJesse Gross <jesse@nicira.com>
Thu, 3 Sep 2015 19:51:26 +0000 (12:51 -0700)
Check if ethtool flags is already set on a netdev, before trying to set it.

This patch works around issues with some older verison of ethernet drivers,
which tend to reset the NIC when call to disable LRO is made, even if LRO is
already disable on that NIC. NIC reset is not desirable in OVS upgrade scenario
as it causes extended downtime.

Signed-off-by: Anoob Soman <anoob.soman@citrix.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
lib/netdev-linux.c

index 56eed04..2b54c6a 100644 (file)
@@ -5298,7 +5298,11 @@ netdev_linux_ethtool_set_flag(struct netdev *netdev, uint32_t flag,
     }
 
     COVERAGE_INC(netdev_set_ethtool);
-    evalue.data = new_flags = (evalue.data & ~flag) | (enable ? flag : 0);
+    new_flags = (evalue.data & ~flag) | (enable ? flag : 0);
+    if (new_flags == evalue.data) {
+        return 0;
+    }
+    evalue.data = new_flags;
     error = netdev_linux_do_ethtool(netdev_name,
                                     (struct ethtool_cmd *)&evalue,
                                     ETHTOOL_SFLAGS, "ETHTOOL_SFLAGS");