lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1304986748-15809-3-git-send-email-decot@google.com>
Date:	Mon,  9 May 2011 17:19:08 -0700
From:	David Decotigny <decot@...gle.com>
To:	Giuseppe Cavallaro <peppe.cavallaro@...com>,
	"David S. Miller" <davem@...emloft.net>,
	Joe Perches <joe@...ches.com>,
	Stanislaw Gruszka <sgruszka@...hat.com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	David Decotigny <decot@...gle.com>
Subject: [PATCH 2/2] net/dl2k: Don't reconfigure link @100Mbps when disabling autoneg @1Gbps

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@...gle.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ