* [PATCH ethtool] ethtool: Fix the "advertise" parameter logic.
@ 2016-11-22 23:55 Michael Chan
2016-11-23 15:00 ` John W. Linville
0 siblings, 1 reply; 2+ messages in thread
From: Michael Chan @ 2016-11-22 23:55 UTC (permalink / raw)
To: linville; +Cc: netdev
From: Michael Chan <mchan@broadcom.com>
The current code ignores the value of the advertise parameter. For example,
ethtool -s ethx advertise 0x1000
The full_advertising_wanted parameter of 0x1000 is not passed to the kernel.
The reason is that advertising_wanted is NULL in this case, and ethtool
will think that the user has given no advertisement input and so it will
proceed to pass all supported advertisement speeds to the kernel.
The older legacy ethtool with similar logic worked because
advertising_wanted was an integer and could take on -1 and 0. It would pass
the full_advertising_wanted value if advertising_wanted == -1.
This fix is to pass all supported advertisement speeds only when both
advertising_wanted == NULL && full_advertising_wanted == NULL.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
ethtool.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ethtool.c b/ethtool.c
index 49ac94e..7715823 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2971,7 +2971,8 @@ static int do_sset(struct cmd_context *ctx)
fprintf(stderr, "\n");
}
if (autoneg_wanted == AUTONEG_ENABLE &&
- advertising_wanted == NULL) {
+ advertising_wanted == NULL &&
+ full_advertising_wanted == NULL) {
unsigned int i;
/* Auto negotiation enabled, but with
--
1.8.4.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH ethtool] ethtool: Fix the "advertise" parameter logic.
2016-11-22 23:55 [PATCH ethtool] ethtool: Fix the "advertise" parameter logic Michael Chan
@ 2016-11-23 15:00 ` John W. Linville
0 siblings, 0 replies; 2+ messages in thread
From: John W. Linville @ 2016-11-23 15:00 UTC (permalink / raw)
To: Michael Chan; +Cc: netdev
On Tue, Nov 22, 2016 at 06:55:47PM -0500, Michael Chan wrote:
> From: Michael Chan <mchan@broadcom.com>
>
> The current code ignores the value of the advertise parameter. For example,
>
> ethtool -s ethx advertise 0x1000
>
> The full_advertising_wanted parameter of 0x1000 is not passed to the kernel.
> The reason is that advertising_wanted is NULL in this case, and ethtool
> will think that the user has given no advertisement input and so it will
> proceed to pass all supported advertisement speeds to the kernel.
>
> The older legacy ethtool with similar logic worked because
> advertising_wanted was an integer and could take on -1 and 0. It would pass
> the full_advertising_wanted value if advertising_wanted == -1.
>
> This fix is to pass all supported advertisement speeds only when both
> advertising_wanted == NULL && full_advertising_wanted == NULL.
>
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Thanks, Michael -- merging...
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-23 15:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-22 23:55 [PATCH ethtool] ethtool: Fix the "advertise" parameter logic Michael Chan
2016-11-23 15:00 ` John W. Linville
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).