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