| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ixgbe.c,v 1.270 2020/12/24 22:36:43 msaitoh Exp $ */ | | 1 | /* $NetBSD: ixgbe.c,v 1.271 2020/12/26 06:01:22 msaitoh Exp $ */ |
2 | | | 2 | |
3 | /****************************************************************************** | | 3 | /****************************************************************************** |
4 | | | 4 | |
5 | Copyright (c) 2001-2017, Intel Corporation | | 5 | Copyright (c) 2001-2017, Intel Corporation |
6 | All rights reserved. | | 6 | All rights reserved. |
7 | | | 7 | |
8 | Redistribution and use in source and binary forms, with or without | | 8 | Redistribution and use in source and binary forms, with or without |
9 | modification, are permitted provided that the following conditions are met: | | 9 | modification, are permitted provided that the following conditions are met: |
10 | | | 10 | |
11 | 1. Redistributions of source code must retain the above copyright notice, | | 11 | 1. Redistributions of source code must retain the above copyright notice, |
12 | this list of conditions and the following disclaimer. | | 12 | this list of conditions and the following disclaimer. |
13 | | | 13 | |
14 | 2. Redistributions in binary form must reproduce the above copyright | | 14 | 2. Redistributions in binary form must reproduce the above copyright |
| @@ -5146,27 +5146,26 @@ ixgbe_ensure_disabled_intr(struct adapte | | | @@ -5146,27 +5146,26 @@ ixgbe_ensure_disabled_intr(struct adapte |
5146 | } /* ixgbe_ensure_disabled_intr */ | | 5146 | } /* ixgbe_ensure_disabled_intr */ |
5147 | | | 5147 | |
5148 | /************************************************************************ | | 5148 | /************************************************************************ |
5149 | * ixgbe_legacy_irq - Legacy Interrupt Service routine | | 5149 | * ixgbe_legacy_irq - Legacy Interrupt Service routine |
5150 | ************************************************************************/ | | 5150 | ************************************************************************/ |
5151 | static int | | 5151 | static int |
5152 | ixgbe_legacy_irq(void *arg) | | 5152 | ixgbe_legacy_irq(void *arg) |
5153 | { | | 5153 | { |
5154 | struct ix_queue *que = arg; | | 5154 | struct ix_queue *que = arg; |
5155 | struct adapter *adapter = que->adapter; | | 5155 | struct adapter *adapter = que->adapter; |
5156 | struct ixgbe_hw *hw = &adapter->hw; | | 5156 | struct ixgbe_hw *hw = &adapter->hw; |
5157 | struct ifnet *ifp = adapter->ifp; | | 5157 | struct ifnet *ifp = adapter->ifp; |
5158 | struct tx_ring *txr = adapter->tx_rings; | | 5158 | struct tx_ring *txr = adapter->tx_rings; |
5159 | bool more = false; | | | |
5160 | bool reenable_intr = true; | | 5159 | bool reenable_intr = true; |
5161 | u32 eicr, eicr_mask; | | 5160 | u32 eicr, eicr_mask; |
5162 | u32 eims_orig; | | 5161 | u32 eims_orig; |
5163 | u32 task_requests = 0; | | 5162 | u32 task_requests = 0; |
5164 | | | 5163 | |
5165 | eims_orig = IXGBE_READ_REG(hw, IXGBE_EIMS); | | 5164 | eims_orig = IXGBE_READ_REG(hw, IXGBE_EIMS); |
5166 | /* | | 5165 | /* |
5167 | * Silicon errata #26 on 82598. Disable all interrupts before reading | | 5166 | * Silicon errata #26 on 82598. Disable all interrupts before reading |
5168 | * EICR. | | 5167 | * EICR. |
5169 | */ | | 5168 | */ |
5170 | IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_IRQ_CLEAR_MASK); | | 5169 | IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_IRQ_CLEAR_MASK); |
5171 | | | 5170 | |
5172 | /* Read and clear EICR */ | | 5171 | /* Read and clear EICR */ |
| @@ -5177,40 +5176,37 @@ ixgbe_legacy_irq(void *arg) | | | @@ -5177,40 +5176,37 @@ ixgbe_legacy_irq(void *arg) |
5177 | if (eicr == 0) { | | 5176 | if (eicr == 0) { |
5178 | adapter->stats.pf.intzero.ev_count++; | | 5177 | adapter->stats.pf.intzero.ev_count++; |
5179 | IXGBE_WRITE_REG(hw, IXGBE_EIMS, eims_orig); | | 5178 | IXGBE_WRITE_REG(hw, IXGBE_EIMS, eims_orig); |
5180 | return 0; | | 5179 | return 0; |
5181 | } | | 5180 | } |
5182 | | | 5181 | |
5183 | if ((ifp->if_flags & IFF_RUNNING) != 0) { | | 5182 | if ((ifp->if_flags & IFF_RUNNING) != 0) { |
5184 | /* | | 5183 | /* |
5185 | * The same as ixgbe_msix_que() about | | 5184 | * The same as ixgbe_msix_que() about |
5186 | * "que->txrx_use_workqueue". | | 5185 | * "que->txrx_use_workqueue". |
5187 | */ | | 5186 | */ |
5188 | que->txrx_use_workqueue = adapter->txrx_use_workqueue; | | 5187 | que->txrx_use_workqueue = adapter->txrx_use_workqueue; |
5189 | | | 5188 | |
5190 | #ifdef __NetBSD__ | | | |
5191 | /* Don't run ixgbe_rxeof in interrupt context */ | | | |
5192 | more = true; | | | |
5193 | #else | | | |
5194 | more = ixgbe_rxeof(que); | | | |
5195 | #endif | | | |
5196 | | | | |
5197 | IXGBE_TX_LOCK(txr); | | 5189 | IXGBE_TX_LOCK(txr); |
5198 | ixgbe_txeof(txr); | | 5190 | ixgbe_txeof(txr); |
5199 | #ifdef notyet | | 5191 | #ifdef notyet |
5200 | if (!ixgbe_ring_empty(ifp, txr->br)) | | 5192 | if (!ixgbe_ring_empty(ifp, txr->br)) |
5201 | ixgbe_start_locked(ifp, txr); | | 5193 | ixgbe_start_locked(ifp, txr); |
5202 | #endif | | 5194 | #endif |
5203 | IXGBE_TX_UNLOCK(txr); | | 5195 | IXGBE_TX_UNLOCK(txr); |
| | | 5196 | |
| | | 5197 | que->req.ev_count++; |
| | | 5198 | ixgbe_sched_handle_que(adapter, que); |
| | | 5199 | reenable_intr = false; |
5204 | } | | 5200 | } |
5205 | | | 5201 | |
5206 | /* Link status change */ | | 5202 | /* Link status change */ |
5207 | if (eicr & IXGBE_EICR_LSC) | | 5203 | if (eicr & IXGBE_EICR_LSC) |
5208 | task_requests |= IXGBE_REQUEST_TASK_LSC; | | 5204 | task_requests |= IXGBE_REQUEST_TASK_LSC; |
5209 | | | 5205 | |
5210 | if (ixgbe_is_sfp(hw)) { | | 5206 | if (ixgbe_is_sfp(hw)) { |
5211 | /* Pluggable optics-related interrupt */ | | 5207 | /* Pluggable optics-related interrupt */ |
5212 | if (hw->mac.type >= ixgbe_mac_X540) | | 5208 | if (hw->mac.type >= ixgbe_mac_X540) |
5213 | eicr_mask = IXGBE_EICR_GPI_SDP0_X540; | | 5209 | eicr_mask = IXGBE_EICR_GPI_SDP0_X540; |
5214 | else | | 5210 | else |
5215 | eicr_mask = IXGBE_EICR_GPI_SDP2_BY_MAC(hw); | | 5211 | eicr_mask = IXGBE_EICR_GPI_SDP2_BY_MAC(hw); |
5216 | | | 5212 | |
| @@ -5232,31 +5228,26 @@ ixgbe_legacy_irq(void *arg) | | | @@ -5232,31 +5228,26 @@ ixgbe_legacy_irq(void *arg) |
5232 | } | | 5228 | } |
5233 | } | | 5229 | } |
5234 | | | 5230 | |
5235 | /* Check for fan failure */ | | 5231 | /* Check for fan failure */ |
5236 | if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) { | | 5232 | if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) { |
5237 | ixgbe_check_fan_failure(adapter, eicr, true); | | 5233 | ixgbe_check_fan_failure(adapter, eicr, true); |
5238 | } | | 5234 | } |
5239 | | | 5235 | |
5240 | /* External PHY interrupt */ | | 5236 | /* External PHY interrupt */ |
5241 | if ((hw->phy.type == ixgbe_phy_x550em_ext_t) && | | 5237 | if ((hw->phy.type == ixgbe_phy_x550em_ext_t) && |
5242 | (eicr & IXGBE_EICR_GPI_SDP0_X540)) | | 5238 | (eicr & IXGBE_EICR_GPI_SDP0_X540)) |
5243 | task_requests |= IXGBE_REQUEST_TASK_PHY; | | 5239 | task_requests |= IXGBE_REQUEST_TASK_PHY; |
5244 | | | 5240 | |
5245 | if (more) { | | | |
5246 | que->req.ev_count++; | | | |
5247 | ixgbe_sched_handle_que(adapter, que); | | | |
5248 | reenable_intr = false; | | | |
5249 | } | | | |
5250 | if (task_requests != 0) { | | 5241 | if (task_requests != 0) { |
5251 | /* Re-enabling other interrupts is done in the admin task */ | | 5242 | /* Re-enabling other interrupts is done in the admin task */ |
5252 | task_requests |= IXGBE_REQUEST_TASK_NEED_ACKINTR; | | 5243 | task_requests |= IXGBE_REQUEST_TASK_NEED_ACKINTR; |
5253 | | | 5244 | |
5254 | mutex_enter(&adapter->admin_mtx); | | 5245 | mutex_enter(&adapter->admin_mtx); |
5255 | adapter->task_requests |= task_requests; | | 5246 | adapter->task_requests |= task_requests; |
5256 | ixgbe_schedule_admin_tasklet(adapter); | | 5247 | ixgbe_schedule_admin_tasklet(adapter); |
5257 | mutex_exit(&adapter->admin_mtx); | | 5248 | mutex_exit(&adapter->admin_mtx); |
5258 | | | 5249 | |
5259 | reenable_intr = false; | | 5250 | reenable_intr = false; |
5260 | } | | 5251 | } |
5261 | | | 5252 | |
5262 | if (reenable_intr == true) | | 5253 | if (reenable_intr == true) |