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