Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011-2015 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 ProcessMessageQueue.cc contains the code |
| 30 | * for processing LIM message Queue. |
| 31 | * Author: Chandra Modumudi |
| 32 | * Date: 02/11/02 |
| 33 | * History:- |
| 34 | * Date Modified by Modification Information |
| 35 | * -------------------------------------------------------------------- |
| 36 | * |
| 37 | */ |
| 38 | #include "cds_api.h" |
| 39 | #include "wni_api.h" |
| 40 | #include "wma_types.h" |
| 41 | |
| 42 | #include "wni_cfg.h" |
| 43 | #include "cfg_api.h" |
| 44 | #include "sir_common.h" |
| 45 | #include "utils_api.h" |
| 46 | #include "lim_types.h" |
| 47 | #include "lim_utils.h" |
| 48 | #include "lim_assoc_utils.h" |
| 49 | #include "lim_prop_exts_utils.h" |
| 50 | |
| 51 | #include "lim_admit_control.h" |
| 52 | #include "lim_ibss_peer_mgmt.h" |
| 53 | #include "sch_api.h" |
| 54 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 55 | #include "lim_ft_defs.h" |
| 56 | #endif |
| 57 | #include "lim_session.h" |
| 58 | #include "lim_send_messages.h" |
| 59 | |
| 60 | #if defined WLAN_FEATURE_VOWIFI |
| 61 | #include "rrm_api.h" |
| 62 | #endif |
| 63 | |
| 64 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 65 | #include "lim_ft.h" |
| 66 | #endif |
| 67 | |
| 68 | #include "cdf_types.h" |
| 69 | #include "cds_packet.h" |
| 70 | #include "cdf_memory.h" |
| 71 | |
| 72 | void lim_log_session_states(tpAniSirGlobal pMac); |
| 73 | static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx, |
| 74 | struct sSirMsgQ *msg, uint8_t rsp_reqd); |
| 75 | |
| 76 | /** |
| 77 | * lim_process_dual_mac_cfg_resp() - Process set dual mac config response |
| 78 | * @mac: Global MAC pointer |
| 79 | * @body: Set dual mac config response in sir_dual_mac_config_resp format |
| 80 | * |
| 81 | * Process the set dual mac config response and post the message |
| 82 | * to SME to process this further and release the active |
| 83 | * command list |
| 84 | * |
| 85 | * Return: None |
| 86 | */ |
| 87 | static void lim_process_dual_mac_cfg_resp(tpAniSirGlobal mac, void *body) |
| 88 | { |
| 89 | struct sir_dual_mac_config_resp *resp, *param; |
| 90 | uint32_t len, fail_resp = 0; |
| 91 | tSirMsgQ msg; |
| 92 | |
| 93 | resp = (struct sir_dual_mac_config_resp *)body; |
| 94 | if (!resp) { |
| 95 | lim_log(mac, LOGE, FL("Set dual mac cfg param is NULL")); |
| 96 | fail_resp = 1; |
| 97 | /* Not returning here. If possible, let us proceed |
| 98 | * and send fail response to SME |
| 99 | */ |
| 100 | } |
| 101 | |
| 102 | len = sizeof(*param); |
| 103 | |
| 104 | param = cdf_mem_malloc(len); |
| 105 | if (!param) { |
| 106 | lim_log(mac, LOGE, FL("Fail to allocate memory")); |
| 107 | /* Memory allocation for param failed. |
| 108 | * Cannot send fail status back to SME |
| 109 | */ |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | if (fail_resp) { |
| 114 | lim_log(mac, LOGE, FL("Send fail status to SME")); |
| 115 | param->status = SET_HW_MODE_STATUS_ECANCELED; |
| 116 | } else { |
| 117 | param->status = resp->status; |
| 118 | /* |
| 119 | * TODO: Update this HW mode info in any UMAC params, if needed |
| 120 | */ |
| 121 | } |
| 122 | |
| 123 | msg.type = eWNI_SME_SET_DUAL_MAC_CFG_RESP; |
| 124 | msg.bodyptr = param; |
| 125 | msg.bodyval = 0; |
| 126 | lim_log(mac, LOG1, FL("Send eWNI_SME_SET_DUAL_MAC_CFG_RESP to SME")); |
| 127 | lim_sys_process_mmh_msg_api(mac, &msg, ePROT); |
| 128 | return; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * lim_process_set_hw_mode_resp() - Process set HW mode response |
| 133 | * @mac: Global MAC pointer |
| 134 | * @body: Set HW mode response in sir_set_hw_mode_resp format |
| 135 | * |
| 136 | * Process the set HW mode response and post the message |
| 137 | * to SME to process this further and release the active |
| 138 | * command list |
| 139 | * |
| 140 | * Return: None |
| 141 | */ |
| 142 | static void lim_process_set_hw_mode_resp(tpAniSirGlobal mac, void *body) |
| 143 | { |
| 144 | struct sir_set_hw_mode_resp *resp, *param; |
| 145 | uint32_t len, i, fail_resp = 0; |
| 146 | tSirMsgQ msg; |
| 147 | |
| 148 | resp = (struct sir_set_hw_mode_resp *)body; |
| 149 | if (!resp) { |
| 150 | lim_log(mac, LOGE, FL("Set HW mode param is NULL")); |
| 151 | fail_resp = 1; |
| 152 | /* Not returning here. If possible, let us proceed |
| 153 | * and send fail response to SME */ |
| 154 | } |
| 155 | |
| 156 | len = sizeof(*param); |
| 157 | |
| 158 | param = cdf_mem_malloc(len); |
| 159 | if (!param) { |
| 160 | lim_log(mac, LOGE, FL("Fail to allocate memory")); |
| 161 | /* Memory allocation for param failed. |
| 162 | * Cannot send fail status back to SME |
| 163 | */ |
| 164 | return; |
| 165 | } |
| 166 | |
| 167 | if (fail_resp) { |
| 168 | lim_log(mac, LOGE, FL("Send fail status to SME")); |
| 169 | param->status = SET_HW_MODE_STATUS_ECANCELED; |
| 170 | param->cfgd_hw_mode_index = 0; |
| 171 | param->num_vdev_mac_entries = 0; |
| 172 | } else { |
| 173 | param->status = resp->status; |
| 174 | param->cfgd_hw_mode_index = resp->cfgd_hw_mode_index; |
| 175 | param->num_vdev_mac_entries = resp->num_vdev_mac_entries; |
| 176 | |
| 177 | for (i = 0; i < resp->num_vdev_mac_entries; i++) { |
| 178 | param->vdev_mac_map[i].vdev_id = |
| 179 | resp->vdev_mac_map[i].vdev_id; |
| 180 | param->vdev_mac_map[i].mac_id = |
| 181 | resp->vdev_mac_map[i].mac_id; |
| 182 | } |
| 183 | /* |
| 184 | * TODO: Update this HW mode info in any UMAC params, if needed |
| 185 | */ |
| 186 | } |
| 187 | |
| 188 | msg.type = eWNI_SME_SET_HW_MODE_RESP; |
| 189 | msg.bodyptr = param; |
| 190 | msg.bodyval = 0; |
| 191 | lim_log(mac, LOGE, FL("Send eWNI_SME_SET_HW_MODE_RESP to SME")); |
| 192 | lim_sys_process_mmh_msg_api(mac, &msg, ePROT); |
| 193 | return; |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * lim_process_hw_mode_trans_ind() - Process set HW mode transition indication |
| 198 | * @mac: Global MAC pointer |
| 199 | * @body: Set HW mode response in sir_hw_mode_trans_ind format |
| 200 | * |
| 201 | * Process the set HW mode transition indication and post the message |
| 202 | * to SME to invoke the HDD callback |
| 203 | * command list |
| 204 | * |
| 205 | * Return: None |
| 206 | */ |
| 207 | static void lim_process_hw_mode_trans_ind(tpAniSirGlobal mac, void *body) |
| 208 | { |
| 209 | struct sir_hw_mode_trans_ind *ind, *param; |
| 210 | uint32_t len, i; |
| 211 | tSirMsgQ msg; |
| 212 | |
| 213 | ind = (struct sir_hw_mode_trans_ind *)body; |
| 214 | if (!ind) { |
| 215 | lim_log(mac, LOGE, FL("Set HW mode trans ind param is NULL")); |
| 216 | return; |
| 217 | } |
| 218 | |
| 219 | len = sizeof(*param); |
| 220 | |
| 221 | param = cdf_mem_malloc(len); |
| 222 | if (!param) { |
| 223 | lim_log(mac, LOGE, FL("Fail to allocate memory")); |
| 224 | return; |
| 225 | } |
| 226 | |
| 227 | param->old_hw_mode_index = ind->old_hw_mode_index; |
| 228 | param->new_hw_mode_index = ind->new_hw_mode_index; |
| 229 | param->num_vdev_mac_entries = ind->num_vdev_mac_entries; |
| 230 | |
| 231 | for (i = 0; i < ind->num_vdev_mac_entries; i++) { |
| 232 | param->vdev_mac_map[i].vdev_id = |
| 233 | ind->vdev_mac_map[i].vdev_id; |
| 234 | param->vdev_mac_map[i].mac_id = |
| 235 | ind->vdev_mac_map[i].mac_id; |
| 236 | } |
| 237 | |
| 238 | /* TODO: Update this HW mode info in any UMAC params, if needed */ |
| 239 | |
| 240 | msg.type = eWNI_SME_HW_MODE_TRANS_IND; |
| 241 | msg.bodyptr = param; |
| 242 | msg.bodyval = 0; |
| 243 | lim_log(mac, LOGE, FL("Send eWNI_SME_HW_MODE_TRANS_IND to SME")); |
| 244 | lim_sys_process_mmh_msg_api(mac, &msg, ePROT); |
| 245 | return; |
| 246 | } |
| 247 | |
| 248 | /** ------------------------------------------------------------- |
| 249 | \fn def_msg_decision |
| 250 | \brief The function decides whether to defer a message or not in limProcessMessage function |
| 251 | \param tpAniSirGlobal pMac |
| 252 | \param tSirMsgQ limMsg |
| 253 | \param tSirMacTspecIE *ppInfo |
| 254 | \return none |
| 255 | -------------------------------------------------------------*/ |
| 256 | |
| 257 | uint8_t static def_msg_decision(tpAniSirGlobal pMac, tpSirMsgQ limMsg) |
| 258 | { |
| 259 | |
| 260 | /* this function should not changed */ |
| 261 | if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) { |
| 262 | /* Defer processsing this message */ |
| 263 | if (lim_defer_msg(pMac, limMsg) != TX_SUCCESS) { |
| 264 | CDF_TRACE(CDF_MODULE_ID_PE, LOGE, |
| 265 | FL("Unable to Defer Msg")); |
| 266 | lim_log_session_states(pMac); |
| 267 | lim_handle_defer_msg_error(pMac, limMsg); |
| 268 | } |
| 269 | return true; |
| 270 | } |
| 271 | /* When defer is requested then defer all the messages except HAL responses. */ |
| 272 | if ((!lim_is_system_in_scan_state(pMac)) |
| 273 | && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) |
| 274 | && !pMac->lim.gLimSystemInScanLearnMode) { |
| 275 | if ((limMsg->type != WMA_ADD_BSS_RSP) |
| 276 | && (limMsg->type != WMA_DELETE_BSS_RSP) |
| 277 | && (limMsg->type != WMA_ADD_STA_RSP) |
| 278 | && (limMsg->type != WMA_DELETE_STA_RSP) |
| 279 | && (limMsg->type != WMA_SET_BSSKEY_RSP) |
| 280 | && (limMsg->type != WMA_SET_STAKEY_RSP) |
| 281 | && (limMsg->type != WMA_SET_STA_BCASTKEY_RSP) |
| 282 | && (limMsg->type != WMA_AGGR_QOS_RSP) |
| 283 | && (limMsg->type != WMA_SET_MIMOPS_RSP) |
| 284 | && (limMsg->type != WMA_SWITCH_CHANNEL_RSP) |
| 285 | && (limMsg->type != WMA_P2P_NOA_ATTR_IND) |
| 286 | && (limMsg->type != WMA_P2P_NOA_START_IND) && |
| 287 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 288 | (limMsg->type != WMA_START_OEM_DATA_RSP) && |
| 289 | #endif |
| 290 | (limMsg->type != WMA_ADD_TS_RSP)) { |
| 291 | PELOG1(lim_log |
| 292 | (pMac, LOG1, |
| 293 | FL |
| 294 | ("Defer the current message %s , gLimProcessDefdMsgs is false and system is not in scan/learn mode"), |
| 295 | lim_msg_str(limMsg->type)); |
| 296 | ) |
| 297 | /* Defer processsing this message */ |
| 298 | if (lim_defer_msg(pMac, limMsg) != TX_SUCCESS) { |
| 299 | CDF_TRACE(CDF_MODULE_ID_PE, LOGE, |
| 300 | FL("Unable to Defer Msg")); |
| 301 | lim_log_session_states(pMac); |
| 302 | lim_handle_defer_msg_error(pMac, limMsg); |
| 303 | |
| 304 | } |
| 305 | return true; |
| 306 | } |
| 307 | } |
| 308 | return false; |
| 309 | } |
| 310 | |
| 311 | #ifdef FEATURE_WLAN_EXTSCAN |
| 312 | static void |
| 313 | __lim_pno_match_fwd_bcn_probepsp(tpAniSirGlobal pmac, uint8_t *rx_pkt_info, |
| 314 | tSirProbeRespBeacon *frame, uint32_t ie_len, |
| 315 | uint32_t msg_type) |
| 316 | { |
| 317 | struct pno_match_found *result; |
| 318 | uint8_t *body; |
| 319 | tSirMsgQ mmh_msg; |
| 320 | tpSirMacMgmtHdr hdr; |
| 321 | uint32_t num_results = 1, len, i; |
| 322 | |
| 323 | /* Upon receiving every matched beacon, bss info is forwarded to the |
| 324 | * the upper layer, hence num_results is set to 1 */ |
| 325 | len = sizeof(*result) + (num_results * sizeof(tSirWifiScanResult)) + |
| 326 | ie_len; |
| 327 | |
| 328 | result = cdf_mem_malloc(len); |
| 329 | if (NULL == result) { |
| 330 | lim_log(pmac, LOGE, FL("Memory allocation failed")); |
| 331 | return; |
| 332 | } |
| 333 | hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 334 | body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 335 | cdf_mem_zero(result, sizeof(*result) + ie_len); |
| 336 | |
| 337 | /* Received frame does not have request id, hence set 0 */ |
| 338 | result->request_id = 0; |
| 339 | result->more_data = 0; |
| 340 | result->num_results = num_results; |
| 341 | |
| 342 | for (i = 0; i < result->num_results; i++) { |
| 343 | result->ap[i].ts = cdf_mc_timer_get_system_time(); |
| 344 | result->ap[i].beaconPeriod = frame->beaconInterval; |
| 345 | result->ap[i].capability = |
| 346 | lim_get_u16((uint8_t *) &frame->capabilityInfo); |
| 347 | result->ap[i].channel = WMA_GET_RX_CH(rx_pkt_info); |
| 348 | result->ap[i].rssi = WMA_GET_RX_RSSI_DB(rx_pkt_info); |
| 349 | result->ap[i].rtt = 0; |
| 350 | result->ap[i].rtt_sd = 0; |
| 351 | result->ap[i].ieLength = ie_len; |
| 352 | cdf_mem_copy((uint8_t *) &result->ap[i].ssid[0], |
| 353 | (uint8_t *) frame->ssId.ssId, frame->ssId.length); |
| 354 | result->ap[i].ssid[frame->ssId.length] = '\0'; |
| 355 | cdf_mem_copy((uint8_t *) &result->ap[i].bssid, |
| 356 | (uint8_t *) hdr->bssId, |
| 357 | sizeof(tSirMacAddr)); |
| 358 | /* Copy IE fields */ |
| 359 | cdf_mem_copy((uint8_t *) &result->ap[i].ieData, |
| 360 | body + SIR_MAC_B_PR_SSID_OFFSET, ie_len); |
| 361 | } |
| 362 | |
| 363 | mmh_msg.type = msg_type; |
| 364 | mmh_msg.bodyptr = result; |
| 365 | mmh_msg.bodyval = 0; |
| 366 | lim_sys_process_mmh_msg_api(pmac, &mmh_msg, ePROT); |
| 367 | } |
| 368 | |
| 369 | |
| 370 | static void |
| 371 | __lim_ext_scan_forward_bcn_probe_rsp(tpAniSirGlobal pmac, uint8_t *rx_pkt_info, |
| 372 | tSirProbeRespBeacon *frame, |
| 373 | uint32_t ie_len, |
| 374 | uint32_t msg_type) |
| 375 | { |
| 376 | tpSirWifiFullScanResultEvent result; |
| 377 | uint8_t *body; |
| 378 | tSirMsgQ mmh_msg; |
| 379 | tpSirMacMgmtHdr hdr; |
| 380 | |
| 381 | result = cdf_mem_malloc(sizeof(*result) + ie_len); |
| 382 | if (NULL == result) { |
| 383 | lim_log(pmac, LOGE, FL("Memory allocation failed")); |
| 384 | return; |
| 385 | } |
| 386 | hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 387 | body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 388 | cdf_mem_zero(result, sizeof(*result) + ie_len); |
| 389 | |
| 390 | /* Received frame does not have request id, hence set 0 */ |
| 391 | result->requestId = 0; |
| 392 | |
| 393 | result->moreData = 0; |
| 394 | result->ap.ts = cdf_mc_timer_get_system_time(); |
| 395 | result->ap.beaconPeriod = frame->beaconInterval; |
| 396 | result->ap.capability = |
| 397 | lim_get_u16((uint8_t *) &frame->capabilityInfo); |
| 398 | result->ap.channel = WMA_GET_RX_CH(rx_pkt_info); |
| 399 | result->ap.rssi = WMA_GET_RX_RSSI_DB(rx_pkt_info); |
| 400 | result->ap.rtt = 0; |
| 401 | result->ap.rtt_sd = 0; |
| 402 | result->ap.ieLength = ie_len; |
| 403 | |
| 404 | cdf_mem_copy((uint8_t *) &result->ap.ssid[0], |
| 405 | (uint8_t *) frame->ssId.ssId, frame->ssId.length); |
| 406 | result->ap.ssid[frame->ssId.length] = '\0'; |
| 407 | cdf_mem_copy((uint8_t *) &result->ap.bssid.bytes, |
| 408 | (uint8_t *) hdr->bssId, |
| 409 | CDF_MAC_ADDR_SIZE); |
| 410 | /* Copy IE fields */ |
| 411 | cdf_mem_copy((uint8_t *) &result->ap.ieData, |
| 412 | body + SIR_MAC_B_PR_SSID_OFFSET, ie_len); |
| 413 | |
| 414 | mmh_msg.type = msg_type; |
| 415 | mmh_msg.bodyptr = result; |
| 416 | mmh_msg.bodyval = 0; |
| 417 | lim_sys_process_mmh_msg_api(pmac, &mmh_msg, ePROT); |
| 418 | } |
| 419 | |
| 420 | static void |
| 421 | __lim_process_ext_scan_beacon_probe_rsp(tpAniSirGlobal pmac, |
| 422 | uint8_t *rx_pkt_info, |
| 423 | uint8_t sub_type) |
| 424 | { |
| 425 | tSirProbeRespBeacon *frame; |
| 426 | uint8_t *body; |
| 427 | uint32_t frm_len; |
| 428 | tSirRetStatus status; |
| 429 | |
| 430 | frm_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 431 | if (frm_len <= SIR_MAC_B_PR_SSID_OFFSET) { |
| 432 | lim_log(pmac, LOGP, |
| 433 | FL("RX packet has invalid length %d"), frm_len); |
| 434 | return; |
| 435 | } |
| 436 | |
| 437 | frame = cdf_mem_malloc(sizeof(*frame)); |
| 438 | if (NULL == frame) { |
| 439 | lim_log(pmac, LOGE, FL("Memory allocation failed")); |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | if (sub_type == SIR_MAC_MGMT_BEACON) { |
| 444 | lim_log(pmac, LOG2, FL("Beacon due to ExtScan/epno")); |
| 445 | status = sir_convert_beacon_frame2_struct(pmac, |
| 446 | (uint8_t *)rx_pkt_info, |
| 447 | frame); |
| 448 | } else if (sub_type == SIR_MAC_MGMT_PROBE_RSP) { |
| 449 | lim_log(pmac, LOG2, FL("Probe Rsp due to ExtScan/epno")); |
| 450 | body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 451 | status = sir_convert_probe_frame2_struct(pmac, body, |
| 452 | frm_len, frame); |
| 453 | } else { |
| 454 | cdf_mem_free(frame); |
| 455 | return; |
| 456 | } |
| 457 | |
| 458 | if (status != eSIR_SUCCESS) { |
| 459 | lim_log(pmac, LOGE, FL("Frame parsing failed")); |
| 460 | cdf_mem_free(frame); |
| 461 | return; |
| 462 | } |
| 463 | |
| 464 | if (WMA_IS_EXTSCAN_SCAN_SRC(rx_pkt_info)) |
| 465 | __lim_ext_scan_forward_bcn_probe_rsp(pmac, rx_pkt_info, frame, |
| 466 | (frm_len - SIR_MAC_B_PR_SSID_OFFSET), |
| 467 | eWNI_SME_EXTSCAN_FULL_SCAN_RESULT_IND); |
| 468 | |
| 469 | if (WMA_IS_EPNO_SCAN_SRC(rx_pkt_info)) |
| 470 | __lim_pno_match_fwd_bcn_probepsp(pmac, rx_pkt_info, frame, |
| 471 | (frm_len - SIR_MAC_B_PR_SSID_OFFSET), |
| 472 | eWNI_SME_EPNO_NETWORK_FOUND_IND); |
| 473 | |
| 474 | cdf_mem_free(frame); |
| 475 | } |
| 476 | #endif |
| 477 | |
| 478 | /* |
| 479 | * Beacon Handling Cases: |
| 480 | * during scanning, when no session is active: |
| 481 | * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked. |
| 482 | * during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null. |
| 483 | * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked. |
| 484 | * during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null. |
| 485 | * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked. |
| 486 | * Not scanning, no session: |
| 487 | * there should not be any beacon coming, if coming, should be dropped. |
| 488 | * Not Scanning, |
| 489 | */ |
| 490 | static void |
| 491 | __lim_handle_beacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, |
| 492 | tpPESession psessionEntry) |
| 493 | { |
| 494 | /* checking for global SME state... */ |
| 495 | uint8_t *pRxPacketInfo; |
| 496 | lim_get_b_dfrom_rx_packet(pMac, pMsg->bodyptr, |
| 497 | (uint32_t * *) &pRxPacketInfo); |
| 498 | |
| 499 | /* This function should not be called if beacon is received in scan state. */ |
| 500 | /* So not doing any checks for the global state. */ |
| 501 | |
| 502 | if (psessionEntry == NULL) { |
| 503 | sch_beacon_process(pMac, pRxPacketInfo, NULL); |
| 504 | } else if ((psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) || |
| 505 | (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)) { |
| 506 | sch_beacon_process(pMac, pRxPacketInfo, psessionEntry); |
| 507 | } else |
| 508 | lim_process_beacon_frame(pMac, pRxPacketInfo, psessionEntry); |
| 509 | |
| 510 | return; |
| 511 | } |
| 512 | |
| 513 | /** |
| 514 | * lim_defer_msg() |
| 515 | * |
| 516 | ***FUNCTION: |
| 517 | * This function is called to defer the messages received |
| 518 | * during Learn mode |
| 519 | * |
| 520 | ***LOGIC: |
| 521 | * NA |
| 522 | * |
| 523 | ***ASSUMPTIONS: |
| 524 | * NA |
| 525 | * |
| 526 | ***NOTE: |
| 527 | * NA |
| 528 | * |
| 529 | * @param pMac - Pointer to Global MAC structure |
| 530 | * @param pMsg of type tSirMsgQ - Pointer to the message structure |
| 531 | * @return None |
| 532 | */ |
| 533 | |
| 534 | uint32_t lim_defer_msg(tpAniSirGlobal pMac, tSirMsgQ *pMsg) |
| 535 | { |
| 536 | uint32_t retCode = TX_SUCCESS; |
| 537 | |
| 538 | retCode = lim_write_deferred_msg_q(pMac, pMsg); |
| 539 | |
| 540 | if (retCode == TX_SUCCESS) { |
| 541 | MTRACE(mac_trace_msg_rx |
| 542 | (pMac, NO_SESSION, |
| 543 | LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED)); |
| 544 | ) |
| 545 | } else { |
| 546 | lim_log(pMac, LOGE, FL("Dropped lim message (0x%X)"), |
| 547 | pMsg->type); |
| 548 | MTRACE(mac_trace_msg_rx |
| 549 | (pMac, NO_SESSION, |
| 550 | LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED)); |
| 551 | ) |
| 552 | } |
| 553 | |
| 554 | return retCode; |
| 555 | } /*** end lim_defer_msg() ***/ |
| 556 | |
| 557 | /** |
| 558 | * lim_handle_unknown_a2_index_frames() - This function handles Unknown Unicast |
| 559 | * (A2 Index) packets |
| 560 | * @mac_ctx: Pointer to the Global Mac Context. |
| 561 | * @rx_pkt_buffer: Pointer to the packet Buffer descriptor. |
| 562 | * @session_entry: Pointer to the PE Session Entry. |
| 563 | * |
| 564 | * This routine will handle public action frames. |
| 565 | * |
| 566 | * Return: None. |
| 567 | */ |
| 568 | static void lim_handle_unknown_a2_index_frames(tpAniSirGlobal mac_ctx, |
| 569 | void *rx_pkt_buffer, tpPESession session_entry) |
| 570 | { |
| 571 | #ifdef FEATURE_WLAN_TDLS |
| 572 | tpSirMacDataHdr3a mac_hdr; |
| 573 | #endif |
| 574 | if (LIM_IS_P2P_DEVICE_ROLE(session_entry)) |
| 575 | lim_process_action_frame_no_session(mac_ctx, |
| 576 | (uint8_t *) rx_pkt_buffer); |
| 577 | #ifdef FEATURE_WLAN_TDLS |
| 578 | mac_hdr = WMA_GET_RX_MPDUHEADER3A(rx_pkt_buffer); |
| 579 | |
| 580 | if (lim_is_group_addr(mac_hdr->addr2)) { |
| 581 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO_HIGH, |
| 582 | FL("Ignoring A2 Invalid Packet received for MC/BC:")); |
| 583 | lim_print_mac_addr(mac_ctx, mac_hdr->addr2, LOG2); |
| 584 | return; |
| 585 | } |
| 586 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO, |
| 587 | FL("type=0x%x, subtype=0x%x"), |
| 588 | mac_hdr->fc.type, mac_hdr->fc.subType); |
| 589 | /* Currently only following type and subtype are handled. |
| 590 | * If there are more combinations, then add switch-case |
| 591 | * statements. |
| 592 | */ |
| 593 | if (LIM_IS_STA_ROLE(session_entry) && |
| 594 | (mac_hdr->fc.type == SIR_MAC_MGMT_FRAME) && |
| 595 | (mac_hdr->fc.subType == SIR_MAC_MGMT_ACTION)) |
| 596 | lim_process_action_frame(mac_ctx, rx_pkt_buffer, session_entry); |
| 597 | #endif |
| 598 | return; |
| 599 | } |
| 600 | |
| 601 | /** |
| 602 | * lim_check_mgmt_registered_frames() - This function handles registered |
| 603 | * management frames. |
| 604 | * |
| 605 | * @mac_ctx: Pointer to the Global Mac Context. |
| 606 | * @buff_desc: Pointer to the packet Buffer descriptor. |
| 607 | * @session_entry: Pointer to the PE Session Entry. |
| 608 | * |
| 609 | * This function is called to process to check if received frame match with |
| 610 | * any of the registered frame from HDD. If yes pass this frame to SME. |
| 611 | * |
| 612 | * Return: True or False for Match or Mismatch respectively. |
| 613 | */ |
| 614 | static bool |
| 615 | lim_check_mgmt_registered_frames(tpAniSirGlobal mac_ctx, uint8_t *buff_desc, |
| 616 | tpPESession session_entry) |
| 617 | { |
| 618 | tSirMacFrameCtl fc; |
| 619 | tpSirMacMgmtHdr hdr; |
| 620 | uint8_t *body; |
| 621 | struct mgmt_frm_reg_info *mgmt_frame = NULL; |
| 622 | struct mgmt_frm_reg_info *next_frm = NULL; |
| 623 | uint16_t frm_type; |
| 624 | uint16_t frm_len; |
| 625 | uint8_t type, sub_type; |
| 626 | bool match = false; |
| 627 | CDF_STATUS cdf_status; |
| 628 | |
| 629 | hdr = WMA_GET_RX_MAC_HEADER(buff_desc); |
| 630 | fc = hdr->fc; |
| 631 | frm_type = (fc.type << 2) | (fc.subType << 4); |
| 632 | body = WMA_GET_RX_MPDU_DATA(buff_desc); |
| 633 | frm_len = WMA_GET_RX_PAYLOAD_LEN(buff_desc); |
| 634 | |
| 635 | cdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock); |
| 636 | cdf_list_peek_front(&mac_ctx->lim.gLimMgmtFrameRegistratinQueue, |
| 637 | (cdf_list_node_t **) &mgmt_frame); |
| 638 | cdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock); |
| 639 | |
| 640 | while (mgmt_frame != NULL) { |
| 641 | type = (mgmt_frame->frameType >> 2) & 0x03; |
| 642 | sub_type = (mgmt_frame->frameType >> 4) & 0x0f; |
| 643 | if ((type == SIR_MAC_MGMT_FRAME) |
| 644 | && (fc.type == SIR_MAC_MGMT_FRAME) |
| 645 | && (sub_type == SIR_MAC_MGMT_RESERVED15)) { |
| 646 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO_HIGH, |
| 647 | FL |
| 648 | ("rcvd frm match for SIR_MAC_MGMT_RESERVED15")); |
| 649 | match = true; |
| 650 | break; |
| 651 | } |
| 652 | if (mgmt_frame->frameType == frm_type) { |
| 653 | if (mgmt_frame->matchLen <= 0) { |
| 654 | match = true; |
| 655 | break; |
| 656 | } |
| 657 | if (mgmt_frame->matchLen <= frm_len && |
| 658 | cdf_mem_compare(mgmt_frame->matchData, body, |
| 659 | mgmt_frame->matchLen)) { |
| 660 | /* found match! */ |
| 661 | match = true; |
| 662 | break; |
| 663 | } |
| 664 | } |
| 665 | |
| 666 | cdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock); |
| 667 | cdf_status = |
| 668 | cdf_list_peek_next( |
| 669 | &mac_ctx->lim.gLimMgmtFrameRegistratinQueue, |
| 670 | (cdf_list_node_t *) mgmt_frame, |
| 671 | (cdf_list_node_t **) &next_frm); |
| 672 | cdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock); |
| 673 | mgmt_frame = next_frm; |
| 674 | next_frm = NULL; |
| 675 | } |
| 676 | |
| 677 | if (match) { |
| 678 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO, |
| 679 | FL("rcvd frame match with registered frame params")); |
| 680 | /* Indicate this to SME */ |
| 681 | lim_send_sme_mgmt_frame_ind(mac_ctx, hdr->fc.subType, |
| 682 | (uint8_t *) hdr, |
| 683 | WMA_GET_RX_PAYLOAD_LEN(buff_desc) + |
| 684 | sizeof(tSirMacMgmtHdr), mgmt_frame->sessionId, |
| 685 | WMA_GET_RX_CH(buff_desc), session_entry, 0); |
| 686 | |
| 687 | if ((type == SIR_MAC_MGMT_FRAME) |
| 688 | && (fc.type == SIR_MAC_MGMT_FRAME) |
| 689 | && (sub_type == SIR_MAC_MGMT_RESERVED15)) |
| 690 | /* These packets needs to be processed by PE/SME |
| 691 | * as well as HDD.If it returns true here, |
| 692 | * the packet is forwarded to HDD only. |
| 693 | */ |
| 694 | match = false; |
| 695 | } |
| 696 | |
| 697 | return match; |
| 698 | } |
| 699 | |
| 700 | /** |
| 701 | * lim_handle80211_frames() |
| 702 | * |
| 703 | ***FUNCTION: |
| 704 | * This function is called to process 802.11 frames |
| 705 | * received by LIM. |
| 706 | * |
| 707 | ***LOGIC: |
| 708 | * NA |
| 709 | * |
| 710 | ***ASSUMPTIONS: |
| 711 | * NA |
| 712 | * |
| 713 | ***NOTE: |
| 714 | * NA |
| 715 | * |
| 716 | * @param pMac - Pointer to Global MAC structure |
| 717 | * @param pMsg of type tSirMsgQ - Pointer to the message structure |
| 718 | * @return None |
| 719 | */ |
| 720 | |
| 721 | static void |
| 722 | lim_handle80211_frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, uint8_t *pDeferMsg) |
| 723 | { |
| 724 | uint8_t *pRxPacketInfo = NULL; |
| 725 | tSirMacFrameCtl fc; |
| 726 | tpSirMacMgmtHdr pHdr = NULL; |
| 727 | tpPESession psessionEntry = NULL; |
| 728 | uint8_t sessionId; |
| 729 | tAniBool isFrmFt = false; |
| 730 | |
| 731 | *pDeferMsg = false; |
| 732 | lim_get_b_dfrom_rx_packet(pMac, limMsg->bodyptr, |
| 733 | (uint32_t * *) &pRxPacketInfo); |
| 734 | |
| 735 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 736 | isFrmFt = WMA_GET_RX_FT_DONE(pRxPacketInfo); |
| 737 | fc = pHdr->fc; |
| 738 | |
| 739 | #ifdef WLAN_DUMP_MGMTFRAMES |
| 740 | lim_log(pMac, LOGE, |
| 741 | FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"), |
| 742 | fc.protVer, fc.type, fc.subType, |
| 743 | WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo)); |
| 744 | CDF_TRACE_HEX_DUMP(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_ERROR, pHdr, |
| 745 | WMA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo)); |
| 746 | #endif |
| 747 | if (pMac->fEnableDebugLog & 0x1) { |
| 748 | if ((fc.type == SIR_MAC_MGMT_FRAME) && |
| 749 | (fc.subType != SIR_MAC_MGMT_PROBE_REQ) && |
| 750 | (fc.subType != SIR_MAC_MGMT_PROBE_RSP) && |
| 751 | (fc.subType != SIR_MAC_MGMT_BEACON)) { |
| 752 | lim_log(pMac, LOGE, |
| 753 | FL("RX MGMT - Type %hu, SubType %hu, seq num[%d]"), |
| 754 | fc.type, |
| 755 | fc.subType, |
| 756 | ((pHdr->seqControl.seqNumHi << |
| 757 | HIGH_SEQ_NUM_OFFSET) | |
| 758 | pHdr->seqControl.seqNumLo)); |
| 759 | } |
| 760 | } |
| 761 | #ifdef FEATURE_WLAN_EXTSCAN |
| 762 | if (WMA_IS_EXTSCAN_SCAN_SRC(pRxPacketInfo) || |
| 763 | WMA_IS_EPNO_SCAN_SRC(pRxPacketInfo)) { |
| 764 | if (fc.subType == SIR_MAC_MGMT_BEACON || |
| 765 | fc.subType == SIR_MAC_MGMT_PROBE_RSP) { |
| 766 | __lim_process_ext_scan_beacon_probe_rsp(pMac, |
| 767 | pRxPacketInfo, |
| 768 | fc.subType); |
| 769 | } else { |
| 770 | lim_log(pMac, LOGE, |
| 771 | FL("Wrong frameType %d, Subtype %d for %d"), |
| 772 | fc.type, fc.subType, |
| 773 | WMA_GET_SCAN_SRC(pRxPacketInfo)); |
| 774 | } |
| 775 | goto end; |
| 776 | } |
| 777 | #endif |
| 778 | if (WMA_GET_OFFLOADSCANLEARN(pRxPacketInfo)) { |
| 779 | if (fc.subType == SIR_MAC_MGMT_BEACON) { |
| 780 | lim_log(pMac, LOG2, FL("Learning scan beacon")); |
| 781 | __lim_handle_beacon(pMac, limMsg, NULL); |
| 782 | } else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP) { |
| 783 | lim_log(pMac, LOG2, FL("Learning scan probe rsp")); |
| 784 | lim_process_probe_rsp_frame_no_session(pMac, pRxPacketInfo); |
| 785 | } else { |
| 786 | lim_log(pMac, LOGE, |
| 787 | FL("Wrong frame Type %d, Subtype %d for LFR"), |
| 788 | fc.type, fc.subType); |
| 789 | } |
| 790 | goto end; |
| 791 | } |
| 792 | /* Added For BT-AMP Support */ |
| 793 | if ((psessionEntry = |
| 794 | pe_find_session_by_bssid(pMac, pHdr->bssId, |
| 795 | &sessionId)) == NULL) { |
| 796 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 797 | if (fc.subType == SIR_MAC_MGMT_AUTH) { |
| 798 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 799 | lim_log(pMac, LOG1, |
| 800 | FL |
| 801 | ("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"), |
| 802 | fc.protVer, fc.type, fc.subType, |
| 803 | WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo)); |
| 804 | lim_print_mac_addr(pMac, pHdr->bssId, LOG1); |
| 805 | #endif |
| 806 | if (lim_process_auth_frame_no_session |
| 807 | (pMac, pRxPacketInfo, |
| 808 | limMsg->bodyptr) == eSIR_SUCCESS) { |
| 809 | lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, |
| 810 | pRxPacketInfo, limMsg->bodyptr); |
| 811 | return; |
| 812 | } |
| 813 | } |
| 814 | #endif |
| 815 | if ((fc.subType != SIR_MAC_MGMT_PROBE_RSP) && |
| 816 | (fc.subType != SIR_MAC_MGMT_BEACON) && |
| 817 | (fc.subType != SIR_MAC_MGMT_PROBE_REQ) |
| 818 | && (fc.subType != SIR_MAC_MGMT_ACTION) /* Public action frame can be received from non-associated stations. */ |
| 819 | ) { |
| 820 | |
| 821 | if ((psessionEntry = |
| 822 | pe_find_session_by_peer_sta(pMac, pHdr->sa, |
| 823 | &sessionId)) == NULL) { |
| 824 | lim_log(pMac, LOG1, |
| 825 | FL |
| 826 | ("session does not exist for given bssId")); |
| 827 | lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, |
| 828 | pRxPacketInfo, limMsg->bodyptr); |
| 829 | return; |
| 830 | } else |
| 831 | lim_log(pMac, LOG1, |
| 832 | "SessionId:%d Session Exist for given Bssid", |
| 833 | psessionEntry->peSessionId); |
| 834 | } |
| 835 | /* For p2p resp frames search for valid session with DA as */ |
| 836 | /* BSSID will be SA and session will be present with DA only */ |
| 837 | if (fc.subType == SIR_MAC_MGMT_ACTION) { |
| 838 | psessionEntry = |
| 839 | pe_find_session_by_bssid(pMac, pHdr->da, &sessionId); |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | /* Check if frame is registered by HDD */ |
| 844 | if (lim_check_mgmt_registered_frames(pMac, pRxPacketInfo, psessionEntry)) { |
| 845 | lim_log(pMac, LOG1, FL("Received frame is passed to SME")); |
| 846 | lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo, |
| 847 | limMsg->bodyptr); |
| 848 | return; |
| 849 | } |
| 850 | |
| 851 | if (fc.protVer != SIR_MAC_PROTOCOL_VERSION) { /* Received Frame with non-zero Protocol Version */ |
| 852 | lim_log(pMac, LOGE, |
| 853 | FL("Unexpected frame with protVersion %d received"), |
| 854 | fc.protVer); |
| 855 | lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo, |
| 856 | (void *)limMsg->bodyptr); |
| 857 | #ifdef WLAN_DEBUG |
| 858 | pMac->lim.numProtErr++; |
| 859 | #endif |
| 860 | return; |
| 861 | } |
| 862 | |
| 863 | /* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */ |
| 864 | |
| 865 | #ifdef WLAN_DEBUG |
| 866 | pMac->lim.numMAC[fc.type][fc.subType]++; |
| 867 | #endif |
| 868 | |
| 869 | switch (fc.type) { |
| 870 | case SIR_MAC_MGMT_FRAME: |
| 871 | { |
| 872 | /* Received Management frame */ |
| 873 | switch (fc.subType) { |
| 874 | case SIR_MAC_MGMT_ASSOC_REQ: |
| 875 | /* Make sure the role supports Association */ |
| 876 | if (LIM_IS_BT_AMP_AP_ROLE(psessionEntry) || |
| 877 | LIM_IS_AP_ROLE(psessionEntry)) |
| 878 | lim_process_assoc_req_frame(pMac, |
| 879 | pRxPacketInfo, |
| 880 | LIM_ASSOC, |
| 881 | psessionEntry); |
| 882 | else { |
| 883 | /* Unwanted messages - Log error */ |
| 884 | lim_log(pMac, LOGE, |
| 885 | FL |
| 886 | ("unexpected message received %X"), |
| 887 | limMsg->type); |
| 888 | lim_print_msg_name(pMac, LOGE, |
| 889 | limMsg->type); |
| 890 | } |
| 891 | break; |
| 892 | |
| 893 | case SIR_MAC_MGMT_ASSOC_RSP: |
| 894 | lim_process_assoc_rsp_frame(pMac, pRxPacketInfo, |
| 895 | LIM_ASSOC, |
| 896 | psessionEntry); |
| 897 | break; |
| 898 | |
| 899 | case SIR_MAC_MGMT_REASSOC_REQ: |
| 900 | /* Make sure the role supports Reassociation */ |
| 901 | if (LIM_IS_BT_AMP_AP_ROLE(psessionEntry) || |
| 902 | LIM_IS_AP_ROLE(psessionEntry)) { |
| 903 | lim_process_assoc_req_frame(pMac, |
| 904 | pRxPacketInfo, |
| 905 | LIM_REASSOC, |
| 906 | psessionEntry); |
| 907 | } else { |
| 908 | /* Unwanted messages - Log error */ |
| 909 | lim_log(pMac, LOGE, |
| 910 | FL |
| 911 | ("unexpected message received %X"), |
| 912 | limMsg->type); |
| 913 | lim_print_msg_name(pMac, LOGE, |
| 914 | limMsg->type); |
| 915 | } |
| 916 | break; |
| 917 | |
| 918 | case SIR_MAC_MGMT_REASSOC_RSP: |
| 919 | lim_process_assoc_rsp_frame(pMac, pRxPacketInfo, |
| 920 | LIM_REASSOC, |
| 921 | psessionEntry); |
| 922 | break; |
| 923 | |
| 924 | case SIR_MAC_MGMT_PROBE_REQ: |
| 925 | lim_process_probe_req_frame_multiple_bss(pMac, |
| 926 | pRxPacketInfo, |
| 927 | psessionEntry); |
| 928 | break; |
| 929 | |
| 930 | case SIR_MAC_MGMT_PROBE_RSP: |
| 931 | if (psessionEntry == NULL) |
| 932 | lim_process_probe_rsp_frame_no_session(pMac, |
| 933 | pRxPacketInfo); |
| 934 | else |
| 935 | lim_process_probe_rsp_frame(pMac, |
| 936 | pRxPacketInfo, |
| 937 | psessionEntry); |
| 938 | break; |
| 939 | |
| 940 | case SIR_MAC_MGMT_BEACON: |
| 941 | __lim_handle_beacon(pMac, limMsg, psessionEntry); |
| 942 | break; |
| 943 | |
| 944 | case SIR_MAC_MGMT_DISASSOC: |
| 945 | lim_process_disassoc_frame(pMac, pRxPacketInfo, |
| 946 | psessionEntry); |
| 947 | break; |
| 948 | |
| 949 | case SIR_MAC_MGMT_AUTH: |
| 950 | lim_process_auth_frame(pMac, pRxPacketInfo, |
| 951 | psessionEntry); |
| 952 | break; |
| 953 | |
| 954 | case SIR_MAC_MGMT_DEAUTH: |
| 955 | lim_process_deauth_frame(pMac, pRxPacketInfo, |
| 956 | psessionEntry); |
| 957 | break; |
| 958 | |
| 959 | case SIR_MAC_MGMT_ACTION: |
| 960 | if (psessionEntry == NULL) |
| 961 | lim_process_action_frame_no_session(pMac, |
| 962 | pRxPacketInfo); |
| 963 | else { |
| 964 | if (WMA_GET_RX_UNKNOWN_UCAST |
| 965 | (pRxPacketInfo)) |
| 966 | lim_handle_unknown_a2_index_frames |
| 967 | (pMac, pRxPacketInfo, |
| 968 | psessionEntry); |
| 969 | else |
| 970 | lim_process_action_frame(pMac, |
| 971 | pRxPacketInfo, |
| 972 | psessionEntry); |
| 973 | } |
| 974 | break; |
| 975 | default: |
| 976 | /* Received Management frame of 'reserved' subtype */ |
| 977 | break; |
| 978 | } /* switch (fc.subType) */ |
| 979 | |
| 980 | } |
| 981 | break; |
| 982 | case SIR_MAC_DATA_FRAME: |
| 983 | { |
| 984 | } |
| 985 | break; |
| 986 | default: |
| 987 | /* Received frame of type 'reserved' */ |
| 988 | break; |
| 989 | |
| 990 | } /* switch (fc.type) */ |
| 991 | |
| 992 | end: |
| 993 | lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo, |
| 994 | (void *)limMsg->bodyptr); |
| 995 | return; |
| 996 | } /*** end lim_handle80211_frames() ***/ |
| 997 | |
| 998 | /** |
| 999 | * lim_send_stop_scan_offload_req() |
| 1000 | * |
| 1001 | ***FUNCTION: |
| 1002 | * This function will be called to abort the ongoing offloaded scan |
| 1003 | * request. |
| 1004 | * |
| 1005 | * |
| 1006 | ***NOTE: |
| 1007 | * |
| 1008 | * @param pMac Pointer to Global MAC structure |
| 1009 | * @return CDF_STATUS_SUCCESS or CDF_STATUS_E_FAILURE |
| 1010 | */ |
| 1011 | CDF_STATUS lim_send_stop_scan_offload_req(tpAniSirGlobal pMac, |
| 1012 | uint8_t SessionId, uint32_t scan_id) |
| 1013 | { |
| 1014 | tSirMsgQ msg; |
| 1015 | tSirRetStatus rc = eSIR_SUCCESS; |
| 1016 | tAbortScanParams *pAbortScanParams; |
| 1017 | |
| 1018 | pAbortScanParams = cdf_mem_malloc(sizeof(tAbortScanParams)); |
| 1019 | if (NULL == pAbortScanParams) { |
| 1020 | lim_log(pMac, LOGP, |
| 1021 | FL("Memory allocation failed for AbortScanParams")); |
| 1022 | return CDF_STATUS_E_NOMEM; |
| 1023 | } |
| 1024 | |
| 1025 | pAbortScanParams->SessionId = SessionId; |
| 1026 | pAbortScanParams->scan_id = scan_id; |
| 1027 | msg.type = WMA_STOP_SCAN_OFFLOAD_REQ; |
| 1028 | msg.bodyptr = pAbortScanParams; |
| 1029 | msg.bodyval = 0; |
| 1030 | |
| 1031 | rc = wma_post_ctrl_msg(pMac, &msg); |
| 1032 | if (rc != eSIR_SUCCESS) { |
| 1033 | lim_log(pMac, LOGE, FL("wma_post_ctrl_msg() return failure")); |
| 1034 | cdf_mem_free(pAbortScanParams); |
| 1035 | return CDF_STATUS_E_FAILURE; |
| 1036 | } |
| 1037 | |
| 1038 | lim_log(pMac, LOG1, FL("Abort ongoing offload scan.")); |
| 1039 | return CDF_STATUS_SUCCESS; |
| 1040 | |
| 1041 | } |
| 1042 | |
| 1043 | /** |
| 1044 | * lim_process_abort_scan_ind() |
| 1045 | * |
| 1046 | ***FUNCTION: |
| 1047 | * This function is called from HDD to abort the scan which is presently being run |
| 1048 | * |
| 1049 | * |
| 1050 | ***NOTE: |
| 1051 | * |
| 1052 | * @param pMac Pointer to Global MAC structure |
| 1053 | * @param *pMsgBuf A pointer to the SME message buffer |
| 1054 | * @return None |
| 1055 | */ |
| 1056 | void lim_process_abort_scan_ind(tpAniSirGlobal mac_ctx, |
| 1057 | uint8_t session_id, uint32_t scan_id) |
| 1058 | { |
| 1059 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 1060 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0); |
| 1061 | #endif |
| 1062 | |
| 1063 | lim_log(mac_ctx, LOG2, FL("Processing AbortScan Ind scan_id %d"), |
| 1064 | scan_id); |
| 1065 | |
| 1066 | /* send stop scan cmd to fw if scan offload is enabled. */ |
| 1067 | lim_send_stop_scan_offload_req(mac_ctx, session_id, scan_id); |
| 1068 | return; |
| 1069 | } |
| 1070 | |
| 1071 | /** |
| 1072 | * lim_message_processor() - Process messages from LIM. |
| 1073 | * |
| 1074 | * @mac_ctx: Pointer to the Global Mac Context. |
| 1075 | * @msg: Received LIM message. |
| 1076 | * |
| 1077 | * Wrapper function for lim_process_messages when handling messages received by |
| 1078 | * LIM.Could either defer messages or process them. |
| 1079 | * |
| 1080 | * Return: None. |
| 1081 | */ |
| 1082 | void lim_message_processor(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) |
| 1083 | { |
| 1084 | if (eLIM_MLM_OFFLINE_STATE == mac_ctx->lim.gLimMlmState) { |
| 1085 | pe_free_msg(mac_ctx, msg); |
| 1086 | return; |
| 1087 | } |
| 1088 | |
| 1089 | if (!def_msg_decision(mac_ctx, msg)) { |
| 1090 | lim_process_messages(mac_ctx, msg); |
| 1091 | /* process deferred message queue if allowed */ |
| 1092 | if ((!(mac_ctx->lim.gLimAddtsSent)) && |
| 1093 | (!(lim_is_system_in_scan_state(mac_ctx))) && |
| 1094 | (true == GET_LIM_PROCESS_DEFD_MESGS(mac_ctx))) |
| 1095 | lim_process_deferred_message_queue(mac_ctx); |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 1100 | |
| 1101 | void lim_oem_data_rsp_handle_resume_link_rsp(tpAniSirGlobal pMac, CDF_STATUS status, |
| 1102 | uint32_t *mlmOemDataRsp) |
| 1103 | { |
| 1104 | if (status != CDF_STATUS_SUCCESS) { |
| 1105 | lim_log(pMac, LOGE, |
| 1106 | FL |
| 1107 | ("OEM Data Rsp failed to get the response for resume link")); |
| 1108 | } |
| 1109 | |
| 1110 | if (NULL != pMac->lim.gpLimMlmOemDataReq) { |
| 1111 | cdf_mem_free(pMac->lim.gpLimMlmOemDataReq); |
| 1112 | pMac->lim.gpLimMlmOemDataReq = NULL; |
| 1113 | } |
| 1114 | /* "Failure" status doesn't mean that Oem Data Rsp did not happen */ |
| 1115 | /* and hence we need to respond to upper layers. Only Resume link is failed, but */ |
| 1116 | /* we got the oem data response already. */ |
| 1117 | /* Post the meessage to MLM */ |
| 1118 | lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF, |
| 1119 | (uint32_t *) (mlmOemDataRsp)); |
| 1120 | |
| 1121 | return; |
| 1122 | } |
| 1123 | |
| 1124 | void lim_process_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *body) |
| 1125 | { |
| 1126 | tpLimMlmOemDataRsp mlmOemDataRsp = NULL; |
| 1127 | |
| 1128 | /* Process all the messages for the lim queue */ |
| 1129 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 1130 | |
| 1131 | mlmOemDataRsp = (tpLimMlmOemDataRsp) body; |
| 1132 | |
| 1133 | PELOG1(lim_log |
| 1134 | (pMac, LOG1, FL("%s: sending oem data response msg to sme"), |
| 1135 | __func__); |
| 1136 | ) |
| 1137 | lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF, |
| 1138 | (uint32_t *) (mlmOemDataRsp)); |
| 1139 | |
| 1140 | return; |
| 1141 | } |
| 1142 | |
| 1143 | #endif |
| 1144 | |
| 1145 | /** |
| 1146 | * lim_process_messages() - Process messages from upper layers. |
| 1147 | * |
| 1148 | * @mac_ctx: Pointer to the Global Mac Context. |
| 1149 | * @msg: Received message. |
| 1150 | * |
| 1151 | * Return: None. |
| 1152 | */ |
| 1153 | void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) |
| 1154 | { |
| 1155 | #ifdef FEATURE_AP_MCC_CH_AVOIDANCE |
| 1156 | uint8_t vdev_id = 0; |
| 1157 | tUpdateBeaconParams beacon_params; |
| 1158 | #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ |
| 1159 | uint8_t i; |
| 1160 | uint8_t p2p_go_exists = 0; |
| 1161 | tpPESession session_entry = NULL; |
| 1162 | uint8_t defer_msg = false; |
| 1163 | tLinkStateParams *link_state_param; |
| 1164 | uint16_t pkt_len = 0; |
| 1165 | cds_pkt_t *body_ptr = NULL; |
| 1166 | CDF_STATUS cdf_status; |
| 1167 | tSirMsgQ new_msg; |
| 1168 | tSirSmeScanAbortReq *req_msg = NULL; |
| 1169 | uint8_t session_id; |
| 1170 | uint32_t scan_id; |
| 1171 | |
| 1172 | #ifdef FEATURE_WLAN_TDLS |
| 1173 | tSirTdlsInd *tdls_ind = NULL; |
| 1174 | tpDphHashNode sta_ds = NULL; |
| 1175 | tTdlsLinkEstablishParams *tdls_link_params = NULL; |
| 1176 | #endif |
| 1177 | tSirMbMsgP2p *p2p_msg = NULL; |
| 1178 | if (ANI_DRIVER_TYPE(mac_ctx) == eDRIVER_TYPE_MFG) { |
| 1179 | cdf_mem_free(msg->bodyptr); |
| 1180 | msg->bodyptr = NULL; |
| 1181 | return; |
| 1182 | } |
| 1183 | if (msg == NULL) { |
| 1184 | lim_log(mac_ctx, LOGE, FL("Message pointer is Null")); |
| 1185 | CDF_ASSERT(0); |
| 1186 | return; |
| 1187 | } |
| 1188 | #ifdef WLAN_DEBUG |
| 1189 | mac_ctx->lim.numTot++; |
| 1190 | #endif |
| 1191 | MTRACE(mac_trace_msg_rx(mac_ctx, NO_SESSION, |
| 1192 | LIM_TRACE_MAKE_RXMSG(msg->type, LIM_MSG_PROCESSED));) |
| 1193 | |
| 1194 | switch (msg->type) { |
| 1195 | |
| 1196 | case SIR_LIM_UPDATE_BEACON: |
| 1197 | lim_update_beacon(mac_ctx); |
| 1198 | break; |
| 1199 | case SIR_CFG_PARAM_UPDATE_IND: |
| 1200 | if (!lim_is_system_in_scan_state(mac_ctx)) { |
| 1201 | lim_handle_cf_gparam_update(mac_ctx, msg->bodyval); |
| 1202 | break; |
| 1203 | } |
| 1204 | /* System is in DFS (Learn) mode. |
| 1205 | * Defer processsing this message |
| 1206 | */ |
| 1207 | if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) { |
| 1208 | if (!(mac_ctx->lim.deferredMsgCnt & 0xF)) |
| 1209 | CDF_TRACE(CDF_MODULE_ID_PE, LOGE, |
| 1210 | FL("Unable to Defer Msg")); |
| 1211 | lim_log_session_states(mac_ctx); |
| 1212 | lim_print_msg_name(mac_ctx, LOGE, msg->type); |
| 1213 | } |
| 1214 | break; |
| 1215 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 1216 | case WMA_START_OEM_DATA_RSP: |
| 1217 | lim_process_oem_data_rsp(mac_ctx, msg->bodyptr); |
| 1218 | msg->bodyptr = NULL; |
| 1219 | break; |
| 1220 | #endif |
| 1221 | case WMA_SWITCH_CHANNEL_RSP: |
| 1222 | lim_process_switch_channel_rsp(mac_ctx, msg->bodyptr); |
| 1223 | msg->bodyptr = NULL; |
| 1224 | break; |
| 1225 | #ifdef ANI_SIR_IBSS_PEER_CACHING |
| 1226 | case WMA_IBSS_STA_ADD: |
| 1227 | lim_ibss_sta_add(mac_ctx, msg->bodyptr); |
| 1228 | break; |
| 1229 | #endif |
| 1230 | case SIR_BB_XPORT_MGMT_MSG: |
| 1231 | /* These messages are from Peer MAC entity. */ |
| 1232 | #ifdef WLAN_DEBUG |
| 1233 | mac_ctx->lim.numBbt++; |
| 1234 | #endif |
| 1235 | /* The original msg which we were deferring have the |
| 1236 | * bodyPointer point to 'BD' instead of 'cds pkt'. If we |
| 1237 | * don't make a copy of msg, then overwrite the |
| 1238 | * msg->bodyPointer and next time when we try to |
| 1239 | * process the msg, we will try to use 'BD' as |
| 1240 | * 'cds Pkt' which will cause a crash |
| 1241 | */ |
| 1242 | if (msg->bodyptr == NULL) { |
| 1243 | lim_log(mac_ctx, LOGE, FL("Message bodyptr is Null")); |
| 1244 | CDF_ASSERT(0); |
| 1245 | break; |
| 1246 | } |
| 1247 | cdf_mem_copy((uint8_t *) &new_msg, |
| 1248 | (uint8_t *) msg, sizeof(tSirMsgQ)); |
| 1249 | body_ptr = (cds_pkt_t *) new_msg.bodyptr; |
| 1250 | cds_pkt_get_packet_length(body_ptr, &pkt_len); |
| 1251 | |
| 1252 | cdf_status = wma_ds_peek_rx_packet_info(body_ptr, |
| 1253 | (void **) &new_msg.bodyptr, false); |
| 1254 | |
| 1255 | if (!CDF_IS_STATUS_SUCCESS(cdf_status)) { |
| 1256 | cds_pkt_return_packet(body_ptr); |
| 1257 | break; |
| 1258 | } |
| 1259 | |
| 1260 | if (WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr)) |
| 1261 | lim_log(mac_ctx, LOG1, FL("roamCandidateInd %d"), |
| 1262 | WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr)); |
| 1263 | |
| 1264 | if (WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr)) |
| 1265 | lim_log(mac_ctx, LOG1, FL("offloadScanLearn %d"), |
| 1266 | WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr)); |
| 1267 | |
| 1268 | lim_handle80211_frames(mac_ctx, &new_msg, &defer_msg); |
| 1269 | |
| 1270 | if (defer_msg == true) { |
| 1271 | CDF_TRACE(CDF_MODULE_ID_PE, LOG1, |
| 1272 | FL("Defer Msg type=%x"), msg->type); |
| 1273 | if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) { |
| 1274 | CDF_TRACE(CDF_MODULE_ID_PE, LOGE, |
| 1275 | FL("Unable to Defer Msg")); |
| 1276 | lim_log_session_states(mac_ctx); |
| 1277 | cds_pkt_return_packet(body_ptr); |
| 1278 | } |
| 1279 | } else |
| 1280 | /* PE is not deferring this 802.11 frame so we need to |
| 1281 | * call cds_pkt_return. Asumption here is when Rx mgmt |
| 1282 | * frame processing is done, cds packet could be |
| 1283 | * freed here. |
| 1284 | */ |
| 1285 | cds_pkt_return_packet(body_ptr); |
| 1286 | break; |
| 1287 | case eWNI_SME_SCAN_REQ: |
| 1288 | case eWNI_SME_REMAIN_ON_CHANNEL_REQ: |
| 1289 | case eWNI_SME_DISASSOC_REQ: |
| 1290 | case eWNI_SME_DEAUTH_REQ: |
| 1291 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 1292 | case eWNI_SME_OEM_DATA_REQ: |
| 1293 | #endif |
| 1294 | #ifdef FEATURE_WLAN_TDLS |
| 1295 | case eWNI_SME_TDLS_SEND_MGMT_REQ: |
| 1296 | case eWNI_SME_TDLS_ADD_STA_REQ: |
| 1297 | case eWNI_SME_TDLS_DEL_STA_REQ: |
| 1298 | case eWNI_SME_TDLS_LINK_ESTABLISH_REQ: |
| 1299 | #endif |
| 1300 | case eWNI_SME_RESET_AP_CAPS_CHANGED: |
| 1301 | case eWNI_SME_SET_HW_MODE_REQ: |
| 1302 | case eWNI_SME_SET_DUAL_MAC_CFG_REQ: |
| 1303 | /* These messages are from HDD. Need to respond to HDD */ |
| 1304 | lim_process_normal_hdd_msg(mac_ctx, msg, true); |
| 1305 | break; |
| 1306 | |
| 1307 | case eWNI_SME_SCAN_ABORT_IND: |
| 1308 | req_msg = msg->bodyptr; |
| 1309 | if (req_msg) { |
| 1310 | session_id = req_msg->sessionId; |
| 1311 | scan_id = req_msg->scan_id; |
| 1312 | lim_process_abort_scan_ind(mac_ctx, session_id, |
| 1313 | scan_id); |
| 1314 | cdf_mem_free((void *)msg->bodyptr); |
| 1315 | msg->bodyptr = NULL; |
| 1316 | } |
| 1317 | break; |
| 1318 | case eWNI_SME_SYS_READY_IND: |
| 1319 | case eWNI_SME_JOIN_REQ: |
| 1320 | case eWNI_SME_REASSOC_REQ: |
| 1321 | case eWNI_SME_START_BSS_REQ: |
| 1322 | case eWNI_SME_STOP_BSS_REQ: |
| 1323 | case eWNI_SME_SWITCH_CHL_IND: |
| 1324 | case eWNI_SME_SETCONTEXT_REQ: |
| 1325 | case eWNI_SME_DISASSOC_CNF: |
| 1326 | case eWNI_SME_DEAUTH_CNF: |
| 1327 | case eWNI_SME_ASSOC_CNF: |
| 1328 | case eWNI_SME_ADDTS_REQ: |
| 1329 | case eWNI_SME_DELTS_REQ: |
| 1330 | case eWNI_SME_GET_ASSOC_STAS_REQ: |
| 1331 | case eWNI_SME_TKIP_CNTR_MEAS_REQ: |
| 1332 | case eWNI_SME_UPDATE_APWPSIE_REQ: |
| 1333 | case eWNI_SME_HIDE_SSID_REQ: |
| 1334 | case eWNI_SME_GET_WPSPBC_SESSION_REQ: |
| 1335 | case eWNI_SME_SET_APWPARSNIEs_REQ: |
| 1336 | case eWNI_SME_CHNG_MCC_BEACON_INTERVAL: |
| 1337 | #if defined WLAN_FEATURE_VOWIFI |
| 1338 | case eWNI_SME_NEIGHBOR_REPORT_REQ_IND: |
| 1339 | case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: |
| 1340 | #endif |
| 1341 | #if defined FEATURE_WLAN_ESE |
| 1342 | case eWNI_SME_ESE_ADJACENT_AP_REPORT: |
| 1343 | #endif |
| 1344 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1345 | case eWNI_SME_FT_UPDATE_KEY: |
| 1346 | case eWNI_SME_FT_PRE_AUTH_REQ: |
| 1347 | case eWNI_SME_FT_AGGR_QOS_REQ: |
| 1348 | #endif |
| 1349 | case eWNI_SME_REGISTER_MGMT_FRAME_REQ: |
| 1350 | case eWNI_SME_UPDATE_NOA: |
| 1351 | case eWNI_SME_CLEAR_DFS_CHANNEL_LIST: |
| 1352 | case eWNI_SME_GET_STATISTICS_REQ: |
| 1353 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
| 1354 | case eWNI_SME_GET_TSM_STATS_REQ: |
| 1355 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 1356 | case eWNI_SME_EXT_CHANGE_CHANNEL: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1357 | /* These messages are from HDD.No need to respond to HDD */ |
| 1358 | lim_process_normal_hdd_msg(mac_ctx, msg, false); |
| 1359 | break; |
| 1360 | |
| 1361 | case eWNI_PMC_SMPS_STATE_IND: |
| 1362 | if (msg->bodyptr) { |
| 1363 | cdf_mem_free(msg->bodyptr); |
| 1364 | msg->bodyptr = NULL; |
| 1365 | } |
| 1366 | break; |
| 1367 | case eWNI_SME_SEND_ACTION_FRAME_IND: |
| 1368 | lim_send_p2p_action_frame(mac_ctx, msg); |
| 1369 | cdf_mem_free(msg->bodyptr); |
| 1370 | msg->bodyptr = NULL; |
| 1371 | break; |
| 1372 | case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND: |
| 1373 | p2p_msg = (tSirMbMsgP2p *) msg->bodyptr; |
| 1374 | lim_abort_remain_on_chan(mac_ctx, p2p_msg->sessionId, |
| 1375 | p2p_msg->scan_id); |
| 1376 | cdf_mem_free(msg->bodyptr); |
| 1377 | msg->bodyptr = NULL; |
| 1378 | break; |
| 1379 | case SIR_HAL_P2P_NOA_START_IND: |
| 1380 | session_entry = &mac_ctx->lim.gpSession[0]; |
| 1381 | lim_log(mac_ctx, LOG1, "LIM received NOA start %x", msg->type); |
| 1382 | |
| 1383 | /* Since insert NOA is done and NOA start msg received, |
| 1384 | * we should deactivate the Insert NOA timer |
| 1385 | */ |
| 1386 | lim_deactivate_and_change_timer(mac_ctx, |
| 1387 | eLIM_INSERT_SINGLESHOT_NOA_TIMER); |
| 1388 | |
| 1389 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 1390 | session_entry = &mac_ctx->lim.gpSession[i]; |
| 1391 | if ((session_entry != NULL) && (session_entry->valid) && |
| 1392 | (session_entry->pePersona == CDF_P2P_GO_MODE)) { |
| 1393 | /* Save P2P NOA start attribute for Go persona*/ |
| 1394 | p2p_go_exists = 1; |
| 1395 | cdf_mem_copy(&session_entry->p2pGoPsNoaStartInd, |
| 1396 | msg->bodyptr, sizeof(tSirP2PNoaStart)); |
| 1397 | cdf_status = |
| 1398 | session_entry->p2pGoPsNoaStartInd.status; |
| 1399 | if (cdf_status != CDF_STATUS_SUCCESS) |
| 1400 | CDF_TRACE(CDF_MODULE_ID_PE, LOGW, |
| 1401 | FL( |
| 1402 | "GO NOA start status %d by FW"), |
| 1403 | cdf_status); |
| 1404 | break; |
| 1405 | } |
| 1406 | } |
| 1407 | |
| 1408 | if (p2p_go_exists == 0) |
| 1409 | CDF_TRACE(CDF_MODULE_ID_PE, LOGW, |
| 1410 | FL( |
| 1411 | "GO is removed by the time NOA start recvd")); |
| 1412 | |
| 1413 | /* We received the NOA start indication. Now we can send down |
| 1414 | * the SME request which requires off-channel operation */ |
| 1415 | lim_process_regd_defd_sme_req_after_noa_start(mac_ctx); |
| 1416 | cdf_mem_free(msg->bodyptr); |
| 1417 | msg->bodyptr = NULL; |
| 1418 | break; |
| 1419 | #ifdef FEATURE_WLAN_TDLS |
| 1420 | case SIR_HAL_TDLS_IND: |
| 1421 | tdls_ind = (tpSirTdlsInd) msg->bodyptr; |
| 1422 | session_entry = pe_find_session_by_sta_id(mac_ctx, |
| 1423 | tdls_ind->staIdx, &session_id); |
| 1424 | if (session_entry == NULL) { |
| 1425 | lim_log(mac_ctx, LOG1, |
| 1426 | FL("No session exist for given bssId")); |
| 1427 | cdf_mem_free(msg->bodyptr); |
| 1428 | msg->bodyptr = NULL; |
| 1429 | return; |
| 1430 | } |
| 1431 | sta_ds = dph_get_hash_entry(mac_ctx, tdls_ind->assocId, |
| 1432 | &session_entry->dph.dphHashTable); |
| 1433 | if (sta_ds == NULL) { |
| 1434 | lim_log(mac_ctx, LOG1, |
| 1435 | FL("No sta_ds exist for given staId")); |
| 1436 | cdf_mem_free(msg->bodyptr); |
| 1437 | msg->bodyptr = NULL; |
| 1438 | return; |
| 1439 | } |
| 1440 | |
| 1441 | if (STA_ENTRY_TDLS_PEER == sta_ds->staType) { |
| 1442 | lim_log(mac_ctx, LOGE, |
| 1443 | FL("rcvd TDLS IND from FW with RC %d "), |
| 1444 | tdls_ind->reasonCode); |
| 1445 | lim_send_sme_tdls_del_sta_ind(mac_ctx, sta_ds, |
| 1446 | session_entry, tdls_ind->reasonCode); |
| 1447 | } |
| 1448 | cdf_mem_free(msg->bodyptr); |
| 1449 | msg->bodyptr = NULL; |
| 1450 | break; |
| 1451 | #endif |
| 1452 | case SIR_HAL_P2P_NOA_ATTR_IND: |
| 1453 | session_entry = &mac_ctx->lim.gpSession[0]; |
| 1454 | lim_log(mac_ctx, LOG1, FL("Received message Noa_ATTR %x"), |
| 1455 | msg->type); |
| 1456 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 1457 | session_entry = &mac_ctx->lim.gpSession[i]; |
| 1458 | if ((session_entry != NULL) && (session_entry->valid) |
| 1459 | && (session_entry->pePersona == |
| 1460 | CDF_P2P_GO_MODE)) { /* Save P2P attr for Go */ |
| 1461 | cdf_mem_copy( |
| 1462 | &session_entry->p2pGoPsUpdate, |
| 1463 | msg->bodyptr, |
| 1464 | sizeof(tSirP2PNoaAttr)); |
| 1465 | lim_log(mac_ctx, LOG2, |
| 1466 | FL("bssId" |
| 1467 | MAC_ADDRESS_STR |
| 1468 | " ctWin=%d oppPsFlag=%d"), |
| 1469 | MAC_ADDR_ARRAY( |
| 1470 | session_entry->bssId), |
| 1471 | session_entry->p2pGoPsUpdate.ctWin, |
| 1472 | session_entry->p2pGoPsUpdate.oppPsFlag); |
| 1473 | lim_log(mac_ctx, LOG2, |
| 1474 | FL |
| 1475 | (" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"), |
| 1476 | session_entry->p2pGoPsUpdate.uNoa1IntervalCnt, |
| 1477 | session_entry->p2pGoPsUpdate.uNoa1Duration, |
| 1478 | session_entry->p2pGoPsUpdate.uNoa1Interval, |
| 1479 | session_entry->p2pGoPsUpdate.uNoa1StartTime); |
| 1480 | break; |
| 1481 | } |
| 1482 | } |
| 1483 | cdf_mem_free(msg->bodyptr); |
| 1484 | msg->bodyptr = NULL; |
| 1485 | break; |
| 1486 | case WMA_MISSED_BEACON_IND: |
| 1487 | lim_ps_offload_handle_missed_beacon_ind(mac_ctx, msg); |
| 1488 | cdf_mem_free(msg->bodyptr); |
| 1489 | msg->bodyptr = NULL; |
| 1490 | break; |
| 1491 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1492 | case WMA_ROAM_OFFLOAD_SYNCH_IND: |
| 1493 | lim_roam_offload_synch_ind(mac_ctx, msg); |
| 1494 | /* bodyPtr is freed after handling |
| 1495 | * eWNI_SME_ROAM_OFFLOAD_SYNCH_IND in sme_ProcessMsg */ |
| 1496 | break; |
| 1497 | #endif |
| 1498 | case SIR_LIM_ADDTS_RSP_TIMEOUT: |
| 1499 | lim_process_sme_req_messages(mac_ctx, msg); |
| 1500 | break; |
| 1501 | #ifdef FEATURE_WLAN_ESE |
| 1502 | case SIR_LIM_ESE_TSM_TIMEOUT: |
| 1503 | #ifndef FEATURE_WLAN_ESE_UPLOAD |
| 1504 | limProcessTsmTimeoutHandler(mac_ctx, msg); |
| 1505 | #endif /* FEATURE_WLAN_ESE_UPLOAD */ |
| 1506 | break; |
| 1507 | case WMA_TSM_STATS_RSP: |
| 1508 | #ifdef FEATURE_WLAN_ESE_UPLOAD |
| 1509 | lim_send_sme_pe_ese_tsm_rsp(mac_ctx, |
| 1510 | (tAniGetTsmStatsRsp *) msg->bodyptr); |
| 1511 | #else |
| 1512 | limProcessHalEseTsmRsp(mac_ctx, msg); |
| 1513 | #endif /* FEATURE_WLAN_ESE_UPLOAD */ |
| 1514 | break; |
| 1515 | #endif |
| 1516 | case WMA_ADD_TS_RSP: |
| 1517 | lim_process_hal_add_ts_rsp(mac_ctx, msg); |
| 1518 | break; |
| 1519 | case SIR_LIM_DEL_TS_IND: |
| 1520 | lim_process_del_ts_ind(mac_ctx, msg); |
| 1521 | break; |
| 1522 | case SIR_LIM_BEACON_GEN_IND: |
| 1523 | if (mac_ctx->lim.gLimSystemRole != eLIM_AP_ROLE) |
| 1524 | sch_process_pre_beacon_ind(mac_ctx, msg); |
| 1525 | break; |
| 1526 | case SIR_LIM_DELETE_STA_CONTEXT_IND: |
| 1527 | lim_delete_sta_context(mac_ctx, msg); |
| 1528 | break; |
| 1529 | case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT: |
| 1530 | case SIR_LIM_JOIN_FAIL_TIMEOUT: |
| 1531 | case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT: |
| 1532 | case SIR_LIM_AUTH_FAIL_TIMEOUT: |
| 1533 | case SIR_LIM_AUTH_RSP_TIMEOUT: |
| 1534 | case SIR_LIM_ASSOC_FAIL_TIMEOUT: |
| 1535 | case SIR_LIM_REASSOC_FAIL_TIMEOUT: |
| 1536 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1537 | case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT: |
| 1538 | #endif |
| 1539 | case SIR_LIM_REMAIN_CHN_TIMEOUT: |
| 1540 | case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT: |
| 1541 | case SIR_LIM_DISASSOC_ACK_TIMEOUT: |
| 1542 | case SIR_LIM_DEAUTH_ACK_TIMEOUT: |
| 1543 | case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE: |
| 1544 | /* These timeout messages are handled by MLM sub module */ |
| 1545 | lim_process_mlm_req_messages(mac_ctx, msg); |
| 1546 | break; |
| 1547 | case SIR_LIM_HEART_BEAT_TIMEOUT: |
| 1548 | /** check if heart beat failed, even if one Beacon |
| 1549 | * is rcvd within the Heart Beat interval continue |
| 1550 | * normal processing |
| 1551 | */ |
| 1552 | if (NULL == msg->bodyptr) |
| 1553 | lim_log(mac_ctx, LOGE, |
| 1554 | FL("Can't Process HB TO - bodyptr is Null")); |
| 1555 | else { |
| 1556 | session_entry = (tpPESession) msg->bodyptr; |
| 1557 | lim_log(mac_ctx, LOGE, |
| 1558 | FL |
| 1559 | ("SIR_LIM_HEART_BEAT_TIMEOUT, Session %d"), |
| 1560 | ((tpPESession) msg->bodyptr)->peSessionId); |
| 1561 | limResetHBPktCount(session_entry); |
| 1562 | lim_handle_heart_beat_timeout_for_session(mac_ctx, |
| 1563 | session_entry); |
| 1564 | } |
| 1565 | break; |
| 1566 | case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT: |
| 1567 | lim_handle_heart_beat_failure_timeout(mac_ctx); |
| 1568 | break; |
| 1569 | case SIR_LIM_HASH_MISS_THRES_TIMEOUT: |
| 1570 | mac_ctx->lim.gLimDisassocFrameCredit = 0; |
| 1571 | break; |
| 1572 | case SIR_LIM_CNF_WAIT_TIMEOUT: |
| 1573 | /* Does not receive CNF or dummy packet */ |
| 1574 | lim_handle_cnf_wait_timeout(mac_ctx, (uint16_t) msg->bodyval); |
| 1575 | break; |
| 1576 | case SIR_LIM_RETRY_INTERRUPT_MSG: |
| 1577 | /* Message from ISR upon TFP's max retry limit interrupt */ |
| 1578 | break; |
| 1579 | case SIR_LIM_INV_KEY_INTERRUPT_MSG: |
| 1580 | /* Message from ISR upon SP's Invalid session key interrupt */ |
| 1581 | break; |
| 1582 | case SIR_LIM_KEY_ID_INTERRUPT_MSG: |
| 1583 | /* Message from ISR upon SP's Invalid key ID interrupt */ |
| 1584 | break; |
| 1585 | case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG: |
| 1586 | /* Message from ISR upon SP's Replay threshold interrupt */ |
| 1587 | break; |
| 1588 | case SIR_LIM_CHANNEL_SWITCH_TIMEOUT: |
| 1589 | lim_process_channel_switch_timeout(mac_ctx); |
| 1590 | break; |
| 1591 | case SIR_LIM_QUIET_TIMEOUT: |
| 1592 | lim_process_quiet_timeout(mac_ctx); |
| 1593 | break; |
| 1594 | case SIR_LIM_QUIET_BSS_TIMEOUT: |
| 1595 | lim_process_quiet_bss_timeout(mac_ctx); |
| 1596 | break; |
| 1597 | case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT: |
| 1598 | lim_handle_update_olbc_cache(mac_ctx); |
| 1599 | break; |
| 1600 | #ifdef FEATURE_WLAN_TDLS |
| 1601 | case SIR_HAL_TDLS_SHOULD_DISCOVER: |
| 1602 | case SIR_HAL_TDLS_SHOULD_TEARDOWN: |
| 1603 | case SIR_HAL_TDLS_PEER_DISCONNECTED: |
| 1604 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO, |
| 1605 | ("%s received tdls event: 0x%x"), __func__, msg->type); |
| 1606 | lim_send_sme_tdls_event_notify(mac_ctx, msg->type, |
| 1607 | (void *)msg->bodyptr); |
| 1608 | break; |
| 1609 | #endif |
| 1610 | case WMA_ADD_BSS_RSP: |
| 1611 | lim_process_mlm_add_bss_rsp(mac_ctx, msg); |
| 1612 | break; |
| 1613 | case WMA_ADD_STA_RSP: |
| 1614 | lim_process_add_sta_rsp(mac_ctx, msg); |
| 1615 | break; |
| 1616 | case WMA_DELETE_STA_RSP: |
| 1617 | lim_process_mlm_del_sta_rsp(mac_ctx, msg); |
| 1618 | break; |
| 1619 | case WMA_DELETE_BSS_RSP: |
| 1620 | lim_handle_delete_bss_rsp(mac_ctx, msg); |
| 1621 | break; |
| 1622 | case WMA_CSA_OFFLOAD_EVENT: |
| 1623 | lim_handle_csa_offload_msg(mac_ctx, msg); |
| 1624 | break; |
| 1625 | case WMA_SET_BSSKEY_RSP: |
| 1626 | case WMA_SET_STA_BCASTKEY_RSP: |
| 1627 | lim_process_mlm_set_bss_key_rsp(mac_ctx, msg); |
| 1628 | break; |
| 1629 | case WMA_SET_STAKEY_RSP: |
| 1630 | lim_process_mlm_set_sta_key_rsp(mac_ctx, msg); |
| 1631 | break; |
| 1632 | case WMA_GET_STATISTICS_RSP: |
| 1633 | lim_send_sme_pe_statistics_rsp(mac_ctx, msg->type, |
| 1634 | (void *)msg->bodyptr); |
| 1635 | break; |
| 1636 | case WMA_SET_MIMOPS_RSP: |
| 1637 | case WMA_SET_TX_POWER_RSP: |
| 1638 | cdf_mem_free((void *)msg->bodyptr); |
| 1639 | msg->bodyptr = NULL; |
| 1640 | break; |
| 1641 | case WMA_SET_MAX_TX_POWER_RSP: |
| 1642 | #if defined WLAN_FEATURE_VOWIFI |
| 1643 | rrm_set_max_tx_power_rsp(mac_ctx, msg); |
| 1644 | #endif |
| 1645 | if (msg->bodyptr != NULL) { |
| 1646 | cdf_mem_free((void *)msg->bodyptr); |
| 1647 | msg->bodyptr = NULL; |
| 1648 | } |
| 1649 | break; |
| 1650 | case SIR_LIM_ADDR2_MISS_IND: |
| 1651 | lim_log(mac_ctx, LOGE, |
| 1652 | FL("Addr2 mismatch interrupt received %X"), msg->type); |
| 1653 | /* message from HAL indicating addr2 mismatch interrupt occurred |
| 1654 | * msg->bodyptr contains only pointer to 48-bit addr2 field |
| 1655 | */ |
| 1656 | cdf_mem_free((void *)(msg->bodyptr)); |
| 1657 | msg->bodyptr = NULL; |
| 1658 | break; |
| 1659 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1660 | case WMA_AGGR_QOS_RSP: |
| 1661 | lim_process_ft_aggr_qo_s_rsp(mac_ctx, msg); |
| 1662 | break; |
| 1663 | #endif |
| 1664 | case WMA_SET_LINK_STATE_RSP: |
| 1665 | link_state_param = (tLinkStateParams *) msg->bodyptr; |
| 1666 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 1667 | session_entry = link_state_param->session; |
| 1668 | if (link_state_param->ft |
| 1669 | #if defined WLAN_FEATURE_ROAM_OFFLOAD |
| 1670 | && !session_entry->bRoamSynchInProgress |
| 1671 | #endif |
| 1672 | ) |
| 1673 | lim_send_reassoc_req_with_ft_ies_mgmt_frame(mac_ctx, |
| 1674 | session_entry->pLimMlmReassocReq, |
| 1675 | session_entry); |
| 1676 | #endif |
| 1677 | if (link_state_param->callback) |
| 1678 | link_state_param->callback(mac_ctx, |
| 1679 | link_state_param->callbackArg, |
| 1680 | link_state_param->status); |
| 1681 | cdf_mem_free((void *)(msg->bodyptr)); |
| 1682 | msg->bodyptr = NULL; |
| 1683 | break; |
| 1684 | case eWNI_SME_SET_BCN_FILTER_REQ: |
| 1685 | session_id = (uint8_t) msg->bodyval; |
| 1686 | session_entry = &mac_ctx->lim.gpSession[session_id]; |
| 1687 | if ((session_entry != NULL) && |
| 1688 | (lim_send_beacon_filter_info(mac_ctx, session_entry) != |
| 1689 | eSIR_SUCCESS)) |
| 1690 | lim_log(mac_ctx, LOGE, |
| 1691 | FL("Failied to send Beacon Filter Info ")); |
| 1692 | cdf_mem_free((void *)(msg->bodyptr)); |
| 1693 | msg->bodyptr = NULL; |
| 1694 | break; |
| 1695 | #ifdef FEATURE_WLAN_TDLS |
| 1696 | case WMA_SET_TDLS_LINK_ESTABLISH_REQ_RSP: |
| 1697 | tdls_link_params = (tTdlsLinkEstablishParams *) msg->bodyptr; |
| 1698 | session_entry = pe_find_session_by_sta_id(mac_ctx, |
| 1699 | tdls_link_params->staIdx, &session_id); |
| 1700 | if (session_entry == NULL) { |
| 1701 | lim_log(mac_ctx, LOGE, |
| 1702 | FL("session %u does not exist"), session_id); |
| 1703 | /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP |
| 1704 | * message to SME with session id as zero and status |
| 1705 | * as FAILURE so, that message queued in SME queue |
| 1706 | * can be freed to prevent the SME cmd buffer leak |
| 1707 | */ |
| 1708 | lim_send_sme_tdls_link_establish_req_rsp(mac_ctx, 0, |
| 1709 | NULL, NULL, eSIR_FAILURE); |
| 1710 | } else { |
| 1711 | lim_send_sme_tdls_link_establish_req_rsp(mac_ctx, |
| 1712 | session_entry->smeSessionId, NULL, NULL, |
| 1713 | tdls_link_params->status); |
| 1714 | } |
| 1715 | cdf_mem_free((void *)(msg->bodyptr)); |
| 1716 | msg->bodyptr = NULL; |
| 1717 | break; |
| 1718 | #endif |
| 1719 | case WMA_RX_SCAN_EVENT: |
| 1720 | lim_process_rx_scan_event(mac_ctx, msg->bodyptr); |
| 1721 | break; |
| 1722 | case WMA_IBSS_PEER_INACTIVITY_IND: |
| 1723 | lim_process_ibss_peer_inactivity(mac_ctx, msg->bodyptr); |
| 1724 | cdf_mem_free((void *)(msg->bodyptr)); |
| 1725 | msg->bodyptr = NULL; |
| 1726 | break; |
| 1727 | case WMA_DFS_RADAR_IND: |
| 1728 | lim_send_sme_dfs_event_notify(mac_ctx, msg->type, |
| 1729 | (void *)msg->bodyptr); |
| 1730 | /* msg->bodyptr will be freed up by SME/CSR */ |
| 1731 | break; |
| 1732 | case WMA_DFS_BEACON_TX_SUCCESS_IND: |
| 1733 | lim_process_beacon_tx_success_ind(mac_ctx, msg->type, |
| 1734 | (void *)msg->bodyptr); |
| 1735 | cdf_mem_free((void *)msg->bodyptr); |
| 1736 | msg->bodyptr = NULL; |
| 1737 | break; |
| 1738 | case WMA_DISASSOC_TX_COMP: |
| 1739 | lim_disassoc_tx_complete_cnf(mac_ctx, msg->bodyval); |
| 1740 | break; |
| 1741 | case WMA_DEAUTH_TX_COMP: |
| 1742 | lim_deauth_tx_complete_cnf(mac_ctx, msg->bodyval); |
| 1743 | break; |
| 1744 | #ifdef FEATURE_AP_MCC_CH_AVOIDANCE |
| 1745 | case WMA_UPDATE_Q2Q_IE_IND: |
| 1746 | cdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams)); |
| 1747 | beacon_params.paramChangeBitmap = 0; |
| 1748 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 1749 | vdev_id = ((uint8_t *)msg->bodyptr)[i]; |
| 1750 | session_entry = pe_find_session_by_sme_session_id( |
| 1751 | mac_ctx, vdev_id); |
| 1752 | if (session_entry == NULL) |
| 1753 | continue; |
| 1754 | session_entry->sap_advertise_avoid_ch_ie = |
| 1755 | (uint8_t)msg->bodyval; |
| 1756 | /* |
| 1757 | * if message comes for DFS channel, no need to update: |
| 1758 | * 1) We wont have MCC with DFS channels. so no need to |
| 1759 | * add Q2Q IE |
| 1760 | * 2) We cannot end up in DFS channel SCC by channel |
| 1761 | * switch from non DFS MCC scenario, so no need to |
| 1762 | * remove Q2Q IE |
| 1763 | * 3) There is however a case where device start MCC and |
| 1764 | * then user modifies hostapd.conf and does SAP |
| 1765 | * restart, in such a case, beacon params will be |
| 1766 | * reset and thus will not contain Q2Q IE, by default |
| 1767 | */ |
| 1768 | if (cds_get_channel_state( |
| 1769 | session_entry->currentOperChannel) |
| 1770 | != CHANNEL_STATE_DFS) { |
| 1771 | beacon_params.bssIdx = session_entry->bssIdx; |
| 1772 | beacon_params.beaconInterval = |
| 1773 | session_entry->beaconParams.beaconInterval; |
| 1774 | beacon_params.paramChangeBitmap |= |
| 1775 | PARAM_BCN_INTERVAL_CHANGED; |
| 1776 | sch_set_fixed_beacon_fields(mac_ctx, |
| 1777 | session_entry); |
| 1778 | lim_send_beacon_params(mac_ctx, &beacon_params, |
| 1779 | session_entry); |
| 1780 | } |
| 1781 | } |
| 1782 | cdf_mem_free(msg->bodyptr); |
| 1783 | msg->bodyptr = NULL; |
| 1784 | break; |
| 1785 | #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ |
| 1786 | case eWNI_SME_NSS_UPDATE_REQ: |
| 1787 | case eWNI_SME_DFS_BEACON_CHAN_SW_IE_REQ: |
| 1788 | lim_process_sme_req_messages(mac_ctx, msg); |
| 1789 | cdf_mem_free((void *)msg->bodyptr); |
| 1790 | msg->bodyptr = NULL; |
| 1791 | break; |
| 1792 | case eWNI_SME_CHANNEL_CHANGE_REQ: |
| 1793 | lim_process_sme_req_messages(mac_ctx, msg); |
| 1794 | cdf_mem_free((void *)msg->bodyptr); |
| 1795 | msg->bodyptr = NULL; |
| 1796 | break; |
| 1797 | case eWNI_SME_START_BEACON_REQ: |
| 1798 | lim_process_sme_req_messages(mac_ctx, msg); |
| 1799 | cdf_mem_free((void *)msg->bodyptr); |
| 1800 | msg->bodyptr = NULL; |
| 1801 | break; |
| 1802 | case eWNI_SME_UPDATE_ADDITIONAL_IES: |
| 1803 | lim_process_sme_req_messages(mac_ctx, msg); |
| 1804 | cdf_mem_free((void *)msg->bodyptr); |
| 1805 | msg->bodyptr = NULL; |
| 1806 | break; |
| 1807 | case eWNI_SME_MODIFY_ADDITIONAL_IES: |
| 1808 | lim_process_sme_req_messages(mac_ctx, msg); |
| 1809 | cdf_mem_free((void *)msg->bodyptr); |
| 1810 | msg->bodyptr = NULL; |
| 1811 | break; |
| 1812 | #ifdef QCA_HT_2040_COEX |
| 1813 | case eWNI_SME_SET_HT_2040_MODE: |
| 1814 | lim_process_sme_req_messages(mac_ctx, msg); |
| 1815 | cdf_mem_free((void *)msg->bodyptr); |
| 1816 | msg->bodyptr = NULL; |
| 1817 | break; |
| 1818 | #endif |
| 1819 | case SIR_HAL_SOC_SET_HW_MODE_RESP: |
| 1820 | lim_process_set_hw_mode_resp(mac_ctx, msg->bodyptr); |
| 1821 | cdf_mem_free((void *)msg->bodyptr); |
| 1822 | msg->bodyptr = NULL; |
| 1823 | break; |
| 1824 | case SIR_HAL_SOC_HW_MODE_TRANS_IND: |
| 1825 | lim_process_hw_mode_trans_ind(mac_ctx, msg->bodyptr); |
| 1826 | cdf_mem_free((void *)msg->bodyptr); |
| 1827 | msg->bodyptr = NULL; |
| 1828 | break; |
| 1829 | case SIR_HAL_SOC_DUAL_MAC_CFG_RESP: |
| 1830 | lim_process_dual_mac_cfg_resp(mac_ctx, msg->bodyptr); |
| 1831 | cdf_mem_free((void *)msg->bodyptr); |
| 1832 | msg->bodyptr = NULL; |
| 1833 | break; |
| 1834 | case eWNI_SME_SET_IE_REQ: |
| 1835 | lim_process_sme_req_messages(mac_ctx, msg); |
| 1836 | cdf_mem_free((void *)msg->bodyptr); |
| 1837 | msg->bodyptr = NULL; |
| 1838 | break; |
| 1839 | default: |
| 1840 | cdf_mem_free((void *)msg->bodyptr); |
| 1841 | msg->bodyptr = NULL; |
| 1842 | /* Unwanted messages */ |
| 1843 | /* Log error */ |
| 1844 | lim_log(mac_ctx, LOGE, |
| 1845 | FL("Discarding unexpected message received %X"), |
| 1846 | msg->type); |
| 1847 | lim_print_msg_name(mac_ctx, LOGE, msg->type); |
| 1848 | break; |
| 1849 | |
| 1850 | } /* switch (msg->type) */ |
| 1851 | } /*** end lim_process_messages() ***/ |
| 1852 | |
| 1853 | /** |
| 1854 | * lim_process_deferred_message_queue |
| 1855 | * |
| 1856 | ***FUNCTION: |
| 1857 | * This function is called by LIM while exiting from Learn |
| 1858 | * mode. This function fetches messages posted to the LIM |
| 1859 | * deferred message queue limDeferredMsgQ. |
| 1860 | * |
| 1861 | ***LOGIC: |
| 1862 | * |
| 1863 | ***ASSUMPTIONS: |
| 1864 | * NA |
| 1865 | * |
| 1866 | ***NOTE: |
| 1867 | * NA |
| 1868 | * |
| 1869 | * @param pMac - Pointer to Global MAC structure |
| 1870 | * @return None |
| 1871 | */ |
| 1872 | |
| 1873 | void lim_process_deferred_message_queue(tpAniSirGlobal pMac) |
| 1874 | { |
| 1875 | tSirMsgQ limMsg = { 0, 0, 0 }; |
| 1876 | |
| 1877 | tSirMsgQ *readMsg; |
| 1878 | uint16_t size; |
| 1879 | |
| 1880 | /* |
| 1881 | ** check any deferred messages need to be processed |
| 1882 | **/ |
| 1883 | size = pMac->lim.gLimDeferredMsgQ.size; |
| 1884 | if (size > 0) { |
| 1885 | while ((readMsg = lim_read_deferred_msg_q(pMac)) != NULL) { |
| 1886 | cdf_mem_copy((uint8_t *) &limMsg, |
| 1887 | (uint8_t *) readMsg, sizeof(tSirMsgQ)); |
| 1888 | size--; |
| 1889 | lim_process_messages(pMac, &limMsg); |
| 1890 | |
| 1891 | if ((lim_is_system_in_scan_state(pMac)) |
| 1892 | || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) |
| 1893 | || (pMac->lim.gLimSystemInScanLearnMode)) |
| 1894 | break; |
| 1895 | } |
| 1896 | } |
| 1897 | } /*** end lim_process_deferred_message_queue() ***/ |
| 1898 | |
| 1899 | /** |
| 1900 | * lim_process_normal_hdd_msg() - Process the message and defer if needed |
| 1901 | * @mac_ctx : Pointer to Global MAC structure |
| 1902 | * @msg : The message need to be processed |
| 1903 | * @rsp_reqd: whether return result to hdd |
| 1904 | * |
| 1905 | * This function checks the current lim state and decide whether the message |
| 1906 | * passed will be deferred or not. |
| 1907 | * |
| 1908 | * Return: None |
| 1909 | */ |
| 1910 | static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx, tSirMsgQ *msg, |
| 1911 | uint8_t rsp_reqd) |
| 1912 | { |
| 1913 | bool defer_msg = true; |
| 1914 | |
| 1915 | /* Added For BT-AMP Support */ |
| 1916 | if ((mac_ctx->lim.gLimSystemRole == eLIM_AP_ROLE) |
| 1917 | || (mac_ctx->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE) |
| 1918 | || (mac_ctx->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE) |
| 1919 | || (mac_ctx->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)) { |
| 1920 | /* |
| 1921 | * This check is required only for the AP and in 2 cases. |
| 1922 | * 1. If we are in learn mode and we receive any of these |
| 1923 | * messages, you have to come out of scan and process the |
| 1924 | * message, hence dont defer the message here. In handler, |
| 1925 | * these message could be defered till we actually come out of |
| 1926 | * scan mode. |
| 1927 | * 2. If radar is detected, you might have to defer all of |
| 1928 | * these messages except Stop BSS request/ Switch channel |
| 1929 | * request. This decision is also made inside its handler. |
| 1930 | * |
| 1931 | * Please be careful while using the flag defer_msg. Possibly |
| 1932 | * you might end up in an infinite loop. |
| 1933 | */ |
| 1934 | if ((msg->type == eWNI_SME_START_BSS_REQ) || |
| 1935 | (msg->type == eWNI_SME_STOP_BSS_REQ) || |
| 1936 | (msg->type == eWNI_SME_SWITCH_CHL_IND)) |
| 1937 | defer_msg = false; |
| 1938 | } |
| 1939 | |
| 1940 | if (((mac_ctx->lim.gLimAddtsSent) || |
| 1941 | (lim_is_system_in_scan_state(mac_ctx))) && defer_msg) { |
| 1942 | /* |
| 1943 | * System is in DFS (Learn) mode or awaiting addts response or |
| 1944 | * if radar is detected, Defer processsing this message |
| 1945 | */ |
| 1946 | if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) { |
| 1947 | #ifdef WLAN_DEBUG |
| 1948 | mac_ctx->lim.numSme++; |
| 1949 | #endif |
| 1950 | lim_log_session_states(mac_ctx); |
| 1951 | /* Release body */ |
| 1952 | cdf_mem_free(msg->bodyptr); |
| 1953 | msg->bodyptr = NULL; |
| 1954 | } |
| 1955 | } else { |
| 1956 | /* |
| 1957 | * These messages are from HDD.Since these requests may also be |
| 1958 | * generated internally within LIM module, need to distinquish |
| 1959 | * and send response to host |
| 1960 | */ |
| 1961 | if (rsp_reqd) |
| 1962 | mac_ctx->lim.gLimRspReqd = true; |
| 1963 | #ifdef WLAN_DEBUG |
| 1964 | mac_ctx->lim.numSme++; |
| 1965 | #endif |
| 1966 | if (lim_process_sme_req_messages(mac_ctx, msg)) { |
| 1967 | /* |
| 1968 | * Release body. limProcessSmeReqMessage consumed the |
| 1969 | * buffer. We can free it. |
| 1970 | */ |
| 1971 | cdf_mem_free(msg->bodyptr); |
| 1972 | msg->bodyptr = NULL; |
| 1973 | } |
| 1974 | } |
| 1975 | } |
| 1976 | |
| 1977 | void |
| 1978 | handle_ht_capabilityand_ht_info(struct sAniSirGlobal *pMac, |
| 1979 | tpPESession psessionEntry) |
| 1980 | { |
| 1981 | tSirMacHTCapabilityInfo macHTCapabilityInfo; |
| 1982 | tSirMacHTParametersInfo macHTParametersInfo; |
| 1983 | tSirMacHTInfoField1 macHTInfoField1; |
| 1984 | tSirMacHTInfoField2 macHTInfoField2; |
| 1985 | tSirMacHTInfoField3 macHTInfoField3; |
| 1986 | uint32_t cfgValue; |
| 1987 | uint8_t *ptr; |
| 1988 | |
| 1989 | if (wlan_cfg_get_int(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != |
| 1990 | eSIR_SUCCESS) { |
| 1991 | lim_log(pMac, LOGP, |
| 1992 | FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value")); |
| 1993 | return; |
| 1994 | } |
| 1995 | ptr = (uint8_t *) &macHTCapabilityInfo; |
| 1996 | *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff); |
| 1997 | pMac->lim.gHTLsigTXOPProtection = |
| 1998 | (uint8_t) macHTCapabilityInfo.lsigTXOPProtection; |
| 1999 | pMac->lim.gHTMIMOPSState = |
| 2000 | (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave; |
| 2001 | pMac->lim.gHTGreenfield = (uint8_t) macHTCapabilityInfo.greenField; |
| 2002 | pMac->lim.gHTMaxAmsduLength = |
| 2003 | (uint8_t) macHTCapabilityInfo.maximalAMSDUsize; |
| 2004 | pMac->lim.gHTShortGI20Mhz = (uint8_t) macHTCapabilityInfo.shortGI20MHz; |
| 2005 | pMac->lim.gHTShortGI40Mhz = (uint8_t) macHTCapabilityInfo.shortGI40MHz; |
| 2006 | pMac->lim.gHTPSMPSupport = (uint8_t) macHTCapabilityInfo.psmp; |
| 2007 | pMac->lim.gHTDsssCckRate40MHzSupport = |
| 2008 | (uint8_t) macHTCapabilityInfo.dsssCckMode40MHz; |
| 2009 | |
| 2010 | if (wlan_cfg_get_int(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != |
| 2011 | eSIR_SUCCESS) { |
| 2012 | lim_log(pMac, LOGP, |
| 2013 | FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value")); |
| 2014 | return; |
| 2015 | } |
| 2016 | ptr = (uint8_t *) &macHTParametersInfo; |
| 2017 | *ptr = (uint8_t) (cfgValue & 0xff); |
| 2018 | pMac->lim.gHTAMpduDensity = (uint8_t) macHTParametersInfo.mpduDensity; |
| 2019 | pMac->lim.gHTMaxRxAMpduFactor = |
| 2020 | (uint8_t) macHTParametersInfo.maxRxAMPDUFactor; |
| 2021 | |
| 2022 | /* Get HT IE Info */ |
| 2023 | if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != |
| 2024 | eSIR_SUCCESS) { |
| 2025 | lim_log(pMac, LOGP, |
| 2026 | FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value")); |
| 2027 | return; |
| 2028 | } |
| 2029 | ptr = (uint8_t *) &macHTInfoField1; |
| 2030 | *((uint8_t *) ptr) = (uint8_t) (cfgValue & 0xff); |
| 2031 | pMac->lim.gHTServiceIntervalGranularity = |
| 2032 | (uint8_t) macHTInfoField1.serviceIntervalGranularity; |
| 2033 | pMac->lim.gHTControlledAccessOnly = |
| 2034 | (uint8_t) macHTInfoField1.controlledAccessOnly; |
| 2035 | pMac->lim.gHTRifsMode = (uint8_t) macHTInfoField1.rifsMode; |
| 2036 | |
| 2037 | if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != |
| 2038 | eSIR_SUCCESS) { |
| 2039 | lim_log(pMac, LOGP, |
| 2040 | FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value")); |
| 2041 | return; |
| 2042 | } |
| 2043 | ptr = (uint8_t *) &macHTInfoField2; |
| 2044 | *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff); |
| 2045 | pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode; |
| 2046 | |
| 2047 | if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != |
| 2048 | eSIR_SUCCESS) { |
| 2049 | lim_log(pMac, LOGP, |
| 2050 | FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value")); |
| 2051 | return; |
| 2052 | } |
| 2053 | ptr = (uint8_t *) &macHTInfoField3; |
| 2054 | *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff); |
| 2055 | pMac->lim.gHTPCOActive = (uint8_t) macHTInfoField3.pcoActive; |
| 2056 | pMac->lim.gHTPCOPhase = (uint8_t) macHTInfoField3.pcoPhase; |
| 2057 | pMac->lim.gHTSecondaryBeacon = |
| 2058 | (uint8_t) macHTInfoField3.secondaryBeacon; |
| 2059 | pMac->lim.gHTDualCTSProtection = |
| 2060 | (uint8_t) macHTInfoField3.dualCTSProtection; |
| 2061 | pMac->lim.gHTSTBCBasicMCS = (uint8_t) macHTInfoField3.basicSTBCMCS; |
| 2062 | |
| 2063 | /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session; |
| 2064 | * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old); |
| 2065 | * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist |
| 2066 | * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below |
| 2067 | */ |
| 2068 | if (psessionEntry != NULL) { |
| 2069 | psessionEntry->htCapability = |
| 2070 | IS_DOT11_MODE_HT(psessionEntry->dot11mode); |
| 2071 | psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = |
| 2072 | (uint8_t) macHTInfoField3.lsigTXOPProtectionFullSupport; |
| 2073 | } |
| 2074 | } |
| 2075 | |
| 2076 | void lim_log_session_states(tpAniSirGlobal mac_ctx) |
| 2077 | { |
| 2078 | #ifdef WLAN_DEBUG |
| 2079 | int i; |
| 2080 | |
| 2081 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 2082 | if (mac_ctx->lim.gpSession[i].valid) { |
| 2083 | CDF_TRACE(CDF_MODULE_ID_PE, LOG1, |
| 2084 | FL("sysRole(%d) Session (%d)"), |
| 2085 | mac_ctx->lim.gLimSystemRole, i); |
| 2086 | CDF_TRACE(CDF_MODULE_ID_PE, LOG1, |
| 2087 | FL("SME: Curr %s,Prev %s,MLM: Curr %s,Prev %s"), |
| 2088 | lim_sme_state_str( |
| 2089 | mac_ctx->lim.gpSession[i].limSmeState), |
| 2090 | lim_sme_state_str( |
| 2091 | mac_ctx->lim.gpSession[i].limPrevSmeState), |
| 2092 | lim_mlm_state_str( |
| 2093 | mac_ctx->lim.gpSession[i].limMlmState), |
| 2094 | lim_mlm_state_str( |
| 2095 | mac_ctx->lim.gpSession[i].limPrevMlmState)); |
| 2096 | } |
| 2097 | } |
| 2098 | #endif |
| 2099 | } |