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