Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Krishna Kumaar Natarajan | 4e9cf39 | 2015-11-20 13:35:05 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 701 | /** |
| 702 | * lim_send_sme_scan_rsp() - Send scan response to SME |
| 703 | * @pMac: Pointer to Global MAC structure |
| 704 | * @length: Indicates length of message |
| 705 | * @resultCode: Indicates the result of previously issued |
| 706 | * eWNI_SME_SCAN_REQ message |
| 707 | * @scan_id: scan identifier |
| 708 | * |
| 709 | * This function is called by lim_process_sme_req_messages() to send |
| 710 | * eWNI_SME_SCAN_RSP message to applications above MAC |
| 711 | * |
| 712 | * return: None |
| 713 | */ |
| 714 | |
| 715 | void |
| 716 | lim_send_sme_scan_rsp(tpAniSirGlobal pMac, tSirResultCodes resultCode, |
| 717 | uint8_t smesessionId, uint16_t smetranscationId, |
| 718 | uint32_t scan_id) |
| 719 | { |
| 720 | lim_log(pMac, LOG1, |
| 721 | FL("Sending message SME_SCAN_RSP reasonCode %s scanId %d"), |
| 722 | lim_result_code_str(resultCode), scan_id); |
| 723 | lim_post_sme_scan_rsp_message(pMac, resultCode, smesessionId, |
| 724 | smetranscationId, scan_id); |
| 725 | } |
| 726 | |
| 727 | /** |
| 728 | * lim_post_sme_scan_rsp_message() |
| 729 | * |
| 730 | ***FUNCTION: |
| 731 | * This function is called by lim_send_sme_scan_rsp() to send |
| 732 | * eWNI_SME_SCAN_RSP message with failed result code |
| 733 | * |
| 734 | ***NOTE: |
| 735 | * NA |
| 736 | * |
| 737 | * @param pMac Pointer to Global MAC structure |
| 738 | * @param length Indicates length of message |
| 739 | * @param resultCode failed result code |
| 740 | * |
| 741 | * @return None |
| 742 | */ |
| 743 | |
| 744 | void |
| 745 | lim_post_sme_scan_rsp_message(tpAniSirGlobal pMac, |
| 746 | tSirResultCodes resultCode, uint8_t smesessionId, |
| 747 | uint16_t smetransactionId, |
| 748 | uint32_t scan_id) |
| 749 | { |
| 750 | tpSirSmeScanRsp pSirSmeScanRsp; |
| 751 | tSirMsgQ mmhMsg; |
| 752 | |
| 753 | lim_log(pMac, LOG1, FL("send SME_SCAN_RSP (reasonCode %s)."), |
| 754 | lim_result_code_str(resultCode)); |
| 755 | |
| 756 | pSirSmeScanRsp = cdf_mem_malloc(sizeof(tSirSmeScanRsp)); |
| 757 | if (NULL == pSirSmeScanRsp) { |
| 758 | lim_log(pMac, LOGP, |
| 759 | FL("AllocateMemory failed for eWNI_SME_SCAN_RSP")); |
| 760 | return; |
| 761 | } |
| 762 | cdf_mem_set((void *)pSirSmeScanRsp, sizeof(tSirSmeScanRsp), 0); |
| 763 | |
| 764 | pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP; |
| 765 | pSirSmeScanRsp->statusCode = resultCode; |
| 766 | |
| 767 | /*Update SME session Id and transaction Id */ |
| 768 | pSirSmeScanRsp->sessionId = smesessionId; |
| 769 | pSirSmeScanRsp->transcationId = smetransactionId; |
| 770 | pSirSmeScanRsp->scan_id = scan_id; |
| 771 | |
| 772 | mmhMsg.type = eWNI_SME_SCAN_RSP; |
| 773 | mmhMsg.bodyptr = pSirSmeScanRsp; |
| 774 | mmhMsg.bodyval = 0; |
| 775 | |
| 776 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 777 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 778 | lim_diag_event_report(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, |
| 779 | (uint16_t) resultCode, 0); |
| 780 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 781 | |
| 782 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 783 | return; |
| 784 | |
| 785 | } /*** lim_post_sme_scan_rsp_message ***/ |
| 786 | |
| 787 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 788 | |
| 789 | /** |
| 790 | * lim_send_sme_oem_data_rsp() |
| 791 | * |
| 792 | ***FUNCTION: |
| 793 | * This function is called by lim_process_sme_req_messages() to send |
| 794 | * eWNI_SME_OEM_DATA_RSP message to applications above MAC |
| 795 | * Software. |
| 796 | * |
| 797 | ***PARAMS: |
| 798 | * |
| 799 | ***LOGIC: |
| 800 | * |
| 801 | ***ASSUMPTIONS: |
| 802 | * NA |
| 803 | * |
| 804 | ***NOTE: |
| 805 | * NA |
| 806 | * |
| 807 | * @param pMac Pointer to Global MAC structure |
| 808 | * @param pMsgBuf Indicates the mlm message |
| 809 | * @param resultCode Indicates the result of previously issued |
| 810 | * eWNI_SME_OEM_DATA_RSP message |
| 811 | * |
| 812 | * @return None |
| 813 | */ |
| 814 | |
| 815 | void lim_send_sme_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *pMsgBuf, |
| 816 | tSirResultCodes resultCode) |
| 817 | { |
| 818 | tSirMsgQ mmhMsg; |
| 819 | tSirOemDataRsp *pSirSmeOemDataRsp = NULL; |
| 820 | tLimMlmOemDataRsp *pMlmOemDataRsp = NULL; |
| 821 | uint16_t msgLength; |
| 822 | |
| 823 | /* get the pointer to the mlm message */ |
| 824 | pMlmOemDataRsp = (tLimMlmOemDataRsp *) (pMsgBuf); |
| 825 | |
| 826 | msgLength = sizeof(tSirOemDataRsp); |
| 827 | |
| 828 | /* now allocate memory for the char buffer */ |
| 829 | pSirSmeOemDataRsp = cdf_mem_malloc(msgLength); |
| 830 | if (NULL == pSirSmeOemDataRsp) { |
| 831 | lim_log(pMac, LOGP, |
| 832 | FL |
| 833 | ("call to AllocateMemory failed for pSirSmeOemDataRsp")); |
| 834 | return; |
| 835 | } |
| 836 | #if defined (ANI_LITTLE_BYTE_ENDIAN) |
| 837 | sir_store_u16_n((uint8_t *) &pSirSmeOemDataRsp->length, msgLength); |
| 838 | sir_store_u16_n((uint8_t *) &pSirSmeOemDataRsp->messageType, |
| 839 | eWNI_SME_OEM_DATA_RSP); |
| 840 | #else |
| 841 | pSirSmeOemDataRsp->length = msgLength; |
| 842 | pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP; |
| 843 | #endif |
Krishna Kumaar Natarajan | 4e9cf39 | 2015-11-20 13:35:05 -0800 | [diff] [blame] | 844 | pSirSmeOemDataRsp->target_rsp = pMlmOemDataRsp->target_rsp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 845 | cdf_mem_copy(pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, |
| 846 | OEM_DATA_RSP_SIZE); |
| 847 | |
| 848 | /* Now free the memory from MLM Rsp Message */ |
| 849 | cdf_mem_free(pMlmOemDataRsp); |
| 850 | |
| 851 | mmhMsg.type = eWNI_SME_OEM_DATA_RSP; |
| 852 | mmhMsg.bodyptr = pSirSmeOemDataRsp; |
| 853 | mmhMsg.bodyval = 0; |
| 854 | |
| 855 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 856 | |
| 857 | return; |
| 858 | } /*** lim_send_sme_oem_data_rsp ***/ |
| 859 | |
| 860 | #endif |
| 861 | |
| 862 | void lim_send_sme_disassoc_deauth_ntf(tpAniSirGlobal pMac, |
| 863 | CDF_STATUS status, uint32_t *pCtx) |
| 864 | { |
| 865 | tSirMsgQ mmhMsg; |
| 866 | tSirMsgQ *pMsg = (tSirMsgQ *) pCtx; |
| 867 | |
| 868 | mmhMsg.type = pMsg->type; |
| 869 | mmhMsg.bodyptr = pMsg; |
| 870 | mmhMsg.bodyval = 0; |
| 871 | |
| 872 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 873 | |
| 874 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 875 | } |
| 876 | |
| 877 | /** |
| 878 | * lim_send_sme_disassoc_ntf() |
| 879 | * |
| 880 | ***FUNCTION: |
| 881 | * This function is called by limProcessSmeMessages() to send |
| 882 | * eWNI_SME_DISASSOC_RSP/IND message to host |
| 883 | * |
| 884 | ***PARAMS: |
| 885 | * |
| 886 | ***LOGIC: |
| 887 | * |
| 888 | ***ASSUMPTIONS: |
| 889 | * NA |
| 890 | * |
| 891 | ***NOTE: |
| 892 | * This function is used for sending eWNI_SME_DISASSOC_CNF, |
| 893 | * or eWNI_SME_DISASSOC_IND to host depending on |
| 894 | * disassociation trigger. |
| 895 | * |
| 896 | * @param peerMacAddr Indicates the peer MAC addr to which |
| 897 | * disassociate was initiated |
| 898 | * @param reasonCode Indicates the reason for Disassociation |
| 899 | * @param disassocTrigger Indicates the trigger for Disassociation |
| 900 | * @param aid Indicates the STAID. This parameter is |
| 901 | * present only on AP. |
| 902 | * |
| 903 | * @return None |
| 904 | */ |
| 905 | void |
| 906 | lim_send_sme_disassoc_ntf(tpAniSirGlobal pMac, |
| 907 | tSirMacAddr peerMacAddr, |
| 908 | tSirResultCodes reasonCode, |
| 909 | uint16_t disassocTrigger, |
| 910 | uint16_t aid, |
| 911 | uint8_t smesessionId, |
| 912 | uint16_t smetransactionId, tpPESession psessionEntry) |
| 913 | { |
| 914 | |
| 915 | uint8_t *pBuf; |
| 916 | tSirSmeDisassocRsp *pSirSmeDisassocRsp; |
| 917 | tSirSmeDisassocInd *pSirSmeDisassocInd; |
| 918 | uint32_t *pMsg; |
| 919 | bool failure = false; |
| 920 | |
| 921 | lim_log(pMac, LOG1, FL("Disassoc Ntf with trigger : %d reasonCode: %d"), |
| 922 | disassocTrigger, reasonCode); |
| 923 | |
| 924 | switch (disassocTrigger) { |
| 925 | case eLIM_PEER_ENTITY_DISASSOC: |
| 926 | if (reasonCode != eSIR_SME_STA_NOT_ASSOCIATED) { |
| 927 | failure = true; |
| 928 | goto error; |
| 929 | } |
| 930 | |
| 931 | case eLIM_HOST_DISASSOC: |
| 932 | /** |
| 933 | * Disassociation response due to |
| 934 | * host triggered disassociation |
| 935 | */ |
| 936 | |
| 937 | pSirSmeDisassocRsp = cdf_mem_malloc(sizeof(tSirSmeDisassocRsp)); |
| 938 | if (NULL == pSirSmeDisassocRsp) { |
| 939 | /* Log error */ |
| 940 | lim_log(pMac, LOGP, FL("Memory allocation failed")); |
| 941 | failure = true; |
| 942 | goto error; |
| 943 | } |
| 944 | lim_log(pMac, LOG1, FL("send eWNI_SME_DISASSOC_RSP with " |
| 945 | "retCode: %d for " MAC_ADDRESS_STR), |
| 946 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 947 | pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP; |
| 948 | pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp); |
| 949 | /* sessionId */ |
| 950 | pBuf = (uint8_t *) &pSirSmeDisassocRsp->sessionId; |
| 951 | *pBuf = smesessionId; |
| 952 | pBuf++; |
| 953 | |
| 954 | /* transactionId */ |
| 955 | lim_copy_u16(pBuf, smetransactionId); |
| 956 | pBuf += sizeof(uint16_t); |
| 957 | |
| 958 | /* statusCode */ |
| 959 | lim_copy_u32(pBuf, reasonCode); |
| 960 | pBuf += sizeof(tSirResultCodes); |
| 961 | |
| 962 | /* peerMacAddr */ |
| 963 | cdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr)); |
| 964 | pBuf += sizeof(tSirMacAddr); |
| 965 | |
| 966 | /* Clear Station Stats */ |
| 967 | /* for sta, it is always 1, IBSS is handled at halInitSta */ |
| 968 | |
| 969 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 970 | |
| 971 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT, |
| 972 | psessionEntry, (uint16_t) reasonCode, 0); |
| 973 | #endif |
| 974 | pMsg = (uint32_t *) pSirSmeDisassocRsp; |
| 975 | break; |
| 976 | |
| 977 | default: |
| 978 | /** |
| 979 | * Disassociation indication due to Disassociation |
| 980 | * frame reception from peer entity or due to |
| 981 | * loss of link with peer entity. |
| 982 | */ |
| 983 | pSirSmeDisassocInd = cdf_mem_malloc(sizeof(tSirSmeDisassocInd)); |
| 984 | if (NULL == pSirSmeDisassocInd) { |
| 985 | /* Log error */ |
| 986 | lim_log(pMac, LOGP, FL("Memory allocation failed")); |
| 987 | failure = true; |
| 988 | goto error; |
| 989 | } |
| 990 | lim_log(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with " |
| 991 | "retCode: %d for " MAC_ADDRESS_STR), |
| 992 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 993 | pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND; |
| 994 | pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd); |
| 995 | |
| 996 | /* Update SME session Id and Transaction Id */ |
| 997 | pSirSmeDisassocInd->sessionId = smesessionId; |
| 998 | pSirSmeDisassocInd->transactionId = smetransactionId; |
| 999 | pSirSmeDisassocInd->reasonCode = reasonCode; |
| 1000 | pBuf = (uint8_t *) &pSirSmeDisassocInd->statusCode; |
| 1001 | |
| 1002 | lim_copy_u32(pBuf, reasonCode); |
| 1003 | pBuf += sizeof(tSirResultCodes); |
| 1004 | |
| 1005 | cdf_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 1006 | pBuf += sizeof(tSirMacAddr); |
| 1007 | |
| 1008 | cdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr)); |
| 1009 | |
| 1010 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1011 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, |
| 1012 | psessionEntry, (uint16_t) reasonCode, 0); |
| 1013 | #endif |
| 1014 | pMsg = (uint32_t *) pSirSmeDisassocInd; |
| 1015 | |
| 1016 | break; |
| 1017 | } |
| 1018 | |
| 1019 | error: |
| 1020 | /* Delete the PE session Created */ |
| 1021 | if ((psessionEntry != NULL) && |
| 1022 | (LIM_IS_STA_ROLE(psessionEntry) || |
| 1023 | LIM_IS_BT_AMP_STA_ROLE(psessionEntry))) { |
| 1024 | pe_delete_session(pMac, psessionEntry); |
| 1025 | } |
| 1026 | |
| 1027 | if (false == failure) |
| 1028 | lim_send_sme_disassoc_deauth_ntf(pMac, CDF_STATUS_SUCCESS, |
| 1029 | (uint32_t *) pMsg); |
| 1030 | } /*** end lim_send_sme_disassoc_ntf() ***/ |
| 1031 | |
| 1032 | /** ----------------------------------------------------------------- |
| 1033 | \brief lim_send_sme_disassoc_ind() - sends SME_DISASSOC_IND |
| 1034 | |
| 1035 | After receiving disassociation frame from peer entity, this |
| 1036 | function sends a eWNI_SME_DISASSOC_IND to SME with a specific |
| 1037 | reason code. |
| 1038 | |
| 1039 | \param pMac - global mac structure |
| 1040 | \param pStaDs - station dph hash node |
| 1041 | \return none |
| 1042 | \sa |
| 1043 | ----------------------------------------------------------------- */ |
| 1044 | void |
| 1045 | lim_send_sme_disassoc_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1046 | tpPESession psessionEntry) |
| 1047 | { |
| 1048 | tSirMsgQ mmhMsg; |
| 1049 | tSirSmeDisassocInd *pSirSmeDisassocInd; |
| 1050 | |
| 1051 | pSirSmeDisassocInd = cdf_mem_malloc(sizeof(tSirSmeDisassocInd)); |
| 1052 | if (NULL == pSirSmeDisassocInd) { |
| 1053 | lim_log(pMac, LOGP, |
| 1054 | FL("AllocateMemory failed for eWNI_SME_DISASSOC_IND")); |
| 1055 | return; |
| 1056 | } |
| 1057 | |
| 1058 | pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND; |
| 1059 | pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd); |
| 1060 | |
| 1061 | pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId; |
| 1062 | pSirSmeDisassocInd->transactionId = psessionEntry->transactionId; |
| 1063 | pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason; |
| 1064 | pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason; |
| 1065 | |
| 1066 | cdf_mem_copy(pSirSmeDisassocInd->bssId, psessionEntry->bssId, |
| 1067 | sizeof(tSirMacAddr)); |
| 1068 | |
| 1069 | cdf_mem_copy(pSirSmeDisassocInd->peerMacAddr, pStaDs->staAddr, |
| 1070 | sizeof(tSirMacAddr)); |
| 1071 | |
| 1072 | pSirSmeDisassocInd->staId = pStaDs->staIndex; |
| 1073 | |
| 1074 | mmhMsg.type = eWNI_SME_DISASSOC_IND; |
| 1075 | mmhMsg.bodyptr = pSirSmeDisassocInd; |
| 1076 | mmhMsg.bodyval = 0; |
| 1077 | |
| 1078 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1079 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1080 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, |
| 1081 | 0, (uint16_t) pStaDs->mlmStaContext.disassocReason); |
| 1082 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1083 | |
| 1084 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1085 | |
| 1086 | } /*** end lim_send_sme_disassoc_ind() ***/ |
| 1087 | |
| 1088 | /** ----------------------------------------------------------------- |
| 1089 | \brief lim_send_sme_deauth_ind() - sends SME_DEAUTH_IND |
| 1090 | |
| 1091 | After receiving deauthentication frame from peer entity, this |
| 1092 | function sends a eWNI_SME_DEAUTH_IND to SME with a specific |
| 1093 | reason code. |
| 1094 | |
| 1095 | \param pMac - global mac structure |
| 1096 | \param pStaDs - station dph hash node |
| 1097 | \return none |
| 1098 | \sa |
| 1099 | ----------------------------------------------------------------- */ |
| 1100 | void |
| 1101 | lim_send_sme_deauth_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1102 | tpPESession psessionEntry) |
| 1103 | { |
| 1104 | tSirMsgQ mmhMsg; |
| 1105 | tSirSmeDeauthInd *pSirSmeDeauthInd; |
| 1106 | |
| 1107 | pSirSmeDeauthInd = cdf_mem_malloc(sizeof(tSirSmeDeauthInd)); |
| 1108 | if (NULL == pSirSmeDeauthInd) { |
| 1109 | lim_log(pMac, LOGP, |
| 1110 | FL("AllocateMemory failed for eWNI_SME_DEAUTH_IND ")); |
| 1111 | return; |
| 1112 | } |
| 1113 | |
| 1114 | pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND; |
| 1115 | pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd); |
| 1116 | |
| 1117 | pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId; |
| 1118 | pSirSmeDeauthInd->transactionId = psessionEntry->transactionId; |
| 1119 | if (eSIR_INFRA_AP_MODE == psessionEntry->bssType) { |
| 1120 | pSirSmeDeauthInd->statusCode = |
| 1121 | (tSirResultCodes) pStaDs->mlmStaContext.cleanupTrigger; |
| 1122 | } else { |
| 1123 | /* Need to indicatet he reascon code over the air */ |
| 1124 | pSirSmeDeauthInd->statusCode = |
| 1125 | (tSirResultCodes) pStaDs->mlmStaContext.disassocReason; |
| 1126 | } |
| 1127 | /* BSSID */ |
| 1128 | cdf_mem_copy(pSirSmeDeauthInd->bssId, psessionEntry->bssId, |
| 1129 | sizeof(tSirMacAddr)); |
| 1130 | /* peerMacAddr */ |
| 1131 | cdf_mem_copy(pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, |
| 1132 | sizeof(tSirMacAddr)); |
| 1133 | pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason; |
| 1134 | |
| 1135 | pSirSmeDeauthInd->staId = pStaDs->staIndex; |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1136 | if (eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON == |
| 1137 | pStaDs->mlmStaContext.disassocReason) |
| 1138 | pSirSmeDeauthInd->rssi = pStaDs->del_sta_ctx_rssi; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1139 | |
| 1140 | mmhMsg.type = eWNI_SME_DEAUTH_IND; |
| 1141 | mmhMsg.bodyptr = pSirSmeDeauthInd; |
| 1142 | mmhMsg.bodyval = 0; |
| 1143 | |
| 1144 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1145 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1146 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, |
| 1147 | 0, pStaDs->mlmStaContext.cleanupTrigger); |
| 1148 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1149 | |
| 1150 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1151 | return; |
| 1152 | } /*** end lim_send_sme_deauth_ind() ***/ |
| 1153 | |
| 1154 | #ifdef FEATURE_WLAN_TDLS |
| 1155 | /** |
| 1156 | * lim_send_sme_tdls_del_sta_ind() |
| 1157 | * |
| 1158 | ***FUNCTION: |
| 1159 | * This function is called to send the TDLS STA context deletion to SME. |
| 1160 | * |
| 1161 | ***LOGIC: |
| 1162 | * |
| 1163 | ***ASSUMPTIONS: |
| 1164 | * |
| 1165 | ***NOTE: |
| 1166 | * NA |
| 1167 | * |
| 1168 | * @param pMac - Pointer to global MAC structure |
| 1169 | * @param pStaDs - Pointer to internal STA Datastructure |
| 1170 | * @param psessionEntry - Pointer to the session entry |
| 1171 | * @param reasonCode - Reason for TDLS sta deletion |
| 1172 | * @return None |
| 1173 | */ |
| 1174 | void |
| 1175 | lim_send_sme_tdls_del_sta_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 1176 | tpPESession psessionEntry, uint16_t reasonCode) |
| 1177 | { |
| 1178 | tSirMsgQ mmhMsg; |
| 1179 | tSirTdlsDelStaInd *pSirTdlsDelStaInd; |
| 1180 | |
| 1181 | pSirTdlsDelStaInd = cdf_mem_malloc(sizeof(tSirTdlsDelStaInd)); |
| 1182 | if (NULL == pSirTdlsDelStaInd) { |
| 1183 | lim_log(pMac, LOGP, |
| 1184 | FL |
| 1185 | ("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND ")); |
| 1186 | return; |
| 1187 | } |
| 1188 | /* messageType */ |
| 1189 | pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND; |
| 1190 | pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd); |
| 1191 | |
| 1192 | /* sessionId */ |
| 1193 | pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId; |
| 1194 | |
| 1195 | /* peerMacAddr */ |
Srinivas Girigowda | 84f4292 | 2015-11-19 16:28:05 -0800 | [diff] [blame] | 1196 | cdf_mem_copy(pSirTdlsDelStaInd->peermac.bytes, pStaDs->staAddr, |
| 1197 | CDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1198 | |
| 1199 | /* staId */ |
| 1200 | lim_copy_u16((uint8_t *) (&pSirTdlsDelStaInd->staId), |
| 1201 | (uint16_t) pStaDs->staIndex); |
| 1202 | |
| 1203 | /* reasonCode */ |
| 1204 | lim_copy_u16((uint8_t *) (&pSirTdlsDelStaInd->reasonCode), reasonCode); |
| 1205 | |
| 1206 | mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND; |
| 1207 | mmhMsg.bodyptr = pSirTdlsDelStaInd; |
| 1208 | mmhMsg.bodyval = 0; |
| 1209 | |
| 1210 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1211 | return; |
| 1212 | } /*** end lim_send_sme_tdls_del_sta_ind() ***/ |
| 1213 | |
| 1214 | /** |
| 1215 | * lim_send_sme_tdls_delete_all_peer_ind() |
| 1216 | * |
| 1217 | ***FUNCTION: |
| 1218 | * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND |
| 1219 | * message to SME. |
| 1220 | * |
| 1221 | ***LOGIC: |
| 1222 | * |
| 1223 | ***ASSUMPTIONS: |
| 1224 | * |
| 1225 | ***NOTE: |
| 1226 | * NA |
| 1227 | * |
| 1228 | * @param pMac - Pointer to global MAC structure |
| 1229 | * @param psessionEntry - Pointer to the session entry |
| 1230 | * @return None |
| 1231 | */ |
| 1232 | void |
| 1233 | lim_send_sme_tdls_delete_all_peer_ind(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 1234 | { |
| 1235 | tSirMsgQ mmhMsg; |
| 1236 | tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd; |
| 1237 | |
| 1238 | pSirTdlsDelAllPeerInd = cdf_mem_malloc(sizeof(tSirTdlsDelAllPeerInd)); |
| 1239 | if (NULL == pSirTdlsDelAllPeerInd) { |
| 1240 | lim_log(pMac, LOGP, |
| 1241 | FL |
| 1242 | ("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND")); |
| 1243 | return; |
| 1244 | } |
| 1245 | /* messageType */ |
| 1246 | pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND; |
| 1247 | pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd); |
| 1248 | |
| 1249 | /* sessionId */ |
| 1250 | pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId; |
| 1251 | |
| 1252 | mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND; |
| 1253 | mmhMsg.bodyptr = pSirTdlsDelAllPeerInd; |
| 1254 | mmhMsg.bodyval = 0; |
| 1255 | |
| 1256 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1257 | return; |
| 1258 | } /*** end lim_send_sme_tdls_delete_all_peer_ind() ***/ |
| 1259 | |
| 1260 | /** |
| 1261 | * lim_send_sme_mgmt_tx_completion() |
| 1262 | * |
| 1263 | ***FUNCTION: |
| 1264 | * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND |
| 1265 | * message to SME. |
| 1266 | * |
| 1267 | ***LOGIC: |
| 1268 | * |
| 1269 | ***ASSUMPTIONS: |
| 1270 | * |
| 1271 | ***NOTE: |
| 1272 | * NA |
| 1273 | * |
| 1274 | * @param pMac - Pointer to global MAC structure |
| 1275 | * @param psessionEntry - Pointer to the session entry |
| 1276 | * @param txCompleteStatus - TX Complete Status of Mgmt Frames |
| 1277 | * @return None |
| 1278 | */ |
| 1279 | void |
| 1280 | lim_send_sme_mgmt_tx_completion(tpAniSirGlobal pMac, |
| 1281 | tpPESession psessionEntry, uint32_t txCompleteStatus) |
| 1282 | { |
| 1283 | tSirMsgQ mmhMsg; |
| 1284 | tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd; |
| 1285 | |
| 1286 | pSirMgmtTxCompletionInd = |
| 1287 | cdf_mem_malloc(sizeof(tSirMgmtTxCompletionInd)); |
| 1288 | if (NULL == pSirMgmtTxCompletionInd) { |
| 1289 | lim_log(pMac, LOGP, |
| 1290 | FL |
| 1291 | ("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND")); |
| 1292 | return; |
| 1293 | } |
| 1294 | /* messageType */ |
| 1295 | pSirMgmtTxCompletionInd->messageType = |
| 1296 | eWNI_SME_MGMT_FRM_TX_COMPLETION_IND; |
| 1297 | pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd); |
| 1298 | |
| 1299 | /* sessionId */ |
| 1300 | pSirMgmtTxCompletionInd->sessionId = psessionEntry->smeSessionId; |
| 1301 | |
| 1302 | pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus; |
| 1303 | |
| 1304 | mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND; |
| 1305 | mmhMsg.bodyptr = pSirMgmtTxCompletionInd; |
| 1306 | mmhMsg.bodyval = 0; |
| 1307 | |
| 1308 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1309 | return; |
| 1310 | } /*** end lim_send_sme_tdls_delete_all_peer_ind() ***/ |
| 1311 | |
| 1312 | void lim_send_sme_tdls_event_notify(tpAniSirGlobal pMac, uint16_t msgType, |
| 1313 | void *events) |
| 1314 | { |
| 1315 | tSirMsgQ mmhMsg; |
| 1316 | |
| 1317 | switch (msgType) { |
| 1318 | case SIR_HAL_TDLS_SHOULD_DISCOVER: |
| 1319 | mmhMsg.type = eWNI_SME_TDLS_SHOULD_DISCOVER; |
| 1320 | break; |
| 1321 | case SIR_HAL_TDLS_SHOULD_TEARDOWN: |
| 1322 | mmhMsg.type = eWNI_SME_TDLS_SHOULD_TEARDOWN; |
| 1323 | break; |
| 1324 | case SIR_HAL_TDLS_PEER_DISCONNECTED: |
| 1325 | mmhMsg.type = eWNI_SME_TDLS_PEER_DISCONNECTED; |
| 1326 | break; |
| 1327 | } |
| 1328 | |
| 1329 | mmhMsg.bodyptr = events; |
| 1330 | mmhMsg.bodyval = 0; |
| 1331 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1332 | return; |
| 1333 | } |
| 1334 | #endif /* FEATURE_WLAN_TDLS */ |
| 1335 | |
| 1336 | /** |
| 1337 | * lim_send_sme_deauth_ntf() |
| 1338 | * |
| 1339 | ***FUNCTION: |
| 1340 | * This function is called by limProcessSmeMessages() to send |
| 1341 | * eWNI_SME_DISASSOC_RSP/IND message to host |
| 1342 | * |
| 1343 | ***PARAMS: |
| 1344 | * |
| 1345 | ***LOGIC: |
| 1346 | * |
| 1347 | ***ASSUMPTIONS: |
| 1348 | * NA |
| 1349 | * |
| 1350 | ***NOTE: |
| 1351 | * This function is used for sending eWNI_SME_DEAUTH_CNF or |
| 1352 | * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger. |
| 1353 | * |
| 1354 | * @param peerMacAddr Indicates the peer MAC addr to which |
| 1355 | * deauthentication was initiated |
| 1356 | * @param reasonCode Indicates the reason for Deauthetication |
| 1357 | * @param deauthTrigger Indicates the trigger for Deauthetication |
| 1358 | * @param aid Indicates the STAID. This parameter is present |
| 1359 | * only on AP. |
| 1360 | * |
| 1361 | * @return None |
| 1362 | */ |
| 1363 | void |
| 1364 | lim_send_sme_deauth_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, |
| 1365 | tSirResultCodes reasonCode, uint16_t deauthTrigger, |
| 1366 | uint16_t aid, uint8_t smesessionId, |
| 1367 | uint16_t smetransactionId) |
| 1368 | { |
| 1369 | uint8_t *pBuf; |
| 1370 | tSirSmeDeauthRsp *pSirSmeDeauthRsp; |
| 1371 | tSirSmeDeauthInd *pSirSmeDeauthInd; |
| 1372 | tpPESession psessionEntry; |
| 1373 | uint8_t sessionId; |
| 1374 | uint32_t *pMsg; |
| 1375 | |
| 1376 | psessionEntry = pe_find_session_by_bssid(pMac, peerMacAddr, &sessionId); |
| 1377 | switch (deauthTrigger) { |
| 1378 | case eLIM_PEER_ENTITY_DEAUTH: |
| 1379 | return; |
| 1380 | |
| 1381 | case eLIM_HOST_DEAUTH: |
| 1382 | /** |
| 1383 | * Deauthentication response to host triggered |
| 1384 | * deauthentication. |
| 1385 | */ |
| 1386 | pSirSmeDeauthRsp = cdf_mem_malloc(sizeof(tSirSmeDeauthRsp)); |
| 1387 | if (NULL == pSirSmeDeauthRsp) { |
| 1388 | /* Log error */ |
| 1389 | lim_log(pMac, LOGP, |
| 1390 | FL |
| 1391 | ("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP")); |
| 1392 | |
| 1393 | return; |
| 1394 | } |
| 1395 | lim_log(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with " |
| 1396 | "retCode: %d for" MAC_ADDRESS_STR), |
| 1397 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 1398 | pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP; |
| 1399 | pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp); |
| 1400 | pSirSmeDeauthRsp->statusCode = reasonCode; |
| 1401 | pSirSmeDeauthRsp->sessionId = smesessionId; |
| 1402 | pSirSmeDeauthRsp->transactionId = smetransactionId; |
| 1403 | |
| 1404 | pBuf = (uint8_t *) pSirSmeDeauthRsp->peerMacAddr; |
| 1405 | cdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr)); |
| 1406 | |
| 1407 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1408 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT, |
| 1409 | psessionEntry, 0, (uint16_t) reasonCode); |
| 1410 | #endif |
| 1411 | pMsg = (uint32_t *) pSirSmeDeauthRsp; |
| 1412 | |
| 1413 | break; |
| 1414 | |
| 1415 | default: |
| 1416 | /** |
| 1417 | * Deauthentication indication due to Deauthentication |
| 1418 | * frame reception from peer entity or due to |
| 1419 | * loss of link with peer entity. |
| 1420 | */ |
| 1421 | pSirSmeDeauthInd = cdf_mem_malloc(sizeof(tSirSmeDeauthInd)); |
| 1422 | if (NULL == pSirSmeDeauthInd) { |
| 1423 | /* Log error */ |
| 1424 | lim_log(pMac, LOGP, |
| 1425 | FL |
| 1426 | ("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind")); |
| 1427 | |
| 1428 | return; |
| 1429 | } |
| 1430 | lim_log(pMac, LOG1, FL("send eWNI_SME_DEAUTH_IND with " |
| 1431 | "retCode: %d for " MAC_ADDRESS_STR), |
| 1432 | reasonCode, MAC_ADDR_ARRAY(peerMacAddr)); |
| 1433 | pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND; |
| 1434 | pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd); |
| 1435 | pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 1436 | |
| 1437 | /* sessionId */ |
| 1438 | pBuf = (uint8_t *) &pSirSmeDeauthInd->sessionId; |
| 1439 | *pBuf++ = smesessionId; |
| 1440 | |
| 1441 | /* transaction ID */ |
| 1442 | lim_copy_u16(pBuf, smetransactionId); |
| 1443 | pBuf += sizeof(uint16_t); |
| 1444 | |
| 1445 | /* status code */ |
| 1446 | lim_copy_u32(pBuf, reasonCode); |
| 1447 | pBuf += sizeof(tSirResultCodes); |
| 1448 | |
| 1449 | /* bssId */ |
| 1450 | cdf_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 1451 | pBuf += sizeof(tSirMacAddr); |
| 1452 | |
| 1453 | /* peerMacAddr */ |
| 1454 | cdf_mem_copy(pSirSmeDeauthInd->peerMacAddr, peerMacAddr, |
| 1455 | sizeof(tSirMacAddr)); |
| 1456 | |
| 1457 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1458 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, |
| 1459 | psessionEntry, 0, (uint16_t) reasonCode); |
| 1460 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1461 | pMsg = (uint32_t *) pSirSmeDeauthInd; |
| 1462 | |
| 1463 | break; |
| 1464 | } |
| 1465 | |
| 1466 | /*Delete the PE session created */ |
| 1467 | if (psessionEntry != NULL) { |
| 1468 | pe_delete_session(pMac, psessionEntry); |
| 1469 | } |
| 1470 | |
| 1471 | lim_send_sme_disassoc_deauth_ntf(pMac, CDF_STATUS_SUCCESS, |
| 1472 | (uint32_t *) pMsg); |
| 1473 | |
| 1474 | } /*** end lim_send_sme_deauth_ntf() ***/ |
| 1475 | |
| 1476 | /** |
| 1477 | * lim_send_sme_wm_status_change_ntf() - Send Notification |
| 1478 | * @mac_ctx: Global MAC Context |
| 1479 | * @status_change_code: Indicates the change in the wireless medium. |
| 1480 | * @status_change_info: Indicates the information associated with |
| 1481 | * change in the wireless medium. |
| 1482 | * @info_len: Indicates the length of status change information |
| 1483 | * being sent. |
| 1484 | * @session_id SessionID |
| 1485 | * |
| 1486 | * This function is called by limProcessSmeMessages() to send |
| 1487 | * eWNI_SME_WM_STATUS_CHANGE_NTF message to host. |
| 1488 | * |
| 1489 | * Return: None |
| 1490 | */ |
| 1491 | void |
| 1492 | lim_send_sme_wm_status_change_ntf(tpAniSirGlobal mac_ctx, |
| 1493 | tSirSmeStatusChangeCode status_change_code, |
| 1494 | uint32_t *status_change_info, uint16_t info_len, uint8_t session_id) |
| 1495 | { |
| 1496 | tSirMsgQ msg; |
| 1497 | tSirSmeWmStatusChangeNtf *wm_status_change_ntf; |
| 1498 | |
| 1499 | wm_status_change_ntf = cdf_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf)); |
| 1500 | if (NULL == wm_status_change_ntf) { |
| 1501 | lim_log(mac_ctx, LOGE, |
| 1502 | FL("Mem Alloc failed - eWNI_SME_WM_STATUS_CHANGE_NTF")); |
| 1503 | return; |
| 1504 | } |
| 1505 | |
| 1506 | msg.type = eWNI_SME_WM_STATUS_CHANGE_NTF; |
| 1507 | msg.bodyval = 0; |
| 1508 | msg.bodyptr = wm_status_change_ntf; |
| 1509 | |
| 1510 | switch (status_change_code) { |
| 1511 | case eSIR_SME_RADAR_DETECTED: |
| 1512 | break; |
| 1513 | default: |
| 1514 | wm_status_change_ntf->messageType = |
| 1515 | eWNI_SME_WM_STATUS_CHANGE_NTF; |
| 1516 | wm_status_change_ntf->statusChangeCode = status_change_code; |
| 1517 | wm_status_change_ntf->length = sizeof(tSirSmeWmStatusChangeNtf); |
| 1518 | wm_status_change_ntf->sessionId = session_id; |
| 1519 | if (sizeof(wm_status_change_ntf->statusChangeInfo) >= |
| 1520 | info_len) { |
| 1521 | cdf_mem_copy( |
| 1522 | (uint8_t *) &wm_status_change_ntf->statusChangeInfo, |
| 1523 | (uint8_t *) status_change_info, info_len); |
| 1524 | } |
| 1525 | lim_log(mac_ctx, LOGE, |
| 1526 | FL("**---** StatusChg: code 0x%x, length %d **---**"), |
| 1527 | status_change_code, info_len); |
| 1528 | break; |
| 1529 | } |
| 1530 | |
| 1531 | MTRACE(mac_trace_msg_tx(mac_ctx, session_id, msg.type)); |
| 1532 | if (eSIR_SUCCESS != lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT)) { |
| 1533 | cdf_mem_free(wm_status_change_ntf); |
| 1534 | lim_log(mac_ctx, LOGP, |
| 1535 | FL("lim_sys_process_mmh_msg_api failed")); |
| 1536 | } |
| 1537 | |
| 1538 | } /*** end lim_send_sme_wm_status_change_ntf() ***/ |
| 1539 | |
| 1540 | /** |
| 1541 | * lim_send_sme_set_context_rsp() |
| 1542 | * |
| 1543 | ***FUNCTION: |
| 1544 | * This function is called by limProcessSmeMessages() to send |
| 1545 | * eWNI_SME_SETCONTEXT_RSP message to host |
| 1546 | * |
| 1547 | ***PARAMS: |
| 1548 | * |
| 1549 | ***LOGIC: |
| 1550 | * |
| 1551 | ***ASSUMPTIONS: |
| 1552 | * NA |
| 1553 | * |
| 1554 | ***NOTE: |
| 1555 | * |
| 1556 | * @param pMac Pointer to Global MAC structure |
| 1557 | * @param peerMacAddr Indicates the peer MAC addr to which |
| 1558 | * setContext was performed |
| 1559 | * @param aid Indicates the aid corresponding to the peer MAC |
| 1560 | * address |
| 1561 | * @param resultCode Indicates the result of previously issued |
| 1562 | * eWNI_SME_SETCONTEXT_RSP message |
| 1563 | * |
| 1564 | * @return None |
| 1565 | */ |
| 1566 | void |
| 1567 | lim_send_sme_set_context_rsp(tpAniSirGlobal pMac, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 1568 | struct cdf_mac_addr peer_macaddr, uint16_t aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1569 | tSirResultCodes resultCode, |
| 1570 | tpPESession psessionEntry, uint8_t smesessionId, |
| 1571 | uint16_t smetransactionId) |
| 1572 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1573 | tSirMsgQ mmhMsg; |
| 1574 | tSirSmeSetContextRsp *pSirSmeSetContextRsp; |
| 1575 | |
| 1576 | pSirSmeSetContextRsp = cdf_mem_malloc(sizeof(tSirSmeSetContextRsp)); |
| 1577 | if (NULL == pSirSmeSetContextRsp) { |
| 1578 | /* Log error */ |
| 1579 | lim_log(pMac, LOGP, |
| 1580 | FL |
| 1581 | ("call to AllocateMemory failed for SmeSetContextRsp")); |
| 1582 | |
| 1583 | return; |
| 1584 | } |
| 1585 | |
| 1586 | pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP; |
| 1587 | pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp); |
| 1588 | pSirSmeSetContextRsp->statusCode = resultCode; |
| 1589 | |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 1590 | cdf_copy_macaddr(&pSirSmeSetContextRsp->peer_macaddr, &peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1591 | |
| 1592 | /* Update SME session and transaction Id */ |
| 1593 | pSirSmeSetContextRsp->sessionId = smesessionId; |
| 1594 | pSirSmeSetContextRsp->transactionId = smetransactionId; |
| 1595 | |
| 1596 | mmhMsg.type = eWNI_SME_SETCONTEXT_RSP; |
| 1597 | mmhMsg.bodyptr = pSirSmeSetContextRsp; |
| 1598 | mmhMsg.bodyval = 0; |
| 1599 | if (NULL == psessionEntry) { |
| 1600 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 1601 | } else { |
| 1602 | MTRACE(mac_trace_msg_tx |
| 1603 | (pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1604 | } |
| 1605 | |
| 1606 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1607 | lim_diag_event_report(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, |
| 1608 | psessionEntry, (uint16_t) resultCode, 0); |
| 1609 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1610 | |
| 1611 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1612 | } /*** end lim_send_sme_set_context_rsp() ***/ |
| 1613 | |
| 1614 | /** |
| 1615 | * lim_send_sme_neighbor_bss_ind() |
| 1616 | * |
| 1617 | ***FUNCTION: |
| 1618 | * This function is called by lim_lookup_nadd_hash_entry() to send |
| 1619 | * eWNI_SME_NEIGHBOR_BSS_IND message to host |
| 1620 | * |
| 1621 | ***PARAMS: |
| 1622 | * |
| 1623 | ***LOGIC: |
| 1624 | * |
| 1625 | ***ASSUMPTIONS: |
| 1626 | * NA |
| 1627 | * |
| 1628 | ***NOTE: |
| 1629 | * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to |
| 1630 | * host upon detecting new BSS during background scanning if CFG |
| 1631 | * option is enabled for sending such indication |
| 1632 | * |
| 1633 | * @param pMac - Pointer to Global MAC structure |
| 1634 | * @return None |
| 1635 | */ |
| 1636 | |
| 1637 | void |
| 1638 | lim_send_sme_neighbor_bss_ind(tpAniSirGlobal pMac, tLimScanResultNode *pBssDescr) |
| 1639 | { |
| 1640 | tSirMsgQ msgQ; |
| 1641 | uint32_t val; |
| 1642 | tSirSmeNeighborBssInd *pNewBssInd; |
| 1643 | |
| 1644 | if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) || |
| 1645 | ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) && |
| 1646 | pMac->lim.gLimRspReqd)) { |
| 1647 | /* LIM is not in background scan state OR */ |
| 1648 | /* current scan is initiated by HDD. */ |
| 1649 | /* No need to send new BSS indication to HDD */ |
| 1650 | return; |
| 1651 | } |
| 1652 | |
| 1653 | if (wlan_cfg_get_int(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != |
| 1654 | eSIR_SUCCESS) { |
| 1655 | lim_log(pMac, LOGP, |
| 1656 | FL("could not get NEIGHBOR_BSS_IND from CFG")); |
| 1657 | |
| 1658 | return; |
| 1659 | } |
| 1660 | |
| 1661 | if (val == 0) |
| 1662 | return; |
| 1663 | |
| 1664 | /** |
| 1665 | * Need to indicate new BSSs found during |
| 1666 | * background scanning to host. |
| 1667 | * Allocate buffer for sending indication. |
| 1668 | * Length of buffer is length of BSS description |
| 1669 | * and length of header itself |
| 1670 | */ |
| 1671 | val = pBssDescr->bssDescription.length + sizeof(uint16_t) + |
| 1672 | sizeof(uint32_t) + sizeof(uint8_t); |
| 1673 | pNewBssInd = cdf_mem_malloc(val); |
| 1674 | if (NULL == pNewBssInd) { |
| 1675 | /* Log error */ |
| 1676 | lim_log(pMac, LOGP, |
| 1677 | FL |
| 1678 | ("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND")); |
| 1679 | |
| 1680 | return; |
| 1681 | } |
| 1682 | |
| 1683 | pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND; |
| 1684 | pNewBssInd->length = (uint16_t) val; |
| 1685 | pNewBssInd->sessionId = 0; |
| 1686 | |
| 1687 | cdf_mem_copy((uint8_t *) pNewBssInd->bssDescription, |
| 1688 | (uint8_t *) &pBssDescr->bssDescription, |
| 1689 | pBssDescr->bssDescription.length + sizeof(uint16_t)); |
| 1690 | |
| 1691 | msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND; |
| 1692 | msgQ.bodyptr = pNewBssInd; |
| 1693 | msgQ.bodyval = 0; |
| 1694 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 1695 | lim_sys_process_mmh_msg_api(pMac, &msgQ, ePROT); |
| 1696 | } /*** end lim_send_sme_neighbor_bss_ind() ***/ |
| 1697 | |
| 1698 | /** ----------------------------------------------------------------- |
| 1699 | \brief lim_send_sme_addts_rsp() - sends SME ADDTS RSP |
| 1700 | \ This function sends a eWNI_SME_ADDTS_RSP to SME. |
| 1701 | \ SME only looks at rc and tspec field. |
| 1702 | \param pMac - global mac structure |
| 1703 | \param rspReqd - is SmeAddTsRsp required |
| 1704 | \param status - status code of SME_ADD_TS_RSP |
| 1705 | \return tspec |
| 1706 | \sa |
| 1707 | ----------------------------------------------------------------- */ |
| 1708 | void |
| 1709 | lim_send_sme_addts_rsp(tpAniSirGlobal pMac, uint8_t rspReqd, uint32_t status, |
| 1710 | tpPESession psessionEntry, tSirMacTspecIE tspec, |
| 1711 | uint8_t smesessionId, uint16_t smetransactionId) |
| 1712 | { |
| 1713 | tpSirAddtsRsp rsp; |
| 1714 | tSirMsgQ mmhMsg; |
| 1715 | |
| 1716 | if (!rspReqd) |
| 1717 | return; |
| 1718 | |
| 1719 | rsp = cdf_mem_malloc(sizeof(tSirAddtsRsp)); |
| 1720 | if (NULL == rsp) { |
| 1721 | lim_log(pMac, LOGP, FL("AllocateMemory failed for ADDTS_RSP")); |
| 1722 | return; |
| 1723 | } |
| 1724 | |
| 1725 | cdf_mem_set((uint8_t *) rsp, sizeof(*rsp), 0); |
| 1726 | rsp->messageType = eWNI_SME_ADDTS_RSP; |
| 1727 | rsp->rc = status; |
| 1728 | rsp->rsp.status = (enum eSirMacStatusCodes)status; |
| 1729 | rsp->rsp.tspec = tspec; |
| 1730 | /* Update SME session Id and transcation Id */ |
| 1731 | rsp->sessionId = smesessionId; |
| 1732 | rsp->transactionId = smetransactionId; |
| 1733 | |
| 1734 | mmhMsg.type = eWNI_SME_ADDTS_RSP; |
| 1735 | mmhMsg.bodyptr = rsp; |
| 1736 | mmhMsg.bodyval = 0; |
| 1737 | if (NULL == psessionEntry) { |
| 1738 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 1739 | } else { |
| 1740 | MTRACE(mac_trace_msg_tx |
| 1741 | (pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1742 | } |
| 1743 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1744 | lim_diag_event_report(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, |
| 1745 | 0); |
| 1746 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1747 | |
| 1748 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1749 | return; |
| 1750 | } |
| 1751 | |
| 1752 | void |
| 1753 | lim_send_sme_delts_rsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, uint32_t status, |
| 1754 | tpPESession psessionEntry, uint8_t smesessionId, |
| 1755 | uint16_t smetransactionId) |
| 1756 | { |
| 1757 | tpSirDeltsRsp rsp; |
| 1758 | tSirMsgQ mmhMsg; |
| 1759 | |
| 1760 | lim_log(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d", |
| 1761 | delts->aid, |
| 1762 | delts->req.tsinfo.traffic.tsid, |
| 1763 | delts->req.tsinfo.traffic.userPrio, status); |
| 1764 | if (!delts->rspReqd) |
| 1765 | return; |
| 1766 | |
| 1767 | rsp = cdf_mem_malloc(sizeof(tSirDeltsRsp)); |
| 1768 | if (NULL == rsp) { |
| 1769 | /* Log error */ |
| 1770 | lim_log(pMac, LOGP, FL("AllocateMemory failed for DELTS_RSP")); |
| 1771 | return; |
| 1772 | } |
| 1773 | cdf_mem_set((uint8_t *) rsp, sizeof(*rsp), 0); |
| 1774 | |
| 1775 | if (psessionEntry != NULL) { |
| 1776 | |
| 1777 | rsp->aid = delts->aid; |
Srinivas Girigowda | bab8893 | 2015-12-03 19:18:11 -0800 | [diff] [blame] | 1778 | cdf_copy_macaddr(&rsp->macaddr, &delts->macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1779 | cdf_mem_copy((uint8_t *) &rsp->rsp, (uint8_t *) &delts->req, |
| 1780 | sizeof(tSirDeltsReqInfo)); |
| 1781 | } |
| 1782 | |
| 1783 | rsp->messageType = eWNI_SME_DELTS_RSP; |
| 1784 | rsp->rc = status; |
| 1785 | |
| 1786 | /* Update SME session Id and transcation Id */ |
| 1787 | rsp->sessionId = smesessionId; |
| 1788 | rsp->transactionId = smetransactionId; |
| 1789 | |
| 1790 | mmhMsg.type = eWNI_SME_DELTS_RSP; |
| 1791 | mmhMsg.bodyptr = rsp; |
| 1792 | mmhMsg.bodyval = 0; |
| 1793 | if (NULL == psessionEntry) { |
| 1794 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 1795 | } else { |
| 1796 | MTRACE(mac_trace_msg_tx |
| 1797 | (pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1798 | } |
| 1799 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1800 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, |
| 1801 | (uint16_t) status, 0); |
| 1802 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1803 | |
| 1804 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1805 | } |
| 1806 | |
| 1807 | void |
| 1808 | lim_send_sme_delts_ind(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, uint16_t aid, |
| 1809 | tpPESession psessionEntry) |
| 1810 | { |
| 1811 | tpSirDeltsRsp rsp; |
| 1812 | tSirMsgQ mmhMsg; |
| 1813 | |
| 1814 | lim_log(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)", |
| 1815 | aid, delts->tsinfo.traffic.tsid, delts->tsinfo.traffic.userPrio); |
| 1816 | |
| 1817 | rsp = cdf_mem_malloc(sizeof(tSirDeltsRsp)); |
| 1818 | if (NULL == rsp) { |
| 1819 | /* Log error */ |
| 1820 | lim_log(pMac, LOGP, FL("AllocateMemory failed for DELTS_IND")); |
| 1821 | return; |
| 1822 | } |
| 1823 | cdf_mem_set((uint8_t *) rsp, sizeof(*rsp), 0); |
| 1824 | |
| 1825 | rsp->messageType = eWNI_SME_DELTS_IND; |
| 1826 | rsp->rc = eSIR_SUCCESS; |
| 1827 | rsp->aid = aid; |
| 1828 | cdf_mem_copy((uint8_t *) &rsp->rsp, (uint8_t *) delts, sizeof(*delts)); |
| 1829 | |
| 1830 | /* Update SME session Id and SME transaction Id */ |
| 1831 | |
| 1832 | rsp->sessionId = psessionEntry->smeSessionId; |
| 1833 | rsp->transactionId = psessionEntry->transactionId; |
| 1834 | |
| 1835 | mmhMsg.type = eWNI_SME_DELTS_IND; |
| 1836 | mmhMsg.bodyptr = rsp; |
| 1837 | mmhMsg.bodyval = 0; |
| 1838 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type)); |
| 1839 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1840 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, |
| 1841 | 0); |
| 1842 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1843 | |
| 1844 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1845 | } |
| 1846 | |
| 1847 | /** |
| 1848 | * lim_send_sme_pe_statistics_rsp() |
| 1849 | * |
| 1850 | ***FUNCTION: |
| 1851 | * This function is called to send 802.11 statistics response to HDD. |
| 1852 | * This function posts the result back to HDD. This is a response to |
| 1853 | * HDD's request for statistics. |
| 1854 | * |
| 1855 | ***PARAMS: |
| 1856 | * |
| 1857 | ***LOGIC: |
| 1858 | * |
| 1859 | ***ASSUMPTIONS: |
| 1860 | * NA |
| 1861 | * |
| 1862 | ***NOTE: |
| 1863 | * NA |
| 1864 | * |
| 1865 | * @param pMac Pointer to Global MAC structure |
| 1866 | * @param p80211Stats Statistics sent in response |
| 1867 | * @param resultCode TODO: |
| 1868 | * |
| 1869 | * |
| 1870 | * @return none |
| 1871 | */ |
| 1872 | |
| 1873 | void |
| 1874 | lim_send_sme_pe_statistics_rsp(tpAniSirGlobal pMac, uint16_t msgType, void *stats) |
| 1875 | { |
| 1876 | tSirMsgQ mmhMsg; |
| 1877 | uint8_t sessionId; |
| 1878 | tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats; |
| 1879 | tpPESession pPeSessionEntry; |
| 1880 | |
| 1881 | /* Get the Session Id based on Sta Id */ |
| 1882 | pPeSessionEntry = |
| 1883 | pe_find_session_by_sta_id(pMac, pPeStats->staId, &sessionId); |
| 1884 | |
| 1885 | /* Fill the Session Id */ |
| 1886 | if (NULL != pPeSessionEntry) { |
| 1887 | /* Fill the Session Id */ |
| 1888 | pPeStats->sessionId = pPeSessionEntry->smeSessionId; |
| 1889 | } |
| 1890 | |
| 1891 | pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP; |
| 1892 | |
| 1893 | /* msgType should be WMA_GET_STATISTICS_RSP */ |
| 1894 | mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP; |
| 1895 | |
| 1896 | mmhMsg.bodyptr = stats; |
| 1897 | mmhMsg.bodyval = 0; |
| 1898 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, mmhMsg.type)); |
| 1899 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1900 | |
| 1901 | return; |
| 1902 | |
| 1903 | } /*** end lim_send_sme_pe_statistics_rsp() ***/ |
| 1904 | |
| 1905 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
| 1906 | /** |
| 1907 | * lim_send_sme_pe_ese_tsm_rsp() |
| 1908 | * |
| 1909 | ***FUNCTION: |
| 1910 | * This function is called to send tsm stats response to HDD. |
| 1911 | * This function posts the result back to HDD. This is a response to |
| 1912 | * HDD's request to get tsm stats. |
| 1913 | * |
| 1914 | ***PARAMS: |
| 1915 | * @param pMac - Pointer to global pMac structure |
| 1916 | * @param pStats - Pointer to TSM Stats |
| 1917 | * |
| 1918 | * @return none |
| 1919 | */ |
| 1920 | |
| 1921 | void lim_send_sme_pe_ese_tsm_rsp(tpAniSirGlobal pMac, tAniGetTsmStatsRsp *pStats) |
| 1922 | { |
| 1923 | tSirMsgQ mmhMsg; |
| 1924 | uint8_t sessionId; |
| 1925 | tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats; |
| 1926 | tpPESession pPeSessionEntry = NULL; |
| 1927 | |
| 1928 | /* Get the Session Id based on Sta Id */ |
| 1929 | pPeSessionEntry = |
| 1930 | pe_find_session_by_sta_id(pMac, pPeStats->staId, &sessionId); |
| 1931 | |
| 1932 | /* Fill the Session Id */ |
| 1933 | if (NULL != pPeSessionEntry) { |
| 1934 | /* Fill the Session Id */ |
| 1935 | pPeStats->sessionId = pPeSessionEntry->smeSessionId; |
| 1936 | } else { |
| 1937 | PELOGE(lim_log |
| 1938 | (pMac, LOGE, FL("Session not found for the Sta id(%d)"), |
| 1939 | pPeStats->staId); |
| 1940 | ) |
| 1941 | return; |
| 1942 | } |
| 1943 | |
| 1944 | pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP; |
| 1945 | pPeStats->tsmMetrics.RoamingCount |
| 1946 | = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount; |
| 1947 | pPeStats->tsmMetrics.RoamingDly |
| 1948 | = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly; |
| 1949 | |
| 1950 | mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP; |
| 1951 | mmhMsg.bodyptr = pStats; |
| 1952 | mmhMsg.bodyval = 0; |
| 1953 | MTRACE(mac_trace_msg_tx(pMac, sessionId, mmhMsg.type)); |
| 1954 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 1955 | |
| 1956 | return; |
| 1957 | } /*** end lim_send_sme_pe_ese_tsm_rsp() ***/ |
| 1958 | |
| 1959 | #endif /* FEATURE_WLAN_ESE) && FEATURE_WLAN_ESE_UPLOAD */ |
| 1960 | |
| 1961 | void |
| 1962 | lim_send_sme_ibss_peer_ind(tpAniSirGlobal pMac, |
| 1963 | tSirMacAddr peerMacAddr, |
| 1964 | uint16_t staIndex, |
| 1965 | uint8_t ucastIdx, |
| 1966 | uint8_t bcastIdx, |
| 1967 | uint8_t *beacon, |
| 1968 | uint16_t beaconLen, uint16_t msgType, uint8_t sessionId) |
| 1969 | { |
| 1970 | tSirMsgQ mmhMsg; |
| 1971 | tSmeIbssPeerInd *pNewPeerInd; |
| 1972 | |
| 1973 | pNewPeerInd = cdf_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen); |
| 1974 | if (NULL == pNewPeerInd) { |
| 1975 | PELOGE(lim_log(pMac, LOGE, FL("Failed to allocate memory"));) |
| 1976 | return; |
| 1977 | } |
| 1978 | |
| 1979 | cdf_mem_set((void *)pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen), |
| 1980 | 0); |
| 1981 | |
Srinivas Girigowda | 01d1c3c | 2015-11-25 16:54:41 -0800 | [diff] [blame] | 1982 | cdf_mem_copy((uint8_t *) pNewPeerInd->peer_addr.bytes, |
| 1983 | peerMacAddr, CDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1984 | pNewPeerInd->staId = staIndex; |
| 1985 | pNewPeerInd->ucastSig = ucastIdx; |
| 1986 | pNewPeerInd->bcastSig = bcastIdx; |
| 1987 | pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen; |
| 1988 | pNewPeerInd->mesgType = msgType; |
| 1989 | pNewPeerInd->sessionId = sessionId; |
| 1990 | |
| 1991 | if (beacon != NULL) { |
| 1992 | cdf_mem_copy((void *)((uint8_t *) pNewPeerInd + |
| 1993 | sizeof(tSmeIbssPeerInd)), (void *)beacon, |
| 1994 | beaconLen); |
| 1995 | } |
| 1996 | |
| 1997 | mmhMsg.type = msgType; |
| 1998 | mmhMsg.bodyptr = pNewPeerInd; |
| 1999 | MTRACE(mac_trace_msg_tx(pMac, sessionId, mmhMsg.type)); |
| 2000 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2001 | |
| 2002 | } |
| 2003 | |
| 2004 | /** |
| 2005 | * lim_handle_csa_offload_msg() - Handle CSA offload message |
| 2006 | * @mac_ctx: pointer to global adapter context |
| 2007 | * @msg: Message pointer. |
| 2008 | * |
| 2009 | * Return: None |
| 2010 | */ |
| 2011 | void lim_handle_csa_offload_msg(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) |
| 2012 | { |
| 2013 | tpPESession session_entry; |
| 2014 | tSirMsgQ mmh_msg; |
| 2015 | tpCSAOffloadParams csa_params = (tpCSAOffloadParams) (msg->bodyptr); |
| 2016 | tpSmeCsaOffloadInd csa_offload_ind; |
| 2017 | tpDphHashNode sta_ds = NULL; |
| 2018 | uint8_t session_id; |
| 2019 | uint16_t aid = 0; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2020 | uint16_t chan_space = 0; |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2021 | chan_params_t ch_params; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2022 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2023 | tLimWiderBWChannelSwitchInfo *chnl_switch_info = NULL; |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2024 | tLimChannelSwitchInfo *lim_ch_switch = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2025 | |
| 2026 | if (!csa_params) { |
| 2027 | lim_log(mac_ctx, LOGE, FL("limMsgQ body ptr is NULL")); |
| 2028 | return; |
| 2029 | } |
| 2030 | |
| 2031 | session_entry = |
| 2032 | pe_find_session_by_bssid(mac_ctx, |
| 2033 | csa_params->bssId, &session_id); |
| 2034 | if (!session_entry) { |
| 2035 | lim_log(mac_ctx, LOGE, |
| 2036 | FL("Session does not exist")); |
| 2037 | goto err; |
| 2038 | } |
| 2039 | |
| 2040 | sta_ds = dph_lookup_hash_entry(mac_ctx, session_entry->bssId, &aid, |
| 2041 | &session_entry->dph.dphHashTable); |
| 2042 | |
| 2043 | if (!sta_ds) { |
| 2044 | lim_log(mac_ctx, LOGE, |
| 2045 | FL("sta_ds does not exist")); |
| 2046 | goto err; |
| 2047 | } |
| 2048 | |
| 2049 | if (LIM_IS_STA_ROLE(session_entry)) { |
Masti, Narayanraddi | 1c63044 | 2015-11-02 12:03:50 +0530 | [diff] [blame] | 2050 | /* |
| 2051 | * on receiving channel switch announcement from AP, delete all |
| 2052 | * TDLS peers before leaving BSS and proceed for channel switch |
| 2053 | */ |
| 2054 | lim_delete_tdls_peers(mac_ctx, session_entry); |
| 2055 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2056 | lim_ch_switch = &session_entry->gLimChannelSwitch; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2057 | session_entry->gLimChannelSwitch.switchMode = |
| 2058 | csa_params->switchmode; |
| 2059 | /* timer already started by firmware, switch immediately */ |
| 2060 | session_entry->gLimChannelSwitch.switchCount = 0; |
| 2061 | session_entry->gLimChannelSwitch.primaryChannel = |
| 2062 | csa_params->channel; |
| 2063 | session_entry->gLimChannelSwitch.state = |
| 2064 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2065 | session_entry->gLimChannelSwitch.ch_width = CH_WIDTH_20MHZ; |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2066 | lim_ch_switch->sec_ch_offset = |
| 2067 | session_entry->htSecondaryChannelOffset; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2068 | session_entry->gLimChannelSwitch.ch_center_freq_seg0 = 0; |
| 2069 | session_entry->gLimChannelSwitch.ch_center_freq_seg1 = 0; |
| 2070 | chnl_switch_info = |
| 2071 | &session_entry->gLimWiderBWChannelSwitch; |
| 2072 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2073 | if (session_entry->vhtCapability && |
| 2074 | session_entry->htSupportedChannelWidthSet) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2075 | if (csa_params->ies_present_flag & lim_wbw_ie_present) { |
| 2076 | chnl_switch_info->newChanWidth = |
| 2077 | csa_params->new_ch_width; |
| 2078 | chnl_switch_info->newCenterChanFreq0 = |
| 2079 | csa_params->new_ch_freq_seg1; |
| 2080 | chnl_switch_info->newCenterChanFreq1 = |
| 2081 | csa_params->new_ch_freq_seg2; |
| 2082 | session_entry->gLimChannelSwitch.state = |
| 2083 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2084 | session_entry->gLimChannelSwitch.ch_width = |
| 2085 | csa_params->new_ch_width + 1; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2086 | } else if (csa_params->ies_present_flag |
| 2087 | & lim_xcsa_ie_present) { |
| 2088 | chan_space = |
| 2089 | cds_regdm_get_chanwidth_from_opclass( |
| 2090 | mac_ctx->scan.countryCodeCurrent, |
| 2091 | csa_params->channel, |
| 2092 | csa_params->new_op_class); |
| 2093 | session_entry->gLimChannelSwitch.state = |
| 2094 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2095 | |
| 2096 | if (chan_space == 80) { |
| 2097 | chnl_switch_info->newChanWidth = |
| 2098 | CH_WIDTH_80MHZ; |
| 2099 | } else if (chan_space == 40) { |
| 2100 | chnl_switch_info->newChanWidth = |
| 2101 | CH_WIDTH_40MHZ; |
| 2102 | } else { |
| 2103 | chnl_switch_info->newChanWidth = |
| 2104 | CH_WIDTH_20MHZ; |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2105 | lim_ch_switch->state = |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2106 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2107 | } |
| 2108 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2109 | ch_params.ch_width = |
| 2110 | chnl_switch_info->newChanWidth; |
| 2111 | cds_set_ch_params(csa_params->channel, |
| 2112 | eCSR_DOT11_MODE_11ac, |
| 2113 | &ch_params); |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2114 | chnl_switch_info->newCenterChanFreq0 = |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2115 | ch_params.center_freq_seg0; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2116 | /* |
| 2117 | * This is not applicable for 20/40/80 MHz. |
| 2118 | * Only used when we support 80+80 MHz operation. |
| 2119 | * In case of 80+80 MHz, this parameter indicates |
| 2120 | * center channel frequency index of 80 MHz |
| 2121 | * channel offrequency segment 1. |
| 2122 | */ |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2123 | chnl_switch_info->newCenterChanFreq1 = |
| 2124 | ch_params.center_freq_seg1; |
| 2125 | lim_ch_switch->sec_ch_offset = |
| 2126 | ch_params.sec_ch_offset; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2127 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2128 | } |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2129 | session_entry->gLimChannelSwitch.ch_center_freq_seg0 = |
| 2130 | chnl_switch_info->newCenterChanFreq0; |
| 2131 | session_entry->gLimChannelSwitch.ch_center_freq_seg1 = |
| 2132 | chnl_switch_info->newCenterChanFreq1; |
| 2133 | session_entry->gLimChannelSwitch.ch_width = |
| 2134 | chnl_switch_info->newChanWidth; |
| 2135 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2136 | } else if (session_entry->htSupportedChannelWidthSet) { |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2137 | if (csa_params->ies_present_flag |
| 2138 | & lim_xcsa_ie_present) { |
| 2139 | chan_space = |
| 2140 | cds_regdm_get_chanwidth_from_opclass( |
| 2141 | mac_ctx->scan.countryCodeCurrent, |
| 2142 | csa_params->channel, |
| 2143 | csa_params->new_op_class); |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2144 | lim_ch_switch->state = |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2145 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2146 | if (chan_space == 40) { |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2147 | lim_ch_switch->ch_width = |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2148 | CH_WIDTH_40MHZ; |
| 2149 | chnl_switch_info->newChanWidth = |
| 2150 | CH_WIDTH_40MHZ; |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2151 | ch_params.ch_width = |
| 2152 | chnl_switch_info->newChanWidth; |
| 2153 | cds_set_ch_params(csa_params->channel, |
| 2154 | eCSR_DOT11_MODE_11n, |
| 2155 | &ch_params); |
| 2156 | lim_ch_switch->ch_center_freq_seg0 = |
| 2157 | ch_params.center_freq_seg0; |
| 2158 | lim_ch_switch->sec_ch_offset = |
| 2159 | ch_params.sec_ch_offset; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2160 | } else { |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2161 | lim_ch_switch->ch_width = |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2162 | CH_WIDTH_20MHZ; |
| 2163 | chnl_switch_info->newChanWidth = |
| 2164 | CH_WIDTH_40MHZ; |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2165 | lim_ch_switch->state = |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2166 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2167 | lim_ch_switch->sec_ch_offset = |
| 2168 | PHY_SINGLE_CHANNEL_CENTERED; |
Gupta, Kapil | 121bf21 | 2015-11-25 19:21:29 +0530 | [diff] [blame] | 2169 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2170 | } else { |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2171 | lim_ch_switch->ch_width = |
| 2172 | CH_WIDTH_40MHZ; |
| 2173 | lim_ch_switch->state = |
| 2174 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2175 | ch_params.ch_width = CH_WIDTH_40MHZ; |
| 2176 | cds_set_ch_params(csa_params->channel, |
| 2177 | eCSR_DOT11_MODE_11n, |
| 2178 | &ch_params); |
| 2179 | lim_ch_switch->ch_center_freq_seg0 = |
| 2180 | ch_params.center_freq_seg0; |
| 2181 | lim_ch_switch->sec_ch_offset = |
| 2182 | ch_params.sec_ch_offset; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2183 | } |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 2184 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2185 | } |
| 2186 | lim_log(mac_ctx, LOG1, FL("new ch width = %d"), |
| 2187 | session_entry->gLimChannelSwitch.ch_width); |
| 2188 | |
| 2189 | lim_prepare_for11h_channel_switch(mac_ctx, session_entry); |
| 2190 | csa_offload_ind = cdf_mem_malloc(sizeof(tSmeCsaOffloadInd)); |
| 2191 | if (NULL == csa_offload_ind) { |
| 2192 | lim_log(mac_ctx, LOGE, |
| 2193 | FL("memalloc fail eWNI_SME_CSA_OFFLOAD_EVENT")); |
| 2194 | goto err; |
| 2195 | } |
| 2196 | |
| 2197 | cdf_mem_set(csa_offload_ind, sizeof(tSmeCsaOffloadInd), 0); |
| 2198 | csa_offload_ind->mesgType = eWNI_SME_CSA_OFFLOAD_EVENT; |
| 2199 | csa_offload_ind->mesgLen = sizeof(tSmeCsaOffloadInd); |
Srinivas Girigowda | c9148f7 | 2015-11-25 12:42:32 -0800 | [diff] [blame] | 2200 | cdf_mem_copy(csa_offload_ind->bssid.bytes, session_entry->bssId, |
| 2201 | CDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2202 | mmh_msg.type = eWNI_SME_CSA_OFFLOAD_EVENT; |
| 2203 | mmh_msg.bodyptr = csa_offload_ind; |
| 2204 | mmh_msg.bodyval = 0; |
| 2205 | lim_log(mac_ctx, LOG1, |
Srinivas Girigowda | c9148f7 | 2015-11-25 12:42:32 -0800 | [diff] [blame] | 2206 | FL("Sending eWNI_SME_CSA_OFFLOAD_EVENT to SME.")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2207 | MTRACE(mac_trace_msg_tx |
| 2208 | (mac_ctx, session_entry->peSessionId, mmh_msg.type)); |
| 2209 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 2210 | lim_diag_event_report(mac_ctx, |
| 2211 | WLAN_PE_DIAG_SWITCH_CHL_IND_EVENT, session_entry, |
| 2212 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 2213 | #endif |
| 2214 | lim_sys_process_mmh_msg_api(mac_ctx, &mmh_msg, ePROT); |
| 2215 | } |
| 2216 | |
| 2217 | err: |
| 2218 | cdf_mem_free(csa_params); |
| 2219 | } |
| 2220 | |
| 2221 | /*-------------------------------------------------------------------------- |
| 2222 | \brief pe_delete_session() - Handle the Delete BSS Response from HAL. |
| 2223 | |
| 2224 | \param pMac - pointer to global adapter context |
| 2225 | \param sessionId - Message pointer. |
| 2226 | |
| 2227 | \sa |
| 2228 | --------------------------------------------------------------------------*/ |
| 2229 | |
| 2230 | void lim_handle_delete_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ MsgQ) |
| 2231 | { |
| 2232 | tpPESession psessionEntry; |
| 2233 | tpDeleteBssParams pDelBss = (tpDeleteBssParams) (MsgQ->bodyptr); |
| 2234 | |
| 2235 | psessionEntry = |
| 2236 | pe_find_session_by_session_id(pMac, pDelBss->sessionId); |
| 2237 | if (psessionEntry == NULL) { |
| 2238 | lim_log(pMac, LOGE, |
| 2239 | FL("Session Does not exist for given sessionID %d"), |
| 2240 | pDelBss->sessionId); |
| 2241 | return; |
| 2242 | } |
| 2243 | if (LIM_IS_IBSS_ROLE(psessionEntry)) { |
| 2244 | lim_ibss_del_bss_rsp(pMac, MsgQ->bodyptr, psessionEntry); |
| 2245 | } else if (LIM_IS_UNKNOWN_ROLE(psessionEntry)) { |
| 2246 | lim_process_sme_del_bss_rsp(pMac, MsgQ->bodyval, psessionEntry); |
| 2247 | } |
| 2248 | |
| 2249 | else |
| 2250 | lim_process_mlm_del_bss_rsp(pMac, MsgQ, psessionEntry); |
| 2251 | |
| 2252 | } |
| 2253 | |
| 2254 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2255 | /** ----------------------------------------------------------------- |
| 2256 | \brief lim_send_sme_aggr_qos_rsp() - sends SME FT AGGR QOS RSP |
| 2257 | \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME. |
| 2258 | \ SME only looks at rc and tspec field. |
| 2259 | \param pMac - global mac structure |
| 2260 | \param rspReqd - is SmeAddTsRsp required |
| 2261 | \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP |
| 2262 | \return tspec |
| 2263 | \sa |
| 2264 | ----------------------------------------------------------------- */ |
| 2265 | void |
| 2266 | lim_send_sme_aggr_qos_rsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp, |
| 2267 | uint8_t smesessionId) |
| 2268 | { |
| 2269 | tSirMsgQ mmhMsg; |
| 2270 | |
| 2271 | mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP; |
| 2272 | mmhMsg.bodyptr = aggrQosRsp; |
| 2273 | mmhMsg.bodyval = 0; |
| 2274 | MTRACE(mac_trace_msg_tx(pMac, smesessionId, mmhMsg.type)); |
| 2275 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2276 | |
| 2277 | return; |
| 2278 | } |
| 2279 | #endif |
| 2280 | |
| 2281 | void lim_send_sme_max_assoc_exceeded_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, |
| 2282 | uint8_t smesessionId) |
| 2283 | { |
| 2284 | tSirMsgQ mmhMsg; |
| 2285 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
| 2286 | |
| 2287 | pSmeMaxAssocInd = cdf_mem_malloc(sizeof(tSmeMaxAssocInd)); |
| 2288 | if (NULL == pSmeMaxAssocInd) { |
| 2289 | PELOGE(lim_log(pMac, LOGE, FL("Failed to allocate memory"));) |
| 2290 | return; |
| 2291 | } |
| 2292 | cdf_mem_set((void *)pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd), 0); |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 2293 | cdf_mem_copy((uint8_t *) pSmeMaxAssocInd->peer_mac.bytes, |
| 2294 | (uint8_t *) peerMacAddr, CDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2295 | pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED; |
| 2296 | pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd); |
| 2297 | pSmeMaxAssocInd->sessionId = smesessionId; |
| 2298 | mmhMsg.type = pSmeMaxAssocInd->mesgType; |
| 2299 | mmhMsg.bodyptr = pSmeMaxAssocInd; |
| 2300 | PELOG1(lim_log(pMac, LOG1, FL("msgType %s peerMacAddr " MAC_ADDRESS_STR |
| 2301 | " sme session id %d"), |
| 2302 | "eWNI_SME_MAX_ASSOC_EXCEEDED", |
| 2303 | MAC_ADDR_ARRAY(peerMacAddr)); |
| 2304 | ) |
| 2305 | MTRACE(mac_trace_msg_tx(pMac, smesessionId, mmhMsg.type)); |
| 2306 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2307 | |
| 2308 | return; |
| 2309 | } |
| 2310 | |
| 2311 | /** ----------------------------------------------------------------- |
| 2312 | \brief lim_send_sme_dfs_event_notify() - sends |
| 2313 | eWNI_SME_DFS_RADAR_FOUND |
| 2314 | After receiving WMI_PHYERR_EVENTID indication frame from FW, this |
| 2315 | function sends a eWNI_SME_DFS_RADAR_FOUND to SME to notify |
| 2316 | that a RADAR is found on current operating channel and SAP- |
| 2317 | has to move to a new channel. |
| 2318 | \param pMac - global mac structure |
| 2319 | \param msgType - message type received from lower layer |
| 2320 | \param event - event data received from lower layer |
| 2321 | \return none |
| 2322 | \sa |
| 2323 | ----------------------------------------------------------------- */ |
| 2324 | void |
| 2325 | lim_send_sme_dfs_event_notify(tpAniSirGlobal pMac, uint16_t msgType, void *event) |
| 2326 | { |
| 2327 | tSirMsgQ mmhMsg; |
| 2328 | mmhMsg.type = eWNI_SME_DFS_RADAR_FOUND; |
| 2329 | mmhMsg.bodyptr = event; |
| 2330 | mmhMsg.bodyval = 0; |
| 2331 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2332 | return; |
| 2333 | } |
| 2334 | |
| 2335 | /*-------------------------------------------------------------------------- |
| 2336 | \brief lim_send_dfs_chan_sw_ie_update() |
| 2337 | This timer handler updates the channel switch IE in beacon template |
| 2338 | |
| 2339 | \param pMac - pointer to global adapter context |
| 2340 | \return - channel to scan from valid session else zero. |
| 2341 | \sa |
| 2342 | --------------------------------------------------------------------------*/ |
| 2343 | static void |
| 2344 | lim_send_dfs_chan_sw_ie_update(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 2345 | { |
| 2346 | |
| 2347 | /* Update the beacon template and send to FW */ |
| 2348 | if (sch_set_fixed_beacon_fields(pMac, psessionEntry) != eSIR_SUCCESS) { |
| 2349 | PELOGE(lim_log(pMac, LOGE, FL("Unable to set CSA IE in beacon"));) |
| 2350 | return; |
| 2351 | } |
| 2352 | |
| 2353 | /* Send update beacon template message */ |
| 2354 | lim_send_beacon_ind(pMac, psessionEntry); |
| 2355 | PELOG1(lim_log(pMac, LOG1, |
| 2356 | FL(" Updated CSA IE, IE COUNT = %d"), |
| 2357 | psessionEntry->gLimChannelSwitch.switchCount); |
| 2358 | ) |
| 2359 | |
| 2360 | return; |
| 2361 | } |
| 2362 | |
| 2363 | /** ----------------------------------------------------------------- |
| 2364 | \brief lim_send_sme_ap_channel_switch_resp() - sends |
| 2365 | eWNI_SME_CHANNEL_CHANGE_RSP |
| 2366 | After receiving WMA_SWITCH_CHANNEL_RSP indication this |
| 2367 | function sends a eWNI_SME_CHANNEL_CHANGE_RSP to SME to notify |
| 2368 | that the Channel change has been done to the specified target |
| 2369 | channel in the Channel change request |
| 2370 | \param pMac - global mac structure |
| 2371 | \param psessionEntry - session info |
| 2372 | \param pChnlParams - Channel switch params |
| 2373 | --------------------------------------------------------------------*/ |
| 2374 | void |
| 2375 | lim_send_sme_ap_channel_switch_resp(tpAniSirGlobal pMac, |
| 2376 | tpPESession psessionEntry, |
| 2377 | tpSwitchChannelParams pChnlParams) |
| 2378 | { |
| 2379 | tSirMsgQ mmhMsg; |
| 2380 | tpSwitchChannelParams pSmeSwithChnlParams; |
| 2381 | uint8_t channelId; |
| 2382 | |
| 2383 | pSmeSwithChnlParams = (tSwitchChannelParams *) |
| 2384 | cdf_mem_malloc(sizeof(tSwitchChannelParams)); |
| 2385 | if (NULL == pSmeSwithChnlParams) { |
| 2386 | lim_log(pMac, LOGP, |
| 2387 | FL("AllocateMemory failed for pSmeSwithChnlParams\n")); |
| 2388 | return; |
| 2389 | } |
| 2390 | |
| 2391 | cdf_mem_set((void *)pSmeSwithChnlParams, |
| 2392 | sizeof(tSwitchChannelParams), 0); |
| 2393 | |
| 2394 | cdf_mem_copy(pSmeSwithChnlParams, pChnlParams, |
| 2395 | sizeof(tSwitchChannelParams)); |
| 2396 | |
| 2397 | channelId = pSmeSwithChnlParams->channelNumber; |
| 2398 | |
| 2399 | /* |
| 2400 | * Pass the sme sessionID to SME instead |
| 2401 | * PE session ID. |
| 2402 | */ |
| 2403 | pSmeSwithChnlParams->peSessionId = psessionEntry->smeSessionId; |
| 2404 | |
| 2405 | mmhMsg.type = eWNI_SME_CHANNEL_CHANGE_RSP; |
| 2406 | mmhMsg.bodyptr = (void *)pSmeSwithChnlParams; |
| 2407 | mmhMsg.bodyval = 0; |
| 2408 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2409 | |
| 2410 | /* |
| 2411 | * We should start beacon transmission only if the new |
| 2412 | * channel after channel change is Non-DFS. For a DFS |
| 2413 | * channel, PE will receive an explicit request from |
| 2414 | * upper layers to start the beacon transmission . |
| 2415 | */ |
| 2416 | |
| 2417 | if (CHANNEL_STATE_DFS != cds_get_channel_state(channelId)) { |
| 2418 | if (channelId == psessionEntry->currentOperChannel) { |
| 2419 | lim_apply_configuration(pMac, psessionEntry); |
| 2420 | lim_send_beacon_ind(pMac, psessionEntry); |
| 2421 | } else { |
| 2422 | PELOG1(lim_log(pMac, LOG1, |
| 2423 | FL |
| 2424 | ("Failed to Transmit Beacons on channel = %d" |
| 2425 | "after AP channel change response"), |
| 2426 | psessionEntry->bcnLen); |
| 2427 | ) |
| 2428 | } |
| 2429 | } |
| 2430 | return; |
| 2431 | } |
| 2432 | |
| 2433 | /** ----------------------------------------------------------------- |
| 2434 | \brief lim_process_beacon_tx_success_ind() - This function is used |
| 2435 | explicitely to handle successful beacon transmission indication |
| 2436 | from the FW. This is a generic event generated by the FW afer the |
| 2437 | first beacon is sent out after the beacon template update by the |
| 2438 | host |
| 2439 | \param pMac - global mac structure |
| 2440 | \param psessionEntry - session info |
| 2441 | \return none |
| 2442 | \sa |
| 2443 | ----------------------------------------------------------------- */ |
| 2444 | void |
| 2445 | lim_process_beacon_tx_success_ind(tpAniSirGlobal pMac, uint16_t msgType, void *event) |
| 2446 | { |
| 2447 | /* Currently, this event is used only for DFS channel switch announcement |
| 2448 | * IE update in the template. If required to be used for other IE updates |
| 2449 | * add appropriate code by introducing a state variable |
| 2450 | */ |
| 2451 | tpPESession psessionEntry; |
| 2452 | tSirMsgQ mmhMsg; |
| 2453 | tSirSmeCSAIeTxCompleteRsp *pChanSwTxResponse; |
| 2454 | struct sir_beacon_tx_complete_rsp *beacon_tx_comp_rsp_ptr; |
| 2455 | uint8_t length = sizeof(tSirSmeCSAIeTxCompleteRsp); |
| 2456 | tpSirFirstBeaconTxCompleteInd pBcnTxInd = |
| 2457 | (tSirFirstBeaconTxCompleteInd *) event; |
| 2458 | |
| 2459 | psessionEntry = pe_find_session_by_bss_idx(pMac, pBcnTxInd->bssIdx); |
| 2460 | if (psessionEntry == NULL) { |
| 2461 | lim_log(pMac, LOGE, |
| 2462 | FL("Session Does not exist for given sessionID")); |
| 2463 | return; |
| 2464 | } |
| 2465 | |
| 2466 | if (LIM_IS_AP_ROLE(psessionEntry) && |
| 2467 | true == psessionEntry->dfsIncludeChanSwIe) { |
| 2468 | /* Send only 5 beacons with CSA IE Set in when a radar is detected */ |
| 2469 | if (psessionEntry->gLimChannelSwitch.switchCount > 0) { |
| 2470 | /* |
| 2471 | * Send the next beacon with updated CSA IE count |
| 2472 | */ |
| 2473 | lim_send_dfs_chan_sw_ie_update(pMac, psessionEntry); |
| 2474 | /* Decrement the IE count */ |
| 2475 | psessionEntry->gLimChannelSwitch.switchCount--; |
| 2476 | } else { |
| 2477 | /* Done with CSA IE update, send response back to SME */ |
| 2478 | psessionEntry->gLimChannelSwitch.switchCount = 0; |
| 2479 | if (pMac->sap.SapDfsInfo.disable_dfs_ch_switch == false) |
| 2480 | psessionEntry->gLimChannelSwitch.switchMode = 0; |
| 2481 | psessionEntry->dfsIncludeChanSwIe = false; |
| 2482 | psessionEntry->dfsIncludeChanWrapperIe = false; |
| 2483 | |
| 2484 | pChanSwTxResponse = (tSirSmeCSAIeTxCompleteRsp *) |
| 2485 | cdf_mem_malloc(length); |
| 2486 | |
| 2487 | if (NULL == pChanSwTxResponse) { |
| 2488 | lim_log(pMac, LOGP, |
| 2489 | FL |
| 2490 | ("AllocateMemory failed for tSirSmeCSAIeTxCompleteRsp")); |
| 2491 | return; |
| 2492 | } |
| 2493 | |
| 2494 | cdf_mem_set((void *)pChanSwTxResponse, length, 0); |
| 2495 | pChanSwTxResponse->sessionId = |
| 2496 | psessionEntry->smeSessionId; |
| 2497 | pChanSwTxResponse->chanSwIeTxStatus = |
| 2498 | CDF_STATUS_SUCCESS; |
| 2499 | |
| 2500 | mmhMsg.type = eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND; |
| 2501 | mmhMsg.bodyptr = pChanSwTxResponse; |
| 2502 | mmhMsg.bodyval = 0; |
| 2503 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2504 | } |
| 2505 | } |
| 2506 | |
| 2507 | if (LIM_IS_AP_ROLE(psessionEntry) && |
| 2508 | psessionEntry->gLimOperatingMode.present) { |
| 2509 | /* Done with nss update, send response back to SME */ |
| 2510 | psessionEntry->gLimOperatingMode.present = 0; |
| 2511 | beacon_tx_comp_rsp_ptr = (struct sir_beacon_tx_complete_rsp *) |
| 2512 | cdf_mem_malloc(sizeof(*beacon_tx_comp_rsp_ptr)); |
| 2513 | if (NULL == beacon_tx_comp_rsp_ptr) { |
| 2514 | lim_log(pMac, LOGP, |
| 2515 | FL |
| 2516 | ("AllocateMemory failed for beacon_tx_comp_rsp_ptr")); |
| 2517 | return; |
| 2518 | } |
| 2519 | cdf_mem_set((void *)beacon_tx_comp_rsp_ptr, |
| 2520 | sizeof(*beacon_tx_comp_rsp_ptr), 0); |
| 2521 | beacon_tx_comp_rsp_ptr->session_id = |
| 2522 | psessionEntry->smeSessionId; |
| 2523 | beacon_tx_comp_rsp_ptr->tx_status = CDF_STATUS_SUCCESS; |
| 2524 | mmhMsg.type = eWNI_SME_NSS_UPDATE_RSP; |
| 2525 | mmhMsg.bodyptr = beacon_tx_comp_rsp_ptr; |
| 2526 | mmhMsg.bodyval = 0; |
| 2527 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 2528 | } |
| 2529 | return; |
| 2530 | } |