From: Auke Kok <auke-jan.h.kok@intel.com>
To: jeff@garzik.org
Cc: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org
Subject: [PATCH 6/9] e1000e: remove irq_sem
Date: Fri, 21 Mar 2008 11:06:52 -0700 [thread overview]
Message-ID: <20080321180652.24164.86255.stgit@localhost.localdomain> (raw)
In-Reply-To: <20080321180625.24164.46137.stgit@localhost.localdomain>
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
irq_sem can safely be removed by auditing all irq.*able sites to
make sure that interrupts don't get enabled unexpectedly when the
interface is down.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000e/e1000.h | 3 ---
drivers/net/e1000e/netdev.c | 37 ++++++++++++++-----------------------
2 files changed, 14 insertions(+), 26 deletions(-)
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index 6e0c6ed..4bf0c6c 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -167,9 +167,6 @@ struct e1000_adapter {
spinlock_t tx_queue_lock; /* prevent concurrent tail updates */
- /* this is still needed for 82571 and above */
- atomic_t irq_sem;
-
/* track device up/down/testing state */
unsigned long state;
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index fc5c63f..f501dd5 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -836,9 +836,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
struct e1000_hw *hw = &adapter->hw;
u32 icr = er32(ICR);
- /* read ICR disables interrupts using IAM, so keep up with our
- * enable/disable accounting */
- atomic_inc(&adapter->irq_sem);
+ /* read ICR disables interrupts using IAM */
if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
hw->mac.get_link_status = 1;
@@ -868,8 +866,6 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
adapter->total_rx_bytes = 0;
adapter->total_rx_packets = 0;
__netif_rx_schedule(netdev, &adapter->napi);
- } else {
- atomic_dec(&adapter->irq_sem);
}
return IRQ_HANDLED;
@@ -895,11 +891,8 @@ static irqreturn_t e1000_intr(int irq, void *data)
if (!(icr & E1000_ICR_INT_ASSERTED))
return IRQ_NONE;
- /* Interrupt Auto-Mask...upon reading ICR,
- * interrupts are masked. No need for the
- * IMC write, but it does mean we should
- * account for it ASAP. */
- atomic_inc(&adapter->irq_sem);
+ /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No
+ * need for the IMC write */
if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
hw->mac.get_link_status = 1;
@@ -931,8 +924,6 @@ static irqreturn_t e1000_intr(int irq, void *data)
adapter->total_rx_bytes = 0;
adapter->total_rx_packets = 0;
__netif_rx_schedule(netdev, &adapter->napi);
- } else {
- atomic_dec(&adapter->irq_sem);
}
return IRQ_HANDLED;
@@ -983,7 +974,6 @@ static void e1000_irq_disable(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
- atomic_inc(&adapter->irq_sem);
ew32(IMC, ~0);
e1e_flush();
synchronize_irq(adapter->pdev->irq);
@@ -996,10 +986,8 @@ static void e1000_irq_enable(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
- if (atomic_dec_and_test(&adapter->irq_sem)) {
- ew32(IMS, IMS_ENABLE_MASK);
- e1e_flush();
- }
+ ew32(IMS, IMS_ENABLE_MASK);
+ e1e_flush();
}
/**
@@ -1427,9 +1415,12 @@ static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
struct e1000_hw *hw = &adapter->hw;
u32 vfta, index;
- e1000_irq_disable(adapter);
+ if (!test_bit(__E1000_DOWN, &adapter->state))
+ e1000_irq_disable(adapter);
vlan_group_set_device(adapter->vlgrp, vid, NULL);
- e1000_irq_enable(adapter);
+
+ if (!test_bit(__E1000_DOWN, &adapter->state))
+ e1000_irq_enable(adapter);
if ((adapter->hw.mng_cookie.status &
E1000_MNG_DHCP_COOKIE_STATUS_VLAN) &&
@@ -1480,7 +1471,8 @@ static void e1000_vlan_rx_register(struct net_device *netdev,
struct e1000_hw *hw = &adapter->hw;
u32 ctrl, rctl;
- e1000_irq_disable(adapter);
+ if (!test_bit(__E1000_DOWN, &adapter->state))
+ e1000_irq_disable(adapter);
adapter->vlgrp = grp;
if (grp) {
@@ -1517,7 +1509,8 @@ static void e1000_vlan_rx_register(struct net_device *netdev,
}
}
- e1000_irq_enable(adapter);
+ if (!test_bit(__E1000_DOWN, &adapter->state))
+ e1000_irq_enable(adapter);
}
static void e1000_restore_vlan(struct e1000_adapter *adapter)
@@ -2167,7 +2160,6 @@ void e1000e_down(struct e1000_adapter *adapter)
msleep(10);
napi_disable(&adapter->napi);
- atomic_set(&adapter->irq_sem, 0);
e1000_irq_disable(adapter);
del_timer_sync(&adapter->watchdog_timer);
@@ -2227,7 +2219,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
spin_lock_init(&adapter->tx_queue_lock);
/* Explicitly disable IRQ since the NIC can be in any state. */
- atomic_set(&adapter->irq_sem, 0);
e1000_irq_disable(adapter);
spin_lock_init(&adapter->stats_lock);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-03-21 18:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-21 18:06 [PATCH 1/9] e1000: Convert boolean_t to bool Auke Kok
2008-03-21 18:06 ` [PATCH 2/9] ixgb: add explicit state checking Auke Kok
2008-03-21 18:06 ` [PATCH 3/9] ixgb: convert boolean_t to bool Auke Kok
2008-03-21 18:06 ` [PATCH 4/9] ixgb: move externs out of .c files Auke Kok
2008-03-21 18:06 ` [PATCH 5/9] e1000e: remove no longer used e1000e_read_nvm_spi Auke Kok
2008-03-21 18:06 ` Auke Kok [this message]
2008-03-21 18:06 ` [PATCH 7/9] e1000: remove irq_sem Auke Kok
2008-03-21 18:07 ` [PATCH 8/9] ixgb: " Auke Kok
2008-03-21 18:07 ` [PATCH 9/9] ixgb: remove unused variable Auke Kok
2008-03-26 4:34 ` [PATCH 1/9] e1000: Convert boolean_t to bool 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=20080321180652.24164.86255.stgit@localhost.localdomain \
--to=auke-jan.h.kok@intel.com \
--cc=e1000-devel@lists.sourceforge.net \
--cc=jeff@garzik.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;
as well as URLs for NNTP newsgroup(s).