+ e1000-explicit-locking-for-two-ethtool-path-functions.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     e1000: explicit locking for two ethtool path functions

has been added to the -mm tree.  Its filename is

     e1000-explicit-locking-for-two-ethtool-path-functions.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: e1000: explicit locking for two ethtool path functions
From: "Kok, Auke" <auke-jan.h.kok@xxxxxxxxx>

Explicitly lock two more ethtool entry points completely instead of the
hardware reset only to prevent a race condition.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@xxxxxxxxx>
Signed-off-by: Auke Kok <auke-jan.h.kok@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/net/e1000/e1000_ethtool.c |   33 +++++++++++++++++++---------
 1 files changed, 23 insertions(+), 10 deletions(-)

diff -puN drivers/net/e1000/e1000_ethtool.c~e1000-explicit-locking-for-two-ethtool-path-functions drivers/net/e1000/e1000_ethtool.c
--- a/drivers/net/e1000/e1000_ethtool.c~e1000-explicit-locking-for-two-ethtool-path-functions
+++ a/drivers/net/e1000/e1000_ethtool.c
@@ -183,6 +183,9 @@ e1000_set_settings(struct net_device *ne
 		return -EINVAL;
 	}
 
+	while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
+		msleep(1);
+
 	if (ecmd->autoneg == AUTONEG_ENABLE) {
 		hw->autoneg = 1;
 		if (hw->media_type == e1000_media_type_fiber)
@@ -199,16 +202,20 @@ e1000_set_settings(struct net_device *ne
 						  ADVERTISED_TP;
 		ecmd->advertising = hw->autoneg_advertised;
 	} else
-		if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex))
+		if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
+			clear_bit(__E1000_RESETTING, &adapter->flags);
 			return -EINVAL;
+		}
 
 	/* reset the link */
 
-	if (netif_running(adapter->netdev))
-		e1000_reinit_locked(adapter);
-	else
+	if (netif_running(adapter->netdev)) {
+		e1000_down(adapter);
+		e1000_up(adapter);
+	} else
 		e1000_reset(adapter);
 
+	clear_bit(__E1000_RESETTING, &adapter->flags);
 	return 0;
 }
 
@@ -238,9 +245,13 @@ e1000_set_pauseparam(struct net_device *
 {
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	struct e1000_hw *hw = &adapter->hw;
+	int retval = 0;
 
 	adapter->fc_autoneg = pause->autoneg;
 
+	while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
+		msleep(1);
+
 	if (pause->rx_pause && pause->tx_pause)
 		hw->fc = e1000_fc_full;
 	else if (pause->rx_pause && !pause->tx_pause)
@@ -253,15 +264,17 @@ e1000_set_pauseparam(struct net_device *
 	hw->original_fc = hw->fc;
 
 	if (adapter->fc_autoneg == AUTONEG_ENABLE) {
-		if (netif_running(adapter->netdev))
-			e1000_reinit_locked(adapter);
-		else
+		if (netif_running(adapter->netdev)) {
+			e1000_down(adapter);
+			e1000_up(adapter);
+		} else
 			e1000_reset(adapter);
 	} else
-		return ((hw->media_type == e1000_media_type_fiber) ?
-			e1000_setup_link(hw) : e1000_force_mac_fc(hw));
+		retval = ((hw->media_type == e1000_media_type_fiber) ?
+			   e1000_setup_link(hw) : e1000_force_mac_fc(hw));
 
-	return 0;
+	clear_bit(__E1000_RESETTING, &adapter->flags);
+	return retval;
 }
 
 static uint32_t
_

Patches currently in -mm which might be from auke-jan.h.kok@xxxxxxxxx are

e100-fix-mdio-mdio-x.patch
e100-increment-version-to-3510-k4.patch
e1000-same-cosmetic-fix-as-earlier-sent-out-for-ipv4.patch
e1000-remove-0x1000-as-supported-device.patch
e1000-explicitly-power-up-the-phy-during-loopback-testing.patch
e1000-explicit-locking-for-two-ethtool-path-functions.patch
e1000-allow-nvm-to-setup-lplu-for-igp2-and-igp3.patch
e1000-force-full-dma-clocking-for-10-100-speed.patch
e1000-disable-aggressive-clocking-on-esb2-with-serdes-port.patch
e1000-increment-driver-version-to-719-k6.patch
ixgb-add-cx4-phy-type-detection-and-subdevice-id.patch
ixgb-fix-cache-miss-due-to-miscalculation.patch
ixgb-increment-version-to-10109-k4.patch
ixgb-add-pci-error-recovery-callbacks.patch
e100-disable-device-on-pci-error.patch
e1000-disable-device-on-pci-error.patch
e1000_7033_dump_ring.patch

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

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux