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