Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 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 - 2013 Intel Corporation. All rights reserved. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of version 2 of the GNU General Public License as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 22 | * USA |
| 23 | * |
| 24 | * The full GNU General Public License is included in this distribution |
Emmanuel Grumbach | 410dc5a | 2013-02-18 09:22:28 +0200 | [diff] [blame] | 25 | * in the file called COPYING. |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 26 | * |
| 27 | * Contact Information: |
| 28 | * Intel Linux Wireless <ilw@linux.intel.com> |
| 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 30 | * |
| 31 | * BSD LICENSE |
| 32 | * |
| 33 | * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. |
| 34 | * All rights reserved. |
| 35 | * |
| 36 | * Redistribution and use in source and binary forms, with or without |
| 37 | * modification, are permitted provided that the following conditions |
| 38 | * are met: |
| 39 | * |
| 40 | * * Redistributions of source code must retain the above copyright |
| 41 | * notice, this list of conditions and the following disclaimer. |
| 42 | * * Redistributions in binary form must reproduce the above copyright |
| 43 | * notice, this list of conditions and the following disclaimer in |
| 44 | * the documentation and/or other materials provided with the |
| 45 | * distribution. |
| 46 | * * Neither the name Intel Corporation nor the names of its |
| 47 | * contributors may be used to endorse or promote products derived |
| 48 | * from this software without specific prior written permission. |
| 49 | * |
| 50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 61 | * |
| 62 | *****************************************************************************/ |
| 63 | |
| 64 | #include <linux/kernel.h> |
| 65 | #include <linux/module.h> |
| 66 | #include <linux/slab.h> |
| 67 | #include <linux/init.h> |
| 68 | |
| 69 | #include <net/mac80211.h> |
| 70 | |
| 71 | #include "iwl-debug.h" |
| 72 | #include "mvm.h" |
| 73 | #include "iwl-modparams.h" |
| 74 | #include "fw-api-power.h" |
| 75 | |
| 76 | #define POWER_KEEP_ALIVE_PERIOD_SEC 25 |
| 77 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 78 | int iwl_mvm_beacon_filter_send_cmd(struct iwl_mvm *mvm, |
| 79 | struct iwl_beacon_filter_cmd *cmd) |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 80 | { |
| 81 | int ret; |
| 82 | |
| 83 | ret = iwl_mvm_send_cmd_pdu(mvm, REPLY_BEACON_FILTERING_CMD, CMD_SYNC, |
| 84 | sizeof(struct iwl_beacon_filter_cmd), cmd); |
| 85 | |
| 86 | if (!ret) { |
| 87 | IWL_DEBUG_POWER(mvm, "ba_enable_beacon_abort is: %d\n", |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 88 | le32_to_cpu(cmd->ba_enable_beacon_abort)); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 89 | IWL_DEBUG_POWER(mvm, "ba_escape_timer is: %d\n", |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 90 | le32_to_cpu(cmd->ba_escape_timer)); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 91 | IWL_DEBUG_POWER(mvm, "bf_debug_flag is: %d\n", |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 92 | le32_to_cpu(cmd->bf_debug_flag)); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 93 | IWL_DEBUG_POWER(mvm, "bf_enable_beacon_filter is: %d\n", |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 94 | le32_to_cpu(cmd->bf_enable_beacon_filter)); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 95 | IWL_DEBUG_POWER(mvm, "bf_energy_delta is: %d\n", |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 96 | le32_to_cpu(cmd->bf_energy_delta)); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 97 | IWL_DEBUG_POWER(mvm, "bf_escape_timer is: %d\n", |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 98 | le32_to_cpu(cmd->bf_escape_timer)); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 99 | IWL_DEBUG_POWER(mvm, "bf_roaming_energy_delta is: %d\n", |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 100 | le32_to_cpu(cmd->bf_roaming_energy_delta)); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 101 | IWL_DEBUG_POWER(mvm, "bf_roaming_state is: %d\n", |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 102 | le32_to_cpu(cmd->bf_roaming_state)); |
| 103 | IWL_DEBUG_POWER(mvm, "bf_temp_threshold is: %d\n", |
| 104 | le32_to_cpu(cmd->bf_temp_threshold)); |
| 105 | IWL_DEBUG_POWER(mvm, "bf_temp_fast_filter is: %d\n", |
| 106 | le32_to_cpu(cmd->bf_temp_fast_filter)); |
| 107 | IWL_DEBUG_POWER(mvm, "bf_temp_slow_filter is: %d\n", |
| 108 | le32_to_cpu(cmd->bf_temp_slow_filter)); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 109 | } |
| 110 | return ret; |
| 111 | } |
| 112 | |
Andrei Otcheretianski | a20fd39 | 2013-07-21 17:23:59 +0300 | [diff] [blame^] | 113 | static |
| 114 | void iwl_mvm_beacon_filter_set_cqm_params(struct iwl_mvm *mvm, |
| 115 | struct ieee80211_vif *vif, |
| 116 | struct iwl_beacon_filter_cmd *cmd) |
| 117 | { |
| 118 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 119 | |
| 120 | if (vif->bss_conf.cqm_rssi_thold) { |
| 121 | cmd->bf_energy_delta = |
| 122 | cpu_to_le32(vif->bss_conf.cqm_rssi_hyst); |
| 123 | /* fw uses an absolute value for this */ |
| 124 | cmd->bf_roaming_state = |
| 125 | cpu_to_le32(-vif->bss_conf.cqm_rssi_thold); |
| 126 | } |
| 127 | cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->bf_data.ba_enabled); |
| 128 | } |
| 129 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 130 | int iwl_mvm_update_beacon_abort(struct iwl_mvm *mvm, |
| 131 | struct ieee80211_vif *vif, bool enable) |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 132 | { |
| 133 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 134 | struct iwl_beacon_filter_cmd cmd = { |
| 135 | IWL_BF_CMD_CONFIG_DEFAULTS, |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 136 | .bf_enable_beacon_filter = cpu_to_le32(1), |
| 137 | .ba_enable_beacon_abort = cpu_to_le32(enable), |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 138 | }; |
| 139 | |
Andrei Otcheretianski | a20fd39 | 2013-07-21 17:23:59 +0300 | [diff] [blame^] | 140 | if (!mvmvif->bf_data.bf_enabled) |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 141 | return 0; |
| 142 | |
Alexander Bondar | 8434925 | 2013-07-22 15:39:26 +0300 | [diff] [blame] | 143 | if (mvm->cur_ucode == IWL_UCODE_WOWLAN) |
| 144 | cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3); |
| 145 | |
Andrei Otcheretianski | a20fd39 | 2013-07-21 17:23:59 +0300 | [diff] [blame^] | 146 | mvmvif->bf_data.ba_enabled = enable; |
| 147 | iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, &cmd); |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 148 | iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 149 | return iwl_mvm_beacon_filter_send_cmd(mvm, &cmd); |
| 150 | } |
| 151 | |
Alexander Bondar | 3f0b2b3 | 2013-03-05 14:08:23 +0200 | [diff] [blame] | 152 | static void iwl_mvm_power_log(struct iwl_mvm *mvm, |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 153 | struct iwl_mac_power_cmd *cmd) |
Alexander Bondar | 3f0b2b3 | 2013-03-05 14:08:23 +0200 | [diff] [blame] | 154 | { |
| 155 | IWL_DEBUG_POWER(mvm, |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 156 | "Sending power table command on mac id 0x%X for power level %d, flags = 0x%X\n", |
| 157 | cmd->id_and_color, iwlmvm_mod_params.power_scheme, |
Alexander Bondar | 3f0b2b3 | 2013-03-05 14:08:23 +0200 | [diff] [blame] | 158 | le16_to_cpu(cmd->flags)); |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 159 | IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n", |
| 160 | le16_to_cpu(cmd->keep_alive_seconds)); |
Alexander Bondar | 3f0b2b3 | 2013-03-05 14:08:23 +0200 | [diff] [blame] | 161 | |
Alexander Bondar | e3c588e | 2013-04-07 14:08:59 +0300 | [diff] [blame] | 162 | if (!(cmd->flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK))) { |
| 163 | IWL_DEBUG_POWER(mvm, "Disable power management\n"); |
| 164 | return; |
| 165 | } |
| 166 | |
| 167 | IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n", |
| 168 | le32_to_cpu(cmd->rx_data_timeout)); |
| 169 | IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n", |
| 170 | le32_to_cpu(cmd->tx_data_timeout)); |
| 171 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK)) |
| 172 | IWL_DEBUG_POWER(mvm, "DTIM periods to skip = %u\n", |
| 173 | cmd->skip_dtim_periods); |
| 174 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK)) |
| 175 | IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n", |
| 176 | cmd->lprx_rssi_threshold); |
| 177 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) { |
| 178 | IWL_DEBUG_POWER(mvm, "uAPSD enabled\n"); |
| 179 | IWL_DEBUG_POWER(mvm, "Rx timeout (uAPSD) = %u usec\n", |
| 180 | le32_to_cpu(cmd->rx_data_timeout_uapsd)); |
| 181 | IWL_DEBUG_POWER(mvm, "Tx timeout (uAPSD) = %u usec\n", |
| 182 | le32_to_cpu(cmd->tx_data_timeout_uapsd)); |
| 183 | IWL_DEBUG_POWER(mvm, "QNDP TID = %d\n", cmd->qndp_tid); |
| 184 | IWL_DEBUG_POWER(mvm, "ACs flags = 0x%x\n", cmd->uapsd_ac_flags); |
| 185 | IWL_DEBUG_POWER(mvm, "Max SP = %d\n", cmd->uapsd_max_sp); |
Alexander Bondar | 3f0b2b3 | 2013-03-05 14:08:23 +0200 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 189 | static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, |
| 190 | struct ieee80211_vif *vif, |
| 191 | struct iwl_mac_power_cmd *cmd) |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 192 | { |
| 193 | struct ieee80211_hw *hw = mvm->hw; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 194 | struct ieee80211_chanctx_conf *chanctx_conf; |
| 195 | struct ieee80211_channel *chan; |
| 196 | int dtimper, dtimper_msec; |
| 197 | int keep_alive; |
| 198 | bool radar_detect = false; |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 199 | struct iwl_mvm_vif *mvmvif __maybe_unused = |
| 200 | iwl_mvm_vif_from_mac80211(vif); |
Alexander Bondar | e3c588e | 2013-04-07 14:08:59 +0300 | [diff] [blame] | 201 | enum ieee80211_ac_numbers ac; |
| 202 | bool tid_found = false; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 203 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 204 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, |
| 205 | mvmvif->color)); |
| 206 | dtimper = hw->conf.ps_dtim_period ?: 1; |
| 207 | |
Alexander Bondar | e16cf7e | 2013-03-05 14:01:27 +0200 | [diff] [blame] | 208 | /* |
| 209 | * Regardless of power management state the driver must set |
| 210 | * keep alive period. FW will use it for sending keep alive NDPs |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 211 | * immediately after association. Check that keep alive period |
| 212 | * is at least 3 * DTIM |
Alexander Bondar | e16cf7e | 2013-03-05 14:01:27 +0200 | [diff] [blame] | 213 | */ |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 214 | dtimper_msec = dtimper * vif->bss_conf.beacon_int; |
| 215 | keep_alive = max_t(int, 3 * dtimper_msec, |
| 216 | MSEC_PER_SEC * POWER_KEEP_ALIVE_PERIOD_SEC); |
| 217 | keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC); |
| 218 | cmd->keep_alive_seconds = cpu_to_le16(keep_alive); |
Alexander Bondar | e16cf7e | 2013-03-05 14:01:27 +0200 | [diff] [blame] | 219 | |
Alexander Bondar | ade5065 | 2013-04-03 16:28:47 +0300 | [diff] [blame] | 220 | if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 221 | return; |
| 222 | |
Alexander Bondar | 9a61304 | 2013-03-05 12:54:00 +0200 | [diff] [blame] | 223 | cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK); |
| 224 | |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 225 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 226 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_DISABLE_POWER_OFF && |
| 227 | mvmvif->dbgfs_pm.disable_power_off) |
| 228 | cmd->flags &= cpu_to_le16(~POWER_FLAGS_POWER_SAVE_ENA_MSK); |
| 229 | #endif |
Alexander Bondar | 9a61304 | 2013-03-05 12:54:00 +0200 | [diff] [blame] | 230 | if (!vif->bss_conf.ps) |
| 231 | return; |
| 232 | |
| 233 | cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK); |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 234 | |
Alexander Bondar | bd4ace2 | 2013-03-21 17:14:14 +0200 | [diff] [blame] | 235 | if (vif->bss_conf.beacon_rate && |
| 236 | (vif->bss_conf.beacon_rate->bitrate == 10 || |
| 237 | vif->bss_conf.beacon_rate->bitrate == 60)) { |
| 238 | cmd->flags |= cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK); |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 239 | cmd->lprx_rssi_threshold = POWER_LPRX_RSSI_THRESHOLD; |
Alexander Bondar | bd4ace2 | 2013-03-21 17:14:14 +0200 | [diff] [blame] | 240 | } |
| 241 | |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 242 | /* Check if radar detection is required on current channel */ |
| 243 | rcu_read_lock(); |
| 244 | chanctx_conf = rcu_dereference(vif->chanctx_conf); |
| 245 | WARN_ON(!chanctx_conf); |
| 246 | if (chanctx_conf) { |
| 247 | chan = chanctx_conf->def.chan; |
| 248 | radar_detect = chan->flags & IEEE80211_CHAN_RADAR; |
| 249 | } |
| 250 | rcu_read_unlock(); |
| 251 | |
| 252 | /* Check skip over DTIM conditions */ |
| 253 | if (!radar_detect && (dtimper <= 10) && |
Alexander Bondar | ee1e842 | 2013-04-23 13:52:10 +0300 | [diff] [blame] | 254 | (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP || |
| 255 | mvm->cur_ucode == IWL_UCODE_WOWLAN)) { |
Alexander Bondar | f4a3e2f | 2013-03-05 13:47:04 +0200 | [diff] [blame] | 256 | cmd->flags |= cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 257 | cmd->skip_dtim_periods = 3; |
Alexander Bondar | 5b1dbfc | 2013-04-23 13:32:35 +0300 | [diff] [blame] | 258 | } |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 259 | |
Alexander Bondar | ee1e842 | 2013-04-23 13:52:10 +0300 | [diff] [blame] | 260 | if (mvm->cur_ucode != IWL_UCODE_WOWLAN) { |
Johannes Berg | 9954592 | 2013-06-14 13:36:21 +0200 | [diff] [blame] | 261 | cmd->rx_data_timeout = |
| 262 | cpu_to_le32(IWL_MVM_DEFAULT_PS_RX_DATA_TIMEOUT); |
| 263 | cmd->tx_data_timeout = |
| 264 | cpu_to_le32(IWL_MVM_DEFAULT_PS_TX_DATA_TIMEOUT); |
Alexander Bondar | ee1e842 | 2013-04-23 13:52:10 +0300 | [diff] [blame] | 265 | } else { |
Johannes Berg | 9954592 | 2013-06-14 13:36:21 +0200 | [diff] [blame] | 266 | cmd->rx_data_timeout = |
| 267 | cpu_to_le32(IWL_MVM_WOWLAN_PS_RX_DATA_TIMEOUT); |
| 268 | cmd->tx_data_timeout = |
| 269 | cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT); |
Alexander Bondar | ee1e842 | 2013-04-23 13:52:10 +0300 | [diff] [blame] | 270 | } |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 271 | |
Alexander Bondar | e3c588e | 2013-04-07 14:08:59 +0300 | [diff] [blame] | 272 | for (ac = IEEE80211_AC_VO; ac <= IEEE80211_AC_BK; ac++) { |
| 273 | if (!mvmvif->queue_params[ac].uapsd) |
| 274 | continue; |
| 275 | |
| 276 | cmd->flags |= cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK); |
| 277 | cmd->uapsd_ac_flags |= BIT(ac); |
| 278 | |
| 279 | /* QNDP TID - the highest TID with no admission control */ |
| 280 | if (!tid_found && !mvmvif->queue_params[ac].acm) { |
| 281 | tid_found = true; |
| 282 | switch (ac) { |
| 283 | case IEEE80211_AC_VO: |
| 284 | cmd->qndp_tid = 6; |
| 285 | break; |
| 286 | case IEEE80211_AC_VI: |
| 287 | cmd->qndp_tid = 5; |
| 288 | break; |
| 289 | case IEEE80211_AC_BE: |
| 290 | cmd->qndp_tid = 0; |
| 291 | break; |
| 292 | case IEEE80211_AC_BK: |
| 293 | cmd->qndp_tid = 1; |
| 294 | break; |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | if (cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) { |
| 300 | cmd->rx_data_timeout_uapsd = |
| 301 | cpu_to_le32(IWL_MVM_UAPSD_RX_DATA_TIMEOUT); |
| 302 | cmd->tx_data_timeout_uapsd = |
| 303 | cpu_to_le32(IWL_MVM_UAPSD_TX_DATA_TIMEOUT); |
| 304 | cmd->uapsd_max_sp = IWL_UAPSD_MAX_SP; |
| 305 | cmd->heavy_tx_thld_packets = |
| 306 | IWL_MVM_PS_HEAVY_TX_THLD_PACKETS; |
| 307 | cmd->heavy_rx_thld_packets = |
| 308 | IWL_MVM_PS_HEAVY_RX_THLD_PACKETS; |
| 309 | cmd->heavy_tx_thld_percentage = |
| 310 | IWL_MVM_PS_HEAVY_TX_THLD_PERCENT; |
| 311 | cmd->heavy_rx_thld_percentage = |
| 312 | IWL_MVM_PS_HEAVY_RX_THLD_PERCENT; |
| 313 | } |
| 314 | |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 315 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 316 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_KEEP_ALIVE) |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 317 | cmd->keep_alive_seconds = |
| 318 | cpu_to_le16(mvmvif->dbgfs_pm.keep_alive_seconds); |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 319 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SKIP_OVER_DTIM) { |
| 320 | if (mvmvif->dbgfs_pm.skip_over_dtim) |
| 321 | cmd->flags |= |
| 322 | cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); |
| 323 | else |
| 324 | cmd->flags &= |
| 325 | cpu_to_le16(~POWER_FLAGS_SKIP_OVER_DTIM_MSK); |
| 326 | } |
| 327 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_RX_DATA_TIMEOUT) |
| 328 | cmd->rx_data_timeout = |
| 329 | cpu_to_le32(mvmvif->dbgfs_pm.rx_data_timeout); |
| 330 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_TX_DATA_TIMEOUT) |
| 331 | cmd->tx_data_timeout = |
| 332 | cpu_to_le32(mvmvif->dbgfs_pm.tx_data_timeout); |
| 333 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS) |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 334 | cmd->skip_dtim_periods = mvmvif->dbgfs_pm.skip_dtim_periods; |
Alexander Bondar | bd4ace2 | 2013-03-21 17:14:14 +0200 | [diff] [blame] | 335 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_LPRX_ENA) { |
| 336 | if (mvmvif->dbgfs_pm.lprx_ena) |
| 337 | cmd->flags |= cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK); |
| 338 | else |
| 339 | cmd->flags &= cpu_to_le16(~POWER_FLAGS_LPRX_ENA_MSK); |
| 340 | } |
| 341 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD) |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 342 | cmd->lprx_rssi_threshold = mvmvif->dbgfs_pm.lprx_rssi_threshold; |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 343 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 344 | } |
| 345 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 346 | static int iwl_mvm_power_mac_update_mode(struct iwl_mvm *mvm, |
| 347 | struct ieee80211_vif *vif) |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 348 | { |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 349 | int ret; |
| 350 | bool ba_enable; |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 351 | struct iwl_mac_power_cmd cmd = {}; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 352 | |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 353 | if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) |
| 354 | return 0; |
| 355 | |
Alexander Bondar | 4bf881f | 2013-05-29 10:19:50 +0300 | [diff] [blame] | 356 | /* |
| 357 | * TODO: The following vif_count verification is temporary condition. |
| 358 | * Avoid power mode update if more than one interface is currently |
| 359 | * active. Remove this condition when FW will support power management |
| 360 | * on multiple MACs. |
| 361 | */ |
| 362 | IWL_DEBUG_POWER(mvm, "Currently %d interfaces active\n", |
| 363 | mvm->vif_count); |
| 364 | if (mvm->vif_count > 1) |
| 365 | return 0; |
| 366 | |
Alexander Bondar | f4a3e2f | 2013-03-05 13:47:04 +0200 | [diff] [blame] | 367 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); |
Alexander Bondar | 3f0b2b3 | 2013-03-05 14:08:23 +0200 | [diff] [blame] | 368 | iwl_mvm_power_log(mvm, &cmd); |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 369 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 370 | ret = iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, CMD_SYNC, |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 371 | sizeof(cmd), &cmd); |
| 372 | if (ret) |
| 373 | return ret; |
| 374 | |
| 375 | ba_enable = !!(cmd.flags & |
| 376 | cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)); |
| 377 | |
| 378 | return iwl_mvm_update_beacon_abort(mvm, vif, ba_enable); |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 379 | } |
| 380 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 381 | static int iwl_mvm_power_mac_disable(struct iwl_mvm *mvm, |
| 382 | struct ieee80211_vif *vif) |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 383 | { |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 384 | struct iwl_mac_power_cmd cmd = {}; |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 385 | struct iwl_mvm_vif *mvmvif __maybe_unused = |
| 386 | iwl_mvm_vif_from_mac80211(vif); |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 387 | |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 388 | if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) |
| 389 | return 0; |
| 390 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 391 | cmd.id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, |
| 392 | mvmvif->color)); |
| 393 | |
Alexander Bondar | ade5065 | 2013-04-03 16:28:47 +0300 | [diff] [blame] | 394 | if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM) |
Alexander Bondar | 9a61304 | 2013-03-05 12:54:00 +0200 | [diff] [blame] | 395 | cmd.flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK); |
| 396 | |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 397 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 398 | if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_DISABLE_POWER_OFF && |
| 399 | mvmvif->dbgfs_pm.disable_power_off) |
| 400 | cmd.flags &= cpu_to_le16(~POWER_FLAGS_POWER_SAVE_ENA_MSK); |
| 401 | #endif |
Alexander Bondar | 3f0b2b3 | 2013-03-05 14:08:23 +0200 | [diff] [blame] | 402 | iwl_mvm_power_log(mvm, &cmd); |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 403 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 404 | return iwl_mvm_send_cmd_pdu(mvm, MAC_PM_POWER_TABLE, CMD_ASYNC, |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 405 | sizeof(cmd), &cmd); |
| 406 | } |
Hila Gonen | 7df15b1 | 2012-12-12 11:16:19 +0200 | [diff] [blame] | 407 | |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 408 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 409 | static int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, |
| 410 | struct ieee80211_vif *vif, char *buf, |
| 411 | int bufsz) |
| 412 | { |
| 413 | struct iwl_mac_power_cmd cmd = {}; |
| 414 | int pos = 0; |
| 415 | |
| 416 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); |
| 417 | |
| 418 | pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off = %d\n", |
| 419 | (cmd.flags & |
| 420 | cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK)) ? |
| 421 | 0 : 1); |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 422 | pos += scnprintf(buf+pos, bufsz-pos, "power_scheme = %d\n", |
| 423 | iwlmvm_mod_params.power_scheme); |
| 424 | pos += scnprintf(buf+pos, bufsz-pos, "flags = 0x%x\n", |
| 425 | le16_to_cpu(cmd.flags)); |
| 426 | pos += scnprintf(buf+pos, bufsz-pos, "keep_alive = %d\n", |
| 427 | le16_to_cpu(cmd.keep_alive_seconds)); |
| 428 | |
| 429 | if (cmd.flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)) { |
| 430 | pos += scnprintf(buf+pos, bufsz-pos, "skip_over_dtim = %d\n", |
| 431 | (cmd.flags & |
| 432 | cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK)) ? |
| 433 | 1 : 0); |
Alexander Bondar | e3c588e | 2013-04-07 14:08:59 +0300 | [diff] [blame] | 434 | pos += scnprintf(buf+pos, bufsz-pos, "skip_dtim_periods = %d\n", |
| 435 | cmd.skip_dtim_periods); |
| 436 | if (!(cmd.flags & |
| 437 | cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK))) { |
| 438 | pos += scnprintf(buf+pos, bufsz-pos, |
| 439 | "rx_data_timeout = %d\n", |
| 440 | le32_to_cpu(cmd.rx_data_timeout)); |
| 441 | pos += scnprintf(buf+pos, bufsz-pos, |
| 442 | "tx_data_timeout = %d\n", |
| 443 | le32_to_cpu(cmd.tx_data_timeout)); |
| 444 | } |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 445 | if (cmd.flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK)) |
| 446 | pos += scnprintf(buf+pos, bufsz-pos, |
| 447 | "lprx_rssi_threshold = %d\n", |
| 448 | cmd.lprx_rssi_threshold); |
Alexander Bondar | e3c588e | 2013-04-07 14:08:59 +0300 | [diff] [blame] | 449 | if (cmd.flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) { |
| 450 | pos += |
| 451 | scnprintf(buf+pos, bufsz-pos, |
| 452 | "rx_data_timeout_uapsd = %d\n", |
| 453 | le32_to_cpu(cmd.rx_data_timeout_uapsd)); |
| 454 | pos += |
| 455 | scnprintf(buf+pos, bufsz-pos, |
| 456 | "tx_data_timeout_uapsd = %d\n", |
| 457 | le32_to_cpu(cmd.tx_data_timeout_uapsd)); |
| 458 | pos += scnprintf(buf+pos, bufsz-pos, "qndp_tid = %d\n", |
| 459 | cmd.qndp_tid); |
| 460 | pos += scnprintf(buf+pos, bufsz-pos, |
| 461 | "uapsd_ac_flags = 0x%x\n", |
| 462 | cmd.uapsd_ac_flags); |
| 463 | pos += scnprintf(buf+pos, bufsz-pos, |
| 464 | "uapsd_max_sp = %d\n", |
| 465 | cmd.uapsd_max_sp); |
| 466 | pos += scnprintf(buf+pos, bufsz-pos, |
| 467 | "heavy_tx_thld_packets = %d\n", |
| 468 | cmd.heavy_tx_thld_packets); |
| 469 | pos += scnprintf(buf+pos, bufsz-pos, |
| 470 | "heavy_rx_thld_packets = %d\n", |
| 471 | cmd.heavy_rx_thld_packets); |
| 472 | pos += scnprintf(buf+pos, bufsz-pos, |
| 473 | "heavy_tx_thld_percentage = %d\n", |
| 474 | cmd.heavy_tx_thld_percentage); |
| 475 | pos += scnprintf(buf+pos, bufsz-pos, |
| 476 | "heavy_rx_thld_percentage = %d\n", |
| 477 | cmd.heavy_rx_thld_percentage); |
| 478 | } |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 479 | } |
| 480 | return pos; |
| 481 | } |
| 482 | |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 483 | void |
| 484 | iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif, |
| 485 | struct iwl_beacon_filter_cmd *cmd) |
| 486 | { |
| 487 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 488 | struct iwl_dbgfs_bf *dbgfs_bf = &mvmvif->dbgfs_bf; |
| 489 | |
| 490 | if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ENERGY_DELTA) |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 491 | cmd->bf_energy_delta = cpu_to_le32(dbgfs_bf->bf_energy_delta); |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 492 | if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ROAMING_ENERGY_DELTA) |
| 493 | cmd->bf_roaming_energy_delta = |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 494 | cpu_to_le32(dbgfs_bf->bf_roaming_energy_delta); |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 495 | if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ROAMING_STATE) |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 496 | cmd->bf_roaming_state = cpu_to_le32(dbgfs_bf->bf_roaming_state); |
| 497 | if (dbgfs_bf->mask & MVM_DEBUGFS_BF_TEMP_THRESHOLD) |
| 498 | cmd->bf_temp_threshold = |
| 499 | cpu_to_le32(dbgfs_bf->bf_temp_threshold); |
| 500 | if (dbgfs_bf->mask & MVM_DEBUGFS_BF_TEMP_FAST_FILTER) |
| 501 | cmd->bf_temp_fast_filter = |
| 502 | cpu_to_le32(dbgfs_bf->bf_temp_fast_filter); |
| 503 | if (dbgfs_bf->mask & MVM_DEBUGFS_BF_TEMP_SLOW_FILTER) |
| 504 | cmd->bf_temp_slow_filter = |
| 505 | cpu_to_le32(dbgfs_bf->bf_temp_slow_filter); |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 506 | if (dbgfs_bf->mask & MVM_DEBUGFS_BF_DEBUG_FLAG) |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 507 | cmd->bf_debug_flag = cpu_to_le32(dbgfs_bf->bf_debug_flag); |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 508 | if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ESCAPE_TIMER) |
| 509 | cmd->bf_escape_timer = cpu_to_le32(dbgfs_bf->bf_escape_timer); |
| 510 | if (dbgfs_bf->mask & MVM_DEBUGFS_BA_ESCAPE_TIMER) |
| 511 | cmd->ba_escape_timer = cpu_to_le32(dbgfs_bf->ba_escape_timer); |
| 512 | if (dbgfs_bf->mask & MVM_DEBUGFS_BA_ENABLE_BEACON_ABORT) |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 513 | cmd->ba_enable_beacon_abort = |
| 514 | cpu_to_le32(dbgfs_bf->ba_enable_beacon_abort); |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 515 | } |
| 516 | #endif |
| 517 | |
Hila Gonen | 7df15b1 | 2012-12-12 11:16:19 +0200 | [diff] [blame] | 518 | int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm, |
| 519 | struct ieee80211_vif *vif) |
| 520 | { |
| 521 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 522 | struct iwl_beacon_filter_cmd cmd = { |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 523 | IWL_BF_CMD_CONFIG_DEFAULTS, |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 524 | .bf_enable_beacon_filter = cpu_to_le32(1), |
Hila Gonen | 7df15b1 | 2012-12-12 11:16:19 +0200 | [diff] [blame] | 525 | }; |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 526 | int ret; |
Hila Gonen | 7df15b1 | 2012-12-12 11:16:19 +0200 | [diff] [blame] | 527 | |
| 528 | if (mvmvif != mvm->bf_allowed_vif || |
| 529 | vif->type != NL80211_IFTYPE_STATION || vif->p2p) |
| 530 | return 0; |
| 531 | |
Andrei Otcheretianski | a20fd39 | 2013-07-21 17:23:59 +0300 | [diff] [blame^] | 532 | iwl_mvm_beacon_filter_set_cqm_params(mvm, vif, &cmd); |
Alexander Bondar | b571a69 | 2013-05-21 14:49:09 +0300 | [diff] [blame] | 533 | iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd); |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 534 | ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd); |
| 535 | |
| 536 | if (!ret) |
Andrei Otcheretianski | a20fd39 | 2013-07-21 17:23:59 +0300 | [diff] [blame^] | 537 | mvmvif->bf_data.bf_enabled = true; |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 538 | |
| 539 | return ret; |
Hila Gonen | 7df15b1 | 2012-12-12 11:16:19 +0200 | [diff] [blame] | 540 | } |
| 541 | |
| 542 | int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, |
| 543 | struct ieee80211_vif *vif) |
| 544 | { |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 545 | struct iwl_beacon_filter_cmd cmd = {}; |
| 546 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 547 | int ret; |
Hila Gonen | 7df15b1 | 2012-12-12 11:16:19 +0200 | [diff] [blame] | 548 | |
Hila Gonen | 5dca7c2 | 2013-07-16 11:15:35 +0300 | [diff] [blame] | 549 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BF_UPDATED) || |
| 550 | vif->type != NL80211_IFTYPE_STATION || vif->p2p) |
Hila Gonen | 7df15b1 | 2012-12-12 11:16:19 +0200 | [diff] [blame] | 551 | return 0; |
| 552 | |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 553 | ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd); |
| 554 | |
| 555 | if (!ret) |
Andrei Otcheretianski | a20fd39 | 2013-07-21 17:23:59 +0300 | [diff] [blame^] | 556 | mvmvif->bf_data.bf_enabled = false; |
Alexander Bondar | 071d4990 | 2013-05-06 13:03:59 +0300 | [diff] [blame] | 557 | |
| 558 | return ret; |
Hila Gonen | 7df15b1 | 2012-12-12 11:16:19 +0200 | [diff] [blame] | 559 | } |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 560 | |
Andrei Otcheretianski | a20fd39 | 2013-07-21 17:23:59 +0300 | [diff] [blame^] | 561 | int iwl_mvm_update_beacon_filter(struct iwl_mvm *mvm, |
| 562 | struct ieee80211_vif *vif) |
| 563 | { |
| 564 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 565 | |
| 566 | if (!mvmvif->bf_data.bf_enabled) |
| 567 | return 0; |
| 568 | |
| 569 | return iwl_mvm_enable_beacon_filter(mvm, vif); |
| 570 | } |
| 571 | |
Alexander Bondar | e811ada | 2013-03-10 15:29:44 +0200 | [diff] [blame] | 572 | const struct iwl_mvm_power_ops pm_mac_ops = { |
| 573 | .power_update_mode = iwl_mvm_power_mac_update_mode, |
| 574 | .power_disable = iwl_mvm_power_mac_disable, |
| 575 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 576 | .power_dbgfs_read = iwl_mvm_power_mac_dbgfs_read, |
| 577 | #endif |
| 578 | }; |