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