Skip to contentSkip to conversation

Ethtool question

DISCUSSION Ben Greear 5 participants 7 messages Oct 11, 2017 – Oct 17, 2017

Subsystems (2)
lore
Share & tools
lore

Ben Greear

author
#0 lore raw

I noticed today that setting some ethtool settings to the same value returns an error code. I would think this should silently return success instead? Makes it easier to call it from scripts this way:

[root@lf0313-6477 lanforge]# ethtool -L eth3 combined 1 combined unmodified, ignoring
no channel parameters changed, aborting current values: tx 0 rx 0 other 1 combined 1 [root@lf0313-6477 lanforge]# echo $?
1

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#1 lore raw
Quoted 10 lines · Ben Greear

I noticed today that setting some ethtool settings to the same value returns an error code. I would think this should silently return success instead? Makes it easier to call it from scripts this way:

[root@lf0313-6477 lanforge]# ethtool -L eth3 combined 1 combined unmodified, ignoring
no channel parameters changed, aborting current values: tx 0 rx 0 other 1 combined 1 [root@lf0313-6477 lanforge]# echo $?
1

I just had this discussion a couple of months ago with someone. My initial feeling was like you, a no-op is not a failure. But someone convinced me otherwise...I will now endeavour to remember who that was and how they convinced me...

Anyone else have input here?

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
maintainer
#2 lore raw

From: "John W. Linville" <[email protected]>
Date: Wed, 11 Oct 2017 16:44:07 -0400

Quoted 12 lines · Ben Greear
Quoted 10 lines

I noticed today that setting some ethtool settings to the same value returns an error code. I would think this should silently return success instead? Makes it easier to call it from scripts this way:

[root@lf0313-6477 lanforge]# ethtool -L eth3 combined 1 combined unmodified, ignoring
no channel parameters changed, aborting current values: tx 0 rx 0 other 1 combined 1 [root@lf0313-6477 lanforge]# echo $?
1

Quoted 6 lines

I just had this discussion a couple of months ago with someone. My initial feeling was like you, a no-op is not a failure. But someone convinced me otherwise...I will now endeavour to remember who that was and how they convinced me...

Anyone else have input here?

I guess this usually happens when drivers don't support changing the settings at all. So they just make their ethtool operation for the 'set' always return an error.

We could have a generic ethtool helper that does "get" and then if the "set" request is identical just return zero.

But from another perspective, the error returned from the "set" in this situation also indicates to the user that the driver does not support the "set" operation which has value and meaning in and of itself. And we'd lose that with the given suggestion.

author
#3 lore raw
Quoted 26 lines · David Miller

From: "John W. Linville" <[email protected]>
Date: Wed, 11 Oct 2017 16:44:07 -0400

Quoted 12 lines · Ben Greear
Quoted 10 lines

I noticed today that setting some ethtool settings to the same value returns an error code. I would think this should silently return success instead? Makes it easier to call it from scripts this way:

[root@lf0313-6477 lanforge]# ethtool -L eth3 combined 1 combined unmodified, ignoring
no channel parameters changed, aborting current values: tx 0 rx 0 other 1 combined 1 [root@lf0313-6477 lanforge]# echo $?
1

Quoted 6 lines

I just had this discussion a couple of months ago with someone. My initial feeling was like you, a no-op is not a failure. But someone convinced me otherwise...I will now endeavour to remember who that was and how they convinced me...

Anyone else have input here?

I guess this usually happens when drivers don't support changing the settings at all. So they just make their ethtool operation for the 'set' always return an error.

Quoted 7 lines

We could have a generic ethtool helper that does "get" and then if the "set" request is identical just return zero.

But from another perspective, the error returned from the "set" in this situation also indicates to the user that the driver does not support the "set" operation which has value and meaning in and of itself. And we'd lose that with the given suggestion.

In my case, the driver (igb) does support the set, my program just made the same ethtool call several times and it fails after the initial change (that actually changes something), as best as I can figure.

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#4 lore raw
Quoted 40 lines · Ben Greear
Quoted 30 lines · David Miller

From: "John W. Linville" <[email protected]>
Date: Wed, 11 Oct 2017 16:44:07 -0400

Quoted 14 lines · Ben Greear
Quoted 11 lines

I noticed today that setting some ethtool settings to the same value returns an error code. I would think this should silently return success instead? Makes it easier to call it from scripts this way:

[root@lf0313-6477 lanforge]# ethtool -L eth3 combined 1 combined unmodified, ignoring
no channel parameters changed, aborting current values: tx 0 rx 0 other 1 combined 1 [root@lf0313-6477 lanforge]# echo $?
1

Quoted 6 lines

I just had this discussion a couple of months ago with someone. My initial feeling was like you, a no-op is not a failure. But someone convinced me otherwise...I will now endeavour to remember who that was and how they convinced me...

Anyone else have input here?

I guess this usually happens when drivers don't support changing the settings at all. So they just make their ethtool operation for the 'set' always return an error.

Quoted 7 lines

We could have a generic ethtool helper that does "get" and then if the "set" request is identical just return zero.

But from another perspective, the error returned from the "set" in this situation also indicates to the user that the driver does not support the "set" operation which has value and meaning in and of itself. And we'd lose that with the given suggestion.

Quoted 5 lines

In my case, the driver (igb) does support the set, my program just made the same
ethtool call several times and it fails after the initial change (that actually
changes something), as best as I can figure.

This error is returned by ethtool user-space. It does a get, check and then set if user has requested changes.

author
#5 lore raw
Quoted 48 lines · Roopa Prabhu
Quoted 40 lines · Ben Greear
Quoted 30 lines · David Miller

From: "John W. Linville" <[email protected]>
Date: Wed, 11 Oct 2017 16:44:07 -0400

Quoted 14 lines · Ben Greear
Quoted 11 lines

I noticed today that setting some ethtool settings to the same value returns an error code. I would think this should silently return success instead? Makes it easier to call it from scripts this way:

[root@lf0313-6477 lanforge]# ethtool -L eth3 combined 1 combined unmodified, ignoring
no channel parameters changed, aborting current values: tx 0 rx 0 other 1 combined 1 [root@lf0313-6477 lanforge]# echo $?
1

Quoted 6 lines

I just had this discussion a couple of months ago with someone. My initial feeling was like you, a no-op is not a failure. But someone convinced me otherwise...I will now endeavour to remember who that was and how they convinced me...

Anyone else have input here?

I guess this usually happens when drivers don't support changing the settings at all. So they just make their ethtool operation for the 'set' always return an error.

Quoted 7 lines

We could have a generic ethtool helper that does "get" and then if the "set" request is identical just return zero.

But from another perspective, the error returned from the "set" in this situation also indicates to the user that the driver does not support the "set" operation which has value and meaning in and of itself. And we'd lose that with the given suggestion.

Quoted 5 lines

In my case, the driver (igb) does support the set, my program just made the same
ethtool call several times and it fails after the initial change (that actually
changes something), as best as I can figure.

Quoted 3 lines

This error is returned by ethtool user-space. It does a get, check and then set if user has requested changes.

So, should we fix ethtool to return 0 in this case instead of an error code?

I think so. If the driver itself returns an error, then probably return the error code and/or fix the driver as seems appropriate.

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#6 lore raw
Quoted 53 lines · Ben Greear
Quoted 48 lines · Roopa Prabhu
Quoted 40 lines · Ben Greear
Quoted 30 lines · David Miller

From: "John W. Linville" <[email protected]>
Date: Wed, 11 Oct 2017 16:44:07 -0400

Quoted 14 lines · Ben Greear
Quoted 11 lines

I noticed today that setting some ethtool settings to the same value returns an error code.  I would think this should silently return success instead?  Makes it easier to call it from scripts this way:

[root@lf0313-6477 lanforge]# ethtool -L eth3 combined 1 combined unmodified, ignoring
no channel parameters changed, aborting current values: tx 0 rx 0 other 1 combined 1 [root@lf0313-6477 lanforge]# echo $?
1

Quoted 6 lines

I just had this discussion a couple of months ago with someone. My initial feeling was like you, a no-op is not a failure. But someone convinced me otherwise...I will now endeavour to remember who that was and how they convinced me...

Anyone else have input here?

I guess this usually happens when drivers don't support changing the settings at all.  So they just make their ethtool operation for the 'set' always return an error.

Quoted 7 lines

We could have a generic ethtool helper that does "get" and then if the "set" request is identical just return zero.

But from another perspective, the error returned from the "set" in this situation also indicates to the user that the driver does not support the "set" operation which has value and meaning in and of itself.  And we'd lose that with the given suggestion.

Quoted 5 lines

In my case, the driver (igb) does support the set, my program just made the same
ethtool call several times and it fails after the initial change (that actually
changes something), as best as I can figure.

Quoted 3 lines

This error is returned by ethtool user-space. It does a get, check and then set if user has requested changes.

Quoted 8 lines

So, should we fix ethtool to return 0 in this case instead of an error code?

I think so.  If the driver itself returns an error, then probably return the error code and/or fix the driver as seems appropriate.

Thanks,
Ben

FWIW, seems like the code isn't consistent in this matter.
Setting pause/channels/coalescing with the same values will return an error code, but setting EEE will return success.