Commit 74ef9c39 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Jeff Garzik

e1000e: remove irq_sem

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: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: default avatarAuke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 67d204a5
...@@ -167,9 +167,6 @@ struct e1000_adapter { ...@@ -167,9 +167,6 @@ struct e1000_adapter {
spinlock_t tx_queue_lock; /* prevent concurrent tail updates */ 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 */ /* track device up/down/testing state */
unsigned long state; unsigned long state;
......
...@@ -836,9 +836,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) ...@@ -836,9 +836,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 icr = er32(ICR); u32 icr = er32(ICR);
/* read ICR disables interrupts using IAM, so keep up with our /* read ICR disables interrupts using IAM */
* enable/disable accounting */
atomic_inc(&adapter->irq_sem);
if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
hw->mac.get_link_status = 1; hw->mac.get_link_status = 1;
...@@ -868,8 +866,6 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) ...@@ -868,8 +866,6 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
adapter->total_rx_bytes = 0; adapter->total_rx_bytes = 0;
adapter->total_rx_packets = 0; adapter->total_rx_packets = 0;
__netif_rx_schedule(netdev, &adapter->napi); __netif_rx_schedule(netdev, &adapter->napi);
} else {
atomic_dec(&adapter->irq_sem);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -895,11 +891,8 @@ static irqreturn_t e1000_intr(int irq, void *data) ...@@ -895,11 +891,8 @@ static irqreturn_t e1000_intr(int irq, void *data)
if (!(icr & E1000_ICR_INT_ASSERTED)) if (!(icr & E1000_ICR_INT_ASSERTED))
return IRQ_NONE; return IRQ_NONE;
/* Interrupt Auto-Mask...upon reading ICR, /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No
* interrupts are masked. No need for the * need for the IMC write */
* IMC write, but it does mean we should
* account for it ASAP. */
atomic_inc(&adapter->irq_sem);
if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
hw->mac.get_link_status = 1; hw->mac.get_link_status = 1;
...@@ -931,8 +924,6 @@ static irqreturn_t e1000_intr(int irq, void *data) ...@@ -931,8 +924,6 @@ static irqreturn_t e1000_intr(int irq, void *data)
adapter->total_rx_bytes = 0; adapter->total_rx_bytes = 0;
adapter->total_rx_packets = 0; adapter->total_rx_packets = 0;
__netif_rx_schedule(netdev, &adapter->napi); __netif_rx_schedule(netdev, &adapter->napi);
} else {
atomic_dec(&adapter->irq_sem);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -983,7 +974,6 @@ static void e1000_irq_disable(struct e1000_adapter *adapter) ...@@ -983,7 +974,6 @@ static void e1000_irq_disable(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
atomic_inc(&adapter->irq_sem);
ew32(IMC, ~0); ew32(IMC, ~0);
e1e_flush(); e1e_flush();
synchronize_irq(adapter->pdev->irq); synchronize_irq(adapter->pdev->irq);
...@@ -996,10 +986,8 @@ static void e1000_irq_enable(struct e1000_adapter *adapter) ...@@ -996,10 +986,8 @@ static void e1000_irq_enable(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
if (atomic_dec_and_test(&adapter->irq_sem)) {
ew32(IMS, IMS_ENABLE_MASK); ew32(IMS, IMS_ENABLE_MASK);
e1e_flush(); e1e_flush();
}
} }
/** /**
...@@ -1427,8 +1415,11 @@ static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) ...@@ -1427,8 +1415,11 @@ static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 vfta, index; u32 vfta, index;
if (!test_bit(__E1000_DOWN, &adapter->state))
e1000_irq_disable(adapter); e1000_irq_disable(adapter);
vlan_group_set_device(adapter->vlgrp, vid, NULL); vlan_group_set_device(adapter->vlgrp, vid, NULL);
if (!test_bit(__E1000_DOWN, &adapter->state))
e1000_irq_enable(adapter); e1000_irq_enable(adapter);
if ((adapter->hw.mng_cookie.status & if ((adapter->hw.mng_cookie.status &
...@@ -1480,6 +1471,7 @@ static void e1000_vlan_rx_register(struct net_device *netdev, ...@@ -1480,6 +1471,7 @@ static void e1000_vlan_rx_register(struct net_device *netdev,
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 ctrl, rctl; u32 ctrl, rctl;
if (!test_bit(__E1000_DOWN, &adapter->state))
e1000_irq_disable(adapter); e1000_irq_disable(adapter);
adapter->vlgrp = grp; adapter->vlgrp = grp;
...@@ -1517,6 +1509,7 @@ static void e1000_vlan_rx_register(struct net_device *netdev, ...@@ -1517,6 +1509,7 @@ static void e1000_vlan_rx_register(struct net_device *netdev,
} }
} }
if (!test_bit(__E1000_DOWN, &adapter->state))
e1000_irq_enable(adapter); e1000_irq_enable(adapter);
} }
...@@ -2167,7 +2160,6 @@ void e1000e_down(struct e1000_adapter *adapter) ...@@ -2167,7 +2160,6 @@ void e1000e_down(struct e1000_adapter *adapter)
msleep(10); msleep(10);
napi_disable(&adapter->napi); napi_disable(&adapter->napi);
atomic_set(&adapter->irq_sem, 0);
e1000_irq_disable(adapter); e1000_irq_disable(adapter);
del_timer_sync(&adapter->watchdog_timer); del_timer_sync(&adapter->watchdog_timer);
...@@ -2227,7 +2219,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter) ...@@ -2227,7 +2219,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
spin_lock_init(&adapter->tx_queue_lock); spin_lock_init(&adapter->tx_queue_lock);
/* Explicitly disable IRQ since the NIC can be in any state. */ /* Explicitly disable IRQ since the NIC can be in any state. */
atomic_set(&adapter->irq_sem, 0);
e1000_irq_disable(adapter); e1000_irq_disable(adapter);
spin_lock_init(&adapter->stats_lock); spin_lock_init(&adapter->stats_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment