3851 irqreturn_t e1000_intr_msi(int irq, void *data) |
3855 irqreturn_t e1000_intr_msi(int irq, void *data) |
3852 { |
3856 { |
3853 struct net_device *netdev = data; |
3857 struct net_device *netdev = data; |
3854 struct e1000_adapter *adapter = netdev_priv(netdev); |
3858 struct e1000_adapter *adapter = netdev_priv(netdev); |
3855 struct e1000_hw *hw = &adapter->hw; |
3859 struct e1000_hw *hw = &adapter->hw; |
3856 #ifndef CONFIG_E1000_NAPI |
|
3857 int i; |
3860 int i; |
3858 #endif |
|
3859 |
|
3860 /* this code avoids the read of ICR but has to get 1000 interrupts |
|
3861 * at every link change event before it will notice the change */ |
|
3862 if (++adapter->detect_link >= 1000) { |
|
3863 uint32_t icr = E1000_READ_REG(hw, ICR); |
|
3864 #ifdef CONFIG_E1000_NAPI |
3861 #ifdef CONFIG_E1000_NAPI |
3865 /* read ICR disables interrupts using IAM, so keep up with our |
3862 int ec_work_done = 0; |
3866 * enable/disable accounting */ |
3863 #endif |
3867 atomic_inc(&adapter->irq_sem); |
3864 |
3868 #endif |
3865 if (adapter->ecdev) { |
3869 adapter->detect_link = 0; |
3866 for (i = 0; i < E1000_MAX_INTR; i++) |
3870 if ((icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) && |
3867 #ifdef CONFIG_E1000_NAPI |
3871 (icr & E1000_ICR_INT_ASSERTED)) { |
3868 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring, |
3872 hw->get_link_status = 1; |
3869 &ec_work_done, 100) & |
3873 /* 80003ES2LAN workaround-- |
3870 !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
3874 * For packet buffer work-around on link down event; |
3871 #else |
3875 * disable receives here in the ISR and |
3872 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
3876 * reset adapter in watchdog |
3873 !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
3877 */ |
3874 #endif |
3878 if (netif_carrier_ok(netdev) && |
3875 break; |
3879 (adapter->hw.mac_type == e1000_80003es2lan)) { |
3876 } else { |
3880 /* disable receives */ |
3877 /* this code avoids the read of ICR but has to get 1000 interrupts |
3881 uint32_t rctl = E1000_READ_REG(hw, RCTL); |
3878 * at every link change event before it will notice the change */ |
3882 E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN); |
3879 if (++adapter->detect_link >= 1000) { |
|
3880 uint32_t icr = E1000_READ_REG(hw, ICR); |
|
3881 #ifdef CONFIG_E1000_NAPI |
|
3882 /* read ICR disables interrupts using IAM, so keep up with our |
|
3883 * enable/disable accounting */ |
|
3884 atomic_inc(&adapter->irq_sem); |
|
3885 #endif |
|
3886 adapter->detect_link = 0; |
|
3887 if ((icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) && |
|
3888 (icr & E1000_ICR_INT_ASSERTED)) { |
|
3889 hw->get_link_status = 1; |
|
3890 /* 80003ES2LAN workaround-- |
|
3891 * For packet buffer work-around on link down event; |
|
3892 * disable receives here in the ISR and |
|
3893 * reset adapter in watchdog |
|
3894 */ |
|
3895 if (netif_carrier_ok(netdev) && |
|
3896 (adapter->hw.mac_type == e1000_80003es2lan)) { |
|
3897 /* disable receives */ |
|
3898 uint32_t rctl = E1000_READ_REG(hw, RCTL); |
|
3899 E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN); |
|
3900 } |
|
3901 /* guard against interrupt when we're going down */ |
|
3902 if (!test_bit(__E1000_DOWN, &adapter->flags)) |
|
3903 mod_timer(&adapter->watchdog_timer, |
|
3904 jiffies + 1); |
3883 } |
3905 } |
3884 /* guard against interrupt when we're going down */ |
3906 } else { |
3885 if (!test_bit(__E1000_DOWN, &adapter->flags)) |
3907 E1000_WRITE_REG(hw, ICR, (0xffffffff & ~(E1000_ICR_RXSEQ | |
3886 mod_timer(&adapter->watchdog_timer, |
3908 E1000_ICR_LSC))); |
3887 jiffies + 1); |
3909 /* bummer we have to flush here, but things break otherwise as |
3888 } |
3910 * some event appears to be lost or delayed and throughput |
3889 } else { |
3911 * drops. In almost all tests this flush is un-necessary */ |
3890 E1000_WRITE_REG(hw, ICR, (0xffffffff & ~(E1000_ICR_RXSEQ | |
3912 E1000_WRITE_FLUSH(hw); |
3891 E1000_ICR_LSC))); |
|
3892 /* bummer we have to flush here, but things break otherwise as |
|
3893 * some event appears to be lost or delayed and throughput |
|
3894 * drops. In almost all tests this flush is un-necessary */ |
|
3895 E1000_WRITE_FLUSH(hw); |
|
3896 #ifdef CONFIG_E1000_NAPI |
3913 #ifdef CONFIG_E1000_NAPI |
3897 /* Interrupt Auto-Mask (IAM)...upon writing ICR, interrupts are |
3914 /* Interrupt Auto-Mask (IAM)...upon writing ICR, interrupts are |
3898 * masked. No need for the IMC write, but it does mean we |
3915 * masked. No need for the IMC write, but it does mean we |
3899 * should account for it ASAP. */ |
3916 * should account for it ASAP. */ |
3900 atomic_inc(&adapter->irq_sem); |
3917 atomic_inc(&adapter->irq_sem); |
3901 #endif |
3918 #endif |
3902 } |
3919 } |
3903 |
3920 |
3904 #ifdef CONFIG_E1000_NAPI |
3921 #ifdef CONFIG_E1000_NAPI |
3905 if (likely(netif_rx_schedule_prep(netdev))) { |
3922 if (likely(netif_rx_schedule_prep(netdev))) { |
|
3923 adapter->total_tx_bytes = 0; |
|
3924 adapter->total_tx_packets = 0; |
|
3925 adapter->total_rx_bytes = 0; |
|
3926 adapter->total_rx_packets = 0; |
|
3927 __netif_rx_schedule(netdev); |
|
3928 } else |
|
3929 e1000_irq_enable(adapter); |
|
3930 #else |
3906 adapter->total_tx_bytes = 0; |
3931 adapter->total_tx_bytes = 0; |
|
3932 adapter->total_rx_bytes = 0; |
3907 adapter->total_tx_packets = 0; |
3933 adapter->total_tx_packets = 0; |
3908 adapter->total_rx_bytes = 0; |
|
3909 adapter->total_rx_packets = 0; |
3934 adapter->total_rx_packets = 0; |
3910 __netif_rx_schedule(netdev); |
3935 |
3911 } else |
3936 for (i = 0; i < E1000_MAX_INTR; i++) |
3912 e1000_irq_enable(adapter); |
3937 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
3913 #else |
3938 !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
3914 adapter->total_tx_bytes = 0; |
3939 break; |
3915 adapter->total_rx_bytes = 0; |
3940 |
3916 adapter->total_tx_packets = 0; |
3941 if (likely(adapter->itr_setting & 3)) |
3917 adapter->total_rx_packets = 0; |
3942 e1000_set_itr(adapter); |
3918 |
3943 #endif |
3919 for (i = 0; i < E1000_MAX_INTR; i++) |
3944 } |
3920 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
|
3921 !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
|
3922 break; |
|
3923 |
|
3924 if (likely(adapter->itr_setting & 3)) |
|
3925 e1000_set_itr(adapter); |
|
3926 #endif |
|
3927 |
3945 |
3928 return IRQ_HANDLED; |
3946 return IRQ_HANDLED; |
3929 } |
3947 } |
3930 #endif |
3948 #endif |
3931 |
3949 |
3979 /* guard against interrupt when we're going down */ |
3998 /* guard against interrupt when we're going down */ |
3980 if (!test_bit(__E1000_DOWN, &adapter->flags)) |
3999 if (!test_bit(__E1000_DOWN, &adapter->flags)) |
3981 mod_timer(&adapter->watchdog_timer, jiffies + 1); |
4000 mod_timer(&adapter->watchdog_timer, jiffies + 1); |
3982 } |
4001 } |
3983 |
4002 |
|
4003 if (adapter->ecdev) { |
|
4004 for (i = 0; i < E1000_MAX_INTR; i++) |
3984 #ifdef CONFIG_E1000_NAPI |
4005 #ifdef CONFIG_E1000_NAPI |
3985 if (!adapter->ecdev) { |
4006 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring, |
|
4007 &ec_work_done, 100) & |
|
4008 !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
|
4009 #else |
|
4010 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
|
4011 !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
|
4012 #endif |
|
4013 break; |
|
4014 } else { |
|
4015 #ifdef CONFIG_E1000_NAPI |
3986 if (unlikely(hw->mac_type < e1000_82571)) { |
4016 if (unlikely(hw->mac_type < e1000_82571)) { |
3987 /* disable interrupts, without the synchronize_irq bit */ |
4017 /* disable interrupts, without the synchronize_irq bit */ |
3988 atomic_inc(&adapter->irq_sem); |
4018 atomic_inc(&adapter->irq_sem); |
3989 E1000_WRITE_REG(hw, IMC, ~0); |
4019 E1000_WRITE_REG(hw, IMC, ~0); |
3990 E1000_WRITE_FLUSH(hw); |
4020 E1000_WRITE_FLUSH(hw); |
3997 __netif_rx_schedule(netdev); |
4027 __netif_rx_schedule(netdev); |
3998 } else |
4028 } else |
3999 /* this really should not happen! if it does it is basically a |
4029 /* this really should not happen! if it does it is basically a |
4000 * bug, but not a hard error, so enable ints and continue */ |
4030 * bug, but not a hard error, so enable ints and continue */ |
4001 e1000_irq_enable(adapter); |
4031 e1000_irq_enable(adapter); |
4002 } |
|
4003 #else |
4032 #else |
4004 /* Writing IMC and IMS is needed for 82547. |
4033 /* Writing IMC and IMS is needed for 82547. |
4005 * Due to Hub Link bus being occupied, an interrupt |
4034 * Due to Hub Link bus being occupied, an interrupt |
4006 * de-assertion message is not able to be sent. |
4035 * de-assertion message is not able to be sent. |
4007 * When an interrupt assertion message is generated later, |
4036 * When an interrupt assertion message is generated later, |
4008 * two messages are re-ordered and sent out. |
4037 * two messages are re-ordered and sent out. |
4009 * That causes APIC to think 82547 is in de-assertion |
4038 * That causes APIC to think 82547 is in de-assertion |
4010 * state, while 82547 is in assertion state, resulting |
4039 * state, while 82547 is in assertion state, resulting |
4011 * in dead lock. Writing IMC forces 82547 into |
4040 * in dead lock. Writing IMC forces 82547 into |
4012 * de-assertion state. |
4041 * de-assertion state. |
4013 */ |
4042 */ |
4014 if (!adapter->ecdev && |
4043 if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) { |
4015 (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2)) { |
4044 atomic_inc(&adapter->irq_sem); |
4016 atomic_inc(&adapter->irq_sem); |
4045 E1000_WRITE_REG(hw, IMC, ~0); |
4017 E1000_WRITE_REG(hw, IMC, ~0); |
4046 } |
4018 } |
4047 |
4019 |
4048 adapter->total_tx_bytes = 0; |
4020 adapter->total_tx_bytes = 0; |
4049 adapter->total_rx_bytes = 0; |
4021 adapter->total_rx_bytes = 0; |
4050 adapter->total_tx_packets = 0; |
4022 adapter->total_tx_packets = 0; |
4051 adapter->total_rx_packets = 0; |
4023 adapter->total_rx_packets = 0; |
4052 |
4024 |
4053 for (i = 0; i < E1000_MAX_INTR; i++) |
4025 for (i = 0; i < E1000_MAX_INTR; i++) |
4054 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
4026 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
4055 !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
4027 !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
4056 break; |
4028 break; |
4057 |
4029 |
|
4030 if (!adapter->ecdev) { |
|
4031 if (likely(adapter->itr_setting & 3)) |
4058 if (likely(adapter->itr_setting & 3)) |
4032 e1000_set_itr(adapter); |
4059 e1000_set_itr(adapter); |
4033 |
4060 |
4034 if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) |
4061 if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) |
4035 e1000_irq_enable(adapter); |
4062 e1000_irq_enable(adapter); |
4036 } |
4063 |
4037 |
4064 #endif |
4038 #endif |
4065 } |
4039 return IRQ_HANDLED; |
4066 return IRQ_HANDLED; |
4040 } |
4067 } |
4041 |
4068 |
4042 #ifdef CONFIG_E1000_NAPI |
4069 #ifdef CONFIG_E1000_NAPI |
4043 /** |
4070 /** |