diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2008-03-21 14:06:58 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-03-26 00:17:52 -0400 |
commit | 9150b76a6439b60e678ccb6376ee3686a2f76767 (patch) | |
tree | dbef93cb3dd8668a805536dde9e354e2d4970d6d | |
parent | 74ef9c39db952355ed379f28b8907bae8ff1abe9 (diff) |
e1000: remove irq_sem
irq_sem was just a hack to prevent interrupts from being enabled
unexpectedly in deep call paths. Simply finding those call paths and
fixing them by hand results in a driver that behaves as we expect and
doesn't need the atomic at all.
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/e1000/e1000.h | 1 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 41 |
2 files changed, 15 insertions, 27 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index d73a6c1fbcff..a05aa51ecfa6 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h | |||
@@ -249,7 +249,6 @@ struct e1000_adapter { | |||
249 | #ifdef CONFIG_E1000_NAPI | 249 | #ifdef CONFIG_E1000_NAPI |
250 | spinlock_t tx_queue_lock; | 250 | spinlock_t tx_queue_lock; |
251 | #endif | 251 | #endif |
252 | atomic_t irq_sem; | ||
253 | unsigned int total_tx_bytes; | 252 | unsigned int total_tx_bytes; |
254 | unsigned int total_tx_packets; | 253 | unsigned int total_tx_packets; |
255 | unsigned int total_rx_bytes; | 254 | unsigned int total_rx_bytes; |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 37c46558e1c7..757d02f443a5 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -347,7 +347,6 @@ static void e1000_free_irq(struct e1000_adapter *adapter) | |||
347 | static void | 347 | static void |
348 | e1000_irq_disable(struct e1000_adapter *adapter) | 348 | e1000_irq_disable(struct e1000_adapter *adapter) |
349 | { | 349 | { |
350 | atomic_inc(&adapter->irq_sem); | ||
351 | E1000_WRITE_REG(&adapter->hw, IMC, ~0); | 350 | E1000_WRITE_REG(&adapter->hw, IMC, ~0); |
352 | E1000_WRITE_FLUSH(&adapter->hw); | 351 | E1000_WRITE_FLUSH(&adapter->hw); |
353 | synchronize_irq(adapter->pdev->irq); | 352 | synchronize_irq(adapter->pdev->irq); |
@@ -361,10 +360,8 @@ e1000_irq_disable(struct e1000_adapter *adapter) | |||
361 | static void | 360 | static void |
362 | e1000_irq_enable(struct e1000_adapter *adapter) | 361 | e1000_irq_enable(struct e1000_adapter *adapter) |
363 | { | 362 | { |
364 | if (likely(atomic_dec_and_test(&adapter->irq_sem))) { | 363 | E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK); |
365 | E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK); | 364 | E1000_WRITE_FLUSH(&adapter->hw); |
366 | E1000_WRITE_FLUSH(&adapter->hw); | ||
367 | } | ||
368 | } | 365 | } |
369 | 366 | ||
370 | static void | 367 | static void |
@@ -638,7 +635,6 @@ e1000_down(struct e1000_adapter *adapter) | |||
638 | 635 | ||
639 | #ifdef CONFIG_E1000_NAPI | 636 | #ifdef CONFIG_E1000_NAPI |
640 | napi_disable(&adapter->napi); | 637 | napi_disable(&adapter->napi); |
641 | atomic_set(&adapter->irq_sem, 0); | ||
642 | #endif | 638 | #endif |
643 | e1000_irq_disable(adapter); | 639 | e1000_irq_disable(adapter); |
644 | 640 | ||
@@ -1396,7 +1392,6 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
1396 | #endif | 1392 | #endif |
1397 | 1393 | ||
1398 | /* Explicitly disable IRQ since the NIC can be in any state. */ | 1394 | /* Explicitly disable IRQ since the NIC can be in any state. */ |
1399 | atomic_set(&adapter->irq_sem, 0); | ||
1400 | e1000_irq_disable(adapter); | 1395 | e1000_irq_disable(adapter); |
1401 | 1396 | ||
1402 | spin_lock_init(&adapter->stats_lock); | 1397 | spin_lock_init(&adapter->stats_lock); |
@@ -3836,11 +3831,8 @@ e1000_intr_msi(int irq, void *data) | |||
3836 | #endif | 3831 | #endif |
3837 | uint32_t icr = E1000_READ_REG(hw, ICR); | 3832 | uint32_t icr = E1000_READ_REG(hw, ICR); |
3838 | 3833 | ||
3839 | #ifdef CONFIG_E1000_NAPI | 3834 | /* in NAPI mode read ICR disables interrupts using IAM */ |
3840 | /* read ICR disables interrupts using IAM, so keep up with our | 3835 | |
3841 | * enable/disable accounting */ | ||
3842 | atomic_inc(&adapter->irq_sem); | ||
3843 | #endif | ||
3844 | if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { | 3836 | if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { |
3845 | hw->get_link_status = 1; | 3837 | hw->get_link_status = 1; |
3846 | /* 80003ES2LAN workaround-- For packet buffer work-around on | 3838 | /* 80003ES2LAN workaround-- For packet buffer work-around on |
@@ -3910,12 +3902,8 @@ e1000_intr(int irq, void *data) | |||
3910 | !(icr & E1000_ICR_INT_ASSERTED))) | 3902 | !(icr & E1000_ICR_INT_ASSERTED))) |
3911 | return IRQ_NONE; | 3903 | return IRQ_NONE; |
3912 | 3904 | ||
3913 | /* Interrupt Auto-Mask...upon reading ICR, | 3905 | /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No |
3914 | * interrupts are masked. No need for the | 3906 | * need for the IMC write */ |
3915 | * IMC write, but it does mean we should | ||
3916 | * account for it ASAP. */ | ||
3917 | if (likely(hw->mac_type >= e1000_82571)) | ||
3918 | atomic_inc(&adapter->irq_sem); | ||
3919 | #endif | 3907 | #endif |
3920 | 3908 | ||
3921 | if (unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) { | 3909 | if (unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) { |
@@ -3939,7 +3927,6 @@ e1000_intr(int irq, void *data) | |||
3939 | #ifdef CONFIG_E1000_NAPI | 3927 | #ifdef CONFIG_E1000_NAPI |
3940 | if (unlikely(hw->mac_type < e1000_82571)) { | 3928 | if (unlikely(hw->mac_type < e1000_82571)) { |
3941 | /* disable interrupts, without the synchronize_irq bit */ | 3929 | /* disable interrupts, without the synchronize_irq bit */ |
3942 | atomic_inc(&adapter->irq_sem); | ||
3943 | E1000_WRITE_REG(hw, IMC, ~0); | 3930 | E1000_WRITE_REG(hw, IMC, ~0); |
3944 | E1000_WRITE_FLUSH(hw); | 3931 | E1000_WRITE_FLUSH(hw); |
3945 | } | 3932 | } |
@@ -3964,10 +3951,8 @@ e1000_intr(int irq, void *data) | |||
3964 | * in dead lock. Writing IMC forces 82547 into | 3951 | * in dead lock. Writing IMC forces 82547 into |
3965 | * de-assertion state. | 3952 | * de-assertion state. |
3966 | */ | 3953 | */ |
3967 | if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) { | 3954 | if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) |
3968 | atomic_inc(&adapter->irq_sem); | ||
3969 | E1000_WRITE_REG(hw, IMC, ~0); | 3955 | E1000_WRITE_REG(hw, IMC, ~0); |
3970 | } | ||
3971 | 3956 | ||
3972 | adapter->total_tx_bytes = 0; | 3957 | adapter->total_tx_bytes = 0; |
3973 | adapter->total_rx_bytes = 0; | 3958 | adapter->total_rx_bytes = 0; |
@@ -5001,7 +4986,8 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | |||
5001 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4986 | struct e1000_adapter *adapter = netdev_priv(netdev); |
5002 | uint32_t ctrl, rctl; | 4987 | uint32_t ctrl, rctl; |
5003 | 4988 | ||
5004 | e1000_irq_disable(adapter); | 4989 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
4990 | e1000_irq_disable(adapter); | ||
5005 | adapter->vlgrp = grp; | 4991 | adapter->vlgrp = grp; |
5006 | 4992 | ||
5007 | if (grp) { | 4993 | if (grp) { |
@@ -5038,7 +5024,8 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | |||
5038 | } | 5024 | } |
5039 | } | 5025 | } |
5040 | 5026 | ||
5041 | e1000_irq_enable(adapter); | 5027 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
5028 | e1000_irq_enable(adapter); | ||
5042 | } | 5029 | } |
5043 | 5030 | ||
5044 | static void | 5031 | static void |
@@ -5064,9 +5051,11 @@ e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid) | |||
5064 | struct e1000_adapter *adapter = netdev_priv(netdev); | 5051 | struct e1000_adapter *adapter = netdev_priv(netdev); |
5065 | uint32_t vfta, index; | 5052 | uint32_t vfta, index; |
5066 | 5053 | ||
5067 | e1000_irq_disable(adapter); | 5054 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
5055 | e1000_irq_disable(adapter); | ||
5068 | vlan_group_set_device(adapter->vlgrp, vid, NULL); | 5056 | vlan_group_set_device(adapter->vlgrp, vid, NULL); |
5069 | e1000_irq_enable(adapter); | 5057 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
5058 | e1000_irq_enable(adapter); | ||
5070 | 5059 | ||
5071 | if ((adapter->hw.mng_cookie.status & | 5060 | if ((adapter->hw.mng_cookie.status & |
5072 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && | 5061 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && |