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