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