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