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