1 /* 2 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. 3 * 4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc. 5 * 6 * 7 * Permission to use, copy, modify, and/or distribute this software for 8 * any purpose with or without fee is hereby granted, provided that the 9 * above copyright notice and this permission notice appear in all 10 * copies. 11 * 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 19 * PERFORMANCE OF THIS SOFTWARE. 20 */ 21 22 /* 23 * This file was originally distributed by Qualcomm Atheros, Inc. 24 * under proprietary terms before Copyright ownership was assigned 25 * to the Linux Foundation. 26 */ 27 28 /* 29 * This file lim_types.h contains the definitions used by all 30 * all LIM modules. 31 * Author: Chandra Modumudi 32 * Date: 02/11/02 33 * History:- 34 * Date Modified by Modification Information 35 * -------------------------------------------------------------------- 36 * 37 */ 38 #ifndef __LIM_TYPES_H 39 #define __LIM_TYPES_H 40 41 #include "wni_api.h" 42 #include "sir_api.h" 43 #include "sir_common.h" 44 #include "sir_mac_prot_def.h" 45 #include "utils_api.h" 46 47 #include "lim_api.h" 48 #include "lim_trace.h" 49 #include "lim_send_sme_rsp_messages.h" 50 #include "sys_global.h" 51 #include "dph_global.h" 52 #include "parser_api.h" 53 #include "wma_if.h" 54 55 #define LINK_TEST_DEFER 1 56 57 #define TRACE_EVENT_CNF_TIMER_DEACT 0x6600 58 #define TRACE_EVENT_CNF_TIMER_ACT 0x6601 59 #define TRACE_EVENT_AUTH_RSP_TIMER_DEACT 0x6602 60 #define TRACE_EVENT_AUTH_RSP_TIMER_ACT 0x6603 61 62 /* MLM message types */ 63 #define LIM_MLM_MSG_START 1000 64 #define LIM_MLM_SCAN_REQ LIM_MLM_MSG_START 65 #define LIM_MLM_SCAN_CNF (LIM_MLM_MSG_START + 1) 66 #define LIM_MLM_START_REQ (LIM_MLM_MSG_START + 2) 67 #define LIM_MLM_START_CNF (LIM_MLM_MSG_START + 3) 68 #define LIM_MLM_JOIN_REQ (LIM_MLM_MSG_START + 4) 69 #define LIM_MLM_JOIN_CNF (LIM_MLM_MSG_START + 5) 70 #define LIM_MLM_AUTH_REQ (LIM_MLM_MSG_START + 6) 71 #define LIM_MLM_AUTH_CNF (LIM_MLM_MSG_START + 7) 72 #define LIM_MLM_AUTH_IND (LIM_MLM_MSG_START + 8) 73 #define LIM_MLM_ASSOC_REQ (LIM_MLM_MSG_START + 9) 74 #define LIM_MLM_ASSOC_CNF (LIM_MLM_MSG_START + 10) 75 #define LIM_MLM_ASSOC_IND (LIM_MLM_MSG_START + 11) 76 #define LIM_MLM_DISASSOC_REQ (LIM_MLM_MSG_START + 12) 77 #define LIM_MLM_DISASSOC_CNF (LIM_MLM_MSG_START + 13) 78 #define LIM_MLM_DISASSOC_IND (LIM_MLM_MSG_START + 14) 79 #define LIM_MLM_REASSOC_REQ (LIM_MLM_MSG_START + 15) 80 #define LIM_MLM_REASSOC_CNF (LIM_MLM_MSG_START + 16) 81 #define LIM_MLM_REASSOC_IND (LIM_MLM_MSG_START + 17) 82 #define LIM_MLM_DEAUTH_REQ (LIM_MLM_MSG_START + 18) 83 #define LIM_MLM_DEAUTH_CNF (LIM_MLM_MSG_START + 19) 84 #define LIM_MLM_DEAUTH_IND (LIM_MLM_MSG_START + 20) 85 #define LIM_MLM_TSPEC_REQ (LIM_MLM_MSG_START + 21) 86 #define LIM_MLM_TSPEC_CNF (LIM_MLM_MSG_START + 22) 87 #define LIM_MLM_TSPEC_IND (LIM_MLM_MSG_START + 23) 88 #define LIM_MLM_SETKEYS_REQ (LIM_MLM_MSG_START + 24) 89 #define LIM_MLM_SETKEYS_CNF (LIM_MLM_MSG_START + 25) 90 #define LIM_MLM_LINK_TEST_STOP_REQ (LIM_MLM_MSG_START + 30) 91 #define LIM_MLM_PURGE_STA_IND (LIM_MLM_MSG_START + 31) 92 /* 93 * Values (LIM_MLM_MSG_START + 32) through 94 * (LIM_MLM_MSG_START + 40) are unused. 95 */ 96 97 #define LIM_HASH_ADD 0 98 #define LIM_HASH_UPDATE 1 99 100 #define LIM_WEP_IN_FC 1 101 #define LIM_NO_WEP_IN_FC 0 102 103 #define LIM_DECRYPT_ICV_FAIL 1 104 105 /* / Definitions to distinquish between Association/Reassociaton */ 106 #define LIM_ASSOC 0 107 #define LIM_REASSOC 1 108 109 /* / Minimum Memory blocks require for different scenario */ 110 #define LIM_MIN_MEM_ASSOC 4 111 112 /* / Verifies whether given mac addr matches the CURRENT Bssid */ 113 #define IS_CURRENT_BSSID(pMac, addr, psessionEntry) (!qdf_mem_cmp(addr, \ 114 psessionEntry->bssId, \ 115 sizeof(psessionEntry->bssId))) 116 /* / Verifies whether given addr matches the REASSOC Bssid */ 117 #define IS_REASSOC_BSSID(pMac, addr, psessionEntry) (!qdf_mem_cmp(addr, \ 118 psessionEntry->limReAssocbssId, \ 119 sizeof(psessionEntry->limReAssocbssId))) 120 121 #define REQ_TYPE_REGISTRAR (0x2) 122 #define REQ_TYPE_WLAN_MANAGER_REGISTRAR (0x3) 123 124 #define RESP_TYPE_REGISTRAR (0x2) 125 #define RESP_TYPE_ENROLLEE_INFO_ONLY (0x0) 126 #define RESP_TYPE_ENROLLEE_OPEN_8021X (0x1) 127 #define RESP_TYPE_AP (0x3) 128 #define LIM_TX_FRAMES_THRESHOLD_ON_CHIP 300 129 130 131 #define HAL_TXCOMP_REQUESTED_MASK 0x1 /* bit 0 for TxComp intr requested. */ 132 #define HAL_USE_SELF_STA_REQUESTED_MASK 0x2 /* bit 1 for STA overwrite with selfSta Requested. */ 133 #define HAL_TX_NO_ENCRYPTION_MASK 0x4 /* bit 2. If set, the frame is not to be encrypted */ 134 #if defined(LIBRA_WAPI_SUPPORT) 135 #define HAL_WAPI_STA_MASK 0x8 /* bit 3. If set, this frame is for WAPI station */ 136 #endif 137 138 #define HAL_TRIGGER_ENABLED_AC_MASK 0x10 /* bit 4 for data frames belonging to trigger enabled AC */ 139 #define HAL_USE_NO_ACK_REQUESTED_MASK 0x20 140 141 #define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40 /* Bit 6 will be used to control BD rate for Management frames */ 142 #define HAL_USE_PEER_STA_REQUESTED_MASK 0x80 /* bit 7 will be used to control frames for p2p interface */ 143 144 #ifdef FEATURE_WLAN_TDLS 145 #define HAL_TDLS_PEER_STA_MASK 0x80 /* bit 7 set for TDLS peer station */ 146 #endif 147 148 149 /* enums used by LIM are as follows */ 150 151 enum eLimDisassocTrigger { 152 eLIM_HOST_DISASSOC, 153 eLIM_PEER_ENTITY_DISASSOC, 154 eLIM_LINK_MONITORING_DISASSOC, 155 eLIM_PROMISCUOUS_MODE_DISASSOC, 156 eLIM_HOST_DEAUTH, 157 eLIM_PEER_ENTITY_DEAUTH, 158 eLIM_LINK_MONITORING_DEAUTH, 159 eLIM_JOIN_FAILURE, 160 eLIM_REASSOC_REJECT, 161 eLIM_DUPLICATE_ENTRY 162 }; 163 164 /* Reason code to determine the channel change context while sending 165 * WMA_CHNL_SWITCH_REQ message to HAL 166 */ 167 enum eChannelChangeReasonCodes { 168 LIM_SWITCH_CHANNEL_REASSOC, 169 LIM_SWITCH_CHANNEL_JOIN, 170 LIM_SWITCH_CHANNEL_OPERATION, /* Generic change channel */ 171 LIM_SWITCH_CHANNEL_SAP_DFS, /* DFS channel change */ 172 }; 173 174 typedef struct sLimAuthRspTimeout { 175 tSirMacAddr peerMacAddr; 176 } tLimAuthRspTimeout; 177 178 typedef struct sLimMlmStartReq { 179 tSirMacSSid ssId; 180 tSirBssType bssType; 181 tSirMacAddr bssId; 182 tSirMacBeaconInterval beaconPeriod; 183 uint8_t dtimPeriod; 184 tSirMacCfParamSet cfParamSet; 185 tSirMacChanNum channelNumber; 186 ePhyChanBondState cbMode; 187 uint16_t atimWindow; 188 tSirMacRateSet rateSet; 189 uint8_t sessionId; /* Added For BT-AMP Support */ 190 191 /* Parameters reqd for new HAL (message) interface */ 192 tSirNwType nwType; 193 uint8_t htCapable; 194 tSirMacHTOperatingMode htOperMode; 195 uint8_t dualCTSProtection; 196 uint8_t txChannelWidthSet; 197 uint8_t ssidHidden; 198 uint8_t wps_state; 199 uint8_t obssProtEnabled; 200 uint16_t beacon_tx_rate; 201 uint32_t cac_duration_ms; 202 uint32_t dfs_regdomain; 203 } tLimMlmStartReq, *tpLimMlmStartReq; 204 205 typedef struct sLimMlmStartCnf { 206 tSirResultCodes resultCode; 207 uint8_t sessionId; 208 } tLimMlmStartCnf, *tpLimMlmStartCnf; 209 210 typedef struct sLimMlmScanCnf { 211 tSirResultCodes resultCode; 212 uint16_t scanResultLength; 213 uint8_t sessionId; 214 tSirBssDescription bssDescription[1]; 215 /* 216 * WARNING: Pls make bssDescription as last variable in struct 217 * tLimMlmScanCnf as it has ieFields followed after this bss 218 * description. Adding a variable after this corrupts the ieFields 219 */ 220 } tLimMlmScanCnf, *tpLimMlmScanCnf; 221 222 typedef struct sLimScanResult { 223 uint16_t numBssDescriptions; 224 tSirBssDescription bssDescription[1]; 225 } tLimScanResult; 226 227 typedef struct sLimMlmJoinCnf { 228 tSirResultCodes resultCode; 229 uint16_t protStatusCode; 230 uint8_t sessionId; 231 } tLimMlmJoinCnf, *tpLimMlmJoinCnf; 232 233 typedef struct sLimMlmAssocReq { 234 tSirMacAddr peerMacAddr; 235 uint32_t assocFailureTimeout; 236 uint16_t capabilityInfo; 237 tSirMacListenInterval listenInterval; 238 uint8_t sessionId; 239 } tLimMlmAssocReq, *tpLimMlmAssocReq; 240 241 typedef struct sLimMlmAssocCnf { 242 tSirResultCodes resultCode; /* Internal status code. */ 243 uint16_t protStatusCode; /* Protocol Status code. */ 244 uint8_t sessionId; 245 } tLimMlmAssocCnf, *tpLimMlmAssocCnf; 246 247 typedef struct sLimMlmAssocInd { 248 tSirMacAddr peerMacAddr; 249 uint16_t aid; 250 tAniAuthType authType; 251 tAniSSID ssId; 252 tSirRSNie rsnIE; 253 tSirWAPIie wapiIE; 254 tSirAddie addIE; /* additional IE received from the peer, which possibly includes WSC IE and/or P2P IE. */ 255 tSirMacCapabilityInfo capabilityInfo; 256 bool spectrumMgtIndicator; 257 tSirMacPowerCapInfo powerCap; 258 tSirSupChnl supportedChannels; 259 uint8_t sessionId; 260 261 bool WmmStaInfoPresent; 262 263 /* Required for indicating the frames to upper layer */ 264 uint32_t beaconLength; 265 uint8_t *beaconPtr; 266 uint32_t assocReqLength; 267 uint8_t *assocReqPtr; 268 tSirSmeChanInfo chan_info; 269 bool ampdu; 270 bool sgi_enable; 271 bool tx_stbc; 272 bool rx_stbc; 273 tSirMacHTChannelWidth ch_width; 274 enum sir_sme_phy_mode mode; 275 uint8_t max_supp_idx; 276 uint8_t max_ext_idx; 277 uint8_t max_mcs_idx; 278 uint8_t rx_mcs_map; 279 uint8_t tx_mcs_map; 280 uint8_t ecsa_capable; 281 282 tDot11fIEHTCaps ht_caps; 283 tDot11fIEVHTCaps vht_caps; 284 } tLimMlmAssocInd, *tpLimMlmAssocInd; 285 286 typedef struct sLimMlmReassocReq { 287 tSirMacAddr peerMacAddr; 288 uint32_t reassocFailureTimeout; 289 uint16_t capabilityInfo; 290 tSirMacListenInterval listenInterval; 291 uint8_t sessionId; 292 } tLimMlmReassocReq, *tpLimMlmReassocReq; 293 294 typedef struct sLimMlmReassocCnf { 295 tSirResultCodes resultCode; 296 uint16_t protStatusCode; /* Protocol Status code. */ 297 uint8_t sessionId; 298 } tLimMlmReassocCnf, *tpLimMlmReassocCnf; 299 300 typedef struct sLimMlmReassocInd { 301 tSirMacAddr peerMacAddr; 302 tSirMacAddr currentApAddr; 303 uint16_t aid; 304 tAniAuthType authType; 305 tAniSSID ssId; 306 tSirRSNie rsnIE; 307 tSirWAPIie wapiIE; 308 tSirAddie addIE; /* additional IE received from the peer, which can be WSC IE and/or P2P IE. */ 309 tSirMacCapabilityInfo capabilityInfo; 310 bool spectrumMgtIndicator; 311 tSirMacPowerCapInfo powerCap; 312 tSirSupChnl supportedChannels; 313 314 bool WmmStaInfoPresent; 315 316 /* Required for indicating the frames to upper layer */ 317 uint32_t beaconLength; 318 uint8_t *beaconPtr; 319 uint32_t assocReqLength; 320 uint8_t *assocReqPtr; 321 uint8_t ecsa_capable; 322 } tLimMlmReassocInd, *tpLimMlmReassocInd; 323 324 typedef struct sLimMlmAuthCnf { 325 tSirMacAddr peerMacAddr; 326 tAniAuthType authType; 327 tSirResultCodes resultCode; 328 uint16_t protStatusCode; 329 uint8_t sessionId; 330 } tLimMlmAuthCnf, *tpLimMlmAuthCnf; 331 332 typedef struct sLimMlmDeauthReq { 333 struct qdf_mac_addr peer_macaddr; 334 uint16_t reasonCode; 335 uint16_t deauthTrigger; 336 uint16_t aid; 337 uint8_t sessionId; /* Added for BT-AMP SUPPORT */ 338 339 } tLimMlmDeauthReq, *tpLimMlmDeauthReq; 340 341 typedef struct sLimMlmDeauthCnf { 342 struct qdf_mac_addr peer_macaddr; 343 tSirResultCodes resultCode; 344 uint16_t deauthTrigger; 345 uint16_t aid; 346 uint8_t sessionId; 347 } tLimMlmDeauthCnf, *tpLimMLmDeauthCnf; 348 349 typedef struct sLimMlmDeauthInd { 350 tSirMacAddr peerMacAddr; 351 uint16_t reasonCode; 352 uint16_t deauthTrigger; 353 uint16_t aid; 354 } tLimMlmDeauthInd, *tpLimMlmDeauthInd; 355 356 typedef struct sLimMlmDisassocReq { 357 struct qdf_mac_addr peer_macaddr; 358 uint16_t reasonCode; 359 uint16_t disassocTrigger; 360 uint16_t aid; 361 uint8_t sessionId; 362 } tLimMlmDisassocReq, *tpLimMlmDisassocReq; 363 364 typedef struct sLimMlmDisassocCnf { 365 tSirMacAddr peerMacAddr; 366 tSirResultCodes resultCode; 367 uint16_t disassocTrigger; 368 uint16_t aid; 369 uint8_t sessionId; 370 } tLimMlmDisassocCnf, *tpLimMlmDisassocCnf; 371 372 typedef struct sLimMlmDisassocInd { 373 tSirMacAddr peerMacAddr; 374 uint16_t reasonCode; 375 uint16_t disassocTrigger; 376 uint16_t aid; 377 uint8_t sessionId; 378 } tLimMlmDisassocInd, *tpLimMlmDisassocInd; 379 380 typedef struct sLimMlmPurgeStaReq { 381 tSirMacAddr peerMacAddr; 382 uint16_t aid; 383 uint8_t sessionId; /* Added For BT-AMP Support */ 384 } tLimMlmPurgeStaReq, *tpLimMlmPurgeStaReq; 385 386 typedef struct sLimMlmPurgeStaInd { 387 tSirMacAddr peerMacAddr; 388 uint16_t reasonCode; 389 uint16_t purgeTrigger; 390 uint16_t aid; 391 uint8_t sessionId; 392 } tLimMlmPurgeStaInd, *tpLimMlmPurgeStaInd; 393 394 /** 395 * struct sLimMlmSetKeysCnf - set key confirmation parameters 396 * @peer_macaddr: peer mac address 397 * @resultCode: Result of set key operation 398 * @aid: association id 399 * @sessionId: PE session id 400 * @key_len_nonzero: Keys are non-zero length 401 */ 402 typedef struct sLimMlmSetKeysCnf { 403 struct qdf_mac_addr peer_macaddr; 404 uint16_t resultCode; 405 uint16_t aid; 406 uint8_t sessionId; 407 bool key_len_nonzero; 408 } tLimMlmSetKeysCnf, *tpLimMlmSetKeysCnf; 409 410 typedef struct sLimMlmResetReq { 411 tSirMacAddr macAddr; 412 uint8_t performCleanup; 413 uint8_t sessionId; 414 } tLimMlmResetReq, *tpLimMlmResetReq; 415 416 typedef struct sLimMlmResetCnf { 417 tSirMacAddr macAddr; 418 tSirResultCodes resultCode; 419 uint8_t sessionId; 420 } tLimMlmResetCnf, *tpLimMlmResetCnf; 421 422 typedef struct sLimMlmLinkTestStopReq { 423 tSirMacAddr peerMacAddr; 424 uint8_t sessionId; 425 } tLimMlmLinkTestStopReq, *tpLimMlmLinkTestStopReq; 426 427 /* Function templates */ 428 429 bool lim_process_sme_req_messages(tpAniSirGlobal, struct scheduler_msg *); 430 void lim_process_mlm_req_messages(tpAniSirGlobal, struct scheduler_msg *); 431 void lim_process_mlm_rsp_messages(tpAniSirGlobal, uint32_t, uint32_t *); 432 void lim_process_sme_del_bss_rsp(tpAniSirGlobal, uint32_t, tpPESession); 433 434 void lim_get_random_bssid(tpAniSirGlobal pMac, uint8_t *data); 435 436 /* Function to handle HT and HT IE CFG parameter intializations */ 437 void handle_ht_capabilityand_ht_info(struct sAniSirGlobal *pMac, 438 tpPESession psessionEntry); 439 440 /* Function to handle CFG parameter updates */ 441 void lim_handle_cf_gparam_update(tpAniSirGlobal, uint32_t); 442 443 void lim_handle_param_update(tpAniSirGlobal pMac, eUpdateIEsType cfgId); 444 445 /* Function to apply CFG parameters before join/reassoc/start BSS */ 446 void lim_apply_configuration(tpAniSirGlobal, tpPESession); 447 448 void lim_set_cfg_protection(tpAniSirGlobal pMac, tpPESession pesessionEntry); 449 450 /* Function to Initialize MLM state machine on STA */ 451 tSirRetStatus lim_init_mlm(tpAniSirGlobal); 452 453 /* Function to cleanup MLM state machine */ 454 void lim_cleanup_mlm(tpAniSirGlobal); 455 456 /* Management frame handling functions */ 457 void lim_process_beacon_frame(tpAniSirGlobal, uint8_t *, tpPESession); 458 void lim_process_probe_req_frame(tpAniSirGlobal, uint8_t *, tpPESession); 459 void lim_process_probe_rsp_frame(tpAniSirGlobal, uint8_t *, tpPESession); 460 void lim_process_probe_req_frame_multiple_bss(tpAniSirGlobal, uint8_t *, 461 tpPESession); 462 463 /* Process Auth frame when we have a session in progress. */ 464 void lim_process_auth_frame(tpAniSirGlobal, uint8_t *, tpPESession); 465 tSirRetStatus lim_process_auth_frame_no_session(tpAniSirGlobal pMac, uint8_t *, 466 void *body); 467 468 void lim_process_assoc_req_frame(tpAniSirGlobal, uint8_t *, uint8_t, tpPESession); 469 void lim_send_mlm_assoc_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, 470 tpPESession psessionEntry); 471 472 void lim_process_assoc_rsp_frame(tpAniSirGlobal, uint8_t *, uint8_t, tpPESession); 473 void lim_process_disassoc_frame(tpAniSirGlobal, uint8_t *, tpPESession); 474 /* 475 * lim_perform_disassoc() - Actual action taken after receiving disassoc 476 * @mac_ctx: Global MAC context 477 * @frame_rssi: RSSI of the frame 478 * @rc: Reason code of the deauth 479 * @pe_session: PE session entry pointer 480 * @addr: BSSID from which the disassoc is received 481 * 482 * Return: None 483 */ 484 void lim_perform_disassoc(tpAniSirGlobal mac_ctx, int32_t frame_rssi, 485 uint16_t rc, tpPESession pe_session, 486 tSirMacAddr addr); 487 /* 488 * lim_disassoc_tdls_peers() - Disassoc action for tdls peers 489 * @mac_ctx: Global MAC context 490 * @pe_session: PE session entry pointer 491 * @addr: BSSID from which the disassoc is received 492 * 493 * Return: None 494 */ 495 #ifdef FEATURE_WLAN_TDLS 496 void lim_disassoc_tdls_peers(tpAniSirGlobal mac_ctx, 497 tpPESession pe_session, tSirMacAddr addr); 498 #else 499 void lim_disassoc_tdls_peers(tpAniSirGlobal mac_ctx, 500 tpPESession pe_session, tSirMacAddr addr) 501 { 502 return; 503 } 504 #endif 505 void lim_process_deauth_frame(tpAniSirGlobal, uint8_t *, tpPESession); 506 /* 507 * lim_perform_deauth() - Actual action taken after receiving deauth 508 * @mac_ctx: Global MAC context 509 * @pe_session: PE session entry pointer 510 * @rc: Reason code of the deauth 511 * @addr: BSSID from which the deauth is received 512 * @frame_rssi: RSSI of the frame 513 * 514 * Return: None 515 */ 516 void lim_perform_deauth(tpAniSirGlobal mac_ctx, tpPESession pe_session, 517 uint16_t rc, tSirMacAddr addr, int32_t frame_rssi); 518 void lim_process_action_frame(tpAniSirGlobal, uint8_t *, tpPESession); 519 void lim_process_action_frame_no_session(tpAniSirGlobal pMac, uint8_t *pRxMetaInfo); 520 521 void lim_populate_p2p_mac_header(tpAniSirGlobal, uint8_t *); 522 void lim_populate_mac_header(tpAniSirGlobal, uint8_t *, uint8_t, uint8_t, 523 tSirMacAddr, tSirMacAddr); 524 tSirRetStatus lim_send_probe_req_mgmt_frame(tpAniSirGlobal, tSirMacSSid *, 525 tSirMacAddr, uint8_t, tSirMacAddr, 526 uint32_t, uint32_t, uint8_t *); 527 void lim_send_probe_rsp_mgmt_frame(tpAniSirGlobal, tSirMacAddr, tpAniSSID, short, 528 uint8_t, tpPESession, uint8_t); 529 void lim_send_auth_mgmt_frame(tpAniSirGlobal, tSirMacAuthFrameBody *, tSirMacAddr, 530 uint8_t, tpPESession); 531 void lim_send_assoc_req_mgmt_frame(tpAniSirGlobal, tLimMlmAssocReq *, tpPESession); 532 #ifdef WLAN_FEATURE_HOST_ROAM 533 void lim_send_reassoc_req_with_ft_ies_mgmt_frame(tpAniSirGlobal pMac, 534 tLimMlmReassocReq *pMlmReassocReq, tpPESession psessionEntry); 535 void lim_send_reassoc_req_mgmt_frame(tpAniSirGlobal, tLimMlmReassocReq *, 536 tpPESession); 537 /** 538 * lim_process_rx_scan_handler() - 539 * process the event for scan which is issued by LIM 540 * @vdev: wlan objmgr vdev pointer 541 * @event: scan event 542 * @arg: global mac context pointer 543 * 544 * Return: void 545 */ 546 void lim_process_rx_scan_handler(struct wlan_objmgr_vdev *vdev, 547 struct scan_event *event, void *arg); 548 #else 549 static inline void lim_send_reassoc_req_with_ft_ies_mgmt_frame( 550 tpAniSirGlobal pMac, tLimMlmReassocReq *pMlmReassocReq, 551 tpPESession psessionEntry) 552 {} 553 static inline void lim_send_reassoc_req_mgmt_frame(tpAniSirGlobal mac_ctx, 554 tLimMlmReassocReq *reassoc_req, tpPESession pe_session) 555 {} 556 static inline void lim_process_rx_scan_handler(struct wlan_objmgr_vdev *vdev, 557 struct scan_event *event, void *arg) 558 {} 559 #endif 560 #ifdef WLAN_FEATURE_11AX_BSS_COLOR 561 /** 562 * lim_process_set_he_bss_color() - process the set he bss color request 563 * 564 * @mac_ctx: global mac context pointer 565 * @msg_buf: message buffer pointer 566 * 567 * Return: void 568 */ 569 void lim_process_set_he_bss_color(tpAniSirGlobal mac_ctx, uint32_t *msg_buf); 570 571 /** 572 * lim_process_obss_color_collision_info() - Process the obss color collision 573 * request. 574 * @mac_ctx: global mac context pointer 575 * @msg_buf: message buffer pointer 576 * 577 * Return: void 578 */ 579 void lim_process_obss_color_collision_info(tpAniSirGlobal mac_ctx, 580 uint32_t *msg_buf); 581 582 /** 583 * lim_send_obss_color_collision_cfg() - Send obss color collision cfg. 584 * @mac_ctx: global mac context pointer 585 * @session: Pointer to session 586 * @event_type: obss color collision detection type 587 * 588 * Return: void 589 */ 590 void lim_send_obss_color_collision_cfg(tpAniSirGlobal mac_ctx, 591 tpPESession session, 592 enum wmi_obss_color_collision_evt_type 593 event_type); 594 #else 595 static inline void lim_process_set_he_bss_color(tpAniSirGlobal mac_ctx, 596 uint32_t *msg_buf) 597 {} 598 static inline void lim_process_obss_color_collision_info(tpAniSirGlobal mac_ctx, 599 uint32_t *msg_buf) 600 {} 601 static inline void lim_send_obss_color_collision_cfg(tpAniSirGlobal mac_ctx, 602 tpPESession session, 603 enum wmi_obss_color_collision_evt_type event_type) 604 {} 605 #endif 606 void lim_send_delts_req_action_frame(tpAniSirGlobal pMac, tSirMacAddr peer, 607 uint8_t wmmTspecPresent, 608 tSirMacTSInfo * pTsinfo, 609 tSirMacTspecIE * pTspecIe, 610 tpPESession psessionEntry); 611 void lim_send_addts_req_action_frame(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, 612 tSirAddtsReqInfo *addts, tpPESession); 613 void lim_send_addts_rsp_action_frame(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, 614 uint16_t statusCode, tSirAddtsReqInfo *addts, 615 tSirMacScheduleIE *pSchedule, tpPESession); 616 617 void lim_send_assoc_rsp_mgmt_frame(tpAniSirGlobal, uint16_t, uint16_t, tSirMacAddr, 618 uint8_t, tpDphHashNode pSta, tpPESession); 619 620 void lim_send_disassoc_mgmt_frame(tpAniSirGlobal, uint16_t, tSirMacAddr, 621 tpPESession, bool waitForAck); 622 void lim_send_deauth_mgmt_frame(tpAniSirGlobal, uint16_t, tSirMacAddr, tpPESession, 623 bool waitForAck); 624 625 void lim_process_mlm_update_hidden_ssid_rsp(tpAniSirGlobal mac_ctx, 626 struct scheduler_msg *msg); 627 628 tSirResultCodes lim_mlm_add_bss(tpAniSirGlobal, tLimMlmStartReq *, 629 tpPESession psessionEntry); 630 631 tSirRetStatus lim_send_channel_switch_mgmt_frame(tpAniSirGlobal, tSirMacAddr, 632 uint8_t, uint8_t, uint8_t, 633 tpPESession); 634 635 tSirRetStatus lim_send_extended_chan_switch_action_frame(tpAniSirGlobal mac_ctx, 636 tSirMacAddr peer, uint8_t mode, uint8_t new_op_class, 637 uint8_t new_channel, uint8_t count, tpPESession session_entry); 638 tSirRetStatus lim_p2p_oper_chan_change_confirm_action_frame( 639 tpAniSirGlobal mac_ctx, tSirMacAddr peer, 640 tpPESession session_entry); 641 642 tSirRetStatus lim_send_vht_opmode_notification_frame(tpAniSirGlobal pMac, 643 tSirMacAddr peer, uint8_t nMode, 644 tpPESession psessionEntry); 645 646 tSirRetStatus lim_send_neighbor_report_request_frame(tpAniSirGlobal, 647 tpSirMacNeighborReportReq, 648 tSirMacAddr, tpPESession); 649 tSirRetStatus lim_send_link_report_action_frame(tpAniSirGlobal, tpSirMacLinkReport, 650 tSirMacAddr, tpPESession); 651 tSirRetStatus lim_send_radio_measure_report_action_frame(tpAniSirGlobal, uint8_t, 652 uint8_t, 653 tpSirMacRadioMeasureReport, 654 tSirMacAddr, tpPESession); 655 656 657 #ifdef FEATURE_WLAN_TDLS 658 void lim_init_tdls_data(tpAniSirGlobal, tpPESession); 659 tSirRetStatus lim_process_sme_tdls_mgmt_send_req(tpAniSirGlobal pMac, 660 uint32_t *pMsgBuf); 661 tSirRetStatus lim_process_sme_tdls_add_sta_req(tpAniSirGlobal pMac, 662 uint32_t *pMsgBuf); 663 tSirRetStatus lim_process_sme_tdls_del_sta_req(tpAniSirGlobal pMac, 664 uint32_t *pMsgBuf); 665 void lim_send_sme_mgmt_tx_completion( 666 tpAniSirGlobal pMac, 667 uint32_t sme_session_id, 668 uint32_t txCompleteStatus); 669 tSirRetStatus lim_delete_tdls_peers(tpAniSirGlobal mac_ctx, 670 tpPESession session_entry); 671 QDF_STATUS lim_process_tdls_add_sta_rsp(tpAniSirGlobal pMac, void *msg, tpPESession); 672 void lim_process_tdls_del_sta_rsp(tpAniSirGlobal mac_ctx, 673 struct scheduler_msg *lim_msg, 674 tpPESession session_entry); 675 #else 676 static inline tSirRetStatus lim_delete_tdls_peers(tpAniSirGlobal mac_ctx, 677 tpPESession session_entry) 678 { 679 return eSIR_SUCCESS; 680 } 681 static inline void lim_init_tdls_data(tpAniSirGlobal pMac, 682 tpPESession pSessionEntry) 683 { 684 685 } 686 #endif 687 688 /* Algorithms & Link Monitoring related functions */ 689 /* / Function that handles heartbeat failure */ 690 void lim_handle_heart_beat_failure(tpAniSirGlobal, tpPESession); 691 692 /* / Function that triggers link tear down with AP upon HB failure */ 693 void lim_tear_down_link_with_ap(tpAniSirGlobal, uint8_t, tSirMacReasonCodes); 694 695 /* / Function that processes Max retries interrupt from TFP */ 696 void limHandleMaxRetriesInterrupt(uint32_t); 697 698 /* / Function that defers the messages received */ 699 uint32_t lim_defer_msg(tpAniSirGlobal, struct scheduler_msg *); 700 701 /* / Function that Switches the Channel and sets the CB Mode */ 702 void lim_set_channel(tpAniSirGlobal pMac, uint8_t channel, 703 uint8_t ch_center_freq_seg0, uint8_t ch_center_freq_seg1, 704 enum phy_ch_width ch_width, int8_t maxTxPower, 705 uint8_t peSessionId, uint32_t cac_duration_ms, 706 uint32_t dfs_regdomain); 707 708 709 #ifdef ANI_SUPPORT_11H 710 /* / Function that sends Measurement Report action frame */ 711 tSirRetStatus lim_send_meas_report_frame(tpAniSirGlobal, tpSirMacMeasReqActionFrame, 712 tSirMacAddr, tpPESession psessionEntry); 713 714 /* / Function that sends TPC Report action frame */ 715 tSirRetStatus lim_send_tpc_report_frame(tpAniSirGlobal, tpSirMacTpcReqActionFrame, 716 tSirMacAddr, tpPESession psessionEntry); 717 #endif 718 719 /* / Function that sends TPC Request action frame */ 720 void lim_send_tpc_request_frame(tpAniSirGlobal, tSirMacAddr, 721 tpPESession psessionEntry); 722 723 /* Function(s) to handle responses received from HAL */ 724 void lim_process_mlm_add_bss_rsp(tpAniSirGlobal pMac, 725 struct scheduler_msg *limMsgQ); 726 void lim_process_mlm_add_sta_rsp(tpAniSirGlobal pMac, 727 struct scheduler_msg *limMsgQt, 728 tpPESession psessionEntry); 729 void lim_process_mlm_del_sta_rsp(tpAniSirGlobal pMac, 730 struct scheduler_msg *limMsgQ); 731 void lim_process_mlm_del_bss_rsp(tpAniSirGlobal pMac, 732 struct scheduler_msg *limMsgQ, 733 tpPESession); 734 void lim_process_sta_mlm_add_sta_rsp(tpAniSirGlobal pMac, 735 struct scheduler_msg *limMsgQ, 736 tpPESession psessionEntry); 737 void lim_process_sta_mlm_del_sta_rsp(tpAniSirGlobal pMac, 738 struct scheduler_msg *limMsgQ, 739 tpPESession psessionEntry); 740 void lim_process_sta_mlm_del_bss_rsp(tpAniSirGlobal pMac, 741 struct scheduler_msg *limMsgQ, 742 tpPESession psessionEntry); 743 void lim_process_mlm_set_sta_key_rsp(tpAniSirGlobal pMac, 744 struct scheduler_msg *limMsgQ); 745 void lim_process_mlm_set_bss_key_rsp(tpAniSirGlobal pMac, 746 struct scheduler_msg *limMsgQ); 747 748 /* Function to process WMA_SWITCH_CHANNEL_RSP message */ 749 void lim_process_switch_channel_rsp(tpAniSirGlobal pMac, void *); 750 751 void lim_covert_channel_scan_type(tpAniSirGlobal pMac, uint8_t channelNum, 752 bool passiveToActive); 753 void lim_set_dfs_channel_list(tpAniSirGlobal pMac, uint8_t channelNum, 754 tSirDFSChannelList *dfsChannelList); 755 void limContinueChannelLearn(tpAniSirGlobal); 756 /* WLAN_SUSPEND_LINK Related */ 757 uint8_t lim_is_link_suspended(tpAniSirGlobal pMac); 758 /* end WLAN_SUSPEND_LINK Related */ 759 760 #ifdef WLAN_FEATURE_11W 761 /* 11w send SA query request action frame */ 762 tSirRetStatus lim_send_sa_query_request_frame(tpAniSirGlobal pMac, uint8_t *transId, 763 tSirMacAddr peer, 764 tpPESession psessionEntry); 765 /* 11w SA query request action frame handler */ 766 tSirRetStatus lim_send_sa_query_response_frame(tpAniSirGlobal pMac, 767 uint8_t *transId, tSirMacAddr peer, 768 tpPESession psessionEntry); 769 #endif 770 771 /* Inline functions */ 772 773 /** 774 * lim_post_sme_message() 775 * 776 ***FUNCTION: 777 * This function is called by limProcessMlmMessages(). In this 778 * function MLM sub-module invokes MLM ind/cnf primitives. 779 * 780 ***LOGIC: 781 * Initially MLM makes an SME function call to invoke MLM ind/cnf 782 * primitive. In future this can be enhanced to 'post' messages to SME. 783 * 784 ***ASSUMPTIONS: 785 * NA 786 * 787 ***NOTE: 788 * NA 789 * 790 * @param pMac Pointer to Global MAC structure 791 * @param msgType Indicates the MLM primitive message type 792 * @param *pMsgBuf A pointer to the MLM message buffer 793 * 794 * @return None 795 */ 796 static inline void 797 lim_post_sme_message(tpAniSirGlobal pMac, uint32_t msgType, uint32_t *pMsgBuf) 798 { 799 struct scheduler_msg msg = {0}; 800 801 if (pMsgBuf == NULL) { 802 pe_err("Buffer is Pointing to NULL"); 803 return; 804 } 805 806 msg.type = (uint16_t) msgType; 807 msg.bodyptr = pMsgBuf; 808 msg.bodyval = 0; 809 if (msgType > eWNI_SME_MSG_TYPES_BEGIN) { 810 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, 811 msg.type)); 812 lim_process_sme_req_messages(pMac, &msg); 813 } else { 814 lim_process_mlm_rsp_messages(pMac, msgType, pMsgBuf); 815 } 816 } /*** end lim_post_sme_message() ***/ 817 818 /** 819 * lim_post_mlm_message() 820 * 821 ***FUNCTION: 822 * This function is called by limProcessSmeMessages(). In this 823 * function SME invokes MLME primitives. 824 * 825 ***PARAMS: 826 * 827 ***LOGIC: 828 * Initially SME makes an MLM function call to invoke MLM primitive. 829 * In future this can be enhanced to 'post' messages to MLM. 830 * 831 ***ASSUMPTIONS: 832 * NA 833 * 834 ***NOTE: 835 * NA 836 * 837 * @param pMac Pointer to Global MAC structure 838 * @param msgType Indicates the MLM primitive message type 839 * @param *pMsgBuf A pointer to the MLM message buffer 840 * 841 * @return None 842 */ 843 static inline void 844 lim_post_mlm_message(tpAniSirGlobal pMac, uint32_t msgType, uint32_t *pMsgBuf) 845 { 846 struct scheduler_msg msg = {0}; 847 848 if (pMsgBuf == NULL) { 849 pe_err("Buffer is Pointing to NULL"); 850 return; 851 } 852 msg.type = (uint16_t) msgType; 853 msg.bodyptr = pMsgBuf; 854 msg.bodyval = 0; 855 MTRACE(mac_trace_msg_rx(pMac, NO_SESSION, msg.type)); 856 lim_process_mlm_req_messages(pMac, &msg); 857 } /*** end lim_post_mlm_message() ***/ 858 859 /** 860 * lim_get_ielen_from_bss_description() 861 * 862 ***FUNCTION: 863 * This function is called in various places to get IE length 864 * from tSirBssDescription structure 865 * number being scanned. 866 * 867 ***PARAMS: 868 * 869 ***LOGIC: 870 * 871 ***ASSUMPTIONS: 872 * NA 873 * 874 ***NOTE: 875 * NA 876 * 877 * @param pBssDescr 878 * @return Total IE length 879 */ 880 881 static inline uint16_t 882 lim_get_ielen_from_bss_description(tpSirBssDescription pBssDescr) 883 { 884 uint16_t ielen; 885 886 if (!pBssDescr) 887 return 0; 888 889 /* 890 * Length of BSS desription is without length of 891 * length itself and length of pointer 892 * that holds ieFields 893 * 894 * <------------sizeof(tSirBssDescription)--------------------> 895 * +--------+---------------------------------+---------------+ 896 * | length | other fields | pointer to IEs| 897 * +--------+---------------------------------+---------------+ 898 * ^ 899 * ieFields 900 */ 901 902 ielen = (uint16_t)(pBssDescr->length + sizeof(pBssDescr->length) - 903 GET_FIELD_OFFSET(tSirBssDescription, ieFields)); 904 905 return ielen; 906 } /*** end lim_get_ielen_from_bss_description() ***/ 907 908 /** 909 * lim_send_beacon_ind() 910 * 911 ***FUNCTION: 912 * This function is called to send the beacon indication 913 * number being scanned. 914 * 915 ***PARAMS: 916 * 917 ***LOGIC: 918 * 919 ***ASSUMPTIONS: 920 */ 921 922 void lim_send_beacon_ind(tpAniSirGlobal pMac, tpPESession psessionEntry); 923 924 void 925 lim_send_vdev_restart(tpAniSirGlobal pMac, tpPESession psessionEntry, 926 uint8_t sessionId); 927 928 void lim_get_wpspbc_sessions(tpAniSirGlobal pMac, struct qdf_mac_addr addr, 929 uint8_t *uuid_e, eWPSPBCOverlap *overlap, 930 tpPESession psessionEntry); 931 void limWPSPBCTimeout(tpAniSirGlobal pMac, tpPESession psessionEntry); 932 void lim_wpspbc_close(tpAniSirGlobal pMac, tpPESession psessionEntry); 933 void lim_remove_pbc_sessions(tpAniSirGlobal pMac, 934 struct qdf_mac_addr pRemoveMac, 935 tpPESession psessionEntry); 936 937 #define LIM_WPS_OVERLAP_TIMER_MS 10000 938 void 939 lim_change_channel_with_callback(tpAniSirGlobal pMac, uint8_t newChannel, 940 CHANGE_CHANNEL_CALLBACK callback, 941 uint32_t *cbdata, tpPESession psessionEntry); 942 943 void lim_send_sme_mgmt_frame_ind(tpAniSirGlobal pMac, uint8_t frameType, 944 uint8_t *frame, uint32_t frameLen, 945 uint16_t sessionId, uint32_t rxChan, 946 tpPESession psessionEntry, int8_t rxRssi); 947 void lim_process_remain_on_chn_timeout(tpAniSirGlobal pMac); 948 void lim_process_insert_single_shot_noa_timeout(tpAniSirGlobal pMac); 949 void lim_convert_active_channel_to_passive_channel(tpAniSirGlobal pMac); 950 void lim_send_p2p_action_frame(tpAniSirGlobal pMac, struct scheduler_msg *pMsg); 951 void lim_process_regd_defd_sme_req_after_noa_start(tpAniSirGlobal pMac); 952 953 void lim_process_disassoc_ack_timeout(tpAniSirGlobal pMac); 954 void lim_process_deauth_ack_timeout(tpAniSirGlobal pMac); 955 QDF_STATUS lim_send_disassoc_cnf(tpAniSirGlobal pMac); 956 QDF_STATUS lim_send_deauth_cnf(tpAniSirGlobal pMac); 957 958 /** 959 * lim_disassoc_tx_complete_cnf() - callback to indicate Tx completion 960 * @context: pointer to mac structure 961 * @txCompleteSuccess: indicates tx success/failure 962 * @params: tx completion params 963 * 964 * function will be invoked on receiving tx completion indication 965 * 966 * return: success: QDF_STATUS_SUCCESS failure: QDF_STATUS_E_FAILURE 967 */ 968 QDF_STATUS lim_disassoc_tx_complete_cnf(void *context, 969 uint32_t txCompleteSuccess, 970 void *params); 971 972 /** 973 * lim_deauth_tx_complete_cnf() - callback to indicate Tx completion 974 * @context: pointer to mac structure 975 * @txCompleteSuccess: indicates tx success/failure 976 * @params: tx completion params 977 * 978 * function will be invoked on receiving tx completion indication 979 * 980 * return: success: QDF_STATUS_SUCCESS failure: QDF_STATUS_E_FAILURE 981 */ 982 QDF_STATUS lim_deauth_tx_complete_cnf(void *context, 983 uint32_t txCompleteSuccess, 984 void *params); 985 986 typedef struct sSetLinkCbackParams { 987 void *cbackDataPtr; 988 } tSetLinkCbackParams; 989 990 int lim_process_remain_on_chnl_req(tpAniSirGlobal pMac, uint32_t *pMsg); 991 void lim_remain_on_chn_rsp(tpAniSirGlobal pMac, QDF_STATUS status, uint32_t *data); 992 void lim_send_sme_disassoc_deauth_ntf(tpAniSirGlobal mac_ctx, 993 QDF_STATUS status, uint32_t *ctx); 994 995 #ifdef FEATURE_WLAN_TDLS 996 tSirRetStatus lim_process_sme_del_all_tdls_peers(tpAniSirGlobal p_mac, 997 uint32_t *msg_buf); 998 #else 999 static inline 1000 tSirRetStatus lim_process_sme_del_all_tdls_peers(tpAniSirGlobal p_mac, 1001 uint32_t *msg_buf) 1002 { 1003 return eSIR_SUCCESS; 1004 } 1005 #endif 1006 1007 /** 1008 * lim_process_rx_channel_status_event() - processes 1009 * event WDA_RX_CHN_STATUS_EVENT 1010 * @mac_ctx Pointer to Global MAC structure 1011 * @buf: Received message info 1012 * 1013 * Return: None 1014 */ 1015 void lim_process_rx_channel_status_event(tpAniSirGlobal mac_ctx, void *buf); 1016 1017 /* / Bit value data structure */ 1018 typedef enum sHalBitVal /* For Bit operations */ 1019 { 1020 eHAL_CLEAR, 1021 eHAL_SET 1022 } tHalBitVal; 1023 1024 enum { 1025 eHI_PRI, 1026 ePROT, 1027 eDBG 1028 }; 1029 1030 QDF_STATUS lim_send_addba_response_frame(tpAniSirGlobal mac_ctx, 1031 tSirMacAddr peer_mac, uint16_t tid, 1032 tpPESession session, uint8_t addba_extn_present); 1033 /** 1034 * lim_process_join_failure_timeout() - This function is called to process 1035 * JoinFailureTimeout 1036 * 1037 * @mac_ctx: Pointer to Global MAC structure 1038 * 1039 * This function is called to process JoinFailureTimeout 1040 * 1041 * @Return None 1042 */ 1043 void lim_process_join_failure_timeout(tpAniSirGlobal mac_ctx); 1044 1045 /** 1046 * lim_process_auth_failure_timeout() - This function is called to process Min 1047 * Channel Timeout during channel scan. 1048 * 1049 * @mac_ctx: Pointer to Global MAC structure 1050 * 1051 * This function is called to process Min Channel Timeout during channel scan. 1052 * 1053 * @Return: None 1054 */ 1055 void lim_process_auth_failure_timeout(tpAniSirGlobal mac_ctx); 1056 1057 /** 1058 * lim_process_assoc_failure_timeout() - This function is called to process Min 1059 * Channel Timeout during channel scan. 1060 * 1061 * @mac_ctx: Pointer to Global MAC structure 1062 * @msg_type: Assoc or reassoc 1063 * 1064 * This function is called to process Min Channel Timeout during channel scan. 1065 * 1066 * @Return: None 1067 */ 1068 void lim_process_assoc_failure_timeout(tpAniSirGlobal mac_ctx, 1069 uint32_t msg_type); 1070 1071 /** 1072 * lim_send_mgmt_frame_tx() - Sends mgmt frame 1073 * @mac_ctx Pointer to Global MAC structure 1074 * @msg: Received message info 1075 * 1076 * Return: None 1077 */ 1078 void lim_send_mgmt_frame_tx(tpAniSirGlobal mac_ctx, 1079 struct scheduler_msg *msg); 1080 1081 #endif /* __LIM_TYPES_H */ 1082