iwlwifi: mvm: Add basic uAPSD client support
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / mvm / fw-api-power.h
CommitLineData
8ca151b5
JB
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
410dc5aa 25 * in the file called COPYING.
8ca151b5
JB
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#ifndef __fw_api_power_h__
65#define __fw_api_power_h__
66
67/* Power Management Commands, Responses, Notifications */
68
bd4ace2a
AB
69/* Radio LP RX Energy Threshold measured in dBm */
70#define POWER_LPRX_RSSI_THRESHOLD 75
71#define POWER_LPRX_RSSI_THRESHOLD_MAX 94
72#define POWER_LPRX_RSSI_THRESHOLD_MIN 30
73
8ca151b5
JB
74/**
75 * enum iwl_scan_flags - masks for power table command flags
83bdad52
AB
76 * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
77 * receiver and transmitter. '0' - does not allow.
8ca151b5
JB
78 * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
79 * '1' Driver enables PM (use rest of parameters)
f4a3e2fe 80 * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
8ca151b5 81 * '1' PM could sleep over DTIM till listen Interval.
e811ada7
AB
82 * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
83 * access categories are both delivery and trigger enabled.
84 * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
85 * PBW Snoozing enabled
8ca151b5 86 * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
83bdad52 87 * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
8ca151b5
JB
88*/
89enum iwl_power_flags {
83bdad52
AB
90 POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
91 POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK = BIT(1),
f4a3e2fe 92 POWER_FLAGS_SKIP_OVER_DTIM_MSK = BIT(2),
e811ada7
AB
93 POWER_FLAGS_SNOOZE_ENA_MSK = BIT(5),
94 POWER_FLAGS_BT_SCO_ENA = BIT(8),
83bdad52
AB
95 POWER_FLAGS_ADVANCE_PM_ENA_MSK = BIT(9),
96 POWER_FLAGS_LPRX_ENA_MSK = BIT(11),
8ca151b5
JB
97};
98
83bdad52
AB
99#define IWL_POWER_VEC_SIZE 5
100
8ca151b5 101/**
e811ada7
AB
102 * struct iwl_powertable_cmd - legacy power command. Beside old API support this
103 * is used also with a new power API for device wide power settings.
8ca151b5
JB
104 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
105 *
8ca151b5
JB
106 * @flags: Power table command flags from POWER_FLAGS_*
107 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
e16cf7ec
AB
108 * Minimum allowed:- 3 * DTIM. Keep alive period must be
109 * set regardless of power scheme or current power state.
110 * FW use this value also when PM is disabled.
8ca151b5
JB
111 * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
112 * PSM transition - legacy PM
113 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
114 * PSM transition - legacy PM
83bdad52 115 * @sleep_interval: not in use
1bd2d175
AB
116 * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
117 * is set. For example, if it is required to skip over
118 * one DTIM, this value need to be set to 2 (DTIM periods).
8ca151b5
JB
119 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
120 * Default: 80dbm
8ca151b5
JB
121 */
122struct iwl_powertable_cmd {
5b1dbfc3 123 /* PM_POWER_TABLE_CMD_API_S_VER_6 */
8ca151b5 124 __le16 flags;
83bdad52
AB
125 u8 keep_alive_seconds;
126 u8 debug_flags;
8ca151b5
JB
127 __le32 rx_data_timeout;
128 __le32 tx_data_timeout;
83bdad52 129 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
1bd2d175 130 __le32 skip_dtim_periods;
83bdad52 131 __le32 lprx_rssi_threshold;
8ca151b5
JB
132} __packed;
133
e811ada7
AB
134/**
135 * struct iwl_mac_power_cmd - New power command containing uAPSD support
136 * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
137 * @id_and_color: MAC contex identifier
138 * @flags: Power table command flags from POWER_FLAGS_*
139 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
140 * Minimum allowed:- 3 * DTIM. Keep alive period must be
141 * set regardless of power scheme or current power state.
142 * FW use this value also when PM is disabled.
143 * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
144 * PSM transition - legacy PM
145 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
146 * PSM transition - legacy PM
147 * @sleep_interval: not in use
148 * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
149 * is set. For example, if it is required to skip over
150 * one DTIM, this value need to be set to 2 (DTIM periods).
151 * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
152 * PSM transition - uAPSD
153 * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
154 * PSM transition - uAPSD
155 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
156 * Default: 80dbm
157 * @num_skip_dtim: Number of DTIMs to skip if Skip over DTIM flag is set
158 * @snooze_interval: TBD
159 * @snooze_window: TBD
160 * @snooze_step: TBD
161 * @qndp_tid: TID client shall use for uAPSD QNDP triggers
162 * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for
163 * each corresponding AC.
164 * Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
165 * @uapsd_max_sp: Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
166 * values.
e3c588ec
AB
167 * @heavy_tx_thld_packets: TX threshold measured in number of packets
168 * @heavy_rx_thld_packets: RX threshold measured in number of packets
169 * @heavy_tx_thld_percentage: TX threshold measured in load's percentage
170 * @heavy_rx_thld_percentage: RX threshold measured in load's percentage
e811ada7
AB
171 * @limited_ps_threshold:
172*/
173struct iwl_mac_power_cmd {
174 /* CONTEXT_DESC_API_T_VER_1 */
175 __le32 id_and_color;
176
177 /* CLIENT_PM_POWER_TABLE_S_VER_1 */
178 __le16 flags;
179 __le16 keep_alive_seconds;
180 __le32 rx_data_timeout;
181 __le32 tx_data_timeout;
182 __le32 rx_data_timeout_uapsd;
183 __le32 tx_data_timeout_uapsd;
184 u8 lprx_rssi_threshold;
185 u8 skip_dtim_periods;
186 __le16 snooze_interval;
187 __le16 snooze_window;
188 u8 snooze_step;
189 u8 qndp_tid;
190 u8 uapsd_ac_flags;
191 u8 uapsd_max_sp;
e3c588ec
AB
192 u8 heavy_tx_thld_packets;
193 u8 heavy_rx_thld_packets;
194 u8 heavy_tx_thld_percentage;
195 u8 heavy_rx_thld_percentage;
e811ada7
AB
196 u8 limited_ps_threshold;
197 u8 reserved;
198} __packed;
199
7df15b1e
HG
200/**
201 * struct iwl_beacon_filter_cmd
202 * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
203 * @id_and_color: MAC contex identifier
204 * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
205 * to driver if delta in Energy values calculated for this and last
206 * passed beacon is greater than this threshold. Zero value means that
207 * the Energy change is ignored for beacon filtering, and beacon will
208 * not be forced to be sent to driver regardless of this delta. Typical
209 * energy delta 5dB.
210 * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
211 * Send beacon to driver if delta in Energy values calculated for this
212 * and last passed beacon is greater than this threshold. Zero value
213 * means that the Energy change is ignored for beacon filtering while in
214 * Roaming state, typical energy delta 1dB.
215 * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
216 * calculated for current beacon is less than the threshold, use
217 * Roaming Energy Delta Threshold, otherwise use normal Energy Delta
218 * Threshold. Typical energy threshold is -72dBm.
5dca7c24
HG
219 * @bf_temp_threshold: This threshold determines the type of temperature
220 * filtering (Slow or Fast) that is selected (Units are in Celsuis):
221 * If the current temperature is above this threshold - Fast filter
222 * will be used, If the current temperature is below this threshold -
223 * Slow filter will be used.
224 * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
225 * calculated for this and the last passed beacon is greater than this
226 * threshold. Zero value means that the temperature change is ignored for
7df15b1e
HG
227 * beacon filtering; beacons will not be forced to be sent to driver
228 * regardless of whether its temerature has been changed.
5dca7c24
HG
229 * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
230 * calculated for this and the last passed beacon is greater than this
231 * threshold. Zero value means that the temperature change is ignored for
232 * beacon filtering; beacons will not be forced to be sent to driver
233 * regardless of whether its temerature has been changed.
7df15b1e
HG
234 * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
235 * @bf_filter_escape_timer: Send beacons to to driver if no beacons were passed
236 * for a specific period of time. Units: Beacons.
237 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
238 * for a longer period of time then this escape-timeout. Units: Beacons.
239 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
240 */
241struct iwl_beacon_filter_cmd {
5dca7c24
HG
242 __le32 bf_energy_delta;
243 __le32 bf_roaming_energy_delta;
244 __le32 bf_roaming_state;
245 __le32 bf_temp_threshold;
246 __le32 bf_temp_fast_filter;
247 __le32 bf_temp_slow_filter;
248 __le32 bf_enable_beacon_filter;
249 __le32 bf_debug_flag;
7df15b1e
HG
250 __le32 bf_escape_timer;
251 __le32 ba_escape_timer;
5dca7c24 252 __le32 ba_enable_beacon_abort;
7df15b1e
HG
253} __packed;
254
255/* Beacon filtering and beacon abort */
256#define IWL_BF_ENERGY_DELTA_DEFAULT 5
257#define IWL_BF_ENERGY_DELTA_MAX 255
258#define IWL_BF_ENERGY_DELTA_MIN 0
259
260#define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
261#define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
262#define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
263
264#define IWL_BF_ROAMING_STATE_DEFAULT 72
265#define IWL_BF_ROAMING_STATE_MAX 255
266#define IWL_BF_ROAMING_STATE_MIN 0
267
5dca7c24
HG
268#define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
269#define IWL_BF_TEMP_THRESHOLD_MAX 255
270#define IWL_BF_TEMP_THRESHOLD_MIN 0
271
272#define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
273#define IWL_BF_TEMP_FAST_FILTER_MAX 255
274#define IWL_BF_TEMP_FAST_FILTER_MIN 0
275
276#define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
277#define IWL_BF_TEMP_SLOW_FILTER_MAX 255
278#define IWL_BF_TEMP_SLOW_FILTER_MIN 0
7df15b1e
HG
279
280#define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
281
282#define IWL_BF_DEBUG_FLAG_DEFAULT 0
283
284#define IWL_BF_ESCAPE_TIMER_DEFAULT 50
285#define IWL_BF_ESCAPE_TIMER_MAX 1024
286#define IWL_BF_ESCAPE_TIMER_MIN 0
287
8434925f
AB
288#define IWL_BA_ESCAPE_TIMER_DEFAULT 6
289#define IWL_BA_ESCAPE_TIMER_D3 6
7df15b1e
HG
290#define IWL_BA_ESCAPE_TIMER_MAX 1024
291#define IWL_BA_ESCAPE_TIMER_MIN 0
292
293#define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
294
5dca7c24
HG
295#define IWL_BF_CMD_CONFIG_DEFAULTS \
296 .bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA_DEFAULT), \
297 .bf_roaming_energy_delta = \
298 cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT), \
299 .bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE_DEFAULT), \
300 .bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD_DEFAULT), \
301 .bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER_DEFAULT), \
302 .bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER_DEFAULT), \
303 .bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG_DEFAULT), \
304 .bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER_DEFAULT), \
071d4990
AB
305 .ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_DEFAULT)
306
8ca151b5 307#endif
This page took 0.074094 seconds and 5 git commands to generate.