From: David Decotigny <decot@google.com>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
"David S. Miller" <davem@davemloft.net>,
Joe Perches <joe@perches.com>,
Stanislaw Gruszka <sgruszka@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: David Decotigny <decot@google.com>
Subject: [PATCH 2/2] net/dl2k: Don't reconfigure link @100Mbps when disabling autoneg @1Gbps
Date: Mon, 9 May 2011 17:19:08 -0700 [thread overview]
Message-ID: <1304986748-15809-3-git-send-email-decot@google.com> (raw)
In-Reply-To: <1304986748-15809-1-git-send-email-decot@google.com>
The initial version of the driver used to force the link to 100Mbps
when auto-negociation was disabled on a 1Gbps link, ignoring the
requested link speed. Instead, this change refuses to change anything
when it is asked to configure the link speed at 1Gbps without
auto-negociation, but acts as requested in all the other cases.
IMPORTANT: Previously, the return value from mii_set_media() was
ignored. This patch uses it for its own return value.
Tested: module compiling, NOT tested on real hardware.
Signed-off-by: David Decotigny <decot@google.com>
---
drivers/net/dl2k.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index c445457..1a4856b 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -1211,24 +1211,17 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (cmd->autoneg == AUTONEG_ENABLE) {
if (np->an_enable)
return 0;
- else {
- np->an_enable = 1;
- mii_set_media(dev);
- return 0;
- }
+
+ np->an_enable = 1;
} else {
- np->an_enable = 0;
- if (np->speed == 1000) {
- ethtool_cmd_speed_set(cmd, SPEED_100);
- cmd->duplex = DUPLEX_FULL;
- printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n");
- }
switch (ethtool_cmd_speed(cmd)) {
case SPEED_10:
+ np->an_enable = 0;
np->speed = 10;
np->full_duplex = (cmd->duplex == DUPLEX_FULL);
break;
case SPEED_100:
+ np->an_enable = 0;
np->speed = 100;
np->full_duplex = (cmd->duplex == DUPLEX_FULL);
break;
@@ -1236,9 +1229,9 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
default:
return -EINVAL;
}
- mii_set_media(dev);
}
- return 0;
+
+ return mii_set_media(dev);
}
static u32 rio_get_link(struct net_device *dev)
--
1.7.3.1
WARNING: multiple messages have this Message-ID (diff)
From: David Decotigny <decot@google.com>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
"David S. Miller" <davem@davemloft.net>,
Joe Perches <joe@perches.com>,
Stanislaw Gruszka <sgruszka@redhat.com>, netdev@vger.kernel.org,
Cc: David Decotigny <decot@google.com>
Subject: [PATCH 2/2] net/dl2k: Don't reconfigure link @100Mbps when disabling autoneg @1Gbps
Date: Mon, 9 May 2011 17:19:08 -0700 [thread overview]
Message-ID: <1304986748-15809-3-git-send-email-decot@google.com> (raw)
In-Reply-To: <1304986748-15809-1-git-send-email-decot@google.com>
The initial version of the driver used to force the link to 100Mbps
when auto-negociation was disabled on a 1Gbps link, ignoring the
requested link speed. Instead, this change refuses to change anything
when it is asked to configure the link speed at 1Gbps without
auto-negociation, but acts as requested in all the other cases.
IMPORTANT: Previously, the return value from mii_set_media() was
ignored. This patch uses it for its own return value.
Tested: module compiling, NOT tested on real hardware.
Signed-off-by: David Decotigny <decot@google.com>
---
drivers/net/dl2k.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index c445457..1a4856b 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -1211,24 +1211,17 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (cmd->autoneg == AUTONEG_ENABLE) {
if (np->an_enable)
return 0;
- else {
- np->an_enable = 1;
- mii_set_media(dev);
- return 0;
- }
+
+ np->an_enable = 1;
} else {
- np->an_enable = 0;
- if (np->speed == 1000) {
- ethtool_cmd_speed_set(cmd, SPEED_100);
- cmd->duplex = DUPLEX_FULL;
- printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n");
- }
switch (ethtool_cmd_speed(cmd)) {
case SPEED_10:
+ np->an_enable = 0;
np->speed = 10;
np->full_duplex = (cmd->duplex == DUPLEX_FULL);
break;
case SPEED_100:
+ np->an_enable = 0;
np->speed = 100;
np->full_duplex = (cmd->duplex == DUPLEX_FULL);
break;
@@ -1236,9 +1229,9 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
default:
return -EINVAL;
}
- mii_set_media(dev);
}
- return 0;
+
+ return mii_set_media(dev);
}
static u32 rio_get_link(struct net_device *dev)
--
1.7.3.1
next prev parent reply other threads:[~2011-05-10 0:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-10 0:19 [PATCH 0/2] Minor autonegociation changes, testers welcome David Decotigny
2011-05-10 0:19 ` David Decotigny
2011-05-10 0:19 ` [PATCH 1/2] net/stmmac: don't go through ethtool to start autonegociation David Decotigny
2011-05-10 0:19 ` David Decotigny
2011-05-10 13:47 ` Giuseppe CAVALLARO
2011-05-13 6:31 ` Giuseppe CAVALLARO
2011-05-10 0:19 ` David Decotigny [this message]
2011-05-10 0:19 ` [PATCH 2/2] net/dl2k: Don't reconfigure link @100Mbps when disabling autoneg @1Gbps David Decotigny
2011-05-10 18:55 ` Ben Hutchings
2011-05-10 22:14 ` David Decotigny
2011-05-11 9:47 ` Florian Weimer
2011-05-13 15:54 ` dl2k/stmmac patches (was Re: [PATCH 2/2] net/dl2k: Don't reconfigure link @100Mbps when disabling autoneg @1Gbps) David Decotigny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1304986748-15809-3-git-send-email-decot@google.com \
--to=decot@google.com \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=sgruszka@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.