]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/net/wireless/iwlwifi/mvm/power.c
Merge remote-tracking branch 'iwlwifi-fixes/master' into NEXT
[mirror_ubuntu-artful-kernel.git] / drivers / net / wireless / iwlwifi / mvm / power.c
1 /******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
23 * USA
24 *
25 * The full GNU General Public License is included in this distribution
26 * in the file called COPYING.
27 *
28 * Contact Information:
29 * Intel Linux Wireless <ilw@linux.intel.com>
30 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
31 *
32 * BSD LICENSE
33 *
34 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
35 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
36 * All rights reserved.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 *
42 * * Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * * Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in
46 * the documentation and/or other materials provided with the
47 * distribution.
48 * * Neither the name Intel Corporation nor the names of its
49 * contributors may be used to endorse or promote products derived
50 * from this software without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 *
64 *****************************************************************************/
65
66 #include <linux/kernel.h>
67 #include <linux/module.h>
68 #include <linux/slab.h>
69
70 #include <net/mac80211.h>
71
72 #include "iwl-debug.h"
73 #include "mvm.h"
74 #include "iwl-modparams.h"
75 #include "fw-api-power.h"
76
77 #define POWER_KEEP_ALIVE_PERIOD_SEC 25
78
79 static
80 int iwl_mvm_beacon_filter_send_cmd(struct iwl_mvm *mvm,
81 struct iwl_beacon_filter_cmd *cmd,
82 u32 flags)
83 {
84 IWL_DEBUG_POWER(mvm, "ba_enable_beacon_abort is: %d\n",
85 le32_to_cpu(cmd->ba_enable_beacon_abort));
86 IWL_DEBUG_POWER(mvm, "ba_escape_timer is: %d\n",
87 le32_to_cpu(cmd->ba_escape_timer));
88 IWL_DEBUG_POWER(mvm, "bf_debug_flag is: %d\n",
89 le32_to_cpu(cmd->bf_debug_flag));
90 IWL_DEBUG_POWER(mvm, "bf_enable_beacon_filter is: %d\n",
91 le32_to_cpu(cmd->bf_enable_beacon_filter));
92 IWL_DEBUG_POWER(mvm, "bf_energy_delta is: %d\n",
93 le32_to_cpu(cmd->bf_energy_delta));
94 IWL_DEBUG_POWER(mvm, "bf_escape_timer is: %d\n",
95 le32_to_cpu(cmd->bf_escape_timer));
96 IWL_DEBUG_POWER(mvm, "bf_roaming_energy_delta is: %d\n",
97 le32_to_cpu(cmd->bf_roaming_energy_delta));
98 IWL_DEBUG_POWER(mvm, "bf_roaming_state is: %d\n",
99 le32_to_cpu(cmd->bf_roaming_state));
100 IWL_DEBUG_POWER(mvm, "bf_temp_threshold is: %d\n",
101 le32_to_cpu(cmd->bf_temp_threshold));
102 IWL_DEBUG_POWER(mvm, "bf_temp_fast_filter is: %d\n",
103 le32_to_cpu(cmd->bf_temp_fast_filter));
104 IWL_DEBUG_POWER(mvm, "bf_temp_slow_filter is: %d\n",
105 le32_to_cpu(cmd->bf_temp_slow_filter));
106
107 return iwl_mvm_send_cmd_pdu(mvm, REPLY_BEACON_FILTERING_CMD, flags,
108 sizeof(struct iwl_beacon_filter_cmd), cmd);
109 }
110
111 static
112 void iwl_mvm_beacon_filter_set_cqm_params(struct iwl_mvm *mvm,
113 struct ieee80211_vif *vif,
114 struct iwl_beacon_filter_cmd *cmd)
115 {
116 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
117
118 if (vif->bss_conf.cqm_rssi_thold) {
119 cmd->bf_energy_delta =
120 cpu_to_le32(vif->bss_conf.cqm_rssi_hyst);
121 /* fw uses an absolute value for this */
122 cmd->bf_roaming_state =
123 cpu_to_le32(-vif->bss_conf.cqm_rssi_thold);
124 }
125 cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->bf_data.ba_enabled);
126 }
127
128 static void iwl_mvm_power_log(struct iwl_mvm *mvm,
129 struct iwl_mac_power_cmd *cmd)
130 {
131 IWL_DEBUG_POWER(mvm,
132 "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n",
133 cmd->id_and_color, iwlmvm_mod_params.power_scheme,
134 le16_to_cpu(cmd->flags));
135 IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n",
136 le16_to_cpu(cmd->keep_alive_seconds));
137
138 if (!(cmd->flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK))) {
139 IWL_DEBUG_POWER(mvm, "Disable power management\n");
140 return;
141 }
142
143 IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n",
144 le32_to_cpu(cmd->rx_data_timeout));
145 IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n",
146 le32_to_cpu(cmd->tx_data_timeout));
147 if (cmd->flags & cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK))
148 IWL_DEBUG_POWER(mvm, "DTIM periods to skip = %u\n",
149 cmd->skip_dtim_periods);
150 if (cmd->flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK))
151 IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n",
152 cmd->lprx_rssi_threshold);
153 if (cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) {
154 IWL_DEBUG_POWER(mvm, "uAPSD enabled\n");
155 IWL_DEBUG_POWER(mvm, "Rx timeout (uAPSD) = %u usec\n",
156 le32_to_cpu(cmd->rx_data_timeout_uapsd));
157 IWL_DEBUG_POWER(mvm, "Tx timeout (uAPSD) = %u usec\n",
158 le32_to_cpu(cmd->tx_data_timeout_uapsd));
159 IWL_DEBUG_POWER(mvm, "QNDP TID = %d\n", cmd->qndp_tid);
160 IWL_DEBUG_POWER(mvm, "ACs flags = 0x%x\n", cmd->uapsd_ac_flags);
161 IWL_DEBUG_POWER(mvm, "Max SP = %d\n", cmd->uapsd_max_sp);
162 }
163 }
164
165 static void iwl_mvm_power_configure_uapsd(struct iwl_mvm *mvm,
166 struct ieee80211_vif *vif,
167 struct iwl_mac_power_cmd *cmd)
168 {
169 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
170 enum ieee80211_ac_numbers ac;
171 bool tid_found = false;
172
173 for (ac = IEEE80211_AC_VO; ac <= IEEE80211_AC_BK; ac++) {
174 if (!mvmvif->queue_params[ac].uapsd)
175 continue;
176
177 if (mvm->cur_ucode != IWL_UCODE_WOWLAN)
178 cmd->flags |=
179 cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK);
180
181 cmd->uapsd_ac_flags |= BIT(ac);
182
183 /* QNDP TID - the highest TID with no admission control */
184 if (!tid_found && !mvmvif->queue_params[ac].acm) {
185 tid_found = true;
186 switch (ac) {
187 case IEEE80211_AC_VO:
188 cmd->qndp_tid = 6;
189 break;
190 case IEEE80211_AC_VI:
191 cmd->qndp_tid = 5;
192 break;
193 case IEEE80211_AC_BE:
194 cmd->qndp_tid = 0;
195 break;
196 case IEEE80211_AC_BK:
197 cmd->qndp_tid = 1;
198 break;
199 }
200 }
201 }
202
203 if (!(cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK))) {
204 #ifdef CONFIG_IWLWIFI_DEBUGFS
205 /* set advanced pm flag with no uapsd ACs to enable ps-poll */
206 if (mvmvif->dbgfs_pm.use_ps_poll)
207 cmd->flags |=
208 cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK);
209 #endif
210 return;
211 }
212
213 cmd->flags |= cpu_to_le16(POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK);
214
215 if (cmd->uapsd_ac_flags == (BIT(IEEE80211_AC_VO) |
216 BIT(IEEE80211_AC_VI) |
217 BIT(IEEE80211_AC_BE) |
218 BIT(IEEE80211_AC_BK))) {
219 cmd->flags |= cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK);
220 cmd->snooze_interval = cpu_to_le16(IWL_MVM_PS_SNOOZE_INTERVAL);
221 cmd->snooze_window = (mvm->cur_ucode == IWL_UCODE_WOWLAN) ?
222 cpu_to_le16(IWL_MVM_WOWLAN_PS_SNOOZE_WINDOW) :
223 cpu_to_le16(IWL_MVM_PS_SNOOZE_WINDOW);
224 }
225
226 cmd->uapsd_max_sp = IWL_UAPSD_MAX_SP;
227
228 if (mvm->cur_ucode == IWL_UCODE_WOWLAN || cmd->flags &
229 cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) {
230 cmd->rx_data_timeout_uapsd =
231 cpu_to_le32(IWL_MVM_WOWLAN_PS_RX_DATA_TIMEOUT);
232 cmd->tx_data_timeout_uapsd =
233 cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT);
234 } else {
235 cmd->rx_data_timeout_uapsd =
236 cpu_to_le32(IWL_MVM_UAPSD_RX_DATA_TIMEOUT);
237 cmd->tx_data_timeout_uapsd =
238 cpu_to_le32(IWL_MVM_UAPSD_TX_DATA_TIMEOUT);
239 }
240
241 if (cmd->flags & cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) {
242 cmd->heavy_tx_thld_packets =
243 IWL_MVM_PS_SNOOZE_HEAVY_TX_THLD_PACKETS;
244 cmd->heavy_rx_thld_packets =
245 IWL_MVM_PS_SNOOZE_HEAVY_RX_THLD_PACKETS;
246 } else {
247 cmd->heavy_tx_thld_packets =
248 IWL_MVM_PS_HEAVY_TX_THLD_PACKETS;
249 cmd->heavy_rx_thld_packets =
250 IWL_MVM_PS_HEAVY_RX_THLD_PACKETS;
251 }
252 cmd->heavy_tx_thld_percentage =
253 IWL_MVM_PS_HEAVY_TX_THLD_PERCENT;
254 cmd->heavy_rx_thld_percentage =
255 IWL_MVM_PS_HEAVY_RX_THLD_PERCENT;
256 }
257
258 static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm,
259 struct ieee80211_vif *vif)
260 {
261 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
262
263 if (!memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid,
264 ETH_ALEN))
265 return false;
266
267 if (vif->p2p &&
268 !(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD))
269 return false;
270 /*
271 * Avoid using uAPSD if P2P client is associated to GO that uses
272 * opportunistic power save. This is due to current FW limitation.
273 */
274 if (vif->p2p &&
275 (vif->bss_conf.p2p_noa_attr.oppps_ctwindow &
276 IEEE80211_P2P_OPPPS_ENABLE_BIT))
277 return false;
278
279 /*
280 * Avoid using uAPSD if client is in DCM -
281 * low latency issue in Miracast
282 */
283 if (iwl_mvm_phy_ctx_count(mvm) >= 2)
284 return false;
285
286 return true;
287 }
288
289 static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
290 struct ieee80211_vif *vif,
291 struct iwl_mac_power_cmd *cmd)
292 {
293 struct ieee80211_chanctx_conf *chanctx_conf;
294 struct ieee80211_channel *chan;
295 int dtimper, dtimper_msec;
296 int keep_alive;
297 bool radar_detect = false;
298 struct iwl_mvm_vif *mvmvif __maybe_unused =
299 iwl_mvm_vif_from_mac80211(vif);
300
301 cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
302 mvmvif->color));
303 dtimper = vif->bss_conf.dtim_period;
304
305 /*
306 * Regardless of power management state the driver must set
307 * keep alive period. FW will use it for sending keep alive NDPs
308 * immediately after association. Check that keep alive period
309 * is at least 3 * DTIM
310 */
311 dtimper_msec = dtimper * vif->bss_conf.beacon_int;
312 keep_alive = max_t(int, 3 * dtimper_msec,
313 MSEC_PER_SEC * POWER_KEEP_ALIVE_PERIOD_SEC);
314 keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC);
315 cmd->keep_alive_seconds = cpu_to_le16(keep_alive);
316
317 if (mvm->ps_disabled)
318 return;
319
320 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK);
321
322 if (!vif->bss_conf.ps || iwl_mvm_vif_low_latency(mvmvif) ||
323 !mvmvif->pm_enabled)
324 return;
325
326 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK);
327
328 if (vif->bss_conf.beacon_rate &&
329 (vif->bss_conf.beacon_rate->bitrate == 10 ||
330 vif->bss_conf.beacon_rate->bitrate == 60)) {
331 cmd->flags |= cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK);
332 cmd->lprx_rssi_threshold = POWER_LPRX_RSSI_THRESHOLD;
333 }
334
335 /* Check if radar detection is required on current channel */
336 rcu_read_lock();
337 chanctx_conf = rcu_dereference(vif->chanctx_conf);
338 WARN_ON(!chanctx_conf);
339 if (chanctx_conf) {
340 chan = chanctx_conf->def.chan;
341 radar_detect = chan->flags & IEEE80211_CHAN_RADAR;
342 }
343 rcu_read_unlock();
344
345 /* Check skip over DTIM conditions */
346 if (!radar_detect && (dtimper <= 10) &&
347 (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP ||
348 mvm->cur_ucode == IWL_UCODE_WOWLAN)) {
349 cmd->flags |= cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK);
350 cmd->skip_dtim_periods = 3;
351 }
352
353 if (mvm->cur_ucode != IWL_UCODE_WOWLAN) {
354 cmd->rx_data_timeout =
355 cpu_to_le32(IWL_MVM_DEFAULT_PS_RX_DATA_TIMEOUT);
356 cmd->tx_data_timeout =
357 cpu_to_le32(IWL_MVM_DEFAULT_PS_TX_DATA_TIMEOUT);
358 } else {
359 cmd->rx_data_timeout =
360 cpu_to_le32(IWL_MVM_WOWLAN_PS_RX_DATA_TIMEOUT);
361 cmd->tx_data_timeout =
362 cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT);
363 }
364
365 if (iwl_mvm_power_allow_uapsd(mvm, vif))
366 iwl_mvm_power_configure_uapsd(mvm, vif, cmd);
367
368 #ifdef CONFIG_IWLWIFI_DEBUGFS
369 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_KEEP_ALIVE)
370 cmd->keep_alive_seconds =
371 cpu_to_le16(mvmvif->dbgfs_pm.keep_alive_seconds);
372 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SKIP_OVER_DTIM) {
373 if (mvmvif->dbgfs_pm.skip_over_dtim)
374 cmd->flags |=
375 cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK);
376 else
377 cmd->flags &=
378 cpu_to_le16(~POWER_FLAGS_SKIP_OVER_DTIM_MSK);
379 }
380 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_RX_DATA_TIMEOUT)
381 cmd->rx_data_timeout =
382 cpu_to_le32(mvmvif->dbgfs_pm.rx_data_timeout);
383 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_TX_DATA_TIMEOUT)
384 cmd->tx_data_timeout =
385 cpu_to_le32(mvmvif->dbgfs_pm.tx_data_timeout);
386 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS)
387 cmd->skip_dtim_periods = mvmvif->dbgfs_pm.skip_dtim_periods;
388 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_LPRX_ENA) {
389 if (mvmvif->dbgfs_pm.lprx_ena)
390 cmd->flags |= cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK);
391 else
392 cmd->flags &= cpu_to_le16(~POWER_FLAGS_LPRX_ENA_MSK);
393 }
394 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD)
395 cmd->lprx_rssi_threshold = mvmvif->dbgfs_pm.lprx_rssi_threshold;
396 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SNOOZE_ENABLE) {
397 if (mvmvif->dbgfs_pm.snooze_ena)
398 cmd->flags |=
399 cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK);
400 else
401 cmd->flags &=
402 cpu_to_le16(~POWER_FLAGS_SNOOZE_ENA_MSK);
403 }
404 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_UAPSD_MISBEHAVING) {
405 u16 flag = POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK;
406 if (mvmvif->dbgfs_pm.uapsd_misbehaving)
407 cmd->flags |= cpu_to_le16(flag);
408 else
409 cmd->flags &= cpu_to_le16(flag);
410 }
411 #endif /* CONFIG_IWLWIFI_DEBUGFS */
412 }
413
414 static int iwl_mvm_power_send_cmd(struct iwl_mvm *mvm,
415 struct ieee80211_vif *vif)
416 {
417 struct iwl_mac_power_cmd cmd = {};
418
419 iwl_mvm_power_build_cmd(mvm, vif, &cmd);
420 iwl_mvm_power_log(mvm, &cmd);
421 #ifdef CONFIG_IWLWIFI_DEBUGFS
422 memcpy(&iwl_mvm_vif_from_mac80211(vif)->mac_pwr_cmd, &cmd, sizeof(cmd));
423 #endif
424
425 return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, 0,
426 sizeof(cmd), &cmd);
427 }
428
429 int iwl_mvm_power_update_device(struct iwl_mvm *mvm)
430 {
431 struct iwl_device_power_cmd cmd = {
432 .flags = cpu_to_le16(DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK),
433 };
434
435 if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM)
436 mvm->ps_disabled = true;
437
438 if (mvm->ps_disabled)
439 cmd.flags |= cpu_to_le16(DEVICE_POWER_FLAGS_CAM_MSK);
440
441 #ifdef CONFIG_IWLWIFI_DEBUGFS
442 if ((mvm->cur_ucode == IWL_UCODE_WOWLAN) ? mvm->disable_power_off_d3 :
443 mvm->disable_power_off)
444 cmd.flags &=
445 cpu_to_le16(~DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK);
446 #endif
447 IWL_DEBUG_POWER(mvm,
448 "Sending device power command with flags = 0x%X\n",
449 cmd.flags);
450
451 return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, 0, sizeof(cmd),
452 &cmd);
453 }
454
455 void iwl_mvm_power_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
456 {
457 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
458
459 if (memcmp(vif->bss_conf.bssid, mvmvif->uapsd_misbehaving_bssid,
460 ETH_ALEN))
461 memset(mvmvif->uapsd_misbehaving_bssid, 0, ETH_ALEN);
462 }
463
464 static void iwl_mvm_power_uapsd_misbehav_ap_iterator(void *_data, u8 *mac,
465 struct ieee80211_vif *vif)
466 {
467 u8 *ap_sta_id = _data;
468 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
469
470 /* The ap_sta_id is not expected to change during current association
471 * so no explicit protection is needed
472 */
473 if (mvmvif->ap_sta_id == *ap_sta_id)
474 memcpy(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid,
475 ETH_ALEN);
476 }
477
478 int iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm,
479 struct iwl_rx_cmd_buffer *rxb,
480 struct iwl_device_cmd *cmd)
481 {
482 struct iwl_rx_packet *pkt = rxb_addr(rxb);
483 struct iwl_uapsd_misbehaving_ap_notif *notif = (void *)pkt->data;
484 u8 ap_sta_id = le32_to_cpu(notif->sta_id);
485
486 ieee80211_iterate_active_interfaces_atomic(
487 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
488 iwl_mvm_power_uapsd_misbehav_ap_iterator, &ap_sta_id);
489
490 return 0;
491 }
492
493 struct iwl_power_vifs {
494 struct iwl_mvm *mvm;
495 struct ieee80211_vif *bf_vif;
496 struct ieee80211_vif *bss_vif;
497 struct ieee80211_vif *p2p_vif;
498 struct ieee80211_vif *ap_vif;
499 struct ieee80211_vif *monitor_vif;
500 bool p2p_active;
501 bool bss_active;
502 bool ap_active;
503 bool monitor_active;
504 bool bss_tdls;
505 bool p2p_tdls;
506 };
507
508 static void iwl_mvm_power_disable_pm_iterator(void *_data, u8* mac,
509 struct ieee80211_vif *vif)
510 {
511 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
512
513 mvmvif->pm_enabled = false;
514 }
515
516 static void iwl_mvm_power_ps_disabled_iterator(void *_data, u8* mac,
517 struct ieee80211_vif *vif)
518 {
519 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
520 bool *disable_ps = _data;
521
522 if (mvmvif->phy_ctxt)
523 if (mvmvif->phy_ctxt->id < MAX_PHYS)
524 *disable_ps |= mvmvif->ps_disabled;
525 }
526
527 static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac,
528 struct ieee80211_vif *vif)
529 {
530 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
531 struct iwl_power_vifs *power_iterator = _data;
532
533 switch (ieee80211_vif_type_p2p(vif)) {
534 case NL80211_IFTYPE_P2P_DEVICE:
535 break;
536
537 case NL80211_IFTYPE_P2P_GO:
538 case NL80211_IFTYPE_AP:
539 /* only a single MAC of the same type */
540 WARN_ON(power_iterator->ap_vif);
541 power_iterator->ap_vif = vif;
542 if (mvmvif->phy_ctxt)
543 if (mvmvif->phy_ctxt->id < MAX_PHYS)
544 power_iterator->ap_active = true;
545 break;
546
547 case NL80211_IFTYPE_MONITOR:
548 /* only a single MAC of the same type */
549 WARN_ON(power_iterator->monitor_vif);
550 power_iterator->monitor_vif = vif;
551 if (mvmvif->phy_ctxt)
552 if (mvmvif->phy_ctxt->id < MAX_PHYS)
553 power_iterator->monitor_active = true;
554 break;
555
556 case NL80211_IFTYPE_P2P_CLIENT:
557 /* only a single MAC of the same type */
558 WARN_ON(power_iterator->p2p_vif);
559 power_iterator->p2p_vif = vif;
560 power_iterator->p2p_tdls =
561 !!iwl_mvm_tdls_sta_count(power_iterator->mvm, vif);
562 if (mvmvif->phy_ctxt)
563 if (mvmvif->phy_ctxt->id < MAX_PHYS)
564 power_iterator->p2p_active = true;
565 break;
566
567 case NL80211_IFTYPE_STATION:
568 /* only a single MAC of the same type */
569 WARN_ON(power_iterator->bss_vif);
570 power_iterator->bss_vif = vif;
571 power_iterator->bss_tdls =
572 !!iwl_mvm_tdls_sta_count(power_iterator->mvm, vif);
573 if (mvmvif->phy_ctxt)
574 if (mvmvif->phy_ctxt->id < MAX_PHYS)
575 power_iterator->bss_active = true;
576
577 if (mvmvif->bf_data.bf_enabled &&
578 !WARN_ON(power_iterator->bf_vif))
579 power_iterator->bf_vif = vif;
580
581 break;
582
583 default:
584 break;
585 }
586 }
587
588 static void iwl_mvm_power_set_pm(struct iwl_mvm *mvm,
589 struct iwl_power_vifs *vifs)
590 {
591 struct iwl_mvm_vif *bss_mvmvif = NULL;
592 struct iwl_mvm_vif *p2p_mvmvif = NULL;
593 struct iwl_mvm_vif *ap_mvmvif = NULL;
594 bool client_same_channel = false;
595 bool ap_same_channel = false;
596
597 lockdep_assert_held(&mvm->mutex);
598
599 /* set pm_enable to false */
600 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
601 IEEE80211_IFACE_ITER_NORMAL,
602 iwl_mvm_power_disable_pm_iterator,
603 NULL);
604
605 if (vifs->bss_vif)
606 bss_mvmvif = iwl_mvm_vif_from_mac80211(vifs->bss_vif);
607
608 if (vifs->p2p_vif)
609 p2p_mvmvif = iwl_mvm_vif_from_mac80211(vifs->p2p_vif);
610
611 if (vifs->ap_vif)
612 ap_mvmvif = iwl_mvm_vif_from_mac80211(vifs->ap_vif);
613
614 /* enable PM on bss if bss stand alone */
615 if (vifs->bss_active && !vifs->p2p_active && !vifs->ap_active &&
616 !vifs->bss_tdls) {
617 bss_mvmvif->pm_enabled = true;
618 return;
619 }
620
621 /* enable PM on p2p if p2p stand alone */
622 if (vifs->p2p_active && !vifs->bss_active && !vifs->ap_active &&
623 !vifs->p2p_tdls) {
624 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PM)
625 p2p_mvmvif->pm_enabled = true;
626 return;
627 }
628
629 if (vifs->bss_active && vifs->p2p_active)
630 client_same_channel = (bss_mvmvif->phy_ctxt->id ==
631 p2p_mvmvif->phy_ctxt->id);
632 if (vifs->bss_active && vifs->ap_active)
633 ap_same_channel = (bss_mvmvif->phy_ctxt->id ==
634 ap_mvmvif->phy_ctxt->id);
635
636 /* clients are not stand alone: enable PM if DCM */
637 if (!(client_same_channel || ap_same_channel) &&
638 (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM)) {
639 if (vifs->bss_active)
640 bss_mvmvif->pm_enabled = true;
641 if (vifs->p2p_active &&
642 (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PM))
643 p2p_mvmvif->pm_enabled = true;
644 return;
645 }
646
647 /*
648 * There is only one channel in the system and there are only
649 * bss and p2p clients that share it
650 */
651 if (client_same_channel && !vifs->ap_active &&
652 (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_SCM)) {
653 /* share same channel*/
654 bss_mvmvif->pm_enabled = true;
655 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PM)
656 p2p_mvmvif->pm_enabled = true;
657 }
658 }
659
660 #ifdef CONFIG_IWLWIFI_DEBUGFS
661 int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm,
662 struct ieee80211_vif *vif, char *buf,
663 int bufsz)
664 {
665 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
666 struct iwl_mac_power_cmd cmd = {};
667 int pos = 0;
668
669 mutex_lock(&mvm->mutex);
670 memcpy(&cmd, &mvmvif->mac_pwr_cmd, sizeof(cmd));
671 mutex_unlock(&mvm->mutex);
672
673 pos += scnprintf(buf+pos, bufsz-pos, "power_scheme = %d\n",
674 iwlmvm_mod_params.power_scheme);
675 pos += scnprintf(buf+pos, bufsz-pos, "flags = 0x%x\n",
676 le16_to_cpu(cmd.flags));
677 pos += scnprintf(buf+pos, bufsz-pos, "keep_alive = %d\n",
678 le16_to_cpu(cmd.keep_alive_seconds));
679
680 if (!(cmd.flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)))
681 return pos;
682
683 pos += scnprintf(buf+pos, bufsz-pos, "skip_over_dtim = %d\n",
684 (cmd.flags &
685 cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK)) ? 1 : 0);
686 pos += scnprintf(buf+pos, bufsz-pos, "skip_dtim_periods = %d\n",
687 cmd.skip_dtim_periods);
688 if (!(cmd.flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK))) {
689 pos += scnprintf(buf+pos, bufsz-pos, "rx_data_timeout = %d\n",
690 le32_to_cpu(cmd.rx_data_timeout));
691 pos += scnprintf(buf+pos, bufsz-pos, "tx_data_timeout = %d\n",
692 le32_to_cpu(cmd.tx_data_timeout));
693 }
694 if (cmd.flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK))
695 pos += scnprintf(buf+pos, bufsz-pos,
696 "lprx_rssi_threshold = %d\n",
697 cmd.lprx_rssi_threshold);
698
699 if (!(cmd.flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)))
700 return pos;
701
702 pos += scnprintf(buf+pos, bufsz-pos, "rx_data_timeout_uapsd = %d\n",
703 le32_to_cpu(cmd.rx_data_timeout_uapsd));
704 pos += scnprintf(buf+pos, bufsz-pos, "tx_data_timeout_uapsd = %d\n",
705 le32_to_cpu(cmd.tx_data_timeout_uapsd));
706 pos += scnprintf(buf+pos, bufsz-pos, "qndp_tid = %d\n", cmd.qndp_tid);
707 pos += scnprintf(buf+pos, bufsz-pos, "uapsd_ac_flags = 0x%x\n",
708 cmd.uapsd_ac_flags);
709 pos += scnprintf(buf+pos, bufsz-pos, "uapsd_max_sp = %d\n",
710 cmd.uapsd_max_sp);
711 pos += scnprintf(buf+pos, bufsz-pos, "heavy_tx_thld_packets = %d\n",
712 cmd.heavy_tx_thld_packets);
713 pos += scnprintf(buf+pos, bufsz-pos, "heavy_rx_thld_packets = %d\n",
714 cmd.heavy_rx_thld_packets);
715 pos += scnprintf(buf+pos, bufsz-pos, "heavy_tx_thld_percentage = %d\n",
716 cmd.heavy_tx_thld_percentage);
717 pos += scnprintf(buf+pos, bufsz-pos, "heavy_rx_thld_percentage = %d\n",
718 cmd.heavy_rx_thld_percentage);
719 pos += scnprintf(buf+pos, bufsz-pos, "uapsd_misbehaving_enable = %d\n",
720 (cmd.flags &
721 cpu_to_le16(POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK)) ?
722 1 : 0);
723
724 if (!(cmd.flags & cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)))
725 return pos;
726
727 pos += scnprintf(buf+pos, bufsz-pos, "snooze_interval = %d\n",
728 cmd.snooze_interval);
729 pos += scnprintf(buf+pos, bufsz-pos, "snooze_window = %d\n",
730 cmd.snooze_window);
731
732 return pos;
733 }
734
735 void
736 iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif,
737 struct iwl_beacon_filter_cmd *cmd)
738 {
739 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
740 struct iwl_dbgfs_bf *dbgfs_bf = &mvmvif->dbgfs_bf;
741
742 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ENERGY_DELTA)
743 cmd->bf_energy_delta = cpu_to_le32(dbgfs_bf->bf_energy_delta);
744 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ROAMING_ENERGY_DELTA)
745 cmd->bf_roaming_energy_delta =
746 cpu_to_le32(dbgfs_bf->bf_roaming_energy_delta);
747 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ROAMING_STATE)
748 cmd->bf_roaming_state = cpu_to_le32(dbgfs_bf->bf_roaming_state);
749 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_TEMP_THRESHOLD)
750 cmd->bf_temp_threshold =
751 cpu_to_le32(dbgfs_bf->bf_temp_threshold);
752 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_TEMP_FAST_FILTER)
753 cmd->bf_temp_fast_filter =
754 cpu_to_le32(dbgfs_bf->bf_temp_fast_filter);
755 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_TEMP_SLOW_FILTER)
756 cmd->bf_temp_slow_filter =
757 cpu_to_le32(dbgfs_bf->bf_temp_slow_filter);
758 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_DEBUG_FLAG)
759 cmd->bf_debug_flag = cpu_to_le32(dbgfs_bf->bf_debug_flag);
760 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ESCAPE_TIMER)
761 cmd->bf_escape_timer = cpu_to_le32(dbgfs_bf->bf_escape_timer);
762 if (dbgfs_bf->mask & MVM_DEBUGFS_BA_ESCAPE_TIMER)
763 cmd->ba_escape_timer = cpu_to_le32(dbgfs_bf->ba_escape_timer);
764 if (dbgfs_bf->mask & MVM_DEBUGFS_BA_ENABLE_BEACON_ABORT)
765 cmd->ba_enable_beacon_abort =
766 cpu_to_le32(dbgfs_bf->ba_enable_beacon_abort);
767 }
768 #endif
769
770 static int _iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm,
771 struct ieee80211_vif *vif,
772 struct iwl_beacon_filter_cmd *cmd,
773 u32 cmd_flags,
774 bool d0i3)
775 {
776 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
777 int ret;
778
779 if (mvmvif != mvm->bf_allowed_vif || !vif->bss_conf.dtim_period ||
780 vif->type != NL80211_IFTYPE_STATION || vif->p2p)
781 return 0;
782
783 iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, cmd);
784 if (!d0i3)
785 iwl_mvm_beacon_filter_debugfs_parameters(vif, cmd);
786 ret = iwl_mvm_beacon_filter_send_cmd(mvm, cmd, cmd_flags);
787
788 /* don't change bf_enabled in case of temporary d0i3 configuration */
789 if (!ret && !d0i3)
790 mvmvif->bf_data.bf_enabled = true;
791
792 return ret;
793 }
794
795 int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm,
796 struct ieee80211_vif *vif,
797 u32 flags)
798 {
799 struct iwl_beacon_filter_cmd cmd = {
800 IWL_BF_CMD_CONFIG_DEFAULTS,
801 .bf_enable_beacon_filter = cpu_to_le32(1),
802 };
803
804 return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, flags, false);
805 }
806
807 static int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm,
808 struct ieee80211_vif *vif,
809 bool enable)
810 {
811 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
812 struct iwl_beacon_filter_cmd cmd = {
813 IWL_BF_CMD_CONFIG_DEFAULTS,
814 .bf_enable_beacon_filter = cpu_to_le32(1),
815 };
816
817 if (!mvmvif->bf_data.bf_enabled)
818 return 0;
819
820 if (mvm->cur_ucode == IWL_UCODE_WOWLAN)
821 cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3);
822
823 mvmvif->bf_data.ba_enabled = enable;
824 return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, 0, false);
825 }
826
827 int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm,
828 struct ieee80211_vif *vif,
829 u32 flags)
830 {
831 struct iwl_beacon_filter_cmd cmd = {};
832 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
833 int ret;
834
835 if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
836 return 0;
837
838 ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd, flags);
839
840 if (!ret)
841 mvmvif->bf_data.bf_enabled = false;
842
843 return ret;
844 }
845
846 static int iwl_mvm_power_set_ps(struct iwl_mvm *mvm)
847 {
848 bool disable_ps;
849 int ret;
850
851 /* disable PS if CAM */
852 disable_ps = (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM);
853 /* ...or if any of the vifs require PS to be off */
854 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
855 IEEE80211_IFACE_ITER_NORMAL,
856 iwl_mvm_power_ps_disabled_iterator,
857 &disable_ps);
858
859 /* update device power state if it has changed */
860 if (mvm->ps_disabled != disable_ps) {
861 bool old_ps_disabled = mvm->ps_disabled;
862
863 mvm->ps_disabled = disable_ps;
864 ret = iwl_mvm_power_update_device(mvm);
865 if (ret) {
866 mvm->ps_disabled = old_ps_disabled;
867 return ret;
868 }
869 }
870
871 return 0;
872 }
873
874 static int iwl_mvm_power_set_ba(struct iwl_mvm *mvm,
875 struct iwl_power_vifs *vifs)
876 {
877 struct iwl_mvm_vif *mvmvif;
878 bool ba_enable;
879
880 if (!vifs->bf_vif)
881 return 0;
882
883 mvmvif = iwl_mvm_vif_from_mac80211(vifs->bf_vif);
884
885 ba_enable = !(!mvmvif->pm_enabled || mvm->ps_disabled ||
886 !vifs->bf_vif->bss_conf.ps ||
887 iwl_mvm_vif_low_latency(mvmvif));
888
889 return iwl_mvm_update_beacon_abort(mvm, vifs->bf_vif, ba_enable);
890 }
891
892 int iwl_mvm_power_update_ps(struct iwl_mvm *mvm)
893 {
894 struct iwl_power_vifs vifs = {
895 .mvm = mvm,
896 };
897 int ret;
898
899 lockdep_assert_held(&mvm->mutex);
900
901 /* get vifs info */
902 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
903 IEEE80211_IFACE_ITER_NORMAL,
904 iwl_mvm_power_get_vifs_iterator, &vifs);
905
906 ret = iwl_mvm_power_set_ps(mvm);
907 if (ret)
908 return ret;
909
910 return iwl_mvm_power_set_ba(mvm, &vifs);
911 }
912
913 int iwl_mvm_power_update_mac(struct iwl_mvm *mvm)
914 {
915 struct iwl_power_vifs vifs = {
916 .mvm = mvm,
917 };
918 int ret;
919
920 lockdep_assert_held(&mvm->mutex);
921
922 /* get vifs info */
923 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
924 IEEE80211_IFACE_ITER_NORMAL,
925 iwl_mvm_power_get_vifs_iterator, &vifs);
926
927 iwl_mvm_power_set_pm(mvm, &vifs);
928
929 ret = iwl_mvm_power_set_ps(mvm);
930 if (ret)
931 return ret;
932
933 if (vifs.bss_vif) {
934 ret = iwl_mvm_power_send_cmd(mvm, vifs.bss_vif);
935 if (ret)
936 return ret;
937 }
938
939 if (vifs.p2p_vif) {
940 ret = iwl_mvm_power_send_cmd(mvm, vifs.p2p_vif);
941 if (ret)
942 return ret;
943 }
944
945 return iwl_mvm_power_set_ba(mvm, &vifs);
946 }
947
948 int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm,
949 struct ieee80211_vif *vif,
950 bool enable, u32 flags)
951 {
952 int ret;
953 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
954 struct iwl_mac_power_cmd cmd = {};
955
956 if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
957 return 0;
958
959 if (!vif->bss_conf.assoc)
960 return 0;
961
962 iwl_mvm_power_build_cmd(mvm, vif, &cmd);
963 if (enable) {
964 /* configure skip over dtim up to 300 msec */
965 int dtimper = vif->bss_conf.dtim_period ?: 1;
966 int dtimper_msec = dtimper * vif->bss_conf.beacon_int;
967
968 if (WARN_ON(!dtimper_msec))
969 return 0;
970
971 cmd.skip_dtim_periods = 300 / dtimper_msec;
972 if (cmd.skip_dtim_periods)
973 cmd.flags |=
974 cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK);
975 }
976 iwl_mvm_power_log(mvm, &cmd);
977 #ifdef CONFIG_IWLWIFI_DEBUGFS
978 memcpy(&mvmvif->mac_pwr_cmd, &cmd, sizeof(cmd));
979 #endif
980 ret = iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, flags,
981 sizeof(cmd), &cmd);
982 if (ret)
983 return ret;
984
985 /* configure beacon filtering */
986 if (mvmvif != mvm->bf_allowed_vif)
987 return 0;
988
989 if (enable) {
990 struct iwl_beacon_filter_cmd cmd_bf = {
991 IWL_BF_CMD_CONFIG_D0I3,
992 .bf_enable_beacon_filter = cpu_to_le32(1),
993 };
994 ret = _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd_bf,
995 flags, true);
996 } else {
997 if (mvmvif->bf_data.bf_enabled)
998 ret = iwl_mvm_enable_beacon_filter(mvm, vif, flags);
999 else
1000 ret = iwl_mvm_disable_beacon_filter(mvm, vif, flags);
1001 }
1002
1003 return ret;
1004 }