1 /* 2 * Copyright (c) 2018-2019 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 * @flags: Flag to enable or disable capabilities, example bcast twt. 66 */ 67 struct wmi_twt_enable_param { 68 uint32_t pdev_id; 69 uint32_t sta_cong_timer_ms; 70 uint32_t mbss_support; 71 uint32_t default_slot_size; 72 uint32_t congestion_thresh_setup; 73 uint32_t congestion_thresh_teardown; 74 uint32_t congestion_thresh_critical; 75 uint32_t interference_thresh_teardown; 76 uint32_t interference_thresh_setup; 77 uint32_t min_no_sta_setup; 78 uint32_t min_no_sta_teardown; 79 uint32_t no_of_bcast_mcast_slots; 80 uint32_t min_no_twt_slots; 81 uint32_t max_no_sta_twt; 82 uint32_t mode_check_interval; 83 uint32_t add_sta_slot_interval; 84 uint32_t remove_sta_slot_interval; 85 uint32_t flags; 86 }; 87 88 /* status code of enabling TWT 89 * WMI_ENABLE_TWT_STATUS_OK: enabling TWT successfully completed 90 * WMI_ENABLE_TWT_STATUS_ALREADY_ENABLED: TWT already enabled 91 * WMI_ENABLE_TWT_STATUS_NOT_READY: FW not ready for enabling TWT 92 * WMI_ENABLE_TWT_INVALID_PARAM: invalid parameters 93 * WMI_ENABLE_TWT_STATUS_UNKNOWN_ERROR: enabling TWT failed with an 94 * unknown reason 95 */ 96 enum WMI_HOST_ENABLE_TWT_STATUS { 97 WMI_HOST_ENABLE_TWT_STATUS_OK, 98 WMI_HOST_ENABLE_TWT_STATUS_ALREADY_ENABLED, 99 WMI_HOST_ENABLE_TWT_STATUS_NOT_READY, 100 WMI_HOST_ENABLE_TWT_INVALID_PARAM, 101 WMI_HOST_ENABLE_TWT_STATUS_UNKNOWN_ERROR, 102 }; 103 104 /** struct wmi_twt_enable_complete_event_param: 105 * @pdev_is: pdev_id for identifying the MAC. 106 * @status: From enum WMI_HOST_ENABLE_TWT_STATUS 107 */ 108 struct wmi_twt_enable_complete_event_param { 109 uint32_t pdev_id; 110 uint32_t status; 111 }; 112 113 /** struct wmi_twt_disable_param: 114 * @pdev_id: pdev_id for identifying the MAC. 115 */ 116 struct wmi_twt_disable_param { 117 uint32_t pdev_id; 118 }; 119 120 /** struct wmi_twt_disable_complete_event: 121 * @pdev_id: pdev_id for identifying the MAC. 122 */ 123 struct wmi_twt_disable_complete_event { 124 uint32_t pdev_id; 125 }; 126 127 /* from IEEE 802.11ah section 9.4.2.200 */ 128 enum WMI_HOST_TWT_COMMAND { 129 WMI_HOST_TWT_COMMAND_REQUEST_TWT = 0, 130 WMI_HOST_TWT_COMMAND_SUGGEST_TWT = 1, 131 WMI_HOST_TWT_COMMAND_DEMAND_TWT = 2, 132 WMI_HOST_TWT_COMMAND_TWT_GROUPING = 3, 133 WMI_HOST_TWT_COMMAND_ACCEPT_TWT = 4, 134 WMI_HOST_TWT_COMMAND_ALTERNATE_TWT = 5, 135 WMI_HOST_TWT_COMMAND_DICTATE_TWT = 6, 136 WMI_HOST_TWT_COMMAND_REJECT_TWT = 7, 137 }; 138 139 /** struct wmi_twt_add_dialog_param - 140 * @vdev_id: VDEV identifier 141 * @peer_macaddr: peer MAC address when vdev is AP VDEV 142 * @dialog_id: diaglog_id (TWT dialog ID) 143 * This dialog ID must be unique within its vdev. 144 * @wake_intvl_us: TWT Wake Interval in units of us 145 * @wake_intvl_mantis: TWT Wake Interval Mantissa 146 * - wake_intvl_mantis must be <= 0xFFFF 147 * - wake_intvl_us must be divided evenly by wake_intvl_mantis, 148 * i.e., wake_intvl_us % wake_intvl_mantis == 0 149 * - the quotient of wake_intvl_us/wake_intvl_mantis must be 150 * 2 to N-th(0<=N<=31) power, 151 * i.e., wake_intvl_us/wake_intvl_mantis == 2^N, 0<=N<=31 152 * @wake_dura_us: TWT Wake Duration in units of us, must be <= 0xFFFF 153 * wake_dura_us must be divided evenly by 256, 154 * i.e., wake_dura_us % 256 == 0 155 * @sp_offset_us: this long time after TWT setup the 1st SP will start. 156 * @twt_cmd: cmd from enum WMI_HOST_TWT_COMMAND 157 * @flag_bcast: 0 means Individual TWT, 158 * 1 means Broadcast TWT 159 * @flag_trigger: 0 means non-Trigger-enabled TWT, 160 * 1 means means Trigger-enabled TWT 161 * @flag_flow_type: 0 means announced TWT, 162 * 1 means un-announced TWT 163 * @flag_protection: 0 means TWT protection is required, 164 * 1 means TWT protection is not required 165 */ 166 struct wmi_twt_add_dialog_param { 167 uint32_t vdev_id; 168 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 169 uint32_t dialog_id; 170 uint32_t wake_intvl_us; 171 uint32_t wake_intvl_mantis; 172 uint32_t wake_dura_us; 173 uint32_t sp_offset_us; 174 enum WMI_HOST_TWT_COMMAND twt_cmd; 175 uint32_t 176 flag_bcast:1, 177 flag_trigger:1, 178 flag_flow_type:1, 179 flag_protection:1; 180 }; 181 182 /* enum - status code of adding TWT dialog 183 * WMI_HOST_ADD_TWT_STATUS_OK: adding TWT dialog successfully completed 184 * WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED: TWT not enabled 185 * WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID: TWT dialog ID is already used 186 * WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM: invalid parameters 187 * WMI_HOST_ADD_TWT_STATUS_NOT_READY: FW not ready 188 * WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE: FW resource exhausted 189 * WMI_HOST_ADD_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the 190 * request/response frame 191 * WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE: peer AP did not send the response frame 192 * WMI_HOST_ADD_TWT_STATUS_DENIED: AP did not accept the request 193 * WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR: adding TWT dialog failed with 194 * an unknown reason 195 */ 196 enum WMI_HOST_ADD_TWT_STATUS { 197 WMI_HOST_ADD_TWT_STATUS_OK, 198 WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED, 199 WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID, 200 WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM, 201 WMI_HOST_ADD_TWT_STATUS_NOT_READY, 202 WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE, 203 WMI_HOST_ADD_TWT_STATUS_NO_ACK, 204 WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE, 205 WMI_HOST_ADD_TWT_STATUS_DENIED, 206 WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR, 207 }; 208 209 /** struct wmi_twt_add_dialog_complete_param - 210 * @vdev_id: VDEV identifier 211 * @peer_macaddr: Peer mac address 212 * @dialog_id: TWT dialog ID 213 * @status: refer to WMI_HOST_ADD_TWT_STATUS enum 214 */ 215 struct wmi_twt_add_dialog_complete_event_param { 216 uint32_t vdev_id; 217 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 218 uint32_t dialog_id; 219 uint32_t status; 220 }; 221 222 /** struct wmi_twt_del_dialog_param - 223 * @vdev_id: VDEV identifier 224 * @peer_macaddr: Peer mac address 225 * @dialog_id: TWT dialog ID 226 */ 227 struct wmi_twt_del_dialog_param { 228 uint32_t vdev_id; 229 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 230 uint32_t dialog_id; 231 }; 232 233 /* status code of deleting TWT dialog 234 * WMI_HOST_DEL_TWT_STATUS_OK: deleting TWT dialog successfully completed 235 * WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists 236 * WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM: invalid parameters 237 * WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling 238 * this dialog 239 * WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE: FW resource exhausted 240 * WMI_HOST_DEL_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the request/response 241 * frame 242 * WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR: deleting TWT dialog failed with an 243 * unknown reason 244 */ 245 enum WMI_HOST_DEL_TWT_STATUS { 246 WMI_HOST_DEL_TWT_STATUS_OK, 247 WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST, 248 WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM, 249 WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY, 250 WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE, 251 WMI_HOST_DEL_TWT_STATUS_NO_ACK, 252 WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR, 253 }; 254 255 /** struct wmi_twt_del_dialog_complete_event_param - 256 * @vdev_id: VDEV identifier 257 * @peer_macaddr: Peer mac address 258 * @dialog_id: TWT dialog ID 259 * @status: refer to WMI_HOST_DEL_TWT_STATUS enum 260 */ 261 struct wmi_twt_del_dialog_complete_event_param { 262 uint32_t vdev_id; 263 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 264 uint32_t dialog_id; 265 uint32_t status; 266 }; 267 268 /** struct wmi_twt_pause_dialog_cmd_param - 269 * @vdev_id: VDEV identifier 270 * @peer_macaddr: Peer mac address 271 * @dialog_id: TWT dialog ID 272 */ 273 struct wmi_twt_pause_dialog_cmd_param { 274 uint32_t vdev_id; 275 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 276 uint32_t dialog_id; 277 }; 278 279 /* enum WMI_HOST_PAUSE_TWT_STATUS - status code of pausing TWT dialog 280 * WMI_HOST_PAUSE_TWT_STATUS_OK: pausing TWT dialog successfully completed 281 * WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists 282 * WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM: invalid parameters 283 * WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling 284 * this dialog 285 * WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE: FW resource exhausted 286 * WMI_HOST_PAUSE_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the 287 * request/response frame 288 * WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR: pausing TWT dialog failed with an 289 * unknown reason 290 */ 291 enum WMI_HOST_PAUSE_TWT_STATUS { 292 WMI_HOST_PAUSE_TWT_STATUS_OK, 293 WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST, 294 WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM, 295 WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY, 296 WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE, 297 WMI_HOST_PAUSE_TWT_STATUS_NO_ACK, 298 WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR, 299 }; 300 301 /** struct wmi_twt_pause_dialog_complete_event_param - 302 * @vdev_id: VDEV identifier 303 * @peer_macaddr: Peer mac address 304 * @dialog_id: TWT dialog ID 305 * @status: refer to WMI_HOST_PAUSE_TWT_STATUS 306 */ 307 struct wmi_twt_pause_dialog_complete_event_param { 308 uint32_t vdev_id; 309 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 310 uint32_t dialog_id; 311 uint32_t status; 312 }; 313 314 /** struct wmi_twt_resume_dialog_cmd_param - 315 * @vdev_id: VDEV identifier 316 * @peer_macaddr: Peer mac address 317 * @dialog_id: TWT dialog ID 318 * @sp_offset_us: this long time after TWT resumed the 1st SP will start 319 * @next_twt_size: Next TWT subfield Size. 320 * Refer IEEE 802.11ax section "9.4.1.60 TWT Information field" 321 */ 322 struct wmi_twt_resume_dialog_cmd_param { 323 uint32_t vdev_id; 324 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 325 uint32_t dialog_id; 326 uint32_t sp_offset_us; 327 uint32_t next_twt_size; 328 }; 329 330 /* enum WMI_HOST_RESUME_TWT_STATUS - status code of resuming TWT dialog 331 * WMI_HOST_RESUME_TWT_STATUS_OK: resuming TWT dialog successfully completed 332 * WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists 333 * WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM: invalid parameters 334 * WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling 335 * this dialog 336 * WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED: dialog not paused currently 337 * WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE: FW resource exhausted 338 * WMI_HOST_RESUME_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the 339 * request/response frame 340 * WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR: resuming TWT dialog failed with an 341 * unknown reason 342 */ 343 enum WMI_HOST_RESUME_TWT_STATUS { 344 WMI_HOST_RESUME_TWT_STATUS_OK, 345 WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST, 346 WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM, 347 WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY, 348 WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED, 349 WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE, 350 WMI_HOST_RESUME_TWT_STATUS_NO_ACK, 351 WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR, 352 }; 353 354 /** struct wmi_twt_resume_dialog_complete_event_param - 355 * @vdev_id: VDEV identifier 356 * @peer_macaddr: Peer mac address 357 * @dialog_id: TWT dialog ID 358 * @status: refer to WMI_HOST_RESUME_TWT_STATUS 359 */ 360 struct wmi_twt_resume_dialog_complete_event_param { 361 uint32_t vdev_id; 362 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 363 uint32_t dialog_id; 364 uint32_t status; 365 }; 366 367 #endif /* _WMI_UNIFIED_TWT_PARAM_H_ */ 368