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