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-next>] [day] [month] [year] [list]
Message-Id: <1298424313-9840-1-git-send-email-prasanna.panchamukhi@riverbed.com>
Date:	Tue, 22 Feb 2011 17:25:13 -0800
From:	prasanna.panchamukhi@...erbed.com
To:	bruce.w.allan@...el.com, jeffrey.t.kirsher@...el.com,
	jeffrey.e.pieper@...el.com
Cc:	e1000-devel@...ts.sourceforge.net, netdev@...r.kernel.org,
	prasanna.panchamukhi@...erbed.com
Subject: [PATCH] e1000: power off PHY after reset when interface is down

From: Prasanna S. Panchamukhi <prasanna.panchamukhi@...erbed.com>

Some Phys supported by the e1000 driver do not remain powered off across
a reset of the device when the interface is down, e.g. on 82546.
This patch powers down (only when WoL is disabled) the PHY after reset if
the interface is down and ethtool diagnostics are not currently running.

Similar problem was see on 82571 controller and was fixed in e1000e driver
by Bruce Allan.
Please refer commit 31dbe5b4ac6fca72dec946e4d0fa7f0913f1d9b1 for details.

Signed-off-by: Prasanna S. Panchamukhi <prasanna.panchamukhi@...erbed.com>
---
 drivers/net/e1000/e1000_ethtool.c |   27 +++++++++++++++++++--------
 drivers/net/e1000/e1000_main.c    |    7 +++++++
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index f4d0922..d3f18f5 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1554,6 +1554,15 @@ static void e1000_diag_test(struct net_device *netdev,
 	bool if_running = netif_running(netdev);
 
 	set_bit(__E1000_TESTING, &adapter->flags);
+
+	if (!if_running) {
+		e1000_power_up_phy(adapter);
+
+		adapter->hw.wait_autoneg_complete = 1;
+		e1000_reset(adapter);
+		adapter->hw.wait_autoneg_complete = 0;
+	}
+
 	if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
 		/* Offline tests */
 
@@ -1572,8 +1581,6 @@ static void e1000_diag_test(struct net_device *netdev,
 		if (if_running)
 			/* indicate we're in test mode */
 			dev_close(netdev);
-		else
-			e1000_reset(adapter);
 
 		if (e1000_reg_test(adapter, &data[0]))
 			eth_test->flags |= ETH_TEST_FL_FAILED;
@@ -1587,8 +1594,6 @@ static void e1000_diag_test(struct net_device *netdev,
 			eth_test->flags |= ETH_TEST_FL_FAILED;
 
 		e1000_reset(adapter);
-		/* make sure the phy is powered up */
-		e1000_power_up_phy(adapter);
 		if (e1000_loopback_test(adapter, &data[3]))
 			eth_test->flags |= ETH_TEST_FL_FAILED;
 
@@ -1602,19 +1607,25 @@ static void e1000_diag_test(struct net_device *netdev,
 		if (if_running)
 			dev_open(netdev);
 	} else {
-		e_info(hw, "online testing starting\n");
 		/* Online tests */
-		if (e1000_link_test(adapter, &data[4]))
-			eth_test->flags |= ETH_TEST_FL_FAILED;
 
-		/* Online tests aren't run; pass by default */
+		e_info(hw, "online testing starting\n");
+
+		/* register, eeprom, intr and loopback tests not run online */
 		data[0] = 0;
 		data[1] = 0;
 		data[2] = 0;
 		data[3] = 0;
 
+		if (e1000_link_test(adapter, &data[4]))
+			eth_test->flags |= ETH_TEST_FL_FAILED;
+
 		clear_bit(__E1000_TESTING, &adapter->flags);
 	}
+
+	if (!if_running)
+		e1000_reset(adapter);
+
 	msleep_interruptible(4 * 1000);
 }
 
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index bfab140..beec573 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -704,6 +704,13 @@ void e1000_reset(struct e1000_adapter *adapter)
 	ew32(VET, ETHERNET_IEEE_VLAN_TYPE);
 
 	e1000_reset_adaptive(hw);
+
+	if (!netif_running(adapter->netdev) &&
+	    !test_bit(__E1000_TESTING, &adapter->flags)) {
+		e1000_power_down_phy(adapter);
+		return;
+	}
+
 	e1000_phy_get_info(hw, &adapter->phy_info);
 
 	e1000_release_manageability(adapter);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ