diff mbox

[ovs-dev,1/1] netdev-linux: Don't set ethtool flags if flag is already set on netdev

Message ID 1441288399-28745-1-git-send-email-anoob.soman@citrix.com
State Accepted
Headers show

Commit Message

Anoob Soman Sept. 3, 2015, 1:53 p.m. UTC
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>
---
 lib/netdev-linux.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Jesse Gross Sept. 3, 2015, 7:54 p.m. UTC | #1
On Thu, Sep 3, 2015 at 6:53 AM, Anoob Soman <anoob.soman@citrix.com> wrote:
> 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>

Thanks, applied to master, branch-2.4, and branch-2.3.

I did fix the typo in 'return' that prevents this from compiling though...
Anoob Soman Sept. 4, 2015, 3:17 p.m. UTC | #2
My bad, Thanks.

-Anoob

On 03/09/15 20:54, Jesse Gross wrote:
> On Thu, Sep 3, 2015 at 6:53 AM, Anoob Soman <anoob.soman@citrix.com> wrote:
>> 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>
> Thanks, applied to master, branch-2.4, and branch-2.3.
>
> I did fix the typo in 'return' that prevents this from compiling though...
diff mbox

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 56eed04..fe92fb5 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -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) {
+        retrun 0;
+    }
+    evalue.data = new_flags;
     error = netdev_linux_do_ethtool(netdev_name,
                                     (struct ethtool_cmd *)&evalue,
                                     ETHTOOL_SFLAGS, "ETHTOOL_SFLAGS");