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