xref: /wlan-dirver/qca-wifi-host-cmn/wmi/inc/wmi_unified_twt_param.h (revision 1b9674e21e24478fba4530f5ae7396b9555e9c6a)
1 /*
2  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /*
20  * This file contains the API definitions for the TWT WMI APIs.
21  */
22 
23 #ifndef _WMI_UNIFIED_TWT_PARAM_H_
24 #define _WMI_UNIFIED_TWT_PARAM_H_
25 
26 /**
27  * @pdev_id: pdev_id for identifying the MAC.
28  * @sta_cong_timer_ms: STA TWT congestion timer TO value in terms of ms
29  * @mbss_support: Flag indicating if AP TWT feature supported in
30  *                MBSS mode or not.
31  * @default_slot_size: This is the default value for the TWT slot setup
32  *                by AP (units = microseconds)
33  * @congestion_thresh_setup: Minimum congestion required to start setting
34  *                up TWT sessions
35  * @congestion_thresh_teardown: Minimum congestion below which TWT will be
36  *                torn down (in percent of occupied airtime)
37  * @congestion_thresh_critical: Threshold above which TWT will not be active
38  *                (in percent of occupied airtime)
39  * @interference_thresh_teardown: Minimum interference above that TWT
40  *                 will not be active. The interference parameters use an
41  *                 abstract method of evaluating interference.
42  *                 The parameters are in percent, ranging from 0 for no
43  *                 interference, to 100 for interference extreme enough
44  *                 to completely block the signal of interest.
45  * @interference_thresh_setup: Minimum interference below that TWT session
46  *                 can be setup. The interference parameters use an
47  *                 abstract method of evaluating interference.
48  *                 The parameters are in percent, ranging from 0 for no
49  *                 interference, to 100 for interference extreme enough
50  *                 to completely block the signal of interest.
51  * @min_no_sta_setup: Minimum no of STA required to start TWT setup
52  * @min_no_sta_teardown: Minimum no of STA below which TWT will be torn down
53  * @no_of_bcast_mcast_slots: Number of default slot sizes reserved for
54  *                 BCAST/MCAST delivery
55  * @min_no_twt_slots: Minimum no of available slots for TWT to be operational
56  * @max_no_sta_twt: Max no of STA with which TWT is possible
57  *                 (must be <= the wmi_resource_config's twt_ap_sta_count value)
58  *      * The below interval parameters have units of milliseconds.
59  * @mode_check_interval: Interval between two successive check to decide the
60  *                 mode of TWT. (units = milliseconds)
61  * @add_sta_slot_interval: Interval between decisions making to create
62  *                 TWT slots for STAs. (units = milliseconds)
63  * @remove_sta_slot_interval: Inrerval between decisions making to remove TWT
64  *                 slot of STAs. (units = milliseconds)
65  */
66 struct wmi_twt_enable_param {
67 	uint32_t pdev_id;
68 	uint32_t sta_cong_timer_ms;
69 	uint32_t mbss_support;
70 	uint32_t default_slot_size;
71 	uint32_t congestion_thresh_setup;
72 	uint32_t congestion_thresh_teardown;
73 	uint32_t congestion_thresh_critical;
74 	uint32_t interference_thresh_teardown;
75 	uint32_t interference_thresh_setup;
76 	uint32_t min_no_sta_setup;
77 	uint32_t min_no_sta_teardown;
78 	uint32_t no_of_bcast_mcast_slots;
79 	uint32_t min_no_twt_slots;
80 	uint32_t max_no_sta_twt;
81 	uint32_t mode_check_interval;
82 	uint32_t add_sta_slot_interval;
83 	uint32_t remove_sta_slot_interval;
84 };
85 
86 /* status code of enabling TWT
87  * WMI_ENABLE_TWT_STATUS_OK: enabling TWT successfully completed
88  * WMI_ENABLE_TWT_STATUS_ALREADY_ENABLED: TWT already enabled
89  * WMI_ENABLE_TWT_STATUS_NOT_READY: FW not ready for enabling TWT
90  * WMI_ENABLE_TWT_INVALID_PARAM: invalid parameters
91  * WMI_ENABLE_TWT_STATUS_UNKNOWN_ERROR: enabling TWT failed with an
92  *                                      unknown reason
93  */
94 enum WMI_HOST_ENABLE_TWT_STATUS {
95 	WMI_HOST_ENABLE_TWT_STATUS_OK,
96 	WMI_HOST_ENABLE_TWT_STATUS_ALREADY_ENABLED,
97 	WMI_HOST_ENABLE_TWT_STATUS_NOT_READY,
98 	WMI_HOST_ENABLE_TWT_INVALID_PARAM,
99 	WMI_HOST_ENABLE_TWT_STATUS_UNKNOWN_ERROR,
100 };
101 
102 /** struct wmi_twt_enable_complete_event_param:
103  * @pdev_is: pdev_id for identifying the MAC.
104  * @status: From enum WMI_HOST_ENABLE_TWT_STATUS
105  */
106 struct wmi_twt_enable_complete_event_param {
107 	uint32_t pdev_id;
108 	uint32_t status;
109 };
110 
111 /** struct wmi_twt_disable_param:
112  * @pdev_id: pdev_id for identifying the MAC.
113  */
114 struct wmi_twt_disable_param {
115 	uint32_t pdev_id;
116 };
117 
118 /** struct wmi_twt_disable_complete_event:
119  * @pdev_id: pdev_id for identifying the MAC.
120  */
121 struct wmi_twt_disable_complete_event {
122 	uint32_t pdev_id;
123 };
124 
125 /* from IEEE 802.11ah section 9.4.2.200 */
126 enum WMI_HOST_TWT_COMMAND {
127 	WMI_HOST_TWT_COMMAND_REQUEST_TWT    = 0,
128 	WMI_HOST_TWT_COMMAND_SUGGEST_TWT    = 1,
129 	WMI_HOST_TWT_COMMAND_DEMAND_TWT     = 2,
130 	WMI_HOST_TWT_COMMAND_TWT_GROUPING   = 3,
131 	WMI_HOST_TWT_COMMAND_ACCEPT_TWT     = 4,
132 	WMI_HOST_TWT_COMMAND_ALTERNATE_TWT  = 5,
133 	WMI_HOST_TWT_COMMAND_DICTATE_TWT    = 6,
134 	WMI_HOST_TWT_COMMAND_REJECT_TWT     = 7,
135 };
136 
137 /** struct wmi_twt_add_dialog_param -
138  * @vdev_id: VDEV identifier
139  * @peer_macaddr: peer MAC address when vdev is AP VDEV
140  * @dialog_id: diaglog_id (TWT dialog ID)
141  *             This dialog ID must be unique within its vdev.
142  * @wake_intvl_us: TWT Wake Interval in units of us
143  * @wake_intvl_mantis: TWT Wake Interval Mantissa
144  *                 - wake_intvl_mantis must be <= 0xFFFF
145  *                 - wake_intvl_us must be divided evenly by wake_intvl_mantis,
146  *                   i.e., wake_intvl_us % wake_intvl_mantis == 0
147  *                 - the quotient of wake_intvl_us/wake_intvl_mantis must be
148  *                   2 to N-th(0<=N<=31) power,
149  *                   i.e., wake_intvl_us/wake_intvl_mantis == 2^N, 0<=N<=31
150  * @wake_dura_us: TWT Wake Duration in units of us, must be <= 0xFFFF
151  *                wake_dura_us must be divided evenly by 256,
152  *                i.e., wake_dura_us % 256 == 0
153  * @sp_offset_us: this long time after TWT setup the 1st SP will start.
154  * @twt_cmd: cmd from enum WMI_HOST_TWT_COMMAND
155  * @flag_bcast: 0 means Individual TWT,
156  *              1 means Broadcast TWT
157  * @flag_trigger: 0 means non-Trigger-enabled TWT,
158  *                1 means  means Trigger-enabled TWT
159  * @flag_flow_type:  0 means announced TWT,
160  *                   1 means un-announced TWT
161  * @flag_protection: 0 means TWT protection is required,
162  *                   1 means TWT protection is not required
163  */
164 struct wmi_twt_add_dialog_param {
165 	uint32_t vdev_id;
166 	uint8_t  peer_macaddr[IEEE80211_ADDR_LEN];
167 	uint32_t dialog_id;
168 	uint32_t wake_intvl_us;
169 	uint32_t wake_intvl_mantis;
170 	uint32_t wake_dura_us;
171 	uint32_t sp_offset_us;
172 	enum WMI_HOST_TWT_COMMAND twt_cmd;
173 	uint32_t
174 		flag_bcast:1,
175 		flag_trigger:1,
176 		flag_flow_type:1,
177 		flag_protection:1;
178 };
179 
180 /* enum - status code of adding TWT dialog
181  * WMI_HOST_ADD_TWT_STATUS_OK: adding TWT dialog successfully completed
182  * WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED: TWT not enabled
183  * WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID: TWT dialog ID is already used
184  * WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM: invalid parameters
185  * WMI_HOST_ADD_TWT_STATUS_NOT_READY: FW not ready
186  * WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE: FW resource exhausted
187  * WMI_HOST_ADD_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
188  *                                 request/response frame
189  * WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE: peer AP did not send the response frame
190  * WMI_HOST_ADD_TWT_STATUS_DENIED: AP did not accept the request
191  * WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR: adding TWT dialog failed with
192  *                                 an unknown reason
193  */
194 enum WMI_HOST_ADD_TWT_STATUS {
195 	WMI_HOST_ADD_TWT_STATUS_OK,
196 	WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED,
197 	WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID,
198 	WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM,
199 	WMI_HOST_ADD_TWT_STATUS_NOT_READY,
200 	WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE,
201 	WMI_HOST_ADD_TWT_STATUS_NO_ACK,
202 	WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE,
203 	WMI_HOST_ADD_TWT_STATUS_DENIED,
204 	WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR,
205 };
206 
207 /** struct wmi_twt_add_dialog_complete_param -
208  * @vdev_id: VDEV identifier
209  * @peer_macaddr: Peer mac address
210  * @dialog_id: TWT dialog ID
211  * @status: refer to WMI_HOST_ADD_TWT_STATUS enum
212  */
213 struct wmi_twt_add_dialog_complete_event_param {
214 	uint32_t vdev_id;
215 	uint8_t  peer_macaddr[IEEE80211_ADDR_LEN];
216 	uint32_t dialog_id;
217 	uint32_t status;
218 };
219 
220 /** struct wmi_twt_del_dialog_param -
221  * @vdev_id: VDEV identifier
222  * @peer_macaddr: Peer mac address
223  * @dialog_id: TWT dialog ID
224  */
225 struct wmi_twt_del_dialog_param {
226 	uint32_t vdev_id;
227 	uint8_t  peer_macaddr[IEEE80211_ADDR_LEN];
228 	uint32_t dialog_id;
229 };
230 
231 /* status code of deleting TWT dialog
232  * WMI_HOST_DEL_TWT_STATUS_OK: deleting TWT dialog successfully completed
233  * WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
234  * WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM: invalid parameters
235  * WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
236  *                                    this dialog
237  * WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE: FW resource exhausted
238  * WMI_HOST_DEL_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the request/response
239  *                            frame
240  * WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR: deleting TWT dialog failed with an
241  *                            unknown reason
242  */
243 enum WMI_HOST_DEL_TWT_STATUS {
244 	WMI_HOST_DEL_TWT_STATUS_OK,
245 	WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST,
246 	WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM,
247 	WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY,
248 	WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE,
249 	WMI_HOST_DEL_TWT_STATUS_NO_ACK,
250 	WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR,
251 };
252 
253 /** struct wmi_twt_del_dialog_complete_event_param -
254  * @vdev_id: VDEV identifier
255  * @peer_macaddr: Peer mac address
256  * @dialog_id: TWT dialog ID
257  * @status: refer to WMI_HOST_DEL_TWT_STATUS enum
258  */
259 struct wmi_twt_del_dialog_complete_event_param {
260 	uint32_t vdev_id;
261 	uint8_t  peer_macaddr[IEEE80211_ADDR_LEN];
262 	uint32_t dialog_id;
263 	uint32_t status;
264 };
265 
266 /** struct wmi_twt_pause_dialog_cmd_param -
267  * @vdev_id: VDEV identifier
268  * @peer_macaddr: Peer mac address
269  * @dialog_id: TWT dialog ID
270  */
271 struct wmi_twt_pause_dialog_cmd_param {
272 	uint32_t vdev_id;
273 	uint8_t  peer_macaddr[IEEE80211_ADDR_LEN];
274 	uint32_t dialog_id;
275 };
276 
277 /* enum WMI_HOST_PAUSE_TWT_STATUS - status code of pausing TWT dialog
278  * WMI_HOST_PAUSE_TWT_STATUS_OK: pausing TWT dialog successfully completed
279  * WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
280  * WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM: invalid parameters
281  * WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
282  *                          this dialog
283  * WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE: FW resource exhausted
284  * WMI_HOST_PAUSE_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
285  *                          request/response frame
286  * WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR: pausing TWT dialog failed with an
287  *                          unknown reason
288  */
289 enum WMI_HOST_PAUSE_TWT_STATUS {
290 	WMI_HOST_PAUSE_TWT_STATUS_OK,
291 	WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST,
292 	WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM,
293 	WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY,
294 	WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE,
295 	WMI_HOST_PAUSE_TWT_STATUS_NO_ACK,
296 	WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR,
297 };
298 
299 /** struct wmi_twt_pause_dialog_complete_event_param -
300  * @vdev_id: VDEV identifier
301  * @peer_macaddr: Peer mac address
302  * @dialog_id: TWT dialog ID
303  * @status: refer to WMI_HOST_PAUSE_TWT_STATUS
304  */
305 struct wmi_twt_pause_dialog_complete_event_param {
306 	uint32_t vdev_id;
307 	uint8_t  peer_macaddr[IEEE80211_ADDR_LEN];
308 	uint32_t dialog_id;
309 	uint32_t status;
310 };
311 
312 /** struct wmi_twt_resume_dialog_cmd_param -
313  * @vdev_id: VDEV identifier
314  * @peer_macaddr: Peer mac address
315  * @dialog_id: TWT dialog ID
316  * @sp_offset_us: this long time after TWT resumed the 1st SP will start
317  * @next_twt_size: Next TWT subfield Size.
318  *                 Refer IEEE 802.11ax section "9.4.1.60 TWT Information field"
319  */
320 struct wmi_twt_resume_dialog_cmd_param {
321 	uint32_t vdev_id;
322 	uint8_t  peer_macaddr[IEEE80211_ADDR_LEN];
323 	uint32_t dialog_id;
324 	uint32_t sp_offset_us;
325 	uint32_t next_twt_size;
326 };
327 
328 /* enum WMI_HOST_RESUME_TWT_STATUS - status code of resuming TWT dialog
329  * WMI_HOST_RESUME_TWT_STATUS_OK: resuming TWT dialog successfully completed
330  * WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
331  * WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM: invalid parameters
332  * WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
333  *                            this dialog
334  * WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED: dialog not paused currently
335  * WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE: FW resource exhausted
336  * WMI_HOST_RESUME_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
337  *                            request/response frame
338  * WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR: resuming TWT dialog failed with an
339  *                            unknown reason
340  */
341 enum WMI_HOST_RESUME_TWT_STATUS {
342 	WMI_HOST_RESUME_TWT_STATUS_OK,
343 	WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST,
344 	WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM,
345 	WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY,
346 	WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED,
347 	WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE,
348 	WMI_HOST_RESUME_TWT_STATUS_NO_ACK,
349 	WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR,
350 };
351 
352 /** struct wmi_twt_resume_dialog_complete_event_param -
353  * @vdev_id: VDEV identifier
354  * @peer_macaddr: Peer mac address
355  * @dialog_id: TWT dialog ID
356  * @status: refer to WMI_HOST_RESUME_TWT_STATUS
357  */
358 struct wmi_twt_resume_dialog_complete_event_param {
359 	uint32_t vdev_id;
360 	uint8_t  peer_macaddr[IEEE80211_ADDR_LEN];
361 	uint32_t dialog_id;
362 	uint32_t status;
363 };
364 
365 #endif /* _WMI_UNIFIED_TWT_PARAM_H_ */
366