diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2011-04-22 00:07:54 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-05-14 21:03:24 -0400 |
commit | 93c52dd0033be3cb91376916b8461fcb94ef0c22 (patch) | |
tree | 1b1daee9686fe407e862d9dfde65d2f269c5d90e /drivers | |
parent | 7086400d87a06588c13270949db9134afc9553ba (diff) |
ixgbe: Merge watchdog functionality into service task
This patch is meant to merge the functionality of the ixgbe watchdog task
into the service task. By doing this all link state functionality will be
controlled by a single task. As a result the reliability of the interface
will be improved as the likelihood of any race conditions is further
reduced.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ixgbe/ixgbe.h | 2 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 364 |
2 files changed, 200 insertions, 166 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index cbb04ba58289..193c6c4243cb 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -455,11 +455,9 @@ struct ixgbe_adapter { | |||
455 | unsigned long link_check_timeout; | 455 | unsigned long link_check_timeout; |
456 | 456 | ||
457 | struct work_struct reset_task; | 457 | struct work_struct reset_task; |
458 | struct work_struct watchdog_task; | ||
459 | struct work_struct fdir_reinit_task; | 458 | struct work_struct fdir_reinit_task; |
460 | struct work_struct check_overtemp_task; | 459 | struct work_struct check_overtemp_task; |
461 | struct work_struct service_task; | 460 | struct work_struct service_task; |
462 | struct timer_list watchdog_timer; | ||
463 | struct timer_list service_timer; | 461 | struct timer_list service_timer; |
464 | u32 fdir_pballoc; | 462 | u32 fdir_pballoc; |
465 | u32 atr_sample_rate; | 463 | u32 atr_sample_rate; |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index a5d4226eee0c..d1e52b5cebfa 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -1900,7 +1900,7 @@ static void ixgbe_check_lsc(struct ixgbe_adapter *adapter) | |||
1900 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) { | 1900 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) { |
1901 | IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_LSC); | 1901 | IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_LSC); |
1902 | IXGBE_WRITE_FLUSH(hw); | 1902 | IXGBE_WRITE_FLUSH(hw); |
1903 | schedule_work(&adapter->watchdog_task); | 1903 | ixgbe_service_event_schedule(adapter); |
1904 | } | 1904 | } |
1905 | } | 1905 | } |
1906 | 1906 | ||
@@ -3940,7 +3940,6 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
3940 | * link up interrupt but shouldn't be a problem */ | 3940 | * link up interrupt but shouldn't be a problem */ |
3941 | adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; | 3941 | adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; |
3942 | adapter->link_check_timeout = jiffies; | 3942 | adapter->link_check_timeout = jiffies; |
3943 | mod_timer(&adapter->watchdog_timer, jiffies); | ||
3944 | mod_timer(&adapter->service_timer, jiffies); | 3943 | mod_timer(&adapter->service_timer, jiffies); |
3945 | 3944 | ||
3946 | /* Set PF Reset Done bit so PF/VF Mail Ops can work */ | 3945 | /* Set PF Reset Done bit so PF/VF Mail Ops can work */ |
@@ -4179,8 +4178,6 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
4179 | 4178 | ||
4180 | netif_tx_stop_all_queues(netdev); | 4179 | netif_tx_stop_all_queues(netdev); |
4181 | 4180 | ||
4182 | del_timer_sync(&adapter->watchdog_timer); | ||
4183 | cancel_work_sync(&adapter->watchdog_task); | ||
4184 | /* call carrier off first to avoid false dev_watchdog timeouts */ | 4181 | /* call carrier off first to avoid false dev_watchdog timeouts */ |
4185 | netif_carrier_off(netdev); | 4182 | netif_carrier_off(netdev); |
4186 | netif_tx_disable(netdev); | 4183 | netif_tx_disable(netdev); |
@@ -5957,23 +5954,54 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
5957 | } | 5954 | } |
5958 | 5955 | ||
5959 | /** | 5956 | /** |
5960 | * ixgbe_watchdog - Timer Call-back | 5957 | * ixgbe_fdir_reinit_task - worker thread to reinit FDIR filter table |
5961 | * @data: pointer to adapter cast into an unsigned long | 5958 | * @work: pointer to work_struct containing our data |
5962 | **/ | 5959 | **/ |
5963 | static void ixgbe_watchdog(unsigned long data) | 5960 | static void ixgbe_fdir_reinit_task(struct work_struct *work) |
5961 | { | ||
5962 | struct ixgbe_adapter *adapter = container_of(work, | ||
5963 | struct ixgbe_adapter, | ||
5964 | fdir_reinit_task); | ||
5965 | struct ixgbe_hw *hw = &adapter->hw; | ||
5966 | int i; | ||
5967 | |||
5968 | if (ixgbe_reinit_fdir_tables_82599(hw) == 0) { | ||
5969 | for (i = 0; i < adapter->num_tx_queues; i++) | ||
5970 | set_bit(__IXGBE_TX_FDIR_INIT_DONE, | ||
5971 | &(adapter->tx_ring[i]->state)); | ||
5972 | } else { | ||
5973 | e_err(probe, "failed to finish FDIR re-initialization, " | ||
5974 | "ignored adding FDIR ATR filters\n"); | ||
5975 | } | ||
5976 | /* Done FDIR Re-initialization, enable transmits */ | ||
5977 | netif_tx_start_all_queues(adapter->netdev); | ||
5978 | } | ||
5979 | |||
5980 | /** | ||
5981 | * ixgbe_check_hang_subtask - check for hung queues and dropped interrupts | ||
5982 | * @adapter - pointer to the device adapter structure | ||
5983 | * | ||
5984 | * This function serves two purposes. First it strobes the interrupt lines | ||
5985 | * in order to make certain interrupts are occuring. Secondly it sets the | ||
5986 | * bits needed to check for TX hangs. As a result we should immediately | ||
5987 | * determine if a hang has occured. | ||
5988 | */ | ||
5989 | static void ixgbe_check_hang_subtask(struct ixgbe_adapter *adapter) | ||
5964 | { | 5990 | { |
5965 | struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)data; | ||
5966 | struct ixgbe_hw *hw = &adapter->hw; | 5991 | struct ixgbe_hw *hw = &adapter->hw; |
5967 | u64 eics = 0; | 5992 | u64 eics = 0; |
5968 | int i; | 5993 | int i; |
5969 | 5994 | ||
5970 | /* | 5995 | /* If we're down or resetting, just bail */ |
5971 | * Do the watchdog outside of interrupt context due to the lovely | 5996 | if (test_bit(__IXGBE_DOWN, &adapter->state) || |
5972 | * delays that some of the newer hardware requires | 5997 | test_bit(__IXGBE_RESETTING, &adapter->state)) |
5973 | */ | 5998 | return; |
5974 | 5999 | ||
5975 | if (test_bit(__IXGBE_DOWN, &adapter->state)) | 6000 | /* Force detection of hung controller */ |
5976 | goto watchdog_short_circuit; | 6001 | if (netif_carrier_ok(adapter->netdev)) { |
6002 | for (i = 0; i < adapter->num_tx_queues; i++) | ||
6003 | set_check_for_tx_hang(adapter->tx_ring[i]); | ||
6004 | } | ||
5977 | 6005 | ||
5978 | if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { | 6006 | if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { |
5979 | /* | 6007 | /* |
@@ -5983,179 +6011,157 @@ static void ixgbe_watchdog(unsigned long data) | |||
5983 | */ | 6011 | */ |
5984 | IXGBE_WRITE_REG(hw, IXGBE_EICS, | 6012 | IXGBE_WRITE_REG(hw, IXGBE_EICS, |
5985 | (IXGBE_EICS_TCP_TIMER | IXGBE_EICS_OTHER)); | 6013 | (IXGBE_EICS_TCP_TIMER | IXGBE_EICS_OTHER)); |
5986 | goto watchdog_reschedule; | 6014 | } else { |
5987 | } | 6015 | /* get one bit for every active tx/rx interrupt vector */ |
5988 | 6016 | for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { | |
5989 | /* get one bit for every active tx/rx interrupt vector */ | 6017 | struct ixgbe_q_vector *qv = adapter->q_vector[i]; |
5990 | for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { | 6018 | if (qv->rxr_count || qv->txr_count) |
5991 | struct ixgbe_q_vector *qv = adapter->q_vector[i]; | 6019 | eics |= ((u64)1 << i); |
5992 | if (qv->rxr_count || qv->txr_count) | 6020 | } |
5993 | eics |= ((u64)1 << i); | ||
5994 | } | 6021 | } |
5995 | 6022 | ||
5996 | /* Cause software interrupt to ensure rx rings are cleaned */ | 6023 | /* Cause software interrupt to ensure rings are cleaned */ |
5997 | ixgbe_irq_rearm_queues(adapter, eics); | 6024 | ixgbe_irq_rearm_queues(adapter, eics); |
5998 | 6025 | ||
5999 | watchdog_reschedule: | ||
6000 | /* Reset the timer */ | ||
6001 | mod_timer(&adapter->watchdog_timer, round_jiffies(jiffies + 2 * HZ)); | ||
6002 | |||
6003 | watchdog_short_circuit: | ||
6004 | schedule_work(&adapter->watchdog_task); | ||
6005 | } | 6026 | } |
6006 | 6027 | ||
6007 | /** | 6028 | /** |
6008 | * ixgbe_fdir_reinit_task - worker thread to reinit FDIR filter table | 6029 | * ixgbe_watchdog_update_link - update the link status |
6009 | * @work: pointer to work_struct containing our data | 6030 | * @adapter - pointer to the device adapter structure |
6031 | * @link_speed - pointer to a u32 to store the link_speed | ||
6010 | **/ | 6032 | **/ |
6011 | static void ixgbe_fdir_reinit_task(struct work_struct *work) | 6033 | static void ixgbe_watchdog_update_link(struct ixgbe_adapter *adapter) |
6012 | { | 6034 | { |
6013 | struct ixgbe_adapter *adapter = container_of(work, | ||
6014 | struct ixgbe_adapter, | ||
6015 | fdir_reinit_task); | ||
6016 | struct ixgbe_hw *hw = &adapter->hw; | 6035 | struct ixgbe_hw *hw = &adapter->hw; |
6036 | u32 link_speed = adapter->link_speed; | ||
6037 | bool link_up = adapter->link_up; | ||
6017 | int i; | 6038 | int i; |
6018 | 6039 | ||
6019 | if (ixgbe_reinit_fdir_tables_82599(hw) == 0) { | 6040 | if (!(adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE)) |
6020 | for (i = 0; i < adapter->num_tx_queues; i++) | 6041 | return; |
6021 | set_bit(__IXGBE_TX_FDIR_INIT_DONE, | 6042 | |
6022 | &(adapter->tx_ring[i]->state)); | 6043 | if (hw->mac.ops.check_link) { |
6044 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); | ||
6023 | } else { | 6045 | } else { |
6024 | e_err(probe, "failed to finish FDIR re-initialization, " | 6046 | /* always assume link is up, if no check link function */ |
6025 | "ignored adding FDIR ATR filters\n"); | 6047 | link_speed = IXGBE_LINK_SPEED_10GB_FULL; |
6048 | link_up = true; | ||
6026 | } | 6049 | } |
6027 | /* Done FDIR Re-initialization, enable transmits */ | 6050 | if (link_up) { |
6028 | netif_tx_start_all_queues(adapter->netdev); | 6051 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
6052 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) | ||
6053 | hw->mac.ops.fc_enable(hw, i); | ||
6054 | } else { | ||
6055 | hw->mac.ops.fc_enable(hw, 0); | ||
6056 | } | ||
6057 | } | ||
6058 | |||
6059 | if (link_up || | ||
6060 | time_after(jiffies, (adapter->link_check_timeout + | ||
6061 | IXGBE_TRY_LINK_TIMEOUT))) { | ||
6062 | adapter->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE; | ||
6063 | IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMC_LSC); | ||
6064 | IXGBE_WRITE_FLUSH(hw); | ||
6065 | } | ||
6066 | |||
6067 | adapter->link_up = link_up; | ||
6068 | adapter->link_speed = link_speed; | ||
6029 | } | 6069 | } |
6030 | 6070 | ||
6031 | static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) | 6071 | /** |
6072 | * ixgbe_watchdog_link_is_up - update netif_carrier status and | ||
6073 | * print link up message | ||
6074 | * @adapter - pointer to the device adapter structure | ||
6075 | **/ | ||
6076 | static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter) | ||
6032 | { | 6077 | { |
6033 | u32 ssvpc; | 6078 | struct net_device *netdev = adapter->netdev; |
6079 | struct ixgbe_hw *hw = &adapter->hw; | ||
6080 | u32 link_speed = adapter->link_speed; | ||
6081 | bool flow_rx, flow_tx; | ||
6034 | 6082 | ||
6035 | /* Do not perform spoof check for 82598 */ | 6083 | /* only continue if link was previously down */ |
6036 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) | 6084 | if (netif_carrier_ok(netdev)) |
6037 | return; | 6085 | return; |
6038 | 6086 | ||
6039 | ssvpc = IXGBE_READ_REG(&adapter->hw, IXGBE_SSVPC); | 6087 | adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP; |
6040 | 6088 | ||
6041 | /* | 6089 | switch (hw->mac.type) { |
6042 | * ssvpc register is cleared on read, if zero then no | 6090 | case ixgbe_mac_82598EB: { |
6043 | * spoofed packets in the last interval. | 6091 | u32 frctl = IXGBE_READ_REG(hw, IXGBE_FCTRL); |
6044 | */ | 6092 | u32 rmcs = IXGBE_READ_REG(hw, IXGBE_RMCS); |
6045 | if (!ssvpc) | 6093 | flow_rx = !!(frctl & IXGBE_FCTRL_RFCE); |
6046 | return; | 6094 | flow_tx = !!(rmcs & IXGBE_RMCS_TFCE_802_3X); |
6095 | } | ||
6096 | break; | ||
6097 | case ixgbe_mac_X540: | ||
6098 | case ixgbe_mac_82599EB: { | ||
6099 | u32 mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN); | ||
6100 | u32 fccfg = IXGBE_READ_REG(hw, IXGBE_FCCFG); | ||
6101 | flow_rx = !!(mflcn & IXGBE_MFLCN_RFCE); | ||
6102 | flow_tx = !!(fccfg & IXGBE_FCCFG_TFCE_802_3X); | ||
6103 | } | ||
6104 | break; | ||
6105 | default: | ||
6106 | flow_tx = false; | ||
6107 | flow_rx = false; | ||
6108 | break; | ||
6109 | } | ||
6110 | e_info(drv, "NIC Link is Up %s, Flow Control: %s\n", | ||
6111 | (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? | ||
6112 | "10 Gbps" : | ||
6113 | (link_speed == IXGBE_LINK_SPEED_1GB_FULL ? | ||
6114 | "1 Gbps" : | ||
6115 | (link_speed == IXGBE_LINK_SPEED_100_FULL ? | ||
6116 | "100 Mbps" : | ||
6117 | "unknown speed"))), | ||
6118 | ((flow_rx && flow_tx) ? "RX/TX" : | ||
6119 | (flow_rx ? "RX" : | ||
6120 | (flow_tx ? "TX" : "None")))); | ||
6047 | 6121 | ||
6048 | e_warn(drv, "%d Spoofed packets detected\n", ssvpc); | 6122 | netif_carrier_on(netdev); |
6123 | #ifdef HAVE_IPLINK_VF_CONFIG | ||
6124 | ixgbe_check_vf_rate_limit(adapter); | ||
6125 | #endif /* HAVE_IPLINK_VF_CONFIG */ | ||
6049 | } | 6126 | } |
6050 | 6127 | ||
6051 | static DEFINE_MUTEX(ixgbe_watchdog_lock); | ||
6052 | |||
6053 | /** | 6128 | /** |
6054 | * ixgbe_watchdog_task - worker thread to bring link up | 6129 | * ixgbe_watchdog_link_is_down - update netif_carrier status and |
6055 | * @work: pointer to work_struct containing our data | 6130 | * print link down message |
6131 | * @adapter - pointer to the adapter structure | ||
6056 | **/ | 6132 | **/ |
6057 | static void ixgbe_watchdog_task(struct work_struct *work) | 6133 | static void ixgbe_watchdog_link_is_down(struct ixgbe_adapter* adapter) |
6058 | { | 6134 | { |
6059 | struct ixgbe_adapter *adapter = container_of(work, | ||
6060 | struct ixgbe_adapter, | ||
6061 | watchdog_task); | ||
6062 | struct net_device *netdev = adapter->netdev; | 6135 | struct net_device *netdev = adapter->netdev; |
6063 | struct ixgbe_hw *hw = &adapter->hw; | 6136 | struct ixgbe_hw *hw = &adapter->hw; |
6064 | u32 link_speed; | ||
6065 | bool link_up; | ||
6066 | int i; | ||
6067 | struct ixgbe_ring *tx_ring; | ||
6068 | int some_tx_pending = 0; | ||
6069 | |||
6070 | mutex_lock(&ixgbe_watchdog_lock); | ||
6071 | 6137 | ||
6072 | link_up = adapter->link_up; | 6138 | adapter->link_up = false; |
6073 | link_speed = adapter->link_speed; | 6139 | adapter->link_speed = 0; |
6074 | 6140 | ||
6075 | if (adapter->flags & IXGBE_FLAG_NEED_LINK_UPDATE) { | 6141 | /* only continue if link was up previously */ |
6076 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); | 6142 | if (!netif_carrier_ok(netdev)) |
6077 | if (link_up) { | 6143 | return; |
6078 | #ifdef CONFIG_DCB | ||
6079 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | ||
6080 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) | ||
6081 | hw->mac.ops.fc_enable(hw, i); | ||
6082 | } else { | ||
6083 | hw->mac.ops.fc_enable(hw, 0); | ||
6084 | } | ||
6085 | #else | ||
6086 | hw->mac.ops.fc_enable(hw, 0); | ||
6087 | #endif | ||
6088 | } | ||
6089 | 6144 | ||
6090 | if (link_up || | 6145 | /* poll for SFP+ cable when link is down */ |
6091 | time_after(jiffies, (adapter->link_check_timeout + | 6146 | if (ixgbe_is_sfp(hw) && hw->mac.type == ixgbe_mac_82598EB) |
6092 | IXGBE_TRY_LINK_TIMEOUT))) { | 6147 | adapter->flags2 |= IXGBE_FLAG2_SEARCH_FOR_SFP; |
6093 | adapter->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE; | ||
6094 | IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMC_LSC); | ||
6095 | } | ||
6096 | adapter->link_up = link_up; | ||
6097 | adapter->link_speed = link_speed; | ||
6098 | } | ||
6099 | 6148 | ||
6100 | if (link_up) { | 6149 | e_info(drv, "NIC Link is Down\n"); |
6101 | if (!netif_carrier_ok(netdev)) { | 6150 | netif_carrier_off(netdev); |
6102 | bool flow_rx, flow_tx; | 6151 | } |
6103 | |||
6104 | switch (hw->mac.type) { | ||
6105 | case ixgbe_mac_82598EB: { | ||
6106 | u32 frctl = IXGBE_READ_REG(hw, IXGBE_FCTRL); | ||
6107 | u32 rmcs = IXGBE_READ_REG(hw, IXGBE_RMCS); | ||
6108 | flow_rx = !!(frctl & IXGBE_FCTRL_RFCE); | ||
6109 | flow_tx = !!(rmcs & IXGBE_RMCS_TFCE_802_3X); | ||
6110 | } | ||
6111 | break; | ||
6112 | case ixgbe_mac_82599EB: | ||
6113 | case ixgbe_mac_X540: { | ||
6114 | u32 mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN); | ||
6115 | u32 fccfg = IXGBE_READ_REG(hw, IXGBE_FCCFG); | ||
6116 | flow_rx = !!(mflcn & IXGBE_MFLCN_RFCE); | ||
6117 | flow_tx = !!(fccfg & IXGBE_FCCFG_TFCE_802_3X); | ||
6118 | } | ||
6119 | break; | ||
6120 | default: | ||
6121 | flow_tx = false; | ||
6122 | flow_rx = false; | ||
6123 | break; | ||
6124 | } | ||
6125 | 6152 | ||
6126 | e_info(drv, "NIC Link is Up %s, Flow Control: %s\n", | 6153 | /** |
6127 | (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? | 6154 | * ixgbe_watchdog_flush_tx - flush queues on link down |
6128 | "10 Gbps" : | 6155 | * @adapter - pointer to the device adapter structure |
6129 | (link_speed == IXGBE_LINK_SPEED_1GB_FULL ? | 6156 | **/ |
6130 | "1 Gbps" : | 6157 | static void ixgbe_watchdog_flush_tx(struct ixgbe_adapter *adapter) |
6131 | (link_speed == IXGBE_LINK_SPEED_100_FULL ? | 6158 | { |
6132 | "100 Mbps" : | 6159 | int i; |
6133 | "unknown speed"))), | 6160 | int some_tx_pending = 0; |
6134 | ((flow_rx && flow_tx) ? "RX/TX" : | ||
6135 | (flow_rx ? "RX" : | ||
6136 | (flow_tx ? "TX" : "None")))); | ||
6137 | |||
6138 | netif_carrier_on(netdev); | ||
6139 | ixgbe_check_vf_rate_limit(adapter); | ||
6140 | } else { | ||
6141 | /* Force detection of hung controller */ | ||
6142 | for (i = 0; i < adapter->num_tx_queues; i++) { | ||
6143 | tx_ring = adapter->tx_ring[i]; | ||
6144 | set_check_for_tx_hang(tx_ring); | ||
6145 | } | ||
6146 | } | ||
6147 | } else { | ||
6148 | adapter->link_up = false; | ||
6149 | adapter->link_speed = 0; | ||
6150 | if (netif_carrier_ok(netdev)) { | ||
6151 | e_info(drv, "NIC Link is Down\n"); | ||
6152 | netif_carrier_off(netdev); | ||
6153 | } | ||
6154 | } | ||
6155 | 6161 | ||
6156 | if (!netif_carrier_ok(netdev)) { | 6162 | if (!netif_carrier_ok(adapter->netdev)) { |
6157 | for (i = 0; i < adapter->num_tx_queues; i++) { | 6163 | for (i = 0; i < adapter->num_tx_queues; i++) { |
6158 | tx_ring = adapter->tx_ring[i]; | 6164 | struct ixgbe_ring *tx_ring = adapter->tx_ring[i]; |
6159 | if (tx_ring->next_to_use != tx_ring->next_to_clean) { | 6165 | if (tx_ring->next_to_use != tx_ring->next_to_clean) { |
6160 | some_tx_pending = 1; | 6166 | some_tx_pending = 1; |
6161 | break; | 6167 | break; |
@@ -6168,13 +6174,52 @@ static void ixgbe_watchdog_task(struct work_struct *work) | |||
6168 | * to get done, so reset controller to flush Tx. | 6174 | * to get done, so reset controller to flush Tx. |
6169 | * (Do the reset outside of interrupt context). | 6175 | * (Do the reset outside of interrupt context). |
6170 | */ | 6176 | */ |
6171 | schedule_work(&adapter->reset_task); | 6177 | schedule_work(&adapter->reset_task); |
6172 | } | 6178 | } |
6173 | } | 6179 | } |
6180 | } | ||
6181 | |||
6182 | static void ixgbe_spoof_check(struct ixgbe_adapter *adapter) | ||
6183 | { | ||
6184 | u32 ssvpc; | ||
6185 | |||
6186 | /* Do not perform spoof check for 82598 */ | ||
6187 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) | ||
6188 | return; | ||
6189 | |||
6190 | ssvpc = IXGBE_READ_REG(&adapter->hw, IXGBE_SSVPC); | ||
6191 | |||
6192 | /* | ||
6193 | * ssvpc register is cleared on read, if zero then no | ||
6194 | * spoofed packets in the last interval. | ||
6195 | */ | ||
6196 | if (!ssvpc) | ||
6197 | return; | ||
6198 | |||
6199 | e_warn(drv, "%d Spoofed packets detected\n", ssvpc); | ||
6200 | } | ||
6201 | |||
6202 | /** | ||
6203 | * ixgbe_watchdog_subtask - check and bring link up | ||
6204 | * @adapter - pointer to the device adapter structure | ||
6205 | **/ | ||
6206 | static void ixgbe_watchdog_subtask(struct ixgbe_adapter *adapter) | ||
6207 | { | ||
6208 | /* if interface is down do nothing */ | ||
6209 | if (test_bit(__IXGBE_DOWN, &adapter->state)) | ||
6210 | return; | ||
6211 | |||
6212 | ixgbe_watchdog_update_link(adapter); | ||
6213 | |||
6214 | if (adapter->link_up) | ||
6215 | ixgbe_watchdog_link_is_up(adapter); | ||
6216 | else | ||
6217 | ixgbe_watchdog_link_is_down(adapter); | ||
6174 | 6218 | ||
6175 | ixgbe_spoof_check(adapter); | 6219 | ixgbe_spoof_check(adapter); |
6176 | ixgbe_update_stats(adapter); | 6220 | ixgbe_update_stats(adapter); |
6177 | mutex_unlock(&ixgbe_watchdog_lock); | 6221 | |
6222 | ixgbe_watchdog_flush_tx(adapter); | ||
6178 | } | 6223 | } |
6179 | 6224 | ||
6180 | /** | 6225 | /** |
@@ -6308,6 +6353,8 @@ static void ixgbe_service_task(struct work_struct *work) | |||
6308 | 6353 | ||
6309 | ixgbe_sfp_detection_subtask(adapter); | 6354 | ixgbe_sfp_detection_subtask(adapter); |
6310 | ixgbe_sfp_link_config_subtask(adapter); | 6355 | ixgbe_sfp_link_config_subtask(adapter); |
6356 | ixgbe_watchdog_subtask(adapter); | ||
6357 | ixgbe_check_hang_subtask(adapter); | ||
6311 | 6358 | ||
6312 | ixgbe_service_event_complete(adapter); | 6359 | ixgbe_service_event_complete(adapter); |
6313 | } | 6360 | } |
@@ -7485,12 +7532,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
7485 | 7532 | ||
7486 | setup_timer(&adapter->service_timer, &ixgbe_service_timer, | 7533 | setup_timer(&adapter->service_timer, &ixgbe_service_timer, |
7487 | (unsigned long) adapter); | 7534 | (unsigned long) adapter); |
7488 | init_timer(&adapter->watchdog_timer); | ||
7489 | adapter->watchdog_timer.function = ixgbe_watchdog; | ||
7490 | adapter->watchdog_timer.data = (unsigned long)adapter; | ||
7491 | 7535 | ||
7492 | INIT_WORK(&adapter->reset_task, ixgbe_reset_task); | 7536 | INIT_WORK(&adapter->reset_task, ixgbe_reset_task); |
7493 | INIT_WORK(&adapter->watchdog_task, ixgbe_watchdog_task); | ||
7494 | 7537 | ||
7495 | INIT_WORK(&adapter->service_task, ixgbe_service_task); | 7538 | INIT_WORK(&adapter->service_task, ixgbe_service_task); |
7496 | clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state); | 7539 | clear_bit(__IXGBE_SERVICE_SCHED, &adapter->state); |
@@ -7643,13 +7686,6 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
7643 | set_bit(__IXGBE_DOWN, &adapter->state); | 7686 | set_bit(__IXGBE_DOWN, &adapter->state); |
7644 | cancel_work_sync(&adapter->service_task); | 7687 | cancel_work_sync(&adapter->service_task); |
7645 | 7688 | ||
7646 | /* | ||
7647 | * The timers may be rescheduled, so explicitly disable them | ||
7648 | * from being rescheduled. | ||
7649 | */ | ||
7650 | del_timer_sync(&adapter->watchdog_timer); | ||
7651 | |||
7652 | cancel_work_sync(&adapter->watchdog_task); | ||
7653 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || | 7689 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || |
7654 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) | 7690 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) |
7655 | cancel_work_sync(&adapter->fdir_reinit_task); | 7691 | cancel_work_sync(&adapter->fdir_reinit_task); |