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