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