From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: "Garzik, Jeff" <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org, akpm@osdl.org, "Brandeburg,
Jesse" <jesse.brandeburg@intel.com>,
"Kok, Auke" <auke-jan.h.kok@intel.com>,
"Kok, Auke" <auke@foo-projects.org>,
"Ronciak, John" <john.ronciak@intel.com>
Subject: [PATCH 06/13] e1000: explicit locking for two ethtool path functions
Date: Wed, 16 Aug 2006 14:56:28 -0700 [thread overview]
Message-ID: <20060816215628.27080.36223.stgit@gitlost.site> (raw)
In-Reply-To: <20060816215336.27080.56147.stgit@gitlost.site>
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@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000/e1000_ethtool.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 8edbc6b..2baccf8 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/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
--
Auke Kok <auke-jan.h.kok@intel.com>
next prev parent reply other threads:[~2006-08-16 21:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-16 21:53 [PATCH 00/13] e100, e1000, ixgb fixes Kok, Auke
2006-08-16 21:56 ` [PATCH 01/13] e100: Fix MDIO/MDIO-X Kok, Auke
2006-08-16 21:56 ` [PATCH 02/13] e100: increment version to 3.5.10-k4 Kok, Auke
2006-08-16 21:56 ` [PATCH 03/13] e1000: Same cosmetic fix as earlier sent out for IPV4 Kok, Auke
2006-08-16 21:56 ` [PATCH 04/13] e1000: Remove 0x1000 as supported device Kok, Auke
2006-08-16 21:56 ` [PATCH 05/13] e1000: Explicitly power up the PHY during loopback testing Kok, Auke
2006-08-16 21:56 ` Kok, Auke [this message]
2006-08-16 21:56 ` [PATCH 07/13] e1000: Allow NVM to setup LPLU for IGP2 and IGP3 Kok, Auke
2006-08-16 21:56 ` [PATCH 08/13] e1000: Force full DMA clocking for 10/100 speed Kok, Auke
2006-08-16 21:56 ` [PATCH 09/13] e1000: Disable aggressive clocking on esb2 with SERDES port Kok, Auke
2006-08-16 21:56 ` [PATCH 10/13] e1000: Increment driver version to 7.1.9-k6 Kok, Auke
2006-08-16 21:56 ` [PATCH 11/13] ixgb: Add CX4 PHY type detection and subdevice ID Kok, Auke
2006-08-16 21:56 ` [PATCH 12/13] ixgb: fix cache miss due to miscalculation Kok, Auke
2006-08-16 21:56 ` [PATCH 13/13] ixgb: Increment version to 1.0.109-k4 Kok, Auke
2006-08-24 4:47 ` [PATCH 00/13] e100, e1000, ixgb fixes Jeff Garzik
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=20060816215628.27080.36223.stgit@gitlost.site \
--to=auke-jan.h.kok@intel.com \
--cc=akpm@osdl.org \
--cc=auke@foo-projects.org \
--cc=jesse.brandeburg@intel.com \
--cc=jgarzik@pobox.com \
--cc=john.ronciak@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).