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