Netdev List
 help / color / mirror / Atom feed
From: Anders Larsen <al@alarsen.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Netdev <netdev@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] pch_gbe: ethtool cannot change parameters when link is down
Date: Sun, 18 Aug 2013 11:54:40 +0200	[thread overview]
Message-ID: <1376819680-15359-1-git-send-email-al@alarsen.net> (raw)

When attempting to change e.g. the advertising mask when the link is down
ecmd->speed is -1 causing mii_ethtool_sset() to bail out.

This bug bit when connecting to a gigabit switch through a 4-pin (industrial)
cable, since link negotiation would not complete (both endpoints claimed to
be gigabit-capable, but this is not possible with only 4 pins).
Any attempt to fix this by setting autonegation to not offer 1000Mbps
failed as the setting would not be accepted while the link was still down...

Set ecmd->speed to SPEED_1000 to satisfy mii_ethtool_sset()
(the actual value of ecmd->speed doesn't matter as long as it is valid,
since a re-negotation is forced afterwards).

Signed-off-by: Anders Larsen <al@alarsen.net>
---
 .../ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c    |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c
index 1129db0..f0ceb89 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c
@@ -118,6 +118,7 @@ static int pch_gbe_set_settings(struct net_device *netdev,
 	 * filled by get_settings() on a down link, speed is -1: */
 	if (speed == UINT_MAX) {
 		speed = SPEED_1000;
+		ethtool_cmd_speed_set(ecmd, speed);
 		ecmd->duplex = DUPLEX_FULL;
 	}
 	ret = mii_ethtool_sset(&adapter->mii, ecmd);
-- 
1.7.0.4

             reply	other threads:[~2013-08-18  9:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-18  9:54 Anders Larsen [this message]
2013-08-20 22:07 ` [PATCH] pch_gbe: ethtool cannot change parameters when link is down David Miller

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=1376819680-15359-1-git-send-email-al@alarsen.net \
    --to=al@alarsen.net \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox