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