Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012-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_send_sme_rspMessages.cc contains the functions |
| 30 | * for sending SME response/notification messages to applications |
| 31 | * above MAC software. |
| 32 | * Author: Chandra Modumudi |
| 33 | * Date: 02/13/02 |
| 34 | * History:- |
| 35 | * Date Modified by Modification Information |
| 36 | * -------------------------------------------------------------------- |
| 37 | */ |
| 38 | |
| 39 | #include "cdf_types.h" |
| 40 | #include "wni_api.h" |
| 41 | #include "sir_common.h" |
| 42 | #include "ani_global.h" |
| 43 | |
| 44 | #include "wni_cfg.h" |
| 45 | #include "sys_def.h" |
| 46 | #include "cfg_api.h" |
| 47 | |
| 48 | #include "sch_api.h" |
| 49 | #include "utils_api.h" |
| 50 | #include "lim_utils.h" |
| 51 | #include "lim_security_utils.h" |
| 52 | #include "lim_ser_des_utils.h" |
| 53 | #include "lim_send_sme_rsp_messages.h" |
| 54 | #include "lim_ibss_peer_mgmt.h" |
| 55 | #include "lim_session_utils.h" |
| 56 | #include "lim_types.h" |
| 57 | #include "sir_api.h" |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 58 | #include "cds_regdomain_common.h" |
| 59 | #include "lim_send_messages.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 60 | |
| 61 | static void lim_handle_join_rsp_status(tpAniSirGlobal mac_ctx, |
| 62 | tpPESession session_entry, tSirResultCodes result_code, |
| 63 | tpSirSmeJoinRsp sme_join_rsp); |
| 64 | |
| 65 | /** |
| 66 | * lim_send_sme_rsp() - Send Response to upper layers |
| 67 | * @mac_ctx: Pointer to Global MAC structure |
| 68 | * @msg_type: Indicates message type |
| 69 | * @result_code: Indicates the result of previously issued |
| 70 | * eWNI_SME_msg_type_REQ message |
| 71 | * |
| 72 | * This function is called by lim_process_sme_req_messages() to send |
| 73 | * eWNI_SME_START_RSP, eWNI_SME_STOP_BSS_RSP |
| 74 | * or eWNI_SME_SWITCH_CHL_RSP messages to applications above MAC |
| 75 | * Software. |
| 76 | * |
| 77 | * Return: None |
| 78 | */ |
| 79 | |
| 80 | void |
| 81 | lim_send_sme_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, |
| 82 | tSirResultCodes result_code, uint8_t sme_session_id, |
| 83 | uint16_t sme_transaction_id) |
| 84 | { |
| 85 | tSirMsgQ msg; |
| 86 | tSirSmeRsp *sme_rsp; |
| 87 | |
| 88 | lim_log(mac_ctx, LOG1, FL("Sending message %s with reasonCode %s"), |
| 89 | lim_msg_str(msg_type), lim_result_code_str(result_code)); |
| 90 | |
| 91 | sme_rsp = cdf_mem_malloc(sizeof(tSirSmeRsp)); |
| 92 | if (NULL == sme_rsp) { |
| 93 | /* Buffer not available. Log error */ |
| 94 | CDF_TRACE(CDF_MODULE_ID_PE, LOGP, |
| 95 | FL("call to AllocateMemory failed for eWNI_SME_*_RSP")); |
| 96 | return; |
| 97 | } |
| 98 | |
| 99 | sme_rsp->messageType = msg_type; |
| 100 | sme_rsp->length = sizeof(tSirSmeRsp); |
| 101 | sme_rsp->statusCode = result_code; |
| 102 | |
| 103 | sme_rsp->sessionId = sme_session_id; |
| 104 | sme_rsp->transactionId = sme_transaction_id; |
| 105 | |
| 106 | msg.type = msg_type; |
| 107 | msg.bodyptr = sme_rsp; |
| 108 | msg.bodyval = 0; |
| 109 | MTRACE(mac_trace_msg_tx(mac_ctx, sme_session_id, msg.type)); |
| 110 | |
| 111 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 112 | switch (msg_type) { |
| 113 | case eWNI_SME_STOP_BSS_RSP: |
| 114 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_STOP_BSS_RSP_EVENT, |
| 115 | NULL, (uint16_t) result_code, 0); |
| 116 | break; |
| 117 | } |
| 118 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 119 | lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT); |
| 120 | } |
| 121 | |
| 122 | |
| 123 | |
| 124 | /** |
| 125 | * lim_send_sme_roc_rsp() - Send Response to SME |
| 126 | * @mac_ctx: Pointer to Global MAC structure |
| 127 | * @status: Resume link status |
| 128 | * @result_code: Result of the ROC request |
| 129 | * @sme_session_id: SME sesson Id |
| 130 | * @scan_id: Scan Identifier |
| 131 | * |
| 132 | * This function is called to send ROC rsp |
| 133 | * message to SME. |
| 134 | * |
| 135 | * Return: None |
| 136 | */ |
| 137 | void |
| 138 | lim_send_sme_roc_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, |
| 139 | tSirResultCodes result_code, uint8_t sme_session_id, |
| 140 | uint32_t scan_id) |
| 141 | { |
| 142 | tSirMsgQ msg; |
| 143 | struct sir_roc_rsp *sme_rsp; |
| 144 | |
| 145 | lim_log(mac_ctx, LOG1, |
| 146 | FL("Sending message %s with reasonCode %s scanId %d"), |
| 147 | lim_msg_str(msg_type), lim_result_code_str(result_code), |
| 148 | scan_id); |
| 149 | |
| 150 | sme_rsp = cdf_mem_malloc(sizeof(struct sir_roc_rsp)); |
| 151 | if (NULL == sme_rsp) { |
| 152 | CDF_TRACE(CDF_MODULE_ID_PE, LOGP, |
| 153 | FL("call to AllocateMemory failed for eWNI_SME_*_RSP")); |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | sme_rsp->message_type = msg_type; |
| 158 | sme_rsp->length = sizeof(struct sir_roc_rsp); |
| 159 | sme_rsp->status = result_code; |
| 160 | |
| 161 | sme_rsp->session_id = sme_session_id; |
| 162 | sme_rsp->scan_id = scan_id; |
| 163 | |
| 164 | msg.type = msg_type; |
| 165 | msg.bodyptr = sme_rsp; |
| 166 | msg.bodyval = 0; |
| 167 | MTRACE(mac_trace_msg_tx(mac_ctx, sme_session_id, msg.type)); |
| 168 | lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT); |
| 169 | } |
| 170 | |
| 171 | |
| 172 | /** |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 173 | * lim_get_max_rate_flags() - Get rate flags |
| 174 | * @mac_ctx: Pointer to global MAC structure |
| 175 | * @sta_ds: Pointer to station ds structure |
| 176 | * |
| 177 | * This function is called to get the rate flags for a connection |
| 178 | * from the station ds structure depending on the ht and the vht |
| 179 | * channel width supported. |
| 180 | * |
| 181 | * Return: Returns the populated rate_flags |
| 182 | */ |
| 183 | uint32_t lim_get_max_rate_flags(tpAniSirGlobal mac_ctx, tpDphHashNode sta_ds) |
| 184 | { |
| 185 | uint32_t rate_flags = 0; |
| 186 | |
| 187 | if (sta_ds == NULL) { |
| 188 | lim_log(mac_ctx, LOGE, FL("sta_ds is NULL")); |
| 189 | return rate_flags; |
| 190 | } |
| 191 | |
| 192 | if (!sta_ds->mlmStaContext.htCapability && |
| 193 | !sta_ds->mlmStaContext.vhtCapability) { |
| 194 | rate_flags |= eHAL_TX_RATE_LEGACY; |
| 195 | } else { |
| 196 | if (sta_ds->mlmStaContext.vhtCapability) { |
| 197 | if (WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ == |
| 198 | sta_ds->vhtSupportedChannelWidthSet) { |
| 199 | rate_flags |= eHAL_TX_RATE_VHT80; |
| 200 | } else if (WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ == |
| 201 | sta_ds->vhtSupportedChannelWidthSet) { |
| 202 | if (sta_ds->htSupportedChannelWidthSet) |
| 203 | rate_flags |= eHAL_TX_RATE_VHT40; |
| 204 | else |
| 205 | rate_flags |= eHAL_TX_RATE_VHT20; |
| 206 | } |
| 207 | } else if (sta_ds->mlmStaContext.htCapability) { |
| 208 | if (sta_ds->htSupportedChannelWidthSet) |
| 209 | rate_flags |= eHAL_TX_RATE_HT40; |
| 210 | else |
| 211 | rate_flags |= eHAL_TX_RATE_HT20; |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | if (sta_ds->htShortGI20Mhz || sta_ds->htShortGI40Mhz) |
| 216 | rate_flags |= eHAL_TX_RATE_SGI; |
| 217 | |
| 218 | return rate_flags; |
| 219 | } |
| 220 | |
| 221 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 222 | * lim_send_sme_join_reassoc_rsp_after_resume() - Send Response to SME |
| 223 | * @mac_ctx Pointer to Global MAC structure |
| 224 | * @status Resume link status |
| 225 | * @ctx context passed while calling resmune link. |
| 226 | * (join response to be sent) |
| 227 | * |
| 228 | * This function is called to send Join/Reassoc rsp |
| 229 | * message to SME after the resume link. |
| 230 | * |
| 231 | * Return: None |
| 232 | */ |
| 233 | static void lim_send_sme_join_reassoc_rsp_after_resume(tpAniSirGlobal mac_ctx, |
| 234 | CDF_STATUS status, uint32_t *ctx) |
| 235 | { |
| 236 | tSirMsgQ msg; |
| 237 | tpSirSmeJoinRsp sme_join_rsp = (tpSirSmeJoinRsp) ctx; |
| 238 | |
| 239 | msg.type = sme_join_rsp->messageType; |
| 240 | msg.bodyptr = sme_join_rsp; |
| 241 | msg.bodyval = 0; |
| 242 | MTRACE(mac_trace_msg_tx(mac_ctx, NO_SESSION, msg.type)); |
| 243 | lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT); |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * lim_handle_join_rsp_status() - Handle the response. |
| 248 | * @mac_ctx: Pointer to Global MAC structure |
| 249 | * @session_entry: PE Session Info |
| 250 | * @result_code: Indicates the result of previously issued |
| 251 | * eWNI_SME_msgType_REQ message |
| 252 | * @sme_join_rsp The received response. |
| 253 | * |
| 254 | * This function will handle both the success and failure status |
| 255 | * of the received response. |
| 256 | * |
| 257 | * Return: None |
| 258 | */ |
| 259 | static void lim_handle_join_rsp_status(tpAniSirGlobal mac_ctx, |
| 260 | tpPESession session_entry, tSirResultCodes result_code, |
| 261 | tpSirSmeJoinRsp sme_join_rsp) |
| 262 | { |
| 263 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 264 | tSirSmeHTProfile *ht_profile; |
| 265 | #endif |
| 266 | if (result_code == eSIR_SME_SUCCESS) { |
| 267 | if (session_entry->beacon != NULL) { |
| 268 | sme_join_rsp->beaconLength = session_entry->bcnLen; |
| 269 | cdf_mem_copy(sme_join_rsp->frames, |
| 270 | session_entry->beacon, |
| 271 | sme_join_rsp->beaconLength); |
| 272 | cdf_mem_free(session_entry->beacon); |
| 273 | session_entry->beacon = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 274 | session_entry->bcnLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 275 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 276 | lim_log(mac_ctx, LOG1, FL("Beacon=%d"), |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 277 | sme_join_rsp->beaconLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 278 | #endif |
| 279 | } |
| 280 | if (session_entry->assocReq != NULL) { |
| 281 | sme_join_rsp->assocReqLength = |
| 282 | session_entry->assocReqLen; |
| 283 | cdf_mem_copy(sme_join_rsp->frames + |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 284 | sme_join_rsp->beaconLength, |
| 285 | session_entry->assocReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 286 | sme_join_rsp->assocReqLength); |
| 287 | cdf_mem_free(session_entry->assocReq); |
| 288 | session_entry->assocReq = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 289 | session_entry->assocReqLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 290 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 291 | lim_log(mac_ctx, |
| 292 | LOG1, FL("AssocReq=%d"), |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 293 | sme_join_rsp->assocReqLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 294 | #endif |
| 295 | } |
| 296 | if (session_entry->assocRsp != NULL) { |
| 297 | sme_join_rsp->assocRspLength = |
| 298 | session_entry->assocRspLen; |
| 299 | cdf_mem_copy(sme_join_rsp->frames + |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 300 | sme_join_rsp->beaconLength + |
| 301 | sme_join_rsp->assocReqLength, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 302 | session_entry->assocRsp, |
| 303 | sme_join_rsp->assocRspLength); |
| 304 | cdf_mem_free(session_entry->assocRsp); |
| 305 | session_entry->assocRsp = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 306 | session_entry->assocRspLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 307 | } |
| 308 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 309 | if (session_entry->ricData != NULL) { |
| 310 | sme_join_rsp->parsedRicRspLen = |
| 311 | session_entry->RICDataLen; |
| 312 | cdf_mem_copy(sme_join_rsp->frames + |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 313 | sme_join_rsp->beaconLength + |
| 314 | sme_join_rsp->assocReqLength + |
| 315 | sme_join_rsp->assocRspLength, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 316 | session_entry->ricData, |
| 317 | sme_join_rsp->parsedRicRspLen); |
| 318 | cdf_mem_free(session_entry->ricData); |
| 319 | session_entry->ricData = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 320 | session_entry->RICDataLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 321 | lim_log(mac_ctx, LOG1, FL("RicLength=%d"), |
| 322 | sme_join_rsp->parsedRicRspLen); |
| 323 | } |
| 324 | #endif |
| 325 | #ifdef FEATURE_WLAN_ESE |
| 326 | if (session_entry->tspecIes != NULL) { |
| 327 | sme_join_rsp->tspecIeLen = |
| 328 | session_entry->tspecLen; |
| 329 | cdf_mem_copy(sme_join_rsp->frames + |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 330 | sme_join_rsp->beaconLength + |
| 331 | sme_join_rsp->assocReqLength + |
| 332 | sme_join_rsp->assocRspLength + |
| 333 | sme_join_rsp->parsedRicRspLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 334 | session_entry->tspecIes, |
| 335 | sme_join_rsp->tspecIeLen); |
| 336 | cdf_mem_free(session_entry->tspecIes); |
| 337 | session_entry->tspecIes = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 338 | session_entry->tspecLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | lim_log(mac_ctx, LOG1, FL("ESE-TspecLen=%d"), |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 340 | sme_join_rsp->tspecIeLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 341 | } |
| 342 | #endif |
| 343 | sme_join_rsp->aid = session_entry->limAID; |
| 344 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 345 | lim_log(mac_ctx, LOG1, FL("AssocRsp=%d"), |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 346 | sme_join_rsp->assocRspLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 347 | #endif |
| 348 | sme_join_rsp->vht_channel_width = |
| 349 | session_entry->ch_width; |
| 350 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 351 | if (session_entry->cc_switch_mode != |
| 352 | CDF_MCC_TO_SCC_SWITCH_DISABLE) { |
| 353 | ht_profile = &sme_join_rsp->HTProfile; |
| 354 | ht_profile->htSupportedChannelWidthSet = |
| 355 | session_entry->htSupportedChannelWidthSet; |
| 356 | ht_profile->htRecommendedTxWidthSet = |
| 357 | session_entry->htRecommendedTxWidthSet; |
| 358 | ht_profile->htSecondaryChannelOffset = |
| 359 | session_entry->htSecondaryChannelOffset; |
| 360 | ht_profile->dot11mode = session_entry->dot11mode; |
| 361 | ht_profile->htCapability = session_entry->htCapability; |
| 362 | #ifdef WLAN_FEATURE_11AC |
| 363 | ht_profile->vhtCapability = |
| 364 | session_entry->vhtCapability; |
| 365 | ht_profile->vhtTxChannelWidthSet = |
| 366 | session_entry->vhtTxChannelWidthSet; |
| 367 | ht_profile->apCenterChan = session_entry->ch_center_freq_seg0; |
| 368 | ht_profile->apChanWidth = session_entry->ch_width; |
| 369 | #endif |
| 370 | } |
| 371 | #endif |
| 372 | } else { |
| 373 | if (session_entry->beacon != NULL) { |
| 374 | cdf_mem_free(session_entry->beacon); |
| 375 | session_entry->beacon = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 376 | session_entry->bcnLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 377 | } |
| 378 | if (session_entry->assocReq != NULL) { |
| 379 | cdf_mem_free(session_entry->assocReq); |
| 380 | session_entry->assocReq = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 381 | session_entry->assocReqLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 382 | } |
| 383 | if (session_entry->assocRsp != NULL) { |
| 384 | cdf_mem_free(session_entry->assocRsp); |
| 385 | session_entry->assocRsp = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 386 | session_entry->assocRspLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 387 | } |
| 388 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 389 | if (session_entry->ricData != NULL) { |
| 390 | cdf_mem_free(session_entry->ricData); |
| 391 | session_entry->ricData = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 392 | session_entry->RICDataLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 393 | } |
| 394 | #endif |
| 395 | #ifdef FEATURE_WLAN_ESE |
| 396 | if (session_entry->tspecIes != NULL) { |
| 397 | cdf_mem_free(session_entry->tspecIes); |
| 398 | session_entry->tspecIes = NULL; |
Sreelakshmi Konamki | 3b8ba61 | 2015-12-02 18:13:22 +0530 | [diff] [blame] | 399 | session_entry->tspecLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 400 | } |
| 401 | #endif |
| 402 | } |
| 403 | } |
| 404 | /** |
| 405 | * lim_send_sme_join_reassoc_rsp() - Send Response to Upper Layers |
| 406 | * @mac_ctx: Pointer to Global MAC structure |
| 407 | * @msg_type: Indicates message type |
| 408 | * @result_code: Indicates the result of previously issued |
| 409 | * eWNI_SME_msgType_REQ message |
| 410 | * @prot_status_code: Protocol Status Code |
| 411 | * @session_entry: PE Session Info |
| 412 | * @sme_session_id: SME Session ID |
| 413 | * @sme_transaction_id: SME Transaction ID |
| 414 | * |
| 415 | * This function is called by lim_process_sme_req_messages() to send |
| 416 | * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications |
| 417 | * above MAC Software. |
| 418 | * |
| 419 | * Return: None |
| 420 | */ |
| 421 | |
| 422 | void |
| 423 | lim_send_sme_join_reassoc_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type, |
| 424 | tSirResultCodes result_code, uint16_t prot_status_code, |
| 425 | tpPESession session_entry, uint8_t sme_session_id, |
| 426 | uint16_t sme_transaction_id) |
| 427 | { |
| 428 | tpSirSmeJoinRsp sme_join_rsp; |
| 429 | uint32_t rsp_len; |
| 430 | tpDphHashNode sta_ds = NULL; |
| 431 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 432 | if (msg_type == eWNI_SME_REASSOC_RSP) |
| 433 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_REASSOC_RSP_EVENT, |
| 434 | session_entry, (uint16_t) result_code, 0); |
| 435 | else |
| 436 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_JOIN_RSP_EVENT, |
| 437 | session_entry, (uint16_t) result_code, 0); |
| 438 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 439 | |
| 440 | lim_log(mac_ctx, LOG1, FL("Sending message %s with reasonCode %s"), |
| 441 | lim_msg_str(msg_type), lim_result_code_str(result_code)); |
| 442 | |
| 443 | if (session_entry == NULL) { |
| 444 | rsp_len = sizeof(tSirSmeJoinRsp); |
| 445 | sme_join_rsp = cdf_mem_malloc(rsp_len); |
| 446 | if (NULL == sme_join_rsp) { |
| 447 | lim_log(mac_ctx, LOGP, |
| 448 | FL("Mem Alloc fail - JOIN/REASSOC_RSP")); |
| 449 | return; |
| 450 | } |
| 451 | |
| 452 | cdf_mem_set((uint8_t *) sme_join_rsp, rsp_len, 0); |
| 453 | sme_join_rsp->beaconLength = 0; |
| 454 | sme_join_rsp->assocReqLength = 0; |
| 455 | sme_join_rsp->assocRspLength = 0; |
| 456 | } else { |
| 457 | rsp_len = session_entry->assocReqLen + |
| 458 | session_entry->assocRspLen + session_entry->bcnLen + |
| 459 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 460 | session_entry->RICDataLen + |
| 461 | #endif |
| 462 | #ifdef FEATURE_WLAN_ESE |
| 463 | session_entry->tspecLen + |
| 464 | #endif |
| 465 | sizeof(tSirSmeJoinRsp) - sizeof(uint8_t); |
| 466 | sme_join_rsp = cdf_mem_malloc(rsp_len); |
| 467 | if (NULL == sme_join_rsp) { |
| 468 | lim_log(mac_ctx, LOGP, |
| 469 | FL("MemAlloc fail - JOIN/REASSOC_RSP")); |
| 470 | return; |
| 471 | } |
| 472 | cdf_mem_set((uint8_t *) sme_join_rsp, rsp_len, 0); |
| 473 | if (result_code == eSIR_SME_SUCCESS) { |
| 474 | sta_ds = dph_get_hash_entry(mac_ctx, |
| 475 | DPH_STA_HASH_INDEX_PEER, |
| 476 | &session_entry->dph.dphHashTable); |
| 477 | if (sta_ds == NULL) { |
| 478 | lim_log(mac_ctx, LOGE, |
| 479 | FL("Get Self Sta Entry fail")); |
| 480 | } else { |
| 481 | /* Pass the peer's staId */ |
| 482 | sme_join_rsp->staId = sta_ds->staIndex; |
| 483 | sme_join_rsp->ucastSig = |
| 484 | sta_ds->ucUcastSig; |
| 485 | sme_join_rsp->bcastSig = |
| 486 | sta_ds->ucBcastSig; |
| 487 | sme_join_rsp->timingMeasCap = |
| 488 | sta_ds->timingMeasCap; |
| 489 | #ifdef FEATURE_WLAN_TDLS |
| 490 | sme_join_rsp->tdls_prohibited = |
| 491 | session_entry->tdls_prohibited; |
| 492 | sme_join_rsp->tdls_chan_swit_prohibited = |
| 493 | session_entry->tdls_chan_swit_prohibited; |
| 494 | #endif |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 495 | sme_join_rsp->nss = sta_ds->nss; |
| 496 | sme_join_rsp->max_rate_flags = |
| 497 | lim_get_max_rate_flags(mac_ctx, sta_ds); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 498 | } |
| 499 | } |
| 500 | sme_join_rsp->beaconLength = 0; |
| 501 | sme_join_rsp->assocReqLength = 0; |
| 502 | sme_join_rsp->assocRspLength = 0; |
| 503 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 504 | sme_join_rsp->parsedRicRspLen = 0; |
| 505 | #endif |
| 506 | #ifdef FEATURE_WLAN_ESE |
| 507 | sme_join_rsp->tspecIeLen = 0; |
| 508 | #endif |
| 509 | |
| 510 | lim_handle_join_rsp_status(mac_ctx, session_entry, result_code, |
| 511 | sme_join_rsp); |
| 512 | } |
| 513 | |
| 514 | sme_join_rsp->messageType = msg_type; |
| 515 | sme_join_rsp->length = (uint16_t) rsp_len; |
| 516 | sme_join_rsp->statusCode = result_code; |
| 517 | sme_join_rsp->protStatusCode = prot_status_code; |
| 518 | |
| 519 | sme_join_rsp->sessionId = sme_session_id; |
| 520 | sme_join_rsp->transactionId = sme_transaction_id; |
| 521 | |
| 522 | lim_send_sme_join_reassoc_rsp_after_resume(mac_ctx, CDF_STATUS_SUCCESS, |
| 523 | (uint32_t *)sme_join_rsp); |
| 524 | } |
| 525 | |
| 526 | /** |
| 527 | * lim_send_sme_start_bss_rsp() |
| 528 | * |
| 529 | ***FUNCTION: |
| 530 | * This function is called to send eWNI_SME_START_BSS_RSP |
| 531 | * message to applications above MAC Software. |
| 532 | * |
| 533 | ***PARAMS: |
| 534 | * |
| 535 | ***LOGIC: |
| 536 | * |
| 537 | ***ASSUMPTIONS: |
| 538 | * NA |
| 539 | * |
| 540 | ***NOTE: |
| 541 | * NA |
| 542 | * |
| 543 | * @param pMac Pointer to Global MAC structure |
| 544 | * @param msgType Indicates message type |
| 545 | * @param resultCode Indicates the result of previously issued |
| 546 | * eWNI_SME_msgType_REQ message |
| 547 | * |
| 548 | * @return None |
| 549 | */ |
| 550 | |
| 551 | void |
| 552 | lim_send_sme_start_bss_rsp(tpAniSirGlobal pMac, |
| 553 | uint16_t msgType, tSirResultCodes resultCode, |
| 554 | tpPESession psessionEntry, uint8_t smesessionId, |
| 555 | uint16_t smetransactionId) |
| 556 | { |
| 557 | |
| 558 | uint16_t size = 0; |
| 559 | tSirMsgQ mmhMsg; |
| 560 | tSirSmeStartBssRsp *pSirSmeRsp; |
| 561 | uint16_t ieLen; |
| 562 | uint16_t ieOffset, curLen; |
| 563 | |
| 564 | PELOG1(lim_log(pMac, LOG1, FL("Sending message %s with reasonCode %s"), |
| 565 | lim_msg_str(msgType), lim_result_code_str(resultCode)); |
| 566 | ) |
| 567 | |
| 568 | size = sizeof(tSirSmeStartBssRsp); |
| 569 | |
| 570 | if (psessionEntry == NULL) { |
| 571 | pSirSmeRsp = cdf_mem_malloc(size); |
| 572 | if (NULL == pSirSmeRsp) { |
| 573 | /* / Buffer not available. Log error */ |
| 574 | lim_log(pMac, LOGP, |
| 575 | FL |
| 576 | ("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP")); |
| 577 | return; |
| 578 | } |
| 579 | cdf_mem_set((uint8_t *) pSirSmeRsp, size, 0); |
| 580 | |
| 581 | } else { |
| 582 | /* subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID */ |
| 583 | ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET; |
| 584 | ieLen = psessionEntry->schBeaconOffsetBegin |
| 585 | + psessionEntry->schBeaconOffsetEnd - ieOffset; |
| 586 | /* calculate the memory size to allocate */ |
| 587 | size += ieLen; |
| 588 | |
| 589 | pSirSmeRsp = cdf_mem_malloc(size); |
| 590 | if (NULL == pSirSmeRsp) { |
| 591 | /* / Buffer not available. Log error */ |
| 592 | lim_log(pMac, LOGP, |
| 593 | FL |
| 594 | ("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP")); |
| 595 | |
| 596 | return; |
| 597 | } |
| 598 | cdf_mem_set((uint8_t *) pSirSmeRsp, size, 0); |
| 599 | size = sizeof(tSirSmeStartBssRsp); |
| 600 | if (resultCode == eSIR_SME_SUCCESS) { |
| 601 | |
| 602 | sir_copy_mac_addr(pSirSmeRsp->bssDescription.bssId, |
| 603 | psessionEntry->bssId); |
| 604 | |
| 605 | /* Read beacon interval from session */ |
| 606 | pSirSmeRsp->bssDescription.beaconInterval = |
| 607 | (uint16_t) psessionEntry->beaconParams. |
| 608 | beaconInterval; |
| 609 | pSirSmeRsp->bssType = psessionEntry->bssType; |
| 610 | |
| 611 | if (cfg_get_capability_info |
| 612 | (pMac, &pSirSmeRsp->bssDescription.capabilityInfo, |
| 613 | psessionEntry) |
| 614 | != eSIR_SUCCESS) |
| 615 | lim_log(pMac, LOGP, |
| 616 | FL |
| 617 | ("could not retrieve Capabilities value")); |
| 618 | |
| 619 | lim_get_phy_mode(pMac, |
| 620 | (uint32_t *) &pSirSmeRsp->bssDescription. |
| 621 | nwType, psessionEntry); |
| 622 | |
| 623 | pSirSmeRsp->bssDescription.channelId = |
| 624 | psessionEntry->currentOperChannel; |
| 625 | |
| 626 | curLen = psessionEntry->schBeaconOffsetBegin - ieOffset; |
| 627 | cdf_mem_copy((uint8_t *) &pSirSmeRsp->bssDescription. |
| 628 | ieFields, |
| 629 | psessionEntry->pSchBeaconFrameBegin + |
| 630 | ieOffset, (uint32_t) curLen); |
| 631 | |
| 632 | cdf_mem_copy(((uint8_t *) &pSirSmeRsp->bssDescription. |
| 633 | ieFields) + curLen, |
| 634 | psessionEntry->pSchBeaconFrameEnd, |
| 635 | (uint32_t) psessionEntry-> |
| 636 | schBeaconOffsetEnd); |
| 637 | |
| 638 | /* subtracting size of length indicator itself and size of pointer to ieFields */ |
| 639 | pSirSmeRsp->bssDescription.length = |
| 640 | sizeof(tSirBssDescription) - sizeof(uint16_t) - |
| 641 | sizeof(uint32_t) + ieLen; |
| 642 | /* This is the size of the message, subtracting the size of the pointer to ieFields */ |
| 643 | size += ieLen - sizeof(uint32_t); |
| 644 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 645 | if (psessionEntry->cc_switch_mode |
| 646 | != CDF_MCC_TO_SCC_SWITCH_DISABLE) { |
| 647 | pSirSmeRsp->HTProfile. |
| 648 | htSupportedChannelWidthSet = |
| 649 | psessionEntry->htSupportedChannelWidthSet; |
| 650 | pSirSmeRsp->HTProfile.htRecommendedTxWidthSet = |
| 651 | psessionEntry->htRecommendedTxWidthSet; |
| 652 | pSirSmeRsp->HTProfile.htSecondaryChannelOffset = |
| 653 | psessionEntry->htSecondaryChannelOffset; |
| 654 | pSirSmeRsp->HTProfile.dot11mode = |
| 655 | psessionEntry->dot11mode; |
| 656 | pSirSmeRsp->HTProfile.htCapability = |
| 657 | psessionEntry->htCapability; |
| 658 | #ifdef WLAN_FEATURE_11AC |
| 659 | pSirSmeRsp->HTProfile.vhtCapability = |
| 660 | psessionEntry->vhtCapability; |
| 661 | pSirSmeRsp->HTProfile.vhtTxChannelWidthSet = |
| 662 | psessionEntry->vhtTxChannelWidthSet; |
| 663 | pSirSmeRsp->HTProfile.apCenterChan = |
| 664 | psessionEntry->ch_center_freq_seg0; |
| 665 | pSirSmeRsp->HTProfile.apChanWidth = |
| 666 | psessionEntry->ch_width; |
| 667 | #endif |
| 668 | } |
| 669 | #endif |
| 670 | } |
| 671 | |
| 672 | } |
| 673 | |
| 674 | pSirSmeRsp->messageType = msgType; |
| 675 | pSirSmeRsp->length = size; |
| 676 | |
| 677 | /* Update SME session Id and transaction Id */ |
| 678 | pSirSmeRsp->sessionId = smesessionId; |
| 679 | pSirSmeRsp->transactionId = smetransactionId; |
| 680 | pSirSmeRsp->statusCode = resultCode; |
| 681 | if (psessionEntry != NULL) |
| 682 | pSirSmeRsp->staId = psessionEntry->staId; /* else it will be always zero smeRsp StaID = 0 */ |
| 683 | |
| 684 | mmhMsg.type = msgType; |
| 685 | mmhMsg.bodyptr = pSirSmeRsp; |
| 686 | mmhMsg.bodyval = 0; |
| 687 | if (psessionEntry == NULL) { |
| 688 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 689 | } else { |
| 690 | MTRACE(mac_trace_msg_tx |
| 691 | (pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 692 | } |
| 693 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 694 | lim_diag_event_report(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, |
| 695 | psessionEntry, (uint16_t) resultCode, 0); |
| 696 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 697 | |
| 698 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 699 | } /*** end lim_send_sme_start_bss_rsp() ***/ |
| 700 | |
| 701 | #define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20 |
| 702 | #define LIM_SIZE_OF_EACH_BSS 400 /* this is a rough estimate */ |
| 703 | |
| 704 | /** |
| 705 | * lim_send_sme_scan_rsp() - Send scan response to SME |
| 706 | * @pMac: Pointer to Global MAC structure |
| 707 | * @length: Indicates length of message |
| 708 | * @resultCode: Indicates the result of previously issued |
| 709 | * eWNI_SME_SCAN_REQ message |
| 710 | * @scan_id: scan identifier |
| 711 | * |
| 712 | * This function is called by lim_process_sme_req_messages() to send |
| 713 | * eWNI_SME_SCAN_RSP message to applications above MAC |
| 714 | * |
| 715 | * return: None |
| 716 | */ |
| 717 | |
| 718 | void |
| 719 | lim_send_sme_scan_rsp(tpAniSirGlobal pMac, tSirResultCodes resultCode, |
| 720 | uint8_t smesessionId, uint16_t smetranscationId, |
| 721 | uint32_t scan_id) |
| 722 | { |
| 723 | lim_log(pMac, LOG1, |
| 724 | FL("Sending message SME_SCAN_RSP reasonCode %s scanId %d"), |
| 725 | lim_result_code_str(resultCode), scan_id); |
| 726 | lim_post_sme_scan_rsp_message(pMac, resultCode, smesessionId, |
| 727 | smetranscationId, scan_id); |
| 728 | } |
| 729 | |
| 730 | /** |
| 731 | * lim_post_sme_scan_rsp_message() |
| 732 | * |
| 733 | ***FUNCTION: |
| 734 | * This function is called by lim_send_sme_scan_rsp() to send |
| 735 | * eWNI_SME_SCAN_RSP message with failed result code |
| 736 | * |
| 737 | ***NOTE: |
| 738 | * NA |
| 739 | * |
| 740 | * @param pMac Pointer to Global MAC structure |
| 741 | * @param length Indicates length of message |
| 742 | * @param resultCode failed result code |
| 743 | * |
| 744 | * @return None |
| 745 | */ |
| 746 | |
| 747 | void |
| 748 | lim_post_sme_scan_rsp_message(tpAniSirGlobal pMac, |
| 749 | tSirResultCodes resultCode, uint8_t smesessionId, |
| 750 | uint16_t smetransactionId, |
| 751 | uint32_t scan_id) |
| 752 | { |
| 753 | tpSirSmeScanRsp pSirSmeScanRsp; |
| 754 | tSirMsgQ mmhMsg; |
| 755 | |
| 756 | lim_log(pMac, LOG1, FL("send SME_SCAN_RSP (reasonCode %s)."), |
| 757 | lim_result_code_str(resultCode)); |
| 758 | |
| 759 | pSirSmeScanRsp = cdf_mem_malloc(sizeof(tSirSmeScanRsp)); |
| 760 | if (NULL == pSirSmeScanRsp) { |
| 761 | lim_log(pMac, LOGP, |
| 762 | FL("AllocateMemory failed for eWNI_SME_SCAN_RSP")); |
| 763 | return; |
| 764 | } |
| 765 | cdf_mem_set((void *)pSirSmeScanRsp, sizeof(tSirSmeScanRsp), 0); |
| 766 | |
| 767 | pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP; |
| 768 | pSirSmeScanRsp->statusCode = resultCode; |
| 769 | |
| 770 | /*Update SME session Id and transaction Id */ |
| 771 | pSirSmeScanRsp->sessionId = smesessionId; |
| 772 | pSirSmeScanRsp->transcationId = smetransactionId; |
| 773 | pSirSmeScanRsp->scan_id = scan_id; |
| 774 | |
| 775 | mmhMsg.type = eWNI_SME_SCAN_RSP; |
| 776 | mmhMsg.bodyptr = pSirSmeScanRsp; |
| 777 | mmhMsg.bodyval = 0; |
| 778 | |
| 779 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 780 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 781 | lim_diag_event_report(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, |
| 782 | (uint16_t) resultCode, 0); |
| 783 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 784 | |
| 785 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 786 | return; |
| 787 | |
| 788 | } /*** lim_post_sme_scan_rsp_message ***/ |
| 789 | |
| 790 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 791 | |
| 792 | /** |
| 793 | * lim_send_sme_oem_data_rsp() |
| 794 | * |
| 795 | ***FUNCTION: |
| 796 | * This function is called by lim_process_sme_req_messages() to send |
| 797 | * eWNI_SME_OEM_DATA_RSP message to applications above MAC |
| 798 | * Software. |
| 799 | * |
| 800 | ***PARAMS: |
| 801 | * |
| 802 | ***LOGIC: |
| 803 | * |
| 804 | ***ASSUMPTIONS: |
| 805 | * NA |
| 806 | * |
| 807 | ***NOTE: |
| 808 | * NA |
| 809 | * |
| 810 | * @param pMac Pointer to Global MAC structure |
| 811 | * @param pMsgBuf Indicates the mlm message |
| 812 | * @param resultCode Indicates the result of previously issued |
| 813 | * eWNI_SME_OEM_DATA_RSP message |
| 814 | * |
| 815 | * @return None |
| 816 | */ |
| 817 | |
| 818 | void lim_send_sme_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *pMsgBuf, |
| 819 | tSirResultCodes resultCode) |
| 820 | { |
| 821 | tSirMsgQ mmhMsg; |
| 822 | tSirOemDataRsp *pSirSmeOemDataRsp = NULL; |
| 823 | tLimMlmOemDataRsp *pMlmOemDataRsp = NULL; |
| 824 | uint16_t msgLength; |
| 825 | |
| 826 | /* get the pointer to the mlm message */ |
| 827 | pMlmOemDataRsp = (tLimMlmOemDataRsp *) (pMsgBuf); |
| 828 | |
| 829 | msgLength = sizeof(tSirOemDataRsp); |
| 830 | |
| 831 | /* now allocate memory for the char buffer */ |
| 832 | pSirSmeOemDataRsp = cdf_mem_malloc(msgLength); |
| 833 | if (NULL == pSirSmeOemDataRsp) { |
| 834 | lim_log(pMac, LOGP, |
| 835 | FL |
| 836 | ("call to AllocateMemory failed for pSirSmeOemDataRsp")); |
| 837 | return; |
| 838 | } |
| 839 | #if defined (ANI_LITTLE_BYTE_ENDIAN) |
| 840 | sir_store_u16_n((uint8_t *) &pSirSmeOemDataRsp->length, msgLength); |
| 841 | sir_store_u16_n((uint8_t *) &pSirSmeOemDataRsp->messageType, |
| 842 | eWNI_SME_OEM_DATA_RSP); |
| 843 | #else |
| 844 | pSirSmeOemDataRsp->length = msgLength; |
| 845 | pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP; |
| 846 | #endif |
| 847 | |
| 848 | cdf_mem_copy(pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, |
| 849 | OEM_DATA_RSP_SIZE); |
| 850 | |
| 851 | /* Now free the memory from MLM Rsp Message */ |
| 852 | cdf_mem_free(pMlmOemDataRsp); |
| 853 | |
| 854 | mmhMsg.type = eWNI_SME_OEM_DATA_RSP; |
| 855 | mmhMsg.bodyptr = pSirSmeOemDataRsp; |
| 856 | mmhMsg.bodyval = 0; |
| 857 | |
| 858 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 859 | |
| 860 | return; |
| 861 | } /*** lim_send_sme_oem_data_rsp ***/ |
| 862 | |
| 863 | #endif |
| 864 | |
| 865 | void lim_send_sme_disassoc_deauth_ntf(tpAniSirGlobal pMac, |
| 866 | CDF_STATUS status, uint32_t *pCtx) |
| 867 | { |
| 868 | tSirMsgQ mmhMsg; |
| 869 | tSirMsgQ *pMsg = (tSirMsgQ *) pCtx; |
| 870 | |
| 871 | mmhMsg.type = pMsg->type; |
| 872 | mmhMsg.bodyptr = pMsg; |
| 873 | mmhMsg.bodyval = 0; |
| 874 | |
| 875 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 876 | |
| 877 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 878 | } |
| 879 | |
| 880 | /** |
| 881 | * lim_send_sme_disassoc_ntf() |
| 882 | * |
| 883 | ***FUNCTION: |
| 884 | * This function is called by limProcessSmeMessages() to send |
| 885 | * eWNI_SME_DISASSOC_RSP/IND message to host |
| 886 | * |
| 887 | ***PARAMS: |
| 888 | * |
| 889 | ***LOGIC: |
| 890 | * |
| 891 | ***ASSUMPTIONS: |
| 892 | * NA |
| 893 | * |
| 894 | ***NOTE: |
| 895 | * This function is used for sending eWNI_SME_DISASSOC_CNF, |
| 896 | * or eWNI_SME_DISASSOC_IND to host depending on |
| 897 | * disassociation trigger. |
| 898 | * |
| 899 | * @param peerMacAddr Indicates the peer MAC addr to which |
| 900 | * disassociate was initiated |
| 901 | * @param reasonCode Indicates the reason for Disassociation |
| 902 | * @param disassocTrigger Indicates the trigger for Disassociation |
| 903 | * @param aid Indicates the STAID. This parameter is |
| 904 | * present only on AP. |
| 905 | * |
| 906 | * @return None |
| 907 | */ |
| 908 | void |
| 909 | lim_send_sme_disassoc_ntf(tpAniSirGlobal pMac, |
| 910 | tSirMacAddr peerMacAddr, |
| 911 | tSirResultCodes reasonCode, |
| 912 | uint16_t disassocTrigger, |
| 913 | uint16_t aid, |
| 914 | uint8_t smesessionId, |
| 915 | uint16_t smetransactionId, tpPESession psessionEntry) |
| 916 | { |
| 917 | |
| 918 | uint8_t *pBuf; |
| 919 | tSirSmeDisassocRsp *pSirSmeDisassocRsp; |
| 920 | tSirSmeDisassocInd *pSirSmeDisassocInd; |
| 921 | uint32_t *pMsg; |
| 922 | bool failure = false; |
| 923 | |
| 924 | lim_log(pMac, LOG1, FL("Disassoc Ntf with trigger : %d reasonCode: %d"), |
| 925 | disassocTrigger, reasonCode); |
| 926 | |
| 927 | switch (disassocTrigger) { |
| 928 | case eLIM_PEER_ENTITY_DISASSOC: |
| 929 | if (reasonCode != eSIR_SME_STA_NOT_ASSOCIATED) { |
| 930 | failure = true; |
| 931 | goto error; |
| 932 | } |
| 933 | |
| 934 | case eLIM_HOST_DISASSOC: |
| 935 | /** |
| 936 | * Disassociation response due to |
| 937 | * host triggered disassociation |
| 938 | */ |
| 939 | |
| 940 | pSirSmeDisassocRsp = cdf_mem_malloc(sizeof(tSirSmeDisassocRsp)); |
| 941 | if (NULL == pSirSmeDisassocRsp) { |
| 942 | /* Log error */ |
| 943 | lim_log(pMac, LOGP, FL("Memory allocation failed")); |
| 944 | failure = true; |
| 945 | goto error; |
| 946 | } |
| 947 | lim_log(pMac, LOG1, FL("send eWNI_SME_DISASSOC_RSP with " |
| 948 | "retCode: %d for " MAC_ADDRESS_STR), |
| 949 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 950 | pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP; |
| 951 | pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp); |
| 952 | /* sessionId */ |
| 953 | pBuf = (uint8_t *) &pSirSmeDisassocRsp->sessionId; |
| 954 | *pBuf = smesessionId; |
| 955 | pBuf++; |
| 956 | |
| 957 | /* transactionId */ |
| 958 | lim_copy_u16(pBuf, smetransactionId); |
| 959 | pBuf += sizeof(uint16_t); |
| 960 | |
| 961 | /* statusCode */ |
| 962 | lim_copy_u32(pBuf, reasonCode); |
| 963 | pBuf += sizeof(tSirResultCodes); |
| 964 | |
| 965 | /* peerMacAddr */ |
| 966 | cdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr)); |
| 967 | pBuf += sizeof(tSirMacAddr); |
| 968 | |
| 969 | /* Clear Station Stats */ |
| 970 | /* for sta, it is always 1, IBSS is handled at halInitSta */ |
| 971 | |
| 972 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 973 | |
| 974 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT, |
| 975 | psessionEntry, (uint16_t) reasonCode, 0); |
| 976 | #endif |
| 977 | pMsg = (uint32_t *) pSirSmeDisassocRsp; |
| 978 | break; |
| 979 | |
| 980 | default: |
| 981 | /** |
| 982 | * Disassociation indication due to Disassociation |
| 983 | * frame reception from peer entity or due to |
| 984 | * loss of link with peer entity. |
| 985 | */ |
| 986 | pSirSmeDisassocInd = cdf_mem_malloc(sizeof(tSirSmeDisassocInd)); |
| 987 | if (NULL == pSirSmeDisassocInd) { |
| 988 | /* Log error */ |
| 989 | lim_log(pMac, LOGP, FL("Memory allocation failed")); |
| 990 | failure = true; |
| 991 | goto error; |
| 992 | } |
| 993 | lim_log(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with " |
| 994 | "retCode: %d for " MAC_ADDRESS_STR), |
| 995 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 996 | pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND; |
| 997 | pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd); |
| 998 | |
| 999 | /* Update SME session Id and Transaction Id */ |
| 1000 | pSirSmeDisassocInd->sessionId = smesessionId; |
| 1001 | pSirSmeDisassocInd->transactionId = smetransactionId; |
| 1002 | pSirSmeDisassocInd->reasonCode = reasonCode; |
| 1003 | pBuf = (uint8_t *) &pSirSmeDisassocInd->statusCode; |
| 1004 | |
| 1005 | lim_copy_u32(pBuf, reasonCode); |
| 1006 | pBuf += sizeof(tSirResultCodes); |
| 1007 | |
| 1008 | cdf_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 1009 | pBuf += sizeof(tSirMacAddr); |
| 1010 | |
| 1011 | cdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr)); |
| 1012 | |
| 1013 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1014 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, |
| 1015 | psessionEntry, (uint16_t) reasonCode, 0); |
| 1016 | #endif |
| 1017 | pMsg = (uint32_t *) pSirSmeDisassocInd; |
| 1018 | |
| 1019 | break; |
| 1020 | } |
| 1021 | |
| 1022 | error: |
| 1023 | /* Delete the PE session Created */ |
| 1024 | if ((psessionEntry != NULL) && |
| 1025 | (LIM_IS_STA_ROLE(psessionEntry) || |
| 1026 | LIM_IS_BT_AMP_STA_ROLE(psessionEntry))) { |
| 1027 | pe_delete_session(pMac, psessionEntry); |
| 1028 | } |
| 1029 | |
| 1030 | if (false == failure) |
| 1031 | lim_send_sme_disassoc_deauth_ntf(pMac, CDF_STATUS_SUCCESS, |
| 1032 | (uint32_t *) pMsg); |
| 1033 | } /*** end lim_send_sme_disassoc_ntf() ***/ |
| 1034 | |
| 1035 | /** ----------------------------------------------------------------- |
| 1036 | \brief lim_send_sme_disassoc_ind() - sends SME_DISASSOC_IND |
| 1037 | |
| 1038 | After receiving disassociation frame from peer entity, this |
| 1039 | function sends a eWNI_SME_DISASSOC_IND to SME with a specific |
| 1040 | reason code. |
| 1041 | |
| 1042 | \param pMac - global mac structure |
| 1043 | \param pStaDs - station dph hash node |
| 1044 | \return none |
| 1045 | \sa |
| 1046 | ----------------------------------------------------------------- */ |
| 1047 | void |
| 1048 | lim_send_sme_disassoc_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1049 | tpPESession psessionEntry) |
| 1050 | { |
| 1051 | tSirMsgQ mmhMsg; |
| 1052 | tSirSmeDisassocInd *pSirSmeDisassocInd; |
| 1053 | |
| 1054 | pSirSmeDisassocInd = cdf_mem_malloc(sizeof(tSirSmeDisassocInd)); |
| 1055 | if (NULL == pSirSmeDisassocInd) { |
| 1056 | lim_log(pMac, LOGP, |
| 1057 | FL("AllocateMemory failed for eWNI_SME_DISASSOC_IND")); |
| 1058 | return; |
| 1059 | } |
| 1060 | |
| 1061 | pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND; |
| 1062 | pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd); |
| 1063 | |
| 1064 | pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId; |
| 1065 | pSirSmeDisassocInd->transactionId = psessionEntry->transactionId; |
| 1066 | pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason; |
| 1067 | pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason; |
| 1068 | |
| 1069 | cdf_mem_copy(pSirSmeDisassocInd->bssId, psessionEntry->bssId, |
| 1070 | sizeof(tSirMacAddr)); |
| 1071 | |
| 1072 | cdf_mem_copy(pSirSmeDisassocInd->peerMacAddr, pStaDs->staAddr, |
| 1073 | sizeof(tSirMacAddr)); |
| 1074 | |
| 1075 | pSirSmeDisassocInd->staId = pStaDs->staIndex; |
| 1076 | |
| 1077 | mmhMsg.type = eWNI_SME_DISASSOC_IND; |
| 1078 | mmhMsg.bodyptr = pSirSmeDisassocInd; |
| 1079 | mmhMsg.bodyval = 0; |
| 1080 | |
| 1081 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1082 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1083 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, |
| 1084 | 0, (uint16_t) pStaDs->mlmStaContext.disassocReason); |
| 1085 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1086 | |
| 1087 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1088 | |
| 1089 | } /*** end lim_send_sme_disassoc_ind() ***/ |
| 1090 | |
| 1091 | /** ----------------------------------------------------------------- |
| 1092 | \brief lim_send_sme_deauth_ind() - sends SME_DEAUTH_IND |
| 1093 | |
| 1094 | After receiving deauthentication frame from peer entity, this |
| 1095 | function sends a eWNI_SME_DEAUTH_IND to SME with a specific |
| 1096 | reason code. |
| 1097 | |
| 1098 | \param pMac - global mac structure |
| 1099 | \param pStaDs - station dph hash node |
| 1100 | \return none |
| 1101 | \sa |
| 1102 | ----------------------------------------------------------------- */ |
| 1103 | void |
| 1104 | lim_send_sme_deauth_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1105 | tpPESession psessionEntry) |
| 1106 | { |
| 1107 | tSirMsgQ mmhMsg; |
| 1108 | tSirSmeDeauthInd *pSirSmeDeauthInd; |
| 1109 | |
| 1110 | pSirSmeDeauthInd = cdf_mem_malloc(sizeof(tSirSmeDeauthInd)); |
| 1111 | if (NULL == pSirSmeDeauthInd) { |
| 1112 | lim_log(pMac, LOGP, |
| 1113 | FL("AllocateMemory failed for eWNI_SME_DEAUTH_IND ")); |
| 1114 | return; |
| 1115 | } |
| 1116 | |
| 1117 | pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND; |
| 1118 | pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd); |
| 1119 | |
| 1120 | pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId; |
| 1121 | pSirSmeDeauthInd->transactionId = psessionEntry->transactionId; |
| 1122 | if (eSIR_INFRA_AP_MODE == psessionEntry->bssType) { |
| 1123 | pSirSmeDeauthInd->statusCode = |
| 1124 | (tSirResultCodes) pStaDs->mlmStaContext.cleanupTrigger; |
| 1125 | } else { |
| 1126 | /* Need to indicatet he reascon code over the air */ |
| 1127 | pSirSmeDeauthInd->statusCode = |
| 1128 | (tSirResultCodes) pStaDs->mlmStaContext.disassocReason; |
| 1129 | } |
| 1130 | /* BSSID */ |
| 1131 | cdf_mem_copy(pSirSmeDeauthInd->bssId, psessionEntry->bssId, |
| 1132 | sizeof(tSirMacAddr)); |
| 1133 | /* peerMacAddr */ |
| 1134 | cdf_mem_copy(pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, |
| 1135 | sizeof(tSirMacAddr)); |
| 1136 | pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason; |
| 1137 | |
| 1138 | pSirSmeDeauthInd->staId = pStaDs->staIndex; |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1139 | if (eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON == |
| 1140 | pStaDs->mlmStaContext.disassocReason) |
| 1141 | pSirSmeDeauthInd->rssi = pStaDs->del_sta_ctx_rssi; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1142 | |
| 1143 | mmhMsg.type = eWNI_SME_DEAUTH_IND; |
| 1144 | mmhMsg.bodyptr = pSirSmeDeauthInd; |
| 1145 | mmhMsg.bodyval = 0; |
| 1146 | |
| 1147 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1148 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1149 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, |
| 1150 | 0, pStaDs->mlmStaContext.cleanupTrigger); |
| 1151 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1152 | |
| 1153 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1154 | return; |
| 1155 | } /*** end lim_send_sme_deauth_ind() ***/ |
| 1156 | |
| 1157 | #ifdef FEATURE_WLAN_TDLS |
| 1158 | /** |
| 1159 | * lim_send_sme_tdls_del_sta_ind() |
| 1160 | * |
| 1161 | ***FUNCTION: |
| 1162 | * This function is called to send the TDLS STA context deletion to SME. |
| 1163 | * |
| 1164 | ***LOGIC: |
| 1165 | * |
| 1166 | ***ASSUMPTIONS: |
| 1167 | * |
| 1168 | ***NOTE: |
| 1169 | * NA |
| 1170 | * |
| 1171 | * @param pMac - Pointer to global MAC structure |
| 1172 | * @param pStaDs - Pointer to internal STA Datastructure |
| 1173 | * @param psessionEntry - Pointer to the session entry |
| 1174 | * @param reasonCode - Reason for TDLS sta deletion |
| 1175 | * @return None |
| 1176 | */ |
| 1177 | void |
| 1178 | lim_send_sme_tdls_del_sta_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1179 | tpPESession psessionEntry, uint16_t reasonCode) |
| 1180 | { |
| 1181 | tSirMsgQ mmhMsg; |
| 1182 | tSirTdlsDelStaInd *pSirTdlsDelStaInd; |
| 1183 | |
| 1184 | pSirTdlsDelStaInd = cdf_mem_malloc(sizeof(tSirTdlsDelStaInd)); |
| 1185 | if (NULL == pSirTdlsDelStaInd) { |
| 1186 | lim_log(pMac, LOGP, |
| 1187 | FL |
| 1188 | ("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND ")); |
| 1189 | return; |
| 1190 | } |
| 1191 | /* messageType */ |
| 1192 | pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND; |
| 1193 | pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd); |
| 1194 | |
| 1195 | /* sessionId */ |
| 1196 | pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId; |
| 1197 | |
| 1198 | /* peerMacAddr */ |
Srinivas Girigowda | 84f4292 | 2015-11-19 16:28:05 -0800 | [diff] [blame] | 1199 | cdf_mem_copy(pSirTdlsDelStaInd->peermac.bytes, pStaDs->staAddr, |
| 1200 | CDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1201 | |
| 1202 | /* staId */ |
| 1203 | lim_copy_u16((uint8_t *) (&pSirTdlsDelStaInd->staId), |
| 1204 | (uint16_t) pStaDs->staIndex); |
| 1205 | |
| 1206 | /* reasonCode */ |
| 1207 | lim_copy_u16((uint8_t *) (&pSirTdlsDelStaInd->reasonCode), reasonCode); |
| 1208 | |
| 1209 | mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND; |
| 1210 | mmhMsg.bodyptr = pSirTdlsDelStaInd; |
| 1211 | mmhMsg.bodyval = 0; |
| 1212 | |
| 1213 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1214 | return; |
| 1215 | } /*** end lim_send_sme_tdls_del_sta_ind() ***/ |
| 1216 | |
| 1217 | /** |
| 1218 | * lim_send_sme_tdls_delete_all_peer_ind() |
| 1219 | * |
| 1220 | ***FUNCTION: |
| 1221 | * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND |
| 1222 | * message to SME. |
| 1223 | * |
| 1224 | ***LOGIC: |
| 1225 | * |
| 1226 | ***ASSUMPTIONS: |
| 1227 | * |
| 1228 | ***NOTE: |
| 1229 | * NA |
| 1230 | * |
| 1231 | * @param pMac - Pointer to global MAC structure |
| 1232 | * @param psessionEntry - Pointer to the session entry |
| 1233 | * @return None |
| 1234 | */ |
| 1235 | void |
| 1236 | lim_send_sme_tdls_delete_all_peer_ind(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 1237 | { |
| 1238 | tSirMsgQ mmhMsg; |
| 1239 | tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd; |
| 1240 | |
| 1241 | pSirTdlsDelAllPeerInd = cdf_mem_malloc(sizeof(tSirTdlsDelAllPeerInd)); |
| 1242 | if (NULL == pSirTdlsDelAllPeerInd) { |
| 1243 | lim_log(pMac, LOGP, |
| 1244 | FL |
| 1245 | ("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND")); |
| 1246 | return; |
| 1247 | } |
| 1248 | /* messageType */ |
| 1249 | pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND; |
| 1250 | pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd); |
| 1251 | |
| 1252 | /* sessionId */ |
| 1253 | pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId; |
| 1254 | |
| 1255 | mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND; |
| 1256 | mmhMsg.bodyptr = pSirTdlsDelAllPeerInd; |
| 1257 | mmhMsg.bodyval = 0; |
| 1258 | |
| 1259 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1260 | return; |
| 1261 | } /*** end lim_send_sme_tdls_delete_all_peer_ind() ***/ |
| 1262 | |
| 1263 | /** |
| 1264 | * lim_send_sme_mgmt_tx_completion() |
| 1265 | * |
| 1266 | ***FUNCTION: |
| 1267 | * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND |
| 1268 | * message to SME. |
| 1269 | * |
| 1270 | ***LOGIC: |
| 1271 | * |
| 1272 | ***ASSUMPTIONS: |
| 1273 | * |
| 1274 | ***NOTE: |
| 1275 | * NA |
| 1276 | * |
| 1277 | * @param pMac - Pointer to global MAC structure |
| 1278 | * @param psessionEntry - Pointer to the session entry |
| 1279 | * @param txCompleteStatus - TX Complete Status of Mgmt Frames |
| 1280 | * @return None |
| 1281 | */ |
| 1282 | void |
| 1283 | lim_send_sme_mgmt_tx_completion(tpAniSirGlobal pMac, |
| 1284 | tpPESession psessionEntry, uint32_t txCompleteStatus) |
| 1285 | { |
| 1286 | tSirMsgQ mmhMsg; |
| 1287 | tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd; |
| 1288 | |
| 1289 | pSirMgmtTxCompletionInd = |
| 1290 | cdf_mem_malloc(sizeof(tSirMgmtTxCompletionInd)); |
| 1291 | if (NULL == pSirMgmtTxCompletionInd) { |
| 1292 | lim_log(pMac, LOGP, |
| 1293 | FL |
| 1294 | ("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND")); |
| 1295 | return; |
| 1296 | } |
| 1297 | /* messageType */ |
| 1298 | pSirMgmtTxCompletionInd->messageType = |
| 1299 | eWNI_SME_MGMT_FRM_TX_COMPLETION_IND; |
| 1300 | pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd); |
| 1301 | |
| 1302 | /* sessionId */ |
| 1303 | pSirMgmtTxCompletionInd->sessionId = psessionEntry->smeSessionId; |
| 1304 | |
| 1305 | pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus; |
| 1306 | |
| 1307 | mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND; |
| 1308 | mmhMsg.bodyptr = pSirMgmtTxCompletionInd; |
| 1309 | mmhMsg.bodyval = 0; |
| 1310 | |
| 1311 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1312 | return; |
| 1313 | } /*** end lim_send_sme_tdls_delete_all_peer_ind() ***/ |
| 1314 | |
| 1315 | void lim_send_sme_tdls_event_notify(tpAniSirGlobal pMac, uint16_t msgType, |
| 1316 | void *events) |
| 1317 | { |
| 1318 | tSirMsgQ mmhMsg; |
| 1319 | |
| 1320 | switch (msgType) { |
| 1321 | case SIR_HAL_TDLS_SHOULD_DISCOVER: |
| 1322 | mmhMsg.type = eWNI_SME_TDLS_SHOULD_DISCOVER; |
| 1323 | break; |
| 1324 | case SIR_HAL_TDLS_SHOULD_TEARDOWN: |
| 1325 | mmhMsg.type = eWNI_SME_TDLS_SHOULD_TEARDOWN; |
| 1326 | break; |
| 1327 | case SIR_HAL_TDLS_PEER_DISCONNECTED: |
| 1328 | mmhMsg.type = eWNI_SME_TDLS_PEER_DISCONNECTED; |
| 1329 | break; |
| 1330 | } |
| 1331 | |
| 1332 | mmhMsg.bodyptr = events; |
| 1333 | mmhMsg.bodyval = 0; |
| 1334 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1335 | return; |
| 1336 | } |
| 1337 | #endif /* FEATURE_WLAN_TDLS */ |
| 1338 | |
| 1339 | /** |
| 1340 | * lim_send_sme_deauth_ntf() |
| 1341 | * |
| 1342 | ***FUNCTION: |
| 1343 | * This function is called by limProcessSmeMessages() to send |
| 1344 | * eWNI_SME_DISASSOC_RSP/IND message to host |
| 1345 | * |
| 1346 | ***PARAMS: |
| 1347 | * |
| 1348 | ***LOGIC: |
| 1349 | * |
| 1350 | ***ASSUMPTIONS: |
| 1351 | * NA |
| 1352 | * |
| 1353 | ***NOTE: |
| 1354 | * This function is used for sending eWNI_SME_DEAUTH_CNF or |
| 1355 | * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger. |
| 1356 | * |
| 1357 | * @param peerMacAddr Indicates the peer MAC addr to which |
| 1358 | * deauthentication was initiated |
| 1359 | * @param reasonCode Indicates the reason for Deauthetication |
| 1360 | * @param deauthTrigger Indicates the trigger for Deauthetication |
| 1361 | * @param aid Indicates the STAID. This parameter is present |
| 1362 | * only on AP. |
| 1363 | * |
| 1364 | * @return None |
| 1365 | */ |
| 1366 | void |
| 1367 | lim_send_sme_deauth_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, |
| 1368 | tSirResultCodes reasonCode, uint16_t deauthTrigger, |
| 1369 | uint16_t aid, uint8_t smesessionId, |
| 1370 | uint16_t smetransactionId) |
| 1371 | { |
| 1372 | uint8_t *pBuf; |
| 1373 | tSirSmeDeauthRsp *pSirSmeDeauthRsp; |
| 1374 | tSirSmeDeauthInd *pSirSmeDeauthInd; |
| 1375 | tpPESession psessionEntry; |
| 1376 | uint8_t sessionId; |
| 1377 | uint32_t *pMsg; |
| 1378 | |
| 1379 | psessionEntry = pe_find_session_by_bssid(pMac, peerMacAddr, &sessionId); |
| 1380 | switch (deauthTrigger) { |
| 1381 | case eLIM_PEER_ENTITY_DEAUTH: |
| 1382 | return; |
| 1383 | |
| 1384 | case eLIM_HOST_DEAUTH: |
| 1385 | /** |
| 1386 | * Deauthentication response to host triggered |
| 1387 | * deauthentication. |
| 1388 | */ |
| 1389 | pSirSmeDeauthRsp = cdf_mem_malloc(sizeof(tSirSmeDeauthRsp)); |
| 1390 | if (NULL == pSirSmeDeauthRsp) { |
| 1391 | /* Log error */ |
| 1392 | lim_log(pMac, LOGP, |
| 1393 | FL |
| 1394 | ("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP")); |
| 1395 | |
| 1396 | return; |
| 1397 | } |
| 1398 | lim_log(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with " |
| 1399 | "retCode: %d for" MAC_ADDRESS_STR), |
| 1400 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 1401 | pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP; |
| 1402 | pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp); |
| 1403 | pSirSmeDeauthRsp->statusCode = reasonCode; |
| 1404 | pSirSmeDeauthRsp->sessionId = smesessionId; |
| 1405 | pSirSmeDeauthRsp->transactionId = smetransactionId; |
| 1406 | |
| 1407 | pBuf = (uint8_t *) pSirSmeDeauthRsp->peerMacAddr; |
| 1408 | cdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr)); |
| 1409 | |
| 1410 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1411 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT, |
| 1412 | psessionEntry, 0, (uint16_t) reasonCode); |
| 1413 | #endif |
| 1414 | pMsg = (uint32_t *) pSirSmeDeauthRsp; |
| 1415 | |
| 1416 | break; |
| 1417 | |
| 1418 | default: |
| 1419 | /** |
| 1420 | * Deauthentication indication due to Deauthentication |
| 1421 | * frame reception from peer entity or due to |
| 1422 | * loss of link with peer entity. |
| 1423 | */ |
| 1424 | pSirSmeDeauthInd = cdf_mem_malloc(sizeof(tSirSmeDeauthInd)); |
| 1425 | if (NULL == pSirSmeDeauthInd) { |
| 1426 | /* Log error */ |
| 1427 | lim_log(pMac, LOGP, |
| 1428 | FL |
| 1429 | ("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind")); |
| 1430 | |
| 1431 | return; |
| 1432 | } |
| 1433 | lim_log(pMac, LOG1, FL("send eWNI_SME_DEAUTH_IND with " |
| 1434 | "retCode: %d for " MAC_ADDRESS_STR), |
| 1435 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 1436 | pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND; |
| 1437 | pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd); |
| 1438 | pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 1439 | |
| 1440 | /* sessionId */ |
| 1441 | pBuf = (uint8_t *) &pSirSmeDeauthInd->sessionId; |
| 1442 | *pBuf++ = smesessionId; |
| 1443 | |
| 1444 | /* transaction ID */ |
| 1445 | lim_copy_u16(pBuf, smetransactionId); |
| 1446 | pBuf += sizeof(uint16_t); |
| 1447 | |
| 1448 | /* status code */ |
| 1449 | lim_copy_u32(pBuf, reasonCode); |
| 1450 | pBuf += sizeof(tSirResultCodes); |
| 1451 | |
| 1452 | /* bssId */ |
| 1453 | cdf_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 1454 | pBuf += sizeof(tSirMacAddr); |
| 1455 | |
| 1456 | /* peerMacAddr */ |
| 1457 | cdf_mem_copy(pSirSmeDeauthInd->peerMacAddr, peerMacAddr, |
| 1458 | sizeof(tSirMacAddr)); |
| 1459 | |
| 1460 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1461 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, |
| 1462 | psessionEntry, 0, (uint16_t) reasonCode); |
| 1463 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1464 | pMsg = (uint32_t *) pSirSmeDeauthInd; |
| 1465 | |
| 1466 | break; |
| 1467 | } |
| 1468 | |
| 1469 | /*Delete the PE session created */ |
| 1470 | if (psessionEntry != NULL) { |
| 1471 | pe_delete_session(pMac, psessionEntry); |
| 1472 | } |
| 1473 | |
| 1474 | lim_send_sme_disassoc_deauth_ntf(pMac, CDF_STATUS_SUCCESS, |
| 1475 | (uint32_t *) pMsg); |
| 1476 | |
| 1477 | } /*** end lim_send_sme_deauth_ntf() ***/ |
| 1478 | |
| 1479 | /** |
| 1480 | * lim_send_sme_wm_status_change_ntf() - Send Notification |
| 1481 | * @mac_ctx: Global MAC Context |
| 1482 | * @status_change_code: Indicates the change in the wireless medium. |
| 1483 | * @status_change_info: Indicates the information associated with |
| 1484 | * change in the wireless medium. |
| 1485 | * @info_len: Indicates the length of status change information |
| 1486 | * being sent. |
| 1487 | * @session_id SessionID |
| 1488 | * |
| 1489 | * This function is called by limProcessSmeMessages() to send |
| 1490 | * eWNI_SME_WM_STATUS_CHANGE_NTF message to host. |
| 1491 | * |
| 1492 | * Return: None |
| 1493 | */ |
| 1494 | void |
| 1495 | lim_send_sme_wm_status_change_ntf(tpAniSirGlobal mac_ctx, |
| 1496 | tSirSmeStatusChangeCode status_change_code, |
| 1497 | uint32_t *status_change_info, uint16_t info_len, uint8_t session_id) |
| 1498 | { |
| 1499 | tSirMsgQ msg; |
| 1500 | tSirSmeWmStatusChangeNtf *wm_status_change_ntf; |
| 1501 | |
| 1502 | wm_status_change_ntf = cdf_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf)); |
| 1503 | if (NULL == wm_status_change_ntf) { |
| 1504 | lim_log(mac_ctx, LOGE, |
| 1505 | FL("Mem Alloc failed - eWNI_SME_WM_STATUS_CHANGE_NTF")); |
| 1506 | return; |
| 1507 | } |
| 1508 | |
| 1509 | msg.type = eWNI_SME_WM_STATUS_CHANGE_NTF; |
| 1510 | msg.bodyval = 0; |
| 1511 | msg.bodyptr = wm_status_change_ntf; |
| 1512 | |
| 1513 | switch (status_change_code) { |
| 1514 | case eSIR_SME_RADAR_DETECTED: |
| 1515 | break; |
| 1516 | default: |
| 1517 | wm_status_change_ntf->messageType = |
| 1518 | eWNI_SME_WM_STATUS_CHANGE_NTF; |
| 1519 | wm_status_change_ntf->statusChangeCode = status_change_code; |
| 1520 | wm_status_change_ntf->length = sizeof(tSirSmeWmStatusChangeNtf); |
| 1521 | wm_status_change_ntf->sessionId = session_id; |
| 1522 | if (sizeof(wm_status_change_ntf->statusChangeInfo) >= |
| 1523 | info_len) { |
| 1524 | cdf_mem_copy( |
| 1525 | (uint8_t *) &wm_status_change_ntf->statusChangeInfo, |
| 1526 | (uint8_t *) status_change_info, info_len); |
| 1527 | } |
| 1528 | lim_log(mac_ctx, LOGE, |
| 1529 | FL("**---** StatusChg: code 0x%x, length %d **---**"), |
| 1530 | status_change_code, info_len); |
| 1531 | break; |
| 1532 | } |
| 1533 | |
| 1534 | MTRACE(mac_trace_msg_tx(mac_ctx, session_id, msg.type)); |
| 1535 | if (eSIR_SUCCESS != lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT)) { |
| 1536 | cdf_mem_free(wm_status_change_ntf); |
| 1537 | lim_log(mac_ctx, LOGP, |
| 1538 | FL("lim_sys_process_mmh_msg_api failed")); |
| 1539 | } |
| 1540 | |
| 1541 | } /*** end lim_send_sme_wm_status_change_ntf() ***/ |
| 1542 | |
| 1543 | /** |
| 1544 | * lim_send_sme_set_context_rsp() |
| 1545 | * |
| 1546 | ***FUNCTION: |
| 1547 | * This function is called by limProcessSmeMessages() to send |
| 1548 | * eWNI_SME_SETCONTEXT_RSP message to host |
| 1549 | * |
| 1550 | ***PARAMS: |
| 1551 | * |
| 1552 | ***LOGIC: |
| 1553 | * |
| 1554 | ***ASSUMPTIONS: |
| 1555 | * NA |
| 1556 | * |
| 1557 | ***NOTE: |
| 1558 | * |
| 1559 | * @param pMac Pointer to Global MAC structure |
| 1560 | * @param peerMacAddr Indicates the peer MAC addr to which |
| 1561 | * setContext was performed |
| 1562 | * @param aid Indicates the aid corresponding to the peer MAC |
| 1563 | * address |
| 1564 | * @param resultCode Indicates the result of previously issued |
| 1565 | * eWNI_SME_SETCONTEXT_RSP message |
| 1566 | * |
| 1567 | * @return None |
| 1568 | */ |
| 1569 | void |
| 1570 | lim_send_sme_set_context_rsp(tpAniSirGlobal pMac, |
| 1571 | tSirMacAddr peerMacAddr, uint16_t aid, |
| 1572 | tSirResultCodes resultCode, |
| 1573 | tpPESession psessionEntry, uint8_t smesessionId, |
| 1574 | uint16_t smetransactionId) |
| 1575 | { |
| 1576 | |
| 1577 | uint8_t *pBuf; |
| 1578 | tSirMsgQ mmhMsg; |
| 1579 | tSirSmeSetContextRsp *pSirSmeSetContextRsp; |
| 1580 | |
| 1581 | pSirSmeSetContextRsp = cdf_mem_malloc(sizeof(tSirSmeSetContextRsp)); |
| 1582 | if (NULL == pSirSmeSetContextRsp) { |
| 1583 | /* Log error */ |
| 1584 | lim_log(pMac, LOGP, |
| 1585 | FL |
| 1586 | ("call to AllocateMemory failed for SmeSetContextRsp")); |
| 1587 | |
| 1588 | return; |
| 1589 | } |
| 1590 | |
| 1591 | pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP; |
| 1592 | pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp); |
| 1593 | pSirSmeSetContextRsp->statusCode = resultCode; |
| 1594 | |
| 1595 | pBuf = pSirSmeSetContextRsp->peerMacAddr; |
| 1596 | |
| 1597 | cdf_mem_copy(pBuf, (uint8_t *) peerMacAddr, sizeof(tSirMacAddr)); |
| 1598 | pBuf += sizeof(tSirMacAddr); |
| 1599 | |
| 1600 | /* Update SME session and transaction Id */ |
| 1601 | pSirSmeSetContextRsp->sessionId = smesessionId; |
| 1602 | pSirSmeSetContextRsp->transactionId = smetransactionId; |
| 1603 | |
| 1604 | mmhMsg.type = eWNI_SME_SETCONTEXT_RSP; |
| 1605 | mmhMsg.bodyptr = pSirSmeSetContextRsp; |
| 1606 | mmhMsg.bodyval = 0; |
| 1607 | if (NULL == psessionEntry) { |
| 1608 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 1609 | } else { |
| 1610 | MTRACE(mac_trace_msg_tx |
| 1611 | (pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1612 | } |
| 1613 | |
| 1614 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1615 | lim_diag_event_report(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, |
| 1616 | psessionEntry, (uint16_t) resultCode, 0); |
| 1617 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1618 | |
| 1619 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1620 | } /*** end lim_send_sme_set_context_rsp() ***/ |
| 1621 | |
| 1622 | /** |
| 1623 | * lim_send_sme_neighbor_bss_ind() |
| 1624 | * |
| 1625 | ***FUNCTION: |
| 1626 | * This function is called by lim_lookup_nadd_hash_entry() to send |
| 1627 | * eWNI_SME_NEIGHBOR_BSS_IND message to host |
| 1628 | * |
| 1629 | ***PARAMS: |
| 1630 | * |
| 1631 | ***LOGIC: |
| 1632 | * |
| 1633 | ***ASSUMPTIONS: |
| 1634 | * NA |
| 1635 | * |
| 1636 | ***NOTE: |
| 1637 | * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to |
| 1638 | * host upon detecting new BSS during background scanning if CFG |
| 1639 | * option is enabled for sending such indication |
| 1640 | * |
| 1641 | * @param pMac - Pointer to Global MAC structure |
| 1642 | * @return None |
| 1643 | */ |
| 1644 | |
| 1645 | void |
| 1646 | lim_send_sme_neighbor_bss_ind(tpAniSirGlobal pMac, tLimScanResultNode *pBssDescr) |
| 1647 | { |
| 1648 | tSirMsgQ msgQ; |
| 1649 | uint32_t val; |
| 1650 | tSirSmeNeighborBssInd *pNewBssInd; |
| 1651 | |
| 1652 | if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) || |
| 1653 | ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) && |
| 1654 | pMac->lim.gLimRspReqd)) { |
| 1655 | /* LIM is not in background scan state OR */ |
| 1656 | /* current scan is initiated by HDD. */ |
| 1657 | /* No need to send new BSS indication to HDD */ |
| 1658 | return; |
| 1659 | } |
| 1660 | |
| 1661 | if (wlan_cfg_get_int(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != |
| 1662 | eSIR_SUCCESS) { |
| 1663 | lim_log(pMac, LOGP, |
| 1664 | FL("could not get NEIGHBOR_BSS_IND from CFG")); |
| 1665 | |
| 1666 | return; |
| 1667 | } |
| 1668 | |
| 1669 | if (val == 0) |
| 1670 | return; |
| 1671 | |
| 1672 | /** |
| 1673 | * Need to indicate new BSSs found during |
| 1674 | * background scanning to host. |
| 1675 | * Allocate buffer for sending indication. |
| 1676 | * Length of buffer is length of BSS description |
| 1677 | * and length of header itself |
| 1678 | */ |
| 1679 | val = pBssDescr->bssDescription.length + sizeof(uint16_t) + |
| 1680 | sizeof(uint32_t) + sizeof(uint8_t); |
| 1681 | pNewBssInd = cdf_mem_malloc(val); |
| 1682 | if (NULL == pNewBssInd) { |
| 1683 | /* Log error */ |
| 1684 | lim_log(pMac, LOGP, |
| 1685 | FL |
| 1686 | ("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND")); |
| 1687 | |
| 1688 | return; |
| 1689 | } |
| 1690 | |
| 1691 | pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND; |
| 1692 | pNewBssInd->length = (uint16_t) val; |
| 1693 | pNewBssInd->sessionId = 0; |
| 1694 | |
| 1695 | cdf_mem_copy((uint8_t *) pNewBssInd->bssDescription, |
| 1696 | (uint8_t *) &pBssDescr->bssDescription, |
| 1697 | pBssDescr->bssDescription.length + sizeof(uint16_t)); |
| 1698 | |
| 1699 | msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND; |
| 1700 | msgQ.bodyptr = pNewBssInd; |
| 1701 | msgQ.bodyval = 0; |
| 1702 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 1703 | lim_sys_process_mmh_msg_api(pMac, &msgQ, ePROT); |
| 1704 | } /*** end lim_send_sme_neighbor_bss_ind() ***/ |
| 1705 | |
| 1706 | /** ----------------------------------------------------------------- |
| 1707 | \brief lim_send_sme_addts_rsp() - sends SME ADDTS RSP |
| 1708 | \ This function sends a eWNI_SME_ADDTS_RSP to SME. |
| 1709 | \ SME only looks at rc and tspec field. |
| 1710 | \param pMac - global mac structure |
| 1711 | \param rspReqd - is SmeAddTsRsp required |
| 1712 | \param status - status code of SME_ADD_TS_RSP |
| 1713 | \return tspec |
| 1714 | \sa |
| 1715 | ----------------------------------------------------------------- */ |
| 1716 | void |
| 1717 | lim_send_sme_addts_rsp(tpAniSirGlobal pMac, uint8_t rspReqd, uint32_t status, |
| 1718 | tpPESession psessionEntry, tSirMacTspecIE tspec, |
| 1719 | uint8_t smesessionId, uint16_t smetransactionId) |
| 1720 | { |
| 1721 | tpSirAddtsRsp rsp; |
| 1722 | tSirMsgQ mmhMsg; |
| 1723 | |
| 1724 | if (!rspReqd) |
| 1725 | return; |
| 1726 | |
| 1727 | rsp = cdf_mem_malloc(sizeof(tSirAddtsRsp)); |
| 1728 | if (NULL == rsp) { |
| 1729 | lim_log(pMac, LOGP, FL("AllocateMemory failed for ADDTS_RSP")); |
| 1730 | return; |
| 1731 | } |
| 1732 | |
| 1733 | cdf_mem_set((uint8_t *) rsp, sizeof(*rsp), 0); |
| 1734 | rsp->messageType = eWNI_SME_ADDTS_RSP; |
| 1735 | rsp->rc = status; |
| 1736 | rsp->rsp.status = (enum eSirMacStatusCodes)status; |
| 1737 | rsp->rsp.tspec = tspec; |
| 1738 | /* Update SME session Id and transcation Id */ |
| 1739 | rsp->sessionId = smesessionId; |
| 1740 | rsp->transactionId = smetransactionId; |
| 1741 | |
| 1742 | mmhMsg.type = eWNI_SME_ADDTS_RSP; |
| 1743 | mmhMsg.bodyptr = rsp; |
| 1744 | mmhMsg.bodyval = 0; |
| 1745 | if (NULL == psessionEntry) { |
| 1746 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 1747 | } else { |
| 1748 | MTRACE(mac_trace_msg_tx |
| 1749 | (pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1750 | } |
| 1751 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1752 | lim_diag_event_report(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, |
| 1753 | 0); |
| 1754 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1755 | |
| 1756 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1757 | return; |
| 1758 | } |
| 1759 | |
| 1760 | void |
| 1761 | lim_send_sme_delts_rsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, uint32_t status, |
| 1762 | tpPESession psessionEntry, uint8_t smesessionId, |
| 1763 | uint16_t smetransactionId) |
| 1764 | { |
| 1765 | tpSirDeltsRsp rsp; |
| 1766 | tSirMsgQ mmhMsg; |
| 1767 | |
| 1768 | lim_log(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d", |
| 1769 | delts->aid, |
| 1770 | delts->req.tsinfo.traffic.tsid, |
| 1771 | delts->req.tsinfo.traffic.userPrio, status); |
| 1772 | if (!delts->rspReqd) |
| 1773 | return; |
| 1774 | |
| 1775 | rsp = cdf_mem_malloc(sizeof(tSirDeltsRsp)); |
| 1776 | if (NULL == rsp) { |
| 1777 | /* Log error */ |
| 1778 | lim_log(pMac, LOGP, FL("AllocateMemory failed for DELTS_RSP")); |
| 1779 | return; |
| 1780 | } |
| 1781 | cdf_mem_set((uint8_t *) rsp, sizeof(*rsp), 0); |
| 1782 | |
| 1783 | if (psessionEntry != NULL) { |
| 1784 | |
| 1785 | rsp->aid = delts->aid; |
Srinivas Girigowda | bab8893 | 2015-12-03 19:18:11 -0800 | [diff] [blame^] | 1786 | cdf_copy_macaddr(&rsp->macaddr, &delts->macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1787 | cdf_mem_copy((uint8_t *) &rsp->rsp, (uint8_t *) &delts->req, |
| 1788 | sizeof(tSirDeltsReqInfo)); |
| 1789 | } |
| 1790 | |
| 1791 | rsp->messageType = eWNI_SME_DELTS_RSP; |
| 1792 | rsp->rc = status; |
| 1793 | |
| 1794 | /* Update SME session Id and transcation Id */ |
| 1795 | rsp->sessionId = smesessionId; |
| 1796 | rsp->transactionId = smetransactionId; |
| 1797 | |
| 1798 | mmhMsg.type = eWNI_SME_DELTS_RSP; |
| 1799 | mmhMsg.bodyptr = rsp; |
| 1800 | mmhMsg.bodyval = 0; |
| 1801 | if (NULL == psessionEntry) { |
| 1802 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 1803 | } else { |
| 1804 | MTRACE(mac_trace_msg_tx |
| 1805 | (pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1806 | } |
| 1807 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1808 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, |
| 1809 | (uint16_t) status, 0); |
| 1810 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1811 | |
| 1812 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1813 | } |
| 1814 | |
| 1815 | void |
| 1816 | lim_send_sme_delts_ind(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, uint16_t aid, |
| 1817 | tpPESession psessionEntry) |
| 1818 | { |
| 1819 | tpSirDeltsRsp rsp; |
| 1820 | tSirMsgQ mmhMsg; |
| 1821 | |
| 1822 | lim_log(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)", |
| 1823 | aid, delts->tsinfo.traffic.tsid, delts->tsinfo.traffic.userPrio); |
| 1824 | |
| 1825 | rsp = cdf_mem_malloc(sizeof(tSirDeltsRsp)); |
| 1826 | if (NULL == rsp) { |
| 1827 | /* Log error */ |
| 1828 | lim_log(pMac, LOGP, FL("AllocateMemory failed for DELTS_IND")); |
| 1829 | return; |
| 1830 | } |
| 1831 | cdf_mem_set((uint8_t *) rsp, sizeof(*rsp), 0); |
| 1832 | |
| 1833 | rsp->messageType = eWNI_SME_DELTS_IND; |
| 1834 | rsp->rc = eSIR_SUCCESS; |
| 1835 | rsp->aid = aid; |
| 1836 | cdf_mem_copy((uint8_t *) &rsp->rsp, (uint8_t *) delts, sizeof(*delts)); |
| 1837 | |
| 1838 | /* Update SME session Id and SME transaction Id */ |
| 1839 | |
| 1840 | rsp->sessionId = psessionEntry->smeSessionId; |
| 1841 | rsp->transactionId = psessionEntry->transactionId; |
| 1842 | |
| 1843 | mmhMsg.type = eWNI_SME_DELTS_IND; |
| 1844 | mmhMsg.bodyptr = rsp; |
| 1845 | mmhMsg.bodyval = 0; |
| 1846 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1847 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1848 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, |
| 1849 | 0); |
| 1850 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1851 | |
| 1852 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1853 | } |
| 1854 | |
| 1855 | /** |
| 1856 | * lim_send_sme_pe_statistics_rsp() |
| 1857 | * |
| 1858 | ***FUNCTION: |
| 1859 | * This function is called to send 802.11 statistics response to HDD. |
| 1860 | * This function posts the result back to HDD. This is a response to |
| 1861 | * HDD's request for statistics. |
| 1862 | * |
| 1863 | ***PARAMS: |
| 1864 | * |
| 1865 | ***LOGIC: |
| 1866 | * |
| 1867 | ***ASSUMPTIONS: |
| 1868 | * NA |
| 1869 | * |
| 1870 | ***NOTE: |
| 1871 | * NA |
| 1872 | * |
| 1873 | * @param pMac Pointer to Global MAC structure |
| 1874 | * @param p80211Stats Statistics sent in response |
| 1875 | * @param resultCode TODO: |
| 1876 | * |
| 1877 | * |
| 1878 | * @return none |
| 1879 | */ |
| 1880 | |
| 1881 | void |
| 1882 | lim_send_sme_pe_statistics_rsp(tpAniSirGlobal pMac, uint16_t msgType, void *stats) |
| 1883 | { |
| 1884 | tSirMsgQ mmhMsg; |
| 1885 | uint8_t sessionId; |
| 1886 | tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats; |
| 1887 | tpPESession pPeSessionEntry; |
| 1888 | |
| 1889 | /* Get the Session Id based on Sta Id */ |
| 1890 | pPeSessionEntry = |
| 1891 | pe_find_session_by_sta_id(pMac, pPeStats->staId, &sessionId); |
| 1892 | |
| 1893 | /* Fill the Session Id */ |
| 1894 | if (NULL != pPeSessionEntry) { |
| 1895 | /* Fill the Session Id */ |
| 1896 | pPeStats->sessionId = pPeSessionEntry->smeSessionId; |
| 1897 | } |
| 1898 | |
| 1899 | pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP; |
| 1900 | |
| 1901 | /* msgType should be WMA_GET_STATISTICS_RSP */ |
| 1902 | mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP; |
| 1903 | |
| 1904 | mmhMsg.bodyptr = stats; |
| 1905 | mmhMsg.bodyval = 0; |
| 1906 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 1907 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1908 | |
| 1909 | return; |
| 1910 | |
| 1911 | } /*** end lim_send_sme_pe_statistics_rsp() ***/ |
| 1912 | |
| 1913 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
| 1914 | /** |
| 1915 | * lim_send_sme_pe_ese_tsm_rsp() |
| 1916 | * |
| 1917 | ***FUNCTION: |
| 1918 | * This function is called to send tsm stats response to HDD. |
| 1919 | * This function posts the result back to HDD. This is a response to |
| 1920 | * HDD's request to get tsm stats. |
| 1921 | * |
| 1922 | ***PARAMS: |
| 1923 | * @param pMac - Pointer to global pMac structure |
| 1924 | * @param pStats - Pointer to TSM Stats |
| 1925 | * |
| 1926 | * @return none |
| 1927 | */ |
| 1928 | |
| 1929 | void lim_send_sme_pe_ese_tsm_rsp(tpAniSirGlobal pMac, tAniGetTsmStatsRsp *pStats) |
| 1930 | { |
| 1931 | tSirMsgQ mmhMsg; |
| 1932 | uint8_t sessionId; |
| 1933 | tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats; |
| 1934 | tpPESession pPeSessionEntry = NULL; |
| 1935 | |
| 1936 | /* Get the Session Id based on Sta Id */ |
| 1937 | pPeSessionEntry = |
| 1938 | pe_find_session_by_sta_id(pMac, pPeStats->staId, &sessionId); |
| 1939 | |
| 1940 | /* Fill the Session Id */ |
| 1941 | if (NULL != pPeSessionEntry) { |
| 1942 | /* Fill the Session Id */ |
| 1943 | pPeStats->sessionId = pPeSessionEntry->smeSessionId; |
| 1944 | } else { |
| 1945 | PELOGE(lim_log |
| 1946 | (pMac, LOGE, FL("Session not found for the Sta id(%d)"), |
| 1947 | pPeStats->staId); |
| 1948 | ) |
| 1949 | return; |
| 1950 | } |
| 1951 | |
| 1952 | pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP; |
| 1953 | pPeStats->tsmMetrics.RoamingCount |
| 1954 | = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount; |
| 1955 | pPeStats->tsmMetrics.RoamingDly |
| 1956 | = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly; |
| 1957 | |
| 1958 | mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP; |
| 1959 | mmhMsg.bodyptr = pStats; |
| 1960 | mmhMsg.bodyval = 0; |
| 1961 | MTRACE(mac_trace_msg_tx(pMac, sessionId, mmhMsg.type)); |
| 1962 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1963 | |
| 1964 | return; |
| 1965 | } /*** end lim_send_sme_pe_ese_tsm_rsp() ***/ |
| 1966 | |
| 1967 | #endif /* FEATURE_WLAN_ESE) && FEATURE_WLAN_ESE_UPLOAD */ |
| 1968 | |
| 1969 | void |
| 1970 | lim_send_sme_ibss_peer_ind(tpAniSirGlobal pMac, |
| 1971 | tSirMacAddr peerMacAddr, |
| 1972 | uint16_t staIndex, |
| 1973 | uint8_t ucastIdx, |
| 1974 | uint8_t bcastIdx, |
| 1975 | uint8_t *beacon, |
| 1976 | uint16_t beaconLen, uint16_t msgType, uint8_t sessionId) |
| 1977 | { |
| 1978 | tSirMsgQ mmhMsg; |
| 1979 | tSmeIbssPeerInd *pNewPeerInd; |
| 1980 | |
| 1981 | pNewPeerInd = cdf_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen); |
| 1982 | if (NULL == pNewPeerInd) { |
| 1983 | PELOGE(lim_log(pMac, LOGE, FL("Failed to allocate memory"));) |
| 1984 | return; |
| 1985 | } |
| 1986 | |
| 1987 | cdf_mem_set((void *)pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen), |
| 1988 | 0); |
| 1989 | |
Srinivas Girigowda | 01d1c3c | 2015-11-25 16:54:41 -0800 | [diff] [blame] | 1990 | cdf_mem_copy((uint8_t *) pNewPeerInd->peer_addr.bytes, |
| 1991 | peerMacAddr, CDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1992 | pNewPeerInd->staId = staIndex; |
| 1993 | pNewPeerInd->ucastSig = ucastIdx; |
| 1994 | pNewPeerInd->bcastSig = bcastIdx; |
| 1995 | pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen; |
| 1996 | pNewPeerInd->mesgType = msgType; |
| 1997 | pNewPeerInd->sessionId = sessionId; |
| 1998 | |
| 1999 | if (beacon != NULL) { |
| 2000 | cdf_mem_copy((void *)((uint8_t *) pNewPeerInd + |
| 2001 | sizeof(tSmeIbssPeerInd)), (void *)beacon, |
| 2002 | beaconLen); |
| 2003 | } |
| 2004 | |
| 2005 | mmhMsg.type = msgType; |
| 2006 | mmhMsg.bodyptr = pNewPeerInd; |
| 2007 | MTRACE(mac_trace_msg_tx(pMac, sessionId, mmhMsg.type)); |
| 2008 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2009 | |
| 2010 | } |
| 2011 | |
| 2012 | /** |
| 2013 | * lim_handle_csa_offload_msg() - Handle CSA offload message |
| 2014 | * @mac_ctx: pointer to global adapter context |
| 2015 | * @msg: Message pointer. |
| 2016 | * |
| 2017 | * Return: None |
| 2018 | */ |
| 2019 | void lim_handle_csa_offload_msg(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) |
| 2020 | { |
| 2021 | tpPESession session_entry; |
| 2022 | tSirMsgQ mmh_msg; |
| 2023 | tpCSAOffloadParams csa_params = (tpCSAOffloadParams) (msg->bodyptr); |
| 2024 | tpSmeCsaOffloadInd csa_offload_ind; |
| 2025 | tpDphHashNode sta_ds = NULL; |
| 2026 | uint8_t session_id; |
| 2027 | uint16_t aid = 0; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2028 | uint16_t chan_space = 0; |
| 2029 | int cb_mode = 0; |
| 2030 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2031 | tLimWiderBWChannelSwitchInfo *chnl_switch_info = NULL; |
| 2032 | |
| 2033 | if (!csa_params) { |
| 2034 | lim_log(mac_ctx, LOGE, FL("limMsgQ body ptr is NULL")); |
| 2035 | return; |
| 2036 | } |
| 2037 | |
| 2038 | session_entry = |
| 2039 | pe_find_session_by_bssid(mac_ctx, |
| 2040 | csa_params->bssId, &session_id); |
| 2041 | if (!session_entry) { |
| 2042 | lim_log(mac_ctx, LOGE, |
| 2043 | FL("Session does not exist")); |
| 2044 | goto err; |
| 2045 | } |
| 2046 | |
| 2047 | sta_ds = dph_lookup_hash_entry(mac_ctx, session_entry->bssId, &aid, |
| 2048 | &session_entry->dph.dphHashTable); |
| 2049 | |
| 2050 | if (!sta_ds) { |
| 2051 | lim_log(mac_ctx, LOGE, |
| 2052 | FL("sta_ds does not exist")); |
| 2053 | goto err; |
| 2054 | } |
| 2055 | |
| 2056 | if (LIM_IS_STA_ROLE(session_entry)) { |
Masti, Narayanraddi | 1c63044 | 2015-11-02 12:03:50 +0530 | [diff] [blame] | 2057 | /* |
| 2058 | * on receiving channel switch announcement from AP, delete all |
| 2059 | * TDLS peers before leaving BSS and proceed for channel switch |
| 2060 | */ |
| 2061 | lim_delete_tdls_peers(mac_ctx, session_entry); |
| 2062 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2063 | session_entry->gLimChannelSwitch.switchMode = |
| 2064 | csa_params->switchmode; |
| 2065 | /* timer already started by firmware, switch immediately */ |
| 2066 | session_entry->gLimChannelSwitch.switchCount = 0; |
| 2067 | session_entry->gLimChannelSwitch.primaryChannel = |
| 2068 | csa_params->channel; |
| 2069 | session_entry->gLimChannelSwitch.state = |
| 2070 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2071 | session_entry->gLimChannelSwitch.ch_width = CH_WIDTH_20MHZ; |
| 2072 | |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2073 | session_entry->gLimChannelSwitch.ch_center_freq_seg0 = 0; |
| 2074 | session_entry->gLimChannelSwitch.ch_center_freq_seg1 = 0; |
| 2075 | chnl_switch_info = |
| 2076 | &session_entry->gLimWiderBWChannelSwitch; |
| 2077 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2078 | if (session_entry->vhtCapability && |
| 2079 | session_entry->htSupportedChannelWidthSet) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2080 | if (csa_params->ies_present_flag & lim_wbw_ie_present) { |
| 2081 | chnl_switch_info->newChanWidth = |
| 2082 | csa_params->new_ch_width; |
| 2083 | chnl_switch_info->newCenterChanFreq0 = |
| 2084 | csa_params->new_ch_freq_seg1; |
| 2085 | chnl_switch_info->newCenterChanFreq1 = |
| 2086 | csa_params->new_ch_freq_seg2; |
| 2087 | session_entry->gLimChannelSwitch.state = |
| 2088 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2089 | session_entry->gLimChannelSwitch.ch_width = |
| 2090 | csa_params->new_ch_width + 1; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2091 | } else if (csa_params->ies_present_flag |
| 2092 | & lim_xcsa_ie_present) { |
| 2093 | chan_space = |
| 2094 | cds_regdm_get_chanwidth_from_opclass( |
| 2095 | mac_ctx->scan.countryCodeCurrent, |
| 2096 | csa_params->channel, |
| 2097 | csa_params->new_op_class); |
| 2098 | session_entry->gLimChannelSwitch.state = |
| 2099 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2100 | |
| 2101 | if (chan_space == 80) { |
| 2102 | chnl_switch_info->newChanWidth = |
| 2103 | CH_WIDTH_80MHZ; |
| 2104 | } else if (chan_space == 40) { |
| 2105 | chnl_switch_info->newChanWidth = |
| 2106 | CH_WIDTH_40MHZ; |
| 2107 | } else { |
| 2108 | chnl_switch_info->newChanWidth = |
| 2109 | CH_WIDTH_20MHZ; |
| 2110 | session_entry->gLimChannelSwitch.state = |
| 2111 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2112 | } |
| 2113 | |
| 2114 | cb_mode = lim_select_cb_mode_for_sta( |
| 2115 | session_entry, |
| 2116 | csa_params->channel, |
| 2117 | chan_space); |
| 2118 | |
| 2119 | chnl_switch_info->newCenterChanFreq0 = |
| 2120 | lim_get_center_channel(mac_ctx, |
| 2121 | csa_params->channel, |
| 2122 | cb_mode, |
| 2123 | chnl_switch_info->newChanWidth); |
| 2124 | /* |
| 2125 | * This is not applicable for 20/40/80 MHz. |
| 2126 | * Only used when we support 80+80 MHz operation. |
| 2127 | * In case of 80+80 MHz, this parameter indicates |
| 2128 | * center channel frequency index of 80 MHz |
| 2129 | * channel offrequency segment 1. |
| 2130 | */ |
| 2131 | chnl_switch_info->newCenterChanFreq1 = 0; |
| 2132 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2133 | } |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2134 | session_entry->gLimChannelSwitch.ch_center_freq_seg0 = |
| 2135 | chnl_switch_info->newCenterChanFreq0; |
| 2136 | session_entry->gLimChannelSwitch.ch_center_freq_seg1 = |
| 2137 | chnl_switch_info->newCenterChanFreq1; |
| 2138 | session_entry->gLimChannelSwitch.ch_width = |
| 2139 | chnl_switch_info->newChanWidth; |
| 2140 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2141 | } else if (session_entry->htSupportedChannelWidthSet) { |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2142 | if (csa_params->ies_present_flag |
| 2143 | & lim_xcsa_ie_present) { |
| 2144 | chan_space = |
| 2145 | cds_regdm_get_chanwidth_from_opclass( |
| 2146 | mac_ctx->scan.countryCodeCurrent, |
| 2147 | csa_params->channel, |
| 2148 | csa_params->new_op_class); |
| 2149 | session_entry->gLimChannelSwitch.state = |
| 2150 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2151 | if (chan_space == 40) { |
| 2152 | session_entry-> |
| 2153 | gLimChannelSwitch.ch_width = |
| 2154 | CH_WIDTH_40MHZ; |
| 2155 | chnl_switch_info->newChanWidth = |
| 2156 | CH_WIDTH_40MHZ; |
| 2157 | cb_mode = lim_select_cb_mode_for_sta( |
| 2158 | session_entry, |
| 2159 | csa_params->channel, |
| 2160 | chan_space); |
| 2161 | if (cb_mode == |
| 2162 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) { |
| 2163 | session_entry-> |
| 2164 | gLimChannelSwitch. |
| 2165 | ch_center_freq_seg0 = |
| 2166 | csa_params->channel + 2; |
| 2167 | } else if (cb_mode == |
| 2168 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) { |
| 2169 | session_entry-> |
| 2170 | gLimChannelSwitch. |
| 2171 | ch_center_freq_seg0 = |
| 2172 | csa_params->channel - 2; |
| 2173 | } |
| 2174 | |
| 2175 | } else { |
| 2176 | session_entry-> |
| 2177 | gLimChannelSwitch.ch_width = |
| 2178 | CH_WIDTH_20MHZ; |
| 2179 | chnl_switch_info->newChanWidth = |
| 2180 | CH_WIDTH_40MHZ; |
| 2181 | session_entry->gLimChannelSwitch.state = |
| 2182 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2183 | } |
| 2184 | |
| 2185 | |
| 2186 | } |
| 2187 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2188 | if (csa_params->sec_chan_offset) { |
| 2189 | session_entry->gLimChannelSwitch.ch_width = |
| 2190 | CH_WIDTH_40MHZ; |
| 2191 | session_entry->gLimChannelSwitch.state = |
| 2192 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2193 | } else { |
| 2194 | session_entry->htSupportedChannelWidthSet = |
| 2195 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 2196 | session_entry->htRecommendedTxWidthSet = |
| 2197 | session_entry->htSupportedChannelWidthSet; |
| 2198 | } |
| 2199 | } |
| 2200 | lim_log(mac_ctx, LOG1, FL("new ch width = %d"), |
| 2201 | session_entry->gLimChannelSwitch.ch_width); |
| 2202 | |
| 2203 | lim_prepare_for11h_channel_switch(mac_ctx, session_entry); |
| 2204 | csa_offload_ind = cdf_mem_malloc(sizeof(tSmeCsaOffloadInd)); |
| 2205 | if (NULL == csa_offload_ind) { |
| 2206 | lim_log(mac_ctx, LOGE, |
| 2207 | FL("memalloc fail eWNI_SME_CSA_OFFLOAD_EVENT")); |
| 2208 | goto err; |
| 2209 | } |
| 2210 | |
| 2211 | cdf_mem_set(csa_offload_ind, sizeof(tSmeCsaOffloadInd), 0); |
| 2212 | csa_offload_ind->mesgType = eWNI_SME_CSA_OFFLOAD_EVENT; |
| 2213 | csa_offload_ind->mesgLen = sizeof(tSmeCsaOffloadInd); |
Srinivas Girigowda | c9148f7 | 2015-11-25 12:42:32 -0800 | [diff] [blame] | 2214 | cdf_mem_copy(csa_offload_ind->bssid.bytes, session_entry->bssId, |
| 2215 | CDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2216 | mmh_msg.type = eWNI_SME_CSA_OFFLOAD_EVENT; |
| 2217 | mmh_msg.bodyptr = csa_offload_ind; |
| 2218 | mmh_msg.bodyval = 0; |
| 2219 | lim_log(mac_ctx, LOG1, |
Srinivas Girigowda | c9148f7 | 2015-11-25 12:42:32 -0800 | [diff] [blame] | 2220 | FL("Sending eWNI_SME_CSA_OFFLOAD_EVENT to SME.")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2221 | MTRACE(mac_trace_msg_tx |
| 2222 | (mac_ctx, session_entry->peSessionId, mmh_msg.type)); |
| 2223 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 2224 | lim_diag_event_report(mac_ctx, |
| 2225 | WLAN_PE_DIAG_SWITCH_CHL_IND_EVENT, session_entry, |
| 2226 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 2227 | #endif |
| 2228 | lim_sys_process_mmh_msg_api(mac_ctx, &mmh_msg, ePROT); |
| 2229 | } |
| 2230 | |
| 2231 | err: |
| 2232 | cdf_mem_free(csa_params); |
| 2233 | } |
| 2234 | |
| 2235 | /*-------------------------------------------------------------------------- |
| 2236 | \brief pe_delete_session() - Handle the Delete BSS Response from HAL. |
| 2237 | |
| 2238 | \param pMac - pointer to global adapter context |
| 2239 | \param sessionId - Message pointer. |
| 2240 | |
| 2241 | \sa |
| 2242 | --------------------------------------------------------------------------*/ |
| 2243 | |
| 2244 | void lim_handle_delete_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ MsgQ) |
| 2245 | { |
| 2246 | tpPESession psessionEntry; |
| 2247 | tpDeleteBssParams pDelBss = (tpDeleteBssParams) (MsgQ->bodyptr); |
| 2248 | |
| 2249 | psessionEntry = |
| 2250 | pe_find_session_by_session_id(pMac, pDelBss->sessionId); |
| 2251 | if (psessionEntry == NULL) { |
| 2252 | lim_log(pMac, LOGE, |
| 2253 | FL("Session Does not exist for given sessionID %d"), |
| 2254 | pDelBss->sessionId); |
| 2255 | return; |
| 2256 | } |
| 2257 | if (LIM_IS_IBSS_ROLE(psessionEntry)) { |
| 2258 | lim_ibss_del_bss_rsp(pMac, MsgQ->bodyptr, psessionEntry); |
| 2259 | } else if (LIM_IS_UNKNOWN_ROLE(psessionEntry)) { |
| 2260 | lim_process_sme_del_bss_rsp(pMac, MsgQ->bodyval, psessionEntry); |
| 2261 | } |
| 2262 | |
| 2263 | else |
| 2264 | lim_process_mlm_del_bss_rsp(pMac, MsgQ, psessionEntry); |
| 2265 | |
| 2266 | } |
| 2267 | |
| 2268 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2269 | /** ----------------------------------------------------------------- |
| 2270 | \brief lim_send_sme_aggr_qos_rsp() - sends SME FT AGGR QOS RSP |
| 2271 | \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME. |
| 2272 | \ SME only looks at rc and tspec field. |
| 2273 | \param pMac - global mac structure |
| 2274 | \param rspReqd - is SmeAddTsRsp required |
| 2275 | \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP |
| 2276 | \return tspec |
| 2277 | \sa |
| 2278 | ----------------------------------------------------------------- */ |
| 2279 | void |
| 2280 | lim_send_sme_aggr_qos_rsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp, |
| 2281 | uint8_t smesessionId) |
| 2282 | { |
| 2283 | tSirMsgQ mmhMsg; |
| 2284 | |
| 2285 | mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP; |
| 2286 | mmhMsg.bodyptr = aggrQosRsp; |
| 2287 | mmhMsg.bodyval = 0; |
| 2288 | MTRACE(mac_trace_msg_tx(pMac, smesessionId, mmhMsg.type)); |
| 2289 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2290 | |
| 2291 | return; |
| 2292 | } |
| 2293 | #endif |
| 2294 | |
| 2295 | void lim_send_sme_max_assoc_exceeded_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, |
| 2296 | uint8_t smesessionId) |
| 2297 | { |
| 2298 | tSirMsgQ mmhMsg; |
| 2299 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
| 2300 | |
| 2301 | pSmeMaxAssocInd = cdf_mem_malloc(sizeof(tSmeMaxAssocInd)); |
| 2302 | if (NULL == pSmeMaxAssocInd) { |
| 2303 | PELOGE(lim_log(pMac, LOGE, FL("Failed to allocate memory"));) |
| 2304 | return; |
| 2305 | } |
| 2306 | cdf_mem_set((void *)pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd), 0); |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 2307 | cdf_mem_copy((uint8_t *) pSmeMaxAssocInd->peer_mac.bytes, |
| 2308 | (uint8_t *) peerMacAddr, CDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2309 | pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED; |
| 2310 | pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd); |
| 2311 | pSmeMaxAssocInd->sessionId = smesessionId; |
| 2312 | mmhMsg.type = pSmeMaxAssocInd->mesgType; |
| 2313 | mmhMsg.bodyptr = pSmeMaxAssocInd; |
| 2314 | PELOG1(lim_log(pMac, LOG1, FL("msgType %s peerMacAddr " MAC_ADDRESS_STR |
| 2315 | " sme session id %d"), |
| 2316 | "eWNI_SME_MAX_ASSOC_EXCEEDED", |
| 2317 | MAC_ADDR_ARRAY(peerMacAddr)); |
| 2318 | ) |
| 2319 | MTRACE(mac_trace_msg_tx(pMac, smesessionId, mmhMsg.type)); |
| 2320 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2321 | |
| 2322 | return; |
| 2323 | } |
| 2324 | |
| 2325 | /** ----------------------------------------------------------------- |
| 2326 | \brief lim_send_sme_dfs_event_notify() - sends |
| 2327 | eWNI_SME_DFS_RADAR_FOUND |
| 2328 | After receiving WMI_PHYERR_EVENTID indication frame from FW, this |
| 2329 | function sends a eWNI_SME_DFS_RADAR_FOUND to SME to notify |
| 2330 | that a RADAR is found on current operating channel and SAP- |
| 2331 | has to move to a new channel. |
| 2332 | \param pMac - global mac structure |
| 2333 | \param msgType - message type received from lower layer |
| 2334 | \param event - event data received from lower layer |
| 2335 | \return none |
| 2336 | \sa |
| 2337 | ----------------------------------------------------------------- */ |
| 2338 | void |
| 2339 | lim_send_sme_dfs_event_notify(tpAniSirGlobal pMac, uint16_t msgType, void *event) |
| 2340 | { |
| 2341 | tSirMsgQ mmhMsg; |
| 2342 | mmhMsg.type = eWNI_SME_DFS_RADAR_FOUND; |
| 2343 | mmhMsg.bodyptr = event; |
| 2344 | mmhMsg.bodyval = 0; |
| 2345 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2346 | return; |
| 2347 | } |
| 2348 | |
| 2349 | /*-------------------------------------------------------------------------- |
| 2350 | \brief lim_send_dfs_chan_sw_ie_update() |
| 2351 | This timer handler updates the channel switch IE in beacon template |
| 2352 | |
| 2353 | \param pMac - pointer to global adapter context |
| 2354 | \return - channel to scan from valid session else zero. |
| 2355 | \sa |
| 2356 | --------------------------------------------------------------------------*/ |
| 2357 | static void |
| 2358 | lim_send_dfs_chan_sw_ie_update(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 2359 | { |
| 2360 | |
| 2361 | /* Update the beacon template and send to FW */ |
| 2362 | if (sch_set_fixed_beacon_fields(pMac, psessionEntry) != eSIR_SUCCESS) { |
| 2363 | PELOGE(lim_log(pMac, LOGE, FL("Unable to set CSA IE in beacon"));) |
| 2364 | return; |
| 2365 | } |
| 2366 | |
| 2367 | /* Send update beacon template message */ |
| 2368 | lim_send_beacon_ind(pMac, psessionEntry); |
| 2369 | PELOG1(lim_log(pMac, LOG1, |
| 2370 | FL(" Updated CSA IE, IE COUNT = %d"), |
| 2371 | psessionEntry->gLimChannelSwitch.switchCount); |
| 2372 | ) |
| 2373 | |
| 2374 | return; |
| 2375 | } |
| 2376 | |
| 2377 | /** ----------------------------------------------------------------- |
| 2378 | \brief lim_send_sme_ap_channel_switch_resp() - sends |
| 2379 | eWNI_SME_CHANNEL_CHANGE_RSP |
| 2380 | After receiving WMA_SWITCH_CHANNEL_RSP indication this |
| 2381 | function sends a eWNI_SME_CHANNEL_CHANGE_RSP to SME to notify |
| 2382 | that the Channel change has been done to the specified target |
| 2383 | channel in the Channel change request |
| 2384 | \param pMac - global mac structure |
| 2385 | \param psessionEntry - session info |
| 2386 | \param pChnlParams - Channel switch params |
| 2387 | --------------------------------------------------------------------*/ |
| 2388 | void |
| 2389 | lim_send_sme_ap_channel_switch_resp(tpAniSirGlobal pMac, |
| 2390 | tpPESession psessionEntry, |
| 2391 | tpSwitchChannelParams pChnlParams) |
| 2392 | { |
| 2393 | tSirMsgQ mmhMsg; |
| 2394 | tpSwitchChannelParams pSmeSwithChnlParams; |
| 2395 | uint8_t channelId; |
| 2396 | |
| 2397 | pSmeSwithChnlParams = (tSwitchChannelParams *) |
| 2398 | cdf_mem_malloc(sizeof(tSwitchChannelParams)); |
| 2399 | if (NULL == pSmeSwithChnlParams) { |
| 2400 | lim_log(pMac, LOGP, |
| 2401 | FL("AllocateMemory failed for pSmeSwithChnlParams\n")); |
| 2402 | return; |
| 2403 | } |
| 2404 | |
| 2405 | cdf_mem_set((void *)pSmeSwithChnlParams, |
| 2406 | sizeof(tSwitchChannelParams), 0); |
| 2407 | |
| 2408 | cdf_mem_copy(pSmeSwithChnlParams, pChnlParams, |
| 2409 | sizeof(tSwitchChannelParams)); |
| 2410 | |
| 2411 | channelId = pSmeSwithChnlParams->channelNumber; |
| 2412 | |
| 2413 | /* |
| 2414 | * Pass the sme sessionID to SME instead |
| 2415 | * PE session ID. |
| 2416 | */ |
| 2417 | pSmeSwithChnlParams->peSessionId = psessionEntry->smeSessionId; |
| 2418 | |
| 2419 | mmhMsg.type = eWNI_SME_CHANNEL_CHANGE_RSP; |
| 2420 | mmhMsg.bodyptr = (void *)pSmeSwithChnlParams; |
| 2421 | mmhMsg.bodyval = 0; |
| 2422 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2423 | |
| 2424 | /* |
| 2425 | * We should start beacon transmission only if the new |
| 2426 | * channel after channel change is Non-DFS. For a DFS |
| 2427 | * channel, PE will receive an explicit request from |
| 2428 | * upper layers to start the beacon transmission . |
| 2429 | */ |
| 2430 | |
| 2431 | if (CHANNEL_STATE_DFS != cds_get_channel_state(channelId)) { |
| 2432 | if (channelId == psessionEntry->currentOperChannel) { |
| 2433 | lim_apply_configuration(pMac, psessionEntry); |
| 2434 | lim_send_beacon_ind(pMac, psessionEntry); |
| 2435 | } else { |
| 2436 | PELOG1(lim_log(pMac, LOG1, |
| 2437 | FL |
| 2438 | ("Failed to Transmit Beacons on channel = %d" |
| 2439 | "after AP channel change response"), |
| 2440 | psessionEntry->bcnLen); |
| 2441 | ) |
| 2442 | } |
| 2443 | } |
| 2444 | return; |
| 2445 | } |
| 2446 | |
| 2447 | /** ----------------------------------------------------------------- |
| 2448 | \brief lim_process_beacon_tx_success_ind() - This function is used |
| 2449 | explicitely to handle successful beacon transmission indication |
| 2450 | from the FW. This is a generic event generated by the FW afer the |
| 2451 | first beacon is sent out after the beacon template update by the |
| 2452 | host |
| 2453 | \param pMac - global mac structure |
| 2454 | \param psessionEntry - session info |
| 2455 | \return none |
| 2456 | \sa |
| 2457 | ----------------------------------------------------------------- */ |
| 2458 | void |
| 2459 | lim_process_beacon_tx_success_ind(tpAniSirGlobal pMac, uint16_t msgType, void *event) |
| 2460 | { |
| 2461 | /* Currently, this event is used only for DFS channel switch announcement |
| 2462 | * IE update in the template. If required to be used for other IE updates |
| 2463 | * add appropriate code by introducing a state variable |
| 2464 | */ |
| 2465 | tpPESession psessionEntry; |
| 2466 | tSirMsgQ mmhMsg; |
| 2467 | tSirSmeCSAIeTxCompleteRsp *pChanSwTxResponse; |
| 2468 | struct sir_beacon_tx_complete_rsp *beacon_tx_comp_rsp_ptr; |
| 2469 | uint8_t length = sizeof(tSirSmeCSAIeTxCompleteRsp); |
| 2470 | tpSirFirstBeaconTxCompleteInd pBcnTxInd = |
| 2471 | (tSirFirstBeaconTxCompleteInd *) event; |
| 2472 | |
| 2473 | psessionEntry = pe_find_session_by_bss_idx(pMac, pBcnTxInd->bssIdx); |
| 2474 | if (psessionEntry == NULL) { |
| 2475 | lim_log(pMac, LOGE, |
| 2476 | FL("Session Does not exist for given sessionID")); |
| 2477 | return; |
| 2478 | } |
| 2479 | |
| 2480 | if (LIM_IS_AP_ROLE(psessionEntry) && |
| 2481 | true == psessionEntry->dfsIncludeChanSwIe) { |
| 2482 | /* Send only 5 beacons with CSA IE Set in when a radar is detected */ |
| 2483 | if (psessionEntry->gLimChannelSwitch.switchCount > 0) { |
| 2484 | /* |
| 2485 | * Send the next beacon with updated CSA IE count |
| 2486 | */ |
| 2487 | lim_send_dfs_chan_sw_ie_update(pMac, psessionEntry); |
| 2488 | /* Decrement the IE count */ |
| 2489 | psessionEntry->gLimChannelSwitch.switchCount--; |
| 2490 | } else { |
| 2491 | /* Done with CSA IE update, send response back to SME */ |
| 2492 | psessionEntry->gLimChannelSwitch.switchCount = 0; |
| 2493 | if (pMac->sap.SapDfsInfo.disable_dfs_ch_switch == false) |
| 2494 | psessionEntry->gLimChannelSwitch.switchMode = 0; |
| 2495 | psessionEntry->dfsIncludeChanSwIe = false; |
| 2496 | psessionEntry->dfsIncludeChanWrapperIe = false; |
| 2497 | |
| 2498 | pChanSwTxResponse = (tSirSmeCSAIeTxCompleteRsp *) |
| 2499 | cdf_mem_malloc(length); |
| 2500 | |
| 2501 | if (NULL == pChanSwTxResponse) { |
| 2502 | lim_log(pMac, LOGP, |
| 2503 | FL |
| 2504 | ("AllocateMemory failed for tSirSmeCSAIeTxCompleteRsp")); |
| 2505 | return; |
| 2506 | } |
| 2507 | |
| 2508 | cdf_mem_set((void *)pChanSwTxResponse, length, 0); |
| 2509 | pChanSwTxResponse->sessionId = |
| 2510 | psessionEntry->smeSessionId; |
| 2511 | pChanSwTxResponse->chanSwIeTxStatus = |
| 2512 | CDF_STATUS_SUCCESS; |
| 2513 | |
| 2514 | mmhMsg.type = eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND; |
| 2515 | mmhMsg.bodyptr = pChanSwTxResponse; |
| 2516 | mmhMsg.bodyval = 0; |
| 2517 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2518 | } |
| 2519 | } |
| 2520 | |
| 2521 | if (LIM_IS_AP_ROLE(psessionEntry) && |
| 2522 | psessionEntry->gLimOperatingMode.present) { |
| 2523 | /* Done with nss update, send response back to SME */ |
| 2524 | psessionEntry->gLimOperatingMode.present = 0; |
| 2525 | beacon_tx_comp_rsp_ptr = (struct sir_beacon_tx_complete_rsp *) |
| 2526 | cdf_mem_malloc(sizeof(*beacon_tx_comp_rsp_ptr)); |
| 2527 | if (NULL == beacon_tx_comp_rsp_ptr) { |
| 2528 | lim_log(pMac, LOGP, |
| 2529 | FL |
| 2530 | ("AllocateMemory failed for beacon_tx_comp_rsp_ptr")); |
| 2531 | return; |
| 2532 | } |
| 2533 | cdf_mem_set((void *)beacon_tx_comp_rsp_ptr, |
| 2534 | sizeof(*beacon_tx_comp_rsp_ptr), 0); |
| 2535 | beacon_tx_comp_rsp_ptr->session_id = |
| 2536 | psessionEntry->smeSessionId; |
| 2537 | beacon_tx_comp_rsp_ptr->tx_status = CDF_STATUS_SUCCESS; |
| 2538 | mmhMsg.type = eWNI_SME_NSS_UPDATE_RSP; |
| 2539 | mmhMsg.bodyptr = beacon_tx_comp_rsp_ptr; |
| 2540 | mmhMsg.bodyval = 0; |
| 2541 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2542 | } |
| 2543 | return; |
| 2544 | } |