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