e1000e: remove irq_sem
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Fri, 21 Mar 2008 18:06:52 +0000 (11:06 -0700)
committerJeff Garzik <jeff@garzik.org>
Wed, 26 Mar 2008 04:17:51 +0000 (00:17 -0400)
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>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/e1000e/e1000.h
drivers/net/e1000e/netdev.c

index 6e0c6edd4362c5c27108da082b68a70b4e6a1646..4bf0c6c045c0a0913206edf09781d70518cf7d21 100644 (file)
@@ -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;
 
index fc5c63f4f5788d8de908e1c72d167a0f96bc6938..f501dd5e7b166cba76d3762c8ccd9b888ce164ae 100644 (file)
@@ -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);