xref: /wlan-dirver/qca-wifi-host-cmn/wmi/inc/wmi_unified_twt_param.h (revision 6ecd284e5a94a1c96e26d571dd47419ac305990d)
1 /*
2  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file contains the API definitions for the TWT WMI APIs.
24  */
25 
26 #ifndef _WMI_UNIFIED_TWT_PARAM_H_
27 #define _WMI_UNIFIED_TWT_PARAM_H_
28 
29 /**
30  * @pdev_id: pdev_id for identifying the MAC.
31  * @sta_cong_timer_ms: STA TWT congestion timer TO value in terms of ms
32  * @mbss_support: Flag indicating if AP TWT feature supported in
33  *                MBSS mode or not.
34  * @default_slot_size: This is the default value for the TWT slot setup
35  *                by AP (units = microseconds)
36  * @congestion_thresh_setup: Minimum congestion required to start setting
37  *                up TWT sessions
38  * @congestion_thresh_teardown: Minimum congestion below which TWT will be
39  *                torn down (in percent of occupied airtime)
40  * @congestion_thresh_critical: Threshold above which TWT will not be active
41  *                (in percent of occupied airtime)
42  * @interference_thresh_teardown: Minimum interference above that TWT
43  *                 will not be active. The interference parameters use an
44  *                 abstract method of evaluating interference.
45  *                 The parameters are in percent, ranging from 0 for no
46  *                 interference, to 100 for interference extreme enough
47  *                 to completely block the signal of interest.
48  * @interference_thresh_setup: Minimum interference below that TWT session
49  *                 can be setup. The interference parameters use an
50  *                 abstract method of evaluating interference.
51  *                 The parameters are in percent, ranging from 0 for no
52  *                 interference, to 100 for interference extreme enough
53  *                 to completely block the signal of interest.
54  * @min_no_sta_setup: Minimum no of STA required to start TWT setup
55  * @min_no_sta_teardown: Minimum no of STA below which TWT will be torn down
56  * @no_of_bcast_mcast_slots: Number of default slot sizes reserved for
57  *                 BCAST/MCAST delivery
58  * @min_no_twt_slots: Minimum no of available slots for TWT to be operational
59  * @max_no_sta_twt: Max no of STA with which TWT is possible
60  *                 (must be <= the wmi_resource_config's twt_ap_sta_count value)
61  *      * The below interval parameters have units of milliseconds.
62  * @mode_check_interval: Interval between two successive check to decide the
63  *                 mode of TWT. (units = milliseconds)
64  * @add_sta_slot_interval: Interval between decisions making to create
65  *                 TWT slots for STAs. (units = milliseconds)
66  * @remove_sta_slot_interval: Inrerval between decisions making to remove TWT
67  *                 slot of STAs. (units = milliseconds)
68  */
69 struct wmi_twt_enable_param {
70 	uint32_t pdev_id;
71 	uint32_t sta_cong_timer_ms;
72 	uint32_t mbss_support;
73 	uint32_t default_slot_size;
74 	uint32_t congestion_thresh_setup;
75 	uint32_t congestion_thresh_teardown;
76 	uint32_t congestion_thresh_critical;
77 	uint32_t interference_thresh_teardown;
78 	uint32_t interference_thresh_setup;
79 	uint32_t min_no_sta_setup;
80 	uint32_t min_no_sta_teardown;
81 	uint32_t no_of_bcast_mcast_slots;
82 	uint32_t min_no_twt_slots;
83 	uint32_t max_no_sta_twt;
84 	uint32_t mode_check_interval;
85 	uint32_t add_sta_slot_interval;
86 	uint32_t remove_sta_slot_interval;
87 };
88 
89 /* status code of enabling TWT
90  * WMI_ENABLE_TWT_STATUS_OK: enabling TWT successfully completed
91  * WMI_ENABLE_TWT_STATUS_ALREADY_ENABLED: TWT already enabled
92  * WMI_ENABLE_TWT_STATUS_NOT_READY: FW not ready for enabling TWT
93  * WMI_ENABLE_TWT_INVALID_PARAM: invalid parameters
94  * WMI_ENABLE_TWT_STATUS_UNKNOWN_ERROR: enabling TWT failed with an
95  *                                      unknown reason
96  */
97 enum WMI_HOST_ENABLE_TWT_STATUS {
98 	WMI_HOST_ENABLE_TWT_STATUS_OK,
99 	WMI_HOST_ENABLE_TWT_STATUS_ALREADY_ENABLED,
100 	WMI_HOST_ENABLE_TWT_STATUS_NOT_READY,
101 	WMI_HOST_ENABLE_TWT_INVALID_PARAM,
102 	WMI_HOST_ENABLE_TWT_STATUS_UNKNOWN_ERROR,
103 };
104 
105 /** struct wmi_twt_enable_complete_event_param:
106  * @pdev_is: pdev_id for identifying the MAC.
107  * @status: From enum WMI_HOST_ENABLE_TWT_STATUS
108  */
109 struct wmi_twt_enable_complete_event_param {
110 	uint32_t pdev_id;
111 	uint32_t status;
112 };
113 
114 /** struct wmi_twt_disable_param:
115  * @pdev_id: pdev_id for identifying the MAC.
116  */
117 struct wmi_twt_disable_param {
118 	uint32_t pdev_id;
119 };
120 
121 /** struct wmi_twt_disable_complete_event:
122  * @pdev_id: pdev_id for identifying the MAC.
123  */
124 struct wmi_twt_disable_complete_event {
125 	uint32_t pdev_id;
126 };
127 
128 /* from IEEE 802.11ah section 9.4.2.200 */
129 enum WMI_HOST_TWT_COMMAND {
130 	WMI_HOST_TWT_COMMAND_REQUEST_TWT    = 0,
131 	WMI_HOST_TWT_COMMAND_SUGGEST_TWT    = 1,
132 	WMI_HOST_TWT_COMMAND_DEMAND_TWT     = 2,
133 	WMI_HOST_TWT_COMMAND_TWT_GROUPING   = 3,
134 	WMI_HOST_TWT_COMMAND_ACCEPT_TWT     = 4,
135 	WMI_HOST_TWT_COMMAND_ALTERNATE_TWT  = 5,
136 	WMI_HOST_TWT_COMMAND_DICTATE_TWT    = 6,
137 	WMI_HOST_TWT_COMMAND_REJECT_TWT     = 7,
138 };
139 
140 /** struct wmi_twt_add_dialog_param -
141  * @vdev_id: VDEV identifier
142  * @peer_macaddr: peer MAC address when vdev is AP VDEV
143  * @dialog_id: diaglog_id (TWT dialog ID)
144  *             This dialog ID must be unique within its vdev.
145  * @wake_intvl_us: TWT Wake Interval in units of us
146  * @wake_intvl_mantis: TWT Wake Interval Mantissa
147  *                 - wake_intvl_mantis must be <= 0xFFFF
148  *                 - wake_intvl_us must be divided evenly by wake_intvl_mantis,
149  *                   i.e., wake_intvl_us % wake_intvl_mantis == 0
150  *                 - the quotient of wake_intvl_us/wake_intvl_mantis must be
151  *                   2 to N-th(0<=N<=31) power,
152  *                   i.e., wake_intvl_us/wake_intvl_mantis == 2^N, 0<=N<=31
153  * @wake_dura_us: TWT Wake Duration in units of us, must be <= 0xFFFF
154  *                wake_dura_us must be divided evenly by 256,
155  *                i.e., wake_dura_us % 256 == 0
156  * @sp_offset_us: this long time after TWT setup the 1st SP will start.
157  * @twt_cmd: cmd from enum WMI_HOST_TWT_COMAND
158  * @flag_bcast: 0 means Individual TWT,
159  *              1 means Broadcast TWT
160  * @flag_trigger: 0 means non-Trigger-enabled TWT,
161  *                1 means  means Trigger-enabled TWT
162  * @flag_flow_type:  0 means announced TWT,
163  *                   1 means un-announced TWT
164  * @flag_protection: 0 means TWT protection is required,
165  *                   1 means TWT protection is not required
166  */
167 struct wmi_twt_add_dialog_param {
168 	uint32_t vdev_id;
169 	uint8_t  peer_macaddr[6];
170 	uint32_t dialog_id;
171 	uint32_t wake_intvl_us;
172 	uint32_t wake_intvl_mantis;
173 	uint32_t wake_dura_us;
174 	uint32_t sp_offset_us;
175 	enum WMI_HOST_TWT_COMMAND twt_cmd;
176 	uint32_t
177 		flag_bcast:1,
178 		flag_trigger:1,
179 		flag_flow_type:1,
180 		flag_protection:1;
181 };
182 
183 /* enum - status code of adding TWT dialog
184  * WMI_HOST_ADD_TWT_STATUS_OK: adding TWT dialog successfully completed
185  * WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED: TWT not enabled
186  * WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID: TWT dialog ID is already used
187  * WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM: invalid parameters
188  * WMI_HOST_ADD_TWT_STATUS_NOT_READY: FW not ready
189  * WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE: FW resource exhausted
190  * WMI_HOST_ADD_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
191  *                                 request/response frame
192  * WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE: peer AP did not send the response frame
193  * WMI_HOST_ADD_TWT_STATUS_DENIED: AP did not accept the request
194  * WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR: adding TWT dialog failed with
195  *                                 an unknown reason
196  */
197 enum WMI_HOST_ADD_TWT_STATUS {
198 	WMI_HOST_ADD_TWT_STATUS_OK,
199 	WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED,
200 	WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID,
201 	WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM,
202 	WMI_HOST_ADD_TWT_STATUS_NOT_READY,
203 	WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE,
204 	WMI_HOST_ADD_TWT_STATUS_NO_ACK,
205 	WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE,
206 	WMI_HOST_ADD_TWT_STATUS_DENIED,
207 	WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR,
208 };
209 
210 /** struct wmi_twt_add_dialog_complete_param -
211  * @vdev_id: VDEV identifier
212  * @dialog_id: TWT dialog ID
213  * @status: refer to WMI_HOST_ADD_TWT_STATUS enum
214  */
215 struct wmi_twt_add_dialog_complete_event_param {
216 	uint32_t vdev_id;
217 	uint32_t dialog_id;
218 	uint32_t status;
219 };
220 
221 /** struct wmi_twt_del_dialog_param -
222  * @vdev_id: VDEV identifier
223  * @dialog_id: TWT dialog ID
224  */
225 struct wmi_twt_del_dialog_param {
226 	uint32_t vdev_id;
227 	uint32_t dialog_id;
228 };
229 
230 /* status code of deleting TWT dialog
231  * WMI_HOST_DEL_TWT_STATUS_OK: deleting TWT dialog successfully completed
232  * WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
233  * WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM: invalid parameters
234  * WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
235  *                                    this dialog
236  * WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE: FW resource exhausted
237  * WMI_HOST_DEL_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the request/response
238  *                            frame
239  * WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR: deleting TWT dialog failed with an
240  *                            unknown reason
241  */
242 enum WMI_HOST_DEL_TWT_STATUS {
243 	WMI_HOST_DEL_TWT_STATUS_OK,
244 	WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST,
245 	WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM,
246 	WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY,
247 	WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE,
248 	WMI_HOST_DEL_TWT_STATUS_NO_ACK,
249 	WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR,
250 };
251 
252 /** struct wmi_twt_del_dialog_complete_event_param -
253  * @vdev_id: VDEV identifier
254  * @dialog_id: TWT dialog ID
255  * @status: refer to WMI_HOST_DEL_TWT_STATUS enum
256  */
257 struct wmi_twt_del_dialog_complete_event_param {
258 	uint32_t vdev_id;
259 	uint32_t dialog_id;
260 	uint32_t status;
261 };
262 
263 /** struct wmi_twt_pause_dialog_cmd_param -
264  * @vdev_id: VDEV identifier
265  * @dialog_id: TWT dialog ID
266  */
267 struct wmi_twt_pause_dialog_cmd_param {
268 	uint32_t vdev_id;
269 	uint32_t dialog_id;
270 };
271 
272 /* enum WMI_HOST_PAUSE_TWT_STATUS - status code of pausing TWT dialog
273  * WMI_HOST_PAUSE_TWT_STATUS_OK: pausing TWT dialog successfully completed
274  * WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
275  * WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM: invalid parameters
276  * WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
277  *                          this dialog
278  * WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE: FW resource exhausted
279  * WMI_HOST_PAUSE_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
280  *                          request/response frame
281  * WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR: pausing TWT dialog failed with an
282  *                          unknown reason
283  */
284 enum WMI_HOST_PAUSE_TWT_STATUS {
285 	WMI_HOST_PAUSE_TWT_STATUS_OK,
286 	WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST,
287 	WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM,
288 	WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY,
289 	WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE,
290 	WMI_HOST_PAUSE_TWT_STATUS_NO_ACK,
291 	WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR,
292 };
293 
294 /** struct wmi_twt_pause_dialog_complete_event_param -
295  * @vdev_id: VDEV identifier
296  * @dialog_id: TWT dialog ID
297  * @status: refer to WMI_HOST_PAUSE_TWT_STATUS
298  */
299 struct wmi_twt_pause_dialog_complete_event_param {
300 	uint32_t vdev_id;
301 	uint32_t dialog_id;
302 	uint32_t status;
303 };
304 
305 /** struct wmi_twt_resume_dialog_cmd_param -
306  * @vdev_id: VDEV identifier
307  * @dialog_id: TWT dialog ID
308  * @sp_offset_us: this long time after TWT resumed the 1st SP will start
309  */
310 struct wmi_twt_resume_dialog_cmd_param {
311 	uint32_t vdev_id;
312 	uint32_t dialog_id;
313 	uint32_t sp_offset_us;
314 };
315 
316 /* enum WMI_HOST_RESUME_TWT_STATUS - status code of resuming TWT dialog
317  * WMI_HOST_RESUME_TWT_STATUS_OK: resuming TWT dialog successfully completed
318  * WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
319  * WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM: invalid parameters
320  * WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
321  *                            this dialog
322  * WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED: dialog not paused currently
323  * WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE: FW resource exhausted
324  * WMI_HOST_RESUME_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
325  *                            request/response frame
326  * WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR: resuming TWT dialog failed with an
327  *                            unknown reason
328  */
329 enum WMI_HOST_RESUME_TWT_STATUS {
330 	WMI_HOST_RESUME_TWT_STATUS_OK,
331 	WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST,
332 	WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM,
333 	WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY,
334 	WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED,
335 	WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE,
336 	WMI_HOST_RESUME_TWT_STATUS_NO_ACK,
337 	WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR,
338 };
339 
340 /** struct wmi_twt_resume_dialog_complete_event_param -
341  * @vdev_id: VDEV identifier
342  * @dialog_id: TWT dialog ID
343  * @status: refer to WMI_HOST_RESUME_TWT_STATUS
344  */
345 struct wmi_twt_resume_dialog_complete_event_param {
346 	uint32_t vdev_id;
347 	uint32_t dialog_id;
348 	uint32_t status;
349 };
350 
351 #endif /* _WMI_UNIFIED_TWT_PARAM_H_ */
352