xref: /wlan-driver/qca-wifi-host-cmn/umac/twt/dispatcher/inc/wlan_twt_public_structs.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: This file contains various structures, macros used by the TWT
21  * component and other components interfacing with TWT component.
22  */
23 
24 #ifndef _WLAN_TWT_PUBLIC_STRUCTS_H_
25 #define _WLAN_TWT_PUBLIC_STRUCTS_H_
26 
27 #include <qdf_types.h>
28 
29 #define WLAN_MAX_TWT_SESSIONS_PER_PEER 1
30 #define TWT_ALL_SESSIONS_DIALOG_ID 255
31 
32 /**
33  * enum wlan_twt_commands  - TWT commands
34  * @WLAN_TWT_NONE: Indicates none of the TWT commands are active.
35  * @WLAN_TWT_SETUP: TWT setup
36  * @WLAN_TWT_TERMINATE: TWT terminate
37  * @WLAN_TWT_SUSPEND: TWT suspend
38  * @WLAN_TWT_RESUME: TWT resume
39  * @WLAN_TWT_NUDGE: TWT nudge
40  * @WLAN_TWT_STATISTICS: TWT statistics
41  * @WLAN_TWT_CLEAR_STATISTICS: TWT clear statistics
42  * @WLAN_TWT_ANY: Indicates one of the commands is in progress.
43  */
44 enum wlan_twt_commands {
45 	WLAN_TWT_NONE             = 0,
46 	WLAN_TWT_SETUP            = BIT(0),
47 	WLAN_TWT_TERMINATE        = BIT(1),
48 	WLAN_TWT_SUSPEND          = BIT(2),
49 	WLAN_TWT_RESUME           = BIT(3),
50 	WLAN_TWT_NUDGE            = BIT(4),
51 	WLAN_TWT_STATISTICS       = BIT(5),
52 	WLAN_TWT_CLEAR_STATISTICS = BIT(6),
53 	WLAN_TWT_ANY              = 0xFF,
54 };
55 
56 /**
57  * enum wlan_twt_capabilities  - Represents the Bitmap of TWT capabilities
58  * supported by device and peer.
59  * @WLAN_TWT_CAPA_REQUESTOR: TWT requestor support is advertised by TWT
60  * non-scheduling STA.
61  * @WLAN_TWT_CAPA_RESPONDER: TWT responder support is advertised by TWT
62  * AP.
63  * @WLAN_TWT_CAPA_BROADCAST: This indicates support for the role of broadcast
64  * TWT scheduling/receiving functionality.
65  * @WLAN_TWT_CAPA_FLEXIBLE: Device supports flexible TWT schedule.
66  * @WLAN_TWT_CAPA_REQUIRED: The TWT Required is advertised by AP to indicate
67  * that it mandates the associated HE STAs to support TWT.
68  */
69 enum wlan_twt_capabilities {
70 	WLAN_TWT_CAPA_REQUESTOR = BIT(0),
71 	WLAN_TWT_CAPA_RESPONDER = BIT(1),
72 	WLAN_TWT_CAPA_BROADCAST = BIT(2),
73 	WLAN_TWT_CAPA_FLEXIBLE =  BIT(3),
74 	WLAN_TWT_CAPA_REQUIRED =  BIT(4),
75 };
76 
77 /**
78  * enum wlan_twt_session_state  - TWT session state for a dialog id
79  * @WLAN_TWT_SETUP_STATE_NOT_ESTABLISHED: Session doesn't exist
80  * @WLAN_TWT_SETUP_STATE_ACTIVE: TWT session is active
81  * @WLAN_TWT_SETUP_STATE_SUSPEND: TWT session is suspended
82  */
83 enum wlan_twt_session_state {
84 	WLAN_TWT_SETUP_STATE_NOT_ESTABLISHED = 0,
85 	WLAN_TWT_SETUP_STATE_ACTIVE          = 1,
86 	WLAN_TWT_SETUP_STATE_SUSPEND         = 2,
87 };
88 
89 /**
90  * enum TWT_ROLE - role specified in ext conf in wmi_twt_enable/disable_cmd
91  * @TWT_ROLE_REQUESTOR: TWT role is requestor
92  * @TWT_ROLE_RESPONDER: TWT role is responder
93  */
94 enum TWT_ROLE {
95 	TWT_ROLE_REQUESTOR,
96 	TWT_ROLE_RESPONDER,
97 };
98 
99 /**
100  * enum TWT_OPERATION - specified in ext conf in wmi_twt_enable/disable_cmd
101  * @TWT_OPERATION_INDIVIDUAL: Individual TWT operation
102  * @TWT_OPERATION_BROADCAST: Broadcast TWT operation
103  */
104 enum TWT_OPERATION {
105 	TWT_OPERATION_INDIVIDUAL,
106 	TWT_OPERATION_BROADCAST,
107 };
108 
109 /**
110  * struct twt_enable_param:
111  * @pdev_id: pdev_id for identifying the MAC.
112  * @sta_cong_timer_ms: STA TWT congestion timer TO value in terms of ms
113  * @mbss_support: Flag indicating if AP TWT feature supported in
114  *                MBSS mode or not.
115  * @default_slot_size: This is the default value for the TWT slot setup
116  *                by AP (units = microseconds)
117  * @congestion_thresh_setup: Minimum congestion required to start setting
118  *                up TWT sessions
119  * @congestion_thresh_teardown: Minimum congestion below which TWT will be
120  *                torn down (in percent of occupied airtime)
121  * @congestion_thresh_critical: Threshold above which TWT will not be active
122  *                (in percent of occupied airtime)
123  * @interference_thresh_teardown: Minimum interference above that TWT
124  *                 will not be active. The interference parameters use an
125  *                 abstract method of evaluating interference.
126  *                 The parameters are in percent, ranging from 0 for no
127  *                 interference, to 100 for interference extreme enough
128  *                 to completely block the signal of interest.
129  * @interference_thresh_setup: Minimum interference below that TWT session
130  *                 can be setup. The interference parameters use an
131  *                 abstract method of evaluating interference.
132  *                 The parameters are in percent, ranging from 0 for no
133  *                 interference, to 100 for interference extreme enough
134  *                 to completely block the signal of interest.
135  * @min_no_sta_setup: Minimum no of STA required to start TWT setup
136  * @min_no_sta_teardown: Minimum no of STA below which TWT will be torn down
137  * @no_of_bcast_mcast_slots: Number of default slot sizes reserved for
138  *                 BCAST/MCAST delivery
139  * @min_no_twt_slots: Minimum no of available slots for TWT to be operational
140  * @max_no_sta_twt: Max no of STA with which TWT is possible
141  *                 (must be <= the wmi_resource_config's twt_ap_sta_count value)
142  *      * The below interval parameters have units of milliseconds.
143  * @mode_check_interval: Interval between two successive check to decide the
144  *                 mode of TWT. (units = milliseconds)
145  * @add_sta_slot_interval: Interval between decisions making to create
146  *                 TWT slots for STAs. (units = milliseconds)
147  * @remove_sta_slot_interval: Inrerval between decisions making to remove TWT
148  *                 slot of STAs. (units = milliseconds)
149  * @twt_role: values from enum TWT_ROLE.
150  * @twt_oper: values from enum TWT_OPERATION.
151  * @ext_conf_present: If requestor/responder extend config is present.
152  * @b_twt_enable: Enable or disable broadcast TWT.
153  * @b_twt_legacy_mbss_enable: Enable or disable legacy MBSSID TWT.
154  * @b_twt_ax_mbss_enable: Enable or disable 11AX MBSSID TWT.
155  * @r_twt_enable: Restricted TWT enable or disable.
156  */
157 struct twt_enable_param {
158 	uint32_t pdev_id;
159 	uint32_t sta_cong_timer_ms;
160 	uint32_t mbss_support;
161 	uint32_t default_slot_size;
162 	uint32_t congestion_thresh_setup;
163 	uint32_t congestion_thresh_teardown;
164 	uint32_t congestion_thresh_critical;
165 	uint32_t interference_thresh_teardown;
166 	uint32_t interference_thresh_setup;
167 	uint32_t min_no_sta_setup;
168 	uint32_t min_no_sta_teardown;
169 	uint32_t no_of_bcast_mcast_slots;
170 	uint32_t min_no_twt_slots;
171 	uint32_t max_no_sta_twt;
172 	uint32_t mode_check_interval;
173 	uint32_t add_sta_slot_interval;
174 	uint32_t remove_sta_slot_interval;
175 	enum TWT_ROLE twt_role;
176 	enum TWT_OPERATION twt_oper;
177 	bool ext_conf_present;
178 	uint32_t b_twt_enable:1,
179 		 b_twt_legacy_mbss_enable:1,
180 		 b_twt_ax_mbss_enable:1;
181 	bool r_twt_enable;
182 };
183 
184 /**
185  * enum HOST_TWT_DISABLE_REASON - reason code of disable TWT
186  * @HOST_TWT_DISABLE_REASON_NONE: Host sends TWT disable command to firmware
187  *                              in normal case.
188  * @HOST_TWT_DISABLE_REASON_CONCURRENCY_SCC: Host sends TWT disable command
189  *                              to firmware when SCC concurrency exist.
190  * @HOST_TWT_DISABLE_REASON_CONCURRENCY_MCC: Host sends TWT disable command
191  *                              to firmware when MCC concurrency exist.
192  * @HOST_TWT_DISABLE_REASON_CHANGE_CONGESTION_TIMEOUT: Host sends TWT disable
193  *                              command to firmware to change congestion timeout
194  * @HOST_TWT_DISABLE_REASON_P2P_GO_NOA: Host sends TWT disable command to
195  *                              firmware when P2P GO NOA exist.
196  */
197 enum HOST_TWT_DISABLE_REASON {
198 	HOST_TWT_DISABLE_REASON_NONE,
199 	HOST_TWT_DISABLE_REASON_CONCURRENCY_SCC,
200 	HOST_TWT_DISABLE_REASON_CONCURRENCY_MCC,
201 	HOST_TWT_DISABLE_REASON_CHANGE_CONGESTION_TIMEOUT,
202 	HOST_TWT_DISABLE_REASON_P2P_GO_NOA,
203 };
204 
205 /**
206  * struct twt_disable_param:
207  * @pdev_id: pdev_id for identifying the MAC.
208  * @ext_conf_present: If requestor/responder extend config is present.
209  * @twt_role: values from enum TWT_ROLE.
210  * @twt_oper: values from enum TWT_OPERATION.
211  * @dis_reason_code: values from disable reason code.
212  */
213 struct twt_disable_param {
214 	uint32_t pdev_id;
215 	bool ext_conf_present;
216 	enum TWT_ROLE twt_role;
217 	enum TWT_OPERATION twt_oper;
218 	enum HOST_TWT_DISABLE_REASON dis_reason_code;
219 };
220 
221 /**
222  * enum HOST_TWT_ENABLE_STATUS - status code of enabling TWT
223  * @HOST_TWT_ENABLE_STATUS_OK: enabling TWT successfully completed
224  * @HOST_TWT_ENABLE_STATUS_ALREADY_ENABLED: TWT already enabled
225  * @HOST_TWT_ENABLE_STATUS_NOT_READY: FW not ready for enabling TWT
226  * @HOST_TWT_ENABLE_INVALID_PARAM: invalid parameters
227  * @HOST_TWT_ENABLE_STATUS_UNKNOWN_ERROR: enabling TWT failed with an
228  *                                      unknown reason
229  */
230 enum HOST_TWT_ENABLE_STATUS {
231 	HOST_TWT_ENABLE_STATUS_OK,
232 	HOST_TWT_ENABLE_STATUS_ALREADY_ENABLED,
233 	HOST_TWT_ENABLE_STATUS_NOT_READY,
234 	HOST_TWT_ENABLE_INVALID_PARAM,
235 	HOST_TWT_ENABLE_STATUS_UNKNOWN_ERROR,
236 };
237 
238 /**
239  * enum HOST_ADD_TWT_STATUS - status code of adding TWT dialog
240  * @HOST_ADD_TWT_STATUS_OK: adding TWT dialog successfully completed
241  * @HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED: TWT not enabled
242  * @HOST_ADD_TWT_STATUS_USED_DIALOG_ID: TWT dialog ID is already used
243  * @HOST_ADD_TWT_STATUS_INVALID_PARAM: invalid parameters
244  * @HOST_ADD_TWT_STATUS_NOT_READY: FW not ready
245  * @HOST_ADD_TWT_STATUS_NO_RESOURCE: FW resource exhausted
246  * @HOST_ADD_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
247  * request/response frame
248  * @HOST_ADD_TWT_STATUS_NO_RESPONSE: peer AP did not send the response frame
249  * @HOST_ADD_TWT_STATUS_DENIED: AP did not accept the request
250  * @HOST_ADD_TWT_STATUS_UNKNOWN_ERROR: adding TWT dialog failed with
251  * an unknown reason
252  * @HOST_ADD_TWT_STATUS_AP_PARAMS_NOT_IN_RANGE: peer AP wake interval,
253  * duration not in range
254  * @HOST_ADD_TWT_STATUS_AP_IE_VALIDATION_FAILED: peer AP IE Validation
255  * Failed
256  * @HOST_ADD_TWT_STATUS_ROAM_IN_PROGRESS: Roaming in progress
257  * @HOST_ADD_TWT_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
258  * @HOST_ADD_TWT_STATUS_SCAN_IN_PROGRESS: Scan is in progress
259  * @HOST_ADD_TWT_STATUS_LINK_SWITCH_IN_PROGRESS: Link switch is in progress
260  * @HOST_ADD_TWT_STATUS_UNSUPPORTED_MODE_MLMR: MLMR mode is not supported
261  */
262 enum HOST_ADD_TWT_STATUS {
263 	HOST_ADD_TWT_STATUS_OK,
264 	HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED,
265 	HOST_ADD_TWT_STATUS_USED_DIALOG_ID,
266 	HOST_ADD_TWT_STATUS_INVALID_PARAM,
267 	HOST_ADD_TWT_STATUS_NOT_READY,
268 	HOST_ADD_TWT_STATUS_NO_RESOURCE,
269 	HOST_ADD_TWT_STATUS_NO_ACK,
270 	HOST_ADD_TWT_STATUS_NO_RESPONSE,
271 	HOST_ADD_TWT_STATUS_DENIED,
272 	HOST_ADD_TWT_STATUS_UNKNOWN_ERROR,
273 	HOST_ADD_TWT_STATUS_AP_PARAMS_NOT_IN_RANGE,
274 	HOST_ADD_TWT_STATUS_AP_IE_VALIDATION_FAILED,
275 	HOST_ADD_TWT_STATUS_ROAM_IN_PROGRESS,
276 	HOST_ADD_TWT_STATUS_CHAN_SW_IN_PROGRESS,
277 	HOST_ADD_TWT_STATUS_SCAN_IN_PROGRESS,
278 	HOST_ADD_TWT_STATUS_LINK_SWITCH_IN_PROGRESS,
279 	HOST_ADD_TWT_STATUS_UNSUPPORTED_MODE_MLMR,
280 };
281 
282 /**
283  * struct twt_enable_complete_event_param:
284  * @pdev_id: pdev_id for identifying the MAC.
285  * @status: From enum TWT_ENABLE_STATUS
286  */
287 struct twt_enable_complete_event_param {
288 	uint32_t pdev_id;
289 	uint32_t status;
290 };
291 
292 /**
293  * enum HOST_TWT_DISABLE_STATUS  - status code of disable TWT
294  * @HOST_TWT_DISABLE_STATUS_OK: TWT disable is successfully completed
295  * @HOST_TWT_DISABLE_STATUS_ROAM_IN_PROGRESS: roaming in progress
296  * @HOST_TWT_DISABLE_STATUS_CHAN_SW_IN_PROGRESS: channel switch in progress
297  * @HOST_TWT_DISABLE_STATUS_SCAN_IN_PROGRESS: scan in progress
298  * @HOST_TWT_DISABLE_STATUS_UNKNOWN_ERROR: unknown error
299  */
300 enum HOST_TWT_DISABLE_STATUS {
301 	HOST_TWT_DISABLE_STATUS_OK,
302 	HOST_TWT_DISABLE_STATUS_ROAM_IN_PROGRESS,
303 	HOST_TWT_DISABLE_STATUS_CHAN_SW_IN_PROGRESS,
304 	HOST_TWT_DISABLE_STATUS_SCAN_IN_PROGRESS,
305 	HOST_TWT_DISABLE_STATUS_UNKNOWN_ERROR,
306 };
307 
308 /**
309  * struct twt_disable_complete_event_param:
310  * @pdev_id: pdev_id for identifying the MAC.
311  * @status: From enum HOST_TWT_DISABLE_STATUS
312  */
313 struct twt_disable_complete_event_param {
314 	uint32_t pdev_id;
315 	uint32_t status;
316 };
317 
318 /**
319  * struct twt_ack_context: twt ack private context
320  * @vdev_id: vdev id
321  * @peer_macaddr: peer mac address
322  * @dialog_id: dialog id
323  * @twt_cmd_ack: twt ack command
324  * @status: twt command status
325  */
326 struct twt_ack_context {
327 	uint32_t vdev_id;
328 	struct qdf_mac_addr peer_macaddr;
329 	uint32_t dialog_id;
330 	uint32_t twt_cmd_ack;
331 	uint32_t status;
332 };
333 
334 /**
335  * struct twt_en_dis_context:  twt enable/disable private context
336  * @twt_role: twt role. When the upper layer is invoking requestor/responder
337  * enable/disable command via the TWT component API, Firmware WMI event
338  * doesn't have the info in the event params to distinguish if this enable or
339  * disable is for requestor or responder, hence TWT component stores this role
340  * before the request is sent to the firmware.
341  * @context: cookie. This is the cookie information passed back to the upper
342  * layer to help identify the request structure
343  */
344 struct twt_en_dis_context {
345 	enum TWT_ROLE twt_role;
346 	void *context;
347 };
348 
349 /**
350  * struct twt_ack_complete_event_param:
351  * @vdev_id: vdev id
352  * @peer_macaddr: peer mac address
353  * @dialog_id: dialog id
354  * @twt_cmd_ack: ack event to the corresponding twt command
355  * @status: twt command status
356  */
357 struct twt_ack_complete_event_param {
358 	uint32_t vdev_id;
359 	struct qdf_mac_addr peer_macaddr;
360 	uint32_t dialog_id;
361 	uint32_t twt_cmd_ack;
362 	uint32_t status;
363 };
364 
365 /**
366  * struct twt_session_stats_info:
367  * @vdev_id: id of VDEV for twt session
368  * @peer_mac: MAC address of node
369  * @event_type: Indicates TWT session type (SETUP/TEARDOWN/UPDATE)
370  * @flow_id: TWT flow identifier established with TWT peer
371  * @bcast:  If this is a broadcast TWT session
372  * @trig: If the TWT session is trigger enabled
373  * @announ: If the flow type is announced/unannounced
374  * @protection: If the TWT protection field is set
375  * @info_frame_disabled: If the TWT Information frame is disabled
376  * @pm_responder_bit_valid: is pm_responder_bit valid
377  * @pm_responder_bit: set pm_responder_bit
378  * @dialog_id: Dialog_id of current session
379  * @wake_dura_us: wake duration in us
380  * @wake_intvl_us: wake time interval in us
381  * @sp_offset_us: Time until initial TWT SP occurs
382  * @sp_tsf_us_lo: TWT wake time TSF in usecs lower bits - 31:0
383  * @sp_tsf_us_hi: TWT wake time TSF in usecs higher bits - 63:32
384  */
385 struct twt_session_stats_info {
386 	uint32_t vdev_id;
387 	struct qdf_mac_addr peer_mac;
388 	uint32_t event_type;
389 	uint32_t flow_id:16,
390 		 bcast:1,
391 		 trig:1,
392 		 announ:1,
393 		 protection:1,
394 		 info_frame_disabled:1,
395 		 pm_responder_bit_valid:1,
396 		 pm_responder_bit:1;
397 	uint32_t dialog_id;
398 	uint32_t wake_dura_us;
399 	uint32_t wake_intvl_us;
400 	uint32_t sp_offset_us;
401 	uint32_t sp_tsf_us_lo;
402 	uint32_t sp_tsf_us_hi;
403 };
404 
405 /**
406  * struct twt_session_stats_event_param:
407  * @pdev_id: pdev_id for identifying the MAC.
408  * @num_sessions: number of TWT sessions
409  * @twt_sessions: received TWT sessions
410  */
411 struct twt_session_stats_event_param {
412 	uint32_t pdev_id;
413 	uint32_t num_sessions;
414 };
415 
416 /* from IEEE 802.11ah section 9.4.2.200 */
417 enum HOST_TWT_COMMAND {
418 	HOST_TWT_COMMAND_REQUEST_TWT    = 0,
419 	HOST_TWT_COMMAND_SUGGEST_TWT    = 1,
420 	HOST_TWT_COMMAND_DEMAND_TWT     = 2,
421 	HOST_TWT_COMMAND_TWT_GROUPING   = 3,
422 	HOST_TWT_COMMAND_ACCEPT_TWT     = 4,
423 	HOST_TWT_COMMAND_ALTERNATE_TWT  = 5,
424 	HOST_TWT_COMMAND_DICTATE_TWT    = 6,
425 	HOST_TWT_COMMAND_REJECT_TWT     = 7,
426 };
427 
428 /**
429  * struct twt_add_dialog_param -
430  * @vdev_id: VDEV identifier
431  * @peer_macaddr: peer MAC address when vdev is AP VDEV
432  * @dialog_id: diaglog_id (TWT dialog ID)
433  *             This dialog ID must be unique within its vdev.
434  * @wake_intvl_us: TWT Wake Interval in units of us
435  * @wake_intvl_mantis: TWT Wake Interval Mantissa
436  *                 - wake_intvl_mantis must be <= 0xFFFF
437  *                 - wake_intvl_us must be divided evenly by wake_intvl_mantis,
438  *                   i.e., wake_intvl_us % wake_intvl_mantis == 0
439  *                 - the quotient of wake_intvl_us/wake_intvl_mantis must be
440  *                   2 to N-th(0<=N<=31) power,
441  *                   i.e., wake_intvl_us/wake_intvl_mantis == 2^N, 0<=N<=31
442  * @min_wake_intvl_us: Min tolerance limit of TWT wake interval
443  * @max_wake_intvl_us: Max tolerance limit of TWT wake interval
444  * @wake_dura_us: TWT Wake Duration in units of us, must be <= 0xFFFF
445  *                wake_dura_us must be divided evenly by 256,
446  *                i.e., wake_dura_us % 256 == 0
447  * @min_wake_dura_us: Min tolerance limit of TWT wake duration.
448  * @max_wake_dura_us: Max tolerance limit of TWT wake duration.
449  * @sp_offset_us: this long time after TWT setup the 1st SP will start.
450  * @twt_cmd: cmd from enum HOST_TWT_COMMAND
451  * @flag_bcast: 0 means Individual TWT,
452  *              1 means Broadcast TWT
453  * @flag_trigger: 0 means non-Trigger-enabled TWT,
454  *                1 means  means Trigger-enabled TWT
455  * @flag_flow_type:  0 means announced TWT,
456  *                   1 means un-announced TWT
457  * @flag_protection: 0 means TWT protection is required,
458  *                   1 means TWT protection is not required
459  * @b_twt_id0: 0 means BTWT recommendation will not be used
460  *             1 means BTWT recommendation will be used
461  * @flag_reserved: unused bits
462  * @b_twt_recommendation: defines types of frames tx during bTWT SP
463  * @b_twt_persistence: Countdown VAL frames to param update/teardown
464  * @wake_time_tsf: Absolute TSF value to start first TWT service period
465  * @announce_timeout_us: Timeout value before sending QoS NULL frame.
466  * @link_id_bitmap: MLD links to which R-TWT element applies
467  * @r_twt_dl_tid_bitmap: DL TIDs for R-TWT scheduling
468  * @r_twt_ul_tid_bitmap: UL TIDs for R-TWT scheduling
469  */
470 struct twt_add_dialog_param {
471 	uint32_t vdev_id;
472 	struct qdf_mac_addr peer_macaddr;
473 	uint32_t dialog_id;
474 	uint32_t wake_intvl_us;
475 	uint32_t wake_intvl_mantis;
476 	uint32_t min_wake_intvl_us;
477 	uint32_t max_wake_intvl_us;
478 	uint32_t wake_dura_us;
479 	uint32_t min_wake_dura_us;
480 	uint32_t max_wake_dura_us;
481 	uint32_t sp_offset_us;
482 	enum HOST_TWT_COMMAND twt_cmd;
483 	uint32_t
484 		flag_bcast:1,
485 		flag_trigger:1,
486 		flag_flow_type:1,
487 		flag_protection:1,
488 		flag_b_twt_id0:1,
489 		flag_reserved:11,
490 		b_twt_persistence:8,
491 		b_twt_recommendation:3;
492 	uint64_t wake_time_tsf;
493 	uint32_t announce_timeout_us;
494 	uint32_t link_id_bitmap;
495 	uint32_t r_twt_dl_tid_bitmap;
496 	uint32_t r_twt_ul_tid_bitmap;
497 };
498 
499 /**
500  * enum HOST_TWT_GET_STATS_STATUS - status code of TWT Get stats dialog id
501  * @HOST_TWT_GET_STATS_STATUS_OK: Get status TWT dialog successfully completed
502  * @HOST_TWT_GET_STATS_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID does not exist
503  * @HOST_TWT_GET_STATS_STATUS_INVALID_PARAM: Invalid parameters
504  * @HOST_TWT_GET_STATS_STATUS_UNKNOWN_ERROR: Unknown error
505  */
506 enum HOST_TWT_GET_STATS_STATUS {
507 	HOST_TWT_GET_STATS_STATUS_OK,
508 	HOST_TWT_GET_STATS_STATUS_DIALOG_ID_NOT_EXIST,
509 	HOST_TWT_GET_STATS_STATUS_INVALID_PARAM,
510 	HOST_TWT_GET_STATS_STATUS_UNKNOWN_ERROR,
511 };
512 
513 /**
514  * enum HOST_TWT_ADD_STATUS - status code of TWT add dialog
515  * @HOST_TWT_ADD_STATUS_OK: add TWT dialog successfully completed
516  * @HOST_TWT_ADD_STATUS_TWT_NOT_ENABLED: TWT not enabled
517  * @HOST_TWT_ADD_STATUS_USED_DIALOG_ID: TWT dialog ID is already used
518  * @HOST_TWT_ADD_STATUS_INVALID_PARAM: invalid parameters
519  * @HOST_TWT_ADD_STATUS_NOT_READY: FW not ready
520  * @HOST_TWT_ADD_STATUS_NO_RESOURCE: FW resource exhausted
521  * @HOST_TWT_ADD_STATUS_NO_ACK: peer AP/STA did not ACK the
522  * request/response frame
523  * @HOST_TWT_ADD_STATUS_NO_RESPONSE: peer AP did not send the response frame
524  * @HOST_TWT_ADD_STATUS_DENIED: AP did not accept the request
525  * @HOST_TWT_ADD_STATUS_UNKNOWN_ERROR: adding TWT dialog failed with
526  * an unknown reason
527  * @HOST_TWT_ADD_STATUS_AP_PARAMS_NOT_IN_RANGE: peer AP wake interval,
528  * duration not in range
529  * @HOST_TWT_ADD_STATUS_AP_IE_VALIDATION_FAILED: peer AP IE Validation
530  * Failed
531  * @HOST_TWT_ADD_STATUS_ROAM_IN_PROGRESS: Roaming in progress
532  * @HOST_TWT_ADD_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
533  * @HOST_TWT_ADD_STATUS_SCAN_IN_PROGRESS: Scan is in progress
534  * @HOST_TWT_ADD_STATUS_LINK_SWITCH_IN_PROGRESS: link switch is in progress
535  * @HOST_TWT_ADD_STATUS_UNSUPPORTED_MODE_MLMR: MLMR not supported
536  */
537 enum HOST_TWT_ADD_STATUS {
538 	HOST_TWT_ADD_STATUS_OK,
539 	HOST_TWT_ADD_STATUS_TWT_NOT_ENABLED,
540 	HOST_TWT_ADD_STATUS_USED_DIALOG_ID,
541 	HOST_TWT_ADD_STATUS_INVALID_PARAM,
542 	HOST_TWT_ADD_STATUS_NOT_READY,
543 	HOST_TWT_ADD_STATUS_NO_RESOURCE,
544 	HOST_TWT_ADD_STATUS_NO_ACK,
545 	HOST_TWT_ADD_STATUS_NO_RESPONSE,
546 	HOST_TWT_ADD_STATUS_DENIED,
547 	HOST_TWT_ADD_STATUS_UNKNOWN_ERROR,
548 	HOST_TWT_ADD_STATUS_AP_PARAMS_NOT_IN_RANGE,
549 	HOST_TWT_ADD_STATUS_AP_IE_VALIDATION_FAILED,
550 	HOST_TWT_ADD_STATUS_ROAM_IN_PROGRESS,
551 	HOST_TWT_ADD_STATUS_CHAN_SW_IN_PROGRESS,
552 	HOST_TWT_ADD_STATUS_SCAN_IN_PROGRESS,
553 	HOST_TWT_ADD_STATUS_LINK_SWITCH_IN_PROGRESS,
554 	HOST_TWT_ADD_STATUS_UNSUPPORTED_MODE_MLMR,
555 };
556 
557 /**
558  * struct twt_add_dialog_additional_params -
559  * @twt_cmd: TWT command
560  * @bcast: 0 means Individual TWT
561  *         1 means Broadcast TWT
562  * @trig_en: 0 means non-Trigger-enabled TWT
563  *           1 means Trigger-enabled TWT
564  * @announce: 0 means announced TWT
565  *            1 means un-announced TWT
566  * @protection: 0 means TWT protection is required
567  *              1 means TWT protection is not required
568  * @b_twt_id0: 0 means non-0 B-TWT ID or I-TWT
569  *             1 means B-TWT ID 0
570  * @info_frame_disabled: 0 means TWT Information frame is enabled
571  *                       1 means TWT Information frame is disabled
572  * @pm_responder_bit_valid: 1 means responder pm mode field is valid
573  *                          0 means responder pm mode field is not valid
574  * @pm_responder_bit: 1 means that responder set responder pm mode to 1
575  *                    0 means that responder set responder pm mode to 0
576  * @wake_dur_us: wake duration in us
577  * @wake_intvl_us: wake time interval in us
578  * @sp_offset_us: Time until initial TWT SP occurs
579  * @sp_tsf_us_lo: TWT service period tsf in usecs lower bits - 31:0
580  * @sp_tsf_us_hi: TWT service period tsf in usecs higher bits - 63:32
581  */
582 struct twt_add_dialog_additional_params {
583 	uint32_t twt_cmd:8,
584 		 bcast:1,
585 		 trig_en:1,
586 		 announce:1,
587 		 protection:1,
588 		 b_twt_id0:1,
589 		 info_frame_disabled:1,
590 		 pm_responder_bit_valid:1,
591 		 pm_responder_bit:1;
592 	uint32_t wake_dur_us;
593 	uint32_t wake_intvl_us;
594 	uint32_t sp_offset_us;
595 	uint32_t sp_tsf_us_lo;
596 	uint32_t sp_tsf_us_hi;
597 };
598 
599 /**
600  * struct twt_add_dialog_complete_event_param:
601  * @vdev_id: VDEV identifier
602  * @peer_macaddr: Peer mac address
603  * @dialog_id: TWT dialog ID
604  * @status: refer to HOST_TWT_ADD_STATUS enum
605  * @num_additional_twt_params: no of additional_twt_params available
606  */
607 struct twt_add_dialog_complete_event_param {
608 	uint32_t vdev_id;
609 	struct qdf_mac_addr peer_macaddr;
610 	uint32_t dialog_id;
611 	uint32_t status;
612 	uint32_t num_additional_twt_params;
613 };
614 
615 /**
616  * struct twt_add_dialog_complete_event - TWT add dialog complete event
617  * @params: Fixed parameters for TWT add dialog complete event
618  * @additional_params: additional parameters for TWT add dialog complete event
619  *
620  * Holds the fixed and additional parameters from add dialog
621  * complete event
622  */
623 struct twt_add_dialog_complete_event {
624 	struct twt_add_dialog_complete_event_param params;
625 	struct twt_add_dialog_additional_params additional_params;
626 };
627 
628 /**
629  * struct twt_del_dialog_param -
630  * @vdev_id: VDEV identifier
631  * @peer_macaddr: Peer mac address
632  * @dialog_id: TWT dialog ID
633  * @b_twt_persistence: persistence val for b-twt
634  */
635 struct twt_del_dialog_param {
636 	uint32_t vdev_id;
637 	struct qdf_mac_addr peer_macaddr;
638 	uint32_t dialog_id;
639 #ifdef WLAN_SUPPORT_BCAST_TWT
640 	uint32_t b_twt_persistence;
641 #endif
642 };
643 
644 /**
645  * enum HOST_TWT_DEL_STATUS - status code of delete TWT dialog
646  * @HOST_TWT_DEL_STATUS_OK: deleting TWT dialog successfully completed
647  * @HOST_TWT_DEL_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
648  * @HOST_TWT_DEL_STATUS_INVALID_PARAM: invalid parameters
649  * @HOST_TWT_DEL_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
650  * this dialog
651  * @HOST_TWT_DEL_STATUS_NO_RESOURCE: FW resource exhausted
652  * @HOST_TWT_DEL_STATUS_NO_ACK: peer AP/STA did not ACK the request/response
653  * frame
654  * @HOST_TWT_DEL_STATUS_UNKNOWN_ERROR: deleting TWT dialog failed with an
655  * unknown reason
656  * @HOST_TWT_DEL_STATUS_PEER_INIT_TEARDOWN: Peer initiated TWT teardown
657  * @HOST_TWT_DEL_STATUS_ROAMING: TWT teardown due to roaming.
658  * @HOST_TWT_DEL_STATUS_CONCURRENCY: TWT session teardown due to
659  * concurrent session coming up.
660  * @HOST_TWT_DEL_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
661  * @HOST_TWT_DEL_STATUS_SCAN_IN_PROGRESS: Scan is in progress
662  * @HOST_TWT_DEL_STATUS_PS_DISABLE_TEARDOWN: PS disable TWT teardown
663  */
664 enum HOST_TWT_DEL_STATUS {
665 	HOST_TWT_DEL_STATUS_OK,
666 	HOST_TWT_DEL_STATUS_DIALOG_ID_NOT_EXIST,
667 	HOST_TWT_DEL_STATUS_INVALID_PARAM,
668 	HOST_TWT_DEL_STATUS_DIALOG_ID_BUSY,
669 	HOST_TWT_DEL_STATUS_NO_RESOURCE,
670 	HOST_TWT_DEL_STATUS_NO_ACK,
671 	HOST_TWT_DEL_STATUS_UNKNOWN_ERROR,
672 	HOST_TWT_DEL_STATUS_PEER_INIT_TEARDOWN,
673 	HOST_TWT_DEL_STATUS_ROAMING,
674 	HOST_TWT_DEL_STATUS_CONCURRENCY,
675 	HOST_TWT_DEL_STATUS_CHAN_SW_IN_PROGRESS,
676 	HOST_TWT_DEL_STATUS_SCAN_IN_PROGRESS,
677 	HOST_TWT_DEL_STATUS_PS_DISABLE_TEARDOWN,
678 };
679 
680 /**
681  * struct twt_del_dialog_complete_event_param -
682  * @vdev_id: VDEV identifier
683  * @peer_macaddr: Peer mac address
684  * @dialog_id: TWT dialog ID
685  * @b_twt_persistence: persistence val for b-twt
686  * @status: refer to HOST_TWT_DEL_STATUS enum
687  */
688 struct twt_del_dialog_complete_event_param {
689 	uint32_t vdev_id;
690 	struct qdf_mac_addr peer_macaddr;
691 	uint32_t dialog_id;
692 #ifdef WLAN_SUPPORT_BCAST_TWT
693 	uint32_t b_twt_persistence;
694 #endif
695 	uint32_t status;
696 };
697 
698 /**
699  * struct twt_pause_dialog_cmd_param -
700  * @vdev_id: VDEV identifier
701  * @peer_macaddr: Peer mac address
702  * @dialog_id: TWT dialog ID
703  */
704 struct twt_pause_dialog_cmd_param {
705 	uint32_t vdev_id;
706 	struct qdf_mac_addr peer_macaddr;
707 	uint32_t dialog_id;
708 };
709 
710 /**
711  * struct twt_nudge_dialog_cmd_param -
712  * @vdev_id: VDEV identifier
713  * @peer_macaddr: Peer mac address
714  * @dialog_id: TWT dialog ID
715  * @suspend_duration: TWT suspend duration in microseconds
716  * @next_twt_size: next TWT size
717  * @sp_start_offset: value to offset the start of service period
718  */
719 struct twt_nudge_dialog_cmd_param {
720 	uint32_t vdev_id;
721 	struct qdf_mac_addr peer_macaddr;
722 	uint32_t dialog_id;
723 	uint32_t suspend_duration;
724 	uint32_t next_twt_size;
725 	int32_t sp_start_offset;
726 };
727 
728 /**
729  * enum HOST_TWT_PAUSE_STATUS - status code of pause TWT dialog
730  * @HOST_TWT_PAUSE_STATUS_OK: pausing TWT dialog successfully completed
731  * @HOST_TWT_PAUSE_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
732  * @HOST_TWT_PAUSE_STATUS_INVALID_PARAM: invalid parameters
733  * @HOST_TWT_PAUSE_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
734  * this dialog
735  * @HOST_TWT_PAUSE_STATUS_NO_RESOURCE: FW resource exhausted
736  * @HOST_TWT_PAUSE_STATUS_NO_ACK: peer AP/STA did not ACK the
737  * request/response frame
738  * @HOST_TWT_PAUSE_STATUS_UNKNOWN_ERROR: pausing TWT dialog failed with an
739  * unknown reason
740  * @HOST_TWT_PAUSE_STATUS_ALREADY_PAUSED: TWT dialog already in paused state
741  * @HOST_TWT_PAUSE_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
742  * @HOST_TWT_PAUSE_STATUS_ROAM_IN_PROGRESS: Roaming is in progress
743  * @HOST_TWT_PAUSE_STATUS_SCAN_IN_PROGRESS: Scan is in progress
744  */
745 enum HOST_TWT_PAUSE_STATUS {
746 	HOST_TWT_PAUSE_STATUS_OK,
747 	HOST_TWT_PAUSE_STATUS_DIALOG_ID_NOT_EXIST,
748 	HOST_TWT_PAUSE_STATUS_INVALID_PARAM,
749 	HOST_TWT_PAUSE_STATUS_DIALOG_ID_BUSY,
750 	HOST_TWT_PAUSE_STATUS_NO_RESOURCE,
751 	HOST_TWT_PAUSE_STATUS_NO_ACK,
752 	HOST_TWT_PAUSE_STATUS_UNKNOWN_ERROR,
753 	HOST_TWT_PAUSE_STATUS_ALREADY_PAUSED,
754 	HOST_TWT_PAUSE_STATUS_CHAN_SW_IN_PROGRESS,
755 	HOST_TWT_PAUSE_STATUS_ROAM_IN_PROGRESS,
756 	HOST_TWT_PAUSE_STATUS_SCAN_IN_PROGRESS,
757 };
758 
759 /**
760  * struct twt_pause_dialog_complete_event_param -
761  * @vdev_id: VDEV identifier
762  * @peer_macaddr: Peer mac address
763  * @dialog_id: TWT dialog ID
764  * @status: refer to HOST_TWT_PAUSE_STATUS
765  */
766 struct twt_pause_dialog_complete_event_param {
767 	uint32_t vdev_id;
768 	struct qdf_mac_addr peer_macaddr;
769 	uint32_t dialog_id;
770 	enum HOST_TWT_PAUSE_STATUS status;
771 };
772 
773 /**
774  * enum HOST_TWT_NUDGE_STATUS - status code of nudge TWT dialog
775  * @HOST_TWT_NUDGE_STATUS_OK: nudge TWT dialog successfully completed
776  * @HOST_TWT_NUDGE_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
777  * @HOST_TWT_NUDGE_STATUS_INVALID_PARAM: invalid parameters
778  * @HOST_TWT_NUDGE_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
779  * this dialog
780  * @HOST_TWT_NUDGE_STATUS_NO_RESOURCE: FW resource exhausted
781  * @HOST_TWT_NUDGE_STATUS_NO_ACK: peer AP/STA did not ACK the
782  * request/response frame
783  * @HOST_TWT_NUDGE_STATUS_UNKNOWN_ERROR: nudge TWT dialog failed with an
784  * unknown reason
785  * @HOST_TWT_NUDGE_STATUS_ALREADY_PAUSED: TWT dialog already in paused state
786  * @HOST_TWT_NUDGE_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
787  * @HOST_TWT_NUDGE_STATUS_ROAM_IN_PROGRESS: Roaming in progress
788  * @HOST_TWT_NUDGE_STATUS_SCAN_IN_PROGRESS: Scan is in progress
789  */
790 enum HOST_TWT_NUDGE_STATUS {
791 	HOST_TWT_NUDGE_STATUS_OK,
792 	HOST_TWT_NUDGE_STATUS_DIALOG_ID_NOT_EXIST,
793 	HOST_TWT_NUDGE_STATUS_INVALID_PARAM,
794 	HOST_TWT_NUDGE_STATUS_DIALOG_ID_BUSY,
795 	HOST_TWT_NUDGE_STATUS_NO_RESOURCE,
796 	HOST_TWT_NUDGE_STATUS_NO_ACK,
797 	HOST_TWT_NUDGE_STATUS_UNKNOWN_ERROR,
798 	HOST_TWT_NUDGE_STATUS_ALREADY_PAUSED,
799 	HOST_TWT_NUDGE_STATUS_CHAN_SW_IN_PROGRESS,
800 	HOST_TWT_NUDGE_STATUS_ROAM_IN_PROGRESS,
801 	HOST_TWT_NUDGE_STATUS_SCAN_IN_PROGRESS,
802 };
803 
804 /**
805  * struct twt_nudge_dialog_complete_event_param -
806  * @vdev_id: VDEV identifier
807  * @peer_macaddr: Peer mac address
808  * @dialog_id: TWT dialog ID
809  * @status: refer to HOST_TWT_PAUSE_STATUS
810  * @next_twt_tsf_us_lo: TSF lower bits (31:0) of next wake time
811  * @next_twt_tsf_us_hi: TSF higher bits (32:63) of next wake time
812  */
813 struct twt_nudge_dialog_complete_event_param {
814 	uint32_t vdev_id;
815 	struct qdf_mac_addr peer_macaddr;
816 	uint32_t dialog_id;
817 	enum     HOST_TWT_NUDGE_STATUS status;
818 	uint32_t next_twt_tsf_us_lo;
819 	uint32_t next_twt_tsf_us_hi;
820 };
821 
822 /**
823  * struct twt_resume_dialog_cmd_param -
824  * @vdev_id: VDEV identifier
825  * @peer_macaddr: Peer mac address
826  * @dialog_id: TWT dialog ID
827  * @sp_offset_us: this long time after TWT resumed the 1st SP will start
828  * @next_twt_size: Next TWT subfield Size.
829  *                 Refer IEEE 802.11ax section "9.4.1.60 TWT Information field"
830  */
831 struct twt_resume_dialog_cmd_param {
832 	uint32_t vdev_id;
833 	struct qdf_mac_addr peer_macaddr;
834 	uint32_t dialog_id;
835 	uint32_t sp_offset_us;
836 	uint32_t next_twt_size;
837 };
838 
839 /**
840  * enum HOST_TWT_RESUME_STATUS - status code of resume TWT dialog
841  * @HOST_TWT_RESUME_STATUS_OK: resuming TWT dialog successfully completed
842  * @HOST_TWT_RESUME_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
843  * @HOST_TWT_RESUME_STATUS_INVALID_PARAM: invalid parameters
844  * @HOST_TWT_RESUME_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
845  * this dialog
846  * @HOST_TWT_RESUME_STATUS_NOT_PAUSED: dialog not paused currently
847  * @HOST_TWT_RESUME_STATUS_NO_RESOURCE: FW resource exhausted
848  * @HOST_TWT_RESUME_STATUS_NO_ACK: peer AP/STA did not ACK the
849  * request/response frame
850  * @HOST_TWT_RESUME_STATUS_UNKNOWN_ERROR: resuming TWT dialog failed with an
851  * unknown reason
852  * @HOST_TWT_RESUME_STATUS_CHAN_SW_IN_PROGRESS: Channel switch in progress
853  * @HOST_TWT_RESUME_STATUS_ROAM_IN_PROGRESS: Roaming in progress
854  * @HOST_TWT_RESUME_STATUS_SCAN_IN_PROGRESS: Scan is in progress
855  */
856 enum HOST_TWT_RESUME_STATUS {
857 	HOST_TWT_RESUME_STATUS_OK,
858 	HOST_TWT_RESUME_STATUS_DIALOG_ID_NOT_EXIST,
859 	HOST_TWT_RESUME_STATUS_INVALID_PARAM,
860 	HOST_TWT_RESUME_STATUS_DIALOG_ID_BUSY,
861 	HOST_TWT_RESUME_STATUS_NOT_PAUSED,
862 	HOST_TWT_RESUME_STATUS_NO_RESOURCE,
863 	HOST_TWT_RESUME_STATUS_NO_ACK,
864 	HOST_TWT_RESUME_STATUS_UNKNOWN_ERROR,
865 	HOST_TWT_RESUME_STATUS_CHAN_SW_IN_PROGRESS,
866 	HOST_TWT_RESUME_STATUS_ROAM_IN_PROGRESS,
867 	HOST_TWT_RESUME_STATUS_SCAN_IN_PROGRESS,
868 };
869 
870 /**
871  * struct twt_resume_dialog_complete_event_param -
872  * @vdev_id: VDEV identifier
873  * @peer_macaddr: Peer mac address
874  * @dialog_id: TWT dialog ID
875  * @status: refer to HOST_TWT_RESUME_STATUS
876  */
877 struct twt_resume_dialog_complete_event_param {
878 	uint32_t vdev_id;
879 	struct qdf_mac_addr peer_macaddr;
880 	uint32_t dialog_id;
881 	uint32_t status;
882 };
883 
884 /**
885  * enum HOST_TWT_NOTIFY_STATUS - status code of notify TWT event
886  * @HOST_TWT_NOTIFY_EVENT_READY: FW is ready to process the TWT setup request.
887  * @HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_SET: AP set the TWT required bit
888  * @HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_CLEAR: AP cleared the TWT required bit
889  */
890 enum HOST_TWT_NOTIFY_STATUS {
891 	HOST_TWT_NOTIFY_EVENT_READY,
892 	HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_SET,
893 	HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_CLEAR,
894 };
895 
896 /**
897  * struct twt_notify_event_param -
898  * @vdev_id: VDEV identifier
899  * @status: refer to HOST_TWT_NOTIFY_STATUS
900  */
901 struct twt_notify_event_param {
902 	uint32_t vdev_id;
903 	enum HOST_TWT_NOTIFY_STATUS status;
904 };
905 
906 /**
907  * enum HOST_TWT_NEXT_WORK_ACTION - next action of TWT worker thread
908  * @HOST_TWT_SEND_DELETE_CMD: Send TWT delete command request
909  */
910 enum HOST_TWT_NEXT_WORK_ACTION {
911 	HOST_TWT_SEND_DELETE_CMD = 1,
912 };
913 
914 /**
915  * struct twt_work_params
916  * @peer_macaddr: peer mac address
917  * @dialog_id: Dialog ID
918  * @is_ps_disabled: Whether power save is disabled or not.
919  */
920 struct twt_work_params {
921 	struct qdf_mac_addr peer_macaddr;
922 	uint32_t dialog_id;
923 	bool is_ps_disabled;
924 };
925 #ifdef WLAN_SUPPORT_BCAST_TWT
926 /**
927  * struct twt_btwt_invite_sta_cmd_param -
928  * @vdev_id: VDEV identifier
929  * @peer_macaddr: Peer mac address
930  * @dialog_id: TWT dialog ID
931  * @r_twt_dl_tid_bitmap: rTWT DL tids bitmap
932  * @r_twt_ul_tid_bitmap: rTWT UL tids bitmap
933  */
934 struct twt_btwt_invite_sta_cmd_param {
935 	uint32_t vdev_id;
936 	struct qdf_mac_addr peer_macaddr;
937 	uint32_t dialog_id;
938 	uint32_t r_twt_dl_tid_bitmap;
939 	uint32_t r_twt_ul_tid_bitmap;
940 };
941 
942 /**
943  * enum HOST_TWT_INVITATION_BTWT_STATUS - status code of TWT Invitation
944  *                              dialog
945  * @HOST_TWT_INVITATION_BTWT_STATUS_OK: BTWT invitation successfully
946  *                              completed
947  * @HOST_TWT_INVITATION_BTWT_STATUS_DIALOG_ID_NOT_EXIST: BTWT dialog ID not
948  *                              exists
949  * @HOST_TWT_INVITATION_BTWT_STATUS_INVALID_PARAM: invalid parameters
950  * @HOST_TWT_INVITATION_BTWT_STATUS_DIALOG_ID_BUSY: FW is in the process of
951  *                              handling this dialog
952  * @HOST_TWT_INVITATION_BTWT_STATUS_NO_RESOURCE: FW resource exhausted
953  * @HOST_TWT_INVITATION_BTWT_STATUS_NO_ACK: peer AP/STA did not ACK the
954  *                              request/response frame
955  * @HOST_TWT_INVITATION_BTWT_STATUS_UNKNOWN_ERROR: BTWT invitation failed
956  *                              with an unknown reason
957  */
958 enum HOST_TWT_INVITATION_BTWT_STATUS {
959 	HOST_TWT_INVITATION_BTWT_STATUS_OK,
960 	HOST_TWT_INVITATION_BTWT_STATUS_DIALOG_ID_NOT_EXIST,
961 	HOST_TWT_INVITATION_BTWT_STATUS_INVALID_PARAM,
962 	HOST_TWT_INVITATION_BTWT_STATUS_DIALOG_ID_BUSY,
963 	HOST_TWT_INVITATION_BTWT_STATUS_NO_RESOURCE,
964 	HOST_TWT_INVITATION_BTWT_STATUS_NO_ACK,
965 	HOST_TWT_INVITATION_BTWT_STATUS_UNKNOWN_ERROR,
966 };
967 
968 /**
969  * struct twt_btwt_invite_sta_complete_event_param -
970  * @vdev_id: VDEV identifier
971  * @peer_macaddr: Peer mac address
972  * @dialog_id: BTWT dialog ID
973  * @status: refer to HOST_TWT_INVITATION_BTWT_STATUS
974  */
975 struct twt_btwt_invite_sta_complete_event_param {
976 	uint32_t vdev_id;
977 	struct qdf_mac_addr peer_macaddr;
978 	uint32_t dialog_id;
979 	uint32_t status;
980 };
981 
982 /**
983  * struct twt_btwt_remove_sta_cmd_param -
984  * @vdev_id: VDEV identifier
985  * @peer_macaddr: Peer mac address
986  * @dialog_id: BTWT dialog ID
987  * @r_twt_dl_tid_bitmap: rTWT DL tids bitmap
988  * @r_twt_ul_tid_bitmap: rTWT UL tids bitmap
989  */
990 struct twt_btwt_remove_sta_cmd_param {
991 	uint32_t vdev_id;
992 	struct qdf_mac_addr peer_macaddr;
993 	uint32_t dialog_id;
994 	uint32_t r_twt_dl_tid_bitmap;
995 	uint32_t r_twt_ul_tid_bitmap;
996 };
997 
998 /**
999  * enum HOST_TWT_KICKOFF_BTWT_STATUS - status code of kickoff BTWT dialog
1000  * @HOST_TWT_KICKOFF_BTWT_STATUS_OK: TWT kickoff successfully completed
1001  * @HOST_TWT_KICKOFF_BTWT_STATUS_DIALOG_ID_NOT_EXIST: BTWT dialog ID not
1002  *                              exists
1003  * @HOST_TWT_KICKOFF_BTWT_STATUS_INVALID_PARAM: invalid parameters
1004  * @HOST_TWT_KICKOFF_BTWT_STATUS_DIALOG_ID_BUSY: FW is in the process of
1005  *                              handling this dialog
1006  * @HOST_TWT_KICKOFF_BTWT_STATUS_NOT_PAUSED: Dialog not currently paused
1007  * @HOST_TWT_KICKOFF_BTWT_STATUS_NO_RESOURCE: FW resource exhausted
1008  * @HOST_TWT_KICKOFF_BTWT_STATUS_NO_ACK: peer AP/STA did not ACK the
1009  *                              request/response frame
1010  * @HOST_TWT_KICKOFF_BTWT_STATUS_UNKNOWN_ERROR: BTWT kickoff failed with an
1011  *                              unknown reason
1012  */
1013 enum HOST_TWT_KICKOFF_BTWT_STATUS {
1014 	HOST_TWT_KICKOFF_BTWT_STATUS_OK,
1015 	HOST_TWT_KICKOFF_BTWT_STATUS_DIALOG_ID_NOT_EXIST,
1016 	HOST_TWT_KICKOFF_BTWT_STATUS_INVALID_PARAM,
1017 	HOST_TWT_KICKOFF_BTWT_STATUS_DIALOG_ID_BUSY,
1018 	HOST_TWT_KICKOFF_BTWT_STATUS_NOT_PAUSED,
1019 	HOST_TWT_KICKOFF_BTWT_STATUS_NO_RESOURCE,
1020 	HOST_TWT_KICKOFF_BTWT_STATUS_NO_ACK,
1021 	HOST_TWT_KICKOFF_BTWT_STATUS_UNKNOWN_ERROR,
1022 };
1023 
1024 /**
1025  * struct twt_btwt_remove_sta_complete_event_param -
1026  * @vdev_id: VDEV identifier
1027  * @peer_macaddr: Peer mac address
1028  * @dialog_id: BTWT dialog ID
1029  * @status: refer to HOST_TWT_KICKOFF_BTWT_STATUS
1030  */
1031 struct twt_btwt_remove_sta_complete_event_param {
1032 	uint32_t vdev_id;
1033 	struct qdf_mac_addr peer_macaddr;
1034 	uint32_t dialog_id;
1035 	uint32_t status;
1036 };
1037 #endif
1038 
1039 /**
1040  * enum HOST_TWT_CMD_FOR_ACK_EVENT - Ack event for different TWT command
1041  * @HOST_TWT_ADD_DIALOG_CMDID: Ack event for add dialog command
1042  * @HOST_TWT_DEL_DIALOG_CMDID: Ack event for delete dialog command
1043  * @HOST_TWT_PAUSE_DIALOG_CMDID: Ack event for pause command
1044  * @HOST_TWT_RESUME_DIALOG_CMDID: Ack event for resume command
1045  * @HOST_TWT_NUDGE_DIALOG_CMDID: Ack event for nudge command
1046  * @HOST_TWT_UNKNOWN_CMDID: Ack event for unknown TWT command
1047  */
1048 enum HOST_TWT_CMD_FOR_ACK_EVENT {
1049 	HOST_TWT_ADD_DIALOG_CMDID = 0,
1050 	HOST_TWT_DEL_DIALOG_CMDID,
1051 	HOST_TWT_PAUSE_DIALOG_CMDID,
1052 	HOST_TWT_RESUME_DIALOG_CMDID,
1053 	HOST_TWT_NUDGE_DIALOG_CMDID,
1054 	HOST_TWT_UNKNOWN_CMDID,
1055 };
1056 
1057 /* access categories */
1058 enum twt_traffic_ac {
1059 	TWT_AC_VO  = 0,
1060 	TWT_AC_VI  = 1,
1061 	TWT_AC_BE  = 2,
1062 	TWT_AC_BK  = 3,
1063 	TWT_AC_MAX = 4,
1064 };
1065 
1066 /**
1067  * enum twt_disable_reason - twt disable/enable reason
1068  * @REASON_PMO_SUSPEND: reason is suspended
1069  */
1070 enum twt_disable_reason {
1071 	REASON_PMO_SUSPEND  = 0x1,
1072 };
1073 
1074 #endif /* _WLAN_TWT_PUBLIC_STRUCTS_H_ */
1075 
1076