|
|
efe3ca |
From 47b95959941b3d7d2d35a128da5685799329aaf6 Mon Sep 17 00:00:00 2001
|
|
|
efe3ca |
From: Michael Chan <mchan@broadcom.com>
|
|
|
efe3ca |
Date: Tue, 22 Nov 2016 18:55:47 -0500
|
|
|
efe3ca |
Subject: [PATCH 3/3] ethtool: Fix the "advertise" parameter logic.
|
|
|
efe3ca |
|
|
|
efe3ca |
The current code ignores the value of the advertise parameter. For example,
|
|
|
efe3ca |
|
|
|
efe3ca |
ethtool -s ethx advertise 0x1000
|
|
|
efe3ca |
|
|
|
efe3ca |
The full_advertising_wanted parameter of 0x1000 is not passed to the kernel.
|
|
|
efe3ca |
The reason is that advertising_wanted is NULL in this case, and ethtool
|
|
|
efe3ca |
will think that the user has given no advertisement input and so it will
|
|
|
efe3ca |
proceed to pass all supported advertisement speeds to the kernel.
|
|
|
efe3ca |
|
|
|
efe3ca |
The older legacy ethtool with similar logic worked because
|
|
|
efe3ca |
advertising_wanted was an integer and could take on -1 and 0. It would pass
|
|
|
efe3ca |
the full_advertising_wanted value if advertising_wanted == -1.
|
|
|
efe3ca |
|
|
|
efe3ca |
This fix is to pass all supported advertisement speeds only when both
|
|
|
efe3ca |
advertising_wanted == NULL && full_advertising_wanted == NULL.
|
|
|
efe3ca |
|
|
|
efe3ca |
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
|
|
|
efe3ca |
Signed-off-by: John W. Linville <linville@tuxdriver.com>
|
|
|
efe3ca |
---
|
|
|
efe3ca |
ethtool.c | 3 ++-
|
|
|
efe3ca |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
efe3ca |
|
|
|
efe3ca |
diff --git a/ethtool.c b/ethtool.c
|
|
|
efe3ca |
index 0d3244e..ce48639 100644
|
|
|
efe3ca |
--- a/ethtool.c
|
|
|
efe3ca |
+++ b/ethtool.c
|
|
|
efe3ca |
@@ -2972,7 +2972,8 @@ static int do_sset(struct cmd_context *ctx)
|
|
|
efe3ca |
fprintf(stderr, "\n");
|
|
|
efe3ca |
}
|
|
|
efe3ca |
if (autoneg_wanted == AUTONEG_ENABLE &&
|
|
|
efe3ca |
- advertising_wanted == NULL) {
|
|
|
efe3ca |
+ advertising_wanted == NULL &&
|
|
|
efe3ca |
+ full_advertising_wanted == NULL) {
|
|
|
efe3ca |
unsigned int i;
|
|
|
efe3ca |
|
|
|
efe3ca |
/* Auto negotiation enabled, but with
|
|
|
efe3ca |
--
|
|
|
efe3ca |
1.8.3.1
|
|
|
efe3ca |
|