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