xref: /wlan-dirver/qca-wifi-host-cmn/wmi/inc/wmi_unified_twt_param.h (revision 10fe6982eb7194813d8d8335da336bbcd531b22e)
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 broacast 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  */
364 enum WMI_HOST_ADD_TWT_STATUS {
365 	WMI_HOST_ADD_TWT_STATUS_OK,
366 	WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED,
367 	WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID,
368 	WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM,
369 	WMI_HOST_ADD_TWT_STATUS_NOT_READY,
370 	WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE,
371 	WMI_HOST_ADD_TWT_STATUS_NO_ACK,
372 	WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE,
373 	WMI_HOST_ADD_TWT_STATUS_DENIED,
374 	WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR,
375 	WMI_HOST_ADD_TWT_STATUS_AP_PARAMS_NOT_IN_RANGE,
376 	WMI_HOST_ADD_TWT_STATUS_AP_IE_VALIDATION_FAILED,
377 	WMI_HOST_ADD_TWT_STATUS_ROAM_IN_PROGRESS,
378 	WMI_HOST_ADD_TWT_STATUS_CHAN_SW_IN_PROGRESS,
379 	WMI_HOST_ADD_TWT_STATUS_SCAN_IN_PROGRESS,
380 };
381 
382 /**
383  * struct wmi_twt_add_dialog_additional_params -
384  * @twt_cmd: TWT command
385  * @bcast: 0 means Individual TWT
386  *         1 means Broadcast TWT
387  * @trig_en: 0 means non-Trigger-enabled TWT
388  *           1 means Trigger-enabled TWT
389  * @announce: 0 means announced TWT
390  *            1 means un-announced TWT
391  * @protection: 0 means TWT protection is required
392  *              1 means TWT protection is not required
393  * @b_twt_id0: 0 means non-0 B-TWT ID or I-TWT
394  *             1 means B-TWT ID 0
395  * @info_frame_disabled: 0 means TWT Information frame is enabled
396  *                       1 means TWT Information frame is disabled
397  * @pm_responder_bit_valid: 1 means responder pm mode field is valid
398  *                          0 means responder pm mode field is not valid
399  * @pm_responder_bit: 1 means that responder set responder pm mode to 1
400  *                    0 means that responder set responder pm mode to 0
401  * @wake_dur_us: wake duration in us
402  * @wake_intvl_us: wake time interval in us
403  * @sp_offset_us: Time until initial TWT SP occurs
404  * @sp_tsf_us_lo: TWT service period tsf in usecs lower bits - 31:0
405  * @sp_tsf_us_hi: TWT service period tsf in usecs higher bits - 63:32
406  */
407 struct wmi_twt_add_dialog_additional_params {
408 	uint32_t twt_cmd:8,
409 		 bcast:1,
410 		 trig_en:1,
411 		 announce:1,
412 		 protection:1,
413 		 b_twt_id0:1,
414 		 info_frame_disabled:1,
415 		 pm_responder_bit_valid:1,
416 		 pm_responder_bit:1;
417 	uint32_t wake_dur_us;
418 	uint32_t wake_intvl_us;
419 	uint32_t sp_offset_us;
420 	uint32_t sp_tsf_us_lo;
421 	uint32_t sp_tsf_us_hi;
422 };
423 
424 /**
425  * struct wmi_twt_add_dialog_complete_event_param - parameters from TWT
426  *	Add Dialog Complete event
427  * @vdev_id: VDEV identifier
428  * @peer_macaddr: Peer mac address
429  * @dialog_id: TWT dialog ID
430  * @status: refer to WMI_HOST_ADD_TWT_STATUS enum
431  * @num_additional_twt_params: no of additional_twt_params available
432  */
433 struct wmi_twt_add_dialog_complete_event_param {
434 	uint32_t vdev_id;
435 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
436 	uint32_t dialog_id;
437 	uint32_t status;
438 	uint32_t num_additional_twt_params;
439 };
440 
441 /**
442  * struct wmi_twt_cap_bitmap_params - TWT capabilities bitmap
443  * @twt_ack_support_cap: TWT ACK supported
444  *
445  */
446 struct wmi_twt_cap_bitmap_params {
447 	uint32_t twt_ack_support_cap:1;
448 };
449 
450 /**
451  * struct wmi_twt_del_dialog_param -
452  * @vdev_id: VDEV identifier
453  * @peer_macaddr: Peer mac address
454  * @dialog_id: TWT dialog ID
455  * @b_twt_persistence: persistence val for b-twt
456  */
457 struct wmi_twt_del_dialog_param {
458 	uint32_t vdev_id;
459 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
460 	uint32_t dialog_id;
461 #ifdef WLAN_SUPPORT_BCAST_TWT
462 	uint32_t b_twt_persistence;
463 #endif
464 };
465 
466 /**
467  * enum WMI_HOST_DEL_TWT_STATUS - status code of deleting TWT dialog
468  * @WMI_HOST_DEL_TWT_STATUS_OK: deleting TWT dialog successfully completed
469  * @WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
470  * @WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM: invalid parameters
471  * @WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
472  * this dialog
473  * @WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE: FW resource exhausted
474  * @WMI_HOST_DEL_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the request/response
475  * frame
476  * @WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR: deleting TWT dialog failed with an
477  * unknown reason
478  * @WMI_HOST_DEL_TWT_STATUS_PEER_INIT_TEARDOWN: Peer initiated TWT teardown
479  * @WMI_HOST_DEL_TWT_STATUS_ROAMING: TWT teardown due to roaming.
480  * @WMI_HOST_DEL_TWT_STATUS_CONCURRENCY: TWT session teardown due to
481  * concurrent session coming up.
482  * @WMI_HOST_DEL_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
483  * @WMI_HOST_DEL_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
484  * @WMI_HOST_DEL_TWT_STATUS_PS_DISABLE_TEARDOWN: PS disable TWT teardown
485  */
486 enum WMI_HOST_DEL_TWT_STATUS {
487 	WMI_HOST_DEL_TWT_STATUS_OK,
488 	WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST,
489 	WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM,
490 	WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY,
491 	WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE,
492 	WMI_HOST_DEL_TWT_STATUS_NO_ACK,
493 	WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR,
494 	WMI_HOST_DEL_TWT_STATUS_PEER_INIT_TEARDOWN,
495 	WMI_HOST_DEL_TWT_STATUS_ROAMING,
496 	WMI_HOST_DEL_TWT_STATUS_CONCURRENCY,
497 	WMI_HOST_DEL_TWT_STATUS_CHAN_SW_IN_PROGRESS,
498 	WMI_HOST_DEL_TWT_STATUS_SCAN_IN_PROGRESS,
499 	WMI_HOST_DEL_TWT_STATUS_PS_DISABLE_TEARDOWN,
500 };
501 
502 /**
503  * struct wmi_twt_del_dialog_complete_event_param -
504  * @vdev_id: VDEV identifier
505  * @peer_macaddr: Peer mac address
506  * @dialog_id: TWT dialog ID
507  * @b_twt_persistence: persistence val for b-twt
508  * @status: refer to WMI_HOST_DEL_TWT_STATUS enum
509  */
510 struct wmi_twt_del_dialog_complete_event_param {
511 	uint32_t vdev_id;
512 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
513 	uint32_t dialog_id;
514 #ifdef WLAN_SUPPORT_BCAST_TWT
515 	uint32_t b_twt_persistence;
516 #endif
517 	uint32_t status;
518 };
519 
520 /**
521  * struct wmi_twt_pause_dialog_cmd_param -
522  * @vdev_id: VDEV identifier
523  * @peer_macaddr: Peer mac address
524  * @dialog_id: TWT dialog ID
525  */
526 struct wmi_twt_pause_dialog_cmd_param {
527 	uint32_t vdev_id;
528 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
529 	uint32_t dialog_id;
530 };
531 
532 /**
533  * struct wmi_twt_nudge_dialog_cmd_param -
534  * @vdev_id: VDEV identifier
535  * @peer_macaddr: Peer mac address
536  * @dialog_id: TWT dialog ID
537  * @suspend_duration: TWT suspend duration in microseconds
538  * @next_twt_size: next TWT size
539  */
540 struct wmi_twt_nudge_dialog_cmd_param {
541 	uint32_t vdev_id;
542 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
543 	uint32_t dialog_id;
544 	uint32_t suspend_duration;
545 	uint32_t next_twt_size;
546 };
547 
548 /* enum WMI_HOST_PAUSE_TWT_STATUS - status code of pausing TWT dialog
549  * @WMI_HOST_PAUSE_TWT_STATUS_OK: pausing TWT dialog successfully completed
550  * @WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
551  * @WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM: invalid parameters
552  * @WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
553  * this dialog
554  * @WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE: FW resource exhausted
555  * @WMI_HOST_PAUSE_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
556  * request/response frame
557  * @WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR: pausing TWT dialog failed with an
558  * unknown reason
559  * @WMI_HOST_PAUSE_TWT_STATUS_ALREADY_PAUSED: TWT dialog already in paused state
560  * @WMI_HOST_PAUSE_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
561  * @WMI_HOST_PAUSE_TWT_STATUS_ROAM_IN_PROGRESS: Roaming is in progress
562  * @WMI_HOST_PAUSE_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
563  */
564 enum WMI_HOST_PAUSE_TWT_STATUS {
565 	WMI_HOST_PAUSE_TWT_STATUS_OK,
566 	WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST,
567 	WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM,
568 	WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY,
569 	WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE,
570 	WMI_HOST_PAUSE_TWT_STATUS_NO_ACK,
571 	WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR,
572 	WMI_HOST_PAUSE_TWT_STATUS_ALREADY_PAUSED,
573 	WMI_HOST_PAUSE_TWT_STATUS_CHAN_SW_IN_PROGRESS,
574 	WMI_HOST_PAUSE_TWT_STATUS_ROAM_IN_PROGRESS,
575 	WMI_HOST_PAUSE_TWT_STATUS_SCAN_IN_PROGRESS,
576 };
577 
578 /**
579  * struct wmi_twt_pause_dialog_complete_event_param -
580  * @vdev_id: VDEV identifier
581  * @peer_macaddr: Peer mac address
582  * @dialog_id: TWT dialog ID
583  * @status: refer to WMI_HOST_PAUSE_TWT_STATUS
584  */
585 struct wmi_twt_pause_dialog_complete_event_param {
586 	uint32_t vdev_id;
587 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
588 	uint32_t dialog_id;
589 	enum WMI_HOST_PAUSE_TWT_STATUS status;
590 };
591 
592 /* enum WMI_HOST_NUDGE_TWT_STATUS - status code of nudge TWT dialog
593  * @WMI_HOST_NUDGE_TWT_STATUS_OK: nudge TWT dialog successfully completed
594  * @WMI_HOST_NUDGE_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
595  * @WMI_HOST_NUDGE_TWT_STATUS_INVALID_PARAM: invalid parameters
596  * @WMI_HOST_NUDGE_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
597  * this dialog
598  * @WMI_HOST_NUDGE_TWT_STATUS_NO_RESOURCE: FW resource exhausted
599  * @WMI_HOST_NUDGE_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
600  * request/response frame
601  * @WMI_HOST_NUDGE_TWT_STATUS_UNKNOWN_ERROR: nudge TWT dialog failed with an
602  * unknown reason
603  * @WMI_HOST_NUDGE_TWT_STATUS_ALREADY_PAUSED: TWT dialog already in paused state
604  * @WMI_HOST_NUDGE_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
605  * @WMI_HOST_NUDGE_TWT_STATUS_ROAM_IN_PROGRESS: Roaming in progress
606  * @WMI_HOST_NUDGE_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
607  */
608 enum WMI_HOST_NUDGE_TWT_STATUS {
609 	WMI_HOST_NUDGE_TWT_STATUS_OK,
610 	WMI_HOST_NUDGE_TWT_STATUS_DIALOG_ID_NOT_EXIST,
611 	WMI_HOST_NUDGE_TWT_STATUS_INVALID_PARAM,
612 	WMI_HOST_NUDGE_TWT_STATUS_DIALOG_ID_BUSY,
613 	WMI_HOST_NUDGE_TWT_STATUS_NO_RESOURCE,
614 	WMI_HOST_NUDGE_TWT_STATUS_NO_ACK,
615 	WMI_HOST_NUDGE_TWT_STATUS_UNKNOWN_ERROR,
616 	WMI_HOST_NUDGE_TWT_STATUS_ALREADY_PAUSED,
617 	WMI_HOST_NUDGE_TWT_STATUS_CHAN_SW_IN_PROGRESS,
618 	WMI_HOST_NUDGE_TWT_STATUS_ROAM_IN_PROGRESS,
619 	WMI_HOST_NUDGE_TWT_STATUS_SCAN_IN_PROGRESS,
620 };
621 
622 /**
623  * struct wmi_twt_nudge_dialog_complete_event_param -
624  * @vdev_id: VDEV identifier
625  * @peer_macaddr: Peer mac address
626  * @dialog_id: TWT dialog ID
627  * @status: refer to WMI_HOST_PAUSE_TWT_STATUS
628  * @next_twt_tsf_us_lo: TSF lower bits (31:0) of next wake time
629  * @next_twt_tsf_us_hi: TSF higher bits (32:63) of next wake time
630  */
631 struct wmi_twt_nudge_dialog_complete_event_param {
632 	uint32_t vdev_id;
633 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
634 	uint32_t dialog_id;
635 	enum WMI_HOST_NUDGE_TWT_STATUS status;
636 	uint32_t next_twt_tsf_us_lo;
637 	uint32_t next_twt_tsf_us_hi;
638 };
639 
640 /**
641  * struct wmi_twt_resume_dialog_cmd_param -
642  * @vdev_id: VDEV identifier
643  * @peer_macaddr: Peer mac address
644  * @dialog_id: TWT dialog ID
645  * @sp_offset_us: this long time after TWT resumed the 1st SP will start
646  * @next_twt_size: Next TWT subfield Size.
647  *                 Refer IEEE 802.11ax section "9.4.1.60 TWT Information field"
648  */
649 struct wmi_twt_resume_dialog_cmd_param {
650 	uint32_t vdev_id;
651 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
652 	uint32_t dialog_id;
653 	uint32_t sp_offset_us;
654 	uint32_t next_twt_size;
655 };
656 
657 /* enum WMI_HOST_RESUME_TWT_STATUS - status code of resuming TWT dialog
658  * @WMI_HOST_RESUME_TWT_STATUS_OK: resuming TWT dialog successfully completed
659  * @WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
660  * @WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM: invalid parameters
661  * @WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
662  * this dialog
663  * @WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED: dialog not paused currently
664  * @WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE: FW resource exhausted
665  * @WMI_HOST_RESUME_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
666  * request/response frame
667  * @WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR: resuming TWT dialog failed with an
668  * unknown reason
669  * @WMI_HOST_RESUME_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
670  * @WMI_HOST_RESUME_TWT_STATUS_ROAM_IN_PROGRESS: Roaming in progress
671  * @WMI_HOST_RESUME_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
672  */
673 enum WMI_HOST_RESUME_TWT_STATUS {
674 	WMI_HOST_RESUME_TWT_STATUS_OK,
675 	WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST,
676 	WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM,
677 	WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY,
678 	WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED,
679 	WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE,
680 	WMI_HOST_RESUME_TWT_STATUS_NO_ACK,
681 	WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR,
682 	WMI_HOST_RESUME_TWT_STATUS_CHAN_SW_IN_PROGRESS,
683 	WMI_HOST_RESUME_TWT_STATUS_ROAM_IN_PROGRESS,
684 	WMI_HOST_RESUME_TWT_STATUS_SCAN_IN_PROGRESS,
685 };
686 
687 /**
688  * struct wmi_twt_resume_dialog_complete_event_param -
689  * @vdev_id: VDEV identifier
690  * @peer_macaddr: Peer mac address
691  * @dialog_id: TWT dialog ID
692  * @status: refer to WMI_HOST_RESUME_TWT_STATUS
693  */
694 struct wmi_twt_resume_dialog_complete_event_param {
695 	uint32_t vdev_id;
696 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
697 	uint32_t dialog_id;
698 	uint32_t status;
699 };
700 
701 /**
702  * struct wmi_twt_notify_event_param -
703  * @vdev_id: VDEV identifier
704  */
705 struct wmi_twt_notify_event_param {
706 	uint32_t vdev_id;
707 };
708 
709 #ifdef WLAN_SUPPORT_BCAST_TWT
710 /**
711  * struct wmi_twt_btwt_invite_sta_cmd_param -
712  * @vdev_id: VDEV identifier
713  * @peer_macaddr: Peer mac address
714  * @dialog_id: TWT dialog ID
715  */
716 struct wmi_twt_btwt_invite_sta_cmd_param {
717 	uint32_t vdev_id;
718 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
719 	uint32_t dialog_id;
720 };
721 
722 /* enum WMI_HOST_INVITATION_TWT_BTWT_STATUS - status code of TWT Invitation
723  *                              dialog
724  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_OK: BTWT invitation successfully
725  *                              completed
726  * WMI_HOST_INVITATION_TWT_TWT_STATUS_DIALOG_ID_NOT_EXIST: BTWT dialog ID not
727  *                              exists
728  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_INVALID_PARAM: invalid parameters
729  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_DIALOG_ID_BUSY: FW is in the process of
730  *                              handling this dialog
731  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_NO_RESOURCE: FW resource exhausted
732  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_NO_ACK: peer AP/STA did not ACK the
733  *                              request/response frame
734  * WMI_HOST_INVITATION_TWT_BTWT_STATUS_UNKNOWN_ERROR: BTWT invitation failed
735  *                              with an unknown reason
736  */
737 enum WMI_HOST_INVITATION_TWT_BTWT_STATUS {
738 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_OK,
739 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_DIALOG_ID_NOT_EXIST,
740 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_INVALID_PARAM,
741 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_DIALOG_ID_BUSY,
742 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_NO_RESOURCE,
743 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_NO_ACK,
744 	WMI_HOST_INVITATION_TWT_BTWT_STATUS_UNKNOWN_ERROR,
745 };
746 
747 /**
748  * struct wmi_twt_btwt_invite_sta_complete_event_param -
749  * @vdev_id: VDEV identifier
750  * @peer_macaddr: Peer mac address
751  * @dialog_id: BTWT dialog ID
752  * @status: refer to WMI_HOST_INVITATION_TWT_BTWT_STATUS
753  */
754 struct wmi_twt_btwt_invite_sta_complete_event_param {
755 		uint32_t vdev_id;
756 		uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
757 		uint32_t dialog_id;
758 		uint32_t status;
759 };
760 
761 /**
762  * struct wmi_twt_btwt_remove_sta_cmd_param -
763  * @vdev_id: VDEV identifier
764  * @peer_macaddr: Peer mac address
765  * @dialog_id: BTWT dialog ID
766  */
767 struct wmi_twt_btwt_remove_sta_cmd_param {
768 		uint32_t vdev_id;
769 		uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
770 		uint32_t dialog_id;
771 };
772 
773 /* enum WMI_HOST_KICKOFF_TWT_BTWT_STATUS - status code of resuming TWT dialog
774  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_OK: TWT kickoff successfully completed
775  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_DIALOG_ID_NOT_EXIST: BTWT dialog ID not
776  *                              exists
777  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_INVALID_PARAM: invalid parameters
778  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_DIALOG_ID_BUSY: FW is in the process of
779  *                              handling this dialog
780  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NOT_PAUSED: Dialog not currently paused
781  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NO_RESOURCE: FW resource exhausted
782  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NO_ACK: peer AP/STA did not ACK the
783  *                              request/response frame
784  * WMI_HOST_KICKOFF_TWT_BTWT_STATUS_UNKNOWN_ERROR: BTWT kickoff failed with an
785  *                              unknown reason
786  */
787 enum WMI_HOST_KICKOFF_TWT_BTWT_STATUS {
788 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_OK,
789 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_DIALOG_ID_NOT_EXIST,
790 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_INVALID_PARAM,
791 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_DIALOG_ID_BUSY,
792 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NOT_PAUSED,
793 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NO_RESOURCE,
794 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_NO_ACK,
795 	WMI_HOST_KICKOFF_TWT_BTWT_STATUS_UNKNOWN_ERROR,
796 };
797 
798 /**
799  * struct wmi_twt_btwt_remove_sta_complete_event_param -
800  * @vdev_id: VDEV identifier
801  * @peer_macaddr: Peer mac address
802  * @dialog_id: BTWT dialog ID
803  * @status: refer to WMI_HOST_KICKOFF_TWT_BTWT_STATUS
804  */
805 struct wmi_twt_btwt_remove_sta_complete_event_param {
806 	uint32_t vdev_id;
807 	uint8_t  peer_macaddr[QDF_MAC_ADDR_SIZE];
808 	uint32_t dialog_id;
809 	uint32_t status;
810 };
811 #endif
812 
813 /**
814  * enum WMI_HOST_TWT_CMD_FOR_ACK_EVENT - Ack event for different TWT command
815  * @WMI_HOST_TWT_ADD_DIALOG_CMDID: Ack event for add dialog command
816  * @WMI_HOST_TWT_DEL_DIALOG_CMDID: Ack event for delete dialog command
817  * @WMI_HOST_TWT_PAUSE_DIALOG_CMDID: Ack event for pause command
818  * @WMI_HOST_TWT_RESUME_DIALOG_CMDID: Ack event for resume command
819  * @WMI_HOST_TWT_NUDGE_DIALOG_CMDID: Ack event for nudge command
820  * @WMI_HOST_TWT_UNKNOWN_CMDID: Ack event for unknown TWT command
821  */
822 enum WMI_HOST_TWT_CMD_FOR_ACK_EVENT {
823 	WMI_HOST_TWT_ADD_DIALOG_CMDID = 0,
824 	WMI_HOST_TWT_DEL_DIALOG_CMDID,
825 	WMI_HOST_TWT_PAUSE_DIALOG_CMDID,
826 	WMI_HOST_TWT_RESUME_DIALOG_CMDID,
827 	WMI_HOST_TWT_NUDGE_DIALOG_CMDID,
828 	WMI_HOST_TWT_UNKNOWN_CMDID,
829 };
830 #endif /* _WMI_UNIFIED_TWT_PARAM_H_ */
831