xref: /wlan-dirver/qca-wifi-host-cmn/wmi/inc/wmi_unified_twt_param.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
1 /*
2  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /*
21  * This file contains the API definitions for the TWT WMI APIs.
22  */
23 
24 #ifndef _WMI_UNIFIED_TWT_PARAM_H_
25 #define _WMI_UNIFIED_TWT_PARAM_H_
26 
27 /* enum WMI_TWT_ROLE - role specified in ext conf in wmi_twt_enable/disable_cmd
28  * WMI_TWT_ROLE_REQUESTOR: TWT role is requestor
29  * WMI_TWT_ROLE_RESPONDER: TWT role is responder
30  */
31 enum WMI_TWT_ROLE {
32 	WMI_TWT_ROLE_REQUESTOR,
33 	WMI_TWT_ROLE_RESPONDER,
34 };
35 
36 /* enum WMI_TWT_OPERATION - specified in ext conf in wmi_twt_enable/disable_cmd
37  * WMI_TWT_OPERATION_INDIVIDUAL: Individual TWT operation
38  * WMI_TWT_OPERATION_BROADCAST: Broadcast TWT operation
39  */
40 enum WMI_TWT_OPERATION {
41 	WMI_TWT_OPERATION_INDIVIDUAL,
42 	WMI_TWT_OPERATION_BROADCAST,
43 };
44 
45 /**
46  * @pdev_id: pdev_id for identifying the MAC.
47  * @sta_cong_timer_ms: STA TWT congestion timer TO value in terms of ms
48  * @mbss_support: Flag indicating if AP TWT feature supported in
49  *                MBSS mode or not.
50  * @default_slot_size: This is the default value for the TWT slot setup
51  *                by AP (units = microseconds)
52  * @congestion_thresh_setup: Minimum congestion required to start setting
53  *                up TWT sessions
54  * @congestion_thresh_teardown: Minimum congestion below which TWT will be
55  *                torn down (in percent of occupied airtime)
56  * @congestion_thresh_critical: Threshold above which TWT will not be active
57  *                (in percent of occupied airtime)
58  * @interference_thresh_teardown: Minimum interference above that TWT
59  *                 will not be active. The interference parameters use an
60  *                 abstract method of evaluating interference.
61  *                 The parameters are in percent, ranging from 0 for no
62  *                 interference, to 100 for interference extreme enough
63  *                 to completely block the signal of interest.
64  * @interference_thresh_setup: Minimum interference below that TWT session
65  *                 can be setup. The interference parameters use an
66  *                 abstract method of evaluating interference.
67  *                 The parameters are in percent, ranging from 0 for no
68  *                 interference, to 100 for interference extreme enough
69  *                 to completely block the signal of interest.
70  * @min_no_sta_setup: Minimum no of STA required to start TWT setup
71  * @min_no_sta_teardown: Minimum no of STA below which TWT will be torn down
72  * @no_of_bcast_mcast_slots: Number of default slot sizes reserved for
73  *                 BCAST/MCAST delivery
74  * @min_no_twt_slots: Minimum no of available slots for TWT to be operational
75  * @max_no_sta_twt: Max no of STA with which TWT is possible
76  *                 (must be <= the wmi_resource_config's twt_ap_sta_count value)
77  *      * The below interval parameters have units of milliseconds.
78  * @mode_check_interval: Interval between two successive check to decide the
79  *                 mode of TWT. (units = milliseconds)
80  * @add_sta_slot_interval: Interval between decisions making to create
81  *                 TWT slots for STAs. (units = milliseconds)
82  * @remove_sta_slot_interval: Inrerval between decisions making to remove TWT
83  *                 slot of STAs. (units = milliseconds)
84  * @twt_role: values from enum WMI_TWT_ROLE.
85  * @twt_oper: values from enum WMI_TWT_OPERATION.
86  * @ext_conf_present: If requestor/responder extend config is present.
87  * @b_twt_enable: Enable or disable broadcast TWT.
88  * @b_twt_legacy_mbss_enable: Enable or disable legacy MBSSID TWT.
89  * @b_twt_ax_mbss_enable: Enable or disable 11AX MBSSID TWT.
90  */
91 struct wmi_twt_enable_param {
92 	uint32_t pdev_id;
93 	uint32_t sta_cong_timer_ms;
94 	uint32_t mbss_support;
95 	uint32_t default_slot_size;
96 	uint32_t congestion_thresh_setup;
97 	uint32_t congestion_thresh_teardown;
98 	uint32_t congestion_thresh_critical;
99 	uint32_t interference_thresh_teardown;
100 	uint32_t interference_thresh_setup;
101 	uint32_t min_no_sta_setup;
102 	uint32_t min_no_sta_teardown;
103 	uint32_t no_of_bcast_mcast_slots;
104 	uint32_t min_no_twt_slots;
105 	uint32_t max_no_sta_twt;
106 	uint32_t mode_check_interval;
107 	uint32_t add_sta_slot_interval;
108 	uint32_t remove_sta_slot_interval;
109 	enum WMI_TWT_ROLE twt_role;
110 	enum WMI_TWT_OPERATION twt_oper;
111 	bool ext_conf_present;
112 	uint32_t b_twt_enable:1,
113 		 b_twt_legacy_mbss_enable:1,
114 		 b_twt_ax_mbss_enable:1;
115 };
116 
117 /* status code of enabling TWT
118  * WMI_ENABLE_TWT_STATUS_OK: enabling TWT successfully completed
119  * WMI_ENABLE_TWT_STATUS_ALREADY_ENABLED: TWT already enabled
120  * WMI_ENABLE_TWT_STATUS_NOT_READY: FW not ready for enabling TWT
121  * WMI_ENABLE_TWT_INVALID_PARAM: invalid parameters
122  * WMI_ENABLE_TWT_STATUS_UNKNOWN_ERROR: enabling TWT failed with an
123  *                                      unknown reason
124  */
125 enum WMI_HOST_ENABLE_TWT_STATUS {
126 	WMI_HOST_ENABLE_TWT_STATUS_OK,
127 	WMI_HOST_ENABLE_TWT_STATUS_ALREADY_ENABLED,
128 	WMI_HOST_ENABLE_TWT_STATUS_NOT_READY,
129 	WMI_HOST_ENABLE_TWT_INVALID_PARAM,
130 	WMI_HOST_ENABLE_TWT_STATUS_UNKNOWN_ERROR,
131 };
132 
133 /**
134  * struct wmi_twt_enable_complete_event_param:
135  * @pdev_is: pdev_id for identifying the MAC.
136  * @status: From enum WMI_HOST_ENABLE_TWT_STATUS
137  */
138 struct wmi_twt_enable_complete_event_param {
139 	uint32_t pdev_id;
140 	uint32_t status;
141 };
142 
143 /**
144  * struct wmi_twt_disable_param:
145  * @pdev_id: pdev_id for identifying the MAC.
146  * @ext_conf_present: If requestor/responder extend config is present.
147  * @twt_role: values from enum WMI_TWT_ROLE.
148  * @twt_oper: values from enum WMI_TWT_OPERATION.
149  */
150 struct wmi_twt_disable_param {
151 	uint32_t pdev_id;
152 	bool ext_conf_present;
153 	enum WMI_TWT_ROLE twt_role;
154 	enum WMI_TWT_OPERATION twt_oper;
155 };
156 
157 /**
158  * struct wmi_twt_disable_complete_event:
159  * @pdev_id: pdev_id for identifying the MAC.
160  */
161 struct wmi_twt_disable_complete_event {
162 	uint32_t pdev_id;
163 };
164 
165 /**
166  * wmi_twt_ack_complete_event_param:
167  * @vdev_id: vdev id
168  * @peer_macaddr: peer mac address
169  * @dialog_id: dialog id
170  * @twt_cmd_ack: ack event to the corresponding twt command
171  * @status: twt command status
172  */
173 struct wmi_twt_ack_complete_event_param {
174 	uint32_t vdev_id;
175 	struct qdf_mac_addr peer_macaddr;
176 	uint32_t dialog_id;
177 	uint32_t twt_cmd_ack;
178 	uint32_t status;
179 };
180 
181 /* TWT event types
182  *  refer to wmi_unified.h enum wmi_twt_session_stats_type
183  */
184 enum host_twt_session_stats_type {
185 	HOST_TWT_SESSION_SETUP     = 1,
186 	HOST_TWT_SESSION_TEARDOWN  = 2,
187 	HOST_TWT_SESSION_UPDATE    = 3,
188 };
189 
190 /**
191  * struct wmi_host_twt_session_stats_info:
192  * @vdev_id: id of VDEV for twt session
193  * @peer_mac: MAC address of node
194  * @event_type: Indicates TWT session type (SETUP/TEARDOWN/UPDATE)
195  * @flow_id: TWT flow identifier established with TWT peer
196  * @bcast:  If this is a broacast TWT session
197  * @trig: If the TWT session is trigger enabled
198  * @announ: If the flow type is announced/unannounced
199  * @protection: If the TWT protection field is set
200  * @info_frame_disabled: If the TWT Information frame is disabled
201  * @pm_responder_bit_valid: pm responder bit is valid or not
202  * @pm_responder_bit: pm responder value
203  * @dialog_id: Dialog_id of current session
204  * @wake_dura_us: wake duration in us
205  * @wake_intvl_us: wake time interval in us
206  * @sp_offset_us: Time until initial TWT SP occurs
207  * @sp_tsf_us_lo: TWT wake time TSF in usecs lower bits - 31:0
208  * @sp_tsf_us_hi: TWT wake time TSF in usecs higher bits - 63:32
209  */
210 struct wmi_host_twt_session_stats_info {
211 	uint32_t vdev_id;
212 	uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
213 	uint32_t event_type;
214 	uint32_t flow_id:16,
215 		 bcast:1,
216 		 trig:1,
217 		 announ:1,
218 		 protection:1,
219 		 info_frame_disabled:1,
220 		 pm_responder_bit_valid:1,
221 		 pm_responder_bit:1;
222 	uint32_t dialog_id;
223 	uint32_t wake_dura_us;
224 	uint32_t wake_intvl_us;
225 	uint32_t sp_offset_us;
226 	uint32_t sp_tsf_us_lo;
227 	uint32_t sp_tsf_us_hi;
228 };
229 
230 /**
231  * struct wmi_twt_session_stats_event:
232  * @pdev_id: pdev_id for identifying the MAC.
233  * @num_sessions: number of TWT sessions
234  * @twt_sessions: received TWT sessions
235  */
236 struct wmi_twt_session_stats_event_param {
237 	uint32_t pdev_id;
238 	uint32_t num_sessions;
239 };
240 
241 /* from IEEE 802.11ah section 9.4.2.200 */
242 enum WMI_HOST_TWT_COMMAND {
243 	WMI_HOST_TWT_COMMAND_REQUEST_TWT    = 0,
244 	WMI_HOST_TWT_COMMAND_SUGGEST_TWT    = 1,
245 	WMI_HOST_TWT_COMMAND_DEMAND_TWT     = 2,
246 	WMI_HOST_TWT_COMMAND_TWT_GROUPING   = 3,
247 	WMI_HOST_TWT_COMMAND_ACCEPT_TWT     = 4,
248 	WMI_HOST_TWT_COMMAND_ALTERNATE_TWT  = 5,
249 	WMI_HOST_TWT_COMMAND_DICTATE_TWT    = 6,
250 	WMI_HOST_TWT_COMMAND_REJECT_TWT     = 7,
251 };
252 
253 /**
254  * struct wmi_twt_add_dialog_param -
255  * @vdev_id: VDEV identifier
256  * @peer_macaddr: peer MAC address when vdev is AP VDEV
257  * @dialog_id: diaglog_id (TWT dialog ID)
258  *             This dialog ID must be unique within its vdev.
259  * @wake_intvl_us: TWT Wake Interval in units of us
260  * @wake_intvl_mantis: TWT Wake Interval Mantissa
261  *                 - wake_intvl_mantis must be <= 0xFFFF
262  *                 - wake_intvl_us must be divided evenly by wake_intvl_mantis,
263  *                   i.e., wake_intvl_us % wake_intvl_mantis == 0
264  *                 - the quotient of wake_intvl_us/wake_intvl_mantis must be
265  *                   2 to N-th(0<=N<=31) power,
266  *                   i.e., wake_intvl_us/wake_intvl_mantis == 2^N, 0<=N<=31
267  * @min_wake_intvl_us: Min tolerance limit of TWT wake interval
268  * @max_wake_intvl_us: Max tolerance limit of TWT wake interval
269  * @wake_dura_us: TWT Wake Duration in units of us, must be <= 0xFFFF
270  *                wake_dura_us must be divided evenly by 256,
271  *                i.e., wake_dura_us % 256 == 0
272  * @min_wake_dura_us: Min tolerance limit of TWT wake duration.
273  * @max_wake_dura_us: Max tolerance limit of TWT wake duration.
274  * @sp_offset_us: this long time after TWT setup the 1st SP will start.
275  * @twt_cmd: cmd from enum WMI_HOST_TWT_COMMAND
276  * @flag_bcast: 0 means Individual TWT,
277  *              1 means Broadcast TWT
278  * @flag_trigger: 0 means non-Trigger-enabled TWT,
279  *                1 means  means Trigger-enabled TWT
280  * @flag_flow_type:  0 means announced TWT,
281  *                   1 means un-announced TWT
282  * @flag_protection: 0 means TWT protection is required,
283  *                   1 means TWT protection is not required
284  * @b_twt_id0: 0 means BTWT recommendation will not be used
285  *             1 means BTWT recommendation will be used
286  * @flag_reserved: unused bits
287  * @b_twt_recommendation: defines types of frames tx during bTWT SP
288  * @b_twt_persistence: Countdown VAL frames to param update/teardown
289  * @wake_time_tsf: Absolute TSF value to start first TWT service period
290  * @annouce_timeout_us: Timeout value before sending QoS NULL frame.
291  */
292 struct wmi_twt_add_dialog_param {
293 	uint32_t vdev_id;
294 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
295 	uint32_t dialog_id;
296 	uint32_t wake_intvl_us;
297 	uint32_t wake_intvl_mantis;
298 	uint32_t min_wake_intvl_us;
299 	uint32_t max_wake_intvl_us;
300 	uint32_t wake_dura_us;
301 	uint32_t min_wake_dura_us;
302 	uint32_t max_wake_dura_us;
303 	uint32_t sp_offset_us;
304 	enum WMI_HOST_TWT_COMMAND twt_cmd;
305 	uint32_t
306 		flag_bcast:1,
307 		flag_trigger:1,
308 		flag_flow_type:1,
309 		flag_protection:1,
310 		flag_b_twt_id0:1,
311 		flag_reserved:11,
312 		b_twt_persistence:8,
313 		b_twt_recommendation:3;
314 	uint64_t wake_time_tsf;
315 	uint32_t announce_timeout_us;
316 };
317 
318 /* enum - status code of Get stats TWT dialog
319  * @WMI_HOST_GET_STATS_TWT_STATUS_OK: Get status TWT dialog successfully completed
320  * @WMI_HOST_GET_STATS_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID does not exist
321  * @WMI_HOST_GET_STATS_TWT_STATUS_INVALID_PARAM: Invalid parameters
322  * @WMI_HOST_GET_STATS_TWT_STATUS_UNKNOWN_ERROR: Unknown error
323  */
324 enum WMI_HOST_GET_STATS_TWT_STATUS {
325 	WMI_HOST_GET_STATS_TWT_STATUS_OK,
326 	WMI_HOST_GET_STATS_TWT_STATUS_DIALOG_ID_NOT_EXIST,
327 	WMI_HOST_GET_STATS_TWT_STATUS_INVALID_PARAM,
328 	WMI_HOST_GET_STATS_TWT_STATUS_UNKNOWN_ERROR,
329 };
330 
331 /* enum - status code of adding TWT dialog
332  * @WMI_HOST_ADD_TWT_STATUS_OK: adding TWT dialog successfully completed
333  * @WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED: TWT not enabled
334  * @WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID: TWT dialog ID is already used
335  * @WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM: invalid parameters
336  * @WMI_HOST_ADD_TWT_STATUS_NOT_READY: FW not ready
337  * @WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE: FW resource exhausted
338  * @WMI_HOST_ADD_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
339  * request/response frame
340  * @WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE: peer AP did not send the response frame
341  * @WMI_HOST_ADD_TWT_STATUS_DENIED: AP did not accept the request
342  * @WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR: adding TWT dialog failed with
343  * an unknown reason
344  * @WMI_HOST_ADD_TWT_STATUS_AP_PARAMS_NOT_IN_RANGE: peer AP wake interval,
345  * duration not in range
346  * @WMI_HOST_ADD_TWT_STATUS_AP_IE_VALIDATION_FAILED: peer AP IE Validation
347  * Failed
348  * @WMI_HOST_ADD_TWT_STATUS_ROAM_IN_PROGRESS: Roaming in progress
349  * @WMI_HOST_ADD_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
350  * @WMI_HOST_ADD_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
351  */
352 enum WMI_HOST_ADD_TWT_STATUS {
353 	WMI_HOST_ADD_TWT_STATUS_OK,
354 	WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED,
355 	WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID,
356 	WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM,
357 	WMI_HOST_ADD_TWT_STATUS_NOT_READY,
358 	WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE,
359 	WMI_HOST_ADD_TWT_STATUS_NO_ACK,
360 	WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE,
361 	WMI_HOST_ADD_TWT_STATUS_DENIED,
362 	WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR,
363 	WMI_HOST_ADD_TWT_STATUS_AP_PARAMS_NOT_IN_RANGE,
364 	WMI_HOST_ADD_TWT_STATUS_AP_IE_VALIDATION_FAILED,
365 	WMI_HOST_ADD_TWT_STATUS_ROAM_IN_PROGRESS,
366 	WMI_HOST_ADD_TWT_STATUS_CHAN_SW_IN_PROGRESS,
367 	WMI_HOST_ADD_TWT_STATUS_SCAN_IN_PROGRESS,
368 };
369 
370 /**
371  * struct wmi_twt_add_dialog_additional_params -
372  * @twt_cmd: TWT command
373  * @bcast: 0 means Individual TWT
374  *         1 means Broadcast TWT
375  * @trig_en: 0 means non-Trigger-enabled TWT
376  *           1 means Trigger-enabled TWT
377  * @announce: 0 means announced TWT
378  *            1 means un-announced TWT
379  * @protection: 0 means TWT protection is required
380  *              1 means TWT protection is not required
381  * @b_twt_id0: 0 means non-0 B-TWT ID or I-TWT
382  *             1 means B-TWT ID 0
383  * @info_frame_disabled: 0 means TWT Information frame is enabled
384  *                       1 means TWT Information frame is disabled
385  * @pm_responder_bit_valid: 1 means responder pm mode field is valid
386  *                          0 means responder pm mode field is not valid
387  * @pm_responder_bit: 1 means that responder set responder pm mode to 1
388  *                    0 means that responder set responder pm mode to 0
389  * @wake_dura_us: wake duration in us
390  * @wake_intvl_us: wake time interval in us
391  * @sp_offset_us: Time until initial TWT SP occurs
392  * @sp_tsf_us_lo: TWT service period tsf in usecs lower bits - 31:0
393  * @sp_tsf_us_hi: TWT service period tsf in usecs higher bits - 63:32
394  */
395 struct wmi_twt_add_dialog_additional_params {
396 	uint32_t twt_cmd:8,
397 		 bcast:1,
398 		 trig_en:1,
399 		 announce:1,
400 		 protection:1,
401 		 b_twt_id0:1,
402 		 info_frame_disabled:1,
403 		 pm_responder_bit_valid:1,
404 		 pm_responder_bit:1;
405 	uint32_t wake_dur_us;
406 	uint32_t wake_intvl_us;
407 	uint32_t sp_offset_us;
408 	uint32_t sp_tsf_us_lo;
409 	uint32_t sp_tsf_us_hi;
410 };
411 
412 /**
413  * struct wmi_twt_add_dialog_complete_param -
414  * @vdev_id: VDEV identifier
415  * @peer_macaddr: Peer mac address
416  * @dialog_id: TWT dialog ID
417  * @status: refer to WMI_HOST_ADD_TWT_STATUS enum
418  * @num_additional_twt_params: no of additional_twt_params available
419  */
420 struct wmi_twt_add_dialog_complete_event_param {
421 	uint32_t vdev_id;
422 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
423 	uint32_t dialog_id;
424 	uint32_t status;
425 	uint32_t num_additional_twt_params;
426 };
427 
428 /**
429  * struct wmi_twt_cap_bitmap_params -
430  * twt_cap_bitmap: TWT capability bitmap
431  *
432  */
433 struct wmi_twt_cap_bitmap_params {
434 	uint32_t twt_ack_support_cap:1;
435 };
436 
437 /**
438  * struct wmi_twt_del_dialog_param -
439  * @vdev_id: VDEV identifier
440  * @peer_macaddr: Peer mac address
441  * @dialog_id: TWT dialog ID
442  * @b_twt_persistence: persistence val for b-twt
443  */
444 struct wmi_twt_del_dialog_param {
445 	uint32_t vdev_id;
446 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
447 	uint32_t dialog_id;
448 #ifdef WLAN_SUPPORT_BCAST_TWT
449 	uint32_t b_twt_persistence;
450 #endif
451 };
452 
453 /**
454  * enum WMI_HOST_DEL_TWT_STATUS - status code of deleting TWT dialog
455  * @WMI_HOST_DEL_TWT_STATUS_OK: deleting TWT dialog successfully completed
456  * @WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
457  * @WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM: invalid parameters
458  * @WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
459  * this dialog
460  * @WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE: FW resource exhausted
461  * @WMI_HOST_DEL_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the request/response
462  * frame
463  * @WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR: deleting TWT dialog failed with an
464  * unknown reason
465  * @WMI_HOST_DEL_TWT_STATUS_PEER_INIT_TEARDOWN: Peer initiated TWT teardown
466  * @WMI_HOST_DEL_TWT_STATUS_ROAMING: TWT teardown due to roaming.
467  * @WMI_HOST_DEL_TWT_STATUS_CONCURRENCY: TWT session teardown due to
468  * concurrent session comming up.
469  * @WMI_HOST_DEL_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
470  * @WMI_HOST_DEL_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
471  * @WMI_HOST_DEL_TWT_STATUS_PS_DISABLE_TEARDOWN: PS disable TWT teardown
472  */
473 enum WMI_HOST_DEL_TWT_STATUS {
474 	WMI_HOST_DEL_TWT_STATUS_OK,
475 	WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST,
476 	WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM,
477 	WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY,
478 	WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE,
479 	WMI_HOST_DEL_TWT_STATUS_NO_ACK,
480 	WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR,
481 	WMI_HOST_DEL_TWT_STATUS_PEER_INIT_TEARDOWN,
482 	WMI_HOST_DEL_TWT_STATUS_ROAMING,
483 	WMI_HOST_DEL_TWT_STATUS_CONCURRENCY,
484 	WMI_HOST_DEL_TWT_STATUS_CHAN_SW_IN_PROGRESS,
485 	WMI_HOST_DEL_TWT_STATUS_SCAN_IN_PROGRESS,
486 	WMI_HOST_DEL_TWT_STATUS_PS_DISABLE_TEARDOWN,
487 };
488 
489 /**
490  * struct wmi_twt_del_dialog_complete_event_param -
491  * @vdev_id: VDEV identifier
492  * @peer_macaddr: Peer mac address
493  * @dialog_id: TWT dialog ID
494  * @b_twt_persistence: persistence val for b-twt
495  * @status: refer to WMI_HOST_DEL_TWT_STATUS enum
496  */
497 struct wmi_twt_del_dialog_complete_event_param {
498 	uint32_t vdev_id;
499 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
500 	uint32_t dialog_id;
501 #ifdef WLAN_SUPPORT_BCAST_TWT
502 	uint32_t b_twt_persistence;
503 #endif
504 	uint32_t status;
505 };
506 
507 /**
508  * struct wmi_twt_pause_dialog_cmd_param -
509  * @vdev_id: VDEV identifier
510  * @peer_macaddr: Peer mac address
511  * @dialog_id: TWT dialog ID
512  */
513 struct wmi_twt_pause_dialog_cmd_param {
514 	uint32_t vdev_id;
515 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
516 	uint32_t dialog_id;
517 };
518 
519 /**
520  * struct wmi_twt_nudge_dialog_cmd_param -
521  * @vdev_id: VDEV identifier
522  * @peer_macaddr: Peer mac address
523  * @dialog_id: TWT dialog ID
524  * @suspend_duration: TWT suspend duration in microseconds
525  * @next_twt_size: next TWT size
526  */
527 struct wmi_twt_nudge_dialog_cmd_param {
528 	uint32_t vdev_id;
529 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
530 	uint32_t dialog_id;
531 	uint32_t suspend_duration;
532 	uint32_t next_twt_size;
533 };
534 
535 /* enum WMI_HOST_PAUSE_TWT_STATUS - status code of pausing TWT dialog
536  * @WMI_HOST_PAUSE_TWT_STATUS_OK: pausing TWT dialog successfully completed
537  * @WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
538  * @WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM: invalid parameters
539  * @WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
540  * this dialog
541  * @WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE: FW resource exhausted
542  * @WMI_HOST_PAUSE_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
543  * request/response frame
544  * @WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR: pausing TWT dialog failed with an
545  * unknown reason
546  * @WMI_HOST_PAUSE_TWT_STATUS_ALREADY_PAUSED: TWT dialog already in paused state
547  * @WMI_HOST_PAUSE_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
548  * @WMI_HOST_PAUSE_TWT_STATUS_ROAM_IN_PROGRESS: Roaming is in progress
549  * @WMI_HOST_PAUSE_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
550  */
551 enum WMI_HOST_PAUSE_TWT_STATUS {
552 	WMI_HOST_PAUSE_TWT_STATUS_OK,
553 	WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST,
554 	WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM,
555 	WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY,
556 	WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE,
557 	WMI_HOST_PAUSE_TWT_STATUS_NO_ACK,
558 	WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR,
559 	WMI_HOST_PAUSE_TWT_STATUS_ALREADY_PAUSED,
560 	WMI_HOST_PAUSE_TWT_STATUS_CHAN_SW_IN_PROGRESS,
561 	WMI_HOST_PAUSE_TWT_STATUS_ROAM_IN_PROGRESS,
562 	WMI_HOST_PAUSE_TWT_STATUS_SCAN_IN_PROGRESS,
563 };
564 
565 /**
566  * struct wmi_twt_pause_dialog_complete_event_param -
567  * @vdev_id: VDEV identifier
568  * @peer_macaddr: Peer mac address
569  * @dialog_id: TWT dialog ID
570  * @status: refer to WMI_HOST_PAUSE_TWT_STATUS
571  */
572 struct wmi_twt_pause_dialog_complete_event_param {
573 	uint32_t vdev_id;
574 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
575 	uint32_t dialog_id;
576 	enum WMI_HOST_PAUSE_TWT_STATUS status;
577 };
578 
579 /* enum WMI_HOST_NUDGE_TWT_STATUS - status code of nudge TWT dialog
580  * @WMI_HOST_NUDGE_TWT_STATUS_OK: nudge TWT dialog successfully completed
581  * @WMI_HOST_NUDGE_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
582  * @WMI_HOST_NUDGE_TWT_STATUS_INVALID_PARAM: invalid parameters
583  * @WMI_HOST_NUDGE_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
584  * this dialog
585  * @WMI_HOST_NUDGE_TWT_STATUS_NO_RESOURCE: FW resource exhausted
586  * @WMI_HOST_NUDGE_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
587  * request/response frame
588  * @WMI_HOST_NUDGE_TWT_STATUS_UNKNOWN_ERROR: nudge TWT dialog failed with an
589  * unknown reason
590  * @WMI_HOST_NUDGE_TWT_STATUS_ALREADY_PAUSED: TWT dialog already in paused state
591  * @WMI_HOST_NUDGE_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
592  * @WMI_HOST_NUDGE_TWT_STATUS_ROAM_IN_PROGRESS: Roaming in progress
593  * @WMI_HOST_NUDGE_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
594  */
595 enum WMI_HOST_NUDGE_TWT_STATUS {
596 	WMI_HOST_NUDGE_TWT_STATUS_OK,
597 	WMI_HOST_NUDGE_TWT_STATUS_DIALOG_ID_NOT_EXIST,
598 	WMI_HOST_NUDGE_TWT_STATUS_INVALID_PARAM,
599 	WMI_HOST_NUDGE_TWT_STATUS_DIALOG_ID_BUSY,
600 	WMI_HOST_NUDGE_TWT_STATUS_NO_RESOURCE,
601 	WMI_HOST_NUDGE_TWT_STATUS_NO_ACK,
602 	WMI_HOST_NUDGE_TWT_STATUS_UNKNOWN_ERROR,
603 	WMI_HOST_NUDGE_TWT_STATUS_ALREADY_PAUSED,
604 	WMI_HOST_NUDGE_TWT_STATUS_CHAN_SW_IN_PROGRESS,
605 	WMI_HOST_NUDGE_TWT_STATUS_ROAM_IN_PROGRESS,
606 	WMI_HOST_NUDGE_TWT_STATUS_SCAN_IN_PROGRESS,
607 };
608 
609 /**
610  * struct wmi_twt_nudge_dialog_complete_event_param -
611  * @vdev_id: VDEV identifier
612  * @peer_macaddr: Peer mac address
613  * @dialog_id: TWT dialog ID
614  * @status: refer to WMI_HOST_PAUSE_TWT_STATUS
615  * @next_twt_tsf_us_lo: TSF lower bits (31:0) of next wake time
616  * @next_twt_tsf_us_hi: TSF higher bits (32:63) of next wake time
617  */
618 struct wmi_twt_nudge_dialog_complete_event_param {
619 	uint32_t vdev_id;
620 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
621 	uint32_t dialog_id;
622 	enum WMI_HOST_NUDGE_TWT_STATUS status;
623 	uint32_t next_twt_tsf_us_lo;
624 	uint32_t next_twt_tsf_us_hi;
625 };
626 
627 /**
628  * struct wmi_twt_resume_dialog_cmd_param -
629  * @vdev_id: VDEV identifier
630  * @peer_macaddr: Peer mac address
631  * @dialog_id: TWT dialog ID
632  * @sp_offset_us: this long time after TWT resumed the 1st SP will start
633  * @next_twt_size: Next TWT subfield Size.
634  *                 Refer IEEE 802.11ax section "9.4.1.60 TWT Information field"
635  */
636 struct wmi_twt_resume_dialog_cmd_param {
637 	uint32_t vdev_id;
638 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
639 	uint32_t dialog_id;
640 	uint32_t sp_offset_us;
641 	uint32_t next_twt_size;
642 };
643 
644 /* enum WMI_HOST_RESUME_TWT_STATUS - status code of resuming TWT dialog
645  * @WMI_HOST_RESUME_TWT_STATUS_OK: resuming TWT dialog successfully completed
646  * @WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
647  * @WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM: invalid parameters
648  * @WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
649  * this dialog
650  * @WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED: dialog not paused currently
651  * @WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE: FW resource exhausted
652  * @WMI_HOST_RESUME_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
653  * request/response frame
654  * @WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR: resuming TWT dialog failed with an
655  * unknown reason
656  * @WMI_HOST_RESUME_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
657  * @WMI_HOST_RESUME_TWT_STATUS_ROAM_IN_PROGRESS: Roaming in progress
658  * @WMI_HOST_RESUME_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
659  */
660 enum WMI_HOST_RESUME_TWT_STATUS {
661 	WMI_HOST_RESUME_TWT_STATUS_OK,
662 	WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST,
663 	WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM,
664 	WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY,
665 	WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED,
666 	WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE,
667 	WMI_HOST_RESUME_TWT_STATUS_NO_ACK,
668 	WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR,
669 	WMI_HOST_RESUME_TWT_STATUS_CHAN_SW_IN_PROGRESS,
670 	WMI_HOST_RESUME_TWT_STATUS_ROAM_IN_PROGRESS,
671 	WMI_HOST_RESUME_TWT_STATUS_SCAN_IN_PROGRESS,
672 };
673 
674 /**
675  * struct wmi_twt_resume_dialog_complete_event_param -
676  * @vdev_id: VDEV identifier
677  * @peer_macaddr: Peer mac address
678  * @dialog_id: TWT dialog ID
679  * @status: refer to WMI_HOST_RESUME_TWT_STATUS
680  */
681 struct wmi_twt_resume_dialog_complete_event_param {
682 	uint32_t vdev_id;
683 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
684 	uint32_t dialog_id;
685 	uint32_t status;
686 };
687 
688 /**
689  * struct wmi_twt_notify_event_param -
690  * @vdev_id: VDEV identifier
691  */
692 struct wmi_twt_notify_event_param {
693 	uint32_t vdev_id;
694 };
695 
696 #ifdef WLAN_SUPPORT_BCAST_TWT
697 /**
698  * struct wmi_twt_btwt_invite_sta_cmd_param -
699  * @vdev_id: VDEV identifier
700  * @peer_macaddr: Peer mac address
701  * @dialog_id: TWT dialog ID
702  */
703 struct wmi_twt_btwt_invite_sta_cmd_param {
704 	uint32_t vdev_id;
705 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
706 	uint32_t dialog_id;
707 };
708 
709 /* enum WMI_HOST_INVITATION_TWT_BTWT_STATUS - status code of TWT Invitation
710  *                              dialog
711  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_OK: BTWT invitation successfully
712  *                              completed
713  * WMI_HOST_INVITATION_TWT_TWT_STATUS_DIALOG_ID_NOT_EXIST: BTWT dialog ID not
714  *                              exists
715  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_INVALID_PARAM: invalid parameters
716  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_DIALOG_ID_BUSY: FW is in the process of
717  *                              handling this dialog
718  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_NO_RESOURCE: FW resource exhausted
719  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_NO_ACK: peer AP/STA did not ACK the
720  *                              request/response frame
721  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_UNKNOWN_ERROR: BTWT invitation failed
722  *                              with an unknown reason
723  */
724 enum WMI_HOST_INVITATION_TWT_BTWT_STATUS {
725 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_OK,
726 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_DIALOG_ID_NOT_EXIST,
727 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_INVALID_PARAM,
728 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_DIALOG_ID_BUSY,
729 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_NO_RESOURCE,
730 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_NO_ACK,
731 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_UNKNOWN_ERROR,
732 };
733 
734 /**
735  * struct wmi_twt_btwt_invite_sta_complete_event_param -
736  * @vdev_id: VDEV identifier
737  * @peer_macaddr: Peer mac address
738  * @dialog_id: BTWT dialog ID
739  * @status: refer to WMI_HOST_INVITATION_TWT_BTWT_STATUS
740  */
741 struct wmi_twt_btwt_invite_sta_complete_event_param {
742 		uint32_t vdev_id;
743 		uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
744 		uint32_t dialog_id;
745 		uint32_t status;
746 };
747 
748 /**
749  * struct wmi_twt_btwt_remove_sta_cmd_param -
750  * @vdev_id: VDEV identifier
751  * @peer_macaddr: Peer mac address
752  * @dialog_id: BTWT dialog ID
753  */
754 struct wmi_twt_btwt_remove_sta_cmd_param {
755 		uint32_t vdev_id;
756 		uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
757 		uint32_t dialog_id;
758 };
759 
760 /* enum WMI_HOST_KICKOFF_TWT_BTWT_STATUS - status code of resuming TWT dialog
761  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_OK: TWT kickoff successfully completed
762  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_DIALOG_ID_NOT_EXIST: BTWT dialog ID not
763  *                              exists
764  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_INVALID_PARAM: invalid parameters
765  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_DIALOG_ID_BUSY: FW is in the process of
766  *                              handling this dialog
767  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NOT_PAUSED: Dialog not currently paused
768  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NO_RESOURCE: FW resource exhausted
769  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NO_ACK: peer AP/STA did not ACK the
770  *                              request/response frame
771  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_UNKNOWN_ERROR: BTWT kickoff failed with an
772  *                              unknown reason
773  */
774 enum WMI_HOST_KICKOFF_TWT_BTWT_STATUS {
775 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_OK,
776 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_DIALOG_ID_NOT_EXIST,
777 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_INVALID_PARAM,
778 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_DIALOG_ID_BUSY,
779 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NOT_PAUSED,
780 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NO_RESOURCE,
781 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NO_ACK,
782 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_UNKNOWN_ERROR,
783 };
784 
785 /**
786  * struct wmi_twt_btwt_remove_sta_complete_event_param -
787  * @vdev_id: VDEV identifier
788  * @peer_macaddr: Peer mac address
789  * @dialog_id: BTWT dialog ID
790  * @status: refer to WMI_HOST_KICKOFF_TWT_BTWT_STATUS
791  */
792 struct wmi_twt_btwt_remove_sta_complete_event_param {
793 	uint32_t vdev_id;
794 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
795 	uint32_t dialog_id;
796 	uint32_t status;
797 };
798 #endif
799 
800 /**
801  * enum WMI_HOST_TWT_CMD_FOR_ACK_EVENT - Ack event for different TWT command
802  * WMI_HOST_TWT_ADD_DIALOG_CMDID: Ack event for add dialog command
803  * WMI_HOST_TWT_DEL_DIALOG_CMDID: Ack event for delete dialog command
804  * WMI_HOST_TWT_PAUSE_DIALOG_CMDID: Ack event for pause command
805  * WMI_HOST_TWT_RESUME_DIALOG_CMDID: Ack event for resume command
806  * WMI_HOST_TWT_NUDGE_DIALOG_CMDID: Ack event for nudge command
807  * WMI_HOST_TWT_UNKNOWN_CMDID: Ack event for unknown TWT command
808  */
809 enum WMI_HOST_TWT_CMD_FOR_ACK_EVENT {
810 	WMI_HOST_TWT_ADD_DIALOG_CMDID = 0,
811 	WMI_HOST_TWT_DEL_DIALOG_CMDID,
812 	WMI_HOST_TWT_PAUSE_DIALOG_CMDID,
813 	WMI_HOST_TWT_RESUME_DIALOG_CMDID,
814 	WMI_HOST_TWT_NUDGE_DIALOG_CMDID,
815 	WMI_HOST_TWT_UNKNOWN_CMDID,
816 };
817 #endif /* _WMI_UNIFIED_TWT_PARAM_H_ */
818