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