diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2008-03-21 14:06:52 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-03-26 00:17:51 -0400 |
commit | 74ef9c39db952355ed379f28b8907bae8ff1abe9 (patch) | |
tree | 386ac9ecf02bad980375da72472e62696f1ca6c2 | |
parent | 67d204a532c6fa76041440069e1b00d5b0b8d42c (diff) |
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: 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>
-rw-r--r-- | drivers/net/e1000e/e1000.h | 3 | ||||
-rw-r--r-- | 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 6e0c6edd4362..4bf0c6c045c0 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -167,9 +167,6 @@ struct e1000_adapter { | |||
167 | 167 | ||
168 | spinlock_t tx_queue_lock; /* prevent concurrent tail updates */ | 168 | spinlock_t tx_queue_lock; /* prevent concurrent tail updates */ |
169 | 169 | ||
170 | /* this is still needed for 82571 and above */ | ||
171 | atomic_t irq_sem; | ||
172 | |||
173 | /* track device up/down/testing state */ | 170 | /* track device up/down/testing state */ |
174 | unsigned long state; | 171 | unsigned long state; |
175 | 172 | ||
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index fc5c63f4f578..f501dd5e7b16 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) | |||
836 | struct e1000_hw *hw = &adapter->hw; | 836 | struct e1000_hw *hw = &adapter->hw; |
837 | u32 icr = er32(ICR); | 837 | u32 icr = er32(ICR); |
838 | 838 | ||
839 | /* read ICR disables interrupts using IAM, so keep up with our | 839 | /* read ICR disables interrupts using IAM */ |
840 | * enable/disable accounting */ | ||
841 | atomic_inc(&adapter->irq_sem); | ||
842 | 840 | ||
843 | if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { | 841 | if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { |
844 | hw->mac.get_link_status = 1; | 842 | hw->mac.get_link_status = 1; |
@@ -868,8 +866,6 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) | |||
868 | adapter->total_rx_bytes = 0; | 866 | adapter->total_rx_bytes = 0; |
869 | adapter->total_rx_packets = 0; | 867 | adapter->total_rx_packets = 0; |
870 | __netif_rx_schedule(netdev, &adapter->napi); | 868 | __netif_rx_schedule(netdev, &adapter->napi); |
871 | } else { | ||
872 | atomic_dec(&adapter->irq_sem); | ||
873 | } | 869 | } |
874 | 870 | ||
875 | return IRQ_HANDLED; | 871 | return IRQ_HANDLED; |
@@ -895,11 +891,8 @@ static irqreturn_t e1000_intr(int irq, void *data) | |||
895 | if (!(icr & E1000_ICR_INT_ASSERTED)) | 891 | if (!(icr & E1000_ICR_INT_ASSERTED)) |
896 | return IRQ_NONE; | 892 | return IRQ_NONE; |
897 | 893 | ||
898 | /* Interrupt Auto-Mask...upon reading ICR, | 894 | /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No |
899 | * interrupts are masked. No need for the | 895 | * need for the IMC write */ |
900 | * IMC write, but it does mean we should | ||
901 | * account for it ASAP. */ | ||
902 | atomic_inc(&adapter->irq_sem); | ||
903 | 896 | ||
904 | if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { | 897 | if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { |
905 | hw->mac.get_link_status = 1; | 898 | hw->mac.get_link_status = 1; |
@@ -931,8 +924,6 @@ static irqreturn_t e1000_intr(int irq, void *data) | |||
931 | adapter->total_rx_bytes = 0; | 924 | adapter->total_rx_bytes = 0; |
932 | adapter->total_rx_packets = 0; | 925 | adapter->total_rx_packets = 0; |
933 | __netif_rx_schedule(netdev, &adapter->napi); | 926 | __netif_rx_schedule(netdev, &adapter->napi); |
934 | } else { | ||
935 | atomic_dec(&adapter->irq_sem); | ||
936 | } | 927 | } |
937 | 928 | ||
938 | return IRQ_HANDLED; | 929 | return IRQ_HANDLED; |
@@ -983,7 +974,6 @@ static void e1000_irq_disable(struct e1000_adapter *adapter) | |||
983 | { | 974 | { |
984 | struct e1000_hw *hw = &adapter->hw; | 975 | struct e1000_hw *hw = &adapter->hw; |
985 | 976 | ||
986 | atomic_inc(&adapter->irq_sem); | ||
987 | ew32(IMC, ~0); | 977 | ew32(IMC, ~0); |
988 | e1e_flush(); | 978 | e1e_flush(); |
989 | synchronize_irq(adapter->pdev->irq); | 979 | synchronize_irq(adapter->pdev->irq); |
@@ -996,10 +986,8 @@ static void e1000_irq_enable(struct e1000_adapter *adapter) | |||
996 | { | 986 | { |
997 | struct e1000_hw *hw = &adapter->hw; | 987 | struct e1000_hw *hw = &adapter->hw; |
998 | 988 | ||
999 | if (atomic_dec_and_test(&adapter->irq_sem)) { | 989 | ew32(IMS, IMS_ENABLE_MASK); |
1000 | ew32(IMS, IMS_ENABLE_MASK); | 990 | e1e_flush(); |
1001 | e1e_flush(); | ||
1002 | } | ||
1003 | } | 991 | } |
1004 | 992 | ||
1005 | /** | 993 | /** |
@@ -1427,9 +1415,12 @@ static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) | |||
1427 | struct e1000_hw *hw = &adapter->hw; | 1415 | struct e1000_hw *hw = &adapter->hw; |
1428 | u32 vfta, index; | 1416 | u32 vfta, index; |
1429 | 1417 | ||
1430 | e1000_irq_disable(adapter); | 1418 | if (!test_bit(__E1000_DOWN, &adapter->state)) |
1419 | e1000_irq_disable(adapter); | ||
1431 | vlan_group_set_device(adapter->vlgrp, vid, NULL); | 1420 | vlan_group_set_device(adapter->vlgrp, vid, NULL); |
1432 | e1000_irq_enable(adapter); | 1421 | |
1422 | if (!test_bit(__E1000_DOWN, &adapter->state)) | ||
1423 | e1000_irq_enable(adapter); | ||
1433 | 1424 | ||
1434 | if ((adapter->hw.mng_cookie.status & | 1425 | if ((adapter->hw.mng_cookie.status & |
1435 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN) && | 1426 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN) && |
@@ -1480,7 +1471,8 @@ static void e1000_vlan_rx_register(struct net_device *netdev, | |||
1480 | struct e1000_hw *hw = &adapter->hw; | 1471 | struct e1000_hw *hw = &adapter->hw; |
1481 | u32 ctrl, rctl; | 1472 | u32 ctrl, rctl; |
1482 | 1473 | ||
1483 | e1000_irq_disable(adapter); | 1474 | if (!test_bit(__E1000_DOWN, &adapter->state)) |
1475 | e1000_irq_disable(adapter); | ||
1484 | adapter->vlgrp = grp; | 1476 | adapter->vlgrp = grp; |
1485 | 1477 | ||
1486 | if (grp) { | 1478 | if (grp) { |
@@ -1517,7 +1509,8 @@ static void e1000_vlan_rx_register(struct net_device *netdev, | |||
1517 | } | 1509 | } |
1518 | } | 1510 | } |
1519 | 1511 | ||
1520 | e1000_irq_enable(adapter); | 1512 | if (!test_bit(__E1000_DOWN, &adapter->state)) |
1513 | e1000_irq_enable(adapter); | ||
1521 | } | 1514 | } |
1522 | 1515 | ||
1523 | static void e1000_restore_vlan(struct e1000_adapter *adapter) | 1516 | static void e1000_restore_vlan(struct e1000_adapter *adapter) |
@@ -2167,7 +2160,6 @@ void e1000e_down(struct e1000_adapter *adapter) | |||
2167 | msleep(10); | 2160 | msleep(10); |
2168 | 2161 | ||
2169 | napi_disable(&adapter->napi); | 2162 | napi_disable(&adapter->napi); |
2170 | atomic_set(&adapter->irq_sem, 0); | ||
2171 | e1000_irq_disable(adapter); | 2163 | e1000_irq_disable(adapter); |
2172 | 2164 | ||
2173 | del_timer_sync(&adapter->watchdog_timer); | 2165 | del_timer_sync(&adapter->watchdog_timer); |
@@ -2227,7 +2219,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter) | |||
2227 | spin_lock_init(&adapter->tx_queue_lock); | 2219 | spin_lock_init(&adapter->tx_queue_lock); |
2228 | 2220 | ||
2229 | /* Explicitly disable IRQ since the NIC can be in any state. */ | 2221 | /* Explicitly disable IRQ since the NIC can be in any state. */ |
2230 | atomic_set(&adapter->irq_sem, 0); | ||
2231 | e1000_irq_disable(adapter); | 2222 | e1000_irq_disable(adapter); |
2232 | 2223 | ||
2233 | spin_lock_init(&adapter->stats_lock); | 2224 | spin_lock_init(&adapter->stats_lock); |