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 * @wmi_cmd_rsp_wake_lock: wmi command response wake lock 893 * @wmi_cmd_rsp_runtime_lock: wmi command response bus lock 894 * @active_uc_apf_mode: Setting that determines how APF is applied in 895 * active mode for uc packets 896 * @active_mc_bc_apf_mode: Setting that determines how APF is applied in 897 * active mode for MC/BC packets 898 * @ini_config: Initial configuration from upper layer 899 * @saved_chan: saved channel list sent as part of 900 * WMI_SCAN_CHAN_LIST_CMDID 901 * @nan_datapath_enabled: Is NAN datapath support enabled in firmware? 902 * @fw_timeout_crash: Should firmware be reset upon response timeout? 903 * @sub_20_support: Does target support sub-20MHz bandwidth (aka 904 * half-rate and quarter-rate)? 905 * @is_dfs_offloaded: Is dfs and cac timer offloaded? 906 * @wma_mgmt_tx_packetdump_cb: Callback function for TX packet dump 907 * @wma_mgmt_rx_packetdump_cb: Callback function for RX packet dump 908 * @rcpi_enabled: Is RCPI enabled? 909 * @link_stats_results: Structure for handing link stats from firmware 910 * @tx_fail_cnt: Number of TX failures 911 * @wlm_data: Data required for WLM req and resp handling 912 * @he_cap: 802.11ax capabilities 913 * @bandcapability: band capability configured through ini 914 * @tx_bfee_8ss_enabled: Is Tx Beamformee support for 8x8 enabled? 915 * @in_imps: Is device in Idle Mode Power Save? 916 * @dynamic_nss_chains_update: per vdev nss, chains update 917 * @ito_repeat_count: Indicates ito repeated count 918 * @wma_fw_time_sync_timer: timer used for firmware time sync 919 * * @fw_therm_throt_support: FW Supports thermal throttling? 920 * @eht_cap: 802.11be capabilities 921 * @set_hw_mode_resp_status: Set HW mode response status 922 * @pagefault_wakeups_ts: Stores timestamps at which host wakes up by fw 923 * because of pagefaults 924 * @num_page_fault_wakeups: Stores the number of times host wakes up by fw 925 * because of pagefaults 926 * 927 * This structure is the global wma context. It contains global wma 928 * module parameters and handles of other modules. 929 930 */ 931 typedef struct { 932 void *wmi_handle; 933 void *cds_context; 934 struct mac_context *mac_context; 935 struct wlan_objmgr_psoc *psoc; 936 struct wlan_objmgr_pdev *pdev; 937 qdf_event_t target_suspend; 938 qdf_event_t runtime_suspend; 939 qdf_event_t recovery_event; 940 uint16_t max_station; 941 uint16_t max_bssid; 942 uint8_t myaddr[QDF_MAC_ADDR_SIZE]; 943 uint8_t hwaddr[QDF_MAC_ADDR_SIZE]; 944 #ifdef WLAN_FEATURE_LPSS 945 uint8_t lpss_support; 946 #endif 947 uint8_t ap_arpns_support; 948 bool wmi_ready; 949 uint32_t wlan_init_status; 950 qdf_device_t qdf_dev; 951 uint32_t wmi_service_bitmap[WMI_SERVICE_BM_SIZE]; 952 uint32_t wmi_service_ext_bitmap[WMI_SERVICE_SEGMENT_BM_SIZE32]; 953 wma_tx_dwnld_comp_callback tx_frm_download_comp_cb; 954 qdf_event_t tx_frm_download_comp_event; 955 qdf_event_t tx_queue_empty_event; 956 wma_tx_ota_comp_callback umac_data_ota_ack_cb; 957 unsigned long last_umac_data_ota_timestamp; 958 qdf_nbuf_t last_umac_data_nbuf; 959 wma_tgt_cfg_cb tgt_cfg_update_cb; 960 HAL_REG_CAPABILITIES reg_cap; 961 uint32_t scan_id; 962 struct wma_txrx_node *interfaces; 963 pdev_cli_config_t pdevconfig; 964 qdf_list_t wma_hold_req_queue; 965 qdf_spinlock_t wma_hold_req_q_lock; 966 uint32_t vht_supp_mcs; 967 uint8_t is_fw_assert; 968 struct wma_tx_ack_work_ctx *ack_work_ctx; 969 void *pGetRssiReq; 970 bool get_one_peer_info; 971 struct qdf_mac_addr peer_macaddr; 972 t_thermal_mgmt thermal_mgmt_info; 973 bool enable_mc_list; 974 #ifdef FEATURE_WLAN_EXTSCAN 975 qdf_wake_lock_t extscan_wake_lock; 976 #endif 977 qdf_wake_lock_t wow_wake_lock; 978 qdf_wake_lock_t wow_auth_req_wl; 979 qdf_wake_lock_t wow_assoc_req_wl; 980 qdf_wake_lock_t wow_deauth_rec_wl; 981 qdf_wake_lock_t wow_disassoc_rec_wl; 982 qdf_wake_lock_t wow_ap_assoc_lost_wl; 983 qdf_wake_lock_t wow_auto_shutdown_wl; 984 qdf_wake_lock_t roam_ho_wl; 985 qdf_wake_lock_t roam_preauth_wl; 986 qdf_wake_lock_t probe_req_wps_wl; 987 int wow_nack; 988 qdf_atomic_t is_wow_bus_suspended; 989 #ifdef WLAN_FEATURE_LPSS 990 bool is_lpass_enabled; 991 #endif 992 uint8_t staMaxLIModDtim; 993 uint16_t sta_max_li_mod_dtim_ms; 994 uint8_t staModDtim; 995 uint8_t staDynamicDtim; 996 uint32_t hw_bd_id; 997 uint32_t hw_bd_info[HW_BD_INFO_SIZE]; 998 uint32_t miracast_value; 999 qdf_mc_timer_t log_completion_timer; 1000 uint32_t old_hw_mode_index; 1001 uint32_t new_hw_mode_index; 1002 uint16_t self_gen_frm_pwr; 1003 bool tx_chain_mask_cck; 1004 qdf_mc_timer_t service_ready_ext_timer; 1005 1006 QDF_STATUS (*csr_roam_auth_event_handle_cb)(struct mac_context *mac, 1007 uint8_t vdev_id, 1008 struct qdf_mac_addr bssid, 1009 uint32_t akm); 1010 QDF_STATUS (*pe_roam_synch_cb)(struct mac_context *mac, 1011 uint8_t vdev_id, 1012 struct roam_offload_synch_ind *roam_synch_data, 1013 uint16_t ie_len, 1014 enum sir_roam_op_code reason); 1015 QDF_STATUS (*pe_disconnect_cb) (struct mac_context *mac, 1016 uint8_t vdev_id, 1017 uint8_t *deauth_disassoc_frame, 1018 uint16_t deauth_disassoc_frame_len, 1019 uint16_t reason_code); 1020 qdf_wake_lock_t wmi_cmd_rsp_wake_lock; 1021 qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock; 1022 qdf_runtime_lock_t sap_prevent_runtime_pm_lock; 1023 qdf_runtime_lock_t ndp_prevent_runtime_pm_lock; 1024 enum active_apf_mode active_uc_apf_mode; 1025 enum active_apf_mode active_mc_bc_apf_mode; 1026 struct wma_ini_config ini_config; 1027 struct wma_valid_channels saved_chan; 1028 bool nan_datapath_enabled; 1029 bool fw_timeout_crash; 1030 bool sub_20_support; 1031 bool is_dfs_offloaded; 1032 ol_txrx_pktdump_cb wma_mgmt_tx_packetdump_cb; 1033 ol_txrx_pktdump_cb wma_mgmt_rx_packetdump_cb; 1034 bool rcpi_enabled; 1035 tSirLLStatsResults *link_stats_results; 1036 qdf_mutex_t radio_stats_lock; 1037 uint64_t tx_fail_cnt; 1038 #ifdef FEATURE_WLM_STATS 1039 struct wma_wlm_stats_data wlm_data; 1040 #endif 1041 #ifdef WLAN_FEATURE_11AX 1042 struct he_capability he_cap; 1043 #endif 1044 uint8_t bandcapability; 1045 bool tx_bfee_8ss_enabled; 1046 bool in_imps; 1047 bool dynamic_nss_chains_support; 1048 uint8_t ito_repeat_count; 1049 bool fw_therm_throt_support; 1050 bool enable_tx_compl_tsf64; 1051 #ifdef WLAN_FEATURE_11BE 1052 struct eht_capability eht_cap; 1053 #endif 1054 qdf_atomic_t sap_num_clients_connected; 1055 qdf_atomic_t go_num_clients_connected; 1056 qdf_wake_lock_t sap_d3_wow_wake_lock; 1057 qdf_wake_lock_t go_d3_wow_wake_lock; 1058 enum set_hw_mode_status set_hw_mode_resp_status; 1059 qdf_time_t *pagefault_wakeups_ts; 1060 uint8_t num_page_fault_wakeups; 1061 } t_wma_handle, *tp_wma_handle; 1062 1063 /** 1064 * wma_validate_handle() - Validate WMA handle 1065 * @wma_handle: wma handle 1066 * 1067 * This function will log on error and hence caller should not log on error 1068 * 1069 * Return: errno if WMA handle is NULL; 0 otherwise 1070 */ 1071 #define wma_validate_handle(wma_handle) \ 1072 __wma_validate_handle(wma_handle, __func__) 1073 int __wma_validate_handle(tp_wma_handle wma_handle, const char *func); 1074 1075 /** 1076 * wma_vdev_nss_chain_params_send() - send vdev nss chain params to fw. 1077 * @vdev_id: vdev_id 1078 * @user_cfg: pointer to the params structure 1079 * 1080 * This function sends nss chain params to the fw 1081 * 1082 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on error 1083 */ 1084 QDF_STATUS 1085 wma_vdev_nss_chain_params_send(uint8_t vdev_id, 1086 struct wlan_mlme_nss_chains *user_cfg); 1087 1088 /** 1089 * wma_send_regdomain_info_to_fw() - send regdomain info to fw 1090 * @reg_dmn: reg domain 1091 * @regdmn2G: 2G reg domain 1092 * @regdmn5G: 5G reg domain 1093 * @ctl2G: 2G test limit 1094 * @ctl5G: 5G test limit 1095 * 1096 * Return: none 1097 */ 1098 void wma_send_regdomain_info_to_fw(uint32_t reg_dmn, uint16_t regdmn2G, 1099 uint16_t regdmn5G, uint8_t ctl2G, 1100 uint8_t ctl5G); 1101 /** 1102 * enum frame_index - Frame index 1103 * @GENERIC_NODOWNLD_NOACK_COMP_INDEX: Frame index for no download comp no ack 1104 * @GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX: Frame index for download comp no ack 1105 * @GENERIC_DOWNLD_COMP_ACK_COMP_INDEX: Frame index for download comp and ack 1106 * @GENERIC_NODOWLOAD_ACK_COMP_INDEX: Frame index for no download comp and ack 1107 * @FRAME_INDEX_MAX: maximum frame index 1108 */ 1109 enum frame_index { 1110 GENERIC_NODOWNLD_NOACK_COMP_INDEX, 1111 GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX, 1112 GENERIC_DOWNLD_COMP_ACK_COMP_INDEX, 1113 GENERIC_NODOWLOAD_ACK_COMP_INDEX, 1114 FRAME_INDEX_MAX 1115 }; 1116 1117 /** 1118 * struct wma_tx_ack_work_ctx - tx ack work context 1119 * @wma_handle: wma handle 1120 * @sub_type: sub type 1121 * @status: status 1122 * @ack_cmp_work: work structure 1123 */ 1124 struct wma_tx_ack_work_ctx { 1125 tp_wma_handle wma_handle; 1126 uint16_t sub_type; 1127 int32_t status; 1128 qdf_work_t ack_cmp_work; 1129 }; 1130 1131 /** 1132 * struct wma_target_req - target request parameters 1133 * @event_timeout: event timeout 1134 * @node: list 1135 * @user_data: user data 1136 * @addr: Mac address 1137 * @msg_type: message type 1138 * @vdev_id: vdev id 1139 * @type: type 1140 */ 1141 struct wma_target_req { 1142 qdf_mc_timer_t event_timeout; 1143 qdf_list_node_t node; 1144 void *user_data; 1145 struct qdf_mac_addr addr; 1146 uint32_t msg_type; 1147 uint8_t vdev_id; 1148 uint8_t type; 1149 }; 1150 1151 /** 1152 * struct t_thermal_cmd_params - thermal command parameters 1153 * @minTemp: minimum temperature 1154 * @maxTemp: maximum temperature 1155 * @thermalEnable: thermal enable 1156 * @thermal_action: thermal action 1157 */ 1158 typedef struct { 1159 uint16_t minTemp; 1160 uint16_t maxTemp; 1161 uint8_t thermalEnable; 1162 enum thermal_mgmt_action_code thermal_action; 1163 } t_thermal_cmd_params, *tp_thermal_cmd_params; 1164 1165 /** 1166 * enum wma_cfg_cmd_id - wma cmd ids 1167 * @WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID: txrx firmware stats enable command 1168 * @WMA_VDEV_TXRX_FWSTATS_RESET_CMDID: txrx firmware stats reset command 1169 * @WMA_VDEV_MCC_SET_TIME_LATENCY: set MCC latency time 1170 * @WMA_VDEV_MCC_SET_TIME_QUOTA: set MCC time quota 1171 * @WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID: get IPA microcontroller fw stats 1172 * @WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID: get IPA uC wifi-sharing stats 1173 * @WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID: set IPA uC quota limit 1174 * 1175 * wma command ids for configuration request which 1176 * does not involve sending a wmi command. 1177 */ 1178 enum wma_cfg_cmd_id { 1179 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID = WMI_CMDID_MAX, 1180 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID, 1181 WMA_VDEV_MCC_SET_TIME_LATENCY, 1182 WMA_VDEV_MCC_SET_TIME_QUOTA, 1183 WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID, 1184 WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID, 1185 WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID, 1186 WMA_CMD_ID_MAX 1187 }; 1188 1189 /** 1190 * struct wma_trigger_uapsd_params - trigger uapsd parameters 1191 * @wmm_ac: wmm access category 1192 * @user_priority: user priority 1193 * @service_interval: service interval 1194 * @suspend_interval: suspend interval 1195 * @delay_interval: delay interval 1196 */ 1197 typedef struct wma_trigger_uapsd_params { 1198 uint32_t wmm_ac; 1199 uint32_t user_priority; 1200 uint32_t service_interval; 1201 uint32_t suspend_interval; 1202 uint32_t delay_interval; 1203 } t_wma_trigger_uapsd_params, *tp_wma_trigger_uapsd_params; 1204 1205 /** 1206 * enum uapsd_peer_param_max_sp - U-APSD maximum service period of peer station 1207 * @UAPSD_MAX_SP_LEN_UNLIMITED: unlimited max service period 1208 * @UAPSD_MAX_SP_LEN_2: max service period = 2 1209 * @UAPSD_MAX_SP_LEN_4: max service period = 4 1210 * @UAPSD_MAX_SP_LEN_6: max service period = 6 1211 */ 1212 enum uapsd_peer_param_max_sp { 1213 UAPSD_MAX_SP_LEN_UNLIMITED = 0, 1214 UAPSD_MAX_SP_LEN_2 = 2, 1215 UAPSD_MAX_SP_LEN_4 = 4, 1216 UAPSD_MAX_SP_LEN_6 = 6 1217 }; 1218 1219 /** 1220 * enum uapsd_peer_param_enabled_ac - U-APSD Enabled AC's of peer station 1221 * @UAPSD_VO_ENABLED: enable uapsd for voice 1222 * @UAPSD_VI_ENABLED: enable uapsd for video 1223 * @UAPSD_BK_ENABLED: enable uapsd for background 1224 * @UAPSD_BE_ENABLED: enable uapsd for best effort 1225 */ 1226 enum uapsd_peer_param_enabled_ac { 1227 UAPSD_VO_ENABLED = 0x01, 1228 UAPSD_VI_ENABLED = 0x02, 1229 UAPSD_BK_ENABLED = 0x04, 1230 UAPSD_BE_ENABLED = 0x08 1231 }; 1232 1233 /** 1234 * enum profile_id_t - Firmware profiling index 1235 * @PROF_CPU_IDLE: cpu idle profile 1236 * @PROF_PPDU_PROC: ppdu processing profile 1237 * @PROF_PPDU_POST: ppdu post profile 1238 * @PROF_HTT_TX_INPUT: htt tx input profile 1239 * @PROF_MSDU_ENQ: msdu enqueue profile 1240 * @PROF_PPDU_POST_HAL: ppdu post profile 1241 * @PROF_COMPUTE_TX_TIME: tx time profile 1242 * @PROF_MAX_ID: max profile index 1243 */ 1244 enum profile_id_t { 1245 PROF_CPU_IDLE, 1246 PROF_PPDU_PROC, 1247 PROF_PPDU_POST, 1248 PROF_HTT_TX_INPUT, 1249 PROF_MSDU_ENQ, 1250 PROF_PPDU_POST_HAL, 1251 PROF_COMPUTE_TX_TIME, 1252 PROF_MAX_ID, 1253 }; 1254 1255 /** 1256 * struct p2p_ie - P2P IE structural definition. 1257 * @p2p_id: p2p id 1258 * @p2p_len: p2p length 1259 * @p2p_oui: p2p OUI 1260 * @p2p_oui_type: p2p OUI type 1261 */ 1262 struct p2p_ie { 1263 uint8_t p2p_id; 1264 uint8_t p2p_len; 1265 uint8_t p2p_oui[3]; 1266 uint8_t p2p_oui_type; 1267 } __packed; 1268 1269 /** 1270 * struct p2p_noa_descriptor - noa descriptor 1271 * @type_count: 255: continuous schedule, 0: reserved 1272 * @duration: Absent period duration in micro seconds 1273 * @interval: Absent period interval in micro seconds 1274 * @start_time: 32 bit tsf time when in starts 1275 */ 1276 struct p2p_noa_descriptor { 1277 uint8_t type_count; 1278 uint32_t duration; 1279 uint32_t interval; 1280 uint32_t start_time; 1281 } __packed; 1282 1283 /** 1284 * struct p2p_sub_element_noa - p2p noa element 1285 * @p2p_sub_id: p2p sub id 1286 * @p2p_sub_len: p2p sub length 1287 * @index: identifies instance of NOA su element 1288 * @oppPS: oppPS state of the AP 1289 * @ctwindow: ctwindow in TUs 1290 * @num_descriptors: number of NOA descriptors 1291 * @noa_descriptors: noa descriptors 1292 */ 1293 struct p2p_sub_element_noa { 1294 uint8_t p2p_sub_id; 1295 uint8_t p2p_sub_len; 1296 uint8_t index; /* identifies instance of NOA su element */ 1297 uint8_t oppPS:1, /* oppPS state of the AP */ 1298 ctwindow:7; /* ctwindow in TUs */ 1299 uint8_t num_descriptors; /* number of NOA descriptors */ 1300 struct p2p_noa_descriptor noa_descriptors[WMA_MAX_NOA_DESCRIPTORS]; 1301 }; 1302 1303 /** 1304 * struct wma_decap_info_t - decapsulation info 1305 * @hdr: header 1306 * @hdr_len: header length 1307 */ 1308 struct wma_decap_info_t { 1309 uint8_t hdr[sizeof(struct ieee80211_qosframe_addr4)]; 1310 int32_t hdr_len; 1311 }; 1312 1313 /** 1314 * enum packet_power_save - packet power save params 1315 * @WMI_VDEV_PPS_PAID_MATCH: paid match param 1316 * @WMI_VDEV_PPS_GID_MATCH: gid match param 1317 * @WMI_VDEV_PPS_EARLY_TIM_CLEAR: early tim clear param 1318 * @WMI_VDEV_PPS_EARLY_DTIM_CLEAR: early dtim clear param 1319 * @WMI_VDEV_PPS_EOF_PAD_DELIM: eof pad delim param 1320 * @WMI_VDEV_PPS_MACADDR_MISMATCH: macaddr mismatch param 1321 * @WMI_VDEV_PPS_DELIM_CRC_FAIL: delim CRC fail param 1322 * @WMI_VDEV_PPS_GID_NSTS_ZERO: gid nsts zero param 1323 * @WMI_VDEV_PPS_RSSI_CHECK: RSSI check param 1324 * @WMI_VDEV_PPS_5G_EBT: 5G ebt param 1325 */ 1326 typedef enum { 1327 WMI_VDEV_PPS_PAID_MATCH = 0, 1328 WMI_VDEV_PPS_GID_MATCH = 1, 1329 WMI_VDEV_PPS_EARLY_TIM_CLEAR = 2, 1330 WMI_VDEV_PPS_EARLY_DTIM_CLEAR = 3, 1331 WMI_VDEV_PPS_EOF_PAD_DELIM = 4, 1332 WMI_VDEV_PPS_MACADDR_MISMATCH = 5, 1333 WMI_VDEV_PPS_DELIM_CRC_FAIL = 6, 1334 WMI_VDEV_PPS_GID_NSTS_ZERO = 7, 1335 WMI_VDEV_PPS_RSSI_CHECK = 8, 1336 WMI_VDEV_VHT_SET_GID_MGMT = 9, 1337 WMI_VDEV_PPS_5G_EBT = 10 1338 } packet_power_save; 1339 1340 /** 1341 * enum green_tx_param - green tx parameters 1342 * @wmi_vdev_param_gtx_ht_mcs: ht mcs param 1343 * @wmi_vdev_param_gtx_vht_mcs: vht mcs param 1344 * @wmi_vdev_param_gtx_usr_cfg: user cfg param 1345 * @wmi_vdev_param_gtx_thre: thre param 1346 * @wmi_vdev_param_gtx_margin: green tx margin param 1347 * @wmi_vdev_param_gtx_step: green tx step param 1348 * @wmi_vdev_param_gtx_mintpc: mintpc param 1349 * @wmi_vdev_param_gtx_bw_mask: bandwidth mask 1350 */ 1351 typedef enum { 1352 wmi_vdev_param_gtx_ht_mcs, 1353 wmi_vdev_param_gtx_vht_mcs, 1354 wmi_vdev_param_gtx_usr_cfg, 1355 wmi_vdev_param_gtx_thre, 1356 wmi_vdev_param_gtx_margin, 1357 wmi_vdev_param_gtx_step, 1358 wmi_vdev_param_gtx_mintpc, 1359 wmi_vdev_param_gtx_bw_mask, 1360 } green_tx_param; 1361 1362 /** 1363 * enum uapsd_ac - U-APSD Access Categories 1364 * @UAPSD_BE: best effort 1365 * @UAPSD_BK: back ground 1366 * @UAPSD_VI: video 1367 * @UAPSD_VO: voice 1368 */ 1369 enum uapsd_ac { 1370 UAPSD_BE, 1371 UAPSD_BK, 1372 UAPSD_VI, 1373 UAPSD_VO 1374 }; 1375 1376 /** 1377 * wma_disable_uapsd_per_ac() - disable uapsd per ac 1378 * @wmi_handle: wma handle 1379 * @vdev_id: vdev id 1380 * @ac: access category 1381 * 1382 * Return: QDF_STATUS_SUCCESS for success or error code. 1383 */ 1384 QDF_STATUS wma_disable_uapsd_per_ac(tp_wma_handle wma_handle, 1385 uint32_t vdev_id, enum uapsd_ac ac); 1386 1387 /** 1388 * enum uapsd_up - U-APSD User Priorities 1389 * @UAPSD_UP_BE: best effort 1390 * @UAPSD_UP_BK: back ground 1391 * @UAPSD_UP_RESV: reserve 1392 * @UAPSD_UP_EE: Excellent Effort 1393 * @UAPSD_UP_CL: Critical Applications 1394 * @UAPSD_UP_VI: video 1395 * @UAPSD_UP_VO: voice 1396 * @UAPSD_UP_NC: Network Control 1397 */ 1398 enum uapsd_up { 1399 UAPSD_UP_BE, 1400 UAPSD_UP_BK, 1401 UAPSD_UP_RESV, 1402 UAPSD_UP_EE, 1403 UAPSD_UP_CL, 1404 UAPSD_UP_VI, 1405 UAPSD_UP_VO, 1406 UAPSD_UP_NC, 1407 UAPSD_UP_MAX 1408 }; 1409 1410 /** 1411 * wma_trigger_uapsd_params() - set trigger uapsd parameter 1412 * @wmi_handle: wma handle 1413 * @vdev_id: vdev id 1414 * @trigger_uapsd_params: trigger uapsd parameters 1415 * 1416 * This function sets the trigger uapsd 1417 * params such as service interval, delay 1418 * interval and suspend interval which 1419 * will be used by the firmware to send 1420 * trigger frames periodically when there 1421 * is no traffic on the transmit side. 1422 * 1423 * Return: QDF_STATUS_SUCCESS for success or error code. 1424 */ 1425 QDF_STATUS wma_trigger_uapsd_params(tp_wma_handle wma_handle, uint32_t vdev_id, 1426 tp_wma_trigger_uapsd_params 1427 trigger_uapsd_params); 1428 1429 void wma_send_flush_logs_to_fw(tp_wma_handle wma_handle); 1430 void wma_log_completion_timeout(void *data); 1431 1432 #ifdef FEATURE_RSSI_MONITOR 1433 /** 1434 * wma_set_rssi_monitoring() - set rssi monitoring 1435 * @handle: WMA handle 1436 * @req: rssi monitoring request structure 1437 * 1438 * This function takes the incoming @req and sends it down to the 1439 * firmware 1440 * 1441 * Return: QDF_STATUS 1442 */ 1443 QDF_STATUS wma_set_rssi_monitoring(tp_wma_handle wma, 1444 struct rssi_monitor_param *req); 1445 #else /* FEATURE_RSSI_MONITOR */ 1446 static inline 1447 QDF_STATUS wma_set_rssi_monitoring(tp_wma_handle wma, 1448 struct rssi_monitor_param *req) 1449 { 1450 return QDF_STATUS_SUCCESS; 1451 } 1452 #endif /* FEATURE_RSSI_MONITOR */ 1453 1454 /** 1455 * wma_map_pcl_weights - Map WMA pcl weights to wmi pcl weights 1456 * @pcl_weight: Input PCL weight to be converted to wmi format 1457 * 1458 * Return: wmi_pcl_chan_weight 1459 */ 1460 wmi_pcl_chan_weight wma_map_pcl_weights(uint32_t pcl_weight); 1461 1462 QDF_STATUS wma_send_set_pcl_cmd(tp_wma_handle wma_handle, 1463 struct set_pcl_req *msg); 1464 1465 QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle, 1466 struct policy_mgr_hw_mode *msg); 1467 1468 QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle, 1469 struct policy_mgr_dual_mac_config *msg); 1470 QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle, 1471 struct sir_antenna_mode_param *msg); 1472 1473 struct wma_target_req *wma_fill_hold_req(tp_wma_handle wma, 1474 uint8_t vdev_id, uint32_t msg_type, 1475 uint8_t type, void *params, 1476 uint32_t timeout); 1477 1478 int wma_mgmt_tx_completion_handler(void *handle, uint8_t *cmpl_event_params, 1479 uint32_t len); 1480 int wma_mgmt_tx_bundle_completion_handler(void *handle, 1481 uint8_t *cmpl_event_params, uint32_t len); 1482 uint32_t wma_get_vht_ch_width(void); 1483 1484 #ifdef WLAN_FEATURE_11BE 1485 /** 1486 * wma_get_orig_eht_ch_width() - Get original EHT channel width supported 1487 * 1488 * API to get original EHT channel width 1489 * 1490 * Return: void 1491 */ 1492 uint32_t wma_get_orig_eht_ch_width(void); 1493 1494 /** 1495 * wma_get_orig_eht_ch_width() - Get current EHT channel width supported 1496 * 1497 * API to get current EHT channel width 1498 * 1499 * Return: void 1500 */ 1501 uint32_t wma_get_eht_ch_width(void); 1502 #else 1503 static inline uint32_t wma_get_orig_eht_ch_width(void) 1504 { 1505 return 0; 1506 } 1507 1508 static inline uint32_t wma_get_eht_ch_width(void) 1509 { 1510 return 0; 1511 } 1512 #endif 1513 1514 QDF_STATUS 1515 wma_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param, 1516 A_UINT32 val, A_UINT32 *module_id_bitmap, 1517 A_UINT32 bitmap_len); 1518 1519 #ifdef FEATURE_LFR_SUBNET_DETECTION 1520 /** 1521 * wma_set_gateway_params() - set gateway parameters 1522 * @wma: WMA handle 1523 * @req: gateway update request parameter structure 1524 * 1525 * This function takes the incoming @req and sends it down to the 1526 * firmware 1527 * 1528 * Return: QDF_STATUS 1529 */ 1530 QDF_STATUS wma_set_gateway_params(tp_wma_handle wma, 1531 struct gateway_update_req_param *req); 1532 #else 1533 static inline 1534 QDF_STATUS wma_set_gateway_params(tp_wma_handle wma, 1535 struct gateway_update_req_param *req) 1536 { 1537 return QDF_STATUS_SUCCESS; 1538 } 1539 #endif /* FEATURE_LFR_SUBNET_DETECTION */ 1540 1541 QDF_STATUS wma_ht40_stop_obss_scan(tp_wma_handle wma_handle, 1542 int32_t vdev_id); 1543 1544 QDF_STATUS wma_process_fw_test_cmd(WMA_HANDLE handle, 1545 struct set_fwtest_params *wma_fwtest); 1546 1547 QDF_STATUS wma_send_ht40_obss_scanind(tp_wma_handle wma, 1548 struct obss_ht40_scanind *req); 1549 1550 uint32_t wma_get_num_of_setbits_from_bitmask(uint32_t mask); 1551 1552 #ifdef FEATURE_WLAN_APF 1553 /** 1554 * wma_get_apf_caps_event_handler() - Event handler for get apf capability 1555 * @handle: WMA global handle 1556 * @cmd_param_info: command event data 1557 * @len: Length of @cmd_param_info 1558 * 1559 * Return: 0 on Success or Errno on failure 1560 */ 1561 int wma_get_apf_caps_event_handler(void *handle, 1562 u_int8_t *cmd_param_info, 1563 u_int32_t len); 1564 1565 /** 1566 * wma_get_apf_capabilities - Send get apf capability to firmware 1567 * @wma_handle: wma handle 1568 * 1569 * Return: QDF_STATUS enumeration. 1570 */ 1571 QDF_STATUS wma_get_apf_capabilities(tp_wma_handle wma); 1572 1573 /** 1574 * wma_set_apf_instructions - Set apf instructions to firmware 1575 * @wma: wma handle 1576 * @apf_set_offload: APF offload information to set to firmware 1577 * 1578 * Return: QDF_STATUS enumeration 1579 */ 1580 QDF_STATUS 1581 wma_set_apf_instructions(tp_wma_handle wma, 1582 struct sir_apf_set_offload *apf_set_offload); 1583 1584 /** 1585 * wma_send_apf_enable_cmd - Send apf enable/disable cmd 1586 * @wma_handle: wma handle 1587 * @vdev_id: vdev id 1588 * @apf_enable: true: Enable APF Int., false: Disable APF Int. 1589 * 1590 * Return: QDF_STATUS enumeration. 1591 */ 1592 QDF_STATUS wma_send_apf_enable_cmd(WMA_HANDLE handle, uint8_t vdev_id, 1593 bool apf_enable); 1594 1595 /** 1596 * wma_send_apf_write_work_memory_cmd - Command to write into the apf work 1597 * memory 1598 * @wma_handle: wma handle 1599 * @write_params: APF parameters for the write operation 1600 * 1601 * Return: QDF_STATUS enumeration. 1602 */ 1603 QDF_STATUS 1604 wma_send_apf_write_work_memory_cmd(WMA_HANDLE handle, 1605 struct wmi_apf_write_memory_params 1606 *write_params); 1607 1608 /** 1609 * wma_send_apf_read_work_memory_cmd - Command to get part of apf work memory 1610 * @wma_handle: wma handle 1611 * @callback: HDD callback to receive apf get mem event 1612 * @context: Context for the HDD callback 1613 * @read_params: APF parameters for the get operation 1614 * 1615 * Return: QDF_STATUS enumeration. 1616 */ 1617 QDF_STATUS 1618 wma_send_apf_read_work_memory_cmd(WMA_HANDLE handle, 1619 struct wmi_apf_read_memory_params 1620 *read_params); 1621 1622 /** 1623 * wma_apf_read_work_memory_event_handler - Event handler for get apf mem 1624 * operation 1625 * @handle: wma handle 1626 * @evt_buf: Buffer pointer to the event 1627 * @len: Length of the event buffer 1628 * 1629 * Return: status. 1630 */ 1631 int wma_apf_read_work_memory_event_handler(void *handle, uint8_t *evt_buf, 1632 uint32_t len); 1633 #else /* FEATURE_WLAN_APF */ 1634 static inline QDF_STATUS wma_get_apf_capabilities(tp_wma_handle wma) 1635 { 1636 return QDF_STATUS_SUCCESS; 1637 } 1638 1639 static inline QDF_STATUS 1640 wma_set_apf_instructions(tp_wma_handle wma, 1641 struct sir_apf_set_offload *apf_set_offload) 1642 { 1643 return QDF_STATUS_SUCCESS; 1644 } 1645 #endif /* FEATURE_WLAN_APF */ 1646 1647 void wma_process_set_pdev_ie_req(tp_wma_handle wma, 1648 struct set_ie_param *ie_params); 1649 void wma_process_set_pdev_ht_ie_req(tp_wma_handle wma, 1650 struct set_ie_param *ie_params); 1651 void wma_process_set_pdev_vht_ie_req(tp_wma_handle wma, 1652 struct set_ie_param *ie_params); 1653 1654 QDF_STATUS wma_remove_peer(tp_wma_handle wma, uint8_t *mac_addr, 1655 uint8_t vdev_id, bool no_fw_peer_delete); 1656 1657 /** 1658 * wma_create_peer() - Call wma_add_peer() to send peer create command to fw 1659 * and setup cdp peer 1660 * @wma: wma handle 1661 * @peer_addr: peer mac address 1662 * @peer_type: peer type 1663 * @vdev_id: vdev id 1664 * @peer_mld_addr: peer mld address 1665 * @is_assoc_peer: is assoc peer or not 1666 * 1667 * Return: QDF_STATUS 1668 */ 1669 QDF_STATUS wma_create_peer(tp_wma_handle wma, 1670 uint8_t peer_addr[QDF_MAC_ADDR_SIZE], 1671 u_int32_t peer_type, u_int8_t vdev_id, 1672 uint8_t peer_mld_addr[QDF_MAC_ADDR_SIZE], 1673 bool is_assoc_peer); 1674 1675 /** 1676 * wma_create_objmgr_peer() - create objmgr peer information in host driver 1677 * @wma: wma handle 1678 * @vdev_id: vdev id 1679 * @peer_addr: peer mac address 1680 * @wma_peer_type: peer type of enum wmi_peer_type 1681 * @peer_mld: peer mld address 1682 * 1683 * Return: Pointer to objmgr_peer 1684 */ 1685 struct wlan_objmgr_peer *wma_create_objmgr_peer(tp_wma_handle wma, 1686 uint8_t vdev_id, 1687 uint8_t *peer_addr, 1688 uint32_t wma_peer_type, 1689 uint8_t *peer_mld); 1690 1691 /** 1692 * wma_remove_objmgr_peer() - Remove Object manager peer 1693 * @wma: WMA handle 1694 * @obj_vdev: Vdev object pointer 1695 * @peer_addr: Peer mac address 1696 * 1697 * Return: None 1698 */ 1699 void wma_remove_objmgr_peer(tp_wma_handle wma, 1700 struct wlan_objmgr_vdev *obj_vdev, 1701 uint8_t *peer_addr); 1702 1703 QDF_STATUS wma_peer_unmap_conf_cb(uint8_t vdev_id, 1704 uint32_t peer_id_cnt, 1705 uint16_t *peer_id_list); 1706 1707 bool wma_objmgr_peer_exist(tp_wma_handle wma, 1708 uint8_t *peer_addr, uint8_t *peer_vdev_id); 1709 1710 /** 1711 * wma_get_cca_stats() - send request to fw to get CCA 1712 * @wmi_hdl: wma handle 1713 * @vdev_id: vdev id 1714 * 1715 * Return: QDF status 1716 */ 1717 QDF_STATUS wma_get_cca_stats(tp_wma_handle wma_handle, 1718 uint8_t vdev_id); 1719 1720 struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle); 1721 1722 /** 1723 * wma_chan_phy__mode() - get host phymode for channel 1724 * @freq: channel freq 1725 * @chan_width: maximum channel width possible 1726 * @dot11_mode: maximum phy_mode possible 1727 * 1728 * Return: return host phymode 1729 */ 1730 enum wlan_phymode wma_chan_phy_mode(uint32_t freq, enum phy_ch_width chan_width, 1731 uint8_t dot11_mode); 1732 1733 /** 1734 * wma_fw_to_host_phymode() - convert fw to host phymode 1735 * @phymode: phymode to convert 1736 * 1737 * Return: one of the values defined in enum wlan_phymode; 1738 * or WLAN_PHYMODE_AUTO if the conversion fails 1739 */ 1740 enum wlan_phymode wma_fw_to_host_phymode(WMI_HOST_WLAN_PHY_MODE phymode); 1741 1742 1743 #ifdef FEATURE_OEM_DATA_SUPPORT 1744 /** 1745 * wma_start_oem_req_cmd() - send oem request command to fw 1746 * @wma_handle: wma handle 1747 * @oem_data_req: the pointer of oem req buf 1748 * 1749 * Return: QDF status 1750 */ 1751 QDF_STATUS wma_start_oem_req_cmd(tp_wma_handle wma_handle, 1752 struct oem_data_req *oem_data_req); 1753 #endif 1754 1755 #ifdef FEATURE_OEM_DATA 1756 /** 1757 * wma_start_oem_data_cmd() - send oem data command to fw 1758 * @wma_handle: wma handle 1759 * @oem_data: the pointer of oem data buf 1760 * 1761 * Return: QDF status 1762 */ 1763 QDF_STATUS wma_start_oem_data_cmd(tp_wma_handle wma_handle, 1764 struct oem_data *oem_data); 1765 #endif 1766 1767 QDF_STATUS wma_enable_disable_caevent_ind(tp_wma_handle wma_handle, 1768 uint8_t val); 1769 void wma_register_packetdump_callback( 1770 ol_txrx_pktdump_cb wma_mgmt_tx_packetdump_cb, 1771 ol_txrx_pktdump_cb wma_mgmt_rx_packetdump_cb); 1772 void wma_deregister_packetdump_callback(void); 1773 void wma_update_sta_inactivity_timeout(tp_wma_handle wma, 1774 struct sme_sta_inactivity_timeout *sta_inactivity_timer); 1775 1776 /** 1777 * wma_form_rx_packet() - form rx cds packet 1778 * @buf: buffer 1779 * @mgmt_rx_params: mgmt rx params 1780 * @rx_pkt: cds packet 1781 * 1782 * This functions forms a cds packet from the rx mgmt frame received. 1783 * 1784 * Return: 0 for success or error code 1785 */ 1786 int wma_form_rx_packet(qdf_nbuf_t buf, 1787 struct mgmt_rx_event_params *mgmt_rx_params, 1788 cds_pkt_t *rx_pkt); 1789 1790 /** 1791 * wma_mgmt_unified_cmd_send() - send the mgmt tx packet 1792 * @vdev: objmgr vdev 1793 * @buf: buffer 1794 * @desc_id: desc id 1795 * @mgmt_tx_params: mgmt rx params 1796 * 1797 * This functions sends mgmt tx packet to WMI layer. 1798 * 1799 * Return: 0 for success or error code 1800 */ 1801 QDF_STATUS wma_mgmt_unified_cmd_send(struct wlan_objmgr_vdev *vdev, 1802 qdf_nbuf_t buf, uint32_t desc_id, 1803 void *mgmt_tx_params); 1804 1805 #ifndef CONFIG_HL_SUPPORT 1806 /** 1807 * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts 1808 * @pdev: objmgr pdev 1809 * @buf: buffer 1810 * 1811 * This function does the dma unmap of the pending mgmt packet cleanup 1812 * 1813 * Return: None 1814 */ 1815 void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev, 1816 qdf_nbuf_t buf); 1817 /** 1818 * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts 1819 * @pdev: objmgr pdev 1820 * @buf: buffer 1821 * 1822 * This is a cb function drains all mgmt packets of a vdev. 1823 * This is called in event of target going down without sending completions. 1824 * 1825 * Return: QDF_STATUS 1826 */ 1827 QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer, 1828 qdf_nbuf_t buf); 1829 #else 1830 static inline void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev, 1831 qdf_nbuf_t buf) 1832 {} 1833 static inline QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer, 1834 qdf_nbuf_t buf) 1835 { 1836 return QDF_STATUS_SUCCESS; 1837 } 1838 #endif 1839 1840 /** 1841 * wma_chan_info_event_handler() - chan info event handler 1842 * @handle: wma handle 1843 * @event_buf: event handler data 1844 * @len: length of @event_buf 1845 * 1846 * this function will handle the WMI_CHAN_INFO_EVENTID 1847 * 1848 * Return: int 1849 */ 1850 int wma_chan_info_event_handler(void *handle, uint8_t *event_buf, 1851 uint32_t len); 1852 1853 /** 1854 * wma_update_vdev_pause_bitmap() - update vdev pause bitmap 1855 * @vdev_id: the Id of the vdev to configure 1856 * @value: value pause bitmap value 1857 * 1858 * Return: None 1859 */ 1860 static inline 1861 void wma_vdev_update_pause_bitmap(uint8_t vdev_id, uint16_t value) 1862 { 1863 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1864 struct wma_txrx_node *iface; 1865 1866 if (!wma) 1867 return; 1868 1869 if (vdev_id >= wma->max_bssid) { 1870 wma_err("Invalid vdev_id: %d", vdev_id); 1871 return; 1872 } 1873 1874 iface = &wma->interfaces[vdev_id]; 1875 1876 if (!iface) { 1877 wma_err("Interface is NULL"); 1878 return; 1879 } 1880 1881 iface->pause_bitmap = value; 1882 } 1883 1884 /** 1885 * wma_vdev_get_pause_bitmap() - Get vdev pause bitmap 1886 * @vdev_id: the Id of the vdev to configure 1887 * 1888 * Return: Vdev pause bitmap value else 0 on error 1889 */ 1890 static inline 1891 uint16_t wma_vdev_get_pause_bitmap(uint8_t vdev_id) 1892 { 1893 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1894 struct wma_txrx_node *iface; 1895 1896 if (!wma) 1897 return 0; 1898 1899 iface = &wma->interfaces[vdev_id]; 1900 1901 if (!iface) { 1902 wma_err("Interface is NULL"); 1903 return 0; 1904 } 1905 1906 return iface->pause_bitmap; 1907 } 1908 1909 /** 1910 * wma_vdev_is_device_in_low_pwr_mode - is device in power save mode 1911 * @vdev_id: the Id of the vdev to configure 1912 * 1913 * Return: true if device is in low power mode else false 1914 */ 1915 static inline bool wma_vdev_is_device_in_low_pwr_mode(uint8_t vdev_id) 1916 { 1917 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1918 struct wma_txrx_node *iface; 1919 1920 if (!wma) 1921 return 0; 1922 1923 iface = &wma->interfaces[vdev_id]; 1924 1925 if (!iface) { 1926 wma_err("Interface is NULL"); 1927 return 0; 1928 } 1929 1930 return iface->in_bmps || wma->in_imps; 1931 } 1932 1933 /** 1934 * wma_vdev_get_dtim_period - Get dtim period value from mlme 1935 * @vdev_id: vdev index number 1936 * @value: pointer to the value to fill out 1937 * 1938 * Note caller must verify return status before using value 1939 * 1940 * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else 1941 * QDF_STATUS_E_FAILURE 1942 */ 1943 static inline 1944 QDF_STATUS wma_vdev_get_dtim_period(uint8_t vdev_id, uint8_t *value) 1945 { 1946 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1947 struct wma_txrx_node *iface; 1948 /* set value to zero */ 1949 *value = 0; 1950 1951 if (!wma) 1952 return QDF_STATUS_E_FAILURE; 1953 1954 iface = &wma->interfaces[vdev_id]; 1955 1956 if (!iface) 1957 return QDF_STATUS_E_FAILURE; 1958 1959 *value = iface->dtimPeriod; 1960 return QDF_STATUS_SUCCESS; 1961 } 1962 1963 /** 1964 * wma_vdev_get_beacon_interval - Get beacon interval from mlme 1965 * @vdev_id: vdev index number 1966 * @value: pointer to the value to fill out 1967 * 1968 * Note caller must verify return status before using value 1969 * 1970 * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else 1971 * QDF_STATUS_E_FAILURE 1972 */ 1973 static inline 1974 QDF_STATUS wma_vdev_get_beacon_interval(uint8_t vdev_id, uint16_t *value) 1975 { 1976 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 1977 struct wma_txrx_node *iface; 1978 /* set value to zero */ 1979 *value = 0; 1980 1981 if (!wma) 1982 return QDF_STATUS_E_FAILURE; 1983 1984 iface = &wma->interfaces[vdev_id]; 1985 1986 if (!iface) 1987 return QDF_STATUS_E_FAILURE; 1988 1989 *value = iface->beaconInterval; 1990 return QDF_STATUS_SUCCESS; 1991 } 1992 1993 /** 1994 * wma_get_vdev_rate_flag - Get beacon rate flag from mlme 1995 * @vdev_id: vdev index number 1996 * @rate_flag: pointer to the value to fill out 1997 * 1998 * Note caller must verify return status before using value 1999 * 2000 * Return: QDF_STATUS_SUCCESS when fetched a valid value from mlme else 2001 * QDF_STATUS_E_FAILURE 2002 */ 2003 static inline QDF_STATUS 2004 wma_get_vdev_rate_flag(struct wlan_objmgr_vdev *vdev, uint32_t *rate_flag) 2005 { 2006 struct vdev_mlme_obj *mlme_obj; 2007 2008 if (!vdev) { 2009 wma_err("vdev is NULL"); 2010 return QDF_STATUS_E_FAILURE; 2011 } 2012 2013 mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev); 2014 if (!mlme_obj) { 2015 wma_err("ailed to get mlme_obj"); 2016 return QDF_STATUS_E_FAILURE; 2017 } 2018 2019 *rate_flag = mlme_obj->mgmt.rate_info.rate_flags; 2020 return QDF_STATUS_SUCCESS; 2021 } 2022 2023 /** 2024 * wma_vdev_set_pause_bit() - Set a bit in vdev pause bitmap 2025 * @vdev_id: the Id of the vdev to configure 2026 * @bit_pos: set bit position in pause bitmap 2027 * 2028 * Return: None 2029 */ 2030 static inline 2031 void wma_vdev_set_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos) 2032 { 2033 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 2034 struct wma_txrx_node *iface; 2035 2036 if (!wma) 2037 return; 2038 2039 iface = &wma->interfaces[vdev_id]; 2040 2041 if (!iface) { 2042 wma_err("Interface is NULL"); 2043 return; 2044 } 2045 2046 iface->pause_bitmap |= (1 << bit_pos); 2047 } 2048 2049 /** 2050 * wma_vdev_clear_pause_bit() - Clear a bit from vdev pause bitmap 2051 * @vdev_id: the Id of the vdev to configure 2052 * @bit_pos: set bit position in pause bitmap 2053 * 2054 * Return: None 2055 */ 2056 static inline 2057 void wma_vdev_clear_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos) 2058 { 2059 tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA); 2060 struct wma_txrx_node *iface; 2061 2062 if (!wma) 2063 return; 2064 2065 iface = &wma->interfaces[vdev_id]; 2066 2067 if (!iface) { 2068 wma_err("Interface is NULL"); 2069 return; 2070 } 2071 2072 iface->pause_bitmap &= ~(1 << bit_pos); 2073 } 2074 2075 #ifdef WLAN_FEATURE_ROAM_OFFLOAD 2076 /** 2077 * wma_send_roam_preauth_status() - Send the preauth status to wmi 2078 * @handle: WMA handle 2079 * @roam_req: Pointer to wmi_roam_auth_status_params from sae 2080 * 2081 * Return: None 2082 */ 2083 void 2084 wma_send_roam_preauth_status(tp_wma_handle wma_handle, 2085 struct wmi_roam_auth_status_params *params); 2086 /** 2087 * wma_handle_roam_sync_timeout() - Update roaming status at wma layer 2088 * @wma_handle: wma handle 2089 * @info: Info for roaming start timer 2090 * 2091 * This function gets called in case of roaming offload timer get expired 2092 * 2093 * Return: None 2094 */ 2095 void wma_handle_roam_sync_timeout(tp_wma_handle wma_handle, 2096 struct roam_sync_timeout_timer_info *info); 2097 #else 2098 static inline void 2099 wma_send_roam_preauth_status(tp_wma_handle wma_handle, 2100 struct wmi_roam_auth_status_params *params) 2101 {} 2102 2103 static inline void 2104 wma_handle_roam_sync_timeout(tp_wma_handle wma_handle, 2105 struct roam_sync_timeout_timer_info *info) 2106 {} 2107 #endif 2108 2109 #ifdef WMI_INTERFACE_EVENT_LOGGING 2110 static inline void wma_print_wmi_cmd_log(uint32_t count, 2111 qdf_abstract_print *print, 2112 void *print_priv) 2113 { 2114 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2115 2116 if (wma) { 2117 print(print_priv, "Command Log (count %u)", count); 2118 wmi_print_cmd_log(wma->wmi_handle, count, print, print_priv); 2119 } 2120 } 2121 2122 static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count, 2123 qdf_abstract_print *print, 2124 void *print_priv) 2125 { 2126 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2127 2128 if (wma) { 2129 print(print_priv, "Command Tx Complete Log (count %u)", count); 2130 wmi_print_cmd_tx_cmp_log(wma->wmi_handle, count, print, 2131 print_priv); 2132 } 2133 } 2134 2135 static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count, 2136 qdf_abstract_print *print, 2137 void *print_priv) 2138 { 2139 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2140 2141 if (wma) { 2142 print(print_priv, "Management Command Log (count %u)", count); 2143 wmi_print_mgmt_cmd_log(wma->wmi_handle, count, print, 2144 print_priv); 2145 } 2146 } 2147 2148 static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count, 2149 qdf_abstract_print *print, 2150 void *print_priv) 2151 { 2152 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2153 2154 if (wma) { 2155 print(print_priv, 2156 "Management Command Tx Complete Log (count %u)", count); 2157 wmi_print_mgmt_cmd_tx_cmp_log(wma->wmi_handle, count, print, 2158 print_priv); 2159 } 2160 } 2161 2162 static inline void wma_print_wmi_event_log(uint32_t count, 2163 qdf_abstract_print *print, 2164 void *print_priv) 2165 { 2166 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2167 2168 if (wma) { 2169 print(print_priv, "Event Log (count %u)", count); 2170 wmi_print_event_log(wma->wmi_handle, count, print, print_priv); 2171 } 2172 } 2173 2174 static inline void wma_print_wmi_rx_event_log(uint32_t count, 2175 qdf_abstract_print *print, 2176 void *print_priv) 2177 { 2178 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2179 2180 if (wma) { 2181 print(print_priv, "Rx Event Log (count %u)", count); 2182 wmi_print_rx_event_log(wma->wmi_handle, count, print, 2183 print_priv); 2184 } 2185 } 2186 2187 static inline void wma_print_wmi_mgmt_event_log(uint32_t count, 2188 qdf_abstract_print *print, 2189 void *print_priv) 2190 { 2191 t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA); 2192 2193 if (wma) { 2194 print(print_priv, "Management Event Log (count %u)", count); 2195 wmi_print_mgmt_event_log(wma->wmi_handle, count, print, 2196 print_priv); 2197 } 2198 } 2199 #else 2200 2201 static inline void wma_print_wmi_cmd_log(uint32_t count, 2202 qdf_abstract_print *print, 2203 void *print_priv) 2204 { 2205 } 2206 2207 static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count, 2208 qdf_abstract_print *print, 2209 void *print_priv) 2210 { 2211 } 2212 2213 static inline void wma_print_wmi_mgmt_cmd_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_tx_cmp_log(uint32_t count, 2220 qdf_abstract_print *print, 2221 void *print_priv) 2222 { 2223 } 2224 2225 static inline void wma_print_wmi_event_log(uint32_t count, 2226 qdf_abstract_print *print, 2227 void *print_priv) 2228 { 2229 } 2230 2231 static inline void wma_print_wmi_rx_event_log(uint32_t count, 2232 qdf_abstract_print *print, 2233 void *print_priv) 2234 { 2235 } 2236 2237 static inline void wma_print_wmi_mgmt_event_log(uint32_t count, 2238 qdf_abstract_print *print, 2239 void *print_priv) 2240 { 2241 } 2242 #endif /* WMI_INTERFACE_EVENT_LOGGING */ 2243 2244 /** 2245 * wma_set_rx_reorder_timeout_val() - set rx recorder timeout value 2246 * @wma_handle: pointer to wma handle 2247 * @reorder_timeout: rx reorder timeout value 2248 * 2249 * Return: QDF_STATUS 2250 */ 2251 QDF_STATUS wma_set_rx_reorder_timeout_val(tp_wma_handle wma_handle, 2252 struct sir_set_rx_reorder_timeout_val *reorder_timeout); 2253 2254 /** 2255 * wma_set_rx_blocksize() - set rx blocksize 2256 * @wma_handle: pointer to wma handle 2257 * @peer_rx_blocksize: rx blocksize for peer mac 2258 * 2259 * Return: QDF_STATUS_SUCCESS for success or error code. 2260 */ 2261 QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle, 2262 struct sir_peer_set_rx_blocksize *peer_rx_blocksize); 2263 /** 2264 * wma_configure_smps_params() - Configures the smps parameters to set 2265 * @vdev_id: Virtual device for the command 2266 * @param_id: SMPS parameter ID 2267 * @param_val: Value to be set for the parameter 2268 * Return: QDF_STATUS_SUCCESS or non-zero on failure 2269 */ 2270 QDF_STATUS wma_configure_smps_params(uint32_t vdev_id, uint32_t param_id, 2271 uint32_t param_val); 2272 2273 /* 2274 * wma_chip_power_save_failure_detected_handler() - chip pwr save fail detected 2275 * event handler 2276 * @handle: wma handle 2277 * @cmd_param_info: event handler data 2278 * @len: length of @cmd_param_info 2279 * 2280 * Return: QDF_STATUS_SUCCESS on success; error code otherwise 2281 */ 2282 int wma_chip_power_save_failure_detected_handler(void *handle, 2283 uint8_t *cmd_param_info, 2284 uint32_t len); 2285 2286 /** 2287 * wma_get_chain_rssi() - send wmi cmd to get chain rssi 2288 * @wma_handle: wma handler 2289 * @req_params: requset params 2290 * 2291 * Return: Return QDF_STATUS 2292 */ 2293 QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle, 2294 struct get_chain_rssi_req_params *req_params); 2295 2296 /** 2297 * wma_config_bmiss_bcnt_params() - set bmiss config parameters 2298 * @vdev_id: virtual device for the command 2299 * @first_cnt: bmiss first value 2300 * @final_cnt: bmiss final value 2301 * 2302 * Return: QDF_STATUS_SUCCESS or non-zero on failure 2303 */ 2304 QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt, 2305 uint32_t final_cnt); 2306 2307 #ifdef WLAN_POWER_MANAGEMENT_OFFLOAD 2308 /** 2309 * wma_check_and_set_wake_timer(): checks all interfaces and if any interface 2310 * has install_key pending, sets timer pattern in fw to wake up host after 2311 * specified time has elapsed. 2312 * @time: time after which host wants to be awaken. 2313 * 2314 * Return: None 2315 */ 2316 void wma_check_and_set_wake_timer(uint32_t time); 2317 #endif 2318 2319 /** 2320 * wma_delete_invalid_peer_entries() - Delete invalid peer entries stored 2321 * @vdev_id: virtual interface id 2322 * @peer_mac_addr: Peer MAC address 2323 * 2324 * Removes the invalid peer mac entry from wma node 2325 */ 2326 void wma_delete_invalid_peer_entries(uint8_t vdev_id, uint8_t *peer_mac_addr); 2327 2328 /** 2329 * wma_rx_invalid_peer_ind() - the callback for DP to notify WMA layer 2330 * invalid peer data is received, this function will send message to 2331 * lim module. 2332 * @vdev_id: virtual device ID 2333 * @wh: Pointer to 802.11 frame header 2334 * 2335 * Return: 0 for success or non-zero on failure 2336 */ 2337 uint8_t wma_rx_invalid_peer_ind(uint8_t vdev_id, void *wh); 2338 2339 /** 2340 * wma_dp_send_delba_ind() - the callback for DP to notify WMA layer 2341 * to del ba of rx 2342 * @vdev_id: vdev id 2343 * @peer_macaddr: peer mac address 2344 * @tid: tid of rx 2345 * @reason_code: reason code 2346 * @cdp_rcode: CDP reason code for sending DELBA 2347 * 2348 * Return: 0 for success or non-zero on failure 2349 */ 2350 int wma_dp_send_delba_ind(uint8_t vdev_id, 2351 uint8_t *peer_macaddr, 2352 uint8_t tid, 2353 uint8_t reason_code, 2354 enum cdp_delba_rcode cdp_rcode); 2355 2356 /** 2357 * is_roam_inprogress() - Is vdev in progress 2358 * @vdev_id: vdev of interest 2359 * 2360 * Return: true if roaming started, false during roam sync and otherwise 2361 */ 2362 bool wma_is_roam_in_progress(uint32_t vdev_id); 2363 2364 /** 2365 * wma_get_psoc_from_scn_handle() - API to get psoc from scn handle 2366 * @scn_handle: opaque wma handle 2367 * 2368 * API to get psoc from scn handle 2369 * 2370 * Return: psoc context or null in case of failure 2371 */ 2372 struct wlan_objmgr_psoc *wma_get_psoc_from_scn_handle(void *scn_handle); 2373 2374 /** 2375 * wma_set_peer_ucast_cipher() - Update unicast cipher of the peer 2376 * @mac_addr: peer mac address 2377 * @cipher: peer cipher bits 2378 * @cipher_cap: cipher cap 2379 * 2380 * Return: None 2381 */ 2382 void wma_set_peer_ucast_cipher(uint8_t *mac_addr, int32_t cipher, 2383 int32_t cipher_cap); 2384 2385 /** 2386 * wma_update_set_key() - Update WMA layer for set key 2387 * @session_id: vdev session identifier 2388 * @pairwise: denotes if it is pairwise or group key 2389 * @key_index: Key Index 2390 * @cipher_type: cipher type being used for the encryption/decryption 2391 * 2392 * Return: None 2393 */ 2394 void wma_update_set_key(uint8_t session_id, bool pairwise, 2395 uint8_t key_index, 2396 enum wlan_crypto_cipher_type cipher_type); 2397 2398 #ifdef WLAN_FEATURE_MOTION_DETECTION 2399 /** 2400 * wma_motion_det_host_event_handler - motion detection event handler 2401 * @handle: WMA global handle 2402 * @event: motion detection event 2403 * @len: Length of cmd 2404 * 2405 * Call motion detection event callback handler 2406 * 2407 * Return: 0 on success, else error on failure 2408 */ 2409 2410 int wma_motion_det_host_event_handler(void *handle, u_int8_t *event, 2411 u_int32_t len); 2412 2413 /** 2414 * wma_motion_det_base_line_host_event_handler - md baselining event handler 2415 * @handle: WMA global handle 2416 * @event: motion detection baselining event 2417 * @len: Length of cmd 2418 * 2419 * Return: 0 on success, else error on failure 2420 */ 2421 int wma_motion_det_base_line_host_event_handler(void *handle, u_int8_t *event, 2422 u_int32_t len); 2423 #endif /* WLAN_FEATURE_MOTION_DETECTION */ 2424 2425 /** 2426 * wma_add_bss_peer_sta() - create bss peer when sta connect 2427 * @vdev_id: vdev id 2428 * @bssid: AP bssid 2429 * @roam_sync: if roam sync is in progress 2430 * @is_resp_required: Peer create response is expected from firmware. 2431 * This flag will be set to true for initial connection and false for 2432 * LFR2 case. 2433 * @mld_mac: peer mld mac address 2434 * @is_assoc_peer: is assoc peer or not 2435 * 2436 * Return: 0 on success, else error on failure 2437 */ 2438 QDF_STATUS wma_add_bss_peer_sta(uint8_t vdev_id, uint8_t *bssid, 2439 bool is_resp_required, uint8_t *mld_mac, 2440 bool is_assoc_peer); 2441 2442 /** 2443 * wma_send_vdev_stop() - WMA api to send vdev stop to fw 2444 * @vdev_id: vdev id 2445 * 2446 * Return: 0 on success, else error on failure 2447 */ 2448 QDF_STATUS wma_send_vdev_stop(uint8_t vdev_id); 2449 2450 /** 2451 * wma_pre_assoc_req() - wma pre assoc req when sta connect 2452 * @add_bss: add bss param 2453 * 2454 * Return: QDF_STATUS 2455 */ 2456 QDF_STATUS wma_pre_assoc_req(struct bss_params *add_bss); 2457 2458 /** 2459 * wma_add_bss_lfr3() - add bss during LFR3 offload roaming 2460 * @wma: wma handler 2461 * @add_bss: add bss param 2462 * 2463 * Return: None 2464 */ 2465 void wma_add_bss_lfr3(tp_wma_handle wma, struct bss_params *add_bss); 2466 2467 #ifdef WLAN_FEATURE_HOST_ROAM 2468 /** 2469 * wma_add_bss_lfr2_vdev_start() - add bss and start vdev during host roaming 2470 * @vdev: vdev in object manager 2471 * @add_bss: add bss param 2472 * 2473 * Return: None 2474 */ 2475 QDF_STATUS wma_add_bss_lfr2_vdev_start(struct wlan_objmgr_vdev *vdev, 2476 struct bss_params *add_bss); 2477 #endif 2478 2479 /** 2480 * wma_send_peer_assoc_req() - wma send peer assoc req when sta connect 2481 * @add_bss: add bss param 2482 * 2483 * Return: None 2484 */ 2485 QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss); 2486 2487 /** 2488 * wma_get_rx_chainmask() - API to get rx chainmask from mac phy capability 2489 * @pdev_id: pdev id 2490 * @chainmask_2g: pointer to return 2g chainmask 2491 * @chainmask_5g: pointer to return 5g chainmask 2492 * 2493 * API to get rx chainmask from mac phy capability directly. 2494 * 2495 * Return: QDF_STATUS_SUCCESS or non-zero on failure 2496 */ 2497 QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g, 2498 uint32_t *chainmask_5g); 2499 2500 /** 2501 * wma_handle_channel_switch_resp() - handle channel switch resp 2502 * @wma: wma handle 2503 * @rsp: response for channel switch 2504 * 2505 * Return: QDF_STATUS 2506 */ 2507 QDF_STATUS wma_handle_channel_switch_resp(tp_wma_handle wma, 2508 struct vdev_start_response *rsp); 2509 2510 /** 2511 * wma_pre_chan_switch_setup() - handler before channel switch vdev start 2512 * @vdev_id: vdev id 2513 * 2514 * Return: QDF_STATUS 2515 */ 2516 QDF_STATUS wma_pre_chan_switch_setup(uint8_t vdev_id); 2517 2518 /** 2519 * wma_post_chan_switch_setup() - handler after channel switch vdev start 2520 * @vdev_id: vdev id 2521 * 2522 * Return: QDF_STATUS 2523 */ 2524 QDF_STATUS wma_post_chan_switch_setup(uint8_t vdev_id); 2525 2526 /** 2527 * wma_vdev_pre_start() - prepare vdev start 2528 * @vdev_id: vdev id 2529 * 2530 * Return: QDF_STATUS 2531 */ 2532 QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart); 2533 2534 #ifdef WLAN_FEATURE_11BE_MLO 2535 /** 2536 * wma_delete_peer_mlo() - Remove the MLO peer and detach link peer 2537 * @psoc: PSOC objmgr pointer 2538 * @macaddr: MAC address of objmgr peer 2539 * 2540 * The API will remove the ML peer with objmgr peer fetched from 2541 * psoc peer list using the @macaddr. 2542 * 2543 * Return: void 2544 */ 2545 void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr); 2546 #else 2547 static inline 2548 void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr) 2549 { 2550 } 2551 #endif 2552 2553 /** 2554 * wma_remove_bss_peer_on_failure() - remove the bss peers in case of 2555 * failure 2556 * @wma: wma handle. 2557 * @vdev_id: vdev id 2558 * 2559 * This API deletes the BSS peer created during ADD BSS in case of ADD BSS 2560 * request sent to the FW fails. 2561 * 2562 * Return: None; 2563 */ 2564 void wma_remove_bss_peer_on_failure(tp_wma_handle wma, uint8_t vdev_id); 2565 2566 /** 2567 * wma_remove_bss_peer_before_join() - remove the bss peers in case of 2568 * failure before join (vdev start) for sta mode 2569 * @wma: wma handle. 2570 * @vdev_id: vdev id 2571 * @cm_join_req: join cm context 2572 * 2573 * This API deletes the BSS peer if any failure before "join" (vdev start). 2574 * And indicate connection failure to CM after bss peer delete event comes 2575 * from FW. 2576 * 2577 * Return: QDF_STATUS_SUCCESS if success, QDF_STATUS_E_PENDING if peer delete 2578 * event will be indicated later from target. 2579 */ 2580 QDF_STATUS wma_remove_bss_peer_before_join( 2581 tp_wma_handle wma, uint8_t vdev_id, 2582 void *cm_join_req); 2583 2584 /** 2585 * wma_send_add_bss_resp() - send add bss failure 2586 * @wma: wma handle. 2587 * @vdev_id: vdev id 2588 * @status: status 2589 * 2590 * Return: None 2591 */ 2592 void wma_send_add_bss_resp(tp_wma_handle wma, uint8_t vdev_id, 2593 QDF_STATUS status); 2594 2595 /** 2596 * wma_post_vdev_start_setup() - wma post vdev start handler 2597 * @wma: wma handle. 2598 * @vdev_id: vdev id 2599 * 2600 * Return: Success or Failure status 2601 */ 2602 QDF_STATUS wma_post_vdev_start_setup(uint8_t vdev_id); 2603 2604 /** 2605 * wma_pre_vdev_start_setup() - wma pre vdev start handler 2606 * @wma: wma handle. 2607 * @vdev_id: vdev id 2608 * @addbss_param: bss param 2609 * 2610 * Return: Success or Failure status 2611 */ 2612 QDF_STATUS wma_pre_vdev_start_setup(uint8_t vdev_id, 2613 struct bss_params *add_bss); 2614 2615 #ifdef FEATURE_ANI_LEVEL_REQUEST 2616 /** 2617 * wma_send_ani_level_request() - Send get ani level cmd to WMI 2618 * @wma_handle: wma handle. 2619 * @freqs: pointer to channels for which ANI level has to be retrieved 2620 * @num_freqs: number of channels in the above parameter 2621 * 2622 * Return: QDF_STATUS 2623 */ 2624 QDF_STATUS wma_send_ani_level_request(tp_wma_handle wma_handle, 2625 uint32_t *freqs, uint8_t num_freqs); 2626 #endif /* FEATURE_ANI_LEVEL_REQUEST */ 2627 2628 /** 2629 * wma_vdev_detach() - send vdev delete command to fw 2630 * @wma_handle: wma handle 2631 * @pdel_vdev_req_param: del vdev params 2632 * 2633 * Return: QDF status 2634 */ 2635 QDF_STATUS wma_vdev_detach(struct del_vdev_params *pdel_vdev_req_param); 2636 2637 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE 2638 /** 2639 * wma_p2p_self_peer_remove() - Send P2P self peer delete command to FW 2640 * @vdev: Object manager vdev 2641 * 2642 * Return: success if peer delete command sent to firmware, else failure. 2643 */ 2644 2645 QDF_STATUS wma_p2p_self_peer_remove(struct wlan_objmgr_vdev *vdev); 2646 #endif 2647 #endif 2648 2649