Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Jingxiang Ge | 4168a23 | 2018-01-03 18:47:15 +0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | #include "cds_api.h" |
| 20 | #include "wni_cfg.h" |
| 21 | #include "ani_global.h" |
| 22 | #include "sir_api.h" |
| 23 | #include "sir_params.h" |
| 24 | #include "cfg_api.h" |
Arif Hussain | 43e0971 | 2018-09-18 19:31:57 -0700 | [diff] [blame] | 25 | #include "cfg_ucfg_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 26 | #include "sch_api.h" |
| 27 | #include "utils_api.h" |
| 28 | #include "lim_utils.h" |
| 29 | #include "lim_assoc_utils.h" |
| 30 | #include "lim_prop_exts_utils.h" |
| 31 | #include "lim_security_utils.h" |
| 32 | #include "lim_send_messages.h" |
| 33 | #include "lim_send_messages.h" |
| 34 | #include "lim_session_utils.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 35 | #include <lim_ft.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 36 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 37 | #include "host_diag_core_log.h" |
| 38 | #endif |
| 39 | #include "wma_if.h" |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 40 | #include "wlan_reg_services_api.h" |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 41 | #include "lim_process_fils.h" |
Pragaspathi Thilagaraj | 48d273c | 2018-08-31 00:53:02 +0530 | [diff] [blame] | 42 | #include "wlan_mlme_public_struct.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 43 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 44 | static void lim_process_mlm_auth_req(struct mac_context *, uint32_t *); |
| 45 | static void lim_process_mlm_assoc_req(struct mac_context *, uint32_t *); |
| 46 | static void lim_process_mlm_disassoc_req(struct mac_context *, uint32_t *); |
| 47 | static void lim_process_mlm_set_keys_req(struct mac_context *, uint32_t *); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | |
| 49 | /* MLM Timeout event handler templates */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 50 | static void lim_process_auth_rsp_timeout(struct mac_context *, uint32_t); |
| 51 | static void lim_process_periodic_join_probe_req_timer(struct mac_context *); |
| 52 | static void lim_process_auth_retry_timer(struct mac_context *); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 53 | |
| 54 | /** |
Padma, Santhosh Kumar | c56735f | 2017-09-13 18:14:26 +0530 | [diff] [blame] | 55 | * lim_process_sae_auth_timeout() - This function is called to process sae |
| 56 | * auth timeout |
| 57 | * @mac_ctx: Pointer to Global MAC structure |
| 58 | * |
| 59 | * @Return: None |
| 60 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 61 | static void lim_process_sae_auth_timeout(struct mac_context *mac_ctx) |
Padma, Santhosh Kumar | c56735f | 2017-09-13 18:14:26 +0530 | [diff] [blame] | 62 | { |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 63 | struct pe_session *session; |
Padma, Santhosh Kumar | c56735f | 2017-09-13 18:14:26 +0530 | [diff] [blame] | 64 | |
| 65 | session = pe_find_session_by_session_id(mac_ctx, |
| 66 | mac_ctx->lim.limTimers.sae_auth_timer.sessionId); |
| 67 | if (session == NULL) { |
| 68 | pe_err("Session does not exist for given session id"); |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | pe_warn("SAE auth timeout sessionid %d mlmstate %X SmeState %X", |
| 73 | session->peSessionId, session->limMlmState, |
| 74 | session->limSmeState); |
| 75 | |
| 76 | switch (session->limMlmState) { |
| 77 | case eLIM_MLM_WT_SAE_AUTH_STATE: |
| 78 | /* |
| 79 | * SAE authentication is not completed. Restore from |
| 80 | * auth state. |
| 81 | */ |
| 82 | if (session->pePersona == QDF_STA_MODE) |
| 83 | lim_restore_from_auth_state(mac_ctx, |
| 84 | eSIR_SME_AUTH_TIMEOUT_RESULT_CODE, |
| 85 | eSIR_MAC_UNSPEC_FAILURE_REASON, session); |
| 86 | break; |
| 87 | default: |
| 88 | /* SAE authentication is timed out in unexpected state */ |
| 89 | pe_err("received unexpected SAE auth timeout in state %X", |
| 90 | session->limMlmState); |
| 91 | lim_print_mlm_state(mac_ctx, LOGE, session->limMlmState); |
| 92 | break; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 97 | * lim_process_mlm_req_messages() - process mlm request messages |
| 98 | * @mac_ctx: global MAC context |
| 99 | * @msg: mlm request message |
| 100 | * |
| 101 | * This function is called by lim_post_mlm_message(). This |
| 102 | * function handles MLM primitives invoked by SME. |
| 103 | * Depending on the message type, corresponding function will be |
| 104 | * called. |
| 105 | * ASSUMPTIONS: |
| 106 | * 1. Upon receiving Beacon in WT_JOIN_STATE, MLM module invokes |
| 107 | * APIs exposed by Beacon Processing module for setting parameters |
| 108 | * at MAC hardware. |
| 109 | * 2. If attempt to Reassociate with an AP fails, link with current |
| 110 | * AP is restored back. |
| 111 | * |
| 112 | * Return: None |
| 113 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 114 | void lim_process_mlm_req_messages(struct mac_context *mac_ctx, |
Rajeev Kumar | feb9638 | 2017-01-22 19:42:09 -0800 | [diff] [blame] | 115 | struct scheduler_msg *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 116 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 117 | switch (msg->type) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 118 | case LIM_MLM_AUTH_REQ: |
| 119 | lim_process_mlm_auth_req(mac_ctx, msg->bodyptr); |
| 120 | break; |
| 121 | case LIM_MLM_ASSOC_REQ: |
| 122 | lim_process_mlm_assoc_req(mac_ctx, msg->bodyptr); |
| 123 | break; |
| 124 | case LIM_MLM_REASSOC_REQ: |
| 125 | lim_process_mlm_reassoc_req(mac_ctx, msg->bodyptr); |
| 126 | break; |
| 127 | case LIM_MLM_DISASSOC_REQ: |
| 128 | lim_process_mlm_disassoc_req(mac_ctx, msg->bodyptr); |
| 129 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 130 | case LIM_MLM_SETKEYS_REQ: |
| 131 | lim_process_mlm_set_keys_req(mac_ctx, msg->bodyptr); |
| 132 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 133 | case SIR_LIM_JOIN_FAIL_TIMEOUT: |
| 134 | lim_process_join_failure_timeout(mac_ctx); |
| 135 | break; |
| 136 | case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT: |
| 137 | lim_process_periodic_join_probe_req_timer(mac_ctx); |
| 138 | break; |
| 139 | case SIR_LIM_AUTH_FAIL_TIMEOUT: |
| 140 | lim_process_auth_failure_timeout(mac_ctx); |
| 141 | break; |
| 142 | case SIR_LIM_AUTH_RSP_TIMEOUT: |
| 143 | lim_process_auth_rsp_timeout(mac_ctx, msg->bodyval); |
| 144 | break; |
| 145 | case SIR_LIM_ASSOC_FAIL_TIMEOUT: |
| 146 | lim_process_assoc_failure_timeout(mac_ctx, msg->bodyval); |
| 147 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 148 | case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT: |
| 149 | lim_process_ft_preauth_rsp_timeout(mac_ctx); |
| 150 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 151 | case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE: |
| 152 | lim_convert_active_channel_to_passive_channel(mac_ctx); |
| 153 | break; |
| 154 | case SIR_LIM_DISASSOC_ACK_TIMEOUT: |
| 155 | lim_process_disassoc_ack_timeout(mac_ctx); |
| 156 | break; |
| 157 | case SIR_LIM_DEAUTH_ACK_TIMEOUT: |
| 158 | lim_process_deauth_ack_timeout(mac_ctx); |
| 159 | break; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 160 | case SIR_LIM_AUTH_RETRY_TIMEOUT: |
| 161 | lim_process_auth_retry_timer(mac_ctx); |
| 162 | break; |
Padma, Santhosh Kumar | c56735f | 2017-09-13 18:14:26 +0530 | [diff] [blame] | 163 | case SIR_LIM_AUTH_SAE_TIMEOUT: |
| 164 | lim_process_sae_auth_timeout(mac_ctx); |
| 165 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 166 | case LIM_MLM_TSPEC_REQ: |
| 167 | default: |
| 168 | break; |
| 169 | } /* switch (msg->type) */ |
| 170 | } |
| 171 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 172 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 173 | * lim_covert_channel_scan_type() - switch between ACTIVE and PASSIVE scan type |
| 174 | * @mac_ctx: global MAC context |
| 175 | * @chan_num: channel number to change the scan type |
| 176 | * @passive_to_active: flag to indicate if switch allowed |
| 177 | * |
| 178 | * This function is called to get the list, |
| 179 | * change the channel type and set again. |
| 180 | * NOTE: If a channel is ACTIVE, this function will make it as PASSIVE |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 181 | * If a channel is PASSIVE, this function will make it as ACTIVE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 182 | * |
| 183 | * Return: None |
| 184 | */ |
| 185 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 186 | void lim_covert_channel_scan_type(struct mac_context *mac_ctx, uint8_t chan_num, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 187 | bool passive_to_active) |
| 188 | { |
| 189 | |
| 190 | uint32_t i; |
| 191 | uint8_t chan_pair[WNI_CFG_SCAN_CONTROL_LIST_LEN]; |
| 192 | uint32_t len = WNI_CFG_SCAN_CONTROL_LIST_LEN; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 193 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 194 | |
| 195 | status = wlan_cfg_get_str(mac_ctx, WNI_CFG_SCAN_CONTROL_LIST, |
| 196 | chan_pair, &len); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 197 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 198 | pe_err("Unable to get scan control list"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 199 | return; |
| 200 | } |
| 201 | if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 202 | pe_err("Invalid scan control list length: %d", len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 203 | return; |
| 204 | } |
| 205 | for (i = 0; (i + 1) < len; i += 2) { |
| 206 | if (chan_pair[i] != chan_num) /* skip this channel */ |
| 207 | continue; |
| 208 | if ((eSIR_PASSIVE_SCAN == chan_pair[i + 1]) && |
| 209 | true == passive_to_active) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 210 | pe_debug("Channel %d changed from Passive to Active", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 211 | chan_num); |
| 212 | chan_pair[i + 1] = eSIR_ACTIVE_SCAN; |
| 213 | break; |
| 214 | } |
| 215 | if ((eSIR_ACTIVE_SCAN == chan_pair[i + 1]) && |
| 216 | false == passive_to_active) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 217 | pe_debug("Channel %d changed from Active to Passive", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 218 | chan_num); |
| 219 | chan_pair[i + 1] = eSIR_PASSIVE_SCAN; |
| 220 | break; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | cfg_set_str_notify(mac_ctx, WNI_CFG_SCAN_CONTROL_LIST, |
| 225 | (uint8_t *) chan_pair, len, false); |
| 226 | return; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * lim_set_dfs_channel_list() - convert dfs channel list to active channel list |
| 231 | * @mac_ctx: global MAC context. |
| 232 | * @chan_num: channel number |
| 233 | * @dfs_ch_list: list of DFS channels |
| 234 | * |
| 235 | * This function is called to convert DFS channel list to active channel list |
| 236 | * when any beacon is present on that channel. This function store time for |
| 237 | * passive channels which help to know that for how much time channel has been |
| 238 | * passive. |
| 239 | * |
| 240 | * NOTE: If a channel is ACTIVE, it won't store any time |
| 241 | * If a channel is PAssive, it will store time as timestamp |
| 242 | * |
| 243 | * Return: None |
| 244 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 245 | void lim_set_dfs_channel_list(struct mac_context *mac_ctx, uint8_t chan_num, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 246 | tSirDFSChannelList *dfs_ch_list) |
| 247 | { |
| 248 | bool pass_to_active = true; |
| 249 | |
| 250 | if (!((1 <= chan_num) && (165 >= chan_num))) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 251 | pe_err("Invalid Channel: %d", chan_num); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 252 | return; |
| 253 | } |
| 254 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 255 | if (lim_isconnected_on_dfs_channel(mac_ctx, chan_num)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 256 | if (dfs_ch_list->timeStamp[chan_num] == 0) { |
| 257 | /* |
| 258 | * Received first beacon; |
| 259 | * Convert DFS channel to Active channel. |
| 260 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 261 | pe_debug("Received first beacon on DFS channel: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 262 | chan_num); |
| 263 | lim_covert_channel_scan_type(mac_ctx, chan_num, |
| 264 | pass_to_active); |
| 265 | } |
| 266 | dfs_ch_list->timeStamp[chan_num] = |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 267 | qdf_mc_timer_get_system_time(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 268 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 269 | return; |
| 270 | } |
| 271 | |
| 272 | if (!tx_timer_running |
| 273 | (&mac_ctx->lim.limTimers.gLimActiveToPassiveChannelTimer)) { |
| 274 | tx_timer_activate( |
| 275 | &mac_ctx->lim.limTimers.gLimActiveToPassiveChannelTimer); |
| 276 | } |
| 277 | |
| 278 | return; |
| 279 | } |
| 280 | |
| 281 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 282 | * mlm_add_sta() - MLM add sta |
| 283 | * @mac_ctx: global MAC context |
| 284 | * @sta_param: Add sta params |
| 285 | * @bssid: BSSID |
| 286 | * @ht_capable: HT capability |
| 287 | * @session_entry: PE session entry |
| 288 | * |
| 289 | * This function is called to update station parameters |
| 290 | * |
| 291 | * Return: None |
| 292 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 293 | static void mlm_add_sta(struct mac_context *mac_ctx, tpAddStaParams sta_param, |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 294 | uint8_t *bssid, uint8_t ht_capable, struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 295 | { |
| 296 | uint32_t val; |
| 297 | uint32_t self_dot11mode = 0; |
| 298 | |
| 299 | wlan_cfg_get_int(mac_ctx, WNI_CFG_DOT11_MODE, &self_dot11mode); |
| 300 | sta_param->staType = STA_ENTRY_SELF; /* Identifying self */ |
| 301 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 302 | qdf_mem_copy(sta_param->bssId, bssid, sizeof(tSirMacAddr)); |
| 303 | qdf_mem_copy(sta_param->staMac, session_entry->selfMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 304 | sizeof(tSirMacAddr)); |
| 305 | |
| 306 | /* Configuration related parameters to be changed to support BT-AMP */ |
| 307 | |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 308 | val = mac_ctx->mlme_cfg->sap_cfg.listen_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 309 | sta_param->listenInterval = (uint16_t) val; |
| 310 | |
Vignesh Viswanathan | ddc89e5 | 2018-11-02 18:43:42 +0530 | [diff] [blame] | 311 | sta_param->shortPreambleSupported = |
| 312 | mac_ctx->mlme_cfg->ht_caps.short_preamble; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | |
| 314 | sta_param->assocId = 0; /* Is SMAC OK with this? */ |
| 315 | sta_param->wmmEnabled = 0; |
| 316 | sta_param->uAPSD = 0; |
| 317 | sta_param->maxSPLen = 0; |
| 318 | sta_param->us32MaxAmpduDuration = 0; |
| 319 | sta_param->maxAmpduSize = 0; /* 0: 8k, 1: 16k,2: 32k,3: 64k, 4:128k */ |
| 320 | |
| 321 | /* For Self STA get the LDPC capability from config.ini */ |
| 322 | sta_param->htLdpcCapable = |
| 323 | (session_entry->txLdpcIniFeatureEnabled & 0x01); |
| 324 | sta_param->vhtLdpcCapable = |
| 325 | ((session_entry->txLdpcIniFeatureEnabled >> 1) & 0x01); |
| 326 | |
| 327 | if (IS_DOT11_MODE_HT(session_entry->dot11mode)) { |
| 328 | sta_param->htCapable = ht_capable; |
| 329 | sta_param->greenFieldCapable = |
| 330 | lim_get_ht_capability(mac_ctx, eHT_GREENFIELD, |
| 331 | session_entry); |
| 332 | sta_param->ch_width = |
| 333 | lim_get_ht_capability(mac_ctx, |
| 334 | eHT_SUPPORTED_CHANNEL_WIDTH_SET, session_entry); |
| 335 | sta_param->mimoPS = |
| 336 | (tSirMacHTMIMOPowerSaveState)lim_get_ht_capability( |
| 337 | mac_ctx, eHT_MIMO_POWER_SAVE, session_entry); |
| 338 | sta_param->rifsMode = |
| 339 | lim_get_ht_capability(mac_ctx, eHT_RIFS_MODE, |
| 340 | session_entry); |
| 341 | sta_param->lsigTxopProtection = |
| 342 | lim_get_ht_capability(mac_ctx, eHT_LSIG_TXOP_PROTECTION, |
| 343 | session_entry); |
| 344 | sta_param->maxAmpduDensity = |
| 345 | lim_get_ht_capability(mac_ctx, eHT_MPDU_DENSITY, |
| 346 | session_entry); |
| 347 | sta_param->maxAmsduSize = |
| 348 | lim_get_ht_capability(mac_ctx, eHT_MAX_AMSDU_LENGTH, |
| 349 | session_entry); |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 350 | sta_param->max_amsdu_num = |
| 351 | lim_get_ht_capability(mac_ctx, eHT_MAX_AMSDU_NUM, |
| 352 | session_entry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 353 | sta_param->fDsssCckMode40Mhz = |
| 354 | lim_get_ht_capability(mac_ctx, eHT_DSSS_CCK_MODE_40MHZ, |
| 355 | session_entry); |
| 356 | sta_param->fShortGI20Mhz = |
| 357 | lim_get_ht_capability(mac_ctx, eHT_SHORT_GI_20MHZ, |
| 358 | session_entry); |
| 359 | sta_param->fShortGI40Mhz = |
| 360 | lim_get_ht_capability(mac_ctx, eHT_SHORT_GI_40MHZ, |
| 361 | session_entry); |
| 362 | } |
| 363 | if (session_entry->vhtCapability) { |
| 364 | sta_param->vhtCapable = true; |
| 365 | sta_param->vhtTxBFCapable = |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 366 | session_entry->vht_config.su_beam_formee; |
| 367 | sta_param->vhtTxMUBformeeCapable = |
| 368 | session_entry->vht_config.mu_beam_formee; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 369 | sta_param->enable_su_tx_bformer = |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 370 | session_entry->vht_config.su_beam_former; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 371 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 372 | |
| 373 | if (lim_is_session_he_capable(session_entry)) |
| 374 | lim_add_self_he_cap(sta_param, session_entry); |
| 375 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 376 | /* |
| 377 | * Since this is Self-STA, need to populate Self MAX_AMPDU_SIZE |
| 378 | * capabilities |
| 379 | */ |
| 380 | if (IS_DOT11_MODE_VHT(self_dot11mode)) { |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 381 | sta_param->maxAmpduSize = |
| 382 | mac_ctx->mlme_cfg->vht_caps.vht_cap_info.ampdu_len_exponent; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 383 | } |
| 384 | sta_param->enableVhtpAid = session_entry->enableVhtpAid; |
| 385 | sta_param->enableAmpduPs = session_entry->enableAmpduPs; |
| 386 | sta_param->enableHtSmps = session_entry->enableHtSmps; |
| 387 | sta_param->htSmpsconfig = session_entry->htSmpsvalue; |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 388 | sta_param->send_smps_action = session_entry->send_smps_action; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 389 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 390 | lim_populate_own_rate_set(mac_ctx, &sta_param->supportedRates, NULL, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 391 | false, session_entry, NULL, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 392 | |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 393 | pe_debug("GF: %d, ChnlWidth: %d, MimoPS: %d, lsigTXOP: %d, dsssCCK: %d," |
| 394 | " SGI20: %d, SGI40%d", sta_param->greenFieldCapable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 395 | sta_param->ch_width, sta_param->mimoPS, |
| 396 | sta_param->lsigTxopProtection, sta_param->fDsssCckMode40Mhz, |
| 397 | sta_param->fShortGI20Mhz, sta_param->fShortGI40Mhz); |
| 398 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 399 | if (QDF_P2P_GO_MODE == session_entry->pePersona) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 400 | sta_param->p2pCapableSta = 1; |
| 401 | } |
| 402 | |
| 403 | /** |
| 404 | * lim_mlm_add_bss() - HAL interface for WMA_ADD_BSS_REQ |
| 405 | * @mac_ctx: global MAC context |
| 406 | * @mlm_start_req: MLM start request |
| 407 | * @session: PE session entry |
| 408 | * |
| 409 | * Package WMA_ADD_BSS_REQ to HAL, in order to start a BSS |
| 410 | * |
| 411 | * Return: eSIR_SME_SUCCESS on success, other error codes otherwise |
| 412 | */ |
| 413 | tSirResultCodes |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 414 | lim_mlm_add_bss(struct mac_context *mac_ctx, |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 415 | tLimMlmStartReq *mlm_start_req, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 416 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 417 | struct scheduler_msg msg_buf = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 418 | tpAddBssParams addbss_param = NULL; |
Pragaspathi Thilagaraj | 48d273c | 2018-08-31 00:53:02 +0530 | [diff] [blame] | 419 | struct wlan_mlme_qos *qos_aggr = &mac_ctx->mlme_cfg->qos_mlme_params; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 420 | uint32_t retcode; |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 421 | bool is_ch_dfs = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 422 | |
| 423 | /* Package WMA_ADD_BSS_REQ message parameters */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 424 | addbss_param = qdf_mem_malloc(sizeof(tAddBssParams)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 425 | if (!addbss_param) |
Srinivas Girigowda | d3b31e2 | 2017-06-28 00:15:10 -0700 | [diff] [blame] | 426 | return eSIR_SME_RESOURCES_UNAVAILABLE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 427 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 428 | /* Fill in tAddBssParams members */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 429 | qdf_mem_copy(addbss_param->bssId, mlm_start_req->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 430 | sizeof(tSirMacAddr)); |
| 431 | |
| 432 | /* Fill in tAddBssParams selfMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 433 | qdf_mem_copy(addbss_param->selfMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 434 | session->selfMacAddr, sizeof(tSirMacAddr)); |
| 435 | |
| 436 | addbss_param->bssType = mlm_start_req->bssType; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 437 | if (mlm_start_req->bssType == eSIR_IBSS_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 438 | addbss_param->operMode = BSS_OPERATIONAL_MODE_STA; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 439 | else if (mlm_start_req->bssType == eSIR_INFRA_AP_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 440 | addbss_param->operMode = BSS_OPERATIONAL_MODE_AP; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 441 | else if (mlm_start_req->bssType == eSIR_NDI_MODE) |
| 442 | addbss_param->operMode = BSS_OPERATIONAL_MODE_NDI; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 443 | |
| 444 | addbss_param->shortSlotTimeSupported = session->shortSlotTimeSupported; |
| 445 | addbss_param->beaconInterval = mlm_start_req->beaconPeriod; |
| 446 | addbss_param->dtimPeriod = mlm_start_req->dtimPeriod; |
| 447 | addbss_param->wps_state = mlm_start_req->wps_state; |
| 448 | addbss_param->cfParamSet.cfpCount = mlm_start_req->cfParamSet.cfpCount; |
| 449 | addbss_param->cfParamSet.cfpPeriod = |
| 450 | mlm_start_req->cfParamSet.cfpPeriod; |
| 451 | addbss_param->cfParamSet.cfpMaxDuration = |
| 452 | mlm_start_req->cfParamSet.cfpMaxDuration; |
| 453 | addbss_param->cfParamSet.cfpDurRemaining = |
| 454 | mlm_start_req->cfParamSet.cfpDurRemaining; |
| 455 | |
| 456 | addbss_param->rateSet.numRates = mlm_start_req->rateSet.numRates; |
Arif Hussain | cb31292 | 2018-05-01 14:41:15 -0700 | [diff] [blame] | 457 | if (addbss_param->rateSet.numRates > SIR_MAC_RATESET_EID_MAX) { |
| 458 | pe_warn("num of sup rates %d exceeding the limit %d, resetting", |
| 459 | addbss_param->rateSet.numRates, |
| 460 | SIR_MAC_RATESET_EID_MAX); |
| 461 | addbss_param->rateSet.numRates = SIR_MAC_RATESET_EID_MAX; |
| 462 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 463 | qdf_mem_copy(addbss_param->rateSet.rate, mlm_start_req->rateSet.rate, |
Tushnim Bhattacharyya | 6deb27f | 2018-06-05 13:19:06 -0700 | [diff] [blame] | 464 | addbss_param->rateSet.numRates); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 465 | |
| 466 | addbss_param->nwType = mlm_start_req->nwType; |
| 467 | addbss_param->htCapable = mlm_start_req->htCapable; |
| 468 | addbss_param->vhtCapable = session->vhtCapability; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 469 | if (lim_is_session_he_capable(session)) { |
| 470 | lim_update_bss_he_capable(mac_ctx, addbss_param); |
| 471 | lim_decide_he_op(mac_ctx, addbss_param, session); |
| 472 | lim_update_usr_he_cap(mac_ctx, session); |
| 473 | } |
| 474 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 475 | addbss_param->ch_width = session->ch_width; |
| 476 | addbss_param->ch_center_freq_seg0 = |
| 477 | session->ch_center_freq_seg0; |
| 478 | addbss_param->ch_center_freq_seg1 = |
| 479 | session->ch_center_freq_seg1; |
| 480 | addbss_param->htOperMode = mlm_start_req->htOperMode; |
| 481 | addbss_param->dualCTSProtection = mlm_start_req->dualCTSProtection; |
| 482 | addbss_param->txChannelWidthSet = mlm_start_req->txChannelWidthSet; |
| 483 | |
| 484 | addbss_param->currentOperChannel = mlm_start_req->channelNumber; |
| 485 | #ifdef WLAN_FEATURE_11W |
| 486 | addbss_param->rmfEnabled = session->limRmfEnabled; |
| 487 | #endif |
| 488 | |
| 489 | /* Update PE sessionId */ |
| 490 | addbss_param->sessionId = mlm_start_req->sessionId; |
| 491 | |
| 492 | /* Send the SSID to HAL to enable SSID matching for IBSS */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 493 | addbss_param->ssId.length = mlm_start_req->ssId.length; |
Arif Hussain | cb31292 | 2018-05-01 14:41:15 -0700 | [diff] [blame] | 494 | if (addbss_param->ssId.length > SIR_MAC_MAX_SSID_LENGTH) { |
| 495 | pe_err("Invalid ssid length %d, max length allowed %d", |
| 496 | addbss_param->ssId.length, |
| 497 | SIR_MAC_MAX_SSID_LENGTH); |
| 498 | qdf_mem_free(addbss_param); |
| 499 | return eSIR_SME_INVALID_PARAMETERS; |
| 500 | } |
| 501 | qdf_mem_copy(addbss_param->ssId.ssId, |
| 502 | mlm_start_req->ssId.ssId, addbss_param->ssId.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 503 | addbss_param->bHiddenSSIDEn = mlm_start_req->ssidHidden; |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 504 | pe_debug("TRYING TO HIDE SSID %d", addbss_param->bHiddenSSIDEn); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 505 | /* CR309183. Disable Proxy Probe Rsp. Host handles Probe Requests. Until FW fixed. */ |
| 506 | addbss_param->bProxyProbeRespEn = 0; |
| 507 | addbss_param->obssProtEnabled = mlm_start_req->obssProtEnabled; |
| 508 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 509 | addbss_param->maxTxPower = session->maxTxPower; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 510 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 511 | mlm_add_sta(mac_ctx, &addbss_param->staContext, |
| 512 | addbss_param->bssId, addbss_param->htCapable, |
| 513 | session); |
| 514 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 515 | addbss_param->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 516 | addbss_param->respReqd = 1; |
| 517 | |
| 518 | /* Set a new state for MLME */ |
| 519 | session->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_STATE; |
| 520 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, session->peSessionId, |
| 521 | session->limMlmState)); |
| 522 | |
| 523 | /* pass on the session persona to hal */ |
| 524 | addbss_param->halPersona = session->pePersona; |
| 525 | |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 526 | if (session->ch_width == CH_WIDTH_160MHZ) { |
| 527 | is_ch_dfs = true; |
| 528 | } else if (session->ch_width == CH_WIDTH_80P80MHZ) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 529 | if (wlan_reg_get_channel_state(mac_ctx->pdev, |
| 530 | mlm_start_req->channelNumber) == |
| 531 | CHANNEL_STATE_DFS || |
| 532 | wlan_reg_get_channel_state(mac_ctx->pdev, |
| 533 | session->ch_center_freq_seg1 - |
| 534 | SIR_80MHZ_START_CENTER_CH_DIFF) == |
| 535 | CHANNEL_STATE_DFS) |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 536 | is_ch_dfs = true; |
| 537 | } else { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 538 | if (wlan_reg_get_channel_state(mac_ctx->pdev, |
| 539 | mlm_start_req->channelNumber) == |
| 540 | CHANNEL_STATE_DFS) |
Sandeep Puligilla | 2111d3c | 2016-02-03 01:46:15 -0800 | [diff] [blame] | 541 | is_ch_dfs = true; |
| 542 | } |
| 543 | |
| 544 | addbss_param->bSpectrumMgtEnabled = |
| 545 | session->spectrumMgtEnabled || is_ch_dfs; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 546 | addbss_param->extSetStaKeyParamValid = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 547 | |
| 548 | addbss_param->dot11_mode = session->dot11mode; |
| 549 | addbss_param->nss = session->nss; |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 550 | addbss_param->cac_duration_ms = mlm_start_req->cac_duration_ms; |
| 551 | addbss_param->dfs_regdomain = mlm_start_req->dfs_regdomain; |
Jiachao Wu | 712d4fd | 2017-08-23 16:52:34 +0800 | [diff] [blame] | 552 | addbss_param->beacon_tx_rate = session->beacon_tx_rate; |
Kiran Kumar Lokere | 6a7d1eb | 2016-05-02 18:31:35 -0700 | [diff] [blame] | 553 | if (QDF_IBSS_MODE == addbss_param->halPersona) { |
Pragaspathi Thilagaraj | 48d273c | 2018-08-31 00:53:02 +0530 | [diff] [blame] | 554 | if (!(mac_ctx->mlme_cfg)) { |
| 555 | pe_err("Mlme cfg NULL"); |
| 556 | return eSIR_SME_INVALID_PARAMETERS; |
| 557 | } |
Kiran Kumar Lokere | 6a7d1eb | 2016-05-02 18:31:35 -0700 | [diff] [blame] | 558 | addbss_param->nss_2g = mac_ctx->vdev_type_nss_2g.ibss; |
| 559 | addbss_param->nss_5g = mac_ctx->vdev_type_nss_5g.ibss; |
Padma, Santhosh Kumar | a711967 | 2016-08-16 16:05:14 +0530 | [diff] [blame] | 560 | addbss_param->tx_aggregation_size = |
Pragaspathi Thilagaraj | 48d273c | 2018-08-31 00:53:02 +0530 | [diff] [blame] | 561 | qos_aggr->tx_aggregation_size; |
Paul Zhang | ee09f8e | 2018-04-23 16:11:32 +0800 | [diff] [blame] | 562 | addbss_param->tx_aggregation_size_be = |
Pragaspathi Thilagaraj | 48d273c | 2018-08-31 00:53:02 +0530 | [diff] [blame] | 563 | qos_aggr->tx_aggregation_size_be; |
Paul Zhang | ee09f8e | 2018-04-23 16:11:32 +0800 | [diff] [blame] | 564 | addbss_param->tx_aggregation_size_bk = |
Pragaspathi Thilagaraj | 48d273c | 2018-08-31 00:53:02 +0530 | [diff] [blame] | 565 | qos_aggr->tx_aggregation_size_bk; |
Paul Zhang | ee09f8e | 2018-04-23 16:11:32 +0800 | [diff] [blame] | 566 | addbss_param->tx_aggregation_size_vi = |
Pragaspathi Thilagaraj | 48d273c | 2018-08-31 00:53:02 +0530 | [diff] [blame] | 567 | qos_aggr->tx_aggregation_size_vi; |
Paul Zhang | ee09f8e | 2018-04-23 16:11:32 +0800 | [diff] [blame] | 568 | addbss_param->tx_aggregation_size_vo = |
Pragaspathi Thilagaraj | 48d273c | 2018-08-31 00:53:02 +0530 | [diff] [blame] | 569 | qos_aggr->tx_aggregation_size_vo; |
Padma, Santhosh Kumar | a711967 | 2016-08-16 16:05:14 +0530 | [diff] [blame] | 570 | addbss_param->rx_aggregation_size = |
Pragaspathi Thilagaraj | 48d273c | 2018-08-31 00:53:02 +0530 | [diff] [blame] | 571 | qos_aggr->rx_aggregation_size; |
Kiran Kumar Lokere | 6a7d1eb | 2016-05-02 18:31:35 -0700 | [diff] [blame] | 572 | } |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 573 | pe_debug("dot11_mode:%d nss value:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 574 | addbss_param->dot11_mode, addbss_param->nss); |
| 575 | |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 576 | if (cds_is_5_mhz_enabled()) { |
| 577 | addbss_param->ch_width = CH_WIDTH_5MHZ; |
| 578 | addbss_param->staContext.ch_width = CH_WIDTH_5MHZ; |
| 579 | } else if (cds_is_10_mhz_enabled()) { |
| 580 | addbss_param->ch_width = CH_WIDTH_10MHZ; |
| 581 | addbss_param->staContext.ch_width = CH_WIDTH_10MHZ; |
| 582 | } |
| 583 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 584 | msg_buf.type = WMA_ADD_BSS_REQ; |
| 585 | msg_buf.reserved = 0; |
| 586 | msg_buf.bodyptr = addbss_param; |
| 587 | msg_buf.bodyval = 0; |
| 588 | MTRACE(mac_trace_msg_tx(mac_ctx, session->peSessionId, msg_buf.type)); |
| 589 | |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 590 | pe_debug("Sending WMA_ADD_BSS_REQ..."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 591 | retcode = wma_post_ctrl_msg(mac_ctx, &msg_buf); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 592 | if (QDF_STATUS_SUCCESS != retcode) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 593 | pe_err("Posting ADD_BSS_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 594 | retcode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 595 | qdf_mem_free(addbss_param); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 596 | return eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 597 | } |
| 598 | |
| 599 | return eSIR_SME_SUCCESS; |
| 600 | } |
| 601 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 602 | void lim_process_mlm_start_req(struct mac_context *mac_ctx, |
Abhishek Singh | dfa69c3 | 2018-08-30 15:39:34 +0530 | [diff] [blame] | 603 | tLimMlmStartReq *mlm_start_req) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 604 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 605 | tLimMlmStartCnf mlm_start_cnf; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 606 | struct pe_session *session = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 607 | |
Abhishek Singh | dfa69c3 | 2018-08-30 15:39:34 +0530 | [diff] [blame] | 608 | if (!mlm_start_req) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 609 | pe_err("Buffer is Pointing to NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 610 | return; |
| 611 | } |
| 612 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 613 | session = pe_find_session_by_session_id(mac_ctx, |
| 614 | mlm_start_req->sessionId); |
| 615 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 616 | pe_err("Session Does not exist for given sessionID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 617 | mlm_start_cnf.resultCode = eSIR_SME_REFUSED; |
| 618 | goto end; |
| 619 | } |
| 620 | |
| 621 | if (session->limMlmState != eLIM_MLM_IDLE_STATE) { |
| 622 | /* |
| 623 | * Should not have received Start req in states other than idle. |
| 624 | * Return Start confirm with failure code. |
| 625 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 626 | pe_err("received unexpected MLM_START_REQ in state %X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 627 | session->limMlmState); |
| 628 | lim_print_mlm_state(mac_ctx, LOGE, session->limMlmState); |
| 629 | mlm_start_cnf.resultCode = |
| 630 | eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; |
| 631 | goto end; |
| 632 | } |
| 633 | |
| 634 | mlm_start_cnf.resultCode = |
| 635 | lim_mlm_add_bss(mac_ctx, mlm_start_req, session); |
| 636 | |
| 637 | end: |
| 638 | /* Update PE session Id */ |
| 639 | mlm_start_cnf.sessionId = mlm_start_req->sessionId; |
| 640 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 641 | /* |
| 642 | * Respond immediately to LIM, only if MLME has not been |
| 643 | * successfully able to send WMA_ADD_BSS_REQ to HAL. |
| 644 | * Else, LIM_MLM_START_CNF will be sent after receiving |
| 645 | * WMA_ADD_BSS_RSP from HAL |
| 646 | */ |
| 647 | if (eSIR_SME_SUCCESS != mlm_start_cnf.resultCode) |
Abhishek Singh | 1df5088 | 2018-08-30 18:04:29 +0530 | [diff] [blame] | 648 | lim_send_start_bss_confirm(mac_ctx, &mlm_start_cnf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 649 | } |
| 650 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 651 | /** |
| 652 | * lim_post_join_set_link_state_callback()- registered callback to perform post |
| 653 | * peer creation operations |
| 654 | * |
| 655 | * @mac: pointer to global mac structure |
| 656 | * @callback_arg: registered callback argument |
| 657 | * @status: peer creation status |
| 658 | * |
| 659 | * this is registered callback function during association to perform |
| 660 | * post peer creation operation based on the peer creation status |
| 661 | * |
| 662 | * Return: none |
| 663 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 664 | static void lim_post_join_set_link_state_callback(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 665 | void *callback_arg, bool status) |
| 666 | { |
| 667 | uint8_t chan_num, sec_chan_offset; |
Pragaspathi Thilagaraj | 210362a | 2018-07-31 19:08:19 +0530 | [diff] [blame] | 668 | struct session_params *session_cb_param = |
| 669 | (struct session_params *)callback_arg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 670 | tLimMlmJoinCnf mlm_join_cnf; |
| 671 | |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 672 | struct pe_session *session_entry = pe_find_session_by_session_id(mac, |
Pragaspathi Thilagaraj | 210362a | 2018-07-31 19:08:19 +0530 | [diff] [blame] | 673 | session_cb_param->session_id); |
| 674 | if (!session_entry) { |
| 675 | pe_err("sessionId:%d does not exist", |
| 676 | session_cb_param->session_id); |
| 677 | qdf_mem_free(session_cb_param); |
| 678 | return; |
| 679 | } |
| 680 | |
| 681 | qdf_mem_free(session_cb_param); |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 682 | pe_debug("Sessionid %d set link state(%d) cb status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 683 | session_entry->peSessionId, session_entry->limMlmState, |
| 684 | status); |
| 685 | |
| 686 | if (!status) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 687 | pe_err("failed to find pe session for session id:%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 688 | session_entry->peSessionId); |
| 689 | goto failure; |
| 690 | } |
| 691 | |
| 692 | chan_num = session_entry->currentOperChannel; |
| 693 | sec_chan_offset = session_entry->htSecondaryChannelOffset; |
| 694 | /* |
| 695 | * store the channel switch session_entry in the lim |
| 696 | * global variable |
| 697 | */ |
| 698 | session_entry->channelChangeReasonCode = |
| 699 | LIM_SWITCH_CHANNEL_JOIN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 700 | session_entry->pLimMlmReassocRetryReq = NULL; |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 701 | pe_debug("[lim_process_mlm_join_req]: suspend link success(%d) " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 702 | "on sessionid: %d setting channel to: %d with ch_width :%d " |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 703 | "and maxtxPower: %d", status, session_entry->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 704 | session_entry->currentOperChannel, |
| 705 | session_entry->ch_width, |
| 706 | session_entry->maxTxPower); |
| 707 | lim_set_channel(mac, session_entry->currentOperChannel, |
| 708 | session_entry->ch_center_freq_seg0, |
| 709 | session_entry->ch_center_freq_seg1, |
| 710 | session_entry->ch_width, |
| 711 | session_entry->maxTxPower, |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 712 | session_entry->peSessionId, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 713 | return; |
| 714 | |
| 715 | failure: |
| 716 | MTRACE(mac_trace(mac, TRACE_CODE_MLM_STATE, session_entry->peSessionId, |
| 717 | session_entry->limMlmState)); |
| 718 | session_entry->limMlmState = eLIM_MLM_IDLE_STATE; |
Varun Reddy Yeturu | a47f08f | 2018-08-07 14:45:31 -0700 | [diff] [blame] | 719 | mlm_join_cnf.resultCode = eSIR_SME_PEER_CREATE_FAILED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 720 | mlm_join_cnf.sessionId = session_entry->peSessionId; |
| 721 | mlm_join_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 722 | lim_post_sme_message(mac, LIM_MLM_JOIN_CNF, (uint32_t *) &mlm_join_cnf); |
| 723 | } |
| 724 | |
| 725 | /** |
| 726 | * lim_process_mlm_post_join_suspend_link() - This function is called after the |
| 727 | * suspend link while joining off channel. |
| 728 | * |
| 729 | * @mac_ctx: Pointer to Global MAC structure |
| 730 | * @status: status of suspend link. |
| 731 | * @ctx: passed while calling suspend link(session) |
| 732 | * |
| 733 | * This function does following: |
| 734 | * Check for suspend state. |
Jeff Johnson | 4ceed38 | 2018-05-06 16:24:57 -0700 | [diff] [blame] | 735 | * If success, proceed with setting link state to receive the |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 736 | * probe response/beacon from intended AP. |
| 737 | * Switch to the APs channel. |
| 738 | * On an error case, send the MLM_JOIN_CNF with error status. |
| 739 | * |
| 740 | * @Return None |
| 741 | */ |
| 742 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 743 | lim_process_mlm_post_join_suspend_link(struct mac_context *mac_ctx, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 744 | QDF_STATUS status, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 745 | uint32_t *ctx) |
| 746 | { |
| 747 | tLimMlmJoinCnf mlm_join_cnf; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 748 | struct pe_session *session = (struct pe_session *) ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 749 | tSirLinkState lnk_state; |
Pragaspathi Thilagaraj | 210362a | 2018-07-31 19:08:19 +0530 | [diff] [blame] | 750 | struct session_params *pe_session_param = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 751 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 752 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 753 | pe_err("Sessionid %d Suspend link(NOTIFY_BSS) failed. Still proceeding with join", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 754 | session->peSessionId); |
| 755 | } |
| 756 | lim_deactivate_and_change_timer(mac_ctx, eLIM_JOIN_FAIL_TIMER); |
| 757 | |
| 758 | /* assign appropriate sessionId to the timer object */ |
| 759 | mac_ctx->lim.limTimers.gLimJoinFailureTimer.sessionId = |
| 760 | session->peSessionId; |
| 761 | |
Rajeev Kumar | aa262c4 | 2016-04-15 15:41:08 -0700 | [diff] [blame] | 762 | lnk_state = eSIR_LINK_PREASSOC_STATE; |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 763 | pe_debug("[lim_process_mlm_join_req]: lnk_state: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 764 | lnk_state); |
| 765 | |
Pragaspathi Thilagaraj | 210362a | 2018-07-31 19:08:19 +0530 | [diff] [blame] | 766 | pe_session_param = qdf_mem_malloc(sizeof(struct session_params)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 767 | if (!pe_session_param) |
Pragaspathi Thilagaraj | 210362a | 2018-07-31 19:08:19 +0530 | [diff] [blame] | 768 | goto error; |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 769 | |
| 770 | pe_session_param->session_id = session->peSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 771 | if (lim_set_link_state(mac_ctx, lnk_state, |
| 772 | session->pLimMlmJoinReq->bssDescription.bssId, |
| 773 | session->selfMacAddr, |
| 774 | lim_post_join_set_link_state_callback, |
Pragaspathi Thilagaraj | 210362a | 2018-07-31 19:08:19 +0530 | [diff] [blame] | 775 | pe_session_param) != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 776 | pe_err("SessionId:%d lim_set_link_state to eSIR_LINK_PREASSOC_STATE Failed!!", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 777 | session->peSessionId); |
| 778 | lim_print_mac_addr(mac_ctx, |
| 779 | session->pLimMlmJoinReq->bssDescription.bssId, LOGE); |
| 780 | mlm_join_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 781 | session->limMlmState = eLIM_MLM_IDLE_STATE; |
| 782 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 783 | session->peSessionId, session->limMlmState)); |
Pragaspathi Thilagaraj | 210362a | 2018-07-31 19:08:19 +0530 | [diff] [blame] | 784 | qdf_mem_free(pe_session_param); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 785 | goto error; |
| 786 | } |
| 787 | |
| 788 | return; |
| 789 | error: |
| 790 | mlm_join_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 791 | mlm_join_cnf.sessionId = session->peSessionId; |
| 792 | mlm_join_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 793 | lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, |
| 794 | (uint32_t *) &mlm_join_cnf); |
| 795 | } |
| 796 | |
| 797 | /** |
| 798 | * lim_process_mlm_join_req() - process mlm join request. |
| 799 | * |
| 800 | * @mac_ctx: Pointer to Global MAC structure |
Sandeep Puligilla | 45e0c5e | 2018-09-21 00:38:23 -0700 | [diff] [blame] | 801 | * @mlm_join_req: Pointer to the mlme join request |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 802 | * |
| 803 | * This function is called to process MLM_JOIN_REQ message |
| 804 | * from SME. It does following: |
| 805 | * 1) Initialize LIM, HAL, DPH |
| 806 | * 2) Configure the BSS for which the JOIN REQ was received |
| 807 | * a) Send WMA_ADD_BSS_REQ to HAL - |
| 808 | * This will identify the BSS that we are interested in |
| 809 | * --AND-- |
| 810 | * Add a STA entry for the AP (in a STA context) |
| 811 | * b) Wait for WMA_ADD_BSS_RSP |
| 812 | * c) Send WMA_ADD_STA_REQ to HAL |
| 813 | * This will add the "local STA" entry to the STA table |
| 814 | * 3) Continue as before, i.e, |
| 815 | * a) Send a PROBE REQ |
| 816 | * b) Wait for PROBE RSP/BEACON containing the SSID that |
| 817 | * we are interested in |
| 818 | * c) Then start an AUTH seq |
| 819 | * d) Followed by the ASSOC seq |
| 820 | * |
| 821 | * @Return: None |
| 822 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 823 | void lim_process_mlm_join_req(struct mac_context *mac_ctx, |
Sandeep Puligilla | 45e0c5e | 2018-09-21 00:38:23 -0700 | [diff] [blame] | 824 | tLimMlmJoinReq *mlm_join_req) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 825 | { |
| 826 | tLimMlmJoinCnf mlmjoin_cnf; |
| 827 | uint8_t sessionid; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 828 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 829 | |
Sandeep Puligilla | 45e0c5e | 2018-09-21 00:38:23 -0700 | [diff] [blame] | 830 | sessionid = mlm_join_req->sessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 831 | |
| 832 | session = pe_find_session_by_session_id(mac_ctx, sessionid); |
| 833 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 834 | pe_err("SessionId:%d does not exist", sessionid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 835 | goto error; |
| 836 | } |
| 837 | |
Rajeev Kumar | aa262c4 | 2016-04-15 15:41:08 -0700 | [diff] [blame] | 838 | if (!LIM_IS_AP_ROLE(session) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 839 | ((session->limMlmState == eLIM_MLM_IDLE_STATE) || |
| 840 | (session->limMlmState == eLIM_MLM_JOINED_STATE)) && |
| 841 | (SIR_MAC_GET_ESS |
Sandeep Puligilla | 45e0c5e | 2018-09-21 00:38:23 -0700 | [diff] [blame] | 842 | (mlm_join_req->bssDescription.capabilityInfo) != |
| 843 | SIR_MAC_GET_IBSS(mlm_join_req->bssDescription. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 844 | capabilityInfo))) { |
| 845 | /* Hold onto Join request parameters */ |
| 846 | |
Sandeep Puligilla | 45e0c5e | 2018-09-21 00:38:23 -0700 | [diff] [blame] | 847 | session->pLimMlmJoinReq = mlm_join_req; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 848 | if (is_lim_session_off_channel(mac_ctx, sessionid)) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 849 | pe_debug("SessionId:%d LimSession is on OffChannel", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 850 | sessionid); |
| 851 | /* suspend link */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 852 | pe_debug("Suspend link, sessionid %d is off channel", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 853 | sessionid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 854 | lim_process_mlm_post_join_suspend_link(mac_ctx, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 855 | QDF_STATUS_SUCCESS, (uint32_t *)session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 856 | } else { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 857 | pe_debug("No need to Suspend link"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 858 | /* |
| 859 | * No need to Suspend link as LimSession is not |
| 860 | * off channel, calling |
| 861 | * lim_process_mlm_post_join_suspend_link with |
| 862 | * status as SUCCESS. |
| 863 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 864 | pe_debug("SessionId:%d Join req on current chan", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 865 | sessionid); |
| 866 | lim_process_mlm_post_join_suspend_link(mac_ctx, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 867 | QDF_STATUS_SUCCESS, (uint32_t *)session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 868 | } |
| 869 | return; |
| 870 | } else { |
| 871 | /** |
| 872 | * Should not have received JOIN req in states other than |
| 873 | * Idle state or on AP. |
| 874 | * Return join confirm with invalid parameters code. |
| 875 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 876 | pe_err("Session:%d Unexpected Join req, role %d state %X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 877 | session->peSessionId, GET_LIM_SYSTEM_ROLE(session), |
| 878 | session->limMlmState); |
| 879 | lim_print_mlm_state(mac_ctx, LOGE, session->limMlmState); |
| 880 | } |
| 881 | |
| 882 | error: |
Sandeep Puligilla | 45e0c5e | 2018-09-21 00:38:23 -0700 | [diff] [blame] | 883 | qdf_mem_free(mlm_join_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 884 | if (session != NULL) |
| 885 | session->pLimMlmJoinReq = NULL; |
| 886 | mlmjoin_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 887 | mlmjoin_cnf.sessionId = sessionid; |
| 888 | mlmjoin_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 889 | lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, |
| 890 | (uint32_t *)&mlmjoin_cnf); |
| 891 | |
| 892 | } |
| 893 | |
| 894 | /** |
| 895 | * lim_is_auth_req_expected() - check if auth request is expected |
| 896 | * |
| 897 | * @mac_ctx: global MAC context |
| 898 | * @session: PE session entry |
| 899 | * |
| 900 | * This function is called by lim_process_mlm_auth_req to check |
| 901 | * if auth request is expected. |
| 902 | * |
| 903 | * Return: true if expected and false otherwise |
| 904 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 905 | static bool lim_is_auth_req_expected(struct mac_context *mac_ctx, |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 906 | struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 907 | { |
| 908 | bool flag = false; |
| 909 | |
| 910 | /* |
| 911 | * Expect Auth request only when: |
| 912 | * 1. STA joined/associated with a BSS or |
| 913 | * 2. STA is in IBSS mode |
| 914 | * and STA is going to authenticate with a unicast |
| 915 | * address and requested authentication algorithm is |
| 916 | * supported. |
| 917 | */ |
| 918 | |
Rajeev Kumar | aa262c4 | 2016-04-15 15:41:08 -0700 | [diff] [blame] | 919 | flag = (((LIM_IS_STA_ROLE(session) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 920 | ((session->limMlmState == eLIM_MLM_JOINED_STATE) || |
| 921 | (session->limMlmState == |
| 922 | eLIM_MLM_LINK_ESTABLISHED_STATE))) || |
| 923 | (LIM_IS_IBSS_ROLE(session) && |
| 924 | (session->limMlmState == |
| 925 | eLIM_MLM_BSS_STARTED_STATE))) && |
| 926 | (!lim_is_group_addr(mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr)) |
| 927 | && lim_is_auth_algo_supported(mac_ctx, |
| 928 | mac_ctx->lim.gpLimMlmAuthReq->authType, session)); |
| 929 | |
| 930 | return flag; |
| 931 | } |
| 932 | |
| 933 | /** |
| 934 | * lim_is_preauth_ctx_exisits() - check if preauth context exists |
| 935 | * |
| 936 | * @mac_ctx: global MAC context |
| 937 | * @session: PE session entry |
| 938 | * @preauth_node_ptr: pointer to preauth node pointer |
| 939 | * |
| 940 | * This function is called by lim_process_mlm_auth_req to check |
| 941 | * if preauth context already exists |
| 942 | * |
| 943 | * Return: true if exists and false otherwise |
| 944 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 945 | static bool lim_is_preauth_ctx_exists(struct mac_context *mac_ctx, |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 946 | struct pe_session *session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 947 | struct tLimPreAuthNode **preauth_node_ptr) |
| 948 | { |
| 949 | bool fl = false; |
| 950 | struct tLimPreAuthNode *preauth_node; |
| 951 | tpDphHashNode stads; |
| 952 | tSirMacAddr curr_bssid; |
| 953 | |
| 954 | preauth_node = *preauth_node_ptr; |
| 955 | sir_copy_mac_addr(curr_bssid, session->bssId); |
| 956 | stads = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, |
| 957 | &session->dph.dphHashTable); |
| 958 | preauth_node = lim_search_pre_auth_list(mac_ctx, |
| 959 | mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr); |
| 960 | |
Rajeev Kumar | aa262c4 | 2016-04-15 15:41:08 -0700 | [diff] [blame] | 961 | fl = (((LIM_IS_STA_ROLE(session)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 962 | (session->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) && |
| 963 | ((stads != NULL) && |
| 964 | (mac_ctx->lim.gpLimMlmAuthReq->authType == |
| 965 | stads->mlmStaContext.authType)) && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 966 | (!qdf_mem_cmp(mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 967 | curr_bssid, sizeof(tSirMacAddr)))) || |
| 968 | ((preauth_node != NULL) && |
| 969 | (preauth_node->authType == |
| 970 | mac_ctx->lim.gpLimMlmAuthReq->authType))); |
| 971 | |
| 972 | return fl; |
| 973 | } |
| 974 | |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 975 | #ifdef WLAN_FEATURE_SAE |
| 976 | /** |
| 977 | * lim_process_mlm_auth_req_sae() - Handle SAE authentication |
| 978 | * @mac_ctx: global MAC context |
| 979 | * @session: PE session entry |
| 980 | * |
| 981 | * This function is called by lim_process_mlm_auth_req to handle SAE |
| 982 | * authentication. |
| 983 | * |
| 984 | * Return: QDF_STATUS |
| 985 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 986 | static QDF_STATUS lim_process_mlm_auth_req_sae(struct mac_context *mac_ctx, |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 987 | struct pe_session *session) |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 988 | { |
| 989 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
| 990 | struct sir_sae_info *sae_info; |
| 991 | struct scheduler_msg msg = {0}; |
| 992 | |
| 993 | sae_info = qdf_mem_malloc(sizeof(*sae_info)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 994 | if (!sae_info) |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 995 | return QDF_STATUS_E_FAILURE; |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 996 | |
| 997 | sae_info->msg_type = eWNI_SME_TRIGGER_SAE; |
| 998 | sae_info->msg_len = sizeof(*sae_info); |
| 999 | sae_info->vdev_id = session->smeSessionId; |
| 1000 | |
| 1001 | qdf_mem_copy(sae_info->peer_mac_addr.bytes, |
| 1002 | session->bssId, |
| 1003 | QDF_MAC_ADDR_SIZE); |
| 1004 | |
| 1005 | sae_info->ssid.length = session->ssId.length; |
| 1006 | qdf_mem_copy(sae_info->ssid.ssId, |
| 1007 | session->ssId.ssId, |
| 1008 | session->ssId.length); |
| 1009 | |
| 1010 | pe_debug("vdev_id %d ssid %.*s "MAC_ADDRESS_STR"", |
| 1011 | sae_info->vdev_id, |
| 1012 | sae_info->ssid.length, |
| 1013 | sae_info->ssid.ssId, |
| 1014 | MAC_ADDR_ARRAY(sae_info->peer_mac_addr.bytes)); |
| 1015 | |
| 1016 | msg.type = eWNI_SME_TRIGGER_SAE; |
| 1017 | msg.bodyptr = sae_info; |
| 1018 | msg.bodyval = 0; |
| 1019 | |
| 1020 | qdf_status = mac_ctx->lim.sme_msg_callback(mac_ctx, &msg); |
| 1021 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 1022 | pe_err("SAE failed for AUTH frame"); |
| 1023 | qdf_mem_free(sae_info); |
| 1024 | return qdf_status; |
| 1025 | } |
| 1026 | session->limMlmState = eLIM_MLM_WT_SAE_AUTH_STATE; |
| 1027 | |
| 1028 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, session->peSessionId, |
| 1029 | session->limMlmState)); |
| 1030 | |
Padma, Santhosh Kumar | c56735f | 2017-09-13 18:14:26 +0530 | [diff] [blame] | 1031 | mac_ctx->lim.limTimers.sae_auth_timer.sessionId = |
| 1032 | session->peSessionId; |
| 1033 | |
| 1034 | /* Activate SAE auth timer */ |
| 1035 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_TIMER_ACTIVATE, |
| 1036 | session->peSessionId, eLIM_AUTH_SAE_TIMER)); |
| 1037 | if (tx_timer_activate(&mac_ctx->lim.limTimers.sae_auth_timer) |
| 1038 | != TX_SUCCESS) { |
| 1039 | pe_err("could not start Auth SAE timer"); |
| 1040 | } |
| 1041 | |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 1042 | return qdf_status; |
| 1043 | } |
| 1044 | #else |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1045 | static QDF_STATUS lim_process_mlm_auth_req_sae(struct mac_context *mac_ctx, |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 1046 | struct pe_session *session) |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 1047 | { |
| 1048 | return QDF_STATUS_E_NOSUPPORT; |
| 1049 | } |
| 1050 | #endif |
| 1051 | |
| 1052 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1053 | /** |
| 1054 | * lim_process_mlm_auth_req() - process lim auth request |
| 1055 | * |
| 1056 | * @mac_ctx: global MAC context |
| 1057 | * @msg: MLM auth request message |
| 1058 | * |
| 1059 | * This function is called to process MLM_AUTH_REQ message from SME |
| 1060 | * |
| 1061 | * @Return: None |
| 1062 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1063 | static void lim_process_mlm_auth_req(struct mac_context *mac_ctx, uint32_t *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1064 | { |
| 1065 | uint32_t num_preauth_ctx; |
| 1066 | tSirMacAddr curr_bssid; |
| 1067 | tSirMacAuthFrameBody auth_frame_body; |
| 1068 | tLimMlmAuthCnf mlm_auth_cnf; |
| 1069 | struct tLimPreAuthNode *preauth_node = NULL; |
| 1070 | uint8_t session_id; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 1071 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1072 | |
| 1073 | if (msg == NULL) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1074 | pe_err("Buffer is Pointing to NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1075 | return; |
| 1076 | } |
| 1077 | |
| 1078 | mac_ctx->lim.gpLimMlmAuthReq = (tLimMlmAuthReq *) msg; |
| 1079 | session_id = mac_ctx->lim.gpLimMlmAuthReq->sessionId; |
| 1080 | session = pe_find_session_by_session_id(mac_ctx, session_id); |
| 1081 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1082 | pe_err("SessionId:%d does not exist", session_id); |
Krunal Soni | 7d78708 | 2017-11-07 10:30:11 -0800 | [diff] [blame] | 1083 | qdf_mem_free(msg); |
| 1084 | mac_ctx->lim.gpLimMlmAuthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1085 | return; |
| 1086 | } |
| 1087 | |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1088 | pe_debug("Process Auth Req sessionID %d Systemrole %d" |
| 1089 | "mlmstate %d from: " MAC_ADDRESS_STR |
| 1090 | " with authtype %d", session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1091 | GET_LIM_SYSTEM_ROLE(session), session->limMlmState, |
| 1092 | MAC_ADDR_ARRAY(mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr), |
| 1093 | mac_ctx->lim.gpLimMlmAuthReq->authType); |
| 1094 | |
| 1095 | sir_copy_mac_addr(curr_bssid, session->bssId); |
| 1096 | |
| 1097 | if (!lim_is_auth_req_expected(mac_ctx, session)) { |
| 1098 | /* |
| 1099 | * Unexpected auth request. |
| 1100 | * Return Auth confirm with Invalid parameters code. |
| 1101 | */ |
| 1102 | mlm_auth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 1103 | goto end; |
| 1104 | } |
| 1105 | |
| 1106 | /* |
| 1107 | * This is a request for pre-authentication. Check if there exists |
| 1108 | * context already for the requested peer OR |
| 1109 | * if this request is for the AP we're currently associated with. |
| 1110 | * If yes, return auth confirm immediately when |
| 1111 | * requested auth type is same as the one used before. |
| 1112 | */ |
| 1113 | if (lim_is_preauth_ctx_exists(mac_ctx, session, &preauth_node)) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1114 | pe_debug("Already have pre-auth context with peer: " |
| 1115 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1116 | MAC_ADDR_ARRAY(mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr)); |
| 1117 | mlm_auth_cnf.resultCode = (tSirResultCodes) |
| 1118 | eSIR_MAC_SUCCESS_STATUS; |
| 1119 | goto end; |
| 1120 | } else { |
Wu Gao | ca416ff | 2018-09-17 11:05:07 +0800 | [diff] [blame] | 1121 | num_preauth_ctx = mac_ctx->mlme_cfg->lfr.max_num_pre_auth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1122 | if (mac_ctx->lim.gLimNumPreAuthContexts == num_preauth_ctx) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1123 | pe_warn("Number of pre-auth reached max limit"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1124 | /* Return Auth confirm with reject code */ |
| 1125 | mlm_auth_cnf.resultCode = |
| 1126 | eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED; |
| 1127 | goto end; |
| 1128 | } |
| 1129 | } |
| 1130 | |
| 1131 | /* Delete pre-auth node if exists */ |
| 1132 | if (preauth_node) |
| 1133 | lim_delete_pre_auth_node(mac_ctx, |
| 1134 | mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr); |
| 1135 | |
| 1136 | session->limPrevMlmState = session->limMlmState; |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 1137 | |
Padma, Santhosh Kumar | b8f65d9 | 2017-09-14 13:05:42 +0530 | [diff] [blame] | 1138 | if ((mac_ctx->lim.gpLimMlmAuthReq->authType == eSIR_AUTH_TYPE_SAE) && |
| 1139 | !session->sae_pmk_cached) { |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 1140 | if (lim_process_mlm_auth_req_sae(mac_ctx, session) != |
| 1141 | QDF_STATUS_SUCCESS) { |
| 1142 | mlm_auth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 1143 | goto end; |
| 1144 | } else { |
| 1145 | pe_debug("lim_process_mlm_auth_req_sae is successful"); |
Abhinav Kumar | 8556167 | 2018-04-17 12:48:51 +0530 | [diff] [blame] | 1146 | lim_diag_event_report(mac_ctx, |
| 1147 | WLAN_PE_DIAG_AUTH_ALGO_NUM, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1148 | session, QDF_STATUS_SUCCESS, |
Abhinav Kumar | 8556167 | 2018-04-17 12:48:51 +0530 | [diff] [blame] | 1149 | eSIR_AUTH_TYPE_SAE); |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 1150 | return; |
| 1151 | } |
| 1152 | } else |
| 1153 | session->limMlmState = eLIM_MLM_WT_AUTH_FRAME2_STATE; |
| 1154 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1155 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, session->peSessionId, |
| 1156 | session->limMlmState)); |
| 1157 | |
Padma, Santhosh Kumar | b8f65d9 | 2017-09-14 13:05:42 +0530 | [diff] [blame] | 1158 | /* Mark auth algo as open when auth type is SAE and PMK is cached */ |
| 1159 | if ((mac_ctx->lim.gpLimMlmAuthReq->authType == eSIR_AUTH_TYPE_SAE) && |
| 1160 | session->sae_pmk_cached) { |
| 1161 | auth_frame_body.authAlgoNumber = eSIR_OPEN_SYSTEM; |
| 1162 | } else { |
| 1163 | auth_frame_body.authAlgoNumber = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1164 | (uint8_t) mac_ctx->lim.gpLimMlmAuthReq->authType; |
Padma, Santhosh Kumar | b8f65d9 | 2017-09-14 13:05:42 +0530 | [diff] [blame] | 1165 | } |
Abhinav Kumar | 8556167 | 2018-04-17 12:48:51 +0530 | [diff] [blame] | 1166 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ALGO_NUM, session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1167 | QDF_STATUS_SUCCESS, auth_frame_body.authAlgoNumber); |
Padma, Santhosh Kumar | b8f65d9 | 2017-09-14 13:05:42 +0530 | [diff] [blame] | 1168 | |
| 1169 | /* Prepare & send Authentication frame */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1170 | auth_frame_body.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1; |
| 1171 | auth_frame_body.authStatusCode = 0; |
| 1172 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 1173 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_START_EVENT, session, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1174 | QDF_STATUS_SUCCESS, auth_frame_body.authStatusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1175 | #endif |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 1176 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1177 | lim_send_auth_mgmt_frame(mac_ctx, |
| 1178 | &auth_frame_body, mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr, |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1179 | LIM_NO_WEP_IN_FC, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1180 | |
| 1181 | /* assign appropriate session_id to the timer object */ |
| 1182 | mac_ctx->lim.limTimers.gLimAuthFailureTimer.sessionId = session_id; |
| 1183 | |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 1184 | /* assign appropriate sessionId to the timer object */ |
| 1185 | mac_ctx->lim.limTimers.g_lim_periodic_auth_retry_timer.sessionId = |
| 1186 | session_id; |
| 1187 | lim_deactivate_and_change_timer(mac_ctx, eLIM_AUTH_RETRY_TIMER); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1188 | /* Activate Auth failure timer */ |
| 1189 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_TIMER_ACTIVATE, |
| 1190 | session->peSessionId, eLIM_AUTH_FAIL_TIMER)); |
Bala Venkatesh | 4183779 | 2018-11-01 18:22:13 +0530 | [diff] [blame] | 1191 | lim_deactivate_and_change_timer(mac_ctx, eLIM_AUTH_FAIL_TIMER); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1192 | if (tx_timer_activate(&mac_ctx->lim.limTimers.gLimAuthFailureTimer) |
| 1193 | != TX_SUCCESS) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1194 | pe_err("could not start Auth failure timer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1195 | /* Cleanup as if auth timer expired */ |
| 1196 | lim_process_auth_failure_timeout(mac_ctx); |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 1197 | } else { |
| 1198 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_TIMER_ACTIVATE, |
| 1199 | session->peSessionId, eLIM_AUTH_RETRY_TIMER)); |
| 1200 | /* Activate Auth Retry timer */ |
| 1201 | if (tx_timer_activate |
| 1202 | (&mac_ctx->lim.limTimers.g_lim_periodic_auth_retry_timer) |
| 1203 | != TX_SUCCESS) |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1204 | pe_err("could not activate Auth Retry timer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1205 | } |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 1206 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1207 | return; |
| 1208 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1209 | qdf_mem_copy((uint8_t *) &mlm_auth_cnf.peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1210 | (uint8_t *) &mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr, |
| 1211 | sizeof(tSirMacAddr)); |
| 1212 | |
| 1213 | mlm_auth_cnf.authType = mac_ctx->lim.gpLimMlmAuthReq->authType; |
| 1214 | mlm_auth_cnf.sessionId = session_id; |
| 1215 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1216 | qdf_mem_free(mac_ctx->lim.gpLimMlmAuthReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1217 | mac_ctx->lim.gpLimMlmAuthReq = NULL; |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1218 | pe_debug("SessionId:%d LimPostSme LIM_MLM_AUTH_CNF", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1219 | session_id); |
| 1220 | lim_post_sme_message(mac_ctx, LIM_MLM_AUTH_CNF, |
| 1221 | (uint32_t *) &mlm_auth_cnf); |
| 1222 | } |
| 1223 | |
| 1224 | /** |
| 1225 | * lim_process_mlm_assoc_req() - This function is called to process |
| 1226 | * MLM_ASSOC_REQ message from SME |
| 1227 | * |
| 1228 | * @mac_ctx: Pointer to Global MAC structure |
| 1229 | * @msg_buf: A pointer to the MLM message buffer |
| 1230 | * |
| 1231 | * This function is called to process MLM_ASSOC_REQ message from SME |
| 1232 | * |
| 1233 | * @Return None |
| 1234 | */ |
| 1235 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1236 | static void lim_process_mlm_assoc_req(struct mac_context *mac_ctx, uint32_t *msg_buf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1237 | { |
| 1238 | tSirMacAddr curr_bssId; |
| 1239 | tLimMlmAssocReq *mlm_assoc_req; |
| 1240 | tLimMlmAssocCnf mlm_assoc_cnf; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 1241 | struct pe_session *session_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1242 | |
| 1243 | if (msg_buf == NULL) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1244 | pe_err("Buffer is Pointing to NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1245 | return; |
| 1246 | } |
| 1247 | |
| 1248 | mlm_assoc_req = (tLimMlmAssocReq *) msg_buf; |
| 1249 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 1250 | mlm_assoc_req->sessionId); |
| 1251 | if (session_entry == NULL) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1252 | pe_err("SessionId:%d Session Does not exist", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1253 | mlm_assoc_req->sessionId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1254 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1255 | return; |
| 1256 | } |
| 1257 | |
| 1258 | sir_copy_mac_addr(curr_bssId, session_entry->bssId); |
| 1259 | |
Rajeev Kumar | aa262c4 | 2016-04-15 15:41:08 -0700 | [diff] [blame] | 1260 | if (!(!LIM_IS_AP_ROLE(session_entry) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1261 | (session_entry->limMlmState == eLIM_MLM_AUTHENTICATED_STATE || |
| 1262 | session_entry->limMlmState == eLIM_MLM_JOINED_STATE) && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1263 | (!qdf_mem_cmp(mlm_assoc_req->peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1264 | curr_bssId, sizeof(tSirMacAddr))))) { |
| 1265 | /* |
| 1266 | * Received Association request either in invalid state |
| 1267 | * or to a peer MAC entity whose address is different |
| 1268 | * from one that STA is currently joined with or on AP. |
| 1269 | * Return Assoc confirm with Invalid parameters code. |
| 1270 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1271 | pe_warn("received unexpected MLM_ASSOC_CNF in state %X for role=%d, MAC addr= " |
| 1272 | MAC_ADDRESS_STR, session_entry->limMlmState, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1273 | GET_LIM_SYSTEM_ROLE(session_entry), |
| 1274 | MAC_ADDR_ARRAY(mlm_assoc_req->peerMacAddr)); |
| 1275 | lim_print_mlm_state(mac_ctx, LOGW, session_entry->limMlmState); |
| 1276 | mlm_assoc_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 1277 | mlm_assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 1278 | goto end; |
| 1279 | } |
| 1280 | |
| 1281 | /* map the session entry pointer to the AssocFailureTimer */ |
| 1282 | mac_ctx->lim.limTimers.gLimAssocFailureTimer.sessionId = |
| 1283 | mlm_assoc_req->sessionId; |
| 1284 | #ifdef WLAN_FEATURE_11W |
| 1285 | /* |
| 1286 | * Store current MLM state in case ASSOC response returns with |
| 1287 | * TRY_AGAIN_LATER return code. |
| 1288 | */ |
| 1289 | if (session_entry->limRmfEnabled) { |
Jeff Johnson | 4a07a9b | 2018-11-21 23:51:02 -0800 | [diff] [blame] | 1290 | session_entry->pmfComebackTimerInfo.lim_prev_mlm_state = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1291 | session_entry->limPrevMlmState; |
Jeff Johnson | 4a07a9b | 2018-11-21 23:51:02 -0800 | [diff] [blame] | 1292 | session_entry->pmfComebackTimerInfo.lim_mlm_state = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1293 | session_entry->limMlmState; |
| 1294 | } |
| 1295 | #endif /* WLAN_FEATURE_11W */ |
| 1296 | |
| 1297 | session_entry->limPrevMlmState = session_entry->limMlmState; |
| 1298 | session_entry->limMlmState = eLIM_MLM_WT_ASSOC_RSP_STATE; |
| 1299 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 1300 | session_entry->peSessionId, |
| 1301 | session_entry->limMlmState)); |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1302 | pe_debug("SessionId:%d Sending Assoc_Req Frame", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1303 | session_entry->peSessionId); |
| 1304 | |
| 1305 | /* Prepare and send Association request frame */ |
| 1306 | lim_send_assoc_req_mgmt_frame(mac_ctx, mlm_assoc_req, session_entry); |
| 1307 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1308 | /* Start association failure timer */ |
| 1309 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_TIMER_ACTIVATE, |
| 1310 | session_entry->peSessionId, eLIM_ASSOC_FAIL_TIMER)); |
| 1311 | if (tx_timer_activate(&mac_ctx->lim.limTimers.gLimAssocFailureTimer) |
| 1312 | != TX_SUCCESS) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1313 | pe_warn("SessionId:%d couldn't start Assoc failure timer", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1314 | session_entry->peSessionId); |
| 1315 | /* Cleanup as if assoc timer expired */ |
| 1316 | lim_process_assoc_failure_timeout(mac_ctx, LIM_ASSOC); |
| 1317 | } |
| 1318 | |
| 1319 | return; |
| 1320 | end: |
| 1321 | /* Update PE session Id */ |
| 1322 | mlm_assoc_cnf.sessionId = mlm_assoc_req->sessionId; |
| 1323 | /* Free up buffer allocated for assocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1324 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1325 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, |
| 1326 | (uint32_t *) &mlm_assoc_cnf); |
| 1327 | } |
| 1328 | |
| 1329 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1330 | * lim_process_mlm_disassoc_req_ntf() - process disassoc request notification |
| 1331 | * |
| 1332 | * @mac_ctx: global MAC context |
| 1333 | * @suspend_status: suspend status |
| 1334 | * @msg: mlm message buffer |
| 1335 | * |
| 1336 | * This function is used to process MLM disassoc notification |
| 1337 | * |
| 1338 | * Return: None |
| 1339 | */ |
| 1340 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1341 | lim_process_mlm_disassoc_req_ntf(struct mac_context *mac_ctx, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1342 | QDF_STATUS suspend_status, uint32_t *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1343 | { |
| 1344 | uint16_t aid; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1345 | struct qdf_mac_addr curr_bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1346 | tpDphHashNode stads; |
| 1347 | tLimMlmDisassocReq *mlm_disassocreq; |
| 1348 | tLimMlmDisassocCnf mlm_disassoccnf; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 1349 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1350 | extern bool send_disassoc_frame; |
| 1351 | tLimMlmStates mlm_state; |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1352 | tSirSmeDisassocRsp *sme_disassoc_rsp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1353 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1354 | if (QDF_STATUS_SUCCESS != suspend_status) |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1355 | pe_err("Suspend Status is not success %X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1356 | suspend_status); |
| 1357 | |
| 1358 | mlm_disassocreq = (tLimMlmDisassocReq *) msg; |
| 1359 | |
| 1360 | session = pe_find_session_by_session_id(mac_ctx, |
| 1361 | mlm_disassocreq->sessionId); |
| 1362 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1363 | pe_err("session does not exist for given sessionId %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1364 | mlm_disassocreq->sessionId); |
| 1365 | mlm_disassoccnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 1366 | goto end; |
| 1367 | } |
| 1368 | |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1369 | pe_debug("Process DisAssoc Req on sessionID %d Systemrole %d" |
| 1370 | "mlmstate %d from: " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1371 | mlm_disassocreq->sessionId, GET_LIM_SYSTEM_ROLE(session), |
| 1372 | session->limMlmState, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1373 | MAC_ADDR_ARRAY(mlm_disassocreq->peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1374 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1375 | qdf_mem_copy(curr_bssid.bytes, session->bssId, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1376 | |
| 1377 | switch (GET_LIM_SYSTEM_ROLE(session)) { |
| 1378 | case eLIM_STA_ROLE: |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1379 | if (!qdf_is_macaddr_equal(&mlm_disassocreq->peer_macaddr, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1380 | &curr_bssid)) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1381 | pe_warn("received MLM_DISASSOC_REQ with invalid BSS id"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1382 | lim_print_mac_addr(mac_ctx, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1383 | mlm_disassocreq->peer_macaddr.bytes, LOGW); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1384 | |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1385 | /* |
| 1386 | * Disassociation response due to host triggered |
| 1387 | * disassociation |
| 1388 | */ |
| 1389 | sme_disassoc_rsp = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1390 | qdf_mem_malloc(sizeof(tSirSmeDisassocRsp)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1391 | if (!sme_disassoc_rsp) { |
Vignesh Viswanathan | a842b94 | 2018-02-16 16:02:50 +0530 | [diff] [blame] | 1392 | qdf_mem_free(mlm_disassocreq); |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1393 | return; |
| 1394 | } |
| 1395 | |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1396 | pe_debug("send disassoc rsp with ret code %d for" MAC_ADDRESS_STR, |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1397 | eSIR_SME_DEAUTH_STATUS, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1398 | MAC_ADDR_ARRAY( |
| 1399 | mlm_disassocreq->peer_macaddr.bytes)); |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1400 | |
| 1401 | sme_disassoc_rsp->messageType = eWNI_SME_DISASSOC_RSP; |
| 1402 | sme_disassoc_rsp->length = sizeof(tSirSmeDisassocRsp); |
| 1403 | sme_disassoc_rsp->sessionId = |
| 1404 | mlm_disassocreq->sessionId; |
| 1405 | sme_disassoc_rsp->transactionId = 0; |
| 1406 | sme_disassoc_rsp->statusCode = eSIR_SME_DEAUTH_STATUS; |
| 1407 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1408 | qdf_copy_macaddr(&sme_disassoc_rsp->peer_macaddr, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1409 | &mlm_disassocreq->peer_macaddr); |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1410 | msg = (uint32_t *)sme_disassoc_rsp; |
| 1411 | |
| 1412 | lim_send_sme_disassoc_deauth_ntf(mac_ctx, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1413 | QDF_STATUS_SUCCESS, msg); |
Vignesh Viswanathan | a842b94 | 2018-02-16 16:02:50 +0530 | [diff] [blame] | 1414 | qdf_mem_free(mlm_disassocreq); |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1415 | return; |
| 1416 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1417 | } |
| 1418 | break; |
| 1419 | case eLIM_STA_IN_IBSS_ROLE: |
| 1420 | break; |
| 1421 | case eLIM_AP_ROLE: |
| 1422 | case eLIM_P2P_DEVICE_GO: |
| 1423 | if (true == |
| 1424 | mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1425 | pe_err("CAC timer is running, drop disassoc from going out"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1426 | mlm_disassoccnf.resultCode = eSIR_SME_SUCCESS; |
| 1427 | goto end; |
| 1428 | } |
| 1429 | break; |
| 1430 | default: |
| 1431 | break; |
| 1432 | } /* end switch (GET_LIM_SYSTEM_ROLE(session)) */ |
| 1433 | |
| 1434 | /* |
| 1435 | * Check if there exists a context for the peer entity |
| 1436 | * to be disassociated with. |
| 1437 | */ |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1438 | stads = dph_lookup_hash_entry(mac_ctx, |
| 1439 | mlm_disassocreq->peer_macaddr.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1440 | &aid, &session->dph.dphHashTable); |
| 1441 | if (stads) |
| 1442 | mlm_state = stads->mlmStaContext.mlmState; |
| 1443 | |
| 1444 | if ((stads == NULL) || |
| 1445 | (stads && |
| 1446 | ((mlm_state != eLIM_MLM_LINK_ESTABLISHED_STATE) && |
| 1447 | (mlm_state != eLIM_MLM_WT_ASSOC_CNF_STATE) && |
| 1448 | (mlm_state != eLIM_MLM_ASSOCIATED_STATE)))) { |
| 1449 | /* |
| 1450 | * Received LIM_MLM_DISASSOC_REQ for STA that does not |
| 1451 | * have context or in some transit state. |
| 1452 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1453 | pe_warn("Invalid MLM_DISASSOC_REQ, Addr= " MAC_ADDRESS_STR, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1454 | MAC_ADDR_ARRAY(mlm_disassocreq->peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1455 | if (stads != NULL) |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1456 | pe_err("Sta MlmState: %d", stads->mlmStaContext.mlmState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1457 | |
| 1458 | /* Prepare and Send LIM_MLM_DISASSOC_CNF */ |
| 1459 | mlm_disassoccnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 1460 | goto end; |
| 1461 | } |
| 1462 | |
| 1463 | stads->mlmStaContext.disassocReason = (tSirMacReasonCodes) |
| 1464 | mlm_disassocreq->reasonCode; |
| 1465 | stads->mlmStaContext.cleanupTrigger = mlm_disassocreq->disassocTrigger; |
| 1466 | |
| 1467 | /* |
| 1468 | * Set state to mlm State to eLIM_MLM_WT_DEL_STA_RSP_STATE |
| 1469 | * This is to address the issue of race condition between |
| 1470 | * disconnect request from the HDD and deauth from AP |
| 1471 | */ |
| 1472 | |
| 1473 | stads->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
| 1474 | |
| 1475 | /* Send Disassociate frame to peer entity */ |
| 1476 | if (send_disassoc_frame && (mlm_disassocreq->reasonCode != |
| 1477 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) { |
Vignesh Viswanathan | a842b94 | 2018-02-16 16:02:50 +0530 | [diff] [blame] | 1478 | if (mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq) { |
| 1479 | pe_err("pMlmDisassocReq is not NULL, freeing"); |
| 1480 | qdf_mem_free(mac_ctx->lim.limDisassocDeauthCnfReq. |
| 1481 | pMlmDisassocReq); |
| 1482 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1483 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = |
| 1484 | mlm_disassocreq; |
| 1485 | /* |
| 1486 | * Set state to mlm State to eLIM_MLM_WT_DEL_STA_RSP_STATE |
| 1487 | * This is to address the issue of race condition between |
| 1488 | * disconnect request from the HDD and deauth from AP |
| 1489 | */ |
| 1490 | stads->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
| 1491 | |
Edhar, Mahesh Kumar | e3c8d35 | 2015-11-16 12:03:45 +0530 | [diff] [blame] | 1492 | lim_send_disassoc_mgmt_frame(mac_ctx, |
| 1493 | mlm_disassocreq->reasonCode, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1494 | mlm_disassocreq->peer_macaddr.bytes, session, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1495 | /* |
Edhar, Mahesh Kumar | e3c8d35 | 2015-11-16 12:03:45 +0530 | [diff] [blame] | 1496 | * Abort Tx so that data frames won't be sent to the AP |
| 1497 | * after sending Disassoc. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1498 | */ |
Edhar, Mahesh Kumar | e3c8d35 | 2015-11-16 12:03:45 +0530 | [diff] [blame] | 1499 | if (LIM_IS_STA_ROLE(session)) |
| 1500 | wma_tx_abort(session->smeSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1501 | } else { |
| 1502 | /* Disassoc frame is not sent OTA */ |
| 1503 | send_disassoc_frame = 1; |
| 1504 | /* Receive path cleanup with dummy packet */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1505 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1506 | lim_cleanup_rx_path(mac_ctx, stads, session)) { |
| 1507 | mlm_disassoccnf.resultCode = |
| 1508 | eSIR_SME_RESOURCES_UNAVAILABLE; |
| 1509 | goto end; |
| 1510 | } |
| 1511 | /* Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1512 | qdf_mem_free(mlm_disassocreq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1513 | } |
| 1514 | |
| 1515 | return; |
| 1516 | |
| 1517 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1518 | qdf_mem_copy((uint8_t *) &mlm_disassoccnf.peerMacAddr, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1519 | (uint8_t *) mlm_disassocreq->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1520 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1521 | mlm_disassoccnf.aid = mlm_disassocreq->aid; |
| 1522 | mlm_disassoccnf.disassocTrigger = mlm_disassocreq->disassocTrigger; |
| 1523 | |
| 1524 | /* Update PE session ID */ |
| 1525 | mlm_disassoccnf.sessionId = mlm_disassocreq->sessionId; |
| 1526 | |
| 1527 | /* Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1528 | qdf_mem_free(mlm_disassocreq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1529 | |
| 1530 | lim_post_sme_message(mac_ctx, LIM_MLM_DISASSOC_CNF, |
| 1531 | (uint32_t *) &mlm_disassoccnf); |
| 1532 | } |
| 1533 | |
| 1534 | /** |
| 1535 | * lim_check_disassoc_deauth_ack_pending() - check if deauth is pending |
| 1536 | * |
| 1537 | * @mac_ctx - global MAC context |
| 1538 | * @sta_mac - station MAC |
| 1539 | * |
| 1540 | * This function checks if diassociation or deauthentication is pending for |
| 1541 | * given station MAC address. |
| 1542 | * |
| 1543 | * Return: true if pending and false otherwise. |
| 1544 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1545 | bool lim_check_disassoc_deauth_ack_pending(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1546 | uint8_t *sta_mac) |
| 1547 | { |
| 1548 | tLimMlmDisassocReq *disassoc_req; |
| 1549 | tLimMlmDeauthReq *deauth_req; |
| 1550 | |
| 1551 | disassoc_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 1552 | deauth_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1553 | if ((disassoc_req && (!qdf_mem_cmp((uint8_t *) sta_mac, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1554 | (uint8_t *) &disassoc_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1555 | QDF_MAC_ADDR_SIZE))) || |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1556 | (deauth_req && (!qdf_mem_cmp((uint8_t *) sta_mac, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1557 | (uint8_t *) &deauth_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1558 | QDF_MAC_ADDR_SIZE)))) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1559 | pe_debug("Disassoc/Deauth ack pending"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1560 | return true; |
| 1561 | } else { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1562 | pe_debug("Disassoc/Deauth Ack not pending"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1563 | return false; |
| 1564 | } |
| 1565 | } |
| 1566 | |
| 1567 | /* |
| 1568 | * lim_clean_up_disassoc_deauth_req() - cleans up pending disassoc or deauth req |
| 1569 | * |
| 1570 | * @mac_ctx: mac_ctx |
| 1571 | * @sta_mac: sta mac address |
| 1572 | * @clean_rx_path: flag to indicate whether to cleanup rx path or not |
| 1573 | * |
| 1574 | * This function cleans up pending disassoc or deauth req |
| 1575 | * |
| 1576 | * Return: void |
| 1577 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1578 | void lim_clean_up_disassoc_deauth_req(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1579 | uint8_t *sta_mac, bool clean_rx_path) |
| 1580 | { |
| 1581 | tLimMlmDisassocReq *mlm_disassoc_req; |
| 1582 | tLimMlmDeauthReq *mlm_deauth_req; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 1583 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1584 | mlm_disassoc_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 1585 | if (mlm_disassoc_req && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1586 | (!qdf_mem_cmp((uint8_t *) sta_mac, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1587 | (uint8_t *) &mlm_disassoc_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1588 | QDF_MAC_ADDR_SIZE))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1589 | if (clean_rx_path) { |
| 1590 | lim_process_disassoc_ack_timeout(mac_ctx); |
| 1591 | } else { |
| 1592 | if (tx_timer_running( |
| 1593 | &mac_ctx->lim.limTimers.gLimDisassocAckTimer)) { |
| 1594 | lim_deactivate_and_change_timer(mac_ctx, |
| 1595 | eLIM_DISASSOC_ACK_TIMER); |
| 1596 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1597 | qdf_mem_free(mlm_disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1598 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = |
| 1599 | NULL; |
| 1600 | } |
| 1601 | } |
| 1602 | |
| 1603 | mlm_deauth_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 1604 | if (mlm_deauth_req && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1605 | (!qdf_mem_cmp((uint8_t *) sta_mac, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1606 | (uint8_t *) &mlm_deauth_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1607 | QDF_MAC_ADDR_SIZE))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1608 | if (clean_rx_path) { |
| 1609 | lim_process_deauth_ack_timeout(mac_ctx); |
| 1610 | } else { |
| 1611 | if (tx_timer_running( |
| 1612 | &mac_ctx->lim.limTimers.gLimDeauthAckTimer)) { |
| 1613 | lim_deactivate_and_change_timer(mac_ctx, |
| 1614 | eLIM_DEAUTH_ACK_TIMER); |
| 1615 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1616 | qdf_mem_free(mlm_deauth_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1617 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = |
| 1618 | NULL; |
| 1619 | } |
| 1620 | } |
| 1621 | } |
| 1622 | |
| 1623 | /* |
| 1624 | * lim_process_disassoc_ack_timeout() - wrapper function around |
| 1625 | * lim_send_disassoc_cnf |
| 1626 | * |
| 1627 | * @mac_ctx: mac_ctx |
| 1628 | * |
| 1629 | * wrapper function around lim_send_disassoc_cnf |
| 1630 | * |
| 1631 | * Return: void |
| 1632 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1633 | void lim_process_disassoc_ack_timeout(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1635 | lim_send_disassoc_cnf(mac_ctx); |
| 1636 | } |
| 1637 | |
| 1638 | /** |
| 1639 | * lim_process_mlm_disassoc_req() - This function is called to process |
| 1640 | * MLM_DISASSOC_REQ message from SME |
| 1641 | * |
| 1642 | * @mac_ctx: Pointer to Global MAC structure |
| 1643 | * @msg_buf: A pointer to the MLM message buffer |
| 1644 | * |
| 1645 | * This function is called to process MLM_DISASSOC_REQ message from SME |
| 1646 | * |
| 1647 | * @Return: None |
| 1648 | */ |
| 1649 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1650 | lim_process_mlm_disassoc_req(struct mac_context *mac_ctx, uint32_t *msg_buf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1651 | { |
| 1652 | tLimMlmDisassocReq *mlm_disassoc_req; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1653 | |
| 1654 | if (msg_buf == NULL) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1655 | pe_err("Buffer is Pointing to NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1656 | return; |
| 1657 | } |
| 1658 | |
| 1659 | mlm_disassoc_req = (tLimMlmDisassocReq *) msg_buf; |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1660 | pe_debug("Process disassoc req, sessionID %d from: "MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1661 | mlm_disassoc_req->sessionId, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 1662 | MAC_ADDR_ARRAY(mlm_disassoc_req->peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1663 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1664 | lim_process_mlm_disassoc_req_ntf(mac_ctx, QDF_STATUS_SUCCESS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1665 | (uint32_t *) msg_buf); |
| 1666 | } |
| 1667 | |
| 1668 | /** |
| 1669 | * lim_process_mlm_deauth_req_ntf() - This function is process mlm deauth req |
| 1670 | * notification |
| 1671 | * |
| 1672 | * @mac_ctx: Pointer to Global MAC structure |
| 1673 | * @suspend_status: suspend status |
| 1674 | * @msg_buf: A pointer to the MLM message buffer |
| 1675 | * |
| 1676 | * This function is process mlm deauth req notification |
| 1677 | * |
| 1678 | * @Return: None |
| 1679 | */ |
| 1680 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1681 | lim_process_mlm_deauth_req_ntf(struct mac_context *mac_ctx, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1682 | QDF_STATUS suspend_status, uint32_t *msg_buf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1683 | { |
| 1684 | uint16_t aid; |
| 1685 | tSirMacAddr curr_bssId; |
| 1686 | tpDphHashNode sta_ds; |
| 1687 | struct tLimPreAuthNode *auth_node; |
| 1688 | tLimMlmDeauthReq *mlm_deauth_req; |
| 1689 | tLimMlmDeauthCnf mlm_deauth_cnf; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 1690 | struct pe_session *session; |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1691 | tSirSmeDeauthRsp *sme_deauth_rsp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1692 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1693 | if (QDF_STATUS_SUCCESS != suspend_status) |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1694 | pe_err("Suspend Status is not success %X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1695 | suspend_status); |
| 1696 | |
| 1697 | mlm_deauth_req = (tLimMlmDeauthReq *) msg_buf; |
| 1698 | session = pe_find_session_by_session_id(mac_ctx, |
| 1699 | mlm_deauth_req->sessionId); |
| 1700 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1701 | pe_err("session does not exist for given sessionId %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1702 | mlm_deauth_req->sessionId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1703 | qdf_mem_free(mlm_deauth_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1704 | return; |
| 1705 | } |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1706 | pe_debug("Process Deauth Req on sessionID %d Systemrole %d" |
| 1707 | "mlmstate %d from: " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1708 | mlm_deauth_req->sessionId, |
| 1709 | GET_LIM_SYSTEM_ROLE(session), |
| 1710 | session->limMlmState, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1711 | MAC_ADDR_ARRAY(mlm_deauth_req->peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1712 | sir_copy_mac_addr(curr_bssId, session->bssId); |
| 1713 | |
| 1714 | switch (GET_LIM_SYSTEM_ROLE(session)) { |
| 1715 | case eLIM_STA_ROLE: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1716 | switch (session->limMlmState) { |
| 1717 | case eLIM_MLM_IDLE_STATE: |
| 1718 | /* |
| 1719 | * Attempting to Deauthenticate with a pre-authenticated |
| 1720 | * peer. Deauthetiate with peer if there exists a |
| 1721 | * pre-auth context below. |
| 1722 | */ |
| 1723 | break; |
| 1724 | case eLIM_MLM_AUTHENTICATED_STATE: |
| 1725 | case eLIM_MLM_WT_ASSOC_RSP_STATE: |
| 1726 | case eLIM_MLM_LINK_ESTABLISHED_STATE: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1727 | if (qdf_mem_cmp(mlm_deauth_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1728 | curr_bssId, QDF_MAC_ADDR_SIZE)) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1729 | pe_err("received MLM_DEAUTH_REQ with invalid BSS id " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1730 | "Peer MAC: "MAC_ADDRESS_STR |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1731 | " CFG BSSID Addr : "MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1732 | MAC_ADDR_ARRAY( |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1733 | mlm_deauth_req->peer_macaddr.bytes), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1734 | MAC_ADDR_ARRAY(curr_bssId)); |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1735 | /* |
| 1736 | * Deauthentication response to host triggered |
| 1737 | * deauthentication |
| 1738 | */ |
| 1739 | sme_deauth_rsp = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1740 | qdf_mem_malloc(sizeof(tSirSmeDeauthRsp)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1741 | if (!sme_deauth_rsp) { |
Vignesh Viswanathan | a842b94 | 2018-02-16 16:02:50 +0530 | [diff] [blame] | 1742 | qdf_mem_free(mlm_deauth_req); |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1743 | return; |
| 1744 | } |
| 1745 | |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1746 | pe_debug("send deauth rsp with ret code %d for" MAC_ADDRESS_STR, |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1747 | eSIR_SME_DEAUTH_STATUS, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1748 | MAC_ADDR_ARRAY( |
| 1749 | mlm_deauth_req->peer_macaddr.bytes)); |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1750 | |
| 1751 | sme_deauth_rsp->messageType = |
| 1752 | eWNI_SME_DEAUTH_RSP; |
| 1753 | sme_deauth_rsp->length = |
| 1754 | sizeof(tSirSmeDeauthRsp); |
| 1755 | sme_deauth_rsp->statusCode = |
| 1756 | eSIR_SME_DEAUTH_STATUS; |
| 1757 | sme_deauth_rsp->sessionId = |
| 1758 | mlm_deauth_req->sessionId; |
| 1759 | sme_deauth_rsp->transactionId = 0; |
| 1760 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1761 | qdf_mem_copy(sme_deauth_rsp->peer_macaddr.bytes, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1762 | mlm_deauth_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1763 | QDF_MAC_ADDR_SIZE); |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1764 | |
| 1765 | msg_buf = (uint32_t *)sme_deauth_rsp; |
| 1766 | |
| 1767 | lim_send_sme_disassoc_deauth_ntf(mac_ctx, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1768 | QDF_STATUS_SUCCESS, msg_buf); |
Vignesh Viswanathan | a842b94 | 2018-02-16 16:02:50 +0530 | [diff] [blame] | 1769 | qdf_mem_free(mlm_deauth_req); |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 1770 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1771 | } |
| 1772 | |
| 1773 | if ((session->limMlmState == |
| 1774 | eLIM_MLM_AUTHENTICATED_STATE) || |
| 1775 | (session->limMlmState == |
| 1776 | eLIM_MLM_WT_ASSOC_RSP_STATE)) { |
| 1777 | /* Send deauth frame to peer entity */ |
| 1778 | lim_send_deauth_mgmt_frame(mac_ctx, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1779 | mlm_deauth_req->reasonCode, |
| 1780 | mlm_deauth_req->peer_macaddr.bytes, |
| 1781 | session, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1782 | /* Prepare and Send LIM_MLM_DEAUTH_CNF */ |
| 1783 | mlm_deauth_cnf.resultCode = eSIR_SME_SUCCESS; |
| 1784 | session->limMlmState = eLIM_MLM_IDLE_STATE; |
| 1785 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 1786 | session->peSessionId, |
| 1787 | session->limMlmState)); |
| 1788 | goto end; |
| 1789 | } |
| 1790 | break; |
| 1791 | default: |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1792 | pe_warn("received MLM_DEAUTH_REQ with in state %d for peer " |
| 1793 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1794 | session->limMlmState, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1795 | MAC_ADDR_ARRAY( |
| 1796 | mlm_deauth_req->peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1797 | lim_print_mlm_state(mac_ctx, LOGW, |
| 1798 | session->limMlmState); |
| 1799 | /* Prepare and Send LIM_MLM_DEAUTH_CNF */ |
| 1800 | mlm_deauth_cnf.resultCode = |
| 1801 | eSIR_SME_STA_NOT_AUTHENTICATED; |
| 1802 | |
| 1803 | goto end; |
| 1804 | } |
| 1805 | break; |
| 1806 | case eLIM_STA_IN_IBSS_ROLE: |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1807 | pe_err("received MLM_DEAUTH_REQ IBSS Mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1808 | mlm_deauth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 1809 | goto end; |
| 1810 | case eLIM_AP_ROLE: |
| 1811 | case eLIM_P2P_DEVICE_GO: |
| 1812 | if (true == |
| 1813 | mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1814 | pe_err("CAC timer is running, drop disassoc from going out"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1815 | mlm_deauth_cnf.resultCode = eSIR_SME_SUCCESS; |
| 1816 | goto end; |
| 1817 | } |
| 1818 | break; |
| 1819 | |
| 1820 | default: |
| 1821 | break; |
| 1822 | } /* end switch (GET_LIM_SYSTEM_ROLE(session)) */ |
| 1823 | |
| 1824 | /* |
| 1825 | * Check if there exists a context for the peer entity |
| 1826 | * to be deauthenticated with. |
| 1827 | */ |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1828 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
| 1829 | mlm_deauth_req->peer_macaddr.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1830 | &aid, &session->dph.dphHashTable); |
| 1831 | |
| 1832 | if (sta_ds == NULL) { |
| 1833 | /* Check if there exists pre-auth context for this STA */ |
| 1834 | auth_node = lim_search_pre_auth_list(mac_ctx, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1835 | mlm_deauth_req->peer_macaddr.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1836 | if (auth_node == NULL) { |
| 1837 | /* |
| 1838 | * Received DEAUTH REQ for a STA that is neither |
| 1839 | * Associated nor Pre-authenticated. Log error, |
| 1840 | * Prepare and Send LIM_MLM_DEAUTH_CNF |
| 1841 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1842 | pe_warn("received MLM_DEAUTH_REQ in mlme state %d for STA that " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1843 | "does not have context, Addr=" |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1844 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1845 | session->limMlmState, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1846 | MAC_ADDR_ARRAY( |
| 1847 | mlm_deauth_req->peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1848 | mlm_deauth_cnf.resultCode = |
| 1849 | eSIR_SME_STA_NOT_AUTHENTICATED; |
| 1850 | } else { |
| 1851 | mlm_deauth_cnf.resultCode = eSIR_SME_SUCCESS; |
| 1852 | /* Delete STA from pre-auth STA list */ |
| 1853 | lim_delete_pre_auth_node(mac_ctx, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1854 | mlm_deauth_req->peer_macaddr.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1855 | /* Send Deauthentication frame to peer entity */ |
| 1856 | lim_send_deauth_mgmt_frame(mac_ctx, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1857 | mlm_deauth_req->reasonCode, |
| 1858 | mlm_deauth_req->peer_macaddr.bytes, |
| 1859 | session, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1860 | } |
| 1861 | goto end; |
| 1862 | } else if ((sta_ds->mlmStaContext.mlmState != |
| 1863 | eLIM_MLM_LINK_ESTABLISHED_STATE) && |
| 1864 | (sta_ds->mlmStaContext.mlmState != |
| 1865 | eLIM_MLM_WT_ASSOC_CNF_STATE)) { |
| 1866 | /* |
| 1867 | * received MLM_DEAUTH_REQ for STA that either has no context or |
| 1868 | * in some transit state |
| 1869 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1870 | pe_warn("Invalid MLM_DEAUTH_REQ, Addr="MAC_ADDRESS_STR, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1871 | MAC_ADDR_ARRAY(mlm_deauth_req->peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1872 | /* Prepare and Send LIM_MLM_DEAUTH_CNF */ |
| 1873 | mlm_deauth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 1874 | goto end; |
| 1875 | } |
| 1876 | /* sta_ds->mlmStaContext.rxPurgeReq = 1; */ |
| 1877 | sta_ds->mlmStaContext.disassocReason = (tSirMacReasonCodes) |
| 1878 | mlm_deauth_req->reasonCode; |
| 1879 | sta_ds->mlmStaContext.cleanupTrigger = mlm_deauth_req->deauthTrigger; |
Vignesh Viswanathan | a842b94 | 2018-02-16 16:02:50 +0530 | [diff] [blame] | 1880 | |
| 1881 | if (mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq) { |
| 1882 | pe_err("pMlmDeauthReq is not NULL, freeing"); |
| 1883 | qdf_mem_free(mac_ctx->lim.limDisassocDeauthCnfReq. |
| 1884 | pMlmDeauthReq); |
| 1885 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1886 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = mlm_deauth_req; |
Vignesh Viswanathan | a842b94 | 2018-02-16 16:02:50 +0530 | [diff] [blame] | 1887 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1888 | /* |
| 1889 | * Set state to mlm State to eLIM_MLM_WT_DEL_STA_RSP_STATE |
| 1890 | * This is to address the issue of race condition between |
| 1891 | * disconnect request from the HDD and disassoc from |
| 1892 | * inactivity timer. This will make sure that we will not |
| 1893 | * process disassoc if deauth is in progress for the station |
| 1894 | * and thus mlmStaContext.cleanupTrigger will not be overwritten. |
| 1895 | */ |
| 1896 | sta_ds->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
| 1897 | /* Send Deauthentication frame to peer entity */ |
| 1898 | lim_send_deauth_mgmt_frame(mac_ctx, mlm_deauth_req->reasonCode, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1899 | mlm_deauth_req->peer_macaddr.bytes, |
| 1900 | session, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1901 | return; |
| 1902 | end: |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1903 | qdf_copy_macaddr(&mlm_deauth_cnf.peer_macaddr, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1904 | &mlm_deauth_req->peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1905 | mlm_deauth_cnf.deauthTrigger = mlm_deauth_req->deauthTrigger; |
| 1906 | mlm_deauth_cnf.aid = mlm_deauth_req->aid; |
| 1907 | mlm_deauth_cnf.sessionId = mlm_deauth_req->sessionId; |
| 1908 | |
| 1909 | /* Free up buffer allocated for mlmDeauthReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1910 | qdf_mem_free(mlm_deauth_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1911 | lim_post_sme_message(mac_ctx, |
| 1912 | LIM_MLM_DEAUTH_CNF, (uint32_t *) &mlm_deauth_cnf); |
| 1913 | } |
| 1914 | |
| 1915 | /* |
| 1916 | * lim_process_deauth_ack_timeout() - wrapper function around |
| 1917 | * lim_send_deauth_cnf |
| 1918 | * |
| 1919 | * @mac_ctx: mac_ctx |
| 1920 | * |
| 1921 | * wrapper function around lim_send_deauth_cnf |
| 1922 | * |
| 1923 | * Return: void |
| 1924 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1925 | void lim_process_deauth_ack_timeout(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1926 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1927 | lim_send_deauth_cnf(mac_ctx); |
| 1928 | } |
| 1929 | |
| 1930 | /* |
| 1931 | * lim_process_mlm_deauth_req() - This function is called to process |
| 1932 | * MLM_DEAUTH_REQ message from SME |
| 1933 | * |
| 1934 | * @mac_ctx: Pointer to Global MAC structure |
| 1935 | * @msg_buf: A pointer to the MLM message buffer |
| 1936 | * |
| 1937 | * This function is called to process MLM_DEAUTH_REQ message from SME |
| 1938 | * |
| 1939 | * @Return: None |
| 1940 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1941 | void lim_process_mlm_deauth_req(struct mac_context *mac_ctx, uint32_t *msg_buf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1942 | { |
| 1943 | tLimMlmDeauthReq *mlm_deauth_req; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 1944 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1945 | |
| 1946 | if (msg_buf == NULL) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1947 | pe_err("Buffer is Pointing to NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1948 | return; |
| 1949 | } |
| 1950 | |
| 1951 | mlm_deauth_req = (tLimMlmDeauthReq *) msg_buf; |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1952 | pe_debug("Process Deauth Req on sessionID %d from: " |
| 1953 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1954 | mlm_deauth_req->sessionId, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 1955 | MAC_ADDR_ARRAY(mlm_deauth_req->peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1956 | |
| 1957 | session = pe_find_session_by_session_id(mac_ctx, |
| 1958 | mlm_deauth_req->sessionId); |
| 1959 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1960 | pe_err("session does not exist for given sessionId %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1961 | mlm_deauth_req->sessionId); |
Krunal Soni | f7387bd | 2017-11-06 15:48:01 -0800 | [diff] [blame] | 1962 | qdf_mem_free(mlm_deauth_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1963 | return; |
| 1964 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1965 | lim_process_mlm_deauth_req_ntf(mac_ctx, QDF_STATUS_SUCCESS, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1966 | (uint32_t *) msg_buf); |
| 1967 | } |
| 1968 | |
| 1969 | /** |
| 1970 | * lim_process_mlm_set_keys_req() - This function is called to process |
| 1971 | * MLM_SETKEYS_REQ message from SME |
| 1972 | * |
| 1973 | * @mac_ctx: Pointer to Global MAC structure |
| 1974 | * @msg_buf: A pointer to the MLM message buffer |
| 1975 | * |
| 1976 | * This function is called to process MLM_SETKEYS_REQ message from SME |
| 1977 | * |
| 1978 | * @Return: None |
| 1979 | */ |
| 1980 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1981 | lim_process_mlm_set_keys_req(struct mac_context *mac_ctx, uint32_t *msg_buf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1982 | { |
| 1983 | uint16_t aid; |
| 1984 | uint16_t sta_idx = 0; |
| 1985 | uint32_t default_key_id = 0; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1986 | struct qdf_mac_addr curr_bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1987 | tpDphHashNode sta_ds; |
| 1988 | tLimMlmSetKeysReq *mlm_set_keys_req; |
| 1989 | tLimMlmSetKeysCnf mlm_set_keys_cnf; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 1990 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1991 | |
| 1992 | if (msg_buf == NULL) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 1993 | pe_err("Buffer is Pointing to NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1994 | return; |
| 1995 | } |
| 1996 | |
| 1997 | mlm_set_keys_req = (tLimMlmSetKeysReq *) msg_buf; |
Jingxiang Ge | 4168a23 | 2018-01-03 18:47:15 +0800 | [diff] [blame] | 1998 | if (mac_ctx->lim.gpLimMlmSetKeysReq != NULL) { |
| 1999 | qdf_mem_free(mac_ctx->lim.gpLimMlmSetKeysReq); |
| 2000 | mac_ctx->lim.gpLimMlmSetKeysReq = NULL; |
| 2001 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2002 | /* Hold onto the SetKeys request parameters */ |
| 2003 | mac_ctx->lim.gpLimMlmSetKeysReq = (void *)mlm_set_keys_req; |
| 2004 | session = pe_find_session_by_session_id(mac_ctx, |
| 2005 | mlm_set_keys_req->sessionId); |
| 2006 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2007 | pe_err("session does not exist for given sessionId"); |
Krunal Soni | 7d78708 | 2017-11-07 10:30:11 -0800 | [diff] [blame] | 2008 | qdf_mem_free(mlm_set_keys_req); |
| 2009 | mac_ctx->lim.gpLimMlmSetKeysReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | return; |
| 2011 | } |
| 2012 | |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2013 | pe_debug("Received MLM_SETKEYS_REQ with parameters:" |
| 2014 | "AID [%d], ED Type [%d], # Keys [%d] & Peer MAC Addr - ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2015 | mlm_set_keys_req->aid, mlm_set_keys_req->edType, |
| 2016 | mlm_set_keys_req->numKeys); |
Srinivas Girigowda | f936d82 | 2017-03-19 23:23:59 -0700 | [diff] [blame] | 2017 | lim_print_mac_addr(mac_ctx, mlm_set_keys_req->peer_macaddr.bytes, LOGD); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2018 | qdf_mem_copy(curr_bssid.bytes, session->bssId, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2019 | |
| 2020 | switch (GET_LIM_SYSTEM_ROLE(session)) { |
| 2021 | case eLIM_STA_ROLE: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2022 | /* |
| 2023 | * In case of TDLS, peerMac address need not be BssId. Skip this |
| 2024 | * check if TDLS is enabled. |
| 2025 | */ |
| 2026 | #ifndef FEATURE_WLAN_TDLS |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 2027 | if ((!qdf_is_macaddr_broadcast( |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 2028 | &mlm_set_keys_req->peer_macaddr)) && |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 2029 | (!qdf_is_macaddr_equal(&mlm_set_keys_req->peer_macaddr, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 2030 | &curr_bssid))) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2031 | pe_debug("Received MLM_SETKEYS_REQ with invalid BSSID" |
| 2032 | MAC_ADDRESS_STR, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 2033 | MAC_ADDR_ARRAY(mlm_set_keys_req-> |
| 2034 | peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2035 | /* |
| 2036 | * Prepare and Send LIM_MLM_SETKEYS_CNF with error code |
| 2037 | */ |
| 2038 | mlm_set_keys_cnf.resultCode = |
| 2039 | eSIR_SME_INVALID_PARAMETERS; |
| 2040 | goto end; |
| 2041 | } |
| 2042 | #endif |
| 2043 | break; |
| 2044 | case eLIM_STA_IN_IBSS_ROLE: |
| 2045 | /* |
| 2046 | * update the IBSS PE session encrption type based on the |
| 2047 | * key type |
| 2048 | */ |
| 2049 | session->encryptType = mlm_set_keys_req->edType; |
| 2050 | break; |
| 2051 | default: |
| 2052 | break; |
| 2053 | } |
| 2054 | |
| 2055 | /* |
| 2056 | * Use the "unicast" parameter to determine if the "Group Keys" |
| 2057 | * are being set. |
| 2058 | * mlm_set_keys_req->key.unicast = 0 -> Multicast/broadcast |
| 2059 | * mlm_set_keys_req->key.unicast - 1 -> Unicast keys are being set |
| 2060 | */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 2061 | if (qdf_is_macaddr_broadcast(&mlm_set_keys_req->peer_macaddr)) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2062 | pe_debug("Trying to set Group Keys...%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2063 | mlm_set_keys_req->sessionId); |
| 2064 | /* |
| 2065 | * When trying to set Group Keys for any security mode other |
| 2066 | * than WEP, use the STA Index corresponding to the AP... |
| 2067 | */ |
| 2068 | switch (mlm_set_keys_req->edType) { |
| 2069 | case eSIR_ED_CCMP: |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 2070 | case eSIR_ED_GCMP: |
| 2071 | case eSIR_ED_GCMP_256: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2072 | #ifdef WLAN_FEATURE_11W |
| 2073 | case eSIR_ED_AES_128_CMAC: |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 2074 | case eSIR_ED_AES_GMAC_128: |
| 2075 | case eSIR_ED_AES_GMAC_256: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2076 | #endif |
| 2077 | sta_idx = session->staId; |
| 2078 | break; |
| 2079 | default: |
| 2080 | break; |
| 2081 | } |
| 2082 | } else { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2083 | pe_debug("Trying to set Unicast Keys..."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2084 | /* |
| 2085 | * Check if there exists a context for the |
| 2086 | * peer entity for which keys need to be set. |
| 2087 | */ |
| 2088 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 2089 | mlm_set_keys_req->peer_macaddr.bytes, &aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2090 | &session->dph.dphHashTable); |
| 2091 | if ((sta_ds == NULL) || |
| 2092 | ((sta_ds->mlmStaContext.mlmState != |
| 2093 | eLIM_MLM_LINK_ESTABLISHED_STATE) && |
| 2094 | !LIM_IS_AP_ROLE(session))) { |
| 2095 | /* |
| 2096 | * Received LIM_MLM_SETKEYS_REQ for STA that does not |
| 2097 | * have context or in some transit state. |
| 2098 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2099 | pe_debug("Invalid MLM_SETKEYS_REQ, Addr = " |
| 2100 | MAC_ADDRESS_STR, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 2101 | MAC_ADDR_ARRAY(mlm_set_keys_req-> |
| 2102 | peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2103 | /* Prepare and Send LIM_MLM_SETKEYS_CNF */ |
| 2104 | mlm_set_keys_cnf.resultCode = |
| 2105 | eSIR_SME_INVALID_PARAMETERS; |
| 2106 | goto end; |
| 2107 | } else { |
| 2108 | sta_idx = sta_ds->staIndex; |
| 2109 | } |
| 2110 | } |
| 2111 | |
| 2112 | if ((mlm_set_keys_req->numKeys == 0) |
| 2113 | && (mlm_set_keys_req->edType != eSIR_ED_NONE)) { |
| 2114 | /* |
| 2115 | * Broadcast/Multicast Keys (for WEP!!) are NOT sent |
| 2116 | * via this interface!! This indicates to HAL that the WEP Keys |
| 2117 | * need to be extracted from the CFG and applied to hardware |
| 2118 | */ |
| 2119 | default_key_id = 0xff; |
| 2120 | } else if (mlm_set_keys_req->key[0].keyId && |
| 2121 | ((mlm_set_keys_req->edType == eSIR_ED_WEP40) || |
| 2122 | (mlm_set_keys_req->edType == eSIR_ED_WEP104))) { |
| 2123 | /* |
| 2124 | * If the Key Id is non zero and encryption mode is WEP, |
| 2125 | * the key index is coming from the upper layers so that key |
| 2126 | * only need to be used as the default tx key, This is being |
| 2127 | * used only in case of WEP mode in HAL |
| 2128 | */ |
| 2129 | default_key_id = mlm_set_keys_req->key[0].keyId; |
| 2130 | } else { |
| 2131 | default_key_id = 0; |
| 2132 | } |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2133 | pe_debug("Trying to set keys for STA Index [%d], using default_key_id [%d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2134 | sta_idx, default_key_id); |
| 2135 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 2136 | if (qdf_is_macaddr_broadcast(&mlm_set_keys_req->peer_macaddr)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2137 | session->limPrevMlmState = session->limMlmState; |
| 2138 | session->limMlmState = eLIM_MLM_WT_SET_BSS_KEY_STATE; |
| 2139 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 2140 | session->peSessionId, session->limMlmState)); |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2141 | pe_debug("Trying to set Group Keys...%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2142 | session->peSessionId); |
| 2143 | /* Package WMA_SET_BSSKEY_REQ message parameters */ |
| 2144 | lim_send_set_bss_key_req(mac_ctx, mlm_set_keys_req, session); |
| 2145 | return; |
| 2146 | } else { |
| 2147 | /* |
| 2148 | * Package WMA_SET_STAKEY_REQ / WMA_SET_STA_BCASTKEY_REQ message |
| 2149 | * parameters |
| 2150 | */ |
| 2151 | lim_send_set_sta_key_req(mac_ctx, mlm_set_keys_req, sta_idx, |
| 2152 | (uint8_t) default_key_id, session, |
| 2153 | true); |
| 2154 | return; |
| 2155 | } |
| 2156 | end: |
| 2157 | mlm_set_keys_cnf.sessionId = mlm_set_keys_req->sessionId; |
| 2158 | lim_post_sme_set_keys_cnf(mac_ctx, mlm_set_keys_req, &mlm_set_keys_cnf); |
| 2159 | } |
Sandeep Puligilla | 06ae890 | 2018-04-16 19:02:47 -0700 | [diff] [blame] | 2160 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2161 | void lim_process_join_failure_timeout(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2162 | { |
| 2163 | tLimMlmJoinCnf mlm_join_cnf; |
| 2164 | uint32_t len; |
| 2165 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 2166 | host_log_rssi_pkt_type *rssi_log = NULL; |
| 2167 | #endif |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 2168 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2169 | |
| 2170 | session = pe_find_session_by_session_id(mac_ctx, |
| 2171 | mac_ctx->lim.limTimers.gLimJoinFailureTimer.sessionId); |
| 2172 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2173 | pe_err("Session Does not exist for given sessionID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2174 | return; |
| 2175 | } |
| 2176 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 2177 | WLAN_HOST_DIAG_LOG_ALLOC(rssi_log, |
| 2178 | host_log_rssi_pkt_type, LOG_WLAN_RSSI_UPDATE_C); |
| 2179 | if (rssi_log) |
| 2180 | rssi_log->rssi = session->rssi; |
| 2181 | WLAN_HOST_DIAG_LOG_REPORT(rssi_log); |
| 2182 | #endif |
| 2183 | |
| 2184 | if (session->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE) { |
| 2185 | len = sizeof(tSirMacAddr); |
| 2186 | /* Change timer for future activations */ |
| 2187 | lim_deactivate_and_change_timer(mac_ctx, eLIM_JOIN_FAIL_TIMER); |
| 2188 | /* Change Periodic probe req timer for future activation */ |
| 2189 | lim_deactivate_and_change_timer(mac_ctx, |
| 2190 | eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); |
| 2191 | /* Issue MLM join confirm with timeout reason code */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2192 | pe_err("Join Failure Timeout, In eLIM_MLM_WT_JOIN_BEACON_STATE session:%d " |
| 2193 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2194 | session->peSessionId, MAC_ADDR_ARRAY(session->bssId)); |
| 2195 | |
| 2196 | mlm_join_cnf.resultCode = eSIR_SME_JOIN_TIMEOUT_RESULT_CODE; |
| 2197 | mlm_join_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2198 | session->limMlmState = eLIM_MLM_IDLE_STATE; |
| 2199 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 2200 | session->peSessionId, session->limMlmState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2201 | /* Update PE session Id */ |
| 2202 | mlm_join_cnf.sessionId = session->peSessionId; |
| 2203 | /* Freeup buffer allocated to join request */ |
| 2204 | if (session->pLimMlmJoinReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2205 | qdf_mem_free(session->pLimMlmJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2206 | session->pLimMlmJoinReq = NULL; |
| 2207 | } |
| 2208 | lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, |
| 2209 | (uint32_t *) &mlm_join_cnf); |
| 2210 | return; |
| 2211 | } else { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2212 | pe_warn("received unexpected JOIN failure timeout in state %X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2213 | session->limMlmState); |
| 2214 | lim_print_mlm_state(mac_ctx, LOGW, session->limMlmState); |
| 2215 | } |
| 2216 | } |
| 2217 | |
| 2218 | /** |
| 2219 | * lim_process_periodic_join_probe_req_timer() - This function is called to |
| 2220 | * process periodic probe request send during joining process. |
| 2221 | * |
| 2222 | * @mac_ctx: Pointer to Global MAC structure |
| 2223 | * |
| 2224 | * This function is called to process periodic probe request send during |
| 2225 | * joining process. |
| 2226 | * |
| 2227 | * @Return None |
| 2228 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2229 | static void lim_process_periodic_join_probe_req_timer(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2230 | { |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 2231 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2232 | tSirMacSSid ssid; |
| 2233 | |
| 2234 | session = pe_find_session_by_session_id(mac_ctx, |
| 2235 | mac_ctx->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId); |
| 2236 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2237 | pe_err("session does not exist for given SessionId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2238 | mac_ctx->lim.limTimers.gLimPeriodicJoinProbeReqTimer. |
| 2239 | sessionId); |
| 2240 | return; |
| 2241 | } |
| 2242 | |
| 2243 | if ((true == |
| 2244 | tx_timer_running(&mac_ctx->lim.limTimers.gLimJoinFailureTimer)) |
| 2245 | && (session->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2246 | qdf_mem_copy(ssid.ssId, session->ssId.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2247 | session->ssId.length); |
| 2248 | ssid.length = session->ssId.length; |
| 2249 | lim_send_probe_req_mgmt_frame(mac_ctx, &ssid, |
| 2250 | session->pLimMlmJoinReq->bssDescription.bssId, |
| 2251 | session->currentOperChannel /*chanNum */, |
| 2252 | session->selfMacAddr, session->dot11mode, |
Sandeep Puligilla | 06ae890 | 2018-04-16 19:02:47 -0700 | [diff] [blame] | 2253 | &session->pLimJoinReq->addIEScan.length, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2254 | session->pLimJoinReq->addIEScan.addIEdata); |
| 2255 | lim_deactivate_and_change_timer(mac_ctx, |
| 2256 | eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); |
| 2257 | /* Activate Join Periodic Probe Req timer */ |
| 2258 | if (tx_timer_activate( |
| 2259 | &mac_ctx->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != |
| 2260 | TX_SUCCESS) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2261 | pe_warn("could not activate Periodic Join req failure timer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2262 | return; |
| 2263 | } |
| 2264 | } |
| 2265 | } |
| 2266 | |
| 2267 | /** |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2268 | * lim_process_auth_retry_timer()- function to Retry Auth |
| 2269 | * @mac_ctx:pointer to global mac |
| 2270 | * |
| 2271 | * Return: void |
| 2272 | */ |
| 2273 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2274 | static void lim_process_auth_retry_timer(struct mac_context *mac_ctx) |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2275 | { |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 2276 | struct pe_session * session_entry; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2277 | |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2278 | session_entry = |
| 2279 | pe_find_session_by_session_id(mac_ctx, |
| 2280 | mac_ctx->lim.limTimers.g_lim_periodic_auth_retry_timer.sessionId); |
| 2281 | if (NULL == session_entry) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2282 | pe_err("session does not exist for given SessionId: %d", |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2283 | mac_ctx->lim.limTimers. |
| 2284 | g_lim_periodic_auth_retry_timer.sessionId); |
| 2285 | return; |
| 2286 | } |
| 2287 | |
| 2288 | if (tx_timer_running(&mac_ctx->lim.limTimers.gLimAuthFailureTimer) && |
| 2289 | (session_entry->limMlmState == eLIM_MLM_WT_AUTH_FRAME2_STATE) && |
| 2290 | (LIM_AUTH_ACK_RCD_SUCCESS != mac_ctx->auth_ack_status)) { |
| 2291 | tSirMacAuthFrameBody auth_frame; |
| 2292 | |
| 2293 | /* |
| 2294 | * Send the auth retry only in case we have received ack failure |
| 2295 | * else just restart the retry timer. |
| 2296 | */ |
| 2297 | if (LIM_AUTH_ACK_RCD_FAILURE == mac_ctx->auth_ack_status) { |
| 2298 | /* Prepare & send Authentication frame */ |
| 2299 | auth_frame.authAlgoNumber = |
| 2300 | (uint8_t) mac_ctx->lim.gpLimMlmAuthReq->authType; |
| 2301 | auth_frame.authTransactionSeqNumber = |
| 2302 | SIR_MAC_AUTH_FRAME_1; |
| 2303 | auth_frame.authStatusCode = 0; |
Tushnim Bhattacharyya | 332b74c | 2018-08-10 10:55:51 -0700 | [diff] [blame] | 2304 | pe_debug("Retry Auth"); |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2305 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2306 | lim_increase_fils_sequence_number(session_entry); |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2307 | lim_send_auth_mgmt_frame(mac_ctx, |
| 2308 | &auth_frame, |
| 2309 | mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr, |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2310 | LIM_NO_WEP_IN_FC, session_entry); |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2311 | } |
| 2312 | |
| 2313 | lim_deactivate_and_change_timer(mac_ctx, eLIM_AUTH_RETRY_TIMER); |
| 2314 | |
| 2315 | /* Activate Auth Retry timer */ |
| 2316 | if (tx_timer_activate |
| 2317 | (&mac_ctx->lim.limTimers.g_lim_periodic_auth_retry_timer) |
| 2318 | != TX_SUCCESS) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2319 | pe_err("could not activate Auth Retry failure timer"); |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2320 | return; |
| 2321 | } |
| 2322 | } |
| 2323 | return; |
| 2324 | } /*** lim_process_auth_retry_timer() ***/ |
| 2325 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2326 | void lim_process_auth_failure_timeout(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2327 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2328 | /* fetch the pe_session based on the sessionId */ |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 2329 | struct pe_session *session; |
Arif Hussain | 43e0971 | 2018-09-18 19:31:57 -0700 | [diff] [blame] | 2330 | uint32_t val; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2331 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 2332 | host_log_rssi_pkt_type *rssi_log = NULL; |
| 2333 | #endif |
| 2334 | |
| 2335 | session = pe_find_session_by_session_id(mac_ctx, |
| 2336 | mac_ctx->lim.limTimers.gLimAuthFailureTimer.sessionId); |
| 2337 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2338 | pe_err("Session Does not exist for given sessionID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2339 | return; |
| 2340 | } |
| 2341 | |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2342 | pe_warn("received AUTH failure timeout in sessionid %d " |
| 2343 | "limMlmstate %X limSmeState %X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2344 | session->peSessionId, session->limMlmState, |
| 2345 | session->limSmeState); |
| 2346 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
Padma, Santhosh Kumar | e783565 | 2016-08-10 19:11:40 +0530 | [diff] [blame] | 2347 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_TIMEOUT, session, |
| 2348 | 0, AUTH_FAILURE_TIMEOUT); |
| 2349 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2350 | WLAN_HOST_DIAG_LOG_ALLOC(rssi_log, host_log_rssi_pkt_type, |
| 2351 | LOG_WLAN_RSSI_UPDATE_C); |
| 2352 | if (rssi_log) |
| 2353 | rssi_log->rssi = session->rssi; |
| 2354 | WLAN_HOST_DIAG_LOG_REPORT(rssi_log); |
| 2355 | #endif |
| 2356 | |
| 2357 | switch (session->limMlmState) { |
| 2358 | case eLIM_MLM_WT_AUTH_FRAME2_STATE: |
| 2359 | case eLIM_MLM_WT_AUTH_FRAME4_STATE: |
| 2360 | /* |
| 2361 | * Requesting STA did not receive next auth frame before Auth |
| 2362 | * Failure timeout. Issue MLM auth confirm with timeout reason |
| 2363 | * code. Restore default failure timeout |
| 2364 | */ |
Arif Hussain | 43e0971 | 2018-09-18 19:31:57 -0700 | [diff] [blame] | 2365 | if (QDF_P2P_CLIENT_MODE == session->pePersona && |
| 2366 | session->defaultAuthFailureTimeout) { |
| 2367 | if (cfg_in_range(CFG_AUTH_FAILURE_TIMEOUT, |
| 2368 | session->defaultAuthFailureTimeout)) { |
| 2369 | val = session->defaultAuthFailureTimeout; |
| 2370 | } else { |
| 2371 | val = cfg_default(CFG_AUTH_FAILURE_TIMEOUT); |
| 2372 | session->defaultAuthFailureTimeout = val; |
| 2373 | } |
| 2374 | mac_ctx->mlme_cfg->timeouts.auth_failure_timeout = val; |
| 2375 | } |
| 2376 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2377 | lim_restore_from_auth_state(mac_ctx, |
| 2378 | eSIR_SME_AUTH_TIMEOUT_RESULT_CODE, |
| 2379 | eSIR_MAC_UNSPEC_FAILURE_REASON, session); |
| 2380 | break; |
| 2381 | default: |
| 2382 | /* |
| 2383 | * Auth failure timer should not have timed out |
| 2384 | * in states other than wt_auth_frame2/4 |
| 2385 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2386 | pe_err("received unexpected AUTH failure timeout in state %X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2387 | session->limMlmState); |
| 2388 | lim_print_mlm_state(mac_ctx, LOGE, session->limMlmState); |
| 2389 | break; |
| 2390 | } |
| 2391 | } |
| 2392 | |
| 2393 | /** |
| 2394 | * lim_process_auth_rsp_timeout() - This function is called to process Min |
| 2395 | * Channel Timeout during channel scan. |
| 2396 | * |
| 2397 | * @mac_ctx: Pointer to Global MAC structure |
| 2398 | * |
| 2399 | * This function is called to process Min Channel Timeout during channel scan. |
| 2400 | * |
| 2401 | * @Return: None |
| 2402 | */ |
| 2403 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2404 | lim_process_auth_rsp_timeout(struct mac_context *mac_ctx, uint32_t auth_idx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2405 | { |
| 2406 | struct tLimPreAuthNode *auth_node; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 2407 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2408 | uint8_t session_id; |
| 2409 | |
| 2410 | auth_node = lim_get_pre_auth_node_from_index(mac_ctx, |
| 2411 | &mac_ctx->lim.gLimPreAuthTimerTable, auth_idx); |
| 2412 | if (NULL == auth_node) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2413 | pe_warn("Invalid auth node"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2414 | return; |
| 2415 | } |
| 2416 | |
| 2417 | session = pe_find_session_by_bssid(mac_ctx, auth_node->peerMacAddr, |
| 2418 | &session_id); |
| 2419 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2420 | pe_warn("session does not exist for given BSSID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2421 | return; |
| 2422 | } |
| 2423 | |
Padma, Santhosh Kumar | e783565 | 2016-08-10 19:11:40 +0530 | [diff] [blame] | 2424 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 2425 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_TIMEOUT, |
| 2426 | session, 0, AUTH_RESPONSE_TIMEOUT); |
| 2427 | #endif |
| 2428 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2429 | if (LIM_IS_AP_ROLE(session) || LIM_IS_IBSS_ROLE(session)) { |
| 2430 | if (auth_node->mlmState != eLIM_MLM_WT_AUTH_FRAME3_STATE) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2431 | pe_err("received AUTH rsp timeout in unexpected " |
| 2432 | "state for MAC address: " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2433 | MAC_ADDR_ARRAY(auth_node->peerMacAddr)); |
| 2434 | } else { |
| 2435 | auth_node->mlmState = eLIM_MLM_AUTH_RSP_TIMEOUT_STATE; |
| 2436 | auth_node->fTimerStarted = 0; |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2437 | pe_debug("AUTH rsp timedout for MAC address " |
| 2438 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2439 | MAC_ADDR_ARRAY(auth_node->peerMacAddr)); |
| 2440 | /* Change timer to reactivate it in future */ |
| 2441 | lim_deactivate_and_change_per_sta_id_timer(mac_ctx, |
| 2442 | eLIM_AUTH_RSP_TIMER, auth_node->authNodeIdx); |
| 2443 | lim_delete_pre_auth_node(mac_ctx, |
| 2444 | auth_node->peerMacAddr); |
| 2445 | } |
| 2446 | } |
| 2447 | } |
| 2448 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2449 | void lim_process_assoc_failure_timeout(struct mac_context *mac_ctx, |
Abhishek Singh | 6a73017 | 2017-12-29 14:07:21 +0530 | [diff] [blame] | 2450 | uint32_t msg_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2451 | { |
| 2452 | |
| 2453 | tLimMlmAssocCnf mlm_assoc_cnf; |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 2454 | struct pe_session *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2455 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 2456 | host_log_rssi_pkt_type *rssi_log = NULL; |
| 2457 | #endif |
| 2458 | /* |
| 2459 | * to fetch the lim/mlm state based on the session_id, use the |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2460 | * below pe_session |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2461 | */ |
| 2462 | uint8_t session_id; |
| 2463 | |
| 2464 | if (msg_type == LIM_ASSOC) |
| 2465 | session_id = |
| 2466 | mac_ctx->lim.limTimers.gLimAssocFailureTimer.sessionId; |
| 2467 | else |
| 2468 | session_id = |
| 2469 | mac_ctx->lim.limTimers.gLimReassocFailureTimer.sessionId; |
| 2470 | |
| 2471 | session = pe_find_session_by_session_id(mac_ctx, session_id); |
| 2472 | if (NULL == session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2473 | pe_err("Session Does not exist for given sessionID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2474 | return; |
| 2475 | } |
| 2476 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
Padma, Santhosh Kumar | e783565 | 2016-08-10 19:11:40 +0530 | [diff] [blame] | 2477 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_TIMEOUT, |
| 2478 | session, 0, 0); |
| 2479 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2480 | WLAN_HOST_DIAG_LOG_ALLOC(rssi_log, |
| 2481 | host_log_rssi_pkt_type, |
| 2482 | LOG_WLAN_RSSI_UPDATE_C); |
| 2483 | if (rssi_log) |
| 2484 | rssi_log->rssi = session->rssi; |
| 2485 | WLAN_HOST_DIAG_LOG_REPORT(rssi_log); |
| 2486 | #endif |
| 2487 | |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2488 | pe_debug("Re/Association Response not received before timeout"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2489 | |
Abhishek Singh | e36aa82 | 2016-04-27 16:55:43 +0530 | [diff] [blame] | 2490 | /* |
| 2491 | * Send Deauth to handle the scenareo where association timeout happened |
| 2492 | * when device has missed the assoc resp sent by peer. |
| 2493 | * By sending deauth try to clear the session created on peer device. |
| 2494 | */ |
Tushnim Bhattacharyya | 332b74c | 2018-08-10 10:55:51 -0700 | [diff] [blame] | 2495 | pe_debug("Sessionid: %d try sending deauth on channel %d to BSSID: " |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2496 | MAC_ADDRESS_STR, session->peSessionId, |
Abhishek Singh | e36aa82 | 2016-04-27 16:55:43 +0530 | [diff] [blame] | 2497 | session->currentOperChannel, |
| 2498 | MAC_ADDR_ARRAY(session->bssId)); |
| 2499 | lim_send_deauth_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_REASON, |
| 2500 | session->bssId, session, false); |
| 2501 | |
Rajeev Kumar | aa262c4 | 2016-04-15 15:41:08 -0700 | [diff] [blame] | 2502 | if ((LIM_IS_AP_ROLE(session)) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2503 | ((session->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE) && |
| 2504 | (session->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE) && |
| 2505 | (session->limMlmState != eLIM_MLM_WT_FT_REASSOC_RSP_STATE))) { |
| 2506 | /* |
| 2507 | * Re/Assoc failure timer should not have timedout on AP |
| 2508 | * or in a state other than wt_re/assoc_response. |
| 2509 | */ |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2510 | pe_warn("received unexpected REASSOC failure timeout in state %X for role %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2511 | session->limMlmState, |
| 2512 | GET_LIM_SYSTEM_ROLE(session)); |
| 2513 | lim_print_mlm_state(mac_ctx, LOGW, session->limMlmState); |
| 2514 | return; |
| 2515 | } |
| 2516 | |
| 2517 | if ((msg_type == LIM_ASSOC) || ((msg_type == LIM_REASSOC) |
| 2518 | && (session->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE))) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2519 | pe_err("(Re)Assoc Failure Timeout occurred"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2520 | session->limMlmState = eLIM_MLM_IDLE_STATE; |
| 2521 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 2522 | session->peSessionId, session->limMlmState)); |
| 2523 | /* Change timer for future activations */ |
| 2524 | lim_deactivate_and_change_timer(mac_ctx, eLIM_ASSOC_FAIL_TIMER); |
| 2525 | /* |
| 2526 | * Free up buffer allocated for JoinReq held by |
| 2527 | * MLM state machine |
| 2528 | */ |
| 2529 | if (session->pLimMlmJoinReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2530 | qdf_mem_free(session->pLimMlmJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2531 | session->pLimMlmJoinReq = NULL; |
| 2532 | } |
| 2533 | /* To remove the preauth node in case of fail to associate */ |
| 2534 | if (lim_search_pre_auth_list(mac_ctx, session->bssId)) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2535 | pe_debug("delete pre auth node for "MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2536 | MAC_ADDR_ARRAY(session->bssId)); |
| 2537 | lim_delete_pre_auth_node(mac_ctx, |
| 2538 | session->bssId); |
| 2539 | } |
| 2540 | |
| 2541 | mlm_assoc_cnf.resultCode = eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE; |
| 2542 | mlm_assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2543 | /* Update PE session Id */ |
| 2544 | mlm_assoc_cnf.sessionId = session->peSessionId; |
| 2545 | if (msg_type == LIM_ASSOC) { |
| 2546 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, |
| 2547 | (uint32_t *) &mlm_assoc_cnf); |
| 2548 | } else { |
| 2549 | /* |
| 2550 | * Will come here only in case of 11r, Ese FT |
| 2551 | * when reassoc rsp is not received and we |
| 2552 | * receive a reassoc - timesout |
| 2553 | */ |
| 2554 | mlm_assoc_cnf.resultCode = |
| 2555 | eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE; |
| 2556 | lim_post_sme_message(mac_ctx, LIM_MLM_REASSOC_CNF, |
| 2557 | (uint32_t *) &mlm_assoc_cnf); |
| 2558 | } |
| 2559 | } else { |
| 2560 | /* |
| 2561 | * Restore pre-reassoc req state. |
| 2562 | * Set BSSID to currently associated AP address. |
| 2563 | */ |
| 2564 | session->limMlmState = session->limPrevMlmState; |
| 2565 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 2566 | session->peSessionId, session->limMlmState)); |
| 2567 | lim_restore_pre_reassoc_state(mac_ctx, |
| 2568 | eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE, |
| 2569 | eSIR_MAC_UNSPEC_FAILURE_STATUS, session); |
| 2570 | } |
| 2571 | } |
| 2572 | |
| 2573 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2574 | * lim_set_channel() - set channel api for lim |
| 2575 | * |
| 2576 | * @mac_ctx: Pointer to Global MAC structure |
| 2577 | * @channel: power save state |
| 2578 | * @ch_center_freq_seg0: center freq seq 0 |
| 2579 | * @ch_center_freq_seg1: center freq seq 1 |
| 2580 | * @ch_width: channel width |
| 2581 | * @max_tx_power: max tx power |
| 2582 | * @pe_session_id: pe session id |
| 2583 | * |
| 2584 | * set channel api for lim |
| 2585 | * |
| 2586 | * @Return: None |
| 2587 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2588 | void lim_set_channel(struct mac_context *mac_ctx, uint8_t channel, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2589 | uint8_t ch_center_freq_seg0, uint8_t ch_center_freq_seg1, |
Kiran Kumar Lokere | 1364467 | 2016-02-29 15:40:10 -0800 | [diff] [blame] | 2590 | enum phy_ch_width ch_width, int8_t max_tx_power, |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 2591 | uint8_t pe_session_id, uint32_t cac_duration_ms, |
| 2592 | uint32_t dfs_regdomain) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2593 | { |
Jeff Johnson | a7071e6 | 2018-11-18 22:55:45 -0800 | [diff] [blame] | 2594 | struct pe_session *pe_session; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 2595 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2596 | pe_session = pe_find_session_by_session_id(mac_ctx, pe_session_id); |
| 2597 | |
| 2598 | if (NULL == pe_session) { |
Srinivas Girigowda | f5b000d | 2017-03-26 18:30:59 -0700 | [diff] [blame] | 2599 | pe_err("Invalid PE session: %d", pe_session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2600 | return; |
| 2601 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2602 | lim_send_switch_chnl_params(mac_ctx, channel, ch_center_freq_seg0, |
| 2603 | ch_center_freq_seg1, ch_width, |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 2604 | max_tx_power, pe_session_id, false, |
| 2605 | cac_duration_ms, dfs_regdomain); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2606 | } |