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