Commit | Line | Data |
---|---|---|
8e99ea8d JB |
1 | // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause |
2 | /* | |
3 | * Copyright (C) 2012-2014, 2018-2020 Intel Corporation | |
4 | * Copyright (C) 2013-2015 Intel Mobile Communications GmbH | |
5 | * Copyright (C) 2016-2017 Intel Deutschland GmbH | |
6 | */ | |
8ca151b5 | 7 | #include <linux/module.h> |
1bd3cbc1 | 8 | #include <linux/vmalloc.h> |
8ca151b5 JB |
9 | #include <net/mac80211.h> |
10 | ||
9fca9d5c | 11 | #include "fw/notif-wait.h" |
8ca151b5 JB |
12 | #include "iwl-trans.h" |
13 | #include "iwl-op-mode.h" | |
d962f9b1 | 14 | #include "fw/img.h" |
8ca151b5 JB |
15 | #include "iwl-debug.h" |
16 | #include "iwl-drv.h" | |
17 | #include "iwl-modparams.h" | |
18 | #include "mvm.h" | |
19 | #include "iwl-phy-db.h" | |
20 | #include "iwl-eeprom-parse.h" | |
21 | #include "iwl-csr.h" | |
22 | #include "iwl-io.h" | |
23 | #include "iwl-prph.h" | |
24 | #include "rs.h" | |
d172a5ef | 25 | #include "fw/api/scan.h" |
8ca151b5 | 26 | #include "time-event.h" |
39bdb17e | 27 | #include "fw-api.h" |
f2abcfa6 | 28 | #include "fw/acpi.h" |
8ca151b5 | 29 | |
8ca151b5 | 30 | #define DRV_DESCRIPTION "The new Intel(R) wireless AGN driver for Linux" |
8ca151b5 | 31 | MODULE_DESCRIPTION(DRV_DESCRIPTION); |
e9a7f025 | 32 | MODULE_AUTHOR(DRV_AUTHOR); |
8ca151b5 JB |
33 | MODULE_LICENSE("GPL"); |
34 | ||
35 | static const struct iwl_op_mode_ops iwl_mvm_ops; | |
0316d30e | 36 | static const struct iwl_op_mode_ops iwl_mvm_ops_mq; |
8ca151b5 JB |
37 | |
38 | struct iwl_mvm_mod_params iwlmvm_mod_params = { | |
39 | .power_scheme = IWL_POWER_SCHEME_BPS, | |
40 | /* rest of fields are 0 by default */ | |
41 | }; | |
42 | ||
2ef00c53 | 43 | module_param_named(init_dbg, iwlmvm_mod_params.init_dbg, bool, 0444); |
8ca151b5 JB |
44 | MODULE_PARM_DESC(init_dbg, |
45 | "set to true to debug an ASSERT in INIT fw (default: false"); | |
2ef00c53 | 46 | module_param_named(power_scheme, iwlmvm_mod_params.power_scheme, int, 0444); |
8ca151b5 JB |
47 | MODULE_PARM_DESC(power_scheme, |
48 | "power management scheme: 1-active, 2-balanced, 3-low power, default: 2"); | |
49 | ||
50 | /* | |
51 | * module init and exit functions | |
52 | */ | |
53 | static int __init iwl_mvm_init(void) | |
54 | { | |
55 | int ret; | |
56 | ||
57 | ret = iwl_mvm_rate_control_register(); | |
58 | if (ret) { | |
59 | pr_err("Unable to register rate control algorithm: %d\n", ret); | |
60 | return ret; | |
61 | } | |
62 | ||
63 | ret = iwl_opmode_register("iwlmvm", &iwl_mvm_ops); | |
9f66a397 | 64 | if (ret) |
8ca151b5 | 65 | pr_err("Unable to register MVM op_mode: %d\n", ret); |
8ca151b5 JB |
66 | |
67 | return ret; | |
68 | } | |
69 | module_init(iwl_mvm_init); | |
70 | ||
71 | static void __exit iwl_mvm_exit(void) | |
72 | { | |
73 | iwl_opmode_deregister("iwlmvm"); | |
74 | iwl_mvm_rate_control_unregister(); | |
75 | } | |
76 | module_exit(iwl_mvm_exit); | |
77 | ||
78 | static void iwl_mvm_nic_config(struct iwl_op_mode *op_mode) | |
79 | { | |
80 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
81 | u8 radio_cfg_type, radio_cfg_step, radio_cfg_dash; | |
82 | u32 reg_val = 0; | |
a0544272 MH |
83 | u32 phy_config = iwl_mvm_get_phy_config(mvm); |
84 | ||
85 | radio_cfg_type = (phy_config & FW_PHY_CFG_RADIO_TYPE) >> | |
86 | FW_PHY_CFG_RADIO_TYPE_POS; | |
87 | radio_cfg_step = (phy_config & FW_PHY_CFG_RADIO_STEP) >> | |
88 | FW_PHY_CFG_RADIO_STEP_POS; | |
89 | radio_cfg_dash = (phy_config & FW_PHY_CFG_RADIO_DASH) >> | |
90 | FW_PHY_CFG_RADIO_DASH_POS; | |
8ca151b5 JB |
91 | |
92 | /* SKU control */ | |
93 | reg_val |= CSR_HW_REV_STEP(mvm->trans->hw_rev) << | |
94 | CSR_HW_IF_CONFIG_REG_POS_MAC_STEP; | |
95 | reg_val |= CSR_HW_REV_DASH(mvm->trans->hw_rev) << | |
96 | CSR_HW_IF_CONFIG_REG_POS_MAC_DASH; | |
97 | ||
98 | /* radio configuration */ | |
99 | reg_val |= radio_cfg_type << CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE; | |
100 | reg_val |= radio_cfg_step << CSR_HW_IF_CONFIG_REG_POS_PHY_STEP; | |
101 | reg_val |= radio_cfg_dash << CSR_HW_IF_CONFIG_REG_POS_PHY_DASH; | |
102 | ||
103 | WARN_ON((radio_cfg_type << CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE) & | |
104 | ~CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE); | |
105 | ||
9b1fcc11 | 106 | /* |
6e584873 SS |
107 | * TODO: Bits 7-8 of CSR in 8000 HW family and higher set the ADC |
108 | * sampling, and shouldn't be set to any non-zero value. | |
109 | * The same is supposed to be true of the other HW, but unsetting | |
110 | * them (such as the 7260) causes automatic tests to fail on seemingly | |
111 | * unrelated errors. Need to further investigate this, but for now | |
112 | * we'll separate cases. | |
9b1fcc11 | 113 | */ |
286ca8eb | 114 | if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_8000) |
9b1fcc11 | 115 | reg_val |= CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI; |
8ca151b5 | 116 | |
e75bc5f3 | 117 | if (iwl_fw_dbg_is_d3_debug_enabled(&mvm->fwrt)) |
2d8c2615 SM |
118 | reg_val |= CSR_HW_IF_CONFIG_REG_D3_DEBUG; |
119 | ||
e139dc4a LE |
120 | iwl_trans_set_bits_mask(mvm->trans, CSR_HW_IF_CONFIG_REG, |
121 | CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH | | |
122 | CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP | | |
123 | CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE | | |
124 | CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP | | |
125 | CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH | | |
126 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | |
2d8c2615 SM |
127 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI | |
128 | CSR_HW_IF_CONFIG_REG_D3_DEBUG, | |
e139dc4a | 129 | reg_val); |
8ca151b5 JB |
130 | |
131 | IWL_DEBUG_INFO(mvm, "Radio type=0x%x-0x%x-0x%x\n", radio_cfg_type, | |
132 | radio_cfg_step, radio_cfg_dash); | |
133 | ||
134 | /* | |
135 | * W/A : NIC is stuck in a reset state after Early PCIe power off | |
136 | * (PCIe power is lost before PERST# is asserted), causing ME FW | |
137 | * to lose ownership and not being able to obtain it back. | |
138 | */ | |
95411d04 | 139 | if (!mvm->trans->cfg->apmg_not_supported) |
3073d8c0 EH |
140 | iwl_set_bits_mask_prph(mvm->trans, APMG_PS_CTRL_REG, |
141 | APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, | |
142 | ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); | |
8ca151b5 JB |
143 | } |
144 | ||
f7d6ef33 JB |
145 | static void iwl_mvm_rx_monitor_notif(struct iwl_mvm *mvm, |
146 | struct iwl_rx_cmd_buffer *rxb) | |
147 | { | |
148 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | |
149 | struct iwl_datapath_monitor_notif *notif = (void *)pkt->data; | |
150 | struct ieee80211_supported_band *sband; | |
151 | const struct ieee80211_sta_he_cap *he_cap; | |
152 | struct ieee80211_vif *vif; | |
153 | ||
154 | if (notif->type != cpu_to_le32(IWL_DP_MON_NOTIF_TYPE_EXT_CCA)) | |
155 | return; | |
156 | ||
157 | vif = iwl_mvm_get_vif_by_macid(mvm, notif->mac_id); | |
158 | if (!vif || vif->type != NL80211_IFTYPE_STATION) | |
159 | return; | |
160 | ||
161 | if (!vif->bss_conf.chandef.chan || | |
162 | vif->bss_conf.chandef.chan->band != NL80211_BAND_2GHZ || | |
163 | vif->bss_conf.chandef.width < NL80211_CHAN_WIDTH_40) | |
164 | return; | |
165 | ||
166 | if (!vif->bss_conf.assoc) | |
167 | return; | |
168 | ||
169 | /* this shouldn't happen *again*, ignore it */ | |
170 | if (mvm->cca_40mhz_workaround) | |
171 | return; | |
172 | ||
173 | /* | |
174 | * We'll decrement this on disconnect - so set to 2 since we'll | |
175 | * still have to disconnect from the current AP first. | |
176 | */ | |
177 | mvm->cca_40mhz_workaround = 2; | |
178 | ||
179 | /* | |
180 | * This capability manipulation isn't really ideal, but it's the | |
181 | * easiest choice - otherwise we'd have to do some major changes | |
182 | * in mac80211 to support this, which isn't worth it. This does | |
183 | * mean that userspace may have outdated information, but that's | |
184 | * actually not an issue at all. | |
185 | */ | |
186 | sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]; | |
187 | ||
188 | WARN_ON(!sband->ht_cap.ht_supported); | |
189 | WARN_ON(!(sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)); | |
190 | sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; | |
191 | ||
192 | he_cap = ieee80211_get_he_iftype_cap(sband, | |
193 | ieee80211_vif_type_p2p(vif)); | |
194 | ||
195 | if (he_cap) { | |
196 | /* we know that ours is writable */ | |
197 | struct ieee80211_sta_he_cap *he = (void *)he_cap; | |
198 | ||
199 | WARN_ON(!he->has_he); | |
200 | WARN_ON(!(he->he_cap_elem.phy_cap_info[0] & | |
201 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G)); | |
202 | he->he_cap_elem.phy_cap_info[0] &= | |
203 | ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G; | |
204 | } | |
205 | ||
206 | ieee80211_disconnect(vif, true); | |
207 | } | |
208 | ||
2a7ce54c JB |
209 | void iwl_mvm_apply_fw_smps_request(struct ieee80211_vif *vif) |
210 | { | |
211 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | |
212 | struct iwl_mvm *mvm = mvmvif->mvm; | |
de34d1c1 | 213 | enum ieee80211_smps_mode mode = IEEE80211_SMPS_AUTOMATIC; |
2a7ce54c | 214 | |
de34d1c1 JB |
215 | if (mvm->fw_static_smps_request && |
216 | vif->bss_conf.chandef.width == NL80211_CHAN_WIDTH_160 && | |
217 | vif->bss_conf.he_support) | |
218 | mode = IEEE80211_SMPS_STATIC; | |
219 | ||
220 | iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_FW, mode); | |
2a7ce54c JB |
221 | } |
222 | ||
223 | static void iwl_mvm_intf_dual_chain_req(void *data, u8 *mac, | |
224 | struct ieee80211_vif *vif) | |
225 | { | |
226 | iwl_mvm_apply_fw_smps_request(vif); | |
227 | } | |
228 | ||
229 | static void iwl_mvm_rx_thermal_dual_chain_req(struct iwl_mvm *mvm, | |
230 | struct iwl_rx_cmd_buffer *rxb) | |
231 | { | |
232 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | |
233 | struct iwl_thermal_dual_chain_request *req = (void *)pkt->data; | |
234 | ||
235 | /* | |
236 | * We could pass it to the iterator data, but also need to remember | |
237 | * it for new interfaces that are added while in this state. | |
238 | */ | |
239 | mvm->fw_static_smps_request = | |
240 | req->event == cpu_to_le32(THERMAL_DUAL_CHAIN_REQ_DISABLE); | |
241 | ieee80211_iterate_interfaces(mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | |
242 | iwl_mvm_intf_dual_chain_req, NULL); | |
243 | } | |
244 | ||
c9cb14a6 CRI |
245 | /** |
246 | * enum iwl_rx_handler_context context for Rx handler | |
247 | * @RX_HANDLER_SYNC : this means that it will be called in the Rx path | |
248 | * which can't acquire mvm->mutex. | |
249 | * @RX_HANDLER_ASYNC_LOCKED : If the handler needs to hold mvm->mutex | |
250 | * (and only in this case!), it should be set as ASYNC. In that case, | |
251 | * it will be called from a worker with mvm->mutex held. | |
252 | * @RX_HANDLER_ASYNC_UNLOCKED : in case the handler needs to lock the | |
253 | * mutex itself, it will be called from a worker without mvm->mutex held. | |
254 | */ | |
255 | enum iwl_rx_handler_context { | |
256 | RX_HANDLER_SYNC, | |
257 | RX_HANDLER_ASYNC_LOCKED, | |
258 | RX_HANDLER_ASYNC_UNLOCKED, | |
259 | }; | |
260 | ||
261 | /** | |
262 | * struct iwl_rx_handlers handler for FW notification | |
263 | * @cmd_id: command id | |
264 | * @context: see &iwl_rx_handler_context | |
265 | * @fn: the function is called when notification is received | |
266 | */ | |
8ca151b5 | 267 | struct iwl_rx_handlers { |
afc857bc | 268 | u16 cmd_id, min_size; |
c9cb14a6 | 269 | enum iwl_rx_handler_context context; |
0416841d | 270 | void (*fn)(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
8ca151b5 JB |
271 | }; |
272 | ||
afc857bc JB |
273 | #define RX_HANDLER_NO_SIZE(_cmd_id, _fn, _context) \ |
274 | { .cmd_id = _cmd_id, .fn = _fn, .context = _context, } | |
275 | #define RX_HANDLER_GRP_NO_SIZE(_grp, _cmd, _fn, _context) \ | |
276 | { .cmd_id = WIDE_ID(_grp, _cmd), .fn = _fn, .context = _context, } | |
277 | #define RX_HANDLER(_cmd_id, _fn, _context, _struct) \ | |
278 | { .cmd_id = _cmd_id, .fn = _fn, \ | |
279 | .context = _context, .min_size = sizeof(_struct), } | |
280 | #define RX_HANDLER_GRP(_grp, _cmd, _fn, _context, _struct) \ | |
281 | { .cmd_id = WIDE_ID(_grp, _cmd), .fn = _fn, \ | |
282 | .context = _context, .min_size = sizeof(_struct), } | |
8ca151b5 JB |
283 | |
284 | /* | |
285 | * Handlers for fw notifications | |
286 | * Convention: RX_HANDLER(CMD_NAME, iwl_mvm_rx_CMD_NAME | |
287 | * This list should be in order of frequency for performance purposes. | |
288 | * | |
c9cb14a6 | 289 | * The handler can be one from three contexts, see &iwl_rx_handler_context |
8ca151b5 JB |
290 | */ |
291 | static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { | |
afc857bc JB |
292 | RX_HANDLER(TX_CMD, iwl_mvm_rx_tx_cmd, RX_HANDLER_SYNC, |
293 | struct iwl_mvm_tx_resp), | |
294 | RX_HANDLER(BA_NOTIF, iwl_mvm_rx_ba_notif, RX_HANDLER_SYNC, | |
295 | struct iwl_mvm_ba_notif), | |
c9cb14a6 | 296 | |
84226ca1 | 297 | RX_HANDLER_GRP(DATA_PATH_GROUP, TLC_MNG_UPDATE_NOTIF, |
afc857bc JB |
298 | iwl_mvm_tlc_update_notif, RX_HANDLER_SYNC, |
299 | struct iwl_tlc_update_notif), | |
84226ca1 | 300 | |
c9cb14a6 | 301 | RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_notif, |
afc857bc JB |
302 | RX_HANDLER_ASYNC_LOCKED, struct iwl_bt_coex_profile_notif), |
303 | RX_HANDLER_NO_SIZE(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, | |
304 | RX_HANDLER_ASYNC_LOCKED), | |
305 | RX_HANDLER_NO_SIZE(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics, | |
306 | RX_HANDLER_ASYNC_LOCKED), | |
f421f9c3 | 307 | |
3af512d6 | 308 | RX_HANDLER(BA_WINDOW_STATUS_NOTIFICATION_ID, |
afc857bc JB |
309 | iwl_mvm_window_status_notif, RX_HANDLER_SYNC, |
310 | struct iwl_ba_window_status_notif), | |
3af512d6 | 311 | |
c9cb14a6 | 312 | RX_HANDLER(TIME_EVENT_NOTIFICATION, iwl_mvm_rx_time_event_notif, |
afc857bc | 313 | RX_HANDLER_SYNC, struct iwl_time_event_notif), |
fe959c7b | 314 | RX_HANDLER_GRP(MAC_CONF_GROUP, SESSION_PROTECTION_NOTIF, |
afc857bc JB |
315 | iwl_mvm_rx_session_protect_notif, RX_HANDLER_SYNC, |
316 | struct iwl_mvm_session_prot_notif), | |
c9cb14a6 | 317 | RX_HANDLER(MCC_CHUB_UPDATE_CMD, iwl_mvm_rx_chub_update_mcc, |
afc857bc | 318 | RX_HANDLER_ASYNC_LOCKED, struct iwl_mcc_chub_notif), |
497b49d2 | 319 | |
afc857bc JB |
320 | RX_HANDLER(EOSP_NOTIFICATION, iwl_mvm_rx_eosp_notif, RX_HANDLER_SYNC, |
321 | struct iwl_mvm_eosp_notification), | |
3e56eadf | 322 | |
e5d74646 | 323 | RX_HANDLER(SCAN_ITERATION_COMPLETE, |
afc857bc JB |
324 | iwl_mvm_rx_lmac_scan_iter_complete_notif, RX_HANDLER_SYNC, |
325 | struct iwl_lmac_scan_complete_notif), | |
35a000b7 | 326 | RX_HANDLER(SCAN_OFFLOAD_COMPLETE, |
c9cb14a6 | 327 | iwl_mvm_rx_lmac_scan_complete_notif, |
afc857bc JB |
328 | RX_HANDLER_ASYNC_LOCKED, struct iwl_periodic_scan_complete), |
329 | RX_HANDLER_NO_SIZE(MATCH_FOUND_NOTIFICATION, | |
330 | iwl_mvm_rx_scan_match_found, | |
331 | RX_HANDLER_SYNC), | |
d2496221 | 332 | RX_HANDLER(SCAN_COMPLETE_UMAC, iwl_mvm_rx_umac_scan_complete_notif, |
afc857bc | 333 | RX_HANDLER_ASYNC_LOCKED, struct iwl_umac_scan_complete), |
ee9219b2 | 334 | RX_HANDLER(SCAN_ITERATION_COMPLETE_UMAC, |
afc857bc JB |
335 | iwl_mvm_rx_umac_scan_iter_complete_notif, RX_HANDLER_SYNC, |
336 | struct iwl_umac_scan_iter_complete_notif), | |
497b49d2 | 337 | |
c9cb14a6 | 338 | RX_HANDLER(CARD_STATE_NOTIFICATION, iwl_mvm_rx_card_state_notif, |
afc857bc | 339 | RX_HANDLER_SYNC, struct iwl_card_state_notif), |
8ca151b5 | 340 | |
d64048ed | 341 | RX_HANDLER(MISSED_BEACONS_NOTIFICATION, iwl_mvm_rx_missed_beacons_notif, |
afc857bc | 342 | RX_HANDLER_SYNC, struct iwl_missed_beacons_notif), |
d64048ed | 343 | |
afc857bc JB |
344 | RX_HANDLER(REPLY_ERROR, iwl_mvm_rx_fw_error, RX_HANDLER_SYNC, |
345 | struct iwl_error_resp), | |
175a70b7 | 346 | RX_HANDLER(PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION, |
afc857bc JB |
347 | iwl_mvm_power_uapsd_misbehaving_ap_notif, RX_HANDLER_SYNC, |
348 | struct iwl_uapsd_misbehaving_ap_notif), | |
349 | RX_HANDLER_NO_SIZE(DTS_MEASUREMENT_NOTIFICATION, iwl_mvm_temp_notif, | |
350 | RX_HANDLER_ASYNC_LOCKED), | |
351 | RX_HANDLER_GRP_NO_SIZE(PHY_OPS_GROUP, DTS_MEASUREMENT_NOTIF_WIDE, | |
352 | iwl_mvm_temp_notif, RX_HANDLER_ASYNC_UNLOCKED), | |
0a3b7119 | 353 | RX_HANDLER_GRP(PHY_OPS_GROUP, CT_KILL_NOTIFICATION, |
afc857bc JB |
354 | iwl_mvm_ct_kill_notif, RX_HANDLER_SYNC, |
355 | struct ct_kill_notif), | |
ea9af24d | 356 | |
1d3c3f63 | 357 | RX_HANDLER(TDLS_CHANNEL_SWITCH_NOTIFICATION, iwl_mvm_rx_tdls_notif, |
afc857bc JB |
358 | RX_HANDLER_ASYNC_LOCKED, |
359 | struct iwl_tdls_channel_switch_notif), | |
c9cb14a6 | 360 | RX_HANDLER(MFUART_LOAD_NOTIFICATION, iwl_mvm_rx_mfuart_notif, |
afc857bc | 361 | RX_HANDLER_SYNC, struct iwl_mfuart_load_notif_v1), |
b73f9a4a | 362 | RX_HANDLER_GRP(LOCATION_GROUP, TOF_RESPONDER_STATS, |
afc857bc JB |
363 | iwl_mvm_ftm_responder_stats, RX_HANDLER_ASYNC_LOCKED, |
364 | struct iwl_ftm_responder_stats), | |
fc36ffda | 365 | |
afc857bc JB |
366 | RX_HANDLER_GRP_NO_SIZE(LOCATION_GROUP, TOF_RANGE_RESPONSE_NOTIF, |
367 | iwl_mvm_ftm_range_resp, RX_HANDLER_ASYNC_LOCKED), | |
368 | RX_HANDLER_GRP_NO_SIZE(LOCATION_GROUP, TOF_LC_NOTIF, | |
369 | iwl_mvm_ftm_lc_notif, RX_HANDLER_ASYNC_LOCKED), | |
fc36ffda | 370 | |
bdccdb85 | 371 | RX_HANDLER_GRP(DEBUG_GROUP, MFU_ASSERT_DUMP_NTF, |
afc857bc JB |
372 | iwl_mvm_mfu_assert_dump_notif, RX_HANDLER_SYNC, |
373 | struct iwl_mfu_assert_dump_notif), | |
0db056d3 | 374 | RX_HANDLER_GRP(PROT_OFFLOAD_GROUP, STORED_BEACON_NTF, |
afc857bc JB |
375 | iwl_mvm_rx_stored_beacon_notif, RX_HANDLER_SYNC, |
376 | struct iwl_stored_beacon_notif), | |
f92659a1 | 377 | RX_HANDLER_GRP(DATA_PATH_GROUP, MU_GROUP_MGMT_NOTIF, |
afc857bc JB |
378 | iwl_mvm_mu_mimo_grp_notif, RX_HANDLER_SYNC, |
379 | struct iwl_mu_group_mgmt_notif), | |
65e25482 | 380 | RX_HANDLER_GRP(DATA_PATH_GROUP, STA_PM_NOTIF, |
afc857bc JB |
381 | iwl_mvm_sta_pm_notif, RX_HANDLER_SYNC, |
382 | struct iwl_mvm_pm_state_notification), | |
8a59d390 JB |
383 | RX_HANDLER_GRP(MAC_CONF_GROUP, PROBE_RESPONSE_DATA_NOTIF, |
384 | iwl_mvm_probe_resp_data_notif, | |
afc857bc JB |
385 | RX_HANDLER_ASYNC_LOCKED, |
386 | struct iwl_probe_resp_data_notif), | |
8a59d390 JB |
387 | RX_HANDLER_GRP(MAC_CONF_GROUP, CHANNEL_SWITCH_NOA_NOTIF, |
388 | iwl_mvm_channel_switch_noa_notif, | |
afc857bc | 389 | RX_HANDLER_SYNC, struct iwl_channel_switch_noa_notif), |
f7d6ef33 JB |
390 | RX_HANDLER_GRP(DATA_PATH_GROUP, MONITOR_NOTIF, |
391 | iwl_mvm_rx_monitor_notif, RX_HANDLER_ASYNC_LOCKED, | |
392 | struct iwl_datapath_monitor_notif), | |
2a7ce54c JB |
393 | |
394 | RX_HANDLER_GRP(DATA_PATH_GROUP, THERMAL_DUAL_CHAIN_REQUEST, | |
395 | iwl_mvm_rx_thermal_dual_chain_req, | |
396 | RX_HANDLER_ASYNC_LOCKED, | |
397 | struct iwl_thermal_dual_chain_request), | |
8ca151b5 JB |
398 | }; |
399 | #undef RX_HANDLER | |
1230b16b | 400 | #undef RX_HANDLER_GRP |
39bdb17e SD |
401 | |
402 | /* Please keep this array *SORTED* by hex value. | |
403 | * Access is done through binary search | |
404 | */ | |
405 | static const struct iwl_hcmd_names iwl_mvm_legacy_names[] = { | |
9422b978 | 406 | HCMD_NAME(UCODE_ALIVE_NTFY), |
39bdb17e SD |
407 | HCMD_NAME(REPLY_ERROR), |
408 | HCMD_NAME(ECHO_CMD), | |
409 | HCMD_NAME(INIT_COMPLETE_NOTIF), | |
410 | HCMD_NAME(PHY_CONTEXT_CMD), | |
411 | HCMD_NAME(DBG_CFG), | |
39bdb17e SD |
412 | HCMD_NAME(SCAN_CFG_CMD), |
413 | HCMD_NAME(SCAN_REQ_UMAC), | |
414 | HCMD_NAME(SCAN_ABORT_UMAC), | |
415 | HCMD_NAME(SCAN_COMPLETE_UMAC), | |
3af512d6 | 416 | HCMD_NAME(BA_WINDOW_STATUS_NOTIFICATION_ID), |
39bdb17e SD |
417 | HCMD_NAME(ADD_STA_KEY), |
418 | HCMD_NAME(ADD_STA), | |
419 | HCMD_NAME(REMOVE_STA), | |
420 | HCMD_NAME(FW_GET_ITEM_CMD), | |
421 | HCMD_NAME(TX_CMD), | |
422 | HCMD_NAME(SCD_QUEUE_CFG), | |
423 | HCMD_NAME(TXPATH_FLUSH), | |
424 | HCMD_NAME(MGMT_MCAST_KEY), | |
425 | HCMD_NAME(WEP_KEY), | |
426 | HCMD_NAME(SHARED_MEM_CFG), | |
427 | HCMD_NAME(TDLS_CHANNEL_SWITCH_CMD), | |
428 | HCMD_NAME(MAC_CONTEXT_CMD), | |
429 | HCMD_NAME(TIME_EVENT_CMD), | |
430 | HCMD_NAME(TIME_EVENT_NOTIFICATION), | |
431 | HCMD_NAME(BINDING_CONTEXT_CMD), | |
432 | HCMD_NAME(TIME_QUOTA_CMD), | |
433 | HCMD_NAME(NON_QOS_TX_COUNTER_CMD), | |
7089ae63 | 434 | HCMD_NAME(LEDS_CMD), |
39bdb17e SD |
435 | HCMD_NAME(LQ_CMD), |
436 | HCMD_NAME(FW_PAGING_BLOCK_CMD), | |
437 | HCMD_NAME(SCAN_OFFLOAD_REQUEST_CMD), | |
438 | HCMD_NAME(SCAN_OFFLOAD_ABORT_CMD), | |
439 | HCMD_NAME(HOT_SPOT_CMD), | |
440 | HCMD_NAME(SCAN_OFFLOAD_PROFILES_QUERY_CMD), | |
39bdb17e SD |
441 | HCMD_NAME(BT_COEX_UPDATE_REDUCED_TXP), |
442 | HCMD_NAME(BT_COEX_CI), | |
443 | HCMD_NAME(PHY_CONFIGURATION_CMD), | |
444 | HCMD_NAME(CALIB_RES_NOTIF_PHY_DB), | |
176aa60b | 445 | HCMD_NAME(PHY_DB_CMD), |
39bdb17e SD |
446 | HCMD_NAME(SCAN_OFFLOAD_COMPLETE), |
447 | HCMD_NAME(SCAN_OFFLOAD_UPDATE_PROFILES_CMD), | |
39bdb17e SD |
448 | HCMD_NAME(POWER_TABLE_CMD), |
449 | HCMD_NAME(PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION), | |
450 | HCMD_NAME(REPLY_THERMAL_MNG_BACKOFF), | |
451 | HCMD_NAME(DC2DC_CONFIG_CMD), | |
452 | HCMD_NAME(NVM_ACCESS_CMD), | |
39bdb17e SD |
453 | HCMD_NAME(BEACON_NOTIFICATION), |
454 | HCMD_NAME(BEACON_TEMPLATE_CMD), | |
455 | HCMD_NAME(TX_ANT_CONFIGURATION_CMD), | |
456 | HCMD_NAME(BT_CONFIG), | |
457 | HCMD_NAME(STATISTICS_CMD), | |
458 | HCMD_NAME(STATISTICS_NOTIFICATION), | |
459 | HCMD_NAME(EOSP_NOTIFICATION), | |
460 | HCMD_NAME(REDUCE_TX_POWER_CMD), | |
39bdb17e SD |
461 | HCMD_NAME(CARD_STATE_NOTIFICATION), |
462 | HCMD_NAME(MISSED_BEACONS_NOTIFICATION), | |
463 | HCMD_NAME(TDLS_CONFIG_CMD), | |
464 | HCMD_NAME(MAC_PM_POWER_TABLE), | |
465 | HCMD_NAME(TDLS_CHANNEL_SWITCH_NOTIFICATION), | |
466 | HCMD_NAME(MFUART_LOAD_NOTIFICATION), | |
43413a97 | 467 | HCMD_NAME(RSS_CONFIG_CMD), |
39bdb17e SD |
468 | HCMD_NAME(SCAN_ITERATION_COMPLETE_UMAC), |
469 | HCMD_NAME(REPLY_RX_PHY_CMD), | |
470 | HCMD_NAME(REPLY_RX_MPDU_CMD), | |
fe69b7d1 | 471 | HCMD_NAME(BAR_FRAME_RELEASE), |
3e73aa3b | 472 | HCMD_NAME(FRAME_RELEASE), |
39bdb17e SD |
473 | HCMD_NAME(BA_NOTIF), |
474 | HCMD_NAME(MCC_UPDATE_CMD), | |
475 | HCMD_NAME(MCC_CHUB_UPDATE_CMD), | |
476 | HCMD_NAME(MARKER_CMD), | |
39bdb17e SD |
477 | HCMD_NAME(BT_PROFILE_NOTIFICATION), |
478 | HCMD_NAME(BCAST_FILTER_CMD), | |
479 | HCMD_NAME(MCAST_FILTER_CMD), | |
480 | HCMD_NAME(REPLY_SF_CFG_CMD), | |
481 | HCMD_NAME(REPLY_BEACON_FILTERING_CMD), | |
482 | HCMD_NAME(D3_CONFIG_CMD), | |
483 | HCMD_NAME(PROT_OFFLOAD_CONFIG_CMD), | |
484 | HCMD_NAME(OFFLOADS_QUERY_CMD), | |
39bdb17e | 485 | HCMD_NAME(MATCH_FOUND_NOTIFICATION), |
39bdb17e SD |
486 | HCMD_NAME(DTS_MEASUREMENT_NOTIFICATION), |
487 | HCMD_NAME(WOWLAN_PATTERNS), | |
488 | HCMD_NAME(WOWLAN_CONFIGURATION), | |
489 | HCMD_NAME(WOWLAN_TSC_RSC_PARAM), | |
490 | HCMD_NAME(WOWLAN_TKIP_PARAM), | |
491 | HCMD_NAME(WOWLAN_KEK_KCK_MATERIAL), | |
492 | HCMD_NAME(WOWLAN_GET_STATUSES), | |
39bdb17e SD |
493 | HCMD_NAME(SCAN_ITERATION_COMPLETE), |
494 | HCMD_NAME(D0I3_END_CMD), | |
495 | HCMD_NAME(LTR_CONFIG), | |
60ced797 | 496 | HCMD_NAME(LDBG_CONFIG_CMD), |
8ca151b5 | 497 | }; |
39bdb17e | 498 | |
5b086414 GBA |
499 | /* Please keep this array *SORTED* by hex value. |
500 | * Access is done through binary search | |
501 | */ | |
502 | static const struct iwl_hcmd_names iwl_mvm_system_names[] = { | |
503 | HCMD_NAME(SHARED_MEM_CFG_CMD), | |
4399caaa | 504 | HCMD_NAME(INIT_EXTENDED_CFG_CMD), |
f130bb75 | 505 | HCMD_NAME(FW_ERROR_RECOVERY_CMD), |
5b086414 GBA |
506 | }; |
507 | ||
03098268 AE |
508 | /* Please keep this array *SORTED* by hex value. |
509 | * Access is done through binary search | |
510 | */ | |
511 | static const struct iwl_hcmd_names iwl_mvm_mac_conf_names[] = { | |
74a10252 | 512 | HCMD_NAME(CHANNEL_SWITCH_TIME_EVENT_CMD), |
fe959c7b EG |
513 | HCMD_NAME(SESSION_PROTECTION_CMD), |
514 | HCMD_NAME(SESSION_PROTECTION_NOTIF), | |
d3a108a4 | 515 | HCMD_NAME(CHANNEL_SWITCH_NOA_NOTIF), |
03098268 AE |
516 | }; |
517 | ||
39bdb17e SD |
518 | /* Please keep this array *SORTED* by hex value. |
519 | * Access is done through binary search | |
520 | */ | |
521 | static const struct iwl_hcmd_names iwl_mvm_phy_names[] = { | |
522 | HCMD_NAME(CMD_DTS_MEASUREMENT_TRIGGER_WIDE), | |
5c89e7bc | 523 | HCMD_NAME(CTDP_CONFIG_CMD), |
c221daf2 | 524 | HCMD_NAME(TEMP_REPORTING_THRESHOLDS_CMD), |
a6bff3cb | 525 | HCMD_NAME(GEO_TX_POWER_LIMIT), |
0a3b7119 | 526 | HCMD_NAME(CT_KILL_NOTIFICATION), |
39bdb17e SD |
527 | HCMD_NAME(DTS_MEASUREMENT_NOTIF_WIDE), |
528 | }; | |
529 | ||
e0d8fdec SS |
530 | /* Please keep this array *SORTED* by hex value. |
531 | * Access is done through binary search | |
532 | */ | |
533 | static const struct iwl_hcmd_names iwl_mvm_data_path_names[] = { | |
ddef2f98 | 534 | HCMD_NAME(DQA_ENABLE_CMD), |
e0d8fdec | 535 | HCMD_NAME(UPDATE_MU_GROUPS_CMD), |
94bb4481 | 536 | HCMD_NAME(TRIGGER_RX_QUEUES_NOTIF_CMD), |
514c3069 | 537 | HCMD_NAME(STA_HE_CTXT_CMD), |
8edbfaa1 | 538 | HCMD_NAME(RFH_QUEUE_CONFIG_CMD), |
f4056d71 | 539 | HCMD_NAME(TLC_MNG_CONFIG_CMD), |
5213e8a8 | 540 | HCMD_NAME(CHEST_COLLECTOR_FILTER_CONFIG_CMD), |
f7d6ef33 | 541 | HCMD_NAME(MONITOR_NOTIF), |
2a7ce54c | 542 | HCMD_NAME(THERMAL_DUAL_CHAIN_REQUEST), |
65e25482 | 543 | HCMD_NAME(STA_PM_NOTIF), |
f92659a1 | 544 | HCMD_NAME(MU_GROUP_MGMT_NOTIF), |
94bb4481 | 545 | HCMD_NAME(RX_QUEUES_NOTIFICATION), |
e0d8fdec SS |
546 | }; |
547 | ||
6c161980 JB |
548 | /* Please keep this array *SORTED* by hex value. |
549 | * Access is done through binary search | |
550 | */ | |
551 | static const struct iwl_hcmd_names iwl_mvm_location_names[] = { | |
552 | HCMD_NAME(TOF_RANGE_REQ_CMD), | |
553 | HCMD_NAME(TOF_CONFIG_CMD), | |
554 | HCMD_NAME(TOF_RANGE_ABORT_CMD), | |
555 | HCMD_NAME(TOF_RANGE_REQ_EXT_CMD), | |
556 | HCMD_NAME(TOF_RESPONDER_CONFIG_CMD), | |
557 | HCMD_NAME(TOF_RESPONDER_DYN_CONFIG_CMD), | |
558 | HCMD_NAME(TOF_LC_NOTIF), | |
559 | HCMD_NAME(TOF_RESPONDER_STATS), | |
560 | HCMD_NAME(TOF_MCSI_DEBUG_NOTIF), | |
561 | HCMD_NAME(TOF_RANGE_RESPONSE_NOTIF), | |
562 | }; | |
563 | ||
0db056d3 SS |
564 | /* Please keep this array *SORTED* by hex value. |
565 | * Access is done through binary search | |
566 | */ | |
567 | static const struct iwl_hcmd_names iwl_mvm_prot_offload_names[] = { | |
568 | HCMD_NAME(STORED_BEACON_NTF), | |
569 | }; | |
570 | ||
1f370650 SS |
571 | /* Please keep this array *SORTED* by hex value. |
572 | * Access is done through binary search | |
573 | */ | |
574 | static const struct iwl_hcmd_names iwl_mvm_regulatory_and_nvm_names[] = { | |
575 | HCMD_NAME(NVM_ACCESS_COMPLETE), | |
e9e1ba3d | 576 | HCMD_NAME(NVM_GET_INFO), |
28dd7ccd | 577 | HCMD_NAME(TAS_CONFIG), |
1f370650 SS |
578 | }; |
579 | ||
39bdb17e SD |
580 | static const struct iwl_hcmd_arr iwl_mvm_groups[] = { |
581 | [LEGACY_GROUP] = HCMD_ARR(iwl_mvm_legacy_names), | |
582 | [LONG_GROUP] = HCMD_ARR(iwl_mvm_legacy_names), | |
5b086414 | 583 | [SYSTEM_GROUP] = HCMD_ARR(iwl_mvm_system_names), |
03098268 | 584 | [MAC_CONF_GROUP] = HCMD_ARR(iwl_mvm_mac_conf_names), |
39bdb17e | 585 | [PHY_OPS_GROUP] = HCMD_ARR(iwl_mvm_phy_names), |
e0d8fdec | 586 | [DATA_PATH_GROUP] = HCMD_ARR(iwl_mvm_data_path_names), |
6c161980 | 587 | [LOCATION_GROUP] = HCMD_ARR(iwl_mvm_location_names), |
0db056d3 | 588 | [PROT_OFFLOAD_GROUP] = HCMD_ARR(iwl_mvm_prot_offload_names), |
1f370650 SS |
589 | [REGULATORY_AND_NVM_GROUP] = |
590 | HCMD_ARR(iwl_mvm_regulatory_and_nvm_names), | |
39bdb17e SD |
591 | }; |
592 | ||
8ca151b5 JB |
593 | /* this forward declaration can avoid to export the function */ |
594 | static void iwl_mvm_async_handlers_wk(struct work_struct *wk); | |
595 | ||
f2abcfa6 | 596 | static u32 iwl_mvm_min_backoff(struct iwl_mvm *mvm) |
0c0e2c71 | 597 | { |
f2abcfa6 LC |
598 | const struct iwl_pwr_tx_backoff *backoff = mvm->cfg->pwr_tx_backoffs; |
599 | u64 dflt_pwr_limit; | |
0c0e2c71 | 600 | |
f2abcfa6 | 601 | if (!backoff) |
0c0e2c71 IY |
602 | return 0; |
603 | ||
f2abcfa6 | 604 | dflt_pwr_limit = iwl_acpi_get_pwr_limit(mvm->dev); |
0c0e2c71 | 605 | |
f2abcfa6 LC |
606 | while (backoff->pwr) { |
607 | if (dflt_pwr_limit >= backoff->pwr) | |
608 | return backoff->backoff; | |
609 | ||
610 | backoff++; | |
0c0e2c71 IY |
611 | } |
612 | ||
613 | return 0; | |
614 | } | |
615 | ||
d3a108a4 AO |
616 | static void iwl_mvm_tx_unblock_dwork(struct work_struct *work) |
617 | { | |
618 | struct iwl_mvm *mvm = | |
619 | container_of(work, struct iwl_mvm, cs_tx_unblock_dwork.work); | |
620 | struct ieee80211_vif *tx_blocked_vif; | |
621 | struct iwl_mvm_vif *mvmvif; | |
622 | ||
623 | mutex_lock(&mvm->mutex); | |
624 | ||
625 | tx_blocked_vif = | |
626 | rcu_dereference_protected(mvm->csa_tx_blocked_vif, | |
627 | lockdep_is_held(&mvm->mutex)); | |
628 | ||
629 | if (!tx_blocked_vif) | |
630 | goto unlock; | |
631 | ||
632 | mvmvif = iwl_mvm_vif_from_mac80211(tx_blocked_vif); | |
633 | iwl_mvm_modify_all_sta_disable_tx(mvm, mvmvif, false); | |
634 | RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL); | |
635 | unlock: | |
636 | mutex_unlock(&mvm->mutex); | |
637 | } | |
638 | ||
7174beb6 JB |
639 | static int iwl_mvm_fwrt_dump_start(void *ctx) |
640 | { | |
641 | struct iwl_mvm *mvm = ctx; | |
c7ab138e SM |
642 | |
643 | mutex_lock(&mvm->mutex); | |
7174beb6 | 644 | |
58d3bef4 | 645 | return 0; |
7174beb6 JB |
646 | } |
647 | ||
648 | static void iwl_mvm_fwrt_dump_end(void *ctx) | |
649 | { | |
650 | struct iwl_mvm *mvm = ctx; | |
651 | ||
c7ab138e | 652 | mutex_unlock(&mvm->mutex); |
7174beb6 JB |
653 | } |
654 | ||
8745f12a ST |
655 | static bool iwl_mvm_fwrt_fw_running(void *ctx) |
656 | { | |
657 | return iwl_mvm_firmware_running(ctx); | |
658 | } | |
659 | ||
d3f4b6de SM |
660 | static int iwl_mvm_fwrt_send_hcmd(void *ctx, struct iwl_host_cmd *host_cmd) |
661 | { | |
662 | struct iwl_mvm *mvm = (struct iwl_mvm *)ctx; | |
663 | int ret; | |
664 | ||
665 | mutex_lock(&mvm->mutex); | |
666 | ret = iwl_mvm_send_cmd(mvm, host_cmd); | |
667 | mutex_unlock(&mvm->mutex); | |
668 | ||
669 | return ret; | |
670 | } | |
671 | ||
971377e6 SM |
672 | static bool iwl_mvm_d3_debug_enable(void *ctx) |
673 | { | |
674 | return IWL_MVM_D3_DEBUG; | |
675 | } | |
676 | ||
7174beb6 JB |
677 | static const struct iwl_fw_runtime_ops iwl_mvm_fwrt_ops = { |
678 | .dump_start = iwl_mvm_fwrt_dump_start, | |
679 | .dump_end = iwl_mvm_fwrt_dump_end, | |
8745f12a | 680 | .fw_running = iwl_mvm_fwrt_fw_running, |
d3f4b6de | 681 | .send_hcmd = iwl_mvm_fwrt_send_hcmd, |
971377e6 | 682 | .d3_debug_enable = iwl_mvm_d3_debug_enable, |
7174beb6 JB |
683 | }; |
684 | ||
aacee681 EG |
685 | static int iwl_mvm_start_get_nvm(struct iwl_mvm *mvm) |
686 | { | |
687 | int ret; | |
688 | ||
689 | mutex_lock(&mvm->mutex); | |
690 | ||
691 | ret = iwl_run_init_mvm_ucode(mvm); | |
692 | ||
693 | if (ret && ret != -ERFKILL) | |
694 | iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER); | |
eb09ae93 MK |
695 | if (!ret && iwl_mvm_is_lar_supported(mvm)) { |
696 | mvm->hw->wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; | |
697 | ret = iwl_mvm_init_mcc(mvm); | |
698 | } | |
aacee681 EG |
699 | |
700 | if (!iwlmvm_mod_params.init_dbg || !ret) | |
701 | iwl_mvm_stop_device(mvm); | |
702 | ||
703 | mutex_unlock(&mvm->mutex); | |
eb09ae93 | 704 | rtnl_unlock(); |
aacee681 EG |
705 | |
706 | if (ret < 0) | |
707 | IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret); | |
708 | ||
709 | return ret; | |
710 | } | |
711 | ||
13b5fa95 EG |
712 | static int iwl_mvm_start_post_nvm(struct iwl_mvm *mvm) |
713 | { | |
714 | int ret; | |
715 | ||
716 | iwl_mvm_toggle_tx_ant(mvm, &mvm->mgmt_last_antenna_idx); | |
717 | ||
718 | ret = iwl_mvm_mac_setup_register(mvm); | |
719 | if (ret) | |
720 | return ret; | |
721 | mvm->hw_registered = true; | |
722 | ||
723 | iwl_mvm_dbgfs_register(mvm); | |
724 | ||
725 | return 0; | |
726 | } | |
727 | ||
8ca151b5 JB |
728 | static struct iwl_op_mode * |
729 | iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |
730 | const struct iwl_fw *fw, struct dentry *dbgfs_dir) | |
731 | { | |
732 | struct ieee80211_hw *hw; | |
733 | struct iwl_op_mode *op_mode; | |
734 | struct iwl_mvm *mvm; | |
735 | struct iwl_trans_config trans_cfg = {}; | |
736 | static const u8 no_reclaim_cmds[] = { | |
737 | TX_CMD, | |
738 | }; | |
739 | int err, scan_size; | |
0c0e2c71 | 740 | u32 min_backoff; |
034925cb | 741 | enum iwl_amsdu_size rb_size_default; |
8ca151b5 | 742 | |
c4d83271 | 743 | /* |
be9ae34e | 744 | * We use IWL_MVM_STATION_COUNT_MAX to check the validity of the station |
c4d83271 EG |
745 | * index all over the driver - check that its value corresponds to the |
746 | * array size. | |
747 | */ | |
be9ae34e NE |
748 | BUILD_BUG_ON(ARRAY_SIZE(mvm->fw_id_to_mac_id) != |
749 | IWL_MVM_STATION_COUNT_MAX); | |
c4d83271 | 750 | |
8ca151b5 JB |
751 | /******************************** |
752 | * 1. Allocating and configuring HW data | |
753 | ********************************/ | |
754 | hw = ieee80211_alloc_hw(sizeof(struct iwl_op_mode) + | |
755 | sizeof(struct iwl_mvm), | |
756 | &iwl_mvm_hw_ops); | |
757 | if (!hw) | |
758 | return NULL; | |
759 | ||
49b7b35c | 760 | hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; |
745160ee | 761 | |
77d96730 GG |
762 | if (cfg->max_tx_agg_size) |
763 | hw->max_tx_aggregation_subframes = cfg->max_tx_agg_size; | |
1eda295f JB |
764 | else |
765 | hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; | |
77d96730 | 766 | |
8ca151b5 | 767 | op_mode = hw->priv; |
8ca151b5 JB |
768 | |
769 | mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
770 | mvm->dev = trans->dev; | |
771 | mvm->trans = trans; | |
772 | mvm->cfg = cfg; | |
773 | mvm->fw = fw; | |
774 | mvm->hw = hw; | |
775 | ||
93b167c1 MG |
776 | iwl_fw_runtime_init(&mvm->fwrt, trans, fw, &iwl_mvm_fwrt_ops, mvm, |
777 | dbgfs_dir); | |
235acb18 | 778 | |
78a19d52 MK |
779 | iwl_mvm_get_acpi_tables(mvm); |
780 | ||
de8ba41b LK |
781 | mvm->init_status = 0; |
782 | ||
0316d30e JB |
783 | if (iwl_mvm_has_new_rx_api(mvm)) { |
784 | op_mode->ops = &iwl_mvm_ops_mq; | |
18ead597 | 785 | trans->rx_mpdu_cmd_hdr_size = |
286ca8eb | 786 | (trans->trans_cfg->device_family >= |
3681021f | 787 | IWL_DEVICE_FAMILY_AX210) ? |
18ead597 GBA |
788 | sizeof(struct iwl_rx_mpdu_desc) : |
789 | IWL_RX_DESC_SIZE_V1; | |
0316d30e JB |
790 | } else { |
791 | op_mode->ops = &iwl_mvm_ops; | |
25c2b22c SS |
792 | trans->rx_mpdu_cmd_hdr_size = |
793 | sizeof(struct iwl_rx_mpdu_res_start); | |
0316d30e JB |
794 | |
795 | if (WARN_ON(trans->num_rx_queues > 1)) | |
796 | goto out_free; | |
797 | } | |
798 | ||
3b37f4c9 | 799 | mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0; |
291aa7c4 | 800 | |
c6ce1c74 JB |
801 | if (iwl_mvm_has_new_tx_api(mvm)) { |
802 | /* | |
803 | * If we have the new TX/queue allocation API initialize them | |
804 | * all to invalid numbers. We'll rewrite the ones that we need | |
805 | * later, but that doesn't happen for all of them all of the | |
806 | * time (e.g. P2P Device is optional), and if a dynamic queue | |
807 | * ends up getting number 2 (IWL_MVM_DQA_P2P_DEVICE_QUEUE) then | |
808 | * iwl_mvm_is_static_queue() erroneously returns true, and we | |
809 | * might have things getting stuck. | |
810 | */ | |
811 | mvm->aux_queue = IWL_MVM_INVALID_QUEUE; | |
812 | mvm->snif_queue = IWL_MVM_INVALID_QUEUE; | |
813 | mvm->probe_queue = IWL_MVM_INVALID_QUEUE; | |
814 | mvm->p2p_dev_queue = IWL_MVM_INVALID_QUEUE; | |
815 | } else { | |
816 | mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE; | |
817 | mvm->snif_queue = IWL_MVM_DQA_INJECT_MONITOR_QUEUE; | |
818 | mvm->probe_queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE; | |
819 | mvm->p2p_dev_queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE; | |
820 | } | |
c8f54701 | 821 | |
1f3b0ff8 | 822 | mvm->sf_state = SF_UNINIT; |
7d6222e2 | 823 | if (iwl_mvm_has_unified_ucode(mvm)) |
702e975d | 824 | iwl_fw_set_current_image(&mvm->fwrt, IWL_UCODE_REGULAR); |
1f370650 | 825 | else |
702e975d | 826 | iwl_fw_set_current_image(&mvm->fwrt, IWL_UCODE_INIT); |
c89e333d | 827 | mvm->drop_bcn_ap_mode = true; |
19e737c9 | 828 | |
8ca151b5 JB |
829 | mutex_init(&mvm->mutex); |
830 | spin_lock_init(&mvm->async_handlers_lock); | |
831 | INIT_LIST_HEAD(&mvm->time_event_list); | |
b112889c | 832 | INIT_LIST_HEAD(&mvm->aux_roc_te_list); |
8ca151b5 JB |
833 | INIT_LIST_HEAD(&mvm->async_handlers_list); |
834 | spin_lock_init(&mvm->time_event_lock); | |
fc36ffda | 835 | INIT_LIST_HEAD(&mvm->ftm_initiator.loc_list); |
0739a7d7 | 836 | INIT_LIST_HEAD(&mvm->ftm_initiator.pasn_list); |
be82ecd3 | 837 | INIT_LIST_HEAD(&mvm->resp_pasn_list); |
8ca151b5 JB |
838 | |
839 | INIT_WORK(&mvm->async_handlers_wk, iwl_mvm_async_handlers_wk); | |
840 | INIT_WORK(&mvm->roc_done_wk, iwl_mvm_roc_done_wk); | |
1d3c3f63 | 841 | INIT_DELAYED_WORK(&mvm->tdls_cs.dwork, iwl_mvm_tdls_ch_switch_work); |
69e04642 | 842 | INIT_DELAYED_WORK(&mvm->scan_timeout_dwork, iwl_mvm_scan_timeout_wk); |
24afba76 | 843 | INIT_WORK(&mvm->add_stream_wk, iwl_mvm_add_new_dqa_stream_wk); |
cfbc6c4c | 844 | INIT_LIST_HEAD(&mvm->add_stream_txqs); |
8ca151b5 | 845 | |
3a732c65 | 846 | init_waitqueue_head(&mvm->rx_sync_waitq); |
b2492501 | 847 | |
2f7a04c7 | 848 | mvm->queue_sync_state = 0; |
0636b938 | 849 | |
8ca151b5 JB |
850 | SET_IEEE80211_DEV(mvm->hw, mvm->trans->dev); |
851 | ||
7d9d0d56 LC |
852 | spin_lock_init(&mvm->tcm.lock); |
853 | INIT_DELAYED_WORK(&mvm->tcm.work, iwl_mvm_tcm_work); | |
854 | mvm->tcm.ts = jiffies; | |
855 | mvm->tcm.ll_ts = jiffies; | |
856 | mvm->tcm.uapsd_nonagg_ts = jiffies; | |
857 | ||
d3a108a4 AO |
858 | INIT_DELAYED_WORK(&mvm->cs_tx_unblock_dwork, iwl_mvm_tx_unblock_dwork); |
859 | ||
d3b4dc01 | 860 | mvm->cmd_ver.d0i3_resp = |
4af11950 MG |
861 | iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP, D0I3_END_CMD, |
862 | 0); | |
d3b4dc01 HD |
863 | /* we only support version 1 */ |
864 | if (WARN_ON_ONCE(mvm->cmd_ver.d0i3_resp > 1)) | |
865 | goto out_free; | |
866 | ||
1c096d89 AS |
867 | mvm->cmd_ver.range_resp = |
868 | iwl_fw_lookup_notif_ver(mvm->fw, LOCATION_GROUP, | |
869 | TOF_RANGE_RESPONSE_NOTIF, 5); | |
870 | /* we only support up to version 8 */ | |
871 | if (WARN_ON_ONCE(mvm->cmd_ver.range_resp > 8)) | |
872 | goto out_free; | |
873 | ||
8ca151b5 JB |
874 | /* |
875 | * Populate the state variables that the transport layer needs | |
876 | * to know about. | |
877 | */ | |
878 | trans_cfg.op_mode = op_mode; | |
879 | trans_cfg.no_reclaim_cmds = no_reclaim_cmds; | |
880 | trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); | |
034925cb | 881 | |
3681021f | 882 | if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) |
034925cb ST |
883 | rb_size_default = IWL_AMSDU_2K; |
884 | else | |
885 | rb_size_default = IWL_AMSDU_4K; | |
886 | ||
6c4fbcbc | 887 | switch (iwlwifi_mod_params.amsdu_size) { |
4bdd4dfe | 888 | case IWL_AMSDU_DEF: |
034925cb ST |
889 | trans_cfg.rx_buf_size = rb_size_default; |
890 | break; | |
6c4fbcbc EG |
891 | case IWL_AMSDU_4K: |
892 | trans_cfg.rx_buf_size = IWL_AMSDU_4K; | |
893 | break; | |
894 | case IWL_AMSDU_8K: | |
895 | trans_cfg.rx_buf_size = IWL_AMSDU_8K; | |
896 | break; | |
897 | case IWL_AMSDU_12K: | |
898 | trans_cfg.rx_buf_size = IWL_AMSDU_12K; | |
899 | break; | |
900 | default: | |
901 | pr_err("%s: Unsupported amsdu_size: %d\n", KBUILD_MODNAME, | |
902 | iwlwifi_mod_params.amsdu_size); | |
034925cb | 903 | trans_cfg.rx_buf_size = rb_size_default; |
6c4fbcbc | 904 | } |
4bdd4dfe | 905 | |
b7d96bca | 906 | trans->wide_cmd_header = true; |
2a182fbb | 907 | trans_cfg.bc_table_dword = |
3681021f | 908 | mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_AX210; |
8ca151b5 | 909 | |
39bdb17e SD |
910 | trans_cfg.command_groups = iwl_mvm_groups; |
911 | trans_cfg.command_groups_size = ARRAY_SIZE(iwl_mvm_groups); | |
8ca151b5 | 912 | |
c8f54701 | 913 | trans_cfg.cmd_queue = IWL_MVM_DQA_CMD_QUEUE; |
b2d81db7 | 914 | trans_cfg.cmd_fifo = IWL_MVM_TX_FIFO_CMD; |
3a736bcb | 915 | trans_cfg.scd_set_active = true; |
8ca151b5 | 916 | |
21cb3222 JB |
917 | trans_cfg.cb_data_offs = offsetof(struct ieee80211_tx_info, |
918 | driver_data[2]); | |
919 | ||
4cf677fd EG |
920 | /* Set a short watchdog for the command queue */ |
921 | trans_cfg.cmd_q_wdg_timeout = | |
5d42e7b2 | 922 | iwl_mvm_get_wd_timeout(mvm, NULL, false, true); |
4cf677fd | 923 | |
8ca151b5 JB |
924 | snprintf(mvm->hw->wiphy->fw_version, |
925 | sizeof(mvm->hw->wiphy->fw_version), | |
926 | "%s", fw->fw_version); | |
927 | ||
906d4eb8 JB |
928 | trans_cfg.fw_reset_handshake = fw_has_capa(&mvm->fw->ucode_capa, |
929 | IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE); | |
930 | ||
8ca151b5 JB |
931 | /* Configure transport layer */ |
932 | iwl_trans_configure(mvm->trans, &trans_cfg); | |
933 | ||
934 | trans->rx_mpdu_cmd = REPLY_RX_MPDU_CMD; | |
91c28b83 SM |
935 | trans->dbg.dest_tlv = mvm->fw->dbg.dest_tlv; |
936 | trans->dbg.n_dest_reg = mvm->fw->dbg.n_dest_reg; | |
937 | memcpy(trans->dbg.conf_tlv, mvm->fw->dbg.conf_tlv, | |
938 | sizeof(trans->dbg.conf_tlv)); | |
939 | trans->dbg.trigger_tlv = mvm->fw->dbg.trigger_tlv; | |
8ca151b5 | 940 | |
132db31c GBA |
941 | trans->iml = mvm->fw->iml; |
942 | trans->iml_len = mvm->fw->iml_len; | |
943 | ||
8ca151b5 JB |
944 | /* set up notification wait support */ |
945 | iwl_notification_wait_init(&mvm->notif_wait); | |
946 | ||
947 | /* Init phy db */ | |
948 | mvm->phy_db = iwl_phy_db_init(trans); | |
949 | if (!mvm->phy_db) { | |
950 | IWL_ERR(mvm, "Cannot init phy_db\n"); | |
951 | goto out_free; | |
952 | } | |
953 | ||
954 | IWL_INFO(mvm, "Detected %s, REV=0x%X\n", | |
0b295a1e | 955 | mvm->trans->name, mvm->trans->hw_rev); |
8ca151b5 | 956 | |
4fb06283 | 957 | if (iwlwifi_mod_params.nvm_file) |
e02a9d60 | 958 | mvm->nvm_file_name = iwlwifi_mod_params.nvm_file; |
4fb06283 EH |
959 | else |
960 | IWL_DEBUG_EEPROM(mvm->trans->dev, | |
961 | "working without external nvm file\n"); | |
9ee718aa | 962 | |
56f2929b SS |
963 | err = iwl_trans_start_hw(mvm->trans); |
964 | if (err) | |
14b485f0 EH |
965 | goto out_free; |
966 | ||
d2496221 | 967 | scan_size = iwl_mvm_scan_size(mvm); |
fb98be5e | 968 | |
8ca151b5 JB |
969 | mvm->scan_cmd = kmalloc(scan_size, GFP_KERNEL); |
970 | if (!mvm->scan_cmd) | |
971 | goto out_free; | |
972 | ||
e223e42a GG |
973 | /* invalidate ids to prevent accidental removal of sta_id 0 */ |
974 | mvm->aux_sta.sta_id = IWL_MVM_INVALID_STA; | |
975 | mvm->snif_sta.sta_id = IWL_MVM_INVALID_STA; | |
976 | ||
5a4b2afa HD |
977 | /* Set EBS as successful as long as not stated otherwise by the FW. */ |
978 | mvm->last_ebs_successful = true; | |
979 | ||
f2abcfa6 | 980 | min_backoff = iwl_mvm_min_backoff(mvm); |
04ddc2aa CRI |
981 | iwl_mvm_thermal_initialize(mvm, min_backoff); |
982 | ||
678d9b6d LK |
983 | if (!iwl_mvm_has_new_rx_stats_api(mvm)) |
984 | memset(&mvm->rx_stats_v3, 0, | |
985 | sizeof(struct mvm_statistics_rx_v3)); | |
986 | else | |
987 | memset(&mvm->rx_stats, 0, sizeof(struct mvm_statistics_rx)); | |
3848ab66 | 988 | |
13b5fa95 | 989 | mvm->debugfs_dir = dbgfs_dir; |
656fca00 | 990 | |
13b5fa95 | 991 | if (iwl_mvm_start_get_nvm(mvm)) |
46ad1ff9 | 992 | goto out_thermal_exit; |
46ad1ff9 | 993 | |
13b5fa95 EG |
994 | if (iwl_mvm_start_post_nvm(mvm)) |
995 | goto out_thermal_exit; | |
46ad1ff9 | 996 | |
8ca151b5 JB |
997 | return op_mode; |
998 | ||
46ad1ff9 EG |
999 | out_thermal_exit: |
1000 | iwl_mvm_thermal_exit(mvm); | |
8ca151b5 | 1001 | out_free: |
c7ab138e | 1002 | iwl_fw_flush_dumps(&mvm->fwrt); |
54f3f994 | 1003 | iwl_fw_runtime_free(&mvm->fwrt); |
de8ba41b LK |
1004 | |
1005 | if (iwlmvm_mod_params.init_dbg) | |
1006 | return op_mode; | |
8ca151b5 JB |
1007 | iwl_phy_db_free(mvm->phy_db); |
1008 | kfree(mvm->scan_cmd); | |
56f2929b SS |
1009 | iwl_trans_op_mode_leave(trans); |
1010 | ||
8ca151b5 JB |
1011 | ieee80211_free_hw(mvm->hw); |
1012 | return NULL; | |
1013 | } | |
1014 | ||
cf5b4627 JB |
1015 | void iwl_mvm_stop_device(struct iwl_mvm *mvm) |
1016 | { | |
1017 | lockdep_assert_held(&mvm->mutex); | |
1018 | ||
1019 | iwl_fw_cancel_timestamp(&mvm->fwrt); | |
1020 | ||
1021 | clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); | |
1022 | ||
1023 | iwl_fw_dbg_stop_sync(&mvm->fwrt); | |
1024 | iwl_trans_stop_device(mvm->trans); | |
1025 | iwl_free_fw_paging(&mvm->fwrt); | |
1026 | iwl_fw_dump_conf_clear(&mvm->fwrt); | |
1027 | } | |
1028 | ||
8ca151b5 JB |
1029 | static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode) |
1030 | { | |
1031 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
1032 | int i; | |
1033 | ||
1034 | iwl_mvm_leds_exit(mvm); | |
1035 | ||
c221daf2 | 1036 | iwl_mvm_thermal_exit(mvm); |
9ee718aa | 1037 | |
cad7eb75 | 1038 | ieee80211_unregister_hw(mvm->hw); |
8ca151b5 JB |
1039 | |
1040 | kfree(mvm->scan_cmd); | |
e59647ea EP |
1041 | kfree(mvm->mcast_filter_cmd); |
1042 | mvm->mcast_filter_cmd = NULL; | |
8ca151b5 | 1043 | |
f130bb75 MG |
1044 | kfree(mvm->error_recovery_buf); |
1045 | mvm->error_recovery_buf = NULL; | |
1046 | ||
a4082843 | 1047 | iwl_trans_op_mode_leave(mvm->trans); |
8ca151b5 JB |
1048 | |
1049 | iwl_phy_db_free(mvm->phy_db); | |
1050 | mvm->phy_db = NULL; | |
1051 | ||
1dad3e0a | 1052 | kfree(mvm->nvm_data); |
ae2b21b0 | 1053 | for (i = 0; i < NVM_MAX_NUM_SECTIONS; i++) |
8ca151b5 JB |
1054 | kfree(mvm->nvm_sections[i].data); |
1055 | ||
7d9d0d56 LC |
1056 | cancel_delayed_work_sync(&mvm->tcm.work); |
1057 | ||
54f3f994 | 1058 | iwl_fw_runtime_free(&mvm->fwrt); |
a2a57a35 | 1059 | mutex_destroy(&mvm->mutex); |
a2a57a35 | 1060 | |
8ca151b5 JB |
1061 | ieee80211_free_hw(mvm->hw); |
1062 | } | |
1063 | ||
1064 | struct iwl_async_handler_entry { | |
1065 | struct list_head list; | |
1066 | struct iwl_rx_cmd_buffer rxb; | |
c9cb14a6 | 1067 | enum iwl_rx_handler_context context; |
0416841d | 1068 | void (*fn)(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); |
8ca151b5 JB |
1069 | }; |
1070 | ||
1071 | void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm) | |
1072 | { | |
1073 | struct iwl_async_handler_entry *entry, *tmp; | |
1074 | ||
1075 | spin_lock_bh(&mvm->async_handlers_lock); | |
1076 | list_for_each_entry_safe(entry, tmp, &mvm->async_handlers_list, list) { | |
1077 | iwl_free_rxb(&entry->rxb); | |
1078 | list_del(&entry->list); | |
1079 | kfree(entry); | |
1080 | } | |
1081 | spin_unlock_bh(&mvm->async_handlers_lock); | |
1082 | } | |
1083 | ||
1084 | static void iwl_mvm_async_handlers_wk(struct work_struct *wk) | |
1085 | { | |
1086 | struct iwl_mvm *mvm = | |
1087 | container_of(wk, struct iwl_mvm, async_handlers_wk); | |
1088 | struct iwl_async_handler_entry *entry, *tmp; | |
8098203f | 1089 | LIST_HEAD(local_list); |
8ca151b5 JB |
1090 | |
1091 | /* Ensure that we are not in stop flow (check iwl_mvm_mac_stop) */ | |
8ca151b5 JB |
1092 | |
1093 | /* | |
1094 | * Sync with Rx path with a lock. Remove all the entries from this list, | |
1095 | * add them to a local one (lock free), and then handle them. | |
1096 | */ | |
1097 | spin_lock_bh(&mvm->async_handlers_lock); | |
1098 | list_splice_init(&mvm->async_handlers_list, &local_list); | |
1099 | spin_unlock_bh(&mvm->async_handlers_lock); | |
1100 | ||
1101 | list_for_each_entry_safe(entry, tmp, &local_list, list) { | |
c9cb14a6 CRI |
1102 | if (entry->context == RX_HANDLER_ASYNC_LOCKED) |
1103 | mutex_lock(&mvm->mutex); | |
0416841d | 1104 | entry->fn(mvm, &entry->rxb); |
8ca151b5 JB |
1105 | iwl_free_rxb(&entry->rxb); |
1106 | list_del(&entry->list); | |
c9cb14a6 CRI |
1107 | if (entry->context == RX_HANDLER_ASYNC_LOCKED) |
1108 | mutex_unlock(&mvm->mutex); | |
8ca151b5 JB |
1109 | kfree(entry); |
1110 | } | |
8ca151b5 JB |
1111 | } |
1112 | ||
917f39bb EG |
1113 | static inline void iwl_mvm_rx_check_trigger(struct iwl_mvm *mvm, |
1114 | struct iwl_rx_packet *pkt) | |
1115 | { | |
1116 | struct iwl_fw_dbg_trigger_tlv *trig; | |
1117 | struct iwl_fw_dbg_trigger_cmd *cmds_trig; | |
917f39bb EG |
1118 | int i; |
1119 | ||
6c042d75 SS |
1120 | trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, NULL, |
1121 | FW_DBG_TRIGGER_FW_NOTIF); | |
1122 | if (!trig) | |
917f39bb EG |
1123 | return; |
1124 | ||
917f39bb EG |
1125 | cmds_trig = (void *)trig->data; |
1126 | ||
917f39bb EG |
1127 | for (i = 0; i < ARRAY_SIZE(cmds_trig->cmds); i++) { |
1128 | /* don't collect on CMD 0 */ | |
1129 | if (!cmds_trig->cmds[i].cmd_id) | |
1130 | break; | |
1131 | ||
0ab66e6d SS |
1132 | if (cmds_trig->cmds[i].cmd_id != pkt->hdr.cmd || |
1133 | cmds_trig->cmds[i].group_id != pkt->hdr.group_id) | |
917f39bb EG |
1134 | continue; |
1135 | ||
7174beb6 JB |
1136 | iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, |
1137 | "CMD 0x%02x.%02x received", | |
1138 | pkt->hdr.group_id, pkt->hdr.cmd); | |
917f39bb EG |
1139 | break; |
1140 | } | |
1141 | } | |
1142 | ||
0316d30e JB |
1143 | static void iwl_mvm_rx_common(struct iwl_mvm *mvm, |
1144 | struct iwl_rx_cmd_buffer *rxb, | |
1145 | struct iwl_rx_packet *pkt) | |
8ca151b5 | 1146 | { |
afc857bc | 1147 | unsigned int pkt_len = iwl_rx_packet_payload_len(pkt); |
0316d30e | 1148 | int i; |
b108d8c7 | 1149 | union iwl_dbg_tlv_tp_data tp_data = { .fw_pkt = pkt }; |
1738d60b | 1150 | |
b108d8c7 SM |
1151 | iwl_dbg_tlv_time_point(&mvm->fwrt, |
1152 | IWL_FW_INI_TIME_POINT_FW_RSP_OR_NOTIF, &tp_data); | |
917f39bb EG |
1153 | iwl_mvm_rx_check_trigger(mvm, pkt); |
1154 | ||
8ca151b5 JB |
1155 | /* |
1156 | * Do the notification wait before RX handlers so | |
1157 | * even if the RX handler consumes the RXB we have | |
1158 | * access to it in the notification wait entry. | |
1159 | */ | |
1160 | iwl_notification_wait_notify(&mvm->notif_wait, pkt); | |
1161 | ||
1162 | for (i = 0; i < ARRAY_SIZE(iwl_mvm_rx_handlers); i++) { | |
1163 | const struct iwl_rx_handlers *rx_h = &iwl_mvm_rx_handlers[i]; | |
36eed56a EG |
1164 | struct iwl_async_handler_entry *entry; |
1165 | ||
1230b16b | 1166 | if (rx_h->cmd_id != WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd)) |
36eed56a EG |
1167 | continue; |
1168 | ||
afc857bc JB |
1169 | if (unlikely(pkt_len < rx_h->min_size)) |
1170 | return; | |
1171 | ||
c9cb14a6 | 1172 | if (rx_h->context == RX_HANDLER_SYNC) { |
0416841d | 1173 | rx_h->fn(mvm, rxb); |
f7e6469f | 1174 | return; |
0416841d | 1175 | } |
36eed56a EG |
1176 | |
1177 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); | |
1178 | /* we can't do much... */ | |
1179 | if (!entry) | |
f7e6469f | 1180 | return; |
36eed56a EG |
1181 | |
1182 | entry->rxb._page = rxb_steal_page(rxb); | |
1183 | entry->rxb._offset = rxb->_offset; | |
1184 | entry->rxb._rx_page_order = rxb->_rx_page_order; | |
1185 | entry->fn = rx_h->fn; | |
c9cb14a6 | 1186 | entry->context = rx_h->context; |
36eed56a EG |
1187 | spin_lock(&mvm->async_handlers_lock); |
1188 | list_add_tail(&entry->list, &mvm->async_handlers_list); | |
1189 | spin_unlock(&mvm->async_handlers_lock); | |
1190 | schedule_work(&mvm->async_handlers_wk); | |
07fb3299 | 1191 | break; |
8ca151b5 | 1192 | } |
8ca151b5 JB |
1193 | } |
1194 | ||
0316d30e JB |
1195 | static void iwl_mvm_rx(struct iwl_op_mode *op_mode, |
1196 | struct napi_struct *napi, | |
1197 | struct iwl_rx_cmd_buffer *rxb) | |
1198 | { | |
1199 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | |
1200 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
61b0f5d7 | 1201 | u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd); |
0316d30e | 1202 | |
61b0f5d7 | 1203 | if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD))) |
0316d30e | 1204 | iwl_mvm_rx_rx_mpdu(mvm, napi, rxb); |
61b0f5d7 | 1205 | else if (cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_PHY_CMD)) |
0316d30e JB |
1206 | iwl_mvm_rx_rx_phy_cmd(mvm, rxb); |
1207 | else | |
1208 | iwl_mvm_rx_common(mvm, rxb, pkt); | |
1209 | } | |
1210 | ||
88181e6e JB |
1211 | void iwl_mvm_rx_mq(struct iwl_op_mode *op_mode, |
1212 | struct napi_struct *napi, | |
1213 | struct iwl_rx_cmd_buffer *rxb) | |
0316d30e JB |
1214 | { |
1215 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | |
1216 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
61b0f5d7 | 1217 | u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd); |
0316d30e | 1218 | |
61b0f5d7 | 1219 | if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD))) |
780e87c2 | 1220 | iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, 0); |
61b0f5d7 JB |
1221 | else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP, |
1222 | RX_QUEUES_NOTIFICATION))) | |
c61b655a | 1223 | iwl_mvm_rx_queue_notif(mvm, napi, rxb, 0); |
61b0f5d7 | 1224 | else if (cmd == WIDE_ID(LEGACY_GROUP, FRAME_RELEASE)) |
58035432 | 1225 | iwl_mvm_rx_frame_release(mvm, napi, rxb, 0); |
fe69b7d1 JB |
1226 | else if (cmd == WIDE_ID(LEGACY_GROUP, BAR_FRAME_RELEASE)) |
1227 | iwl_mvm_rx_bar_frame_release(mvm, napi, rxb, 0); | |
bf9dfeda | 1228 | else if (cmd == WIDE_ID(DATA_PATH_GROUP, RX_NO_DATA_NOTIF)) |
d47cdb88 | 1229 | iwl_mvm_rx_monitor_no_data(mvm, napi, rxb, 0); |
0316d30e JB |
1230 | else |
1231 | iwl_mvm_rx_common(mvm, rxb, pkt); | |
1232 | } | |
1233 | ||
156f92f2 EG |
1234 | static void iwl_mvm_async_cb(struct iwl_op_mode *op_mode, |
1235 | const struct iwl_device_cmd *cmd) | |
1236 | { | |
1237 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
1238 | ||
1239 | /* | |
1240 | * For now, we only set the CMD_WANT_ASYNC_CALLBACK for ADD_STA | |
1241 | * commands that need to block the Tx queues. | |
1242 | */ | |
1243 | iwl_trans_block_txq_ptrs(mvm->trans, false); | |
1244 | } | |
1245 | ||
99944b73 AS |
1246 | static int iwl_mvm_is_static_queue(struct iwl_mvm *mvm, int queue) |
1247 | { | |
1248 | return queue == mvm->aux_queue || queue == mvm->probe_queue || | |
1249 | queue == mvm->p2p_dev_queue || queue == mvm->snif_queue; | |
1250 | } | |
1251 | ||
cfbc6c4c SS |
1252 | static void iwl_mvm_queue_state_change(struct iwl_op_mode *op_mode, |
1253 | int hw_queue, bool start) | |
8ca151b5 JB |
1254 | { |
1255 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
cfbc6c4c SS |
1256 | struct ieee80211_sta *sta; |
1257 | struct ieee80211_txq *txq; | |
1258 | struct iwl_mvm_txq *mvmtxq; | |
1259 | int i; | |
1260 | unsigned long tid_bitmap; | |
1261 | struct iwl_mvm_sta *mvmsta; | |
1262 | u8 sta_id; | |
b4f7a9d1 | 1263 | |
cfbc6c4c SS |
1264 | sta_id = iwl_mvm_has_new_tx_api(mvm) ? |
1265 | mvm->tvqm_info[hw_queue].sta_id : | |
1266 | mvm->queue_info[hw_queue].ra_sta_id; | |
b4f7a9d1 | 1267 | |
be9ae34e | 1268 | if (WARN_ON_ONCE(sta_id >= mvm->fw->ucode_capa.num_stations)) |
8ca151b5 | 1269 | return; |
8ca151b5 | 1270 | |
cfbc6c4c SS |
1271 | rcu_read_lock(); |
1272 | ||
1273 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); | |
1274 | if (IS_ERR_OR_NULL(sta)) | |
1275 | goto out; | |
1276 | mvmsta = iwl_mvm_sta_from_mac80211(sta); | |
1277 | ||
99944b73 AS |
1278 | if (iwl_mvm_is_static_queue(mvm, hw_queue)) { |
1279 | if (!start) | |
1280 | ieee80211_stop_queues(mvm->hw); | |
1281 | else if (mvmsta->sta_state != IEEE80211_STA_NOTEXIST) | |
1282 | ieee80211_wake_queues(mvm->hw); | |
1283 | ||
1284 | goto out; | |
1285 | } | |
1286 | ||
cfbc6c4c SS |
1287 | if (iwl_mvm_has_new_tx_api(mvm)) { |
1288 | int tid = mvm->tvqm_info[hw_queue].txq_tid; | |
1289 | ||
1290 | tid_bitmap = BIT(tid); | |
1291 | } else { | |
1292 | tid_bitmap = mvm->queue_info[hw_queue].tid_bitmap; | |
1293 | } | |
1294 | ||
1295 | for_each_set_bit(i, &tid_bitmap, IWL_MAX_TID_COUNT + 1) { | |
1296 | int tid = i; | |
1297 | ||
1298 | if (tid == IWL_MAX_TID_COUNT) | |
1299 | tid = IEEE80211_NUM_TIDS; | |
4ecafae9 | 1300 | |
cfbc6c4c SS |
1301 | txq = sta->txq[tid]; |
1302 | mvmtxq = iwl_mvm_txq_from_mac80211(txq); | |
1303 | mvmtxq->stopped = !start; | |
1304 | ||
1305 | if (start && mvmsta->sta_state != IEEE80211_STA_NOTEXIST) | |
1306 | iwl_mvm_mac_itxq_xmit(mvm->hw, txq); | |
4ecafae9 | 1307 | } |
cfbc6c4c SS |
1308 | |
1309 | out: | |
1310 | rcu_read_unlock(); | |
8ca151b5 JB |
1311 | } |
1312 | ||
cfbc6c4c | 1313 | static void iwl_mvm_stop_sw_queue(struct iwl_op_mode *op_mode, int hw_queue) |
b4f7a9d1 | 1314 | { |
cfbc6c4c SS |
1315 | iwl_mvm_queue_state_change(op_mode, hw_queue, false); |
1316 | } | |
b4f7a9d1 | 1317 | |
cfbc6c4c SS |
1318 | static void iwl_mvm_wake_sw_queue(struct iwl_op_mode *op_mode, int hw_queue) |
1319 | { | |
1320 | iwl_mvm_queue_state_change(op_mode, hw_queue, true); | |
b4f7a9d1 LK |
1321 | } |
1322 | ||
6ad04359 JB |
1323 | static void iwl_mvm_set_rfkill_state(struct iwl_mvm *mvm) |
1324 | { | |
1325 | bool state = iwl_mvm_is_radio_killed(mvm); | |
1326 | ||
1327 | if (state) | |
1328 | wake_up(&mvm->rx_sync_waitq); | |
1329 | ||
1330 | wiphy_rfkill_set_hw_state(mvm->hw->wiphy, state); | |
1331 | } | |
1332 | ||
9ee718aa EL |
1333 | void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state) |
1334 | { | |
1335 | if (state) | |
1336 | set_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status); | |
1337 | else | |
1338 | clear_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status); | |
1339 | ||
6ad04359 | 1340 | iwl_mvm_set_rfkill_state(mvm); |
9ee718aa EL |
1341 | } |
1342 | ||
14cfca71 | 1343 | static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) |
8ca151b5 JB |
1344 | { |
1345 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
b3500b47 EG |
1346 | bool rfkill_safe_init_done = READ_ONCE(mvm->rfkill_safe_init_done); |
1347 | bool unified = iwl_mvm_has_unified_ucode(mvm); | |
8ca151b5 JB |
1348 | |
1349 | if (state) | |
1350 | set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); | |
1351 | else | |
1352 | clear_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); | |
1353 | ||
6ad04359 | 1354 | iwl_mvm_set_rfkill_state(mvm); |
14cfca71 | 1355 | |
b3500b47 EG |
1356 | /* iwl_run_init_mvm_ucode is waiting for results, abort it. */ |
1357 | if (rfkill_safe_init_done) | |
31b8b343 EG |
1358 | iwl_abort_notification_waits(&mvm->notif_wait); |
1359 | ||
b3500b47 EG |
1360 | /* |
1361 | * Don't ask the transport to stop the firmware. We'll do it | |
1362 | * after cfg80211 takes us down. | |
1363 | */ | |
1364 | if (unified) | |
1365 | return false; | |
1366 | ||
31b8b343 EG |
1367 | /* |
1368 | * Stop the device if we run OPERATIONAL firmware or if we are in the | |
1369 | * middle of the calibrations. | |
1370 | */ | |
07c89a60 | 1371 | return state && rfkill_safe_init_done; |
8ca151b5 JB |
1372 | } |
1373 | ||
1374 | static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) | |
1375 | { | |
1376 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
1377 | struct ieee80211_tx_info *info; | |
1378 | ||
1379 | info = IEEE80211_SKB_CB(skb); | |
1380 | iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); | |
1381 | ieee80211_free_txskb(mvm->hw, skb); | |
1382 | } | |
1383 | ||
ac1ed416 JB |
1384 | struct iwl_mvm_reprobe { |
1385 | struct device *dev; | |
1386 | struct work_struct work; | |
1387 | }; | |
1388 | ||
1389 | static void iwl_mvm_reprobe_wk(struct work_struct *wk) | |
1390 | { | |
1391 | struct iwl_mvm_reprobe *reprobe; | |
1392 | ||
1393 | reprobe = container_of(wk, struct iwl_mvm_reprobe, work); | |
1394 | if (device_reprobe(reprobe->dev)) | |
1395 | dev_err(reprobe->dev, "reprobe failed!\n"); | |
7a21b1d4 | 1396 | put_device(reprobe->dev); |
ac1ed416 JB |
1397 | kfree(reprobe); |
1398 | module_put(THIS_MODULE); | |
1399 | } | |
1400 | ||
b08c1d97 | 1401 | void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error) |
8ca151b5 | 1402 | { |
8ca151b5 | 1403 | iwl_abort_notification_waits(&mvm->notif_wait); |
9b1bcfcc | 1404 | iwl_dbg_tlv_del_timers(mvm->trans); |
8ca151b5 | 1405 | |
992f81fc DS |
1406 | /* |
1407 | * This is a bit racy, but worst case we tell mac80211 about | |
1408 | * a stopped/aborted scan when that was already done which | |
1409 | * is not a problem. It is necessary to abort any os scan | |
1410 | * here because mac80211 requires having the scan cleared | |
1411 | * before restarting. | |
1412 | * We'll reset the scan_status to NONE in restart cleanup in | |
1413 | * the next start() call from mac80211. If restart isn't called | |
1414 | * (no fw restart) scan status will stay busy. | |
1415 | */ | |
4ffb3650 | 1416 | iwl_mvm_report_scan_aborted(mvm); |
992f81fc | 1417 | |
8ca151b5 JB |
1418 | /* |
1419 | * If we're restarting already, don't cycle restarts. | |
1420 | * If INIT fw asserted, it will likely fail again. | |
1421 | * If WoWLAN fw asserted, don't restart either, mac80211 | |
1422 | * can't recover this since we're already half suspended. | |
1423 | */ | |
3b37f4c9 | 1424 | if (!mvm->fw_restart && fw_error) { |
b8221b0f | 1425 | iwl_fw_error_collect(&mvm->fwrt, false); |
bf8b286f | 1426 | } else if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { |
ac1ed416 JB |
1427 | struct iwl_mvm_reprobe *reprobe; |
1428 | ||
1429 | IWL_ERR(mvm, | |
1430 | "Firmware error during reconfiguration - reprobe!\n"); | |
1431 | ||
1432 | /* | |
1433 | * get a module reference to avoid doing this while unloading | |
1434 | * anyway and to avoid scheduling a work with code that's | |
1435 | * being removed. | |
1436 | */ | |
1437 | if (!try_module_get(THIS_MODULE)) { | |
1438 | IWL_ERR(mvm, "Module is being unloaded - abort\n"); | |
1439 | return; | |
1440 | } | |
1441 | ||
1442 | reprobe = kzalloc(sizeof(*reprobe), GFP_ATOMIC); | |
1443 | if (!reprobe) { | |
1444 | module_put(THIS_MODULE); | |
1445 | return; | |
1446 | } | |
7a21b1d4 | 1447 | reprobe->dev = get_device(mvm->trans->dev); |
ac1ed416 JB |
1448 | INIT_WORK(&reprobe->work, iwl_mvm_reprobe_wk); |
1449 | schedule_work(&reprobe->work); | |
1e78e759 IP |
1450 | } else if (test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, |
1451 | &mvm->status)) { | |
1452 | IWL_ERR(mvm, "HW restart already requested, but not started\n"); | |
702e975d | 1453 | } else if (mvm->fwrt.cur_fw_img == IWL_UCODE_REGULAR && |
f60c9e59 EG |
1454 | mvm->hw_registered && |
1455 | !test_bit(STATUS_TRANS_DEAD, &mvm->trans->status)) { | |
861bae42 MG |
1456 | /* This should be first thing before trying to collect any |
1457 | * data to avoid endless loops if any HW error happens while | |
1458 | * collecting debug data. | |
1459 | */ | |
1460 | set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); | |
1461 | ||
f130bb75 MG |
1462 | if (mvm->fw->ucode_capa.error_log_size) { |
1463 | u32 src_size = mvm->fw->ucode_capa.error_log_size; | |
1464 | u32 src_addr = mvm->fw->ucode_capa.error_log_addr; | |
1465 | u8 *recover_buf = kzalloc(src_size, GFP_ATOMIC); | |
1466 | ||
1467 | if (recover_buf) { | |
1468 | mvm->error_recovery_buf = recover_buf; | |
1469 | iwl_trans_read_mem_bytes(mvm->trans, | |
1470 | src_addr, | |
1471 | recover_buf, | |
1472 | src_size); | |
1473 | } | |
1474 | } | |
1475 | ||
b8221b0f | 1476 | iwl_fw_error_collect(&mvm->fwrt, false); |
4b1831e4 | 1477 | |
3b37f4c9 JB |
1478 | if (fw_error && mvm->fw_restart > 0) |
1479 | mvm->fw_restart--; | |
8ca151b5 JB |
1480 | ieee80211_restart_hw(mvm->hw); |
1481 | } | |
1482 | } | |
1483 | ||
b8221b0f | 1484 | static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, bool sync) |
715c998f EG |
1485 | { |
1486 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
1487 | ||
f60c9e59 EG |
1488 | if (!test_bit(STATUS_TRANS_DEAD, &mvm->trans->status)) |
1489 | iwl_mvm_dump_nic_error_log(mvm); | |
1bd3cbc1 | 1490 | |
b8221b0f JB |
1491 | if (sync) { |
1492 | iwl_fw_error_collect(&mvm->fwrt, true); | |
1493 | /* | |
1494 | * Currently, the only case for sync=true is during | |
1495 | * shutdown, so just stop in this case. If/when that | |
1496 | * changes, we need to be a bit smarter here. | |
1497 | */ | |
1498 | return; | |
1499 | } | |
1500 | ||
2f308f00 JB |
1501 | /* |
1502 | * If the firmware crashes while we're already considering it | |
1503 | * to be dead then don't ask for a restart, that cannot do | |
1504 | * anything useful anyway. | |
1505 | */ | |
1506 | if (!test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status)) | |
1507 | return; | |
1508 | ||
b08c1d97 | 1509 | iwl_mvm_nic_restart(mvm, true); |
715c998f EG |
1510 | } |
1511 | ||
8ca151b5 JB |
1512 | static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode) |
1513 | { | |
715c998f EG |
1514 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); |
1515 | ||
8ca151b5 | 1516 | WARN_ON(1); |
b08c1d97 | 1517 | iwl_mvm_nic_restart(mvm, true); |
8ca151b5 JB |
1518 | } |
1519 | ||
d0129315 MG |
1520 | static void iwl_op_mode_mvm_time_point(struct iwl_op_mode *op_mode, |
1521 | enum iwl_fw_ini_time_point tp_id, | |
1522 | union iwl_dbg_tlv_tp_data *tp_data) | |
1523 | { | |
1524 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
1525 | ||
1526 | iwl_dbg_tlv_time_point(&mvm->fwrt, tp_id, tp_data); | |
1527 | } | |
1528 | ||
0316d30e JB |
1529 | #define IWL_MVM_COMMON_OPS \ |
1530 | /* these could be differentiated */ \ | |
156f92f2 | 1531 | .async_cb = iwl_mvm_async_cb, \ |
0316d30e JB |
1532 | .queue_full = iwl_mvm_stop_sw_queue, \ |
1533 | .queue_not_full = iwl_mvm_wake_sw_queue, \ | |
1534 | .hw_rf_kill = iwl_mvm_set_hw_rfkill_state, \ | |
1535 | .free_skb = iwl_mvm_free_skb, \ | |
1536 | .nic_error = iwl_mvm_nic_error, \ | |
1537 | .cmd_queue_full = iwl_mvm_cmd_queue_full, \ | |
1538 | .nic_config = iwl_mvm_nic_config, \ | |
0316d30e JB |
1539 | /* as we only register one, these MUST be common! */ \ |
1540 | .start = iwl_op_mode_mvm_start, \ | |
d0129315 MG |
1541 | .stop = iwl_op_mode_mvm_stop, \ |
1542 | .time_point = iwl_op_mode_mvm_time_point | |
0316d30e | 1543 | |
8ca151b5 | 1544 | static const struct iwl_op_mode_ops iwl_mvm_ops = { |
0316d30e JB |
1545 | IWL_MVM_COMMON_OPS, |
1546 | .rx = iwl_mvm_rx, | |
1547 | }; | |
1548 | ||
1549 | static void iwl_mvm_rx_mq_rss(struct iwl_op_mode *op_mode, | |
1550 | struct napi_struct *napi, | |
1551 | struct iwl_rx_cmd_buffer *rxb, | |
1552 | unsigned int queue) | |
1553 | { | |
1554 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | |
585a6fcc | 1555 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
61b0f5d7 | 1556 | u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd); |
0316d30e | 1557 | |
61b0f5d7 | 1558 | if (unlikely(cmd == WIDE_ID(LEGACY_GROUP, FRAME_RELEASE))) |
a338384b | 1559 | iwl_mvm_rx_frame_release(mvm, napi, rxb, queue); |
61b0f5d7 JB |
1560 | else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP, |
1561 | RX_QUEUES_NOTIFICATION))) | |
c61b655a | 1562 | iwl_mvm_rx_queue_notif(mvm, napi, rxb, queue); |
61b0f5d7 | 1563 | else if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD))) |
585a6fcc | 1564 | iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, queue); |
0316d30e JB |
1565 | } |
1566 | ||
1567 | static const struct iwl_op_mode_ops iwl_mvm_ops_mq = { | |
1568 | IWL_MVM_COMMON_OPS, | |
1569 | .rx = iwl_mvm_rx_mq, | |
1570 | .rx_rss = iwl_mvm_rx_mq_rss, | |
8ca151b5 | 1571 | }; |