1 /* 2 * Copyright (c) 2013-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 #ifndef WMA_H 21 #define WMA_H 22 23 #include "a_types.h" 24 #include "qdf_types.h" 25 #include "osapi_linux.h" 26 #include "htc_packet.h" 27 #include "i_qdf_event.h" 28 #include "wmi_services.h" 29 #include "wmi_unified.h" 30 #include "wmi_version.h" 31 #include "qdf_types.h" 32 #include "qdf_status.h" 33 #include "cds_sched.h" 34 #include "cds_config.h" 35 #include "sir_mac_prot_def.h" 36 #include "wma_types.h" 37 #include <linux/workqueue.h> 38 #include "utils_api.h" 39 #include "lim_types.h" 40 #include "wmi_unified_api.h" 41 #include "cdp_txrx_cmn.h" 42 #include "dbglog.h" 43 #include "cds_ieee80211_common.h" 44 #include "wlan_objmgr_psoc_obj.h" 45 #include <cdp_txrx_handle.h> 46 #include <wlan_policy_mgr_api.h> 47 #include "wma_api.h" 48 #include "wmi_unified_param.h" 49 #include "wmi.h" 50 #include "wlan_cm_roam_public_struct.h" 51 #include "target_if.h" 52 53 /* Platform specific configuration for max. no. of fragments */ 54 #define QCA_OL_11AC_TX_MAX_FRAGS 2 55 56 /* Private */ 57 58 #define WMA_READY_EVENTID_TIMEOUT 6000 59 #define WMA_SERVICE_READY_EXT_TIMEOUT 6000 60 #define NAN_CLUSTER_ID_BYTES 4 61 62 #define WMA_CRASH_INJECT_TIMEOUT 5000 63 64 /* MAC ID to PDEV ID mapping is as given below 65 * MAC_ID PDEV_ID 66 * 0 1 67 * 1 2 68 * SOC Level WMI_PDEV_ID_SOC 69 */ 70 #define WMA_MAC_TO_PDEV_MAP(x) ((x) + (1)) 71 #define WMA_PDEV_TO_MAC_MAP(x) ((x) - (1)) 72 73 #define MAX_PRINT_FAILURE_CNT 50 74 75 #define WMA_INVALID_VDEV_ID 0xFF 76 77 #define wma_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_WMA, params) 78 #define wma_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_WMA, params) 79 #define wma_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_WMA, params) 80 #define wma_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_WMA, params) 81 #define wma_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_WMA, params) 82 #define wma_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_WMA, params) 83 #define wma_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_WMA, params) 84 85 #define wma_nofl_alert(params...) \ 86 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_WMA, params) 87 #define wma_nofl_err(params...) \ 88 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_WMA, params) 89 #define wma_nofl_warn(params...) \ 90 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_WMA, params) 91 #define wma_nofl_info(params...) \ 92 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_WMA, params) 93 #define wma_nofl_debug(params...) \ 94 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_WMA, params) 95 96 #define wma_conditional_log(is_console_log_enabled, params...) \ 97 do { \ 98 if (is_console_log_enabled) \ 99 wma_info(params); \ 100 else \ 101 wma_debug(params); \ 102 } while(0); \ 103 104 #define WMA_WILDCARD_PDEV_ID 0x0 105 106 #define WMA_HW_DEF_SCAN_MAX_DURATION 30000 /* 30 secs */ 107 108 #define WMA_EAPOL_SUBTYPE_GET_MIN_LEN 21 109 #define WMA_EAPOL_INFO_GET_MIN_LEN 23 110 #define WMA_IS_DHCP_GET_MIN_LEN 38 111 #define WMA_DHCP_SUBTYPE_GET_MIN_LEN 0x11D 112 #define WMA_DHCP_INFO_GET_MIN_LEN 50 113 #define WMA_ARP_SUBTYPE_GET_MIN_LEN 22 114 #define WMA_IPV4_PROTO_GET_MIN_LEN 24 115 #define WMA_IPV4_PKT_INFO_GET_MIN_LEN 42 116 #define WMA_ICMP_SUBTYPE_GET_MIN_LEN 35 117 #define WMA_IPV6_PROTO_GET_MIN_LEN 21 118 #define WMA_IPV6_PKT_INFO_GET_MIN_LEN 62 119 #define WMA_ICMPV6_SUBTYPE_GET_MIN_LEN 55 120 121 /* Beacon tx rate */ 122 #define WMA_BEACON_TX_RATE_1_M 10 123 #define WMA_BEACON_TX_RATE_2_M 20 124 #define WMA_BEACON_TX_RATE_5_5_M 55 125 #define WMA_BEACON_TX_RATE_11_M 110 126 #define WMA_BEACON_TX_RATE_6_M 60 127 #define WMA_BEACON_TX_RATE_9_M 90 128 #define WMA_BEACON_TX_RATE_12_M 120 129 #define WMA_BEACON_TX_RATE_18_M 180 130 #define WMA_BEACON_TX_RATE_24_M 240 131 #define WMA_BEACON_TX_RATE_36_M 360 132 #define WMA_BEACON_TX_RATE_48_M 480 133 #define WMA_BEACON_TX_RATE_54_M 540 134 135 /* Roaming default values 136 * All time and period values are in milliseconds. 137 * All rssi values are in dB except for WMA_NOISE_FLOOR_DBM_DEFAULT. 138 */ 139 140 #define WMA_ROAM_SCAN_CHANNEL_SWITCH_TIME (4) 141 #define WMA_NOISE_FLOOR_DBM_DEFAULT (-96) 142 #define WMA_RSSI_MIN_VALUE (-128) 143 #define WMA_RSSI_MAX_VALUE (127) 144 #define WMA_ROAM_RSSI_DIFF_DEFAULT (5) 145 #define WMA_ROAM_DWELL_TIME_ACTIVE_DEFAULT (100) 146 #define WMA_ROAM_DWELL_TIME_PASSIVE_DEFAULT (110) 147 #define WMA_ROAM_MIN_REST_TIME_DEFAULT (50) 148 #define WMA_ROAM_MAX_REST_TIME_DEFAULT (500) 149 150 #define WMA_INVALID_KEY_IDX 0xff 151 152 #define WMA_MAX_RF_CHAINS(x) ((1 << x) - 1) 153 #define WMA_MIN_RF_CHAINS (1) 154 #define WMA_MAX_NSS (2) 155 156 #define WMA_NOA_IE_SIZE(num_desc) (2 + (13 * (num_desc))) 157 #define WMA_MAX_NOA_DESCRIPTORS 4 158 159 #define WMA_TIM_SUPPORTED_PVB_LENGTH ((HAL_NUM_STA / 8) + 1) 160 161 #define WMA_BSS_STATUS_STARTED 0x1 162 #define WMA_BSS_STATUS_STOPPED 0x2 163 164 #define WMA_PEER_ASSOC_CNF_START 0x01 165 #define WMA_PEER_ASSOC_TIMEOUT SIR_PEER_ASSOC_TIMEOUT 166 167 #define WMA_DELETE_STA_RSP_START 0x02 168 #define WMA_DELETE_STA_TIMEOUT SIR_DELETE_STA_TIMEOUT 169 170 #define WMA_DEL_P2P_SELF_STA_RSP_START 0x03 171 #define WMA_SET_LINK_PEER_RSP 0x04 172 #define WMA_DELETE_PEER_RSP 0x05 173 174 #define WMA_PDEV_SET_HW_MODE_RESP 0x06 175 #define WMA_PDEV_MAC_CFG_RESP 0x07 176 177 #define WMA_PEER_CREATE_RESPONSE 0x08 178 #define WMA_PEER_CREATE_RESPONSE_TIMEOUT SIR_PEER_CREATE_RESPONSE_TIMEOUT 179 180 /* send connect respone after bss peer is deleted */ 181 #define WMA_DELETE_STA_CONNECT_RSP 0x09 182 183 /* Peer create response for 11az PASN peer */ 184 #define WMA_PASN_PEER_CREATE_RESPONSE 0x0a 185 186 #define WMA_PASN_PEER_DELETE_RESPONSE 0x0b 187 #define WMA_PEER_DELETE_RESPONSE_TIMEOUT SIR_DELETE_STA_TIMEOUT 188 189 /* FW response timeout values in milli seconds */ 190 #define WMA_VDEV_PLCY_MGR_TIMEOUT SIR_VDEV_PLCY_MGR_TIMEOUT 191 #define WMA_VDEV_HW_MODE_REQUEST_TIMEOUT WMA_VDEV_PLCY_MGR_TIMEOUT 192 #define WMA_VDEV_DUAL_MAC_CFG_TIMEOUT WMA_VDEV_PLCY_MGR_TIMEOUT 193 #define WMA_VDEV_PLCY_MGR_WAKE_LOCK_TIMEOUT \ 194 (WMA_VDEV_PLCY_MGR_TIMEOUT + 500) 195 196 197 #define WMA_VDEV_SET_KEY_WAKELOCK_TIMEOUT WAKELOCK_DURATION_RECOMMENDED 198 199 #define WMA_TX_Q_RECHECK_TIMER_WAIT 2 /* 2 ms */ 200 201 #define WMA_SMPS_PARAM_VALUE_S 29 202 203 /* 204 * Setting the Tx Comp Timeout to 1 secs. 205 * TODO: Need to Revist the Timing 206 */ 207 #define WMA_TX_FRAME_COMPLETE_TIMEOUT 1000 208 #define WMA_TX_FRAME_BUFFER_NO_FREE 0 209 #define WMA_TX_FRAME_BUFFER_FREE 1 210 211 /* 212 * TODO: Add WMI_CMD_ID_MAX as part of WMI_CMD_ID 213 * instead of assigning it to the last valid wmi 214 * cmd+1 to avoid updating this when a command is 215 * added/deleted. 216 */ 217 #define WMI_CMDID_MAX (WMI_TXBF_CMDID + 1) 218 219 #define WMA_NLO_FREQ_THRESH 1000 /* in MHz */ 220 #define WMA_MSEC_TO_USEC(msec) (msec * 1000) /* msec to usec */ 221 222 #define WMA_AUTH_REQ_RECV_WAKE_LOCK_TIMEOUT WAKELOCK_DURATION_RECOMMENDED 223 #define WMA_ASSOC_REQ_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED 224 #define WMA_DEAUTH_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED 225 #define WMA_DISASSOC_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED 226 #define WMA_ROAM_HO_WAKE_LOCK_DURATION (500) /* in msec */ 227 #define WMA_ROAM_PREAUTH_WAKE_LOCK_DURATION (2 * 1000) 228 229 #define WMA_REASON_PROBE_REQ_WPS_IE_RECV_DURATION (3 * 1000) 230 231 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN 232 #define WMA_AUTO_SHUTDOWN_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED 233 #endif 234 #define WMA_BMISS_EVENT_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED 235 #define WMA_FW_RSP_EVENT_WAKE_LOCK_DURATION WAKELOCK_DURATION_MAX 236 237 #define WMA_TXMIC_LEN 8 238 #define WMA_RXMIC_LEN 8 239 #define WMA_IV_KEY_LEN 16 240 241 /* 242 * Length = (2 octets for Index and CTWin/Opp PS) and 243 * (13 octets for each NOA Descriptors) 244 */ 245 246 #define WMA_P2P_NOA_IE_OPP_PS_SET (0x80) 247 #define WMA_P2P_NOA_IE_CTWIN_MASK (0x7F) 248 249 #define WMA_P2P_IE_ID 0xdd 250 #define WMA_P2P_WFA_OUI { 0x50, 0x6f, 0x9a } 251 #define WMA_P2P_WFA_VER 0x09 /* ver 1.0 */ 252 253 /* P2P Sub element definitions (according to table 5 of Wifi's P2P spec) */ 254 #define WMA_P2P_SUB_ELEMENT_STATUS 0 255 #define WMA_P2P_SUB_ELEMENT_MINOR_REASON 1 256 #define WMA_P2P_SUB_ELEMENT_CAPABILITY 2 257 #define WMA_P2P_SUB_ELEMENT_DEVICE_ID 3 258 #define WMA_P2P_SUB_ELEMENT_GO_INTENT 4 259 #define WMA_P2P_SUB_ELEMENT_CONFIGURATION_TIMEOUT 5 260 #define WMA_P2P_SUB_ELEMENT_LISTEN_CHANNEL 6 261 #define WMA_P2P_SUB_ELEMENT_GROUP_BSSID 7 262 #define WMA_P2P_SUB_ELEMENT_EXTENDED_LISTEN_TIMING 8 263 #define WMA_P2P_SUB_ELEMENT_INTENDED_INTERFACE_ADDR 9 264 #define WMA_P2P_SUB_ELEMENT_MANAGEABILITY 10 265 #define WMA_P2P_SUB_ELEMENT_CHANNEL_LIST 11 266 #define WMA_P2P_SUB_ELEMENT_NOA 12 267 #define WMA_P2P_SUB_ELEMENT_DEVICE_INFO 13 268 #define WMA_P2P_SUB_ELEMENT_GROUP_INFO 14 269 #define WMA_P2P_SUB_ELEMENT_GROUP_ID 15 270 #define WMA_P2P_SUB_ELEMENT_INTERFACE 16 271 #define WMA_P2P_SUB_ELEMENT_OP_CHANNEL 17 272 #define WMA_P2P_SUB_ELEMENT_INVITATION_FLAGS 18 273 #define WMA_P2P_SUB_ELEMENT_VENDOR 221 274 275 /* Macros for handling unaligned memory accesses */ 276 #define P2PIE_PUT_LE16(a, val) \ 277 do { \ 278 (a)[1] = ((uint16_t) (val)) >> 8; \ 279 (a)[0] = ((uint16_t) (val)) & 0xff; \ 280 } while (0) 281 282 #define P2PIE_PUT_LE32(a, val) \ 283 do { \ 284 (a)[3] = (uint8_t) ((((uint32_t) (val)) >> 24) & 0xff); \ 285 (a)[2] = (uint8_t) ((((uint32_t) (val)) >> 16) & 0xff); \ 286 (a)[1] = (uint8_t) ((((uint32_t) (val)) >> 8) & 0xff); \ 287 (a)[0] = (uint8_t) (((uint32_t) (val)) & 0xff); \ 288 } while (0) 289 290 291 #define WMA_DEFAULT_MAX_PSPOLL_BEFORE_WAKE 1 292 293 #define WMA_VHT_PPS_PAID_MATCH 1 294 #define WMA_VHT_PPS_GID_MATCH 2 295 #define WMA_VHT_PPS_DELIM_CRC_FAIL 3 296 297 #define WMA_DEFAULT_HW_MODE_INDEX 0xFFFF 298 #define TWO_THIRD (2/3) 299 300 #ifdef WLAN_FEATURE_SON 301 #define WMA_SON_MAX_PEER_EXT_STATS 16 302 #else 303 #define WMA_SON_MAX_PEER_EXT_STATS 0 304 #endif 305 306 /** 307 * WMA hardware mode list bit-mask definitions. 308 * Bits 4:0, 31:29 are unused. 309 * 310 * The below definitions are added corresponding to WMI DBS HW mode 311 * list to make it independent of firmware changes for WMI definitions. 312 * Currently these definitions have dependency with BIT positions of 313 * the existing WMI macros. Thus, if the BIT positions are changed for 314 * WMI macros, then these macros' BIT definitions are also need to be 315 * changed. 316 */ 317 #define WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS (28) 318 #define WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS (24) 319 #define WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS (20) 320 #define WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS (16) 321 #define WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS (12) 322 #define WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS (8) 323 #define WMA_HW_MODE_DBS_MODE_BITPOS (7) 324 #define WMA_HW_MODE_AGILE_DFS_MODE_BITPOS (6) 325 #define WMA_HW_MODE_SBS_MODE_BITPOS (5) 326 327 #define WMA_HW_MODE_MAC0_TX_STREAMS_MASK \ 328 (0xf << WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS) 329 #define WMA_HW_MODE_MAC0_RX_STREAMS_MASK \ 330 (0xf << WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS) 331 #define WMA_HW_MODE_MAC1_TX_STREAMS_MASK \ 332 (0xf << WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS) 333 #define WMA_HW_MODE_MAC1_RX_STREAMS_MASK \ 334 (0xf << WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS) 335 #define WMA_HW_MODE_MAC0_BANDWIDTH_MASK \ 336 (0xf << WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS) 337 #define WMA_HW_MODE_MAC1_BANDWIDTH_MASK \ 338 (0xf << WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS) 339 #define WMA_HW_MODE_DBS_MODE_MASK \ 340 (0x1 << WMA_HW_MODE_DBS_MODE_BITPOS) 341 #define WMA_HW_MODE_AGILE_DFS_MODE_MASK \ 342 (0x1 << WMA_HW_MODE_AGILE_DFS_MODE_BITPOS) 343 #define WMA_HW_MODE_SBS_MODE_MASK \ 344 (0x1 << WMA_HW_MODE_SBS_MODE_BITPOS) 345 346 #define WMA_HW_MODE_MAC0_TX_STREAMS_SET(hw_mode, value) \ 347 WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS, 4, value) 348 #define WMA_HW_MODE_MAC0_RX_STREAMS_SET(hw_mode, value) \ 349 WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS, 4, value) 350 #define WMA_HW_MODE_MAC1_TX_STREAMS_SET(hw_mode, value) \ 351 WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS, 4, value) 352 #define WMA_HW_MODE_MAC1_RX_STREAMS_SET(hw_mode, value) \ 353 WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS, 4, value) 354 #define WMA_HW_MODE_MAC0_BANDWIDTH_SET(hw_mode, value) \ 355 WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS, 4, value) 356 #define WMA_HW_MODE_MAC1_BANDWIDTH_SET(hw_mode, value) \ 357 WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS, 4, value) 358 #define WMA_HW_MODE_DBS_MODE_SET(hw_mode, value) \ 359 WMI_SET_BITS(hw_mode, WMA_HW_MODE_DBS_MODE_BITPOS, 1, value) 360 #define WMA_HW_MODE_AGILE_DFS_SET(hw_mode, value) \ 361 WMI_SET_BITS(hw_mode, WMA_HW_MODE_AGILE_DFS_MODE_BITPOS, 1, value) 362 #define WMA_HW_MODE_SBS_MODE_SET(hw_mode, value) \ 363 WMI_SET_BITS(hw_mode, WMA_HW_MODE_SBS_MODE_BITPOS, 1, value) 364 365 #define WMA_HW_MODE_MAC0_TX_STREAMS_GET(hw_mode) \ 366 ((hw_mode & WMA_HW_MODE_MAC0_TX_STREAMS_MASK) >> \ 367 WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS) 368 #define WMA_HW_MODE_MAC0_RX_STREAMS_GET(hw_mode) \ 369 ((hw_mode & WMA_HW_MODE_MAC0_RX_STREAMS_MASK) >> \ 370 WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS) 371 #define WMA_HW_MODE_MAC1_TX_STREAMS_GET(hw_mode) \ 372 ((hw_mode & WMA_HW_MODE_MAC1_TX_STREAMS_MASK) >> \ 373 WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS) 374 #define WMA_HW_MODE_MAC1_RX_STREAMS_GET(hw_mode) \ 375 ((hw_mode & WMA_HW_MODE_MAC1_RX_STREAMS_MASK) >> \ 376 WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS) 377 #define WMA_HW_MODE_MAC0_BANDWIDTH_GET(hw_mode) \ 378 ((hw_mode & WMA_HW_MODE_MAC0_BANDWIDTH_MASK) >> \ 379 WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS) 380 #define WMA_HW_MODE_MAC1_BANDWIDTH_GET(hw_mode) \ 381 ((hw_mode & WMA_HW_MODE_MAC1_BANDWIDTH_MASK) >> \ 382 WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS) 383 #define WMA_HW_MODE_DBS_MODE_GET(hw_mode) \ 384 ((hw_mode & WMA_HW_MODE_DBS_MODE_MASK) >> \ 385 WMA_HW_MODE_DBS_MODE_BITPOS) 386 #define WMA_HW_MODE_AGILE_DFS_GET(hw_mode) \ 387 ((hw_mode & WMA_HW_MODE_AGILE_DFS_MODE_MASK) >> \ 388 WMA_HW_MODE_AGILE_DFS_MODE_BITPOS) 389 #define WMA_HW_MODE_SBS_MODE_GET(hw_mode) \ 390 ((hw_mode & WMA_HW_MODE_SBS_MODE_MASK) >> \ 391 WMA_HW_MODE_SBS_MODE_BITPOS) 392 393 /* 394 * Extract 2G or 5G tx/rx chainmask 395 * format of txrx_chainmask (from wmi_service_ready_event_fixed_param): 396 * [7:0] - 2G band tx chain mask 397 * [15:8] - 2G band rx chain mask 398 * [23:16] - 5G band tx chain mask 399 * [31:24] - 5G band rx chain mask 400 */ 401 #define EXTRACT_TX_CHAIN_MASK_2G(chainmask) ((chainmask) & 0xFF) 402 #define EXTRACT_RX_CHAIN_MASK_2G(chainmask) (((chainmask) >> 8) & 0xFF) 403 #define EXTRACT_TX_CHAIN_MASK_5G(chainmask) (((chainmask) >> 16) & 0xFF) 404 #define EXTRACT_RX_CHAIN_MASK_5G(chainmask) (((chainmask) >> 24) & 0xFF) 405 406 /* 407 * PROBE_REQ_TX_DELAY 408 * param to specify probe request Tx delay for scans triggered on this VDEV 409 */ 410 #define PROBE_REQ_TX_DELAY 10 411 412 /* PROBE_REQ_TX_TIME_GAP 413 * param to specify the time gap between each set of probe request transmission. 414 * The number of probe requests in each set depends on the ssid_list and, 415 * bssid_list in the scan request. This parameter will get applied only, 416 * for the scans triggered on this VDEV. 417 */ 418 #define PROBE_REQ_TX_TIME_GAP 20 419 420 /** 421 * enum wma_rx_exec_ctx - wma rx execution context 422 * @WMA_RX_WORK_CTX: work queue context execution 423 * @WMA_RX_TASKLET_CTX: tasklet context execution 424 * @WMA_RX_SERIALIZER_CTX: MC thread context execution 425 * 426 */ 427 enum wma_rx_exec_ctx { 428 WMA_RX_WORK_CTX = WMI_RX_WORK_CTX, 429 WMA_RX_TASKLET_CTX = WMI_RX_TASKLET_CTX, 430 WMA_RX_SERIALIZER_CTX = WMI_RX_SERIALIZER_CTX, 431 }; 432 433 /** 434 * struct beacon_info - structure to store beacon template 435 * @buf: skb ptr 436 * @len: length 437 * @dma_mapped: is it dma mapped or not 438 * @tim_ie_offset: TIM IE offset 439 * @dtim_count: DTIM count 440 * @seq_no: sequence no 441 * @noa_sub_ie: NOA sub IE 442 * @noa_sub_ie_len: NOA sub IE length 443 * @noa_ie: NOA IE 444 * @p2p_ie_offset: p2p IE offset 445 * @csa_count_offset: Offset of Switch count field in CSA IE 446 * @ecsa_count_offset: Offset of Switch count field in ECSA IE 447 * @lock: lock 448 */ 449 struct beacon_info { 450 qdf_nbuf_t buf; 451 uint32_t len; 452 uint8_t dma_mapped; 453 uint32_t tim_ie_offset; 454 uint8_t dtim_count; 455 uint16_t seq_no; 456 uint8_t noa_sub_ie[2 + WMA_NOA_IE_SIZE(WMA_MAX_NOA_DESCRIPTORS)]; 457 uint16_t noa_sub_ie_len; 458 uint8_t *noa_ie; 459 uint16_t p2p_ie_offset; 460 uint16_t csa_count_offset; 461 uint16_t ecsa_count_offset; 462 qdf_spinlock_t lock; 463 }; 464 465 /** 466 * struct beacon_tim_ie - structure to store TIM IE of beacon 467 * @tim_ie: tim ie 468 * @tim_len: tim ie length 469 * @dtim_count: dtim count 470 * @dtim_period: dtim period 471 * @tim_bitctl: tim bit control 472 * @tim_bitmap: tim bitmap 473 */ 474 struct beacon_tim_ie { 475 uint8_t tim_ie; 476 uint8_t tim_len; 477 uint8_t dtim_count; 478 uint8_t dtim_period; 479 uint8_t tim_bitctl; 480 uint8_t tim_bitmap[1]; 481 } __ATTRIB_PACK; 482 483 /** 484 * struct pps - packet power save parameter 485 * @paid_match_enable: paid match enable 486 * @gid_match_enable: gid match enable 487 * @tim_clear: time clear 488 * @dtim_clear: dtim clear 489 * @eof_delim: eof delim 490 * @mac_match: mac match 491 * @delim_fail: delim fail 492 * @nsts_zero: nsts zero 493 * @rssi_chk: RSSI check 494 * @ebt_5g: ebt 5GHz 495 */ 496 struct pps { 497 bool paid_match_enable; 498 bool gid_match_enable; 499 bool tim_clear; 500 bool dtim_clear; 501 bool eof_delim; 502 bool mac_match; 503 bool delim_fail; 504 bool nsts_zero; 505 bool rssi_chk; 506 bool ebt_5g; 507 }; 508 509 /** 510 * struct qpower_params - qpower related parameters 511 * @max_ps_poll_cnt: max ps poll count 512 * @max_tx_before_wake: max tx before wake 513 * @spec_ps_poll_wake_interval: ps poll wake interval 514 * @max_spec_nodata_ps_poll: no data ps poll 515 */ 516 struct qpower_params { 517 uint32_t max_ps_poll_cnt; 518 uint32_t max_tx_before_wake; 519 uint32_t spec_ps_poll_wake_interval; 520 uint32_t max_spec_nodata_ps_poll; 521 }; 522 523 524 /** 525 * struct gtx_config_t - GTX config 526 * @gtxRTMask: for HT and VHT rate masks 527 * @gtxUsrcfg: host request for GTX mask 528 * @gtxPERThreshold: PER Threshold (default: 10%) 529 * @gtxPERMargin: PER margin (default: 2%) 530 * @gtxTPCstep: TCP step (default: 1) 531 * @gtxTPCMin: TCP min (default: 5) 532 * @gtxBWMask: BW mask (20/40/80/160 Mhz) 533 */ 534 typedef struct { 535 uint32_t gtxRTMask[2]; 536 uint32_t gtxUsrcfg; 537 uint32_t gtxPERThreshold; 538 uint32_t gtxPERMargin; 539 uint32_t gtxTPCstep; 540 uint32_t gtxTPCMin; 541 uint32_t gtxBWMask; 542 } gtx_config_t; 543 544 /** 545 * struct pdev_cli_config_t - store pdev parameters 546 * @ani_enable: ANI is enabled/disable on target 547 * @ani_poll_len: store ANI polling period 548 * @ani_listen_len: store ANI listening period 549 * @ani_ofdm_level: store ANI OFDM immunity level 550 * @ani_cck_level: store ANI CCK immunity level 551 * @cwmenable: Dynamic bw is enable/disable in fw 552 * @txchainmask: tx chain mask 553 * @rxchainmask: rx chain mask 554 * @txpow2g: tx power limit for 2GHz 555 * @txpow5g: tx power limit for 5GHz 556 * 557 * This structure stores pdev parameters. 558 * Some of these parameters are set in fw and some 559 * parameters are only maintained in host. 560 */ 561 typedef struct { 562 uint32_t ani_enable; 563 uint32_t ani_poll_len; 564 uint32_t ani_listen_len; 565 uint32_t ani_ofdm_level; 566 uint32_t ani_cck_level; 567 uint32_t cwmenable; 568 uint32_t cts_cbw; 569 uint32_t txchainmask; 570 uint32_t rxchainmask; 571 uint32_t txpow2g; 572 uint32_t txpow5g; 573 } pdev_cli_config_t; 574 575 /** 576 * struct vdev_cli_config_t - store vdev parameters 577 * @nss: nss width 578 * @ldpc: is ldpc is enable/disable 579 * @tx_stbc: TX STBC is enable/disable 580 * @rx_stbc: RX STBC is enable/disable 581 * @shortgi: short gi is enable/disable 582 * @rtscts_en: RTS/CTS is enable/disable 583 * @chwidth: channel width 584 * @tx_rate: tx rate 585 * @ampdu: ampdu size 586 * @amsdu: amsdu size 587 * @erx_adjust: enable/disable early rx enable 588 * @erx_bmiss_num: target bmiss number per sample 589 * @erx_bmiss_cycle: sample cycle 590 * @erx_slop_step: slop_step value 591 * @erx_init_slop: init slop 592 * @erx_adj_pause: pause adjust enable/disable 593 * @erx_dri_sample: enable/disable drift sample 594 * @pps_params: packet power save parameters 595 * @qpower_params: qpower parameters 596 * @gtx_info: GTX offload info 597 * @dcm: DCM enable/disable 598 * @range_ext: HE range extension enable/disable 599 * @tx_ampdu: tx ampdu size 600 * @rx_ampdu: rx ampdu size 601 * @tx_amsdu: tx amsdu size 602 * @rx_amsdu: rx amsdu size 603 * 604 * This structure stores vdev parameters. 605 * Some of these parameters are set in fw and some 606 * parameters are only maintained in host. 607 */ 608 typedef struct { 609 uint32_t nss; 610 uint32_t ldpc; 611 uint32_t tx_stbc; 612 uint32_t rx_stbc; 613 uint32_t shortgi; 614 uint32_t rtscts_en; 615 uint32_t chwidth; 616 uint32_t tx_rate; 617 uint32_t ampdu; 618 uint32_t amsdu; 619 uint32_t erx_adjust; 620 uint32_t erx_bmiss_num; 621 uint32_t erx_bmiss_cycle; 622 uint32_t erx_slop_step; 623 uint32_t erx_init_slop; 624 uint32_t erx_adj_pause; 625 uint32_t erx_dri_sample; 626 struct pps pps_params; 627 struct qpower_params qpower_params; 628 gtx_config_t gtx_info; 629 #ifdef WLAN_FEATURE_11AX 630 uint8_t dcm; 631 uint8_t range_ext; 632 #endif 633 uint32_t tx_ampdu; 634 uint32_t rx_ampdu; 635 uint32_t tx_amsdu; 636 uint32_t rx_amsdu; 637 } vdev_cli_config_t; 638 639 /** 640 * struct wma_version_info - Store wmi version info 641 * @major: wmi major version 642 * @minor: wmi minor version 643 * @revision: wmi revision number 644 */ 645 struct wma_version_info { 646 u_int32_t major; 647 u_int32_t minor; 648 u_int32_t revision; 649 }; 650 651 /* Max number of invalid peer entries */ 652 #define INVALID_PEER_MAX_NUM 5 653 654 /** 655 * struct wma_invalid_peer_params - stores invalid peer entries 656 * @rx_macaddr: store mac addr of invalid peer 657 */ 658 struct wma_invalid_peer_params { 659 uint8_t rx_macaddr[QDF_MAC_ADDR_SIZE]; 660 }; 661 662 /** 663 * struct wma_txrx_node - txrx node 664 * @vdev: pointer to vdev object 665 * @beacon: beacon info 666 * @config: per vdev config parameters 667 * @scan_info: scan info 668 * @type: type 669 * @sub_type: sub type 670 * @nlo_match_evt_received: is nlo match event received or not 671 * @pno_in_progress: is pno in progress or not 672 * @plm_in_progress: is plm in progress or not 673 * @beaconInterval: beacon interval 674 * @llbCoexist: 11b coexist 675 * @shortSlotTimeSupported: is short slot time supported or not 676 * @dtimPeriod: DTIM period 677 * @chan_width: channel bandwidth 678 * @vdev_up: is vdev up or not 679 * @tsfadjust: TSF adjust 680 * @addBssStaContext: add bss context 681 * @aid: association id 682 * @rmfEnabled: Robust Management Frame (RMF) enabled/disabled 683 * @uapsd_cached_val: uapsd cached value 684 * @stats_rsp: stats response 685 * @del_staself_req: delete sta self request 686 * @bss_status: bss status 687 * @nss: nss value 688 * @is_channel_switch: is channel switch 689 * @pause_bitmap: pause bitmap 690 * @nwType: network type (802.11a/b/g/n/ac) 691 * @ps_enabled: is powersave enable/disable 692 * @peer_count: peer count 693 * @plink_status_req: link status request 694 * @psnr_req: snr request 695 * @tx_streams: number of tx streams can be used by the vdev 696 * @mac_id: the mac on which vdev is on 697 * @arp_offload_req: cached arp offload request 698 * @ns_offload_req: cached ns offload request 699 * @rcpi_req: rcpi request 700 * @in_bmps: Whether bmps for this interface has been enabled 701 * @ch_freq: channel frequency 702 * @roam_scan_stats_req: cached roam scan stats request 703 * @wma_invalid_peer_params: structure storing invalid peer params 704 * @invalid_peer_idx: invalid peer index 705 * It stores parameters per vdev in wma. 706 */ 707 struct wma_txrx_node { 708 struct wlan_objmgr_vdev *vdev; 709 struct beacon_info *beacon; 710 vdev_cli_config_t config; 711 uint32_t type; 712 uint32_t sub_type; 713 #ifdef FEATURE_WLAN_ESE 714 bool plm_in_progress; 715 #endif 716 tSirMacBeaconInterval beaconInterval; 717 uint8_t llbCoexist; 718 uint8_t shortSlotTimeSupported; 719 uint8_t dtimPeriod; 720 enum phy_ch_width chan_width; 721 bool vdev_active; 722 uint64_t tsfadjust; 723 tAddStaParams *addBssStaContext; 724 uint16_t aid; 725 uint8_t rmfEnabled; 726 uint32_t uapsd_cached_val; 727 void *del_staself_req; 728 bool is_del_sta_deferred; 729 qdf_atomic_t bss_status; 730 enum tx_rate_info rate_flags; 731 uint8_t nss; 732 uint16_t pause_bitmap; 733 uint32_t nwType; 734 uint32_t peer_count; 735 void *plink_status_req; 736 void *psnr_req; 737 #ifdef FEATURE_WLAN_EXTSCAN 738 bool extscan_in_progress; 739 #endif 740 uint32_t tx_streams; 741 uint32_t mac_id; 742 int32_t roam_synch_delay; 743 struct sme_rcpi_req *rcpi_req; 744 bool in_bmps; 745 struct beacon_filter_param beacon_filter; 746 bool beacon_filter_enabled; 747 struct roam_synch_frame_ind roam_synch_frame_ind; 748 bool is_waiting_for_key; 749 uint32_t ch_freq; 750 uint16_t ch_flagext; 751 struct sir_roam_scan_stats *roam_scan_stats_req; 752 struct wma_invalid_peer_params invalid_peers[INVALID_PEER_MAX_NUM]; 753 uint8_t invalid_peer_idx; 754 uint16_t bss_max_idle_period; 755 }; 756 757 /** 758 * struct mac_ss_bw_info - hw_mode_list PHY/MAC params for each MAC 759 * @mac_tx_stream: Max TX stream 760 * @mac_rx_stream: Max RX stream 761 * @mac_bw: Max bandwidth 762 */ 763 struct mac_ss_bw_info { 764 uint32_t mac_tx_stream; 765 uint32_t mac_rx_stream; 766 uint32_t mac_bw; 767 }; 768 769 /** 770 * struct wma_ini_config - Structure to hold wma ini configuration 771 * @max_no_of_peers: Max Number of supported 772 * @exclude_selftx_from_cca_busy: Exclude self tx time from cca busy time flag. 773 * 774 * Placeholder for WMA ini parameters. 775 */ 776 struct wma_ini_config { 777 uint8_t max_no_of_peers; 778 bool exclude_selftx_from_cca_busy; 779 }; 780 781 /** 782 * struct wma_valid_channels - Channel details part of WMI_SCAN_CHAN_LIST_CMDID 783 * @num_channels: Number of channels 784 * @ch_freq_list: Channel Frequency list 785 */ 786 struct wma_valid_channels { 787 uint8_t num_channels; 788 uint32_t ch_freq_list[NUM_CHANNELS]; 789 }; 790 791 #ifdef FEATURE_WLM_STATS 792 /** 793 * struct wma_wlm_stats_data - Data required to be used to send WLM req 794 * @wlm_stats_max_size: Buffer size provided by userspace 795 * @wlm_stats_cookie: Cookie to retrieve WLM req data 796 * @wlm_stats_callback: Callback to be used to send WLM response 797 */ 798 struct wma_wlm_stats_data { 799 uint32_t wlm_stats_max_size; 800 void *wlm_stats_cookie; 801 wma_wlm_stats_cb wlm_stats_callback; 802 }; 803 #endif 804 805 /** 806 * struct t_wma_handle - wma context 807 * @wmi_handle: wmi handle 808 * @cds_context: cds handle 809 * @mac_context: mac context 810 * @psoc: psoc context 811 * @pdev: physical device global object 812 * @target_suspend: target suspend event 813 * @recovery_event: wma FW recovery event 814 * @max_station: max stations 815 * @max_bssid: max bssid 816 * @myaddr: current mac address 817 * @hwaddr: mac address from EEPROM 818 * @lpss_support: LPSS feature is supported in target or not 819 * @wmi_ready: wmi status flag 820 * @wlan_init_status: wlan init status 821 * @qdf_dev: qdf device 822 * @wmi_service_bitmap: wmi services bitmap received from Target 823 * @wmi_service_ext_bitmap: extended wmi services bitmap received from Target 824 * @tx_frm_download_comp_cb: Tx Frame Compl Cb registered by umac 825 * @tx_frm_download_comp_event: Event to wait for tx download completion 826 * @tx_queue_empty_event: Dummy event to wait for draining MSDUs left 827 * in hardware tx queue and before requesting VDEV_STOP. Nobody will 828 * set this and wait will timeout, and code will poll the pending tx 829 * descriptors number to be zero. 830 * @umac_ota_ack_cb: Ack Complete Callback registered by umac 831 * @umac_data_ota_ack_cb: ack complete callback 832 * @last_umac_data_ota_timestamp: timestamp when OTA of last umac data 833 * was done 834 * @last_umac_data_nbuf: cache nbuf ptr for the last umac data buf 835 * @tgt_cfg_update_cb: configuration update callback 836 * @reg_cap: regulatory capabilities 837 * @scan_id: scan id 838 * @interfaces: txrx nodes(per vdev) 839 * @pdevconfig: pdev related configurations 840 * @wma_hold_req_queue: Queue use to serialize requests to firmware 841 * @wma_hold_req_q_lock: Mutex for @wma_hold_req_queue 842 * @vht_supp_mcs: VHT supported MCS 843 * @is_fw_assert: is fw asserted 844 * @ack_work_ctx: Context for deferred processing of TX ACK 845 * @pGetRssiReq: get RSSI request 846 * @get_one_peer_info: When a "get peer info" request is active, is 847 * the request for a single peer? 848 * @peer_macaddr: When @get_one_peer_info is true, the peer's mac address 849 * @thermal_mgmt_info: Thermal mitigation related info 850 * @enable_mc_list: To Check if Multicast list filtering is enabled in FW 851 * @hddTxFailCb: tx fail indication callback 852 * @extscan_wake_lock: extscan wake lock 853 * @wow_wake_lock: wow wake lock 854 * @wow_auth_req_wl: wow wake lock for auth req 855 * @wow_assoc_req_wl: wow wake lock for assoc req 856 * @wow_deauth_rec_wl: wow wake lock for deauth req 857 * @wow_disassoc_rec_wl: wow wake lock for disassoc req 858 * @wow_ap_assoc_lost_wl: wow wake lock for assoc lost req 859 * @wow_auto_shutdown_wl: wow wake lock for shutdown req 860 * @roam_ho_wl: wake lock for roam handoff req 861 * @wow_nack: wow negative ack flag 862 * @is_wow_bus_suspended: is wow bus suspended flag 863 * @IsRArateLimitEnabled: RA rate limiti s enabled or not 864 * @RArateLimitInterval: RA rate limit interval 865 * @is_lpass_enabled: Flag to indicate if LPASS feature is enabled or not 866 * @staMaxLIModDtim: station max listen interval 867 * @sta_max_li_mod_dtim_ms: station max listen interval in ms 868 * @staModDtim: station mode DTIM 869 * @staDynamicDtim: station dynamic DTIM 870 * @hw_bd_id: hardware board id 871 * @hw_bd_info: hardware board info 872 * @miracast_value: miracast value 873 * @log_completion_timer: log completion timer 874 * @old_hw_mode_index: Previous configured HW mode index 875 * @new_hw_mode_index: Current configured HW mode index 876 * @ocb_config_req: OCB request context 877 * @self_gen_frm_pwr: Self-generated frame power 878 * @tx_chain_mask_cck: Is the CCK tx chain mask enabled 879 * @service_ready_ext_timer: Timer for service ready extended. Note 880 * this is a a timer instead of wait event because on receiving the 881 * service ready event, we will be waiting on the MC thread for the 882 * service extended ready event which is also processed in MC 883 * thread. This leads to MC thread being stuck. Alternative was to 884 * process these events in tasklet/workqueue context. But, this 885 * leads to race conditions when the events are processed in two 886 * different context. So, processing ready event and extended ready 887 * event in the serialized MC thread context with a timer. 888 * @csr_roam_synch_cb: CSR callback for firmware Roam Sync events 889 * @pe_roam_synch_cb: pe callback for firmware Roam Sync events 890 * @csr_roam_auth_event_handle_cb: CSR callback for target authentication 891 * offload event. 892 * @pe_roam_set_ie_cb: PE callback to set IEs to firmware. 893 * @wmi_cmd_rsp_wake_lock: wmi command response wake lock 894 * @wmi_cmd_rsp_runtime_lock: wmi command response bus lock 895 * @active_uc_apf_mode: Setting that determines how APF is applied in 896 * active mode for uc packets 897 * @active_mc_bc_apf_mode: Setting that determines how APF is applied in 898 * active mode for MC/BC packets 899 * @ini_config: Initial configuration from upper layer 900 * @saved_chan: saved channel list sent as part of 901 * WMI_SCAN_CHAN_LIST_CMDID 902 * @nan_datapath_enabled: Is NAN datapath support enabled in firmware? 903 * @fw_timeout_crash: Should firmware be reset upon response timeout? 904 * @sub_20_support: Does target support sub-20MHz bandwidth (aka 905 * half-rate and quarter-rate)? 906 * @is_dfs_offloaded: Is dfs and cac timer offloaded? 907 * @wma_mgmt_tx_packetdump_cb: Callback function for TX packet dump 908 * @wma_mgmt_rx_packetdump_cb: Callback function for RX packet dump 909 * @rcpi_enabled: Is RCPI enabled? 910 * @link_stats_results: Structure for handing link stats from firmware 911 * @tx_fail_cnt: Number of TX failures 912 * @wlm_data: Data required for WLM req and resp handling 913 * @he_cap: 802.11ax capabilities 914 * @bandcapability: band capability configured through ini 915 * @tx_bfee_8ss_enabled: Is Tx Beamformee support for 8x8 enabled? 916 * @in_imps: Is device in Idle Mode Power Save? 917 * @dynamic_nss_chains_update: per vdev nss, chains update 918 * @ito_repeat_count: Indicates ito repeated count 919 * @wma_fw_time_sync_timer: timer used for firmware time sync 920 * * @fw_therm_throt_support: FW Supports thermal throttling? 921 * @eht_cap: 802.11be capabilities 922 * @set_hw_mode_resp_status: Set HW mode response status 923 * @pagefault_wakeups_ts: Stores timestamps at which host wakes up by fw 924 * because of pagefaults 925 * @num_page_fault_wakeups: Stores the number of times host wakes up by fw 926 * because of pagefaults 927 * 928 * This structure is the global wma context. It contains global wma 929 * module parameters and handles of other modules. 930 931 */ 932 typedef struct { 933 void *wmi_handle; 934 void *cds_context; 935 struct mac_context *mac_context; 936 struct wlan_objmgr_psoc *psoc; 937 struct wlan_objmgr_pdev *pdev; 938 qdf_event_t target_suspend; 939 qdf_event_t runtime_suspend; 940 qdf_event_t recovery_event; 941 uint16_t max_station; 942 uint16_t max_bssid; 943 uint8_t myaddr[QDF_MAC_ADDR_SIZE]; 944 uint8_t hwaddr[QDF_MAC_ADDR_SIZE]; 945 #ifdef WLAN_FEATURE_LPSS 946 uint8_t lpss_support; 947 #endif 948 uint8_t ap_arpns_support; 949 bool wmi_ready; 950 uint32_t wlan_init_status; 951 qdf_device_t qdf_dev; 952 uint32_t wmi_service_bitmap[WMI_SERVICE_BM_SIZE]; 953 uint32_t wmi_service_ext_bitmap[WMI_SERVICE_SEGMENT_BM_SIZE32]; 954 wma_tx_dwnld_comp_callback tx_frm_download_comp_cb; 955 qdf_event_t tx_frm_download_comp_event; 956 qdf_event_t tx_queue_empty_event; 957 wma_tx_ota_comp_callback umac_data_ota_ack_cb; 958 unsigned long last_umac_data_ota_timestamp; 959 qdf_nbuf_t last_umac_data_nbuf; 960 wma_tgt_cfg_cb tgt_cfg_update_cb; 961 HAL_REG_CAPABILITIES reg_cap; 962 uint32_t scan_id; 963 struct wma_txrx_node *interfaces; 964 pdev_cli_config_t pdevconfig; 965 qdf_list_t wma_hold_req_queue; 966 qdf_spinlock_t wma_hold_req_q_lock; 967 uint32_t vht_supp_mcs; 968 uint8_t is_fw_assert; 969 struct wma_tx_ack_work_ctx *ack_work_ctx; 970 void *pGetRssiReq; 971 bool get_one_peer_info; 972 struct qdf_mac_addr peer_macaddr; 973 t_thermal_mgmt thermal_mgmt_info; 974 bool enable_mc_list; 975 #ifdef FEATURE_WLAN_EXTSCAN 976 qdf_wake_lock_t extscan_wake_lock; 977 #endif 978 qdf_wake_lock_t wow_wake_lock; 979 qdf_wake_lock_t wow_auth_req_wl; 980 qdf_wake_lock_t wow_assoc_req_wl; 981 qdf_wake_lock_t wow_deauth_rec_wl; 982 qdf_wake_lock_t wow_disassoc_rec_wl; 983 qdf_wake_lock_t wow_ap_assoc_lost_wl; 984 qdf_wake_lock_t wow_auto_shutdown_wl; 985 qdf_wake_lock_t roam_ho_wl; 986 qdf_wake_lock_t roam_preauth_wl; 987 qdf_wake_lock_t probe_req_wps_wl; 988 int wow_nack; 989 qdf_atomic_t is_wow_bus_suspended; 990 #ifdef WLAN_FEATURE_LPSS 991 bool is_lpass_enabled; 992 #endif 993 uint8_t staMaxLIModDtim; 994 uint16_t sta_max_li_mod_dtim_ms; 995 uint8_t staModDtim; 996 uint8_t staDynamicDtim; 997 uint32_t hw_bd_id; 998 uint32_t hw_bd_info[HW_BD_INFO_SIZE]; 999 uint32_t miracast_value; 1000 qdf_mc_timer_t log_completion_timer; 1001 uint32_t old_hw_mode_index; 1002 uint32_t new_hw_mode_index; 1003 uint16_t self_gen_frm_pwr; 1004 bool tx_chain_mask_cck; 1005 qdf_mc_timer_t service_ready_ext_timer; 1006 1007 QDF_STATUS (*csr_roam_auth_event_handle_cb)(struct mac_context *mac, 1008 uint8_t vdev_id, 1009 struct qdf_mac_addr bssid, 1010 uint32_t akm); 1011 QDF_STATUS (*pe_roam_synch_cb)(struct mac_context *mac, 1012 uint8_t vdev_id, 1013 struct roam_offload_synch_ind *roam_synch_data, 1014 uint16_t ie_len, 1015 enum sir_roam_op_code reason); 1016 QDF_STATUS (*pe_disconnect_cb) (struct mac_context *mac, 1017 uint8_t vdev_id, 1018 uint8_t *deauth_disassoc_frame, 1019 uint16_t deauth_disassoc_frame_len, 1020 uint16_t reason_code); 1021 QDF_STATUS (*pe_roam_set_ie_cb)(struct mac_context *mac_ctx, 1022 uint8_t vdev_id, uint16_t dot11_mode, 1023 enum QDF_OPMODE device_mode); 1024 qdf_wake_lock_t wmi_cmd_rsp_wake_lock; 1025 qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock; 1026 qdf_runtime_lock_t sap_prevent_runtime_pm_lock; 1027 qdf_runtime_lock_t ndp_prevent_runtime_pm_lock; 1028 enum active_apf_mode active_uc_apf_mode; 1029 enum active_apf_mode active_mc_bc_apf_mode; 1030 struct wma_ini_config ini_config; 1031 struct wma_valid_channels saved_chan; 1032 bool nan_datapath_enabled; 1033 bool fw_timeout_crash; 1034 bool sub_20_support; 1035 bool is_dfs_offloaded; 1036 ol_txrx_pktdump_cb wma_mgmt_tx_packetdump_cb; 1037 ol_txrx_pktdump_cb wma_mgmt_rx_packetdump_cb; 1038 bool rcpi_enabled; 1039 tSirLLStatsResults *link_stats_results; 1040 qdf_mutex_t radio_stats_lock; 1041 uint64_t tx_fail_cnt; 1042 #ifdef FEATURE_WLM_STATS 1043 struct wma_wlm_stats_data wlm_data; 1044 #endif 1045 #ifdef WLAN_FEATURE_11AX 1046 struct he_capability he_cap; 1047 #endif 1048 uint8_t bandcapability; 1049 bool tx_bfee_8ss_enabled; 1050 bool in_imps; 1051 bool dynamic_nss_chains_support; 1052 uint8_t ito_repeat_count; 1053 bool fw_therm_throt_support; 1054 bool enable_tx_compl_tsf64; 1055 #ifdef WLAN_FEATURE_11BE 1056 struct eht_capability eht_cap; 1057 #endif 1058 qdf_atomic_t sap_num_clients_connected; 1059 qdf_atomic_t go_num_clients_connected; 1060 qdf_wake_lock_t sap_d3_wow_wake_lock; 1061 qdf_wake_lock_t go_d3_wow_wake_lock; 1062 enum set_hw_mode_status set_hw_mode_resp_status; 1063 qdf_time_t *pagefault_wakeups_ts; 1064 uint8_t num_page_fault_wakeups; 1065 } t_wma_handle, *tp_wma_handle; 1066 1067 /** 1068 * wma_validate_handle() - Validate WMA handle 1069 * @wma_handle: wma handle 1070 * 1071 * This function will log on error and hence caller should not log on error 1072 * 1073 * Return: errno if WMA handle is NULL; 0 otherwise 1074 */ 1075 #define wma_validate_handle(wma_handle) \ 1076 __wma_validate_handle(wma_handle, __func__) 1077 int __wma_validate_handle(tp_wma_handle wma_handle, const char *func); 1078 1079 /** 1080 * wma_vdev_nss_chain_params_send() - send vdev nss chain params to fw. 1081 * @vdev_id: vdev_id 1082 * @user_cfg: pointer to the params structure 1083 * 1084 * This function sends nss chain params to the fw 1085 * 1086 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on error 1087 */ 1088 QDF_STATUS 1089 wma_vdev_nss_chain_params_send(uint8_t vdev_id, 1090 struct wlan_mlme_nss_chains *user_cfg); 1091 1092 /** 1093 * wma_send_regdomain_info_to_fw() - send regdomain info to fw 1094 * @reg_dmn: reg domain 1095 * @regdmn2G: 2G reg domain 1096 * @regdmn5G: 5G reg domain 1097 * @ctl2G: 2G test limit 1098 * @ctl5G: 5G test limit 1099 * 1100 * Return: none 1101 */ 1102 void wma_send_regdomain_info_to_fw(uint32_t reg_dmn, uint16_t regdmn2G, 1103 uint16_t regdmn5G, uint8_t ctl2G, 1104 uint8_t ctl5G); 1105 /** 1106 * enum frame_index - Frame index 1107 * @GENERIC_NODOWNLD_NOACK_COMP_INDEX: Frame index for no download comp no ack 1108 * @GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX: Frame index for download comp no ack 1109 * @GENERIC_DOWNLD_COMP_ACK_COMP_INDEX: Frame index for download comp and ack 1110 * @GENERIC_NODOWLOAD_ACK_COMP_INDEX: Frame index for no download comp and ack 1111 * @FRAME_INDEX_MAX: maximum frame index 1112 */ 1113 enum frame_index { 1114 GENERIC_NODOWNLD_NOACK_COMP_INDEX, 1115 GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX, 1116 GENERIC_DOWNLD_COMP_ACK_COMP_INDEX, 1117 GENERIC_NODOWLOAD_ACK_COMP_INDEX, 1118 FRAME_INDEX_MAX 1119 }; 1120 1121 /** 1122 * struct wma_tx_ack_work_ctx - tx ack work context 1123 * @wma_handle: wma handle 1124 * @sub_type: sub type 1125 * @status: status 1126 * @ack_cmp_work: work structure 1127 * @frame: frame nbuf 1128 */ 1129 struct wma_tx_ack_work_ctx { 1130 tp_wma_handle wma_handle; 1131 uint16_t sub_type; 1132 int32_t status; 1133 qdf_work_t ack_cmp_work; 1134 qdf_nbuf_t frame; 1135 }; 1136 1137 /** 1138 * struct wma_target_req - target request parameters 1139 * @event_timeout: event timeout 1140 * @node: list 1141 * @user_data: user data 1142 * @addr: Mac address 1143 * @msg_type: message type 1144 * @vdev_id: vdev id 1145 * @type: type 1146 */ 1147 struct wma_target_req { 1148 qdf_mc_timer_t event_timeout; 1149 qdf_list_node_t node; 1150 void *user_data; 1151 struct qdf_mac_addr addr; 1152 uint32_t msg_type; 1153 uint8_t vdev_id; 1154 uint8_t type; 1155 }; 1156 1157 /** 1158 * struct t_thermal_cmd_params - thermal command parameters 1159 * @minTemp: minimum temperature 1160 * @maxTemp: maximum temperature 1161 * @thermalEnable: thermal enable 1162 * @thermal_action: thermal action 1163 */ 1164 typedef struct { 1165 uint16_t minTemp; 1166 uint16_t maxTemp; 1167 uint8_t thermalEnable; 1168 enum thermal_mgmt_action_code thermal_action; 1169 } t_thermal_cmd_params, *tp_thermal_cmd_params; 1170 1171 /** 1172 * enum wma_cfg_cmd_id - wma cmd ids 1173 * @WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID: txrx firmware stats enable command 1174 * @WMA_VDEV_TXRX_FWSTATS_RESET_CMDID: txrx firmware stats reset command 1175 * @WMA_VDEV_MCC_SET_TIME_LATENCY: set MCC latency time 1176 * @WMA_VDEV_MCC_SET_TIME_QUOTA: set MCC time quota 1177 * @WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID: get IPA microcontroller fw stats 1178 * @WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID: get IPA uC wifi-sharing stats 1179 * @WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID: set IPA uC quota limit 1180 * 1181 * wma command ids for configuration request which 1182 * does not involve sending a wmi command. 1183 */ 1184 enum wma_cfg_cmd_id { 1185 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID = WMI_CMDID_MAX, 1186 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID, 1187 WMA_VDEV_MCC_SET_TIME_LATENCY, 1188 WMA_VDEV_MCC_SET_TIME_QUOTA, 1189 WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID, 1190 WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID, 1191 WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID, 1192 WMA_CMD_ID_MAX 1193 }; 1194 1195 /** 1196 * struct wma_trigger_uapsd_params - trigger uapsd parameters 1197 * @wmm_ac: wmm access category 1198 * @user_priority: user priority 1199 * @service_interval: service interval 1200 * @suspend_interval: suspend interval 1201 * @delay_interval: delay interval 1202 */ 1203 typedef struct wma_trigger_uapsd_params { 1204 uint32_t wmm_ac; 1205 uint32_t user_priority; 1206 uint32_t service_interval; 1207 uint32_t suspend_interval; 1208 uint32_t delay_interval; 1209 } t_wma_trigger_uapsd_params, *tp_wma_trigger_uapsd_params; 1210 1211 /** 1212 * enum uapsd_peer_param_max_sp - U-APSD maximum service period of peer station 1213 * @UAPSD_MAX_SP_LEN_UNLIMITED: unlimited max service period 1214 * @UAPSD_MAX_SP_LEN_2: max service period = 2 1215 * @UAPSD_MAX_SP_LEN_4: max service period = 4 1216 * @UAPSD_MAX_SP_LEN_6: max service period = 6 1217 */ 1218 enum uapsd_peer_param_max_sp { 1219 UAPSD_MAX_SP_LEN_UNLIMITED = 0, 1220 UAPSD_MAX_SP_LEN_2 = 2, 1221 UAPSD_MAX_SP_LEN_4 = 4, 1222 UAPSD_MAX_SP_LEN_6 = 6 1223 }; 1224 1225 /** 1226 * enum uapsd_peer_param_enabled_ac - U-APSD Enabled AC's of peer station 1227 * @UAPSD_VO_ENABLED: enable uapsd for voice 1228 * @UAPSD_VI_ENABLED: enable uapsd for video 1229 * @UAPSD_BK_ENABLED: enable uapsd for background 1230 * @UAPSD_BE_ENABLED: enable uapsd for best effort 1231 */ 1232 enum uapsd_peer_param_enabled_ac { 1233 UAPSD_VO_ENABLED = 0x01, 1234 UAPSD_VI_ENABLED = 0x02, 1235 UAPSD_BK_ENABLED = 0x04, 1236 UAPSD_BE_ENABLED = 0x08 1237 }; 1238 1239 /** 1240 * enum profile_id_t - Firmware profiling index 1241 * @PROF_CPU_IDLE: cpu idle profile 1242 * @PROF_PPDU_PROC: ppdu processing profile 1243 * @PROF_PPDU_POST: ppdu post profile 1244 * @PROF_HTT_TX_INPUT: htt tx input profile 1245 * @PROF_MSDU_ENQ: msdu enqueue profile 1246 * @PROF_PPDU_POST_HAL: ppdu post profile 1247 * @PROF_COMPUTE_TX_TIME: tx time profile 1248 * @PROF_MAX_ID: max profile index 1249 */ 1250 enum profile_id_t { 1251 PROF_CPU_IDLE, 1252 PROF_PPDU_PROC, 1253 PROF_PPDU_POST, 1254 PROF_HTT_TX_INPUT, 1255 PROF_MSDU_ENQ, 1256 PROF_PPDU_POST_HAL, 1257 PROF_COMPUTE_TX_TIME, 1258 PROF_MAX_ID, 1259 }; 1260 1261 /** 1262 * struct p2p_ie - P2P IE structural definition. 1263 * @p2p_id: p2p id 1264 * @p2p_len: p2p length 1265 * @p2p_oui: p2p OUI 1266 * @p2p_oui_type: p2p OUI type 1267 */ 1268 struct p2p_ie { 1269 uint8_t p2p_id; 1270 uint8_t p2p_len; 1271 uint8_t p2p_oui[3]; 1272 uint8_t p2p_oui_type; 1273 } __packed; 1274 1275 /** 1276 * struct p2p_noa_descriptor - noa descriptor 1277 * @type_count: 255: continuous schedule, 0: reserved 1278 * @duration: Absent period duration in micro seconds 1279 * @interval: Absent period interval in micro seconds 1280 * @start_time: 32 bit tsf time when in starts 1281 */ 1282 struct p2p_noa_descriptor { 1283 uint8_t type_count; 1284 uint32_t duration; 1285 uint32_t interval; 1286 uint32_t start_time; 1287 } __packed; 1288 1289 /** 1290 * struct p2p_sub_element_noa - p2p noa element 1291 * @p2p_sub_id: p2p sub id 1292 * @p2p_sub_len: p2p sub length 1293 * @index: identifies instance of NOA su element 1294 * @oppPS: oppPS state of the AP 1295 * @ctwindow: ctwindow in TUs 1296 * @num_descriptors: number of NOA descriptors 1297 * @noa_descriptors: noa descriptors 1298 */ 1299 struct p2p_sub_element_noa { 1300 uint8_t p2p_sub_id; 1301 uint8_t p2p_sub_len; 1302 uint8_t index; /* identifies instance of NOA su element */ 1303 uint8_t oppPS:1, /* oppPS state of the AP */ 1304 ctwindow:7; /* ctwindow in TUs */ 1305 uint8_t num_descriptors; /* number of NOA descriptors */ 1306 struct p2p_noa_descriptor noa_descriptors[WMA_MAX_NOA_DESCRIPTORS]; 1307 }; 1308 1309 /** 1310 * struct wma_decap_info_t - decapsulation info 1311 * @hdr: header 1312 * @hdr_len: header length 1313 */ 1314 struct wma_decap_info_t { 1315 uint8_t hdr[sizeof(struct ieee80211_qosframe_addr4)]; 1316 int32_t hdr_len; 1317 }; 1318 1319 /** 1320 * enum packet_power_save - packet power save params 1321 * @WMI_VDEV_PPS_PAID_MATCH: paid match param 1322 * @WMI_VDEV_PPS_GID_MATCH: gid match param 1323 * @WMI_VDEV_PPS_EARLY_TIM_CLEAR: early tim clear param 1324 * @WMI_VDEV_PPS_EARLY_DTIM_CLEAR: early dtim clear param 1325 * @WMI_VDEV_PPS_EOF_PAD_DELIM: eof pad delim param 1326 * @WMI_VDEV_PPS_MACADDR_MISMATCH: macaddr mismatch param 1327 * @WMI_VDEV_PPS_DELIM_CRC_FAIL: delim CRC fail param 1328 * @WMI_VDEV_PPS_GID_NSTS_ZERO: gid nsts zero param 1329 * @WMI_VDEV_PPS_RSSI_CHECK: RSSI check param 1330 * @WMI_VDEV_PPS_5G_EBT: 5G ebt param 1331 */ 1332 typedef enum { 1333 WMI_VDEV_PPS_PAID_MATCH = 0, 1334 WMI_VDEV_PPS_GID_MATCH = 1, 1335 WMI_VDEV_PPS_EARLY_TIM_CLEAR = 2, 1336 WMI_VDEV_PPS_EARLY_DTIM_CLEAR = 3, 1337 WMI_VDEV_PPS_EOF_PAD_DELIM = 4, 1338 WMI_VDEV_PPS_MACADDR_MISMATCH = 5, 1339 WMI_VDEV_PPS_DELIM_CRC_FAIL = 6, 1340 WMI_VDEV_PPS_GID_NSTS_ZERO = 7, 1341 WMI_VDEV_PPS_RSSI_CHECK = 8, 1342 WMI_VDEV_VHT_SET_GID_MGMT = 9, 1343 WMI_VDEV_PPS_5G_EBT = 10 1344 } packet_power_save; 1345 1346 /** 1347 * enum green_tx_param - green tx parameters 1348 * @wmi_vdev_param_gtx_ht_mcs: ht mcs param 1349 * @wmi_vdev_param_gtx_vht_mcs: vht mcs param 1350 * @wmi_vdev_param_gtx_usr_cfg: user cfg param 1351 * @wmi_vdev_param_gtx_thre: thre param 1352 * @wmi_vdev_param_gtx_margin: green tx margin param 1353 * @wmi_vdev_param_gtx_step: green tx step param 1354 * @wmi_vdev_param_gtx_mintpc: mintpc param 1355 * @wmi_vdev_param_gtx_bw_mask: bandwidth mask 1356 */ 1357 typedef enum { 1358 wmi_vdev_param_gtx_ht_mcs, 1359 wmi_vdev_param_gtx_vht_mcs, 1360 wmi_vdev_param_gtx_usr_cfg, 1361 wmi_vdev_param_gtx_thre, 1362 wmi_vdev_param_gtx_margin, 1363 wmi_vdev_param_gtx_step, 1364 wmi_vdev_param_gtx_mintpc, 1365 wmi_vdev_param_gtx_bw_mask, 1366 } green_tx_param; 1367 1368 /** 1369 * enum uapsd_ac - U-APSD Access Categories 1370 * @UAPSD_BE: best effort 1371 * @UAPSD_BK: back ground 1372 * @UAPSD_VI: video 1373 * @UAPSD_VO: voice 1374 */ 1375 enum uapsd_ac { 1376 UAPSD_BE, 1377 UAPSD_BK, 1378 UAPSD_VI, 1379 UAPSD_VO 1380 }; 1381 1382 /** 1383 * wma_disable_uapsd_per_ac() - disable uapsd per ac 1384 * @wmi_handle: wma handle 1385 * @vdev_id: vdev id 1386 * @ac: access category 1387 * 1388 * Return: QDF_STATUS_SUCCESS for success or error code. 1389 */ 1390 QDF_STATUS wma_disable_uapsd_per_ac(tp_wma_handle wma_handle, 1391 uint32_t vdev_id, enum uapsd_ac ac); 1392 1393 /** 1394 * enum uapsd_up - U-APSD User Priorities 1395 * @UAPSD_UP_BE: best effort 1396 * @UAPSD_UP_BK: back ground 1397 * @UAPSD_UP_RESV: reserve 1398 * @UAPSD_UP_EE: Excellent Effort 1399 * @UAPSD_UP_CL: Critical Applications 1400 * @UAPSD_UP_VI: video 1401 * @UAPSD_UP_VO: voice 1402 * @UAPSD_UP_NC: Network Control 1403 */ 1404 enum uapsd_up { 1405 UAPSD_UP_BE, 1406 UAPSD_UP_BK, 1407 UAPSD_UP_RESV, 1408 UAPSD_UP_EE, 1409 UAPSD_UP_CL, 1410 UAPSD_UP_VI, 1411 UAPSD_UP_VO, 1412 UAPSD_UP_NC, 1413 UAPSD_UP_MAX 1414 }; 1415 1416 /** 1417 * wma_trigger_uapsd_params() - set trigger uapsd parameter 1418 * @wmi_handle: wma handle 1419 * @vdev_id: vdev id 1420 * @trigger_uapsd_params: trigger uapsd parameters 1421 * 1422 * This function sets the trigger uapsd 1423 * params such as service interval, delay 1424 * interval and suspend interval which 1425 * will be used by the firmware to send 1426 * trigger frames periodically when there 1427 * is no traffic on the transmit side. 1428 * 1429 * Return: QDF_STATUS_SUCCESS for success or error code. 1430 */ 1431 QDF_STATUS wma_trigger_uapsd_params(tp_wma_handle wma_handle, uint32_t vdev_id, 1432 tp_wma_trigger_uapsd_params 1433 trigger_uapsd_params); 1434 1435 void wma_send_flush_logs_to_fw(tp_wma_handle wma_handle); 1436 void wma_log_completion_timeout(void *data); 1437 1438 #ifdef FEATURE_RSSI_MONITOR 1439 /** 1440 * wma_set_rssi_monitoring() - set rssi monitoring 1441 * @handle: WMA handle 1442 * @req: rssi monitoring request structure 1443 * 1444 * This function takes the incoming @req and sends it down to the 1445 * firmware 1446 * 1447 * Return: QDF_STATUS 1448 */ 1449 QDF_STATUS wma_set_rssi_monitoring(tp_wma_handle wma, 1450 struct rssi_monitor_param *req); 1451 #else /* FEATURE_RSSI_MONITOR */ 1452 static inline 1453 QDF_STATUS wma_set_rssi_monitoring(tp_wma_handle wma, 1454 struct rssi_monitor_param *req) 1455 { 1456 return QDF_STATUS_SUCCESS; 1457 } 1458 #endif /* FEATURE_RSSI_MONITOR */ 1459 1460 /** 1461 * wma_map_pcl_weights - Map WMA pcl weights to wmi pcl weights 1462 * @pcl_weight: Input PCL weight to be converted to wmi format 1463 * 1464 * Return: wmi_pcl_chan_weight 1465 */ 1466 wmi_pcl_chan_weight wma_map_pcl_weights(uint32_t pcl_weight); 1467 1468 QDF_STATUS wma_send_set_pcl_cmd(tp_wma_handle wma_handle, 1469 struct set_pcl_req *msg); 1470 1471 QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle, 1472 struct policy_mgr_hw_mode *msg); 1473 1474 QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle, 1475 struct policy_mgr_dual_mac_config *msg); 1476 QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle, 1477 struct sir_antenna_mode_param *msg); 1478 1479 struct wma_target_req *wma_fill_hold_req(tp_wma_handle wma, 1480 uint8_t vdev_id, uint32_t msg_type, 1481 uint8_t type, void *params, 1482 uint32_t timeout); 1483 1484 int wma_mgmt_tx_completion_handler(void *handle, uint8_t *cmpl_event_params, 1485 uint32_t len); 1486 int wma_mgmt_tx_bundle_completion_handler(void *handle, 1487 uint8_t *cmpl_event_params, uint32_t len); 1488 uint32_t wma_get_vht_ch_width(void); 1489 1490 #ifdef WLAN_FEATURE_11BE 1491 /** 1492 * wma_get_orig_eht_ch_width() - Get original EHT channel width supported 1493 * 1494 * API to get original EHT channel width 1495 * 1496 * Return: void 1497 */ 1498 uint32_t wma_get_orig_eht_ch_width(void); 1499 1500 /** 1501 * wma_get_orig_eht_ch_width() - Get current EHT channel width supported 1502 * 1503 * API to get current EHT channel width 1504 * 1505 * Return: void 1506 */ 1507 uint32_t wma_get_eht_ch_width(void); 1508 #else 1509 static inline uint32_t wma_get_orig_eht_ch_width(void) 1510 { 1511 return 0; 1512 } 1513 1514 static inline uint32_t wma_get_eht_ch_width(void) 1515 { 1516 return 0; 1517 } 1518 #endif 1519 1520 QDF_STATUS 1521 wma_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param, 1522 A_UINT32 val, A_UINT32 *module_id_bitmap, 1523 A_UINT32 bitmap_len); 1524 1525 #ifdef FEATURE_LFR_SUBNET_DETECTION 1526 /** 1527 * wma_set_gateway_params() - set gateway parameters 1528 * @wma: WMA handle 1529 * @req: gateway update request parameter structure 1530 * 1531 * This function takes the incoming @req and sends it down to the 1532 * firmware 1533 * 1534 * Return: QDF_STATUS 1535 */ 1536 QDF_STATUS wma_set_gateway_params(tp_wma_handle wma, 1537 struct gateway_update_req_param *req); 1538 #else 1539 static inline 1540 QDF_STATUS wma_set_gateway_params(tp_wma_handle wma, 1541 struct gateway_update_req_param *req) 1542 { 1543 return QDF_STATUS_SUCCESS; 1544 } 1545 #endif /* FEATURE_LFR_SUBNET_DETECTION */ 1546 1547 QDF_STATUS wma_ht40_stop_obss_scan(tp_wma_handle wma_handle, 1548 int32_t vdev_id); 1549 1550 QDF_STATUS wma_process_fw_test_cmd(WMA_HANDLE handle, 1551 struct set_fwtest_params *wma_fwtest); 1552 1553 QDF_STATUS wma_send_ht40_obss_scanind(tp_wma_handle wma, 1554 struct obss_ht40_scanind *req); 1555 1556 uint32_t wma_get_num_of_setbits_from_bitmask(uint32_t mask); 1557 1558 #ifdef FEATURE_WLAN_APF 1559 /** 1560 * wma_get_apf_caps_event_handler() - Event handler for get apf capability 1561 * @handle: WMA global handle 1562 * @cmd_param_info: command event data 1563 * @len: Length of @cmd_param_info 1564 * 1565 * Return: 0 on Success or Errno on failure 1566 */ 1567 int wma_get_apf_caps_event_handler(void *handle, 1568 u_int8_t *cmd_param_info, 1569 u_int32_t len); 1570 1571 /** 1572 * wma_get_apf_capabilities - Send get apf capability to firmware 1573 * @wma_handle: wma handle 1574 * 1575 * Return: QDF_STATUS enumeration. 1576 */ 1577 QDF_STATUS wma_get_apf_capabilities(tp_wma_handle wma); 1578 1579 /** 1580 * wma_set_apf_instructions - Set apf instructions to firmware 1581 * @wma: wma handle 1582 * @apf_set_offload: APF offload information to set to firmware 1583 * 1584 * Return: QDF_STATUS enumeration 1585 */ 1586 QDF_STATUS 1587 wma_set_apf_instructions(tp_wma_handle wma, 1588 struct sir_apf_set_offload *apf_set_offload); 1589 1590 /** 1591 * wma_send_apf_enable_cmd - Send apf enable/disable cmd 1592 * @wma_handle: wma handle 1593 * @vdev_id: vdev id 1594 * @apf_enable: true: Enable APF Int., false: Disable APF Int. 1595 * 1596 * Return: QDF_STATUS enumeration. 1597 */ 1598 QDF_STATUS wma_send_apf_enable_cmd(WMA_HANDLE handle, uint8_t vdev_id, 1599 bool apf_enable); 1600 1601 /** 1602 * wma_send_apf_write_work_memory_cmd - Command to write into the apf work 1603 * memory 1604 * @wma_handle: wma handle 1605 * @write_params: APF parameters for the write operation 1606 * 1607 * Return: QDF_STATUS enumeration. 1608 */ 1609 QDF_STATUS 1610 wma_send_apf_write_work_memory_cmd(WMA_HANDLE handle, 1611 struct wmi_apf_write_memory_params 1612 *write_params); 1613 1614 /** 1615 * wma_send_apf_read_work_memory_cmd - Command to get part of apf work memory 1616 * @wma_handle: wma handle 1617 * @callback: HDD callback to receive apf get mem event 1618 * @context: Context for the HDD callback 1619 * @read_params: APF parameters for the get operation 1620 * 1621 * Return: QDF_STATUS enumeration. 1622 */ 1623 QDF_STATUS 1624 wma_send_apf_read_work_memory_cmd(WMA_HANDLE handle, 1625 struct wmi_apf_read_memory_params 1626 *read_params); 1627 1628 /** 1629 * wma_apf_read_work_memory_event_handler - Event handler for get apf mem 1630 * operation 1631 * @handle: wma handle 1632 * @evt_buf: Buffer pointer to the event 1633 * @len: Length of the event buffer 1634 * 1635 * Return: status. 1636 */ 1637 int wma_apf_read_work_memory_event_handler(void *handle, uint8_t *evt_buf, 1638 uint32_t len); 1639 #else /* FEATURE_WLAN_APF */ 1640 static inline QDF_STATUS wma_get_apf_capabilities(tp_wma_handle wma) 1641 { 1642 return QDF_STATUS_SUCCESS; 1643 } 1644 1645 static inline QDF_STATUS 1646 wma_set_apf_instructions(tp_wma_handle wma, 1647 struct sir_apf_set_offload *apf_set_offload) 1648 { 1649 return QDF_STATUS_SUCCESS; 1650 } 1651 #endif /* FEATURE_WLAN_APF */ 1652 1653 void wma_process_set_pdev_ie_req(tp_wma_handle wma, 1654 struct set_ie_param *ie_params); 1655 void wma_process_set_pdev_ht_ie_req(tp_wma_handle wma, 1656 struct set_ie_param *ie_params); 1657 void wma_process_set_pdev_vht_ie_req(tp_wma_handle wma, 1658 struct set_ie_param *ie_params); 1659 1660 QDF_STATUS wma_remove_peer(tp_wma_handle wma, uint8_t *mac_addr, 1661 uint8_t vdev_id, bool no_fw_peer_delete); 1662 1663 /** 1664 * wma_create_peer() - Call wma_add_peer() to send peer create command to fw 1665 * and setup cdp peer 1666 * @wma: wma handle 1667 * @peer_addr: peer mac address 1668 * @peer_type: peer type 1669 * @vdev_id: vdev id 1670 * @peer_mld_addr: peer mld address 1671 * @is_assoc_peer: is assoc peer or not 1672 * 1673 * Return: QDF_STATUS 1674 */ 1675 QDF_STATUS wma_create_peer(tp_wma_handle wma, 1676 uint8_t peer_addr[QDF_MAC_ADDR_SIZE], 1677 u_int32_t peer_type, u_int8_t vdev_id, 1678 uint8_t peer_mld_addr[QDF_MAC_ADDR_SIZE], 1679 bool is_assoc_peer); 1680 1681 /** 1682 * wma_create_objmgr_peer() - create objmgr peer information in host driver 1683 * @wma: wma handle 1684 * @vdev_id: vdev id 1685 * @peer_addr: peer mac address 1686 * @wma_peer_type: peer type of enum wmi_peer_type 1687 * @peer_mld: peer mld address 1688 * 1689 * Return: Pointer to objmgr_peer 1690 */ 1691 struct wlan_objmgr_peer *wma_create_objmgr_peer(tp_wma_handle wma, 1692 uint8_t vdev_id, 1693 uint8_t *peer_addr, 1694 uint32_t wma_peer_type, 1695 uint8_t *peer_mld); 1696 1697 /** 1698 * wma_remove_objmgr_peer() - Remove Object manager peer 1699 * @wma: WMA handle 1700 * @obj_vdev: Vdev object pointer 1701 * @peer_addr: Peer mac address 1702 * 1703 * Return: None 1704 */ 1705 void wma_remove_objmgr_peer(tp_wma_handle wma, 1706 struct wlan_objmgr_vdev *obj_vdev, 1707 uint8_t *peer_addr); 1708 1709 QDF_STATUS wma_peer_unmap_conf_cb(uint8_t vdev_id, 1710 uint32_t peer_id_cnt, 1711 uint16_t *peer_id_list); 1712 1713 bool wma_objmgr_peer_exist(tp_wma_handle wma, 1714 uint8_t *peer_addr, uint8_t *peer_vdev_id); 1715 1716 /** 1717 * wma_get_cca_stats() - send request to fw to get CCA 1718 * @wmi_hdl: wma handle 1719 * @vdev_id: vdev id 1720 * 1721 * Return: QDF status 1722 */ 1723 QDF_STATUS wma_get_cca_stats(tp_wma_handle wma_handle, 1724 uint8_t vdev_id); 1725 1726 struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle); 1727 1728 /** 1729 * wma_chan_phy__mode() - get host phymode for channel 1730 * @freq: channel freq 1731 * @chan_width: maximum channel width possible 1732 * @dot11_mode: maximum phy_mode possible 1733 * 1734 * Return: return host phymode 1735 */ 1736 enum wlan_phymode wma_chan_phy_mode(uint32_t freq, enum phy_ch_width chan_width, 1737 uint8_t dot11_mode); 1738 1739 /** 1740 * wma_fw_to_host_phymode() - convert fw to host phymode 1741 * @phymode: phymode to convert 1742 * 1743 * Return: one of the values defined in enum wlan_phymode; 1744 * or WLAN_PHYMODE_AUTO if the conversion fails 1745 */ 1746 enum wlan_phymode wma_fw_to_host_phymode(WMI_HOST_WLAN_PHY_MODE phymode); 1747 1748 1749 #ifdef FEATURE_OEM_DATA_SUPPORT 1750 /** 1751 * wma_start_oem_req_cmd() - send oem request command to fw 1752 * @wma_handle: wma handle 1753 * @oem_data_req: the pointer of oem req buf 1754 * 1755 * Return: QDF status 1756 */ 1757 QDF_STATUS wma_start_oem_req_cmd(tp_wma_handle wma_handle, 1758 struct oem_data_req *oem_data_req); 1759 #endif 1760 1761 #ifdef FEATURE_OEM_DATA 1762 /** 1763 * wma_start_oem_data_cmd() - send oem data command to fw 1764 * @wma_handle: wma handle 1765 * @oem_data: the pointer of oem data buf 1766 * 1767 * Return: QDF status 1768 */ 1769 QDF_STATUS wma_start_oem_data_cmd(tp_wma_handle wma_handle, 1770 struct oem_data *oem_data); 1771 #endif 1772 1773 QDF_STATUS wma_enable_disable_caevent_ind(tp_wma_handle wma_handle, 1774 uint8_t val); 1775 void wma_register_packetdump_callback( 1776 ol_txrx_pktdump_cb wma_mgmt_tx_packetdump_cb, 1777 ol_txrx_pktdump_cb wma_mgmt_rx_packetdump_cb); 1778 void wma_deregister_packetdump_callback(void); 1779 void wma_update_sta_inactivity_timeout(tp_wma_handle wma, 1780 struct sme_sta_inactivity_timeout *sta_inactivity_timer); 1781 1782 /** 1783 * wma_form_rx_packet() - form rx cds packet 1784 * @buf: buffer 1785 * @mgmt_rx_params: mgmt rx params 1786 * @rx_pkt: cds packet 1787 * 1788 * This functions forms a cds packet from the rx mgmt frame received. 1789 * 1790 * Return: 0 for success or error code 1791 */ 1792 int wma_form_rx_packet(qdf_nbuf_t buf, 1793 struct mgmt_rx_event_params *mgmt_rx_params, 1794 cds_pkt_t *rx_pkt); 1795 1796 /** 1797 * wma_mgmt_unified_cmd_send() - send the mgmt tx packet 1798 * @vdev: objmgr vdev 1799 * @buf: buffer 1800 * @desc_id: desc id 1801 * @mgmt_tx_params: mgmt rx params 1802 * 1803 * This functions sends mgmt tx packet to WMI layer. 1804 * 1805 * Return: 0 for success or error code 1806 */ 1807 QDF_STATUS wma_mgmt_unified_cmd_send(struct wlan_objmgr_vdev *vdev, 1808 qdf_nbuf_t buf, uint32_t desc_id, 1809 void *mgmt_tx_params); 1810 1811 #ifndef CONFIG_HL_SUPPORT 1812 /** 1813 * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts 1814 * @pdev: objmgr pdev 1815 * @buf: buffer 1816 * 1817 * This function does the dma unmap of the pending mgmt packet cleanup 1818 * 1819 * Return: None 1820 */ 1821 void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev, 1822 qdf_nbuf_t buf); 1823 /** 1824 * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts 1825 * @pdev: objmgr pdev 1826 * @buf: buffer 1827 * 1828 * This is a cb function drains all mgmt packets of a vdev. 1829 * This is called in event of target going down without sending completions. 1830 * 1831 * Return: QDF_STATUS 1832 */ 1833 QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer, 1834 qdf_nbuf_t buf); 1835 #else 1836 static inline void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev, 1837 qdf_nbuf_t buf) 1838 {} 1839 static inline QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer, 1840 qdf_nbuf_t buf) 1841 { 1842 return QDF_STATUS_SUCCESS; 1843 } 1844 #endif 1845 1846 /** 1847 * wma_chan_info_event_handler() - chan info event handler 1848 * @handle: wma handle 1849 * @event_buf: event handler data 1850 * @len: length of @event_buf 1851 * 1852 * this function will handle the WMI_CHAN_INFO_EVENTID 1853 * 1854 * Return: int 1855 */ 1856 int wma_chan_info_event_handler(void *handle, uint8_t *event_buf, 1857 uint32_t len); 1858 1859 /** 1860 * wma_update_vdev_pause_bitmap() - update vdev pause bitmap 1861 * @vdev_id: the Id of the vdev to configure 1862 * @value: value pause bitmap value 1863 * 1864 * Return: None 1865 */ 1866 static inline 1867 void wma_vdev_update_pause_bitmap(uint8_t vdev_id, uint16_t value) 1868 { 1869 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1870 struct wma_txrx_node *iface; 1871 1872 if (!wma) 1873 return; 1874 1875 if (vdev_id >= wma->max_bssid) { 1876 wma_err("Invalid vdev_id: %d", vdev_id); 1877 return; 1878 } 1879 1880 iface = &wma->interfaces[vdev_id]; 1881 1882 if (!iface) { 1883 wma_err("Interface is NULL"); 1884 return; 1885 } 1886 1887 iface->pause_bitmap = value; 1888 } 1889 1890 /** 1891 * wma_vdev_get_pause_bitmap() - Get vdev pause bitmap 1892 * @vdev_id: the Id of the vdev to configure 1893 * 1894 * Return: Vdev pause bitmap value else 0 on error 1895 */ 1896 static inline 1897 uint16_t wma_vdev_get_pause_bitmap(uint8_t vdev_id) 1898 { 1899 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1900 struct wma_txrx_node *iface; 1901 1902 if (!wma) 1903 return 0; 1904 1905 iface = &wma->interfaces[vdev_id]; 1906 1907 if (!iface) { 1908 wma_err("Interface is NULL"); 1909 return 0; 1910 } 1911 1912 return iface->pause_bitmap; 1913 } 1914 1915 /** 1916 * wma_vdev_is_device_in_low_pwr_mode - is device in power save mode 1917 * @vdev_id: the Id of the vdev to configure 1918 * 1919 * Return: true if device is in low power mode else false 1920 */ 1921 static inline bool wma_vdev_is_device_in_low_pwr_mode(uint8_t vdev_id) 1922 { 1923 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1924 struct wma_txrx_node *iface; 1925 1926 if (!wma) 1927 return 0; 1928 1929 iface = &wma->interfaces[vdev_id]; 1930 1931 if (!iface) { 1932 wma_err("Interface is NULL"); 1933 return 0; 1934 } 1935 1936 return iface->in_bmps || wma->in_imps; 1937 } 1938 1939 /** 1940 * wma_vdev_get_dtim_period - Get dtim period value from mlme 1941 * @vdev_id: vdev index number 1942 * @value: pointer to the value to fill out 1943 * 1944 * Note caller must verify return status before using value 1945 * 1946 * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else 1947 * QDF_STATUS_E_FAILURE 1948 */ 1949 static inline 1950 QDF_STATUS wma_vdev_get_dtim_period(uint8_t vdev_id, uint8_t *value) 1951 { 1952 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1953 struct wma_txrx_node *iface; 1954 /* set value to zero */ 1955 *value = 0; 1956 1957 if (!wma) 1958 return QDF_STATUS_E_FAILURE; 1959 1960 iface = &wma->interfaces[vdev_id]; 1961 1962 if (!iface) 1963 return QDF_STATUS_E_FAILURE; 1964 1965 *value = iface->dtimPeriod; 1966 return QDF_STATUS_SUCCESS; 1967 } 1968 1969 /** 1970 * wma_vdev_get_beacon_interval - Get beacon interval from mlme 1971 * @vdev_id: vdev index number 1972 * @value: pointer to the value to fill out 1973 * 1974 * Note caller must verify return status before using value 1975 * 1976 * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else 1977 * QDF_STATUS_E_FAILURE 1978 */ 1979 static inline 1980 QDF_STATUS wma_vdev_get_beacon_interval(uint8_t vdev_id, uint16_t *value) 1981 { 1982 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1983 struct wma_txrx_node *iface; 1984 /* set value to zero */ 1985 *value = 0; 1986 1987 if (!wma) 1988 return QDF_STATUS_E_FAILURE; 1989 1990 iface = &wma->interfaces[vdev_id]; 1991 1992 if (!iface) 1993 return QDF_STATUS_E_FAILURE; 1994 1995 *value = iface->beaconInterval; 1996 return QDF_STATUS_SUCCESS; 1997 } 1998 1999 /** 2000 * wma_get_vdev_rate_flag - Get beacon rate flag from mlme 2001 * @vdev_id: vdev index number 2002 * @rate_flag: pointer to the value to fill out 2003 * 2004 * Note caller must verify return status before using value 2005 * 2006 * Return: QDF_STATUS_SUCCESS when fetched a valid value from mlme else 2007 * QDF_STATUS_E_FAILURE 2008 */ 2009 static inline QDF_STATUS 2010 wma_get_vdev_rate_flag(struct wlan_objmgr_vdev *vdev, uint32_t *rate_flag) 2011 { 2012 struct vdev_mlme_obj *mlme_obj; 2013 2014 if (!vdev) { 2015 wma_err("vdev is NULL"); 2016 return QDF_STATUS_E_FAILURE; 2017 } 2018 2019 mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev); 2020 if (!mlme_obj) { 2021 wma_err("ailed to get mlme_obj"); 2022 return QDF_STATUS_E_FAILURE; 2023 } 2024 2025 *rate_flag = mlme_obj->mgmt.rate_info.rate_flags; 2026 return QDF_STATUS_SUCCESS; 2027 } 2028 2029 /** 2030 * wma_vdev_set_pause_bit() - Set a bit in vdev pause bitmap 2031 * @vdev_id: the Id of the vdev to configure 2032 * @bit_pos: set bit position in pause bitmap 2033 * 2034 * Return: None 2035 */ 2036 static inline 2037 void wma_vdev_set_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos) 2038 { 2039 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 2040 struct wma_txrx_node *iface; 2041 2042 if (!wma) 2043 return; 2044 2045 iface = &wma->interfaces[vdev_id]; 2046 2047 if (!iface) { 2048 wma_err("Interface is NULL"); 2049 return; 2050 } 2051 2052 iface->pause_bitmap |= (1 << bit_pos); 2053 } 2054 2055 /** 2056 * wma_vdev_clear_pause_bit() - Clear a bit from vdev pause bitmap 2057 * @vdev_id: the Id of the vdev to configure 2058 * @bit_pos: set bit position in pause bitmap 2059 * 2060 * Return: None 2061 */ 2062 static inline 2063 void wma_vdev_clear_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos) 2064 { 2065 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 2066 struct wma_txrx_node *iface; 2067 2068 if (!wma) 2069 return; 2070 2071 iface = &wma->interfaces[vdev_id]; 2072 2073 if (!iface) { 2074 wma_err("Interface is NULL"); 2075 return; 2076 } 2077 2078 iface->pause_bitmap &= ~(1 << bit_pos); 2079 } 2080 2081 #ifdef WLAN_FEATURE_ROAM_OFFLOAD 2082 /** 2083 * wma_send_roam_preauth_status() - Send the preauth status to wmi 2084 * @handle: WMA handle 2085 * @roam_req: Pointer to wmi_roam_auth_status_params from sae 2086 * 2087 * Return: None 2088 */ 2089 void 2090 wma_send_roam_preauth_status(tp_wma_handle wma_handle, 2091 struct wmi_roam_auth_status_params *params); 2092 /** 2093 * wma_handle_roam_sync_timeout() - Update roaming status at wma layer 2094 * @wma_handle: wma handle 2095 * @info: Info for roaming start timer 2096 * 2097 * This function gets called in case of roaming offload timer get expired 2098 * 2099 * Return: None 2100 */ 2101 void wma_handle_roam_sync_timeout(tp_wma_handle wma_handle, 2102 struct roam_sync_timeout_timer_info *info); 2103 #else 2104 static inline void 2105 wma_send_roam_preauth_status(tp_wma_handle wma_handle, 2106 struct wmi_roam_auth_status_params *params) 2107 {} 2108 2109 static inline void 2110 wma_handle_roam_sync_timeout(tp_wma_handle wma_handle, 2111 struct roam_sync_timeout_timer_info *info) 2112 {} 2113 #endif 2114 2115 #ifdef WMI_INTERFACE_EVENT_LOGGING 2116 static inline void wma_print_wmi_cmd_log(uint32_t count, 2117 qdf_abstract_print *print, 2118 void *print_priv) 2119 { 2120 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2121 2122 if (wma) { 2123 print(print_priv, "Command Log (count %u)", count); 2124 wmi_print_cmd_log(wma->wmi_handle, count, print, print_priv); 2125 } 2126 } 2127 2128 static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count, 2129 qdf_abstract_print *print, 2130 void *print_priv) 2131 { 2132 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2133 2134 if (wma) { 2135 print(print_priv, "Command Tx Complete Log (count %u)", count); 2136 wmi_print_cmd_tx_cmp_log(wma->wmi_handle, count, print, 2137 print_priv); 2138 } 2139 } 2140 2141 static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count, 2142 qdf_abstract_print *print, 2143 void *print_priv) 2144 { 2145 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2146 2147 if (wma) { 2148 print(print_priv, "Management Command Log (count %u)", count); 2149 wmi_print_mgmt_cmd_log(wma->wmi_handle, count, print, 2150 print_priv); 2151 } 2152 } 2153 2154 static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count, 2155 qdf_abstract_print *print, 2156 void *print_priv) 2157 { 2158 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2159 2160 if (wma) { 2161 print(print_priv, 2162 "Management Command Tx Complete Log (count %u)", count); 2163 wmi_print_mgmt_cmd_tx_cmp_log(wma->wmi_handle, count, print, 2164 print_priv); 2165 } 2166 } 2167 2168 static inline void wma_print_wmi_event_log(uint32_t count, 2169 qdf_abstract_print *print, 2170 void *print_priv) 2171 { 2172 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2173 2174 if (wma) { 2175 print(print_priv, "Event Log (count %u)", count); 2176 wmi_print_event_log(wma->wmi_handle, count, print, print_priv); 2177 } 2178 } 2179 2180 static inline void wma_print_wmi_rx_event_log(uint32_t count, 2181 qdf_abstract_print *print, 2182 void *print_priv) 2183 { 2184 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2185 2186 if (wma) { 2187 print(print_priv, "Rx Event Log (count %u)", count); 2188 wmi_print_rx_event_log(wma->wmi_handle, count, print, 2189 print_priv); 2190 } 2191 } 2192 2193 static inline void wma_print_wmi_mgmt_event_log(uint32_t count, 2194 qdf_abstract_print *print, 2195 void *print_priv) 2196 { 2197 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2198 2199 if (wma) { 2200 print(print_priv, "Management Event Log (count %u)", count); 2201 wmi_print_mgmt_event_log(wma->wmi_handle, count, print, 2202 print_priv); 2203 } 2204 } 2205 #else 2206 2207 static inline void wma_print_wmi_cmd_log(uint32_t count, 2208 qdf_abstract_print *print, 2209 void *print_priv) 2210 { 2211 } 2212 2213 static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count, 2214 qdf_abstract_print *print, 2215 void *print_priv) 2216 { 2217 } 2218 2219 static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count, 2220 qdf_abstract_print *print, 2221 void *print_priv) 2222 { 2223 } 2224 2225 static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count, 2226 qdf_abstract_print *print, 2227 void *print_priv) 2228 { 2229 } 2230 2231 static inline void wma_print_wmi_event_log(uint32_t count, 2232 qdf_abstract_print *print, 2233 void *print_priv) 2234 { 2235 } 2236 2237 static inline void wma_print_wmi_rx_event_log(uint32_t count, 2238 qdf_abstract_print *print, 2239 void *print_priv) 2240 { 2241 } 2242 2243 static inline void wma_print_wmi_mgmt_event_log(uint32_t count, 2244 qdf_abstract_print *print, 2245 void *print_priv) 2246 { 2247 } 2248 #endif /* WMI_INTERFACE_EVENT_LOGGING */ 2249 2250 /** 2251 * wma_set_rx_reorder_timeout_val() - set rx recorder timeout value 2252 * @wma_handle: pointer to wma handle 2253 * @reorder_timeout: rx reorder timeout value 2254 * 2255 * Return: QDF_STATUS 2256 */ 2257 QDF_STATUS wma_set_rx_reorder_timeout_val(tp_wma_handle wma_handle, 2258 struct sir_set_rx_reorder_timeout_val *reorder_timeout); 2259 2260 /** 2261 * wma_set_rx_blocksize() - set rx blocksize 2262 * @wma_handle: pointer to wma handle 2263 * @peer_rx_blocksize: rx blocksize for peer mac 2264 * 2265 * Return: QDF_STATUS_SUCCESS for success or error code. 2266 */ 2267 QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle, 2268 struct sir_peer_set_rx_blocksize *peer_rx_blocksize); 2269 /** 2270 * wma_configure_smps_params() - Configures the smps parameters to set 2271 * @vdev_id: Virtual device for the command 2272 * @param_id: SMPS parameter ID 2273 * @param_val: Value to be set for the parameter 2274 * Return: QDF_STATUS_SUCCESS or non-zero on failure 2275 */ 2276 QDF_STATUS wma_configure_smps_params(uint32_t vdev_id, uint32_t param_id, 2277 uint32_t param_val); 2278 2279 /* 2280 * wma_chip_power_save_failure_detected_handler() - chip pwr save fail detected 2281 * event handler 2282 * @handle: wma handle 2283 * @cmd_param_info: event handler data 2284 * @len: length of @cmd_param_info 2285 * 2286 * Return: QDF_STATUS_SUCCESS on success; error code otherwise 2287 */ 2288 int wma_chip_power_save_failure_detected_handler(void *handle, 2289 uint8_t *cmd_param_info, 2290 uint32_t len); 2291 2292 /** 2293 * wma_get_chain_rssi() - send wmi cmd to get chain rssi 2294 * @wma_handle: wma handler 2295 * @req_params: requset params 2296 * 2297 * Return: Return QDF_STATUS 2298 */ 2299 QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle, 2300 struct get_chain_rssi_req_params *req_params); 2301 2302 /** 2303 * wma_config_bmiss_bcnt_params() - set bmiss config parameters 2304 * @vdev_id: virtual device for the command 2305 * @first_cnt: bmiss first value 2306 * @final_cnt: bmiss final value 2307 * 2308 * Return: QDF_STATUS_SUCCESS or non-zero on failure 2309 */ 2310 QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt, 2311 uint32_t final_cnt); 2312 2313 #ifdef WLAN_POWER_MANAGEMENT_OFFLOAD 2314 /** 2315 * wma_check_and_set_wake_timer(): checks all interfaces and if any interface 2316 * has install_key pending, sets timer pattern in fw to wake up host after 2317 * specified time has elapsed. 2318 * @time: time after which host wants to be awaken. 2319 * 2320 * Return: None 2321 */ 2322 void wma_check_and_set_wake_timer(uint32_t time); 2323 #endif 2324 2325 /** 2326 * wma_delete_invalid_peer_entries() - Delete invalid peer entries stored 2327 * @vdev_id: virtual interface id 2328 * @peer_mac_addr: Peer MAC address 2329 * 2330 * Removes the invalid peer mac entry from wma node 2331 */ 2332 void wma_delete_invalid_peer_entries(uint8_t vdev_id, uint8_t *peer_mac_addr); 2333 2334 /** 2335 * wma_rx_invalid_peer_ind() - the callback for DP to notify WMA layer 2336 * invalid peer data is received, this function will send message to 2337 * lim module. 2338 * @vdev_id: virtual device ID 2339 * @wh: Pointer to 802.11 frame header 2340 * 2341 * Return: 0 for success or non-zero on failure 2342 */ 2343 uint8_t wma_rx_invalid_peer_ind(uint8_t vdev_id, void *wh); 2344 2345 /** 2346 * wma_dp_send_delba_ind() - the callback for DP to notify WMA layer 2347 * to del ba of rx 2348 * @vdev_id: vdev id 2349 * @peer_macaddr: peer mac address 2350 * @tid: tid of rx 2351 * @reason_code: reason code 2352 * @cdp_rcode: CDP reason code for sending DELBA 2353 * 2354 * Return: 0 for success or non-zero on failure 2355 */ 2356 int wma_dp_send_delba_ind(uint8_t vdev_id, 2357 uint8_t *peer_macaddr, 2358 uint8_t tid, 2359 uint8_t reason_code, 2360 enum cdp_delba_rcode cdp_rcode); 2361 2362 /** 2363 * is_roam_inprogress() - Is vdev in progress 2364 * @vdev_id: vdev of interest 2365 * 2366 * Return: true if roaming started, false during roam sync and otherwise 2367 */ 2368 bool wma_is_roam_in_progress(uint32_t vdev_id); 2369 2370 /** 2371 * wma_get_psoc_from_scn_handle() - API to get psoc from scn handle 2372 * @scn_handle: opaque wma handle 2373 * 2374 * API to get psoc from scn handle 2375 * 2376 * Return: psoc context or null in case of failure 2377 */ 2378 struct wlan_objmgr_psoc *wma_get_psoc_from_scn_handle(void *scn_handle); 2379 2380 /** 2381 * wma_set_peer_ucast_cipher() - Update unicast cipher of the peer 2382 * @mac_addr: peer mac address 2383 * @cipher: peer cipher bits 2384 * @cipher_cap: cipher cap 2385 * 2386 * Return: None 2387 */ 2388 void wma_set_peer_ucast_cipher(uint8_t *mac_addr, int32_t cipher, 2389 int32_t cipher_cap); 2390 2391 /** 2392 * wma_update_set_key() - Update WMA layer for set key 2393 * @session_id: vdev session identifier 2394 * @pairwise: denotes if it is pairwise or group key 2395 * @key_index: Key Index 2396 * @cipher_type: cipher type being used for the encryption/decryption 2397 * 2398 * Return: None 2399 */ 2400 void wma_update_set_key(uint8_t session_id, bool pairwise, 2401 uint8_t key_index, 2402 enum wlan_crypto_cipher_type cipher_type); 2403 2404 #ifdef WLAN_FEATURE_MOTION_DETECTION 2405 /** 2406 * wma_motion_det_host_event_handler - motion detection event handler 2407 * @handle: WMA global handle 2408 * @event: motion detection event 2409 * @len: Length of cmd 2410 * 2411 * Call motion detection event callback handler 2412 * 2413 * Return: 0 on success, else error on failure 2414 */ 2415 2416 int wma_motion_det_host_event_handler(void *handle, u_int8_t *event, 2417 u_int32_t len); 2418 2419 /** 2420 * wma_motion_det_base_line_host_event_handler - md baselining event handler 2421 * @handle: WMA global handle 2422 * @event: motion detection baselining event 2423 * @len: Length of cmd 2424 * 2425 * Return: 0 on success, else error on failure 2426 */ 2427 int wma_motion_det_base_line_host_event_handler(void *handle, u_int8_t *event, 2428 u_int32_t len); 2429 #endif /* WLAN_FEATURE_MOTION_DETECTION */ 2430 2431 /** 2432 * wma_add_bss_peer_sta() - create bss peer when sta connect 2433 * @vdev_id: vdev id 2434 * @bssid: AP bssid 2435 * @roam_sync: if roam sync is in progress 2436 * @is_resp_required: Peer create response is expected from firmware. 2437 * This flag will be set to true for initial connection and false for 2438 * LFR2 case. 2439 * @mld_mac: peer mld mac address 2440 * @is_assoc_peer: is assoc peer or not 2441 * 2442 * Return: 0 on success, else error on failure 2443 */ 2444 QDF_STATUS wma_add_bss_peer_sta(uint8_t vdev_id, uint8_t *bssid, 2445 bool is_resp_required, uint8_t *mld_mac, 2446 bool is_assoc_peer); 2447 2448 /** 2449 * wma_send_vdev_stop() - WMA api to send vdev stop to fw 2450 * @vdev_id: vdev id 2451 * 2452 * Return: 0 on success, else error on failure 2453 */ 2454 QDF_STATUS wma_send_vdev_stop(uint8_t vdev_id); 2455 2456 /** 2457 * wma_pre_assoc_req() - wma pre assoc req when sta connect 2458 * @add_bss: add bss param 2459 * 2460 * Return: QDF_STATUS 2461 */ 2462 QDF_STATUS wma_pre_assoc_req(struct bss_params *add_bss); 2463 2464 /** 2465 * wma_add_bss_lfr3() - add bss during LFR3 offload roaming 2466 * @wma: wma handler 2467 * @add_bss: add bss param 2468 * 2469 * Return: None 2470 */ 2471 void wma_add_bss_lfr3(tp_wma_handle wma, struct bss_params *add_bss); 2472 2473 #ifdef WLAN_FEATURE_HOST_ROAM 2474 /** 2475 * wma_add_bss_lfr2_vdev_start() - add bss and start vdev during host roaming 2476 * @vdev: vdev in object manager 2477 * @add_bss: add bss param 2478 * 2479 * Return: None 2480 */ 2481 QDF_STATUS wma_add_bss_lfr2_vdev_start(struct wlan_objmgr_vdev *vdev, 2482 struct bss_params *add_bss); 2483 #endif 2484 2485 /** 2486 * wma_send_peer_assoc_req() - wma send peer assoc req when sta connect 2487 * @add_bss: add bss param 2488 * 2489 * Return: None 2490 */ 2491 QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss); 2492 2493 /** 2494 * wma_get_rx_chainmask() - API to get rx chainmask from mac phy capability 2495 * @pdev_id: pdev id 2496 * @chainmask_2g: pointer to return 2g chainmask 2497 * @chainmask_5g: pointer to return 5g chainmask 2498 * 2499 * API to get rx chainmask from mac phy capability directly. 2500 * 2501 * Return: QDF_STATUS_SUCCESS or non-zero on failure 2502 */ 2503 QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g, 2504 uint32_t *chainmask_5g); 2505 2506 /** 2507 * wma_handle_channel_switch_resp() - handle channel switch resp 2508 * @wma: wma handle 2509 * @rsp: response for channel switch 2510 * 2511 * Return: QDF_STATUS 2512 */ 2513 QDF_STATUS wma_handle_channel_switch_resp(tp_wma_handle wma, 2514 struct vdev_start_response *rsp); 2515 2516 /** 2517 * wma_pre_chan_switch_setup() - handler before channel switch vdev start 2518 * @vdev_id: vdev id 2519 * 2520 * Return: QDF_STATUS 2521 */ 2522 QDF_STATUS wma_pre_chan_switch_setup(uint8_t vdev_id); 2523 2524 /** 2525 * wma_post_chan_switch_setup() - handler after channel switch vdev start 2526 * @vdev_id: vdev id 2527 * 2528 * Return: QDF_STATUS 2529 */ 2530 QDF_STATUS wma_post_chan_switch_setup(uint8_t vdev_id); 2531 2532 /** 2533 * wma_vdev_pre_start() - prepare vdev start 2534 * @vdev_id: vdev id 2535 * 2536 * Return: QDF_STATUS 2537 */ 2538 QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart); 2539 2540 #ifdef WLAN_FEATURE_11BE_MLO 2541 /** 2542 * wma_delete_peer_mlo() - Remove the MLO peer and detach link peer 2543 * @psoc: PSOC objmgr pointer 2544 * @macaddr: MAC address of objmgr peer 2545 * 2546 * The API will remove the ML peer with objmgr peer fetched from 2547 * psoc peer list using the @macaddr. 2548 * 2549 * Return: void 2550 */ 2551 void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr); 2552 #else 2553 static inline 2554 void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr) 2555 { 2556 } 2557 #endif 2558 2559 /** 2560 * wma_remove_bss_peer_on_failure() - remove the bss peers in case of 2561 * failure 2562 * @wma: wma handle. 2563 * @vdev_id: vdev id 2564 * 2565 * This API deletes the BSS peer created during ADD BSS in case of ADD BSS 2566 * request sent to the FW fails. 2567 * 2568 * Return: None; 2569 */ 2570 void wma_remove_bss_peer_on_failure(tp_wma_handle wma, uint8_t vdev_id); 2571 2572 /** 2573 * wma_remove_bss_peer_before_join() - remove the bss peers in case of 2574 * failure before join (vdev start) for sta mode 2575 * @wma: wma handle. 2576 * @vdev_id: vdev id 2577 * @cm_join_req: join cm context 2578 * 2579 * This API deletes the BSS peer if any failure before "join" (vdev start). 2580 * And indicate connection failure to CM after bss peer delete event comes 2581 * from FW. 2582 * 2583 * Return: QDF_STATUS_SUCCESS if success, QDF_STATUS_E_PENDING if peer delete 2584 * event will be indicated later from target. 2585 */ 2586 QDF_STATUS wma_remove_bss_peer_before_join( 2587 tp_wma_handle wma, uint8_t vdev_id, 2588 void *cm_join_req); 2589 2590 /** 2591 * wma_send_add_bss_resp() - send add bss failure 2592 * @wma: wma handle. 2593 * @vdev_id: vdev id 2594 * @status: status 2595 * 2596 * Return: None 2597 */ 2598 void wma_send_add_bss_resp(tp_wma_handle wma, uint8_t vdev_id, 2599 QDF_STATUS status); 2600 2601 /** 2602 * wma_post_vdev_start_setup() - wma post vdev start handler 2603 * @wma: wma handle. 2604 * @vdev_id: vdev id 2605 * 2606 * Return: Success or Failure status 2607 */ 2608 QDF_STATUS wma_post_vdev_start_setup(uint8_t vdev_id); 2609 2610 /** 2611 * wma_pre_vdev_start_setup() - wma pre vdev start handler 2612 * @wma: wma handle. 2613 * @vdev_id: vdev id 2614 * @addbss_param: bss param 2615 * 2616 * Return: Success or Failure status 2617 */ 2618 QDF_STATUS wma_pre_vdev_start_setup(uint8_t vdev_id, 2619 struct bss_params *add_bss); 2620 2621 #ifdef FEATURE_ANI_LEVEL_REQUEST 2622 /** 2623 * wma_send_ani_level_request() - Send get ani level cmd to WMI 2624 * @wma_handle: wma handle. 2625 * @freqs: pointer to channels for which ANI level has to be retrieved 2626 * @num_freqs: number of channels in the above parameter 2627 * 2628 * Return: QDF_STATUS 2629 */ 2630 QDF_STATUS wma_send_ani_level_request(tp_wma_handle wma_handle, 2631 uint32_t *freqs, uint8_t num_freqs); 2632 #endif /* FEATURE_ANI_LEVEL_REQUEST */ 2633 2634 /** 2635 * wma_vdev_detach() - send vdev delete command to fw 2636 * @wma_handle: wma handle 2637 * @pdel_vdev_req_param: del vdev params 2638 * 2639 * Return: QDF status 2640 */ 2641 QDF_STATUS wma_vdev_detach(struct del_vdev_params *pdel_vdev_req_param); 2642 2643 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE 2644 /** 2645 * wma_p2p_self_peer_remove() - Send P2P self peer delete command to FW 2646 * @vdev: Object manager vdev 2647 * 2648 * Return: success if peer delete command sent to firmware, else failure. 2649 */ 2650 2651 QDF_STATUS wma_p2p_self_peer_remove(struct wlan_objmgr_vdev *vdev); 2652 #endif 2653 #endif 2654 2655