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