Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Sandeep Puligilla | 4d976b6 | 2017-01-06 17:38:45 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-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 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 28 | /* |
| 29 | * DOC: csr_api_roam.c |
| 30 | * |
| 31 | * Implementation for the Common Roaming interfaces. |
| 32 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 33 | #include "ani_global.h" /* for tpAniSirGlobal */ |
| 34 | #include "wma_types.h" |
| 35 | #include "wma_if.h" /* for STA_INVALID_IDX. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 36 | #include "csr_inside_api.h" |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 37 | #include "sme_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 38 | #include "sme_qos_internal.h" |
| 39 | #include "sme_inside.h" |
| 40 | #include "host_diag_core_event.h" |
| 41 | #include "host_diag_core_log.h" |
| 42 | #include "csr_api.h" |
| 43 | #include "csr_internal.h" |
| 44 | #include "cds_reg_service.h" |
| 45 | #include "mac_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "csr_neighbor_roam.h" |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 47 | #include "cds_regdomain.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include "cds_utils.h" |
| 49 | #include "sir_types.h" |
| 50 | #include "cfg_api.h" |
| 51 | #include "sme_power_save_api.h" |
| 52 | #include "wma.h" |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 53 | #include "wlan_policy_mgr_api.h" |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 54 | #include "sme_nan_datapath.h" |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 55 | #include "pld_common.h" |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 56 | #include "wlan_reg_services_api.h" |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 57 | #include <wlan_logging_sock_svc.h> |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 58 | #include "wlan_objmgr_psoc_obj.h" |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 59 | #include <wlan_scan_ucfg_api.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 60 | |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 61 | #define MAX_PWR_FCC_CHAN_12 8 |
| 62 | #define MAX_PWR_FCC_CHAN_13 2 |
| 63 | |
Sandeep Puligilla | 80038de | 2017-05-10 10:43:29 -0700 | [diff] [blame] | 64 | #define CSR_NUM_IBSS_START_CHAN_50 5 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 65 | #define CSR_NUM_IBSS_START_CHANNELS_24 3 |
Agrawal Ashish | 71afe14 | 2017-04-27 14:38:52 +0530 | [diff] [blame] | 66 | /* 75 seconds, for WPA, WPA2, CCKM */ |
| 67 | #define CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD (75 * QDF_MC_TIMER_TO_SEC_UNIT) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 68 | /* 120 seconds, for WPS */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 69 | #define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD (120 * QDF_MC_TIMER_TO_SEC_UNIT) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 71 | /* OBIWAN recommends [8 10]% : pick 9% */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 72 | #define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9 |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 73 | /* OBIWAN recommends -85dBm */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 74 | #define CSR_VCC_RSSI_THRESHOLD 80 |
| 75 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD 500 /* ms */ |
| 76 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 /* ms */ |
| 77 | #define CSR_MIN_TL_STAT_QUERY_PERIOD 500 /* ms */ |
| 78 | /* Flag to send/do not send disassoc frame over the air */ |
| 79 | #define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1 |
| 80 | #define RSSI_HACK_BMPS (-40) |
| 81 | #define MAX_CB_VALUE_IN_INI (2) |
| 82 | |
| 83 | #define MAX_SOCIAL_CHANNELS 3 |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 84 | |
| 85 | /* packet dump timer duration of 60 secs */ |
| 86 | #define PKT_DUMP_TIMER_DURATION 60 |
| 87 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 88 | /* Choose the largest possible value that can be accomodates in 8 bit signed */ |
| 89 | /* variable. */ |
| 90 | #define SNR_HACK_BMPS (127) |
| 91 | |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 92 | /* |
| 93 | * ROAMING_OFFLOAD_TIMER_START - Indicates the action to start the timer |
| 94 | * ROAMING_OFFLOAD_TIMER_STOP - Indicates the action to stop the timer |
| 95 | * CSR_ROAMING_OFFLOAD_TIMEOUT_PERIOD - Timeout value for roaming offload timer |
| 96 | */ |
| 97 | #define ROAMING_OFFLOAD_TIMER_START 1 |
| 98 | #define ROAMING_OFFLOAD_TIMER_STOP 2 |
| 99 | #define CSR_ROAMING_OFFLOAD_TIMEOUT_PERIOD (5 * QDF_MC_TIMER_TO_SEC_UNIT) |
| 100 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 101 | /* Static Type declarations */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 102 | static tCsrRoamSession csr_roam_roam_session[CSR_ROAM_SESSION_MAX]; |
| 103 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 104 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 105 | int diag_auth_type_from_csr_type(eCsrAuthType authType) |
| 106 | { |
| 107 | int n = AUTH_OPEN; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 108 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 109 | switch (authType) { |
| 110 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 111 | n = AUTH_SHARED; |
| 112 | break; |
| 113 | case eCSR_AUTH_TYPE_WPA: |
| 114 | n = AUTH_WPA_EAP; |
| 115 | break; |
| 116 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 117 | n = AUTH_WPA_PSK; |
| 118 | break; |
| 119 | case eCSR_AUTH_TYPE_RSN: |
| 120 | #ifdef WLAN_FEATURE_11W |
| 121 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 122 | #endif |
| 123 | n = AUTH_WPA2_EAP; |
| 124 | break; |
| 125 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 126 | #ifdef WLAN_FEATURE_11W |
| 127 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 128 | #endif |
| 129 | n = AUTH_WPA2_PSK; |
| 130 | break; |
| 131 | #ifdef FEATURE_WLAN_WAPI |
| 132 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 133 | n = AUTH_WAPI_CERT; |
| 134 | break; |
| 135 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 136 | n = AUTH_WAPI_PSK; |
| 137 | break; |
| 138 | #endif /* FEATURE_WLAN_WAPI */ |
| 139 | default: |
| 140 | break; |
| 141 | } |
| 142 | return n; |
| 143 | } |
| 144 | |
| 145 | int diag_enc_type_from_csr_type(eCsrEncryptionType encType) |
| 146 | { |
| 147 | int n = ENC_MODE_OPEN; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 148 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 149 | switch (encType) { |
| 150 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 151 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 152 | n = ENC_MODE_WEP40; |
| 153 | break; |
| 154 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 155 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 156 | n = ENC_MODE_WEP104; |
| 157 | break; |
| 158 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 159 | n = ENC_MODE_TKIP; |
| 160 | break; |
| 161 | case eCSR_ENCRYPT_TYPE_AES: |
| 162 | n = ENC_MODE_AES; |
| 163 | break; |
| 164 | #ifdef FEATURE_WLAN_WAPI |
| 165 | case eCSR_ENCRYPT_TYPE_WPI: |
| 166 | n = ENC_MODE_SMS4; |
| 167 | break; |
| 168 | #endif /* FEATURE_WLAN_WAPI */ |
| 169 | default: |
| 170 | break; |
| 171 | } |
| 172 | return n; |
| 173 | } |
| 174 | #endif /* #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 175 | static const uint8_t |
Sandeep Puligilla | 80038de | 2017-05-10 10:43:29 -0700 | [diff] [blame] | 176 | csr_start_ibss_channels50[CSR_NUM_IBSS_START_CHAN_50] = { 36, 44, 52, 56, 140 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 177 | static const uint8_t |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 178 | csr_start_ibss_channels24[CSR_NUM_IBSS_START_CHANNELS_24] = { 1, 6, 11 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 179 | static void init_config_param(tpAniSirGlobal pMac); |
| 180 | static bool csr_roam_process_results(tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 181 | eCsrRoamCompleteResult Result, |
| 182 | void *Context); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 183 | static QDF_STATUS csr_roam_start_ibss(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 184 | tCsrRoamProfile *pProfile, |
| 185 | bool *pfSameIbss); |
| 186 | static void csr_roam_update_connected_profile_from_new_bss(tpAniSirGlobal pMac, |
| 187 | uint32_t sessionId, |
| 188 | tSirSmeNewBssInfo * |
| 189 | pNewBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 190 | static ePhyChanBondState csr_get_cb_mode_from_ies(tpAniSirGlobal pMac, |
| 191 | uint8_t primaryChn, |
| 192 | tDot11fBeaconIEs *pIes); |
| 193 | |
| 194 | static void csr_roaming_state_config_cnf_processor(tpAniSirGlobal pMac, |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 195 | tSmeCmd *pCommand, uint32_t result, uint8_t session_id); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 196 | static QDF_STATUS csr_roam_open(tpAniSirGlobal pMac); |
| 197 | static QDF_STATUS csr_roam_close(tpAniSirGlobal pMac); |
| 198 | static bool csr_roam_is_same_profile_keys(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 199 | tCsrRoamConnectedProfile *pConnProfile, |
| 200 | tCsrRoamProfile *pProfile2); |
| 201 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 202 | static QDF_STATUS csr_roam_start_roaming_timer(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 203 | uint32_t sessionId, |
| 204 | uint32_t interval); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 205 | static QDF_STATUS csr_roam_stop_roaming_timer(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 206 | uint32_t sessionId); |
| 207 | static void csr_roam_roaming_timer_handler(void *pv); |
Yingying Tang | 87f0139 | 2017-03-22 17:29:54 +0800 | [diff] [blame] | 208 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 209 | static void csr_roam_roaming_offload_timer_action(tpAniSirGlobal mac_ctx, |
| 210 | uint32_t interval, uint8_t session_id, uint8_t action); |
Yingying Tang | 87f0139 | 2017-03-22 17:29:54 +0800 | [diff] [blame] | 211 | #endif |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 212 | static void csr_roam_roaming_offload_timeout_handler(void *timer_data); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 213 | static QDF_STATUS csr_roam_start_wait_for_key_timer(tpAniSirGlobal pMac, |
| 214 | uint32_t interval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 215 | static void csr_roam_wait_for_key_time_out_handler(void *pv); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 216 | static QDF_STATUS csr_init11d_info(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
| 217 | static QDF_STATUS csr_init_channel_power_list(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 218 | tCsr11dinfo *ps11dinfo); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 219 | static QDF_STATUS csr_roam_free_connected_info(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 220 | tCsrRoamConnectedInfo * |
| 221 | pConnectedInfo); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 222 | static QDF_STATUS csr_send_mb_set_context_req_msg(tpAniSirGlobal pMac, |
| 223 | uint32_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 224 | struct qdf_mac_addr peer_macaddr, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 225 | uint8_t numKeys, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 226 | tAniEdType edType, bool fUnicast, |
| 227 | tAniKeyDirection aniKeyDirection, |
| 228 | uint8_t keyId, uint8_t keyLength, |
| 229 | uint8_t *pKey, uint8_t paeRole, |
| 230 | uint8_t *pKeyRsc); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 231 | static void csr_roam_link_up(tpAniSirGlobal pMac, struct qdf_mac_addr bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 232 | static void csr_roam_link_down(tpAniSirGlobal pMac, uint32_t sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 233 | static QDF_STATUS csr_send_mb_stats_req_msg(tpAniSirGlobal pMac, |
| 234 | uint32_t statsMask, uint8_t staId, |
| 235 | uint8_t sessionId); |
| 236 | /* pStaEntry is no longer invalid upon the return of this function. */ |
| 237 | static void csr_roam_remove_stat_list_entry(tpAniSirGlobal pMac, |
| 238 | tListElem *pEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 239 | static eCsrCfgDot11Mode csr_roam_get_phy_mode_band_for_bss(tpAniSirGlobal pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 240 | tCsrRoamProfile *pProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 241 | uint8_t operationChn, |
| 242 | eCsrBand *pBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 243 | static QDF_STATUS csr_roam_get_qos_info_from_bss(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 244 | tSirBssDescription *pBssDesc); |
| 245 | tCsrStatsClientReqInfo *csr_roam_insert_entry_into_list(tpAniSirGlobal pMac, |
| 246 | tDblLinkList *pStaList, |
| 247 | tCsrStatsClientReqInfo * |
| 248 | pStaEntry); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 249 | static void csr_roam_report_statistics(tpAniSirGlobal pMac, uint32_t statsMask, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 250 | tCsrStatsCallback callback, uint8_t staId, |
| 251 | void *pContext); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 252 | tListElem *csr_roam_check_client_req_list(tpAniSirGlobal pMac, |
| 253 | uint32_t statsMask); |
| 254 | static void csr_roam_remove_entry_from_pe_stats_req_list(tpAniSirGlobal pMac, |
| 255 | tCsrPeStatsReqInfo *pPeStaEntry); |
| 256 | tListElem *csr_roam_find_in_pe_stats_req_list(tpAniSirGlobal pMac, |
| 257 | uint32_t statsMask); |
| 258 | static QDF_STATUS csr_roam_dereg_statistics_req(tpAniSirGlobal pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 259 | static uint32_t csr_find_ibss_session(tpAniSirGlobal pMac); |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 260 | static uint32_t csr_find_session_by_type(tpAniSirGlobal, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 261 | enum tQDF_ADAPTER_MODE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 262 | static bool csr_is_conn_allow_2g_band(tpAniSirGlobal pMac, uint32_t chnl); |
| 263 | static bool csr_is_conn_allow_5g_band(tpAniSirGlobal pMac, uint32_t chnl); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 264 | static QDF_STATUS csr_roam_start_wds(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 265 | tCsrRoamProfile *pProfile, |
| 266 | tSirBssDescription *pBssDesc); |
| 267 | static void csr_init_session(tpAniSirGlobal pMac, uint32_t sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 268 | static QDF_STATUS csr_roam_issue_set_key_command(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 269 | uint32_t sessionId, |
| 270 | tCsrRoamSetKey *pSetKey, |
| 271 | uint32_t roamId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 272 | static QDF_STATUS csr_roam_get_qos_info_from_bss(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 273 | tSirBssDescription *pBssDesc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 274 | static void csr_ser_des_unpack_diassoc_rsp(uint8_t *pBuf, |
| 275 | tSirSmeDisassocRsp *pRsp); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 276 | static void csr_init_operating_classes(tHalHandle hHal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 277 | |
| 278 | /* Initialize global variables */ |
| 279 | static void csr_roam_init_globals(tpAniSirGlobal pMac) |
| 280 | { |
| 281 | if (pMac) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 282 | qdf_mem_zero(&csr_roam_roam_session, |
| 283 | sizeof(csr_roam_roam_session)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 284 | pMac->roam.roamSession = csr_roam_roam_session; |
| 285 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | static void csr_roam_de_init_globals(tpAniSirGlobal pMac) |
| 289 | { |
Naveen Rawat | 2096954 | 2017-01-27 18:01:17 -0800 | [diff] [blame] | 290 | uint8_t i; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 291 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 292 | if (pMac) { |
Naveen Rawat | 2096954 | 2017-01-27 18:01:17 -0800 | [diff] [blame] | 293 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 294 | if (pMac->roam.roamSession[i].pCurRoamProfile) |
| 295 | csr_release_profile(pMac, |
| 296 | pMac->roam.roamSession[i]. |
| 297 | pCurRoamProfile); |
| 298 | csr_release_profile(pMac, |
| 299 | &pMac->roam.roamSession[i]. |
| 300 | stored_roam_profile.profile); |
| 301 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 302 | pMac->roam.roamSession = NULL; |
| 303 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 304 | } |
| 305 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 306 | QDF_STATUS csr_open(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 307 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 308 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 309 | uint32_t i; |
| 310 | |
| 311 | do { |
| 312 | /* Initialize CSR Roam Globals */ |
| 313 | csr_roam_init_globals(pMac); |
| 314 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) |
| 315 | csr_roam_state_change(pMac, eCSR_ROAMING_STATE_STOP, i); |
| 316 | |
| 317 | init_config_param(pMac); |
| 318 | status = csr_scan_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 319 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 320 | break; |
| 321 | status = csr_roam_open(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 322 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 323 | break; |
| 324 | pMac->roam.nextRoamId = 1; /* Must not be 0 */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 325 | if (!QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 326 | (csr_ll_open(pMac->hHdd, |
| 327 | &pMac->roam.statsClientReqList))) |
| 328 | break; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 329 | if (!QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 330 | (csr_ll_open(pMac->hHdd, |
| 331 | &pMac->roam.peStatsReqList))) |
| 332 | break; |
Abhishek Singh | f3756fc | 2017-06-28 16:04:06 +0530 | [diff] [blame] | 333 | qdf_list_create(&pMac->roam.rssi_disallow_bssid, |
| 334 | MAX_RSSI_AVOID_BSSID_LIST); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 335 | } while (0); |
| 336 | |
| 337 | return status; |
| 338 | } |
| 339 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 340 | QDF_STATUS csr_init_chan_list(tpAniSirGlobal mac, uint8_t *alpha2) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 341 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 342 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 343 | |
| 344 | mac->scan.countryCodeDefault[0] = alpha2[0]; |
| 345 | mac->scan.countryCodeDefault[1] = alpha2[1]; |
| 346 | mac->scan.countryCodeDefault[2] = alpha2[2]; |
| 347 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 348 | sme_debug("init time country code %.2s", mac->scan.countryCodeDefault); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 349 | |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 350 | mac->scan.domainIdDefault = 0; |
| 351 | mac->scan.domainIdCurrent = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 352 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 353 | qdf_mem_copy(mac->scan.countryCodeCurrent, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 354 | mac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 355 | qdf_mem_copy(mac->scan.countryCodeElected, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 356 | mac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN); |
| 357 | status = csr_get_channel_and_power_list(mac); |
| 358 | csr_clear_votes_for_country_info(mac); |
| 359 | return status; |
| 360 | } |
| 361 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 362 | QDF_STATUS csr_set_channels(tHalHandle hHal, tCsrConfigParam *pParam) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 363 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 364 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 365 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 366 | uint8_t index = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 367 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 368 | qdf_mem_copy(pParam->Csr11dinfo.countryCode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 369 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 370 | for (index = 0; index < pMac->scan.base_channels.numChannels; |
| 371 | index++) { |
| 372 | pParam->Csr11dinfo.Channels.channelList[index] = |
| 373 | pMac->scan.base_channels.channelList[index]; |
| 374 | pParam->Csr11dinfo.ChnPower[index].firstChannel = |
| 375 | pMac->scan.base_channels.channelList[index]; |
| 376 | pParam->Csr11dinfo.ChnPower[index].numChannels = 1; |
| 377 | pParam->Csr11dinfo.ChnPower[index].maxtxPower = |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 378 | pMac->scan.defaultPowerTable[index].tx_power; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 379 | } |
| 380 | pParam->Csr11dinfo.Channels.numChannels = |
| 381 | pMac->scan.base_channels.numChannels; |
| 382 | |
| 383 | return status; |
| 384 | } |
| 385 | |
Abhishek Singh | f3756fc | 2017-06-28 16:04:06 +0530 | [diff] [blame] | 386 | /** |
| 387 | * csr_assoc_rej_free_rssi_disallow_list() - Free the rssi diallowed |
| 388 | * BSSID entries and destroy the list |
| 389 | * @list: rssi based disallowed list entry |
| 390 | * |
| 391 | * Return: void |
| 392 | */ |
| 393 | static void csr_assoc_rej_free_rssi_disallow_list(qdf_list_t *list) |
| 394 | { |
| 395 | QDF_STATUS status; |
| 396 | struct sir_rssi_disallow_lst *cur_node; |
| 397 | qdf_list_node_t *cur_lst = NULL, *next_lst = NULL; |
| 398 | |
| 399 | qdf_list_peek_front(list, &cur_lst); |
| 400 | while (cur_lst) { |
| 401 | qdf_list_peek_next(list, cur_lst, &next_lst); |
| 402 | cur_node = qdf_container_of(cur_lst, |
| 403 | struct sir_rssi_disallow_lst, node); |
| 404 | status = qdf_list_remove_node(list, cur_lst); |
| 405 | if (QDF_IS_STATUS_SUCCESS(status)) |
| 406 | qdf_mem_free(cur_node); |
| 407 | cur_lst = next_lst; |
| 408 | next_lst = NULL; |
| 409 | } |
| 410 | qdf_list_destroy(list); |
| 411 | } |
| 412 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 413 | QDF_STATUS csr_close(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 414 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 415 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Naveen Rawat | 90542b3 | 2017-01-27 16:54:57 -0800 | [diff] [blame] | 416 | tSmeCmd *saved_scan_cmd; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 417 | |
| 418 | csr_roam_close(pMac); |
Abhishek Singh | f3756fc | 2017-06-28 16:04:06 +0530 | [diff] [blame] | 419 | csr_assoc_rej_free_rssi_disallow_list( |
| 420 | &pMac->roam.rssi_disallow_bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 421 | csr_scan_close(pMac); |
| 422 | csr_ll_close(&pMac->roam.statsClientReqList); |
| 423 | csr_ll_close(&pMac->roam.peStatsReqList); |
Naveen Rawat | 90542b3 | 2017-01-27 16:54:57 -0800 | [diff] [blame] | 424 | saved_scan_cmd = (tSmeCmd *)pMac->sme.saved_scan_cmd; |
| 425 | if (saved_scan_cmd) { |
| 426 | csr_release_profile(pMac, saved_scan_cmd->u.scanCmd. |
| 427 | pToRoamProfile); |
| 428 | if (saved_scan_cmd->u.scanCmd.pToRoamProfile) { |
| 429 | qdf_mem_free(saved_scan_cmd->u.scanCmd.pToRoamProfile); |
| 430 | saved_scan_cmd->u.scanCmd.pToRoamProfile = NULL; |
| 431 | } |
| 432 | if (saved_scan_cmd->u.scanCmd.u.scanRequest.SSIDs.SSIDList) { |
| 433 | qdf_mem_free(saved_scan_cmd->u.scanCmd.u.scanRequest. |
| 434 | SSIDs.SSIDList); |
| 435 | saved_scan_cmd->u.scanCmd.u.scanRequest.SSIDs. |
| 436 | SSIDList = NULL; |
| 437 | } |
| 438 | if (saved_scan_cmd->u.roamCmd.pRoamBssEntry) { |
| 439 | qdf_mem_free(saved_scan_cmd->u.roamCmd.pRoamBssEntry); |
| 440 | saved_scan_cmd->u.roamCmd.pRoamBssEntry = NULL; |
| 441 | } |
| 442 | qdf_mem_free(saved_scan_cmd); |
| 443 | saved_scan_cmd = NULL; |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 444 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 445 | /* DeInit Globals */ |
| 446 | csr_roam_de_init_globals(pMac); |
| 447 | return status; |
| 448 | } |
| 449 | |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 450 | static int8_t csr_find_channel_pwr(struct channel_power * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 451 | pdefaultPowerTable, |
| 452 | uint8_t ChannelNum) |
| 453 | { |
| 454 | uint8_t i; |
| 455 | /* TODO: if defaultPowerTable is guaranteed to be in ascending */ |
| 456 | /* order of channel numbers, we can employ binary search */ |
| 457 | for (i = 0; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++) { |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 458 | if (pdefaultPowerTable[i].chan_num == ChannelNum) |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 459 | return pdefaultPowerTable[i].tx_power; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 460 | } |
| 461 | /* could not find the channel list in default list */ |
| 462 | /* this should not have occured */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 463 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 464 | return 0; |
| 465 | } |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 466 | |
| 467 | /** |
| 468 | * csr_roam_arrange_ch_list() - Updates the channel list modified with greedy |
| 469 | * order for 5 Ghz preference and DFS channels. |
| 470 | * @mac_ctx: pointer to mac context. |
| 471 | * @chan_list: channel list updated with greedy channel order. |
| 472 | * @num_channel: Number of channels in list |
| 473 | * |
| 474 | * To allow Early Stop Roaming Scan feature to co-exist with 5G preference, |
| 475 | * this function moves 5G channels ahead of 2G channels. This function can |
| 476 | * also move 2G channels, ahead of DFS channel or vice versa. Order is |
| 477 | * maintained among same category channels |
| 478 | * |
| 479 | * Return: None |
| 480 | */ |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 481 | static void csr_roam_arrange_ch_list(tpAniSirGlobal mac_ctx, |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 482 | tSirUpdateChanParam *chan_list, uint8_t num_channel) |
| 483 | { |
| 484 | bool prefer_5g = CSR_IS_ROAM_PREFER_5GHZ(mac_ctx); |
| 485 | bool prefer_dfs = CSR_IS_DFS_CH_ROAM_ALLOWED(mac_ctx); |
| 486 | int i, j = 0; |
| 487 | tSirUpdateChanParam *tmp_list = NULL; |
| 488 | |
| 489 | if (!prefer_5g) |
| 490 | return; |
| 491 | |
| 492 | tmp_list = (tSirUpdateChanParam *) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 493 | qdf_mem_malloc(sizeof(tSirUpdateChanParam) * num_channel); |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 494 | if (tmp_list == NULL) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 495 | sme_err("Memory allocation failed"); |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 496 | return; |
| 497 | } |
| 498 | |
| 499 | /* Fist copy Non-DFS 5g channels */ |
| 500 | for (i = 0; i < num_channel; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 501 | if (WLAN_REG_IS_5GHZ_CH(chan_list[i].chanId) && |
| 502 | !wlan_reg_is_dfs_ch(mac_ctx->pdev, |
| 503 | chan_list[i].chanId)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 504 | qdf_mem_copy(&tmp_list[j++], |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 505 | &chan_list[i], sizeof(tSirUpdateChanParam)); |
| 506 | chan_list[i].chanId = INVALID_CHANNEL_ID; |
| 507 | } |
| 508 | } |
| 509 | if (prefer_dfs) { |
| 510 | /* next copy DFS channels (remaining channels in 5G) */ |
| 511 | for (i = 0; i < num_channel; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 512 | if (WLAN_REG_IS_5GHZ_CH(chan_list[i].chanId)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 513 | qdf_mem_copy(&tmp_list[j++], &chan_list[i], |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 514 | sizeof(tSirUpdateChanParam)); |
| 515 | chan_list[i].chanId = INVALID_CHANNEL_ID; |
| 516 | } |
| 517 | } |
| 518 | } else { |
| 519 | /* next copy 2G channels */ |
| 520 | for (i = 0; i < num_channel; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 521 | if (WLAN_REG_IS_24GHZ_CH(chan_list[i].chanId)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 522 | qdf_mem_copy(&tmp_list[j++], &chan_list[i], |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 523 | sizeof(tSirUpdateChanParam)); |
| 524 | chan_list[i].chanId = INVALID_CHANNEL_ID; |
| 525 | } |
| 526 | } |
| 527 | } |
| 528 | /* copy rest of the channels in same order to tmp list */ |
| 529 | for (i = 0; i < num_channel; i++) { |
| 530 | if (chan_list[i].chanId != INVALID_CHANNEL_ID) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 531 | qdf_mem_copy(&tmp_list[j++], &chan_list[i], |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 532 | sizeof(tSirUpdateChanParam)); |
| 533 | chan_list[i].chanId = INVALID_CHANNEL_ID; |
| 534 | } |
| 535 | } |
| 536 | /* copy tmp list to original channel list buffer */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 537 | qdf_mem_copy(chan_list, tmp_list, |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 538 | sizeof(tSirUpdateChanParam) * num_channel); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 539 | qdf_mem_free(tmp_list); |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 540 | } |
| 541 | |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 542 | /** |
| 543 | * csr_roam_sort_channel_for_early_stop() - Sort the channels |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 544 | * @mac_ctx: mac global context |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 545 | * @chan_list: Original channel list from the upper layers |
| 546 | * @num_channel: Number of original channels |
| 547 | * |
| 548 | * For Early stop scan feature, the channel list should be in an order, |
| 549 | * where-in there is a maximum chance to detect an AP in the initial |
| 550 | * channels in the list so that the scanning can be stopped early as the |
| 551 | * feature demands. |
| 552 | * Below fixed greedy channel list has been provided |
| 553 | * based on most of the enterprise wifi installations across the globe. |
| 554 | * |
| 555 | * Identify all the greedy channels within the channel list from user space. |
| 556 | * Identify all the non-greedy channels in the user space channel list. |
| 557 | * Merge greedy channels followed by non-greedy channels back into the |
| 558 | * chan_list. |
| 559 | * |
| 560 | * Return: None |
| 561 | */ |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 562 | static void csr_roam_sort_channel_for_early_stop(tpAniSirGlobal mac_ctx, |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 563 | tSirUpdateChanList *chan_list, uint8_t num_channel) |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 564 | { |
| 565 | tSirUpdateChanList *chan_list_greedy, *chan_list_non_greedy; |
| 566 | uint8_t i, j; |
| 567 | static const uint8_t fixed_greedy_chan_list[] = {1, 6, 11, 36, 48, 40, |
| 568 | 44, 10, 2, 9, 149, 157, 161, 3, 4, 8, 153, 165, 7, 5, 136, 140, |
| 569 | 52, 116, 56, 104, 64, 60, 100, 120, 13, 14, 112, 132, 151, 155}; |
| 570 | uint8_t num_fixed_greedy_chan; |
| 571 | uint8_t num_greedy_chan = 0; |
| 572 | uint8_t num_non_greedy_chan = 0; |
| 573 | uint8_t match_found = false; |
| 574 | uint32_t buf_size; |
| 575 | |
| 576 | buf_size = sizeof(tSirUpdateChanList) + |
| 577 | (sizeof(tSirUpdateChanParam) * num_channel); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 578 | chan_list_greedy = qdf_mem_malloc(buf_size); |
| 579 | chan_list_non_greedy = qdf_mem_malloc(buf_size); |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 580 | if (!chan_list_greedy || !chan_list_non_greedy) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 581 | QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 582 | "Failed to allocate memory for tSirUpdateChanList"); |
| 583 | return; |
| 584 | } |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 585 | /* |
| 586 | * fixed_greedy_chan_list is an evaluated channel list based on most of |
| 587 | * the enterprise wifi deployments and the order of the channels |
| 588 | * determines the highest possibility of finding an AP. |
| 589 | * chan_list is the channel list provided by upper layers based on the |
| 590 | * regulatory domain. |
| 591 | */ |
| 592 | num_fixed_greedy_chan = sizeof(fixed_greedy_chan_list)/sizeof(uint8_t); |
| 593 | /* |
| 594 | * Browse through the chan_list and put all the non-greedy channels |
| 595 | * into a seperate list by name chan_list_non_greedy |
| 596 | */ |
| 597 | for (i = 0; i < num_channel; i++) { |
| 598 | for (j = 0; j < num_fixed_greedy_chan; j++) { |
| 599 | if (chan_list->chanParam[i].chanId == |
| 600 | fixed_greedy_chan_list[j]) { |
| 601 | match_found = true; |
| 602 | break; |
| 603 | } |
| 604 | } |
| 605 | if (!match_found) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 606 | qdf_mem_copy( |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 607 | &chan_list_non_greedy->chanParam[num_non_greedy_chan], |
| 608 | &chan_list->chanParam[i], |
| 609 | sizeof(tSirUpdateChanParam)); |
| 610 | num_non_greedy_chan++; |
| 611 | } else { |
| 612 | match_found = false; |
| 613 | } |
| 614 | } |
| 615 | /* |
| 616 | * Browse through the fixed_greedy_chan_list and put all the greedy |
| 617 | * channels in the chan_list into a seperate list by name |
| 618 | * chan_list_greedy |
| 619 | */ |
| 620 | for (i = 0; i < num_fixed_greedy_chan; i++) { |
| 621 | for (j = 0; j < num_channel; j++) { |
| 622 | if (fixed_greedy_chan_list[i] == |
| 623 | chan_list->chanParam[j].chanId) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 624 | qdf_mem_copy( |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 625 | &chan_list_greedy->chanParam[num_greedy_chan], |
| 626 | &chan_list->chanParam[j], |
| 627 | sizeof(tSirUpdateChanParam)); |
| 628 | num_greedy_chan++; |
| 629 | break; |
| 630 | } |
| 631 | } |
| 632 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 633 | QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_DEBUG, |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 634 | "greedy=%d, non-greedy=%d, tot=%d", |
| 635 | num_greedy_chan, num_non_greedy_chan, num_channel); |
| 636 | if ((num_greedy_chan + num_non_greedy_chan) != num_channel) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 637 | QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 638 | "incorrect sorting of channels"); |
| 639 | goto scan_list_sort_error; |
| 640 | } |
| 641 | /* Copy the Greedy channels first */ |
| 642 | i = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 643 | qdf_mem_copy(&chan_list->chanParam[i], |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 644 | &chan_list_greedy->chanParam[i], |
| 645 | num_greedy_chan * sizeof(tSirUpdateChanParam)); |
| 646 | /* Copy the remaining Non Greedy channels */ |
| 647 | i = num_greedy_chan; |
| 648 | j = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 649 | qdf_mem_copy(&chan_list->chanParam[i], |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 650 | &chan_list_non_greedy->chanParam[j], |
| 651 | num_non_greedy_chan * sizeof(tSirUpdateChanParam)); |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 652 | |
| 653 | /* Update channel list for 5g preference and allow DFS roam */ |
| 654 | csr_roam_arrange_ch_list(mac_ctx, chan_list->chanParam, num_channel); |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 655 | scan_list_sort_error: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 656 | qdf_mem_free(chan_list_greedy); |
| 657 | qdf_mem_free(chan_list_non_greedy); |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 658 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 659 | |
Krishna Kumaar Natarajan | d542b8e | 2016-08-16 17:41:04 -0700 | [diff] [blame] | 660 | /** |
| 661 | * csr_emu_chan_req() - update the required channel list for emulation |
| 662 | * @channel: channel number to check |
| 663 | * |
| 664 | * To reduce scan time during emulation platforms, this function |
| 665 | * restricts the scanning to be done on selected channels |
| 666 | * |
| 667 | * Return: QDF_STATUS enumeration |
| 668 | */ |
| 669 | #ifdef QCA_WIFI_NAPIER_EMULATION |
Krishna Kumaar Natarajan | 585f030 | 2017-08-07 18:01:27 -0700 | [diff] [blame] | 670 | #define SCAN_CHAN_LIST_5G_LEN 6 |
| 671 | #define SCAN_CHAN_LIST_2G_LEN 3 |
| 672 | static const uint8_t |
| 673 | csr_scan_chan_list_5g[SCAN_CHAN_LIST_5G_LEN] = { 36, 44, 52, 56, 140, 149 }; |
| 674 | static const uint8_t |
| 675 | csr_scan_chan_list_2g[SCAN_CHAN_LIST_2G_LEN] = { 1, 6, 11 }; |
Krishna Kumaar Natarajan | d542b8e | 2016-08-16 17:41:04 -0700 | [diff] [blame] | 676 | static QDF_STATUS csr_emu_chan_req(uint32_t channel) |
| 677 | { |
| 678 | int i; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 679 | if (WLAN_REG_IS_24GHZ_CH(channel)) { |
Krishna Kumaar Natarajan | 585f030 | 2017-08-07 18:01:27 -0700 | [diff] [blame] | 680 | for (i = 0; i < QDF_ARRAY_SIZE(csr_scan_chan_list_2g); i++) { |
| 681 | if (csr_scan_chan_list_2g[i] == channel) |
Krishna Kumaar Natarajan | d542b8e | 2016-08-16 17:41:04 -0700 | [diff] [blame] | 682 | return QDF_STATUS_SUCCESS; |
| 683 | } |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 684 | } else if (WLAN_REG_IS_5GHZ_CH(channel)) { |
Krishna Kumaar Natarajan | 585f030 | 2017-08-07 18:01:27 -0700 | [diff] [blame] | 685 | for (i = 0; i < QDF_ARRAY_SIZE(csr_scan_chan_list_5g); i++) { |
| 686 | if (csr_scan_chan_list_5g[i] == channel) |
Krishna Kumaar Natarajan | d542b8e | 2016-08-16 17:41:04 -0700 | [diff] [blame] | 687 | return QDF_STATUS_SUCCESS; |
| 688 | } |
| 689 | } |
| 690 | return QDF_STATUS_E_FAILURE; |
| 691 | } |
| 692 | #else |
| 693 | static QDF_STATUS csr_emu_chan_req(uint32_t channel_num) |
| 694 | { |
| 695 | return QDF_STATUS_SUCCESS; |
| 696 | } |
| 697 | #endif |
| 698 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 699 | QDF_STATUS csr_update_channel_list(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 700 | { |
| 701 | tSirUpdateChanList *pChanList; |
| 702 | tCsrScanStruct *pScan = &pMac->scan; |
| 703 | uint8_t numChan = pScan->base_channels.numChannels; |
| 704 | uint8_t num_channel = 0; |
| 705 | uint32_t bufLen; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 706 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 707 | uint8_t i, j, social_channel[MAX_SOCIAL_CHANNELS] = { 1, 6, 11 }; |
| 708 | uint8_t channel_state; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 709 | uint16_t unsafe_chan[NUM_CHANNELS]; |
| 710 | uint16_t unsafe_chan_cnt = 0; |
| 711 | uint16_t cnt = 0; |
| 712 | uint8_t channel; |
| 713 | bool is_unsafe_chan; |
| 714 | qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); |
| 715 | |
| 716 | if (!qdf_ctx) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 717 | sme_err("qdf_ctx is NULL"); |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 718 | return QDF_STATUS_E_FAILURE; |
| 719 | } |
| 720 | |
| 721 | pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, |
| 722 | &unsafe_chan_cnt, |
| 723 | sizeof(unsafe_chan)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 724 | |
| 725 | if (CSR_IS_5G_BAND_ONLY(pMac)) { |
| 726 | for (i = 0; i < MAX_SOCIAL_CHANNELS; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 727 | if (wlan_reg_get_channel_state(pMac->pdev, |
| 728 | social_channel[i]) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 729 | == CHANNEL_STATE_ENABLE) |
| 730 | numChan++; |
| 731 | } |
| 732 | } |
| 733 | |
| 734 | bufLen = sizeof(tSirUpdateChanList) + |
| 735 | (sizeof(tSirUpdateChanParam) * (numChan)); |
| 736 | |
| 737 | csr_init_operating_classes((tHalHandle) pMac); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 738 | pChanList = (tSirUpdateChanList *) qdf_mem_malloc(bufLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 739 | if (!pChanList) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 740 | QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 741 | "Failed to allocate memory for tSirUpdateChanList"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 742 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 743 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 744 | |
| 745 | for (i = 0; i < pScan->base_channels.numChannels; i++) { |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 746 | struct csr_sta_roam_policy_params *roam_policy = |
| 747 | &pMac->roam.configParam.sta_roam_policy; |
Krishna Kumaar Natarajan | d542b8e | 2016-08-16 17:41:04 -0700 | [diff] [blame] | 748 | if (QDF_STATUS_SUCCESS != |
| 749 | csr_emu_chan_req(pScan->base_channels.channelList[i])) |
| 750 | continue; |
| 751 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 752 | /* Scan is not performed on DSRC channels*/ |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 753 | if (pScan->base_channels.channelList[i] >= |
| 754 | WLAN_REG_MIN_11P_CH_NUM) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 755 | continue; |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 756 | |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 757 | channel = pScan->base_channels.channelList[i]; |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 758 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 759 | channel_state = wlan_reg_get_channel_state(pMac->pdev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 760 | pScan->base_channels.channelList[i]); |
| 761 | if ((CHANNEL_STATE_ENABLE == channel_state) || |
| 762 | pMac->scan.fEnableDFSChnlScan) { |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 763 | if ((pMac->roam.configParam.sta_roam_policy.dfs_mode == |
| 764 | CSR_STA_ROAM_POLICY_DFS_DISABLED) && |
| 765 | (channel_state == CHANNEL_STATE_DFS)) { |
| 766 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 767 | QDF_TRACE_LEVEL_INFO, |
| 768 | FL("skip dfs channel %d"), |
| 769 | channel); |
| 770 | continue; |
| 771 | } |
| 772 | if (pMac->roam.configParam.sta_roam_policy. |
| 773 | skip_unsafe_channels && |
| 774 | unsafe_chan_cnt) { |
| 775 | is_unsafe_chan = false; |
| 776 | for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { |
| 777 | if (unsafe_chan[cnt] == channel) { |
| 778 | is_unsafe_chan = true; |
| 779 | break; |
| 780 | } |
| 781 | } |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 782 | if ((is_unsafe_chan) && |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 783 | ((WLAN_REG_IS_24GHZ_CH(channel) && |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 784 | roam_policy->sap_operating_band == |
| 785 | eCSR_BAND_24) || |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 786 | (WLAN_REG_IS_5GHZ_CH(channel) && |
Agrawal, Ashish | 9f84c40 | 2016-11-30 16:19:44 +0530 | [diff] [blame] | 787 | roam_policy->sap_operating_band == |
| 788 | eCSR_BAND_5G))) { |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 789 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 790 | QDF_TRACE_LEVEL_INFO, |
| 791 | FL("ignoring unsafe channel %d"), |
| 792 | channel); |
| 793 | continue; |
| 794 | } |
| 795 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 796 | pChanList->chanParam[num_channel].chanId = |
| 797 | pScan->base_channels.channelList[i]; |
| 798 | pChanList->chanParam[num_channel].pwr = |
| 799 | csr_find_channel_pwr(pScan->defaultPowerTable, |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 800 | pChanList->chanParam[num_channel].chanId); |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 801 | |
| 802 | if (pScan->fcc_constraint) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 803 | if (12 == pChanList->chanParam[num_channel]. |
| 804 | chanId) { |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 805 | pChanList->chanParam[num_channel].pwr = |
| 806 | MAX_PWR_FCC_CHAN_12; |
| 807 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 808 | QDF_TRACE_LEVEL_INFO, |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 809 | "txpow for channel 12 is %d", |
| 810 | MAX_PWR_FCC_CHAN_12); |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 811 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 812 | if (13 == pChanList->chanParam[num_channel]. |
| 813 | chanId) { |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 814 | pChanList->chanParam[num_channel].pwr = |
| 815 | MAX_PWR_FCC_CHAN_13; |
| 816 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 817 | QDF_TRACE_LEVEL_INFO, |
Amar Singhal | 83a047a | 2016-05-19 15:56:11 -0700 | [diff] [blame] | 818 | "txpow for channel 13 is %d", |
| 819 | MAX_PWR_FCC_CHAN_13); |
Amar Singhal | 7c1e898 | 2016-05-19 15:08:09 -0700 | [diff] [blame] | 820 | } |
| 821 | } |
| 822 | |
| 823 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 824 | if (CHANNEL_STATE_ENABLE == channel_state) |
| 825 | pChanList->chanParam[num_channel].dfsSet = |
| 826 | false; |
| 827 | else |
| 828 | pChanList->chanParam[num_channel].dfsSet = |
| 829 | true; |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 830 | if (cds_is_5_mhz_enabled()) |
| 831 | pChanList->chanParam[num_channel].quarter_rate |
| 832 | = 1; |
| 833 | else if (cds_is_10_mhz_enabled()) |
| 834 | pChanList->chanParam[num_channel].half_rate = 1; |
Abhishek Singh | 562aad6 | 2017-01-05 16:24:23 +0530 | [diff] [blame] | 835 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
| 836 | "channel:%d, pwr=%d, DFS=%d qrate %d hrate %d ", |
| 837 | pChanList->chanParam[num_channel].chanId, |
| 838 | pChanList->chanParam[num_channel].pwr, |
| 839 | pChanList->chanParam[num_channel].dfsSet, |
| 840 | pChanList->chanParam[num_channel].quarter_rate, |
| 841 | pChanList->chanParam[num_channel].half_rate); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 842 | num_channel++; |
| 843 | } |
| 844 | } |
| 845 | |
| 846 | if (CSR_IS_5G_BAND_ONLY(pMac)) { |
| 847 | for (j = 0; j < MAX_SOCIAL_CHANNELS; j++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 848 | if (wlan_reg_get_channel_state(pMac->pdev, |
| 849 | social_channel[j]) |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 850 | != CHANNEL_STATE_ENABLE) |
| 851 | continue; |
| 852 | pChanList->chanParam[num_channel].chanId = |
| 853 | social_channel[j]; |
| 854 | pChanList->chanParam[num_channel].pwr = |
| 855 | csr_find_channel_pwr(pScan->defaultPowerTable, |
| 856 | social_channel[j]); |
| 857 | pChanList->chanParam[num_channel].dfsSet = false; |
| 858 | if (cds_is_5_mhz_enabled()) |
| 859 | pChanList->chanParam[num_channel].quarter_rate |
| 860 | = 1; |
| 861 | else if (cds_is_10_mhz_enabled()) |
| 862 | pChanList->chanParam[num_channel].half_rate = 1; |
| 863 | num_channel++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 864 | } |
| 865 | } |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 866 | if (pMac->roam.configParam.early_stop_scan_enable) |
Naveen Rawat | 16b8287 | 2015-12-14 17:59:16 -0800 | [diff] [blame] | 867 | csr_roam_sort_channel_for_early_stop(pMac, pChanList, |
| 868 | num_channel); |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 869 | else |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 870 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 871 | FL("Early Stop Scan Feature not supported")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 872 | |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 873 | if ((pMac->roam.configParam.uCfgDot11Mode == |
| 874 | eCSR_CFG_DOT11_MODE_AUTO) || |
| 875 | (pMac->roam.configParam.uCfgDot11Mode == |
| 876 | eCSR_CFG_DOT11_MODE_11AC) || |
| 877 | (pMac->roam.configParam.uCfgDot11Mode == |
| 878 | eCSR_CFG_DOT11_MODE_11AC_ONLY)) { |
| 879 | pChanList->vht_en = true; |
| 880 | if (pMac->roam.configParam.enableVhtFor24GHz) |
| 881 | pChanList->vht_24_en = true; |
| 882 | } |
| 883 | if ((pMac->roam.configParam.uCfgDot11Mode == |
| 884 | eCSR_CFG_DOT11_MODE_AUTO) || |
| 885 | (pMac->roam.configParam.uCfgDot11Mode == |
| 886 | eCSR_CFG_DOT11_MODE_11N) || |
| 887 | (pMac->roam.configParam.uCfgDot11Mode == |
| 888 | eCSR_CFG_DOT11_MODE_11N_ONLY)) { |
| 889 | pChanList->ht_en = true; |
| 890 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 891 | msg.type = WMA_UPDATE_CHAN_LIST_REQ; |
| 892 | msg.reserved = 0; |
| 893 | msg.bodyptr = pChanList; |
| 894 | pChanList->numChan = num_channel; |
Sreelakshmi Konamki | 6a06536 | 2016-05-31 16:05:01 +0530 | [diff] [blame] | 895 | MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, |
| 896 | NO_SESSION, msg.type)); |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 897 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_WMA, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 898 | &msg)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 899 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 900 | "%s: Failed to post msg to WMA", __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 901 | qdf_mem_free(pChanList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 902 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 903 | } |
| 904 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 905 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 906 | } |
| 907 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 908 | QDF_STATUS csr_start(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 909 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 910 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 911 | uint32_t i; |
| 912 | |
| 913 | do { |
| 914 | /* save the global cds context */ |
| 915 | pMac->roam.g_cds_context = cds_get_global_context(); |
| 916 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) |
| 917 | csr_roam_state_change(pMac, eCSR_ROAMING_STATE_IDLE, i); |
| 918 | |
| 919 | status = csr_roam_start(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 920 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 921 | break; |
| 922 | |
| 923 | pMac->roam.sPendingCommands = 0; |
| 924 | csr_scan_enable(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 925 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) |
| 926 | status = csr_neighbor_roam_init(pMac, i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 927 | pMac->roam.tlStatsReqInfo.numClient = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 928 | /* init the link quality indication also */ |
| 929 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 930 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 931 | sme_warn("csr_start: Couldn't Init HO control blk "); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 932 | break; |
| 933 | } |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 934 | /* Register with scan component */ |
| 935 | pMac->scan.requester_id = ucfg_scan_register_requester( |
| 936 | pMac->psoc, |
| 937 | "CSR", csr_scan_callback, pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 938 | } while (0); |
| 939 | return status; |
| 940 | } |
| 941 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 942 | QDF_STATUS csr_stop(tpAniSirGlobal pMac, tHalStopType stopType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 943 | { |
| 944 | uint32_t sessionId; |
| 945 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 946 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 947 | csr_roam_close_session(pMac, sessionId, true, NULL, NULL); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 948 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 949 | csr_scan_disable(pMac); |
| 950 | pMac->scan.fCancelIdleScan = false; |
| 951 | pMac->scan.fRestartIdleScan = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 952 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 954 | csr_neighbor_roam_close(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 955 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 956 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) |
| 957 | csr_scan_flush_result(pMac); |
| 958 | |
| 959 | /* Reset the domain back to the deault */ |
| 960 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
| 961 | |
| 962 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) { |
| 963 | csr_roam_state_change(pMac, eCSR_ROAMING_STATE_STOP, sessionId); |
| 964 | pMac->roam.curSubState[sessionId] = eCSR_ROAM_SUBSTATE_NONE; |
| 965 | } |
| 966 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 967 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 968 | } |
| 969 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 970 | QDF_STATUS csr_ready(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 971 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 972 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 973 | /* If the gScanAgingTime is set to '0' then scan results aging timeout |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 974 | * based on timer feature is not enabled |
| 975 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 976 | status = csr_apply_channel_and_power_list(pMac); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 977 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 978 | sme_err("csr_apply_channel_and_power_list failed during csr_ready with status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 979 | status); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 980 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 981 | return status; |
| 982 | } |
| 983 | |
| 984 | void csr_set_default_dot11_mode(tpAniSirGlobal pMac) |
| 985 | { |
| 986 | uint32_t wniDot11mode = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 987 | |
| 988 | wniDot11mode = csr_translate_to_wni_cfg_dot11_mode(pMac, |
| 989 | pMac->roam.configParam.uCfgDot11Mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 990 | cfg_set_int(pMac, WNI_CFG_DOT11_MODE, wniDot11mode); |
| 991 | } |
| 992 | |
| 993 | void csr_set_global_cfgs(tpAniSirGlobal pMac) |
| 994 | { |
| 995 | |
| 996 | cfg_set_int(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 997 | csr_get_frag_thresh(pMac)); |
| 998 | cfg_set_int(pMac, WNI_CFG_RTS_THRESHOLD, csr_get_rts_thresh(pMac)); |
| 999 | cfg_set_int(pMac, WNI_CFG_11D_ENABLED, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1000 | ((pMac->roam.configParam.Is11hSupportEnabled) ? |
| 1001 | pMac->roam.configParam.Is11dSupportEnabled : |
| 1002 | pMac->roam.configParam.Is11dSupportEnabled)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | cfg_set_int(pMac, WNI_CFG_11H_ENABLED, |
| 1004 | pMac->roam.configParam.Is11hSupportEnabled); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1005 | /* For now we will just use the 5GHz CB mode ini parameter to decide |
| 1006 | * whether CB supported or not in Probes when there is no session |
| 1007 | * Once session is established we will use the session related params |
| 1008 | * stored in PE session for CB mode |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1009 | */ |
| 1010 | cfg_set_int(pMac, WNI_CFG_CHANNEL_BONDING_MODE, |
| 1011 | !!(pMac->roam.configParam.channelBondingMode5GHz)); |
| 1012 | cfg_set_int(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 1013 | pMac->roam.configParam.HeartbeatThresh24); |
| 1014 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1015 | /* Update the operating mode to configured value during |
| 1016 | * initialization, So that client can advertise full |
| 1017 | * capabilities in Probe request frame. |
| 1018 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1019 | csr_set_default_dot11_mode(pMac); |
| 1020 | } |
| 1021 | |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1022 | /** |
| 1023 | * csr_packetdump_timer_handler() - packet dump timer |
| 1024 | * handler |
| 1025 | * @pv: user data |
| 1026 | * |
| 1027 | * This function is used to handle packet dump timer |
| 1028 | * |
| 1029 | * Return: None |
| 1030 | * |
| 1031 | */ |
| 1032 | static void csr_packetdump_timer_handler(void *pv) |
| 1033 | { |
| 1034 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
| 1035 | "%s Invoking packetdump deregistration API", __func__); |
| 1036 | wlan_deregister_txrx_packetdump(); |
| 1037 | } |
| 1038 | |
| 1039 | /** |
| 1040 | * csr_packetdump_timer_stop() - stops packet dump timer |
| 1041 | * |
| 1042 | * This function is used to stop packet dump timer |
| 1043 | * |
| 1044 | * Return: None |
| 1045 | * |
| 1046 | */ |
| 1047 | void csr_packetdump_timer_stop(void) |
| 1048 | { |
| 1049 | QDF_STATUS status; |
| 1050 | tHalHandle hal; |
| 1051 | tpAniSirGlobal mac; |
| 1052 | v_CONTEXT_t vos_ctx_ptr; |
| 1053 | |
| 1054 | /* get the global voss context */ |
| 1055 | vos_ctx_ptr = cds_get_global_context(); |
| 1056 | if (vos_ctx_ptr == NULL) { |
| 1057 | QDF_ASSERT(0); |
| 1058 | return; |
| 1059 | } |
| 1060 | |
| 1061 | hal = cds_get_context(QDF_MODULE_ID_SME); |
| 1062 | if (hal == NULL) { |
| 1063 | QDF_ASSERT(0); |
| 1064 | return; |
| 1065 | } |
| 1066 | |
| 1067 | mac = PMAC_STRUCT(hal); |
| 1068 | status = qdf_mc_timer_stop(&mac->roam.packetdump_timer); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1069 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1070 | sme_err("cannot stop packetdump timer"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1071 | } |
| 1072 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1073 | static QDF_STATUS csr_roam_open(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1074 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1075 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1076 | uint32_t i; |
| 1077 | tCsrRoamSession *pSession; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1078 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1079 | do { |
| 1080 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 1081 | pSession = CSR_GET_SESSION(pMac, i); |
| 1082 | pSession->roamingTimerInfo.pMac = pMac; |
| 1083 | pSession->roamingTimerInfo.sessionId = |
| 1084 | CSR_SESSION_ID_INVALID; |
| 1085 | } |
| 1086 | pMac->roam.WaitForKeyTimerInfo.pMac = pMac; |
| 1087 | pMac->roam.WaitForKeyTimerInfo.sessionId = |
| 1088 | CSR_SESSION_ID_INVALID; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1089 | status = qdf_mc_timer_init(&pMac->roam.hTimerWaitForKey, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1090 | QDF_TIMER_TYPE_SW, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1091 | csr_roam_wait_for_key_time_out_handler, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1092 | &pMac->roam.WaitForKeyTimerInfo); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1093 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1094 | sme_err("cannot allocate memory for WaitForKey time out timer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1095 | break; |
| 1096 | } |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1097 | status = qdf_mc_timer_init(&pMac->roam.packetdump_timer, |
| 1098 | QDF_TIMER_TYPE_SW, csr_packetdump_timer_handler, |
| 1099 | pMac); |
| 1100 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1101 | sme_err("cannot allocate memory for packetdump timer"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1102 | break; |
| 1103 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1104 | } while (0); |
| 1105 | return status; |
| 1106 | } |
| 1107 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1108 | static QDF_STATUS csr_roam_close(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1109 | { |
| 1110 | uint32_t sessionId; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1111 | |
| 1112 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1113 | csr_roam_close_session(pMac, sessionId, true, NULL, NULL); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1114 | |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 1115 | qdf_mc_timer_stop(&pMac->roam.hTimerWaitForKey); |
| 1116 | qdf_mc_timer_destroy(&pMac->roam.hTimerWaitForKey); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1117 | qdf_mc_timer_stop(&pMac->roam.packetdump_timer); |
| 1118 | qdf_mc_timer_destroy(&pMac->roam.packetdump_timer); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1119 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1120 | } |
| 1121 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1122 | QDF_STATUS csr_roam_start(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1123 | { |
| 1124 | (void)pMac; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1125 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1126 | } |
| 1127 | |
| 1128 | void csr_roam_stop(tpAniSirGlobal pMac, uint32_t sessionId) |
| 1129 | { |
| 1130 | csr_roam_stop_roaming_timer(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1131 | /* deregister the clients requesting stats from PE/TL & also stop |
| 1132 | * the corresponding timers |
| 1133 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1134 | csr_roam_dereg_statistics_req(pMac); |
| 1135 | } |
| 1136 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1137 | QDF_STATUS csr_roam_get_connect_state(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1138 | eCsrConnectState *pState) |
| 1139 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1140 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1141 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1142 | if (CSR_IS_SESSION_VALID(pMac, sessionId) && (NULL != pState)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1143 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1144 | *pState = pMac->roam.roamSession[sessionId].connectState; |
| 1145 | } |
| 1146 | return status; |
| 1147 | } |
| 1148 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1149 | QDF_STATUS csr_roam_copy_connect_profile(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1150 | uint32_t sessionId, tCsrRoamConnectedProfile *pProfile) |
| 1151 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1152 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | uint32_t size = 0; |
| 1154 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 1155 | tCsrRoamConnectedProfile *connected_prof; |
| 1156 | |
| 1157 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1158 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1159 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1160 | } |
| 1161 | if (!pProfile) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1162 | sme_err("profile not found"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1163 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1164 | } |
| 1165 | |
| 1166 | if (pSession->pConnectBssDesc) { |
| 1167 | size = pSession->pConnectBssDesc->length + |
| 1168 | sizeof(pSession->pConnectBssDesc->length); |
| 1169 | if (size) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1170 | pProfile->pBssDesc = qdf_mem_malloc(size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1171 | if (NULL != pProfile->pBssDesc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1172 | qdf_mem_copy(pProfile->pBssDesc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1173 | pSession->pConnectBssDesc, |
| 1174 | size); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1175 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1176 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1177 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1178 | } |
| 1179 | } else { |
| 1180 | pProfile->pBssDesc = NULL; |
| 1181 | } |
| 1182 | connected_prof = &(pSession->connectedProfile); |
| 1183 | pProfile->AuthType = connected_prof->AuthType; |
| 1184 | pProfile->EncryptionType = connected_prof->EncryptionType; |
| 1185 | pProfile->mcEncryptionType = connected_prof->mcEncryptionType; |
| 1186 | pProfile->BSSType = connected_prof->BSSType; |
| 1187 | pProfile->operationChannel = connected_prof->operationChannel; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1188 | qdf_mem_copy(&pProfile->bssid, &connected_prof->bssid, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1189 | sizeof(struct qdf_mac_addr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1190 | qdf_mem_copy(&pProfile->SSID, &connected_prof->SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1191 | sizeof(tSirMacSSid)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1192 | if (connected_prof->MDID.mdiePresent) { |
| 1193 | pProfile->MDID.mdiePresent = 1; |
| 1194 | pProfile->MDID.mobilityDomain = |
| 1195 | connected_prof->MDID.mobilityDomain; |
| 1196 | } else { |
| 1197 | pProfile->MDID.mdiePresent = 0; |
| 1198 | pProfile->MDID.mobilityDomain = 0; |
| 1199 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1200 | #ifdef FEATURE_WLAN_ESE |
| 1201 | pProfile->isESEAssoc = connected_prof->isESEAssoc; |
| 1202 | if (csr_is_auth_type_ese(connected_prof->AuthType)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1203 | qdf_mem_copy(pProfile->eseCckmInfo.krk, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1204 | connected_prof->eseCckmInfo.krk, |
| 1205 | SIR_KRK_KEY_LEN); |
| 1206 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1207 | qdf_mem_copy(pProfile->eseCckmInfo.btk, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1208 | connected_prof->eseCckmInfo.btk, |
| 1209 | SIR_BTK_KEY_LEN); |
| 1210 | #endif |
| 1211 | pProfile->eseCckmInfo.reassoc_req_num = |
| 1212 | connected_prof->eseCckmInfo.reassoc_req_num; |
| 1213 | pProfile->eseCckmInfo.krk_plumbed = |
| 1214 | connected_prof->eseCckmInfo.krk_plumbed; |
| 1215 | } |
| 1216 | #endif |
Krunal Soni | b2f1304 | 2015-11-02 18:41:08 -0800 | [diff] [blame] | 1217 | #ifdef WLAN_FEATURE_11W |
| 1218 | pProfile->MFPEnabled = connected_prof->MFPEnabled; |
| 1219 | pProfile->MFPRequired = connected_prof->MFPRequired; |
| 1220 | pProfile->MFPCapable = connected_prof->MFPCapable; |
| 1221 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1222 | } |
| 1223 | return status; |
| 1224 | } |
| 1225 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1226 | QDF_STATUS csr_roam_get_connect_profile(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1227 | tCsrRoamConnectedProfile *pProfile) |
| 1228 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1229 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1230 | |
| 1231 | if ((csr_is_conn_state_connected(pMac, sessionId)) || |
| 1232 | (csr_is_conn_state_ibss(pMac, sessionId))) { |
| 1233 | if (pProfile) { |
| 1234 | status = |
| 1235 | csr_roam_copy_connect_profile(pMac, sessionId, |
| 1236 | pProfile); |
| 1237 | } |
| 1238 | } |
| 1239 | return status; |
| 1240 | } |
| 1241 | |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 1242 | void csr_roam_free_connect_profile(tCsrRoamConnectedProfile *profile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1243 | { |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 1244 | if (profile->pBssDesc) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1245 | qdf_mem_free(profile->pBssDesc); |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 1246 | if (profile->pAddIEAssoc) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1247 | qdf_mem_free(profile->pAddIEAssoc); |
| 1248 | qdf_mem_set(profile, sizeof(tCsrRoamConnectedProfile), 0); |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 1249 | profile->AuthType = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1250 | } |
| 1251 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1252 | static QDF_STATUS csr_roam_free_connected_info(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1253 | tCsrRoamConnectedInfo * |
| 1254 | pConnectedInfo) |
| 1255 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1256 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1257 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1258 | if (pConnectedInfo->pbFrames) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1259 | qdf_mem_free(pConnectedInfo->pbFrames); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1260 | pConnectedInfo->pbFrames = NULL; |
| 1261 | } |
| 1262 | pConnectedInfo->nBeaconLength = 0; |
| 1263 | pConnectedInfo->nAssocReqLength = 0; |
| 1264 | pConnectedInfo->nAssocRspLength = 0; |
| 1265 | pConnectedInfo->staId = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1266 | pConnectedInfo->nRICRspLength = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1267 | #ifdef FEATURE_WLAN_ESE |
| 1268 | pConnectedInfo->nTspecIeLength = 0; |
| 1269 | #endif |
| 1270 | return status; |
| 1271 | } |
| 1272 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1273 | void csr_release_command_roam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 1274 | { |
| 1275 | csr_reinit_roam_cmd(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1276 | } |
| 1277 | |
| 1278 | void csr_release_command_scan(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 1279 | { |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 1280 | qdf_mc_timer_stop(&pCommand->u.scanCmd.csr_scan_timer); |
| 1281 | qdf_mc_timer_destroy(&pCommand->u.scanCmd.csr_scan_timer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1282 | csr_reinit_scan_cmd(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1283 | } |
| 1284 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1285 | void csr_release_command_wm_status_change(tpAniSirGlobal pMac, |
| 1286 | tSmeCmd *pCommand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1287 | { |
| 1288 | csr_reinit_wm_status_change_cmd(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1289 | } |
| 1290 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1291 | /** |
| 1292 | * csr_release_roc_req_cmd() - Release the command |
| 1293 | * @mac_ctx: Global MAC Context |
| 1294 | * |
| 1295 | * Release the remain on channel request command from the queue |
| 1296 | * |
| 1297 | * Return: None |
| 1298 | */ |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 1299 | void csr_release_roc_req_cmd(tpAniSirGlobal mac_ctx, tSmeCmd *sme_cmd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1300 | { |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 1301 | if (eSmeCommandRemainOnChannel == sme_cmd->command) { |
| 1302 | remainOnChanCallback callback = |
| 1303 | sme_cmd->u.remainChlCmd.callback; |
| 1304 | /* process the msg */ |
| 1305 | if (callback) |
| 1306 | callback(mac_ctx, |
| 1307 | sme_cmd->u.remainChlCmd.callbackCtx, 0, |
| 1308 | sme_cmd->u.remainChlCmd.scan_id); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1309 | sme_err("Remove RoC Request from Active Cmd List"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1310 | } |
| 1311 | } |
| 1312 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 1313 | void csr_cancel_command(tpAniSirGlobal mac_ctx, tSmeCmd *sme_cmd) |
| 1314 | { |
| 1315 | switch (sme_cmd->command) { |
| 1316 | case eSmeCommandRemainOnChannel: |
| 1317 | if (NULL != sme_cmd->u.remainChlCmd.callback) { |
| 1318 | remainOnChanCallback callback = |
| 1319 | sme_cmd->u.remainChlCmd.callback; |
| 1320 | /* process the msg */ |
| 1321 | if (callback) { |
| 1322 | callback(mac_ctx, sme_cmd->u.remainChlCmd. |
| 1323 | callbackCtx, eCSR_SCAN_ABORT, |
| 1324 | sme_cmd->u.remainChlCmd.scan_id); |
| 1325 | } |
| 1326 | } |
| 1327 | break; |
| 1328 | case eSmeCommandScan: |
| 1329 | /* |
| 1330 | * We need to inform the requester before dropping |
| 1331 | * the scan command |
| 1332 | */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1333 | sme_warn("Drop scan reason %d callback %p", |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 1334 | sme_cmd->u.scanCmd.reason, |
| 1335 | sme_cmd->u.scanCmd.callback); |
| 1336 | if (NULL != sme_cmd->u.scanCmd.callback) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1337 | sme_warn("callback scan requester"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 1338 | csr_scan_call_callback(mac_ctx, sme_cmd, |
| 1339 | eCSR_SCAN_ABORT); |
| 1340 | } |
| 1341 | break; |
| 1342 | default: |
| 1343 | break; |
| 1344 | } |
| 1345 | } |
| 1346 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1347 | void csr_roam_substate_change(tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, |
| 1348 | uint32_t sessionId) |
| 1349 | { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1350 | sme_debug("CSR RoamSubstate: [ %s <== %s ]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1351 | mac_trace_getcsr_roam_sub_state(NewSubstate), |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1352 | mac_trace_getcsr_roam_sub_state(pMac->roam. |
| 1353 | curSubState[sessionId])); |
| 1354 | if (pMac->roam.curSubState[sessionId] == NewSubstate) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1355 | return; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1356 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1357 | pMac->roam.curSubState[sessionId] = NewSubstate; |
| 1358 | } |
| 1359 | |
| 1360 | eCsrRoamState csr_roam_state_change(tpAniSirGlobal pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1361 | eCsrRoamState NewRoamState, |
| 1362 | uint8_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1363 | { |
| 1364 | eCsrRoamState PreviousState; |
| 1365 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1366 | sme_debug("CSR RoamState[%hu]: [ %s <== %s ]", sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1367 | mac_trace_getcsr_roam_state(NewRoamState), |
| 1368 | mac_trace_getcsr_roam_state(pMac->roam.curState[sessionId])); |
| 1369 | PreviousState = pMac->roam.curState[sessionId]; |
| 1370 | |
| 1371 | if (NewRoamState != pMac->roam.curState[sessionId]) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1372 | /* Whenever we transition OUT of the Roaming state, |
| 1373 | * clear the Roaming substate. |
| 1374 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1375 | if (CSR_IS_ROAM_JOINING(pMac, sessionId)) { |
| 1376 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_NONE, |
| 1377 | sessionId); |
| 1378 | } |
| 1379 | |
| 1380 | pMac->roam.curState[sessionId] = NewRoamState; |
| 1381 | } |
| 1382 | return PreviousState; |
| 1383 | } |
| 1384 | |
| 1385 | void csr_assign_rssi_for_category(tpAniSirGlobal pMac, int8_t bestApRssi, |
| 1386 | uint8_t catOffset) |
| 1387 | { |
| 1388 | int i; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1389 | |
| 1390 | sme_debug("best AP RSSI: %d cat offset: %d", bestApRssi, catOffset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1391 | if (catOffset) { |
| 1392 | pMac->roam.configParam.bCatRssiOffset = catOffset; |
| 1393 | for (i = 0; i < CSR_NUM_RSSI_CAT; i++) { |
| 1394 | pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - |
| 1395 | 1] = |
| 1396 | (int)bestApRssi - |
| 1397 | pMac->roam.configParam.nSelect5GHzMargin - |
| 1398 | (int)(i * catOffset); |
| 1399 | } |
| 1400 | } |
| 1401 | } |
| 1402 | |
| 1403 | static void init_config_param(tpAniSirGlobal pMac) |
| 1404 | { |
| 1405 | int i; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1406 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1407 | pMac->roam.configParam.agingCount = CSR_AGING_COUNT; |
| 1408 | pMac->roam.configParam.channelBondingMode24GHz = |
| 1409 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 1410 | pMac->roam.configParam.channelBondingMode5GHz = |
| 1411 | WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 1412 | |
| 1413 | pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_AUTO; |
| 1414 | pMac->roam.configParam.eBand = eCSR_BAND_ALL; |
| 1415 | pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO; |
| 1416 | pMac->roam.configParam.FragmentationThreshold = |
| 1417 | eCSR_DOT11_FRAG_THRESH_DEFAULT; |
| 1418 | pMac->roam.configParam.HeartbeatThresh24 = 40; |
| 1419 | pMac->roam.configParam.HeartbeatThresh50 = 40; |
| 1420 | pMac->roam.configParam.Is11dSupportEnabled = false; |
| 1421 | pMac->roam.configParam.Is11dSupportEnabledOriginal = false; |
| 1422 | pMac->roam.configParam.Is11eSupportEnabled = true; |
| 1423 | pMac->roam.configParam.Is11hSupportEnabled = true; |
| 1424 | pMac->roam.configParam.RTSThreshold = 2346; |
| 1425 | pMac->roam.configParam.shortSlotTime = true; |
| 1426 | pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto; |
| 1427 | pMac->roam.configParam.ProprietaryRatesEnabled = true; |
| 1428 | pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1429 | for (i = 0; i < CSR_NUM_RSSI_CAT; i++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1430 | pMac->roam.configParam.BssPreferValue[i] = i; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1431 | csr_assign_rssi_for_category(pMac, CSR_BEST_RSSI_VALUE, |
Varun Reddy Yeturu | 044bda2 | 2015-11-21 22:03:40 -0800 | [diff] [blame] | 1432 | CSR_DEFAULT_RSSI_DB_GAP); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1433 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = false; |
| 1434 | pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; |
| 1435 | pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; |
| 1436 | pMac->roam.configParam.nPassiveMaxChnTime = |
| 1437 | CSR_PASSIVE_MAX_CHANNEL_TIME; |
| 1438 | pMac->roam.configParam.nPassiveMinChnTime = |
| 1439 | CSR_PASSIVE_MIN_CHANNEL_TIME; |
| 1440 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1441 | pMac->roam.configParam.nActiveMaxChnTimeConc = |
| 1442 | CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; |
| 1443 | pMac->roam.configParam.nActiveMinChnTimeConc = |
| 1444 | CSR_ACTIVE_MIN_CHANNEL_TIME_CONC; |
| 1445 | pMac->roam.configParam.nPassiveMaxChnTimeConc = |
| 1446 | CSR_PASSIVE_MAX_CHANNEL_TIME_CONC; |
| 1447 | pMac->roam.configParam.nPassiveMinChnTimeConc = |
| 1448 | CSR_PASSIVE_MIN_CHANNEL_TIME_CONC; |
| 1449 | pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC; |
Agrawal Ashish | 17bb390 | 2016-05-05 13:29:40 +0530 | [diff] [blame] | 1450 | pMac->roam.configParam.min_rest_time_conc = CSR_MIN_REST_TIME_CONC; |
| 1451 | pMac->roam.configParam.idle_time_conc = CSR_IDLE_TIME_CONC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1452 | #endif |
| 1453 | pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 1454 | pMac->roam.configParam.allow_tpc_from_ap = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1455 | pMac->roam.configParam.statsReqPeriodicity = |
| 1456 | CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; |
| 1457 | pMac->roam.configParam.statsReqPeriodicityInPS = |
| 1458 | CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1459 | pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1460 | pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3; |
| 1461 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = |
| 1462 | 120; |
Varun Reddy Yeturu | 168134f | 2017-06-26 13:46:05 -0700 | [diff] [blame] | 1463 | pMac->roam.configParam.neighborRoamConfig.rssi_thresh_offset_5g = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1464 | pMac->roam.configParam.neighborRoamConfig.nOpportunisticThresholdDiff = |
| 1465 | 30; |
| 1466 | pMac->roam.configParam.neighborRoamConfig.nRoamRescanRssiDiff = 5; |
| 1467 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20; |
| 1468 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40; |
| 1469 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = |
| 1470 | 200; |
Sridhar Selvaraj | 1b2330c | 2017-07-21 15:16:42 +0530 | [diff] [blame] | 1471 | pMac->roam.configParam.neighborRoamConfig. |
| 1472 | neighbor_scan_min_timer_period = 200; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1473 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList. |
| 1474 | numChannels = 3; |
| 1475 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList. |
| 1476 | channelList[0] = 1; |
| 1477 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList. |
| 1478 | channelList[1] = 6; |
| 1479 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList. |
| 1480 | channelList[2] = 11; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1481 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod |
| 1482 | = 20000; /* 20 seconds */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1483 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = 0; |
| 1484 | pMac->roam.configParam.neighborRoamConfig.nRoamBmissFirstBcnt = 10; |
| 1485 | pMac->roam.configParam.neighborRoamConfig.nRoamBmissFinalBcnt = 10; |
| 1486 | pMac->roam.configParam.neighborRoamConfig.nRoamBeaconRssiWeight = 14; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1487 | pMac->roam.configParam.nVhtChannelWidth = |
| 1488 | WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1489 | |
| 1490 | pMac->roam.configParam.addTSWhenACMIsOff = 0; |
| 1491 | pMac->roam.configParam.fScanTwice = false; |
| 1492 | |
| 1493 | /* Remove this code once SLM_Sessionization is supported */ |
| 1494 | /* BMPS_WORKAROUND_NOT_NEEDED */ |
| 1495 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 1496 | |
| 1497 | pMac->roam.configParam.nInitialDwellTime = 0; |
| 1498 | pMac->roam.configParam.initial_scan_no_dfs_chnl = 0; |
| 1499 | } |
| 1500 | |
| 1501 | eCsrBand csr_get_current_band(tHalHandle hHal) |
| 1502 | { |
| 1503 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1504 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1505 | return pMac->roam.configParam.bandCapability; |
| 1506 | } |
| 1507 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1508 | /* This function flushes the roam scan cache */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1509 | QDF_STATUS csr_flush_cfg_bg_scan_roam_channel_list(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1510 | uint8_t sessionId) |
| 1511 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1512 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1513 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1514 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = |
| 1515 | &pMac->roam.neighborRoamInfo[sessionId]; |
| 1516 | |
| 1517 | /* Free up the memory first (if required) */ |
| 1518 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1519 | qdf_mem_free(pNeighborRoamInfo->cfgParams.channelInfo. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1520 | ChannelList); |
| 1521 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 1522 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
| 1523 | } |
| 1524 | return status; |
| 1525 | } |
| 1526 | |
| 1527 | /* |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1528 | * This function flushes the roam scan cache and creates fresh cache |
| 1529 | * based on the input channel list |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1530 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1531 | QDF_STATUS csr_create_bg_scan_roam_channel_list(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1532 | uint8_t sessionId, |
| 1533 | const uint8_t *pChannelList, |
| 1534 | const uint8_t numChannels) |
| 1535 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1536 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1537 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = |
| 1538 | &pMac->roam.neighborRoamInfo[sessionId]; |
| 1539 | |
| 1540 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = numChannels; |
| 1541 | |
| 1542 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1543 | qdf_mem_malloc(pNeighborRoamInfo->cfgParams.channelInfo. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1544 | numOfChannels); |
| 1545 | |
| 1546 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1547 | sme_err("Memory Allocation for CFG Channel List failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1548 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1549 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1550 | } |
| 1551 | |
| 1552 | /* Update the roam global structure */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1553 | qdf_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1554 | pChannelList, |
| 1555 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1556 | return status; |
| 1557 | } |
| 1558 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1559 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1560 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1561 | /** |
| 1562 | * csr_create_roam_scan_channel_list() - create roam scan channel list |
| 1563 | * @pMac: Global mac pointer |
| 1564 | * @sessionId: session id |
| 1565 | * @pChannelList: pointer to channel list |
| 1566 | * @numChannels: number of channels |
| 1567 | * @eBand: band enumeration |
| 1568 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1569 | * This function modifies the roam scan channel list as per AP neighbor |
| 1570 | * report; AP neighbor report may be empty or may include only other AP |
| 1571 | * channels; in any case, we merge the channel list with the learned occupied |
| 1572 | * channels list. |
| 1573 | * if the band is 2.4G, then make sure channel list contains only 2.4G |
| 1574 | * valid channels if the band is 5G, then make sure channel list contains |
| 1575 | * only 5G valid channels |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1576 | * |
| 1577 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1578 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1579 | QDF_STATUS csr_create_roam_scan_channel_list(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1580 | uint8_t sessionId, |
| 1581 | uint8_t *pChannelList, |
| 1582 | uint8_t numChannels, |
| 1583 | const eCsrBand eBand) |
| 1584 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1585 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1586 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1587 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo |
| 1588 | = &pMac->roam.neighborRoamInfo[sessionId]; |
| 1589 | uint8_t outNumChannels = 0; |
| 1590 | uint8_t inNumChannels = numChannels; |
| 1591 | uint8_t *inPtr = pChannelList; |
| 1592 | uint8_t i = 0; |
| 1593 | uint8_t ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; |
| 1594 | uint8_t tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; |
| 1595 | uint8_t mergedOutputNumOfChannels = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1596 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1597 | tpCsrChannelInfo currChannelListInfo |
| 1598 | = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 1599 | /* |
| 1600 | * Create a Union of occupied channel list learnt by the DUT along |
| 1601 | * with the Neighbor report Channels. This increases the chances of |
| 1602 | * the DUT to get a candidate AP while roaming even if the Neighbor |
| 1603 | * Report is not able to provide sufficient information. |
| 1604 | */ |
| 1605 | if (pMac->scan.occupiedChannels[sessionId].numChannels) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1606 | csr_neighbor_roam_merge_channel_lists(pMac, &pMac->scan. |
| 1607 | occupiedChannels[sessionId]. |
| 1608 | channelList[0], pMac->scan. |
| 1609 | occupiedChannels[sessionId]. |
| 1610 | numChannels, inPtr, |
| 1611 | inNumChannels, |
| 1612 | &mergedOutputNumOfChannels); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1613 | inNumChannels = mergedOutputNumOfChannels; |
| 1614 | } |
| 1615 | if (eCSR_BAND_24 == eBand) { |
| 1616 | for (i = 0; i < inNumChannels; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 1617 | if (WLAN_REG_IS_24GHZ_CH(inPtr[i]) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1618 | && csr_roam_is_channel_valid(pMac, inPtr[i])) { |
| 1619 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1620 | } |
| 1621 | } |
| 1622 | } else if (eCSR_BAND_5G == eBand) { |
| 1623 | for (i = 0; i < inNumChannels; i++) { |
| 1624 | /* Add 5G Non-DFS channel */ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 1625 | if (WLAN_REG_IS_5GHZ_CH(inPtr[i]) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1626 | csr_roam_is_channel_valid(pMac, inPtr[i]) && |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 1627 | !wlan_reg_is_dfs_ch(pMac->pdev, inPtr[i])) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1628 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1629 | } |
| 1630 | } |
| 1631 | } else if (eCSR_BAND_ALL == eBand) { |
| 1632 | for (i = 0; i < inNumChannels; i++) { |
| 1633 | if (csr_roam_is_channel_valid(pMac, inPtr[i]) && |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 1634 | !wlan_reg_is_dfs_ch(pMac->pdev, inPtr[i])) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1635 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1636 | } |
| 1637 | } |
| 1638 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1639 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1640 | "Invalid band, No operation carried out (Band %d)", |
| 1641 | eBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1642 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1643 | } |
| 1644 | /* |
| 1645 | * if roaming within band is enabled, then select only the |
| 1646 | * in band channels . |
| 1647 | * This is required only if the band capability is set to ALL, |
| 1648 | * E.g., if band capability is only 2.4G then all the channels in the |
| 1649 | * list are already filtered for 2.4G channels, hence ignore this check |
| 1650 | */ |
| 1651 | if ((eCSR_BAND_ALL == eBand) && CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac)) { |
| 1652 | csr_neighbor_roam_channels_filter_by_current_band(pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1653 | sessionId, |
| 1654 | ChannelList, |
| 1655 | outNumChannels, |
| 1656 | tmpChannelList, |
| 1657 | &outNumChannels); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1658 | qdf_mem_copy(ChannelList, tmpChannelList, outNumChannels); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1659 | } |
| 1660 | /* Prepare final roam scan channel list */ |
| 1661 | if (outNumChannels) { |
| 1662 | /* Clear the channel list first */ |
| 1663 | if (NULL != currChannelListInfo->ChannelList) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1664 | qdf_mem_free(currChannelListInfo->ChannelList); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1665 | currChannelListInfo->ChannelList = NULL; |
| 1666 | currChannelListInfo->numOfChannels = 0; |
| 1667 | } |
| 1668 | currChannelListInfo->ChannelList |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1669 | = qdf_mem_malloc(outNumChannels * sizeof(uint8_t)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1670 | if (NULL == currChannelListInfo->ChannelList) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1671 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1672 | "Failed to allocate memory for roam scan channel list"); |
| 1673 | currChannelListInfo->numOfChannels = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1674 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1675 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1676 | qdf_mem_copy(currChannelListInfo->ChannelList, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1677 | ChannelList, outNumChannels); |
| 1678 | } |
| 1679 | return status; |
| 1680 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1681 | |
| 1682 | /** |
| 1683 | * csr_roam_is_ese_assoc() - is this ese association |
| 1684 | * @mac_ctx: Global MAC context |
| 1685 | * @session_id: session identifier |
| 1686 | * |
| 1687 | * Returns whether the current association is a ESE assoc or not. |
| 1688 | * |
| 1689 | * Return: true if ese association; false otherwise |
| 1690 | */ |
Selvaraj, Sridhar | bc950df | 2016-07-05 15:35:47 +0530 | [diff] [blame] | 1691 | bool csr_roam_is_ese_assoc(tpAniSirGlobal mac_ctx, uint32_t session_id) |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1692 | { |
Srinivas Girigowda | 18dcf3d | 2015-12-16 18:11:48 -0800 | [diff] [blame] | 1693 | return mac_ctx->roam.neighborRoamInfo[session_id].isESEAssoc; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1694 | } |
| 1695 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1696 | |
| 1697 | /** |
| 1698 | * csr_roam_is_ese_ini_feature_enabled() - is ese feature enabled |
| 1699 | * @mac_ctx: Global MAC context |
| 1700 | * |
| 1701 | * Return: true if ese feature is enabled; false otherwise |
| 1702 | */ |
| 1703 | bool csr_roam_is_ese_ini_feature_enabled(tpAniSirGlobal pMac) |
| 1704 | { |
| 1705 | return pMac->roam.configParam.isEseIniFeatureEnabled; |
| 1706 | } |
| 1707 | |
| 1708 | /** |
| 1709 | * csr_tsm_stats_rsp_processor() - tsm stats response processor |
| 1710 | * @pMac: Global MAC context |
| 1711 | * @pMsg: Message pointer |
| 1712 | * |
| 1713 | * Return: None |
| 1714 | */ |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 1715 | static void csr_tsm_stats_rsp_processor(tpAniSirGlobal pMac, void *pMsg) |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1716 | { |
| 1717 | tAniGetTsmStatsRsp *pTsmStatsRsp = (tAniGetTsmStatsRsp *) pMsg; |
| 1718 | |
| 1719 | if (NULL != pTsmStatsRsp) { |
| 1720 | /* |
| 1721 | * Get roam Rssi request is backed up and passed back |
| 1722 | * to the response, Extract the request message |
| 1723 | * to fetch callback. |
| 1724 | */ |
| 1725 | tpAniGetTsmStatsReq reqBkp |
| 1726 | = (tAniGetTsmStatsReq *) pTsmStatsRsp->tsmStatsReq; |
| 1727 | |
| 1728 | if (NULL != reqBkp) { |
| 1729 | if (NULL != reqBkp->tsmStatsCallback) { |
| 1730 | ((tCsrTsmStatsCallback) |
| 1731 | (reqBkp->tsmStatsCallback))(pTsmStatsRsp-> |
| 1732 | tsmMetrics, |
| 1733 | pTsmStatsRsp-> |
| 1734 | staId, |
| 1735 | reqBkp-> |
| 1736 | pDevContext); |
| 1737 | reqBkp->tsmStatsCallback = NULL; |
| 1738 | } |
| 1739 | qdf_mem_free(reqBkp); |
| 1740 | pTsmStatsRsp->tsmStatsReq = NULL; |
| 1741 | } else { |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1742 | if (NULL != reqBkp) { |
| 1743 | qdf_mem_free(reqBkp); |
| 1744 | pTsmStatsRsp->tsmStatsReq = NULL; |
| 1745 | } |
| 1746 | } |
| 1747 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1748 | sme_err("pTsmStatsRsp is NULL"); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1749 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1750 | } |
| 1751 | |
| 1752 | /** |
| 1753 | * csr_send_ese_adjacent_ap_rep_ind() - ese send adjacent ap report |
| 1754 | * @pMac: Global MAC context |
| 1755 | * @pSession: Session pointer |
| 1756 | * |
| 1757 | * Return: None |
| 1758 | */ |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 1759 | static void csr_send_ese_adjacent_ap_rep_ind(tpAniSirGlobal pMac, |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1760 | tCsrRoamSession *pSession) |
| 1761 | { |
| 1762 | uint32_t roamTS2 = 0; |
| 1763 | tCsrRoamInfo roamInfo; |
| 1764 | tpPESession pSessionEntry = NULL; |
| 1765 | uint8_t sessionId = CSR_SESSION_ID_INVALID; |
| 1766 | |
| 1767 | if (NULL == pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1768 | sme_err("pSession is NULL"); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1769 | return; |
| 1770 | } |
| 1771 | |
| 1772 | roamTS2 = qdf_mc_timer_get_system_time(); |
| 1773 | roamInfo.tsmRoamDelay = roamTS2 - pSession->roamTS1; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1774 | sme_debug("Bssid(" MAC_ADDRESS_STR ") Roaming Delay(%u ms)", |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1775 | MAC_ADDR_ARRAY(pSession->connectedProfile.bssid.bytes), |
| 1776 | roamInfo.tsmRoamDelay); |
| 1777 | |
| 1778 | pSessionEntry = pe_find_session_by_bssid(pMac, |
| 1779 | pSession->connectedProfile.bssid.bytes, |
| 1780 | &sessionId); |
| 1781 | if (NULL == pSessionEntry) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1782 | sme_err("session %d not found", sessionId); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1783 | return; |
| 1784 | } |
| 1785 | |
| 1786 | pSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly |
| 1787 | = roamInfo.tsmRoamDelay; |
| 1788 | |
| 1789 | csr_roam_call_callback(pMac, pSession->sessionId, &roamInfo, |
| 1790 | 0, eCSR_ROAM_ESE_ADJ_AP_REPORT_IND, 0); |
| 1791 | } |
| 1792 | |
| 1793 | /** |
| 1794 | * csr_get_tsm_stats() - get tsm stats |
| 1795 | * @pMac: Global MAC context |
| 1796 | * @callback: TSM stats callback |
| 1797 | * @staId: Station id |
| 1798 | * @bssId: bssid |
| 1799 | * @pContext: pointer to context |
| 1800 | * @p_cds_context: cds context |
| 1801 | * @tid: traffic id |
| 1802 | * |
| 1803 | * Return: QDF_STATUS enumeration |
| 1804 | */ |
| 1805 | QDF_STATUS csr_get_tsm_stats(tpAniSirGlobal pMac, |
| 1806 | tCsrTsmStatsCallback callback, |
| 1807 | uint8_t staId, |
| 1808 | struct qdf_mac_addr bssId, |
| 1809 | void *pContext, void *p_cds_context, uint8_t tid) |
| 1810 | { |
| 1811 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1812 | tAniGetTsmStatsReq *pMsg = NULL; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1813 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1814 | pMsg = qdf_mem_malloc(sizeof(tAniGetTsmStatsReq)); |
| 1815 | if (!pMsg) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1816 | sme_err( |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1817 | "csr_get_tsm_stats: failed to allocate mem for req"); |
| 1818 | return QDF_STATUS_E_NOMEM; |
| 1819 | } |
| 1820 | /* need to initiate a stats request to PE */ |
| 1821 | pMsg->msgType = eWNI_SME_GET_TSM_STATS_REQ; |
| 1822 | pMsg->msgLen = (uint16_t) sizeof(tAniGetTsmStatsReq); |
| 1823 | pMsg->staId = staId; |
| 1824 | pMsg->tid = tid; |
| 1825 | qdf_copy_macaddr(&pMsg->bssId, &bssId); |
| 1826 | pMsg->tsmStatsCallback = callback; |
| 1827 | pMsg->pDevContext = pContext; |
| 1828 | pMsg->p_cds_context = p_cds_context; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 1829 | status = umac_send_mb_message_to_mac(pMsg); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1830 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1831 | sme_debug("csr_get_tsm_stats: failed to send down the rssi req"); |
| 1832 | /* pMsg is freed by cds_send_mb_message_to_mac */ |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1833 | status = QDF_STATUS_E_FAILURE; |
| 1834 | } |
| 1835 | return status; |
| 1836 | } |
| 1837 | |
| 1838 | /** |
| 1839 | * csr_fetch_ch_lst_from_received_list() - fetch channel list from received list |
| 1840 | * and update req msg |
| 1841 | * paramters |
| 1842 | * @mac_ctx: global mac ctx |
| 1843 | * @roam_info: roam info struct |
| 1844 | * @curr_ch_lst_info: current channel list info |
| 1845 | * @req_buf: out param, roam offload scan request packet |
| 1846 | * |
| 1847 | * Return: void |
| 1848 | */ |
| 1849 | static void |
| 1850 | csr_fetch_ch_lst_from_received_list(tpAniSirGlobal mac_ctx, |
| 1851 | tpCsrNeighborRoamControlInfo roam_info, |
| 1852 | tpCsrChannelInfo curr_ch_lst_info, |
| 1853 | tSirRoamOffloadScanReq *req_buf) |
| 1854 | { |
| 1855 | uint8_t i = 0; |
| 1856 | uint8_t num_channels = 0; |
| 1857 | uint8_t *ch_lst = NULL; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 1858 | uint16_t unsafe_chan[NUM_CHANNELS]; |
| 1859 | uint16_t unsafe_chan_cnt = 0; |
| 1860 | uint16_t cnt = 0; |
| 1861 | bool is_unsafe_chan; |
| 1862 | qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); |
| 1863 | |
| 1864 | if (!qdf_ctx) { |
| 1865 | cds_err("qdf_ctx is NULL"); |
| 1866 | return; |
| 1867 | } |
| 1868 | pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, |
| 1869 | &unsafe_chan_cnt, |
| 1870 | sizeof(unsafe_chan)); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1871 | |
| 1872 | if (curr_ch_lst_info->numOfChannels == 0) |
| 1873 | return; |
| 1874 | |
| 1875 | ch_lst = curr_ch_lst_info->ChannelList; |
| 1876 | for (i = 0; i < curr_ch_lst_info->numOfChannels; i++) { |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 1877 | if ((!mac_ctx->roam.configParam.allowDFSChannelRoam || |
| 1878 | (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == |
| 1879 | CSR_STA_ROAM_POLICY_DFS_DISABLED)) && |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 1880 | (wlan_reg_is_dfs_ch(mac_ctx->pdev, *ch_lst))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1881 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 1882 | ("ignoring dfs channel %d"), *ch_lst); |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 1883 | ch_lst++; |
| 1884 | continue; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1885 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 1886 | |
| 1887 | if (mac_ctx->roam.configParam.sta_roam_policy. |
| 1888 | skip_unsafe_channels && |
| 1889 | unsafe_chan_cnt) { |
| 1890 | is_unsafe_chan = false; |
| 1891 | for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { |
| 1892 | if (unsafe_chan[cnt] == *ch_lst) { |
| 1893 | is_unsafe_chan = true; |
| 1894 | break; |
| 1895 | } |
| 1896 | } |
| 1897 | if (is_unsafe_chan) { |
| 1898 | QDF_TRACE(QDF_MODULE_ID_SME, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1899 | QDF_TRACE_LEVEL_DEBUG, |
| 1900 | ("ignoring unsafe channel %d"), |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 1901 | *ch_lst); |
| 1902 | ch_lst++; |
| 1903 | continue; |
| 1904 | } |
| 1905 | } |
| 1906 | req_buf->ConnectedNetwork.ChannelCache[num_channels++] = |
| 1907 | *ch_lst; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1908 | ch_lst++; |
| 1909 | } |
| 1910 | req_buf->ConnectedNetwork.ChannelCount = num_channels; |
| 1911 | req_buf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
| 1912 | } |
| 1913 | |
| 1914 | /** |
| 1915 | * csr_set_cckm_ie() - set CCKM IE |
| 1916 | * @pMac: Global MAC context |
| 1917 | * @sessionId: session identifier |
| 1918 | * @pCckmIe: Pointer to input CCKM IE data |
| 1919 | * @ccKmIeLen: Length of @pCckmIe |
| 1920 | * |
| 1921 | * This function stores the CCKM IE passed by the supplicant |
| 1922 | * in a place holder data structure and this IE will be packed inside |
| 1923 | * reassociation request |
| 1924 | * |
| 1925 | * Return: QDF_STATUS enumeration |
| 1926 | */ |
| 1927 | QDF_STATUS csr_set_cckm_ie(tpAniSirGlobal pMac, const uint8_t sessionId, |
| 1928 | const uint8_t *pCckmIe, const uint8_t ccKmIeLen) |
| 1929 | { |
| 1930 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1931 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1932 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1933 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 1934 | sme_err("session %d not found", sessionId); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1935 | return QDF_STATUS_E_FAILURE; |
| 1936 | } |
| 1937 | qdf_mem_copy(pSession->suppCckmIeInfo.cckmIe, pCckmIe, ccKmIeLen); |
| 1938 | pSession->suppCckmIeInfo.cckmIeLen = ccKmIeLen; |
| 1939 | return status; |
| 1940 | } |
| 1941 | |
| 1942 | /** |
| 1943 | * csr_roam_read_tsf() - read TSF |
| 1944 | * @pMac: Global MAC context |
| 1945 | * @sessionId: session identifier |
| 1946 | * @pTimestamp: output TSF timestamp |
| 1947 | * |
| 1948 | * This function reads the TSF; and also add the time elapsed since |
| 1949 | * last beacon or probe response reception from the hand off AP to arrive at |
| 1950 | * the latest TSF value. |
| 1951 | * |
| 1952 | * Return: QDF_STATUS enumeration |
| 1953 | */ |
| 1954 | QDF_STATUS csr_roam_read_tsf(tpAniSirGlobal pMac, uint8_t *pTimestamp, |
| 1955 | uint8_t sessionId) |
| 1956 | { |
| 1957 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | 258594c | 2016-07-31 15:17:45 +0530 | [diff] [blame] | 1958 | tCsrNeighborRoamBSSInfo handoffNode = {{0} }; |
Arun Khandavalli | 8a711cb | 2017-01-03 20:23:56 +0530 | [diff] [blame] | 1959 | uint64_t timer_diff = 0; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1960 | uint32_t timeStamp[2]; |
| 1961 | tpSirBssDescription pBssDescription = NULL; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1962 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1963 | csr_neighbor_roam_get_handoff_ap_info(pMac, &handoffNode, sessionId); |
| 1964 | pBssDescription = handoffNode.pBssDescription; |
Arun Khandavalli | 8a711cb | 2017-01-03 20:23:56 +0530 | [diff] [blame] | 1965 | /* Get the time diff in nano seconds */ |
| 1966 | timer_diff = (qdf_get_monotonic_boottime_ns() - |
| 1967 | pBssDescription->scansystimensec); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1968 | /* Convert msec to micro sec timer */ |
Sarada Prasanna Garnayak | f21c296 | 2017-03-08 20:42:38 +0530 | [diff] [blame] | 1969 | timer_diff = do_div(timer_diff, SYSTEM_TIME_NSEC_TO_USEC); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 1970 | timeStamp[0] = pBssDescription->timeStamp[0]; |
| 1971 | timeStamp[1] = pBssDescription->timeStamp[1]; |
| 1972 | update_cckmtsf(&(timeStamp[0]), &(timeStamp[1]), &timer_diff); |
| 1973 | qdf_mem_copy(pTimestamp, (void *)&timeStamp[0], sizeof(uint32_t) * 2); |
| 1974 | return status; |
| 1975 | } |
| 1976 | |
| 1977 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1978 | |
Mahesh Kumar Kalikot Veetil | 4057511 | 2016-09-09 16:57:08 -0700 | [diff] [blame] | 1979 | /** |
| 1980 | * csr_roam_is_roam_offload_scan_enabled() - is roam offload enabled |
| 1981 | * @mac_ctx: Global MAC context |
| 1982 | * |
| 1983 | * Returns whether firmware based background scan is currently enabled or not. |
| 1984 | * |
| 1985 | * Return: true if roam offload scan enabled; false otherwise |
| 1986 | */ |
| 1987 | bool csr_roam_is_roam_offload_scan_enabled(tpAniSirGlobal mac_ctx) |
| 1988 | { |
| 1989 | return mac_ctx->roam.configParam.isRoamOffloadScanEnabled; |
| 1990 | } |
| 1991 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1992 | QDF_STATUS csr_set_band(tHalHandle hHal, uint8_t sessionId, eCsrBand eBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1993 | { |
| 1994 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1995 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1996 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1997 | if (CSR_IS_PHY_MODE_A_ONLY(pMac) && (eBand == eCSR_BAND_24)) { |
| 1998 | /* DOT11 mode configured to 11a only and received |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 1999 | * request to change the band to 2.4 GHz |
| 2000 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2001 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2002 | "failed to set band cfg80211 = %u, band = %u", |
| 2003 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2004 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2005 | } |
| 2006 | if ((CSR_IS_PHY_MODE_B_ONLY(pMac) || |
| 2007 | CSR_IS_PHY_MODE_G_ONLY(pMac)) && (eBand == eCSR_BAND_5G)) { |
| 2008 | /* DOT11 mode configured to 11b/11g only and received |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2009 | * request to change the band to 5 GHz |
| 2010 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2011 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2012 | "failed to set band dot11mode = %u, band = %u", |
| 2013 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2014 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2015 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2016 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2017 | "Band changed to %u (0 - ALL, 1 - 2.4 GHZ, 2 - 5GHZ)", eBand); |
| 2018 | pMac->roam.configParam.eBand = eBand; |
| 2019 | pMac->roam.configParam.bandCapability = eBand; |
| 2020 | |
| 2021 | status = csr_get_channel_and_power_list(pMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2022 | if (QDF_STATUS_SUCCESS == status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2023 | csr_apply_channel_and_power_list(pMac); |
| 2024 | return status; |
| 2025 | } |
| 2026 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2027 | /* The funcns csr_convert_cb_ini_value_to_phy_cb_state and |
| 2028 | * csr_convert_phy_cb_state_to_ini_value have been introduced |
| 2029 | * to convert the ini value to the ENUM used in csr and MAC for CB state |
| 2030 | * Ideally we should have kept the ini value and enum value same and |
| 2031 | * representing the same cb values as in 11n standard i.e. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2032 | * Set to 1 (SCA) if the secondary channel is above the primary channel |
| 2033 | * Set to 3 (SCB) if the secondary channel is below the primary channel |
| 2034 | * Set to 0 (SCN) if no secondary channel is present |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2035 | * However, since our driver is already distributed we will keep the ini |
| 2036 | * definition as it is which is: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2037 | * 0 - secondary none |
| 2038 | * 1 - secondary LOW |
| 2039 | * 2 - secondary HIGH |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2040 | * and convert to enum value used within the driver in |
| 2041 | * csr_change_default_config_param using this funcn |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2042 | * The enum values are as follows: |
| 2043 | * PHY_SINGLE_CHANNEL_CENTERED = 0 |
| 2044 | * PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1 |
| 2045 | * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 2046 | */ |
| 2047 | ePhyChanBondState csr_convert_cb_ini_value_to_phy_cb_state(uint32_t cbIniValue) |
| 2048 | { |
| 2049 | |
| 2050 | ePhyChanBondState phyCbState; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2051 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2052 | switch (cbIniValue) { |
| 2053 | /* secondary none */ |
| 2054 | case eCSR_INI_SINGLE_CHANNEL_CENTERED: |
| 2055 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 2056 | break; |
| 2057 | /* secondary LOW */ |
| 2058 | case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 2059 | phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 2060 | break; |
| 2061 | /* secondary HIGH */ |
| 2062 | case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 2063 | phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 2064 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2065 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 2066 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
| 2067 | break; |
| 2068 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 2069 | phyCbState = |
| 2070 | PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 2071 | break; |
| 2072 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 2073 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED; |
| 2074 | break; |
| 2075 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 2076 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 2077 | break; |
| 2078 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 2079 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
| 2080 | break; |
| 2081 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 2082 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 2083 | break; |
| 2084 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 2085 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 2086 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2087 | default: |
| 2088 | /* If an invalid value is passed, disable CHANNEL BONDING */ |
| 2089 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 2090 | break; |
| 2091 | } |
| 2092 | return phyCbState; |
| 2093 | } |
| 2094 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 2095 | static |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2096 | uint32_t csr_convert_phy_cb_state_to_ini_value(ePhyChanBondState phyCbState) |
| 2097 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2098 | uint32_t cbIniValue; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2099 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2100 | switch (phyCbState) { |
| 2101 | /* secondary none */ |
| 2102 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 2103 | cbIniValue = eCSR_INI_SINGLE_CHANNEL_CENTERED; |
| 2104 | break; |
| 2105 | /* secondary LOW */ |
| 2106 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 2107 | cbIniValue = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 2108 | break; |
| 2109 | /* secondary HIGH */ |
| 2110 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 2111 | cbIniValue = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 2112 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2113 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 2114 | cbIniValue = |
| 2115 | eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
| 2116 | break; |
| 2117 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 2118 | cbIniValue = |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2119 | eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2120 | break; |
| 2121 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 2122 | cbIniValue = |
| 2123 | eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED; |
| 2124 | break; |
| 2125 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 2126 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 2127 | break; |
| 2128 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 2129 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
| 2130 | break; |
| 2131 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 2132 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 2133 | break; |
| 2134 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 2135 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 2136 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2137 | default: |
| 2138 | /* return some invalid value */ |
| 2139 | cbIniValue = eCSR_INI_CHANNEL_BONDING_STATE_MAX; |
| 2140 | break; |
| 2141 | } |
| 2142 | return cbIniValue; |
| 2143 | } |
| 2144 | |
Krishna Kumaar Natarajan | 90bb6f1 | 2017-03-03 21:05:52 -0800 | [diff] [blame] | 2145 | #ifdef WLAN_FEATURE_11AX |
| 2146 | /** |
| 2147 | * csr_update_he_config_param() - Update MAC context with HE config param |
| 2148 | * @mac_ctx: pointer to MAC context |
| 2149 | * @param: pointer to CSR config params |
| 2150 | * |
| 2151 | * Return: None |
| 2152 | */ |
| 2153 | static void csr_update_he_config_param(tpAniSirGlobal mac_ctx, |
| 2154 | tCsrConfigParam *param) |
| 2155 | { |
| 2156 | mac_ctx->roam.configParam.enable_ul_ofdma = param->enable_ul_ofdma; |
| 2157 | mac_ctx->roam.configParam.enable_ul_mimo = param->enable_ul_mimo; |
| 2158 | } |
| 2159 | |
| 2160 | /** |
| 2161 | * csr_get_he_config_param() - Get HE config param from MAC context |
| 2162 | * @param: pointer to CSR config params |
| 2163 | * @mac_ctx: pointer to MAC context |
| 2164 | * |
| 2165 | * Return: None |
| 2166 | */ |
| 2167 | static void csr_get_he_config_param(tCsrConfigParam *param, |
| 2168 | tpAniSirGlobal mac_ctx) |
| 2169 | { |
| 2170 | param->enable_ul_ofdma = mac_ctx->roam.configParam.enable_ul_ofdma; |
| 2171 | param->enable_ul_mimo = mac_ctx->roam.configParam.enable_ul_mimo; |
| 2172 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2173 | |
| 2174 | |
| 2175 | /** |
| 2176 | * csr_join_req_copy_he_cap() - Copy HE cap into CSR Join Req |
| 2177 | * @csr_join_req: pointer to CSR Join Req |
| 2178 | * @session: pointer to CSR session |
| 2179 | * |
| 2180 | * Return: None |
| 2181 | */ |
| 2182 | static void csr_join_req_copy_he_cap(tSirSmeJoinReq *csr_join_req, |
| 2183 | tCsrRoamSession *session) |
| 2184 | { |
| 2185 | qdf_mem_copy(&csr_join_req->he_config, &session->he_config, |
| 2186 | sizeof(session->he_config)); |
| 2187 | } |
| 2188 | |
| 2189 | /** |
| 2190 | * csr_start_bss_copy_he_cap() - Copy HE cap into CSR Join Req |
| 2191 | * @req: pointer to START BSS Req |
| 2192 | * @session: pointer to CSR session |
| 2193 | * |
| 2194 | * Return: None |
| 2195 | */ |
| 2196 | static void csr_start_bss_copy_he_cap(tSirSmeStartBssReq *req, |
| 2197 | tCsrRoamSession *session) |
| 2198 | { |
| 2199 | qdf_mem_copy(&req->he_config, &session->he_config, |
| 2200 | sizeof(session->he_config)); |
| 2201 | } |
| 2202 | |
| 2203 | static void csr_update_session_he_cap(tpAniSirGlobal mac_ctx, |
| 2204 | tCsrRoamSession *session) |
| 2205 | { |
| 2206 | uint32_t value = 0; |
| 2207 | tDot11fIEvendor_he_cap *he_cap = &session->he_config; |
| 2208 | |
| 2209 | he_cap->present = true; |
| 2210 | |
| 2211 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_CONTROL, &value); |
| 2212 | he_cap->htc_he = value; |
| 2213 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_TWT_REQUESTOR, &value); |
| 2214 | he_cap->twt_request = value; |
| 2215 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_TWT_RESPONDER, &value); |
| 2216 | he_cap->twt_responder = value; |
| 2217 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_FRAGMENTATION, &value); |
| 2218 | he_cap->fragmentation = value; |
| 2219 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MAX_FRAG_MSDU, &value); |
| 2220 | he_cap->max_num_frag_msdu = value; |
| 2221 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MIN_FRAG_SIZE, &value); |
| 2222 | he_cap->min_frag_size = value; |
| 2223 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_TRIG_PAD, &value); |
| 2224 | he_cap->trigger_frm_mac_pad = value; |
| 2225 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MTID_AGGR, &value); |
| 2226 | he_cap->multi_tid_aggr = value; |
| 2227 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_LINK_ADAPTATION, &value); |
| 2228 | he_cap->he_link_adaptation = value; |
| 2229 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_ALL_ACK, &value); |
| 2230 | he_cap->all_ack = value; |
| 2231 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_UL_MU_RSP_SCHEDULING, &value); |
| 2232 | he_cap->ul_mu_rsp_sched = value; |
| 2233 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_BUFFER_STATUS_RPT, &value); |
| 2234 | he_cap->a_bsr = value; |
| 2235 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_BCAST_TWT, &value); |
| 2236 | he_cap->broadcast_twt = value; |
| 2237 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_BA_32BIT, &value); |
| 2238 | he_cap->ba_32bit_bitmap = value; |
| 2239 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MU_CASCADING, &value); |
| 2240 | he_cap->mu_cascade = value; |
| 2241 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MULTI_TID, &value); |
| 2242 | he_cap->ack_enabled_multitid = value; |
| 2243 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_DL_MU_BA, &value); |
| 2244 | he_cap->dl_mu_ba = value; |
| 2245 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_OMI, &value); |
| 2246 | he_cap->omi_a_ctrl = value; |
| 2247 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_OFDMA_RA, &value); |
| 2248 | he_cap->ofdma_ra = value; |
| 2249 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MAX_AMPDU_LEN, &value); |
| 2250 | he_cap->max_ampdu_len = value; |
| 2251 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_AMSDU_FRAG, &value); |
| 2252 | he_cap->amsdu_frag = value; |
| 2253 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_FLEX_TWT_SCHED, &value); |
| 2254 | he_cap->flex_twt_sched = value; |
| 2255 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_RX_CTRL, &value); |
| 2256 | he_cap->rx_ctrl_frame = value; |
| 2257 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_BSRP_AMPDU_AGGR, &value); |
| 2258 | he_cap->bsrp_ampdu_aggr = value; |
| 2259 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_QTP, &value); |
| 2260 | he_cap->qtp = value; |
| 2261 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_A_BQR, &value); |
| 2262 | he_cap->a_bqr = value; |
| 2263 | |
| 2264 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_DUAL_BAND, &value); |
| 2265 | he_cap->dual_band = value; |
| 2266 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_CHAN_WIDTH, &value); |
| 2267 | he_cap->chan_width = value; |
| 2268 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_RX_PREAM_PUNC, &value); |
| 2269 | he_cap->rx_pream_puncturing = value; |
| 2270 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_CLASS_OF_DEVICE, &value); |
| 2271 | he_cap->device_class = value; |
| 2272 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_LDPC, &value); |
| 2273 | he_cap->ldpc_coding = value; |
| 2274 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_LTF_PPDU, &value); |
| 2275 | he_cap->he_ltf_gi_ppdu = value; |
| 2276 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_LTF_NDP, &value); |
| 2277 | he_cap->he_ltf_gi_ndp = value; |
| 2278 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_STBC, &value); |
| 2279 | he_cap->stbc = value; |
| 2280 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_DOPPLER, &value); |
| 2281 | he_cap->doppler = value; |
| 2282 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_UL_MUMIMO, &value); |
| 2283 | he_cap->ul_mu = value; |
| 2284 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_DCM_TX, &value); |
| 2285 | he_cap->dcm_enc_tx = value; |
| 2286 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_DCM_RX, &value); |
| 2287 | he_cap->dcm_enc_rx = value; |
| 2288 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MU_PPDU, &value); |
| 2289 | he_cap->ul_he_mu = value; |
| 2290 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_SU_BEAMFORMER, &value); |
| 2291 | he_cap->su_beamformer = value; |
| 2292 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_SU_BEAMFORMEE, &value); |
| 2293 | he_cap->su_beamformee = value; |
| 2294 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MU_BEAMFORMER, &value); |
| 2295 | he_cap->mu_beamformer = value; |
| 2296 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_BFEE_STS_LT80, &value); |
| 2297 | he_cap->bfee_sts_lt_80 = value; |
| 2298 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_NSTS_TOT_LT80, &value); |
| 2299 | he_cap->nsts_tol_lt_80 = value; |
| 2300 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_BFEE_STS_GT80, &value); |
| 2301 | he_cap->bfee_sta_gt_80 = value; |
| 2302 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_NSTS_TOT_GT80, &value); |
| 2303 | he_cap->nsts_tot_gt_80 = value; |
| 2304 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_NUM_SOUND_LT80, &value); |
| 2305 | he_cap->num_sounding_lt_80 = value; |
| 2306 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_NUM_SOUND_GT80, &value); |
| 2307 | he_cap->num_sounding_gt_80 = value; |
| 2308 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_SU_FEED_TONE16, &value); |
| 2309 | he_cap->su_feedback_tone16 = value; |
| 2310 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MU_FEED_TONE16, &value); |
| 2311 | he_cap->mu_feedback_tone16 = value; |
| 2312 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_CODEBOOK_SU, &value); |
| 2313 | he_cap->codebook_su = value; |
| 2314 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_CODEBOOK_MU, &value); |
| 2315 | he_cap->codebook_mu = value; |
| 2316 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_BFRM_FEED, &value); |
| 2317 | he_cap->beamforming_feedback = value; |
| 2318 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_ER_SU_PPDU, &value); |
| 2319 | he_cap->he_er_su_ppdu = value; |
| 2320 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_DL_PART_BW, &value); |
| 2321 | he_cap->dl_mu_mimo_part_bw = value; |
| 2322 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_PPET_PRESENT, &value); |
| 2323 | he_cap->ppet_present = value; |
| 2324 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_SRP, &value); |
| 2325 | he_cap->srp = value; |
| 2326 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_POWER_BOOST, &value); |
| 2327 | he_cap->power_boost = value; |
| 2328 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_4x_LTF_GI, &value); |
| 2329 | he_cap->he_ltf_gi_4x = value; |
| 2330 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_NSS, &value); |
| 2331 | he_cap->nss_supported = value; |
| 2332 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_MCS, &value); |
| 2333 | he_cap->mcs_supported = value; |
| 2334 | |
Krishna Kumaar Natarajan | bc59459 | 2017-04-12 19:02:39 -0700 | [diff] [blame] | 2335 | if (he_cap->ppet_present) { |
| 2336 | value = WNI_CFG_HE_PPET_LEN; |
| 2337 | sme_cfg_get_str(mac_ctx, WNI_CFG_HE_PPET, |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2338 | (void *)&he_cap->ppe_threshold, &value); |
Krishna Kumaar Natarajan | bc59459 | 2017-04-12 19:02:39 -0700 | [diff] [blame] | 2339 | } else { |
| 2340 | he_cap->ppe_threshold.present = false; |
| 2341 | } |
Manikandan Mohan | 39accff | 2017-05-02 16:09:00 -0700 | [diff] [blame] | 2342 | sme_cfg_get_int(mac_ctx, WNI_CFG_HE_STA_OBSSPD, &value); |
| 2343 | session->he_sta_obsspd = value; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2344 | } |
| 2345 | |
Krishna Kumaar Natarajan | 90bb6f1 | 2017-03-03 21:05:52 -0800 | [diff] [blame] | 2346 | #else |
| 2347 | static inline void csr_update_he_config_param(tpAniSirGlobal mac_ctx, |
| 2348 | tCsrConfigParam *param) |
| 2349 | { |
| 2350 | } |
| 2351 | |
| 2352 | static inline void csr_get_he_config_param(tCsrConfigParam *param, |
| 2353 | tpAniSirGlobal mac_ctx) |
| 2354 | { |
| 2355 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2356 | |
| 2357 | static inline void csr_join_req_copy_he_cap(tSirSmeJoinReq *csr_join_req, |
| 2358 | tCsrRoamSession *session) |
| 2359 | { |
| 2360 | } |
| 2361 | |
| 2362 | static inline void csr_start_bss_copy_he_cap(tSirSmeStartBssReq *req, |
| 2363 | tCsrRoamSession *session) |
| 2364 | { |
| 2365 | } |
| 2366 | |
| 2367 | static inline void csr_update_session_he_cap(tpAniSirGlobal mac_ctx, |
| 2368 | tCsrRoamSession *session) |
| 2369 | { |
| 2370 | } |
| 2371 | |
Krishna Kumaar Natarajan | 90bb6f1 | 2017-03-03 21:05:52 -0800 | [diff] [blame] | 2372 | #endif |
| 2373 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2374 | QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2375 | tCsrConfigParam *pParam) |
| 2376 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2377 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2378 | |
| 2379 | if (pParam) { |
Naveen Rawat | 2b6e3c9 | 2017-03-20 13:59:07 -0700 | [diff] [blame] | 2380 | pMac->roam.configParam.pkt_err_disconn_th = |
| 2381 | pParam->pkt_err_disconn_th; |
Naveen Rawat | b2fc413 | 2017-05-10 20:42:05 -0700 | [diff] [blame] | 2382 | pMac->roam.configParam.is_force_1x1 = |
| 2383 | pParam->is_force_1x1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2384 | pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode; |
| 2385 | cfg_set_int(pMac, WNI_CFG_WME_ENABLED, |
| 2386 | (pParam->WMMSupportMode == eCsrRoamWmmNoQos) ? 0 : 1); |
| 2387 | pMac->roam.configParam.Is11eSupportEnabled = |
| 2388 | pParam->Is11eSupportEnabled; |
| 2389 | pMac->roam.configParam.FragmentationThreshold = |
| 2390 | pParam->FragmentationThreshold; |
| 2391 | pMac->roam.configParam.Is11dSupportEnabled = |
| 2392 | pParam->Is11dSupportEnabled; |
| 2393 | pMac->roam.configParam.Is11dSupportEnabledOriginal = |
| 2394 | pParam->Is11dSupportEnabled; |
| 2395 | pMac->roam.configParam.Is11hSupportEnabled = |
| 2396 | pParam->Is11hSupportEnabled; |
| 2397 | |
| 2398 | pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; |
| 2399 | pMac->roam.configParam.mcc_rts_cts_prot_enable = |
| 2400 | pParam->mcc_rts_cts_prot_enable; |
| 2401 | pMac->roam.configParam.mcc_bcast_prob_resp_enable = |
| 2402 | pParam->mcc_bcast_prob_resp_enable; |
| 2403 | pMac->roam.configParam.fAllowMCCGODiffBI = |
| 2404 | pParam->fAllowMCCGODiffBI; |
| 2405 | |
| 2406 | /* channelBondingMode5GHz plays a dual role right now |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2407 | * INFRA STA will use this non zero value as CB enabled |
| 2408 | * and SOFTAP will use this non-zero value to determine |
| 2409 | * the secondary channel offset. This is how |
| 2410 | * channelBondingMode5GHz works now and this is kept intact |
| 2411 | * to avoid any cfg.ini change. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2412 | */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2413 | if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI) |
| 2414 | sme_warn("Invalid CB value from ini in 2.4GHz band %d, CB DISABLED", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2415 | pParam->channelBondingMode24GHz); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2416 | pMac->roam.configParam.channelBondingMode24GHz = |
| 2417 | csr_convert_cb_ini_value_to_phy_cb_state(pParam-> |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2418 | channelBondingMode24GHz); |
| 2419 | if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI) |
| 2420 | sme_warn("Invalid CB value from ini in 5GHz band %d, CB DISABLED", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2421 | pParam->channelBondingMode5GHz); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2422 | pMac->roam.configParam.channelBondingMode5GHz = |
| 2423 | csr_convert_cb_ini_value_to_phy_cb_state(pParam-> |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2424 | channelBondingMode5GHz); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2425 | pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold; |
| 2426 | pMac->roam.configParam.phyMode = pParam->phyMode; |
| 2427 | pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime; |
| 2428 | pMac->roam.configParam.HeartbeatThresh24 = |
| 2429 | pParam->HeartbeatThresh24; |
| 2430 | pMac->roam.configParam.HeartbeatThresh50 = |
| 2431 | pParam->HeartbeatThresh50; |
| 2432 | pMac->roam.configParam.ProprietaryRatesEnabled = |
| 2433 | pParam->ProprietaryRatesEnabled; |
| 2434 | pMac->roam.configParam.TxRate = pParam->TxRate; |
| 2435 | pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; |
| 2436 | pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; |
| 2437 | pMac->roam.configParam.bandCapability = pParam->bandCapability; |
| 2438 | pMac->roam.configParam.cbChoice = pParam->cbChoice; |
| 2439 | pMac->roam.configParam.neighborRoamConfig. |
| 2440 | delay_before_vdev_stop = |
| 2441 | pParam->neighborRoamConfig.delay_before_vdev_stop; |
| 2442 | |
| 2443 | /* if HDD passed down non zero values then only update, */ |
| 2444 | /* otherwise keep using the defaults */ |
| 2445 | if (pParam->initial_scan_no_dfs_chnl) { |
| 2446 | pMac->roam.configParam.initial_scan_no_dfs_chnl = |
| 2447 | pParam->initial_scan_no_dfs_chnl; |
| 2448 | } |
| 2449 | if (pParam->nInitialDwellTime) { |
| 2450 | pMac->roam.configParam.nInitialDwellTime = |
| 2451 | pParam->nInitialDwellTime; |
| 2452 | } |
| 2453 | if (pParam->nActiveMaxChnTime) { |
| 2454 | pMac->roam.configParam.nActiveMaxChnTime = |
| 2455 | pParam->nActiveMaxChnTime; |
| 2456 | cfg_set_int(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME, |
| 2457 | pParam->nActiveMaxChnTime); |
| 2458 | } |
| 2459 | if (pParam->nActiveMinChnTime) { |
| 2460 | pMac->roam.configParam.nActiveMinChnTime = |
| 2461 | pParam->nActiveMinChnTime; |
| 2462 | cfg_set_int(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME, |
| 2463 | pParam->nActiveMinChnTime); |
| 2464 | } |
| 2465 | if (pParam->nPassiveMaxChnTime) { |
| 2466 | pMac->roam.configParam.nPassiveMaxChnTime = |
| 2467 | pParam->nPassiveMaxChnTime; |
| 2468 | cfg_set_int(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, |
| 2469 | pParam->nPassiveMaxChnTime); |
| 2470 | } |
| 2471 | if (pParam->nPassiveMinChnTime) { |
| 2472 | pMac->roam.configParam.nPassiveMinChnTime = |
| 2473 | pParam->nPassiveMinChnTime; |
| 2474 | cfg_set_int(pMac, WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME, |
| 2475 | pParam->nPassiveMinChnTime); |
| 2476 | } |
| 2477 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 2478 | if (pParam->nActiveMaxChnTimeConc) { |
| 2479 | pMac->roam.configParam.nActiveMaxChnTimeConc = |
| 2480 | pParam->nActiveMaxChnTimeConc; |
| 2481 | } |
| 2482 | if (pParam->nActiveMinChnTimeConc) { |
| 2483 | pMac->roam.configParam.nActiveMinChnTimeConc = |
| 2484 | pParam->nActiveMinChnTimeConc; |
| 2485 | } |
| 2486 | if (pParam->nPassiveMaxChnTimeConc) { |
| 2487 | pMac->roam.configParam.nPassiveMaxChnTimeConc = |
| 2488 | pParam->nPassiveMaxChnTimeConc; |
| 2489 | } |
| 2490 | if (pParam->nPassiveMinChnTimeConc) { |
| 2491 | pMac->roam.configParam.nPassiveMinChnTimeConc = |
| 2492 | pParam->nPassiveMinChnTimeConc; |
| 2493 | } |
Agrawal Ashish | 17bb390 | 2016-05-05 13:29:40 +0530 | [diff] [blame] | 2494 | pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc; |
| 2495 | pMac->roam.configParam.min_rest_time_conc = |
| 2496 | pParam->min_rest_time_conc; |
| 2497 | pMac->roam.configParam.idle_time_conc = pParam->idle_time_conc; |
| 2498 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2499 | #endif |
| 2500 | pMac->roam.configParam.eBand = pParam->eBand; |
| 2501 | pMac->roam.configParam.uCfgDot11Mode = |
| 2502 | csr_get_cfg_dot11_mode_from_csr_phy_mode(NULL, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2503 | pMac->roam.configParam. |
| 2504 | phyMode, |
| 2505 | pMac->roam.configParam. |
| 2506 | ProprietaryRatesEnabled); |
| 2507 | /* if HDD passed down non zero values for age params, |
| 2508 | * then only update, otherwise keep using the defaults |
| 2509 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2510 | if (pParam->nScanResultAgeCount) { |
| 2511 | pMac->roam.configParam.agingCount = |
| 2512 | pParam->nScanResultAgeCount; |
| 2513 | } |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 2514 | if (pParam->obss_width_interval) { |
| 2515 | pMac->roam.configParam.obss_width_interval = |
| 2516 | pParam->obss_width_interval; |
| 2517 | cfg_set_int(pMac, |
| 2518 | WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL, |
| 2519 | pParam->obss_width_interval); |
| 2520 | } |
| 2521 | if (pParam->obss_active_dwelltime) { |
| 2522 | pMac->roam.configParam.obss_active_dwelltime = |
| 2523 | pParam->obss_active_dwelltime; |
| 2524 | cfg_set_int(pMac, |
| 2525 | WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME, |
| 2526 | pParam->obss_active_dwelltime); |
| 2527 | } |
| 2528 | if (pParam->obss_passive_dwelltime) { |
| 2529 | pMac->roam.configParam.obss_passive_dwelltime = |
| 2530 | pParam->obss_passive_dwelltime; |
| 2531 | cfg_set_int(pMac, |
| 2532 | WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME, |
| 2533 | pParam->obss_passive_dwelltime); |
| 2534 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2535 | |
Varun Reddy Yeturu | 044bda2 | 2015-11-21 22:03:40 -0800 | [diff] [blame] | 2536 | pMac->first_scan_bucket_threshold = |
| 2537 | pParam->first_scan_bucket_threshold; |
| 2538 | csr_assign_rssi_for_category(pMac, |
| 2539 | pMac->first_scan_bucket_threshold, |
| 2540 | pParam->bCatRssiOffset); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2541 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = |
| 2542 | pParam->fSupplicantCountryCodeHasPriority; |
| 2543 | pMac->roam.configParam.vccRssiThreshold = |
| 2544 | pParam->vccRssiThreshold; |
| 2545 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 2546 | pParam->vccUlMacLossThreshold; |
| 2547 | pMac->roam.configParam.statsReqPeriodicity = |
| 2548 | pParam->statsReqPeriodicity; |
| 2549 | pMac->roam.configParam.statsReqPeriodicityInPS = |
| 2550 | pParam->statsReqPeriodicityInPS; |
| 2551 | /* Assign this before calling csr_init11d_info */ |
| 2552 | pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 2553 | pMac->roam.configParam.allow_tpc_from_ap = |
| 2554 | pParam->allow_tpc_from_ap; |
Kiran Kumar Lokere | 3beeb95 | 2017-05-02 18:40:24 -0700 | [diff] [blame] | 2555 | if (wlan_reg_11d_enabled_on_host(pMac->psoc)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2556 | status = csr_init11d_info(pMac, &pParam->Csr11dinfo); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2557 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2558 | pMac->scan.curScanType = eSIR_ACTIVE_SCAN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2559 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2560 | /* Initialize the power + channel information if 11h is |
| 2561 | * enabled. If 11d is enabled this information has already |
| 2562 | * been initialized |
| 2563 | */ |
Kiran Kumar Lokere | 3beeb95 | 2017-05-02 18:40:24 -0700 | [diff] [blame] | 2564 | if (csr_is11h_supported(pMac) && |
| 2565 | !wlan_reg_11d_enabled_on_host(pMac->psoc)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2566 | csr_init_channel_power_list(pMac, &pParam->Csr11dinfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2567 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2568 | qdf_mem_copy(&pMac->roam.configParam.csr11rConfig, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2569 | &pParam->csr11rConfig, |
| 2570 | sizeof(tCsr11rConfigParams)); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2571 | sme_debug("IsFTResourceReqSupp: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2572 | pMac->roam.configParam.csr11rConfig. |
| 2573 | IsFTResourceReqSupported); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2574 | pMac->roam.configParam.isFastTransitionEnabled = |
| 2575 | pParam->isFastTransitionEnabled; |
| 2576 | pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff; |
| 2577 | pMac->roam.configParam.nRoamPrefer5GHz = |
| 2578 | pParam->nRoamPrefer5GHz; |
| 2579 | pMac->roam.configParam.nRoamIntraBand = pParam->nRoamIntraBand; |
| 2580 | pMac->roam.configParam.isWESModeEnabled = |
| 2581 | pParam->isWESModeEnabled; |
| 2582 | pMac->roam.configParam.nProbes = pParam->nProbes; |
| 2583 | pMac->roam.configParam.nRoamScanHomeAwayTime = |
| 2584 | pParam->nRoamScanHomeAwayTime; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2585 | pMac->roam.configParam.isRoamOffloadScanEnabled = |
| 2586 | pParam->isRoamOffloadScanEnabled; |
| 2587 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = |
| 2588 | pParam->bFastRoamInConIniFeatureEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2589 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = |
| 2590 | pParam->isFastRoamIniFeatureEnabled; |
| 2591 | pMac->roam.configParam.MAWCEnabled = pParam->MAWCEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2592 | |
| 2593 | #ifdef FEATURE_WLAN_ESE |
| 2594 | pMac->roam.configParam.isEseIniFeatureEnabled = |
| 2595 | pParam->isEseIniFeatureEnabled; |
| 2596 | #endif |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2597 | qdf_mem_copy(&pMac->roam.configParam.neighborRoamConfig, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2598 | &pParam->neighborRoamConfig, |
| 2599 | sizeof(tCsrNeighborRoamConfigParams)); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2600 | sme_debug("nNeighborScanTimerPerioid: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2601 | pMac->roam.configParam.neighborRoamConfig. |
| 2602 | nNeighborScanTimerPeriod); |
Sridhar Selvaraj | 1b2330c | 2017-07-21 15:16:42 +0530 | [diff] [blame] | 2603 | sme_debug("neighbor_scan_min_timer_period: %d", |
| 2604 | pMac->roam.configParam.neighborRoamConfig. |
| 2605 | neighbor_scan_min_timer_period); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2606 | sme_debug("nNeighborLookupRssiThreshold: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2607 | pMac->roam.configParam.neighborRoamConfig. |
| 2608 | nNeighborLookupRssiThreshold); |
Varun Reddy Yeturu | 168134f | 2017-06-26 13:46:05 -0700 | [diff] [blame] | 2609 | sme_debug("rssi_thresh_offset_5g: %d", |
| 2610 | pMac->roam.configParam.neighborRoamConfig.rssi_thresh_offset_5g); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2611 | sme_debug("nOpportunisticThresholdDiff: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2612 | pMac->roam.configParam.neighborRoamConfig. |
| 2613 | nOpportunisticThresholdDiff); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2614 | sme_debug("nRoamRescanRssiDiff: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2615 | pMac->roam.configParam.neighborRoamConfig. |
| 2616 | nRoamRescanRssiDiff); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2617 | sme_debug("nNeighborScanMinChanTime: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2618 | pMac->roam.configParam.neighborRoamConfig. |
| 2619 | nNeighborScanMinChanTime); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2620 | sme_debug("nNeighborScanMaxChanTime: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2621 | pMac->roam.configParam.neighborRoamConfig. |
| 2622 | nNeighborScanMaxChanTime); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2623 | sme_debug("nMaxNeighborRetries: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2624 | pMac->roam.configParam.neighborRoamConfig. |
| 2625 | nMaxNeighborRetries); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2626 | sme_debug("nNeighborResultsRefreshPeriod: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2627 | pMac->roam.configParam.neighborRoamConfig. |
| 2628 | nNeighborResultsRefreshPeriod); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2629 | sme_debug("nEmptyScanRefreshPeriod: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2630 | pMac->roam.configParam.neighborRoamConfig. |
| 2631 | nEmptyScanRefreshPeriod); |
| 2632 | { |
| 2633 | int i; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2634 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2635 | sme_debug("Num of Channels in CFG Channel List: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2636 | pMac->roam.configParam.neighborRoamConfig. |
| 2637 | neighborScanChanList.numChannels); |
| 2638 | for (i = 0; |
| 2639 | i < |
| 2640 | pMac->roam.configParam.neighborRoamConfig. |
| 2641 | neighborScanChanList.numChannels; i++) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2642 | sme_debug("%d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2643 | pMac->roam.configParam. |
| 2644 | neighborRoamConfig.neighborScanChanList. |
| 2645 | channelList[i]); |
| 2646 | } |
| 2647 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2648 | sme_debug("nRoamBmissFirstBcnt: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2649 | pMac->roam.configParam.neighborRoamConfig. |
| 2650 | nRoamBmissFirstBcnt); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2651 | sme_debug("nRoamBmissFinalBcnt: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2652 | pMac->roam.configParam.neighborRoamConfig. |
| 2653 | nRoamBmissFinalBcnt); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2654 | sme_debug("nRoamBeaconRssiWeight: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2655 | pMac->roam.configParam.neighborRoamConfig. |
| 2656 | nRoamBeaconRssiWeight); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2657 | pMac->roam.configParam.addTSWhenACMIsOff = |
| 2658 | pParam->addTSWhenACMIsOff; |
| 2659 | pMac->scan.fValidateList = pParam->fValidateList; |
| 2660 | pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d; |
| 2661 | pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan; |
| 2662 | pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime; |
| 2663 | pMac->roam.configParam.fScanTwice = pParam->fScanTwice; |
| 2664 | pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl; |
| 2665 | pMac->scan.max_scan_count = pParam->max_scan_count; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 2666 | /* This parameter is not available in cfg and not passed from |
| 2667 | * upper layers. Instead it is initialized here This paramtere |
| 2668 | * is used in concurrency to determine if there are concurrent |
| 2669 | * active sessions. Is used as a temporary fix to disconnect |
| 2670 | * all active sessions when BMPS enabled so the active session |
| 2671 | * if Infra STA will automatically connect back and resume BMPS |
| 2672 | * since resume BMPS is not working when moving from concurrent |
| 2673 | * to single session |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2674 | */ |
| 2675 | /* Remove this code once SLM_Sessionization is supported */ |
| 2676 | /* BMPS_WORKAROUND_NOT_NEEDED */ |
| 2677 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 2678 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2679 | pMac->roam.configParam.nVhtChannelWidth = |
| 2680 | pParam->nVhtChannelWidth; |
Kiran Kumar Lokere | 5302ab6 | 2015-12-16 16:03:16 -0800 | [diff] [blame] | 2681 | pMac->roam.configParam.enable_txbf_sap_mode = |
| 2682 | pParam->enable_txbf_sap_mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2683 | pMac->roam.configParam.enable2x2 = pParam->enable2x2; |
| 2684 | pMac->roam.configParam.enableVhtFor24GHz = |
| 2685 | pParam->enableVhtFor24GHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2686 | pMac->roam.configParam.enableVhtpAid = pParam->enableVhtpAid; |
| 2687 | pMac->roam.configParam.enableVhtGid = pParam->enableVhtGid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2688 | pMac->roam.configParam.enableAmpduPs = pParam->enableAmpduPs; |
| 2689 | pMac->roam.configParam.enableHtSmps = pParam->enableHtSmps; |
| 2690 | pMac->roam.configParam.htSmps = pParam->htSmps; |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 2691 | pMac->roam.configParam.send_smps_action = |
| 2692 | pParam->send_smps_action; |
Krunal Soni | a2c0e41 | 2017-05-04 14:12:41 +0530 | [diff] [blame] | 2693 | pMac->roam.configParam.tx_ldpc_enable = pParam->enable_tx_ldpc; |
| 2694 | pMac->roam.configParam.rx_ldpc_enable = pParam->enable_rx_ldpc; |
Krunal Soni | 158bfe6 | 2017-08-02 12:33:08 -0700 | [diff] [blame] | 2695 | pMac->roam.configParam.disable_high_ht_mcs_2x2 = |
| 2696 | pParam->disable_high_ht_mcs_2x2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2697 | pMac->roam.configParam.ignore_peer_erp_info = |
| 2698 | pParam->ignore_peer_erp_info; |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 2699 | pMac->roam.configParam.max_amsdu_num = |
| 2700 | pParam->max_amsdu_num; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2701 | pMac->roam.configParam.nSelect5GHzMargin = |
| 2702 | pParam->nSelect5GHzMargin; |
| 2703 | pMac->roam.configParam.isCoalesingInIBSSAllowed = |
| 2704 | pParam->isCoalesingInIBSSAllowed; |
| 2705 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 2706 | pMac->roam.configParam.cc_switch_mode = pParam->cc_switch_mode; |
| 2707 | #endif |
| 2708 | pMac->roam.configParam.allowDFSChannelRoam = |
| 2709 | pParam->allowDFSChannelRoam; |
| 2710 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2711 | pMac->roam.configParam.isRoamOffloadEnabled = |
| 2712 | pParam->isRoamOffloadEnabled; |
| 2713 | #endif |
| 2714 | pMac->roam.configParam.obssEnabled = pParam->obssEnabled; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 2715 | pMac->roam.configParam.vendor_vht_sap = |
| 2716 | pParam->vendor_vht_sap; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2717 | pMac->roam.configParam.conc_custom_rule1 = |
| 2718 | pParam->conc_custom_rule1; |
| 2719 | pMac->roam.configParam.conc_custom_rule2 = |
| 2720 | pParam->conc_custom_rule2; |
| 2721 | pMac->roam.configParam.is_sta_connection_in_5gz_enabled = |
| 2722 | pParam->is_sta_connection_in_5gz_enabled; |
| 2723 | pMac->roam.configParam.sendDeauthBeforeCon = |
| 2724 | pParam->sendDeauthBeforeCon; |
| 2725 | |
| 2726 | pMac->enable_dot11p = pParam->enable_dot11p; |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 2727 | pMac->roam.configParam.early_stop_scan_enable = |
| 2728 | pParam->early_stop_scan_enable; |
| 2729 | pMac->roam.configParam.early_stop_scan_min_threshold = |
| 2730 | pParam->early_stop_scan_min_threshold; |
| 2731 | pMac->roam.configParam.early_stop_scan_max_threshold = |
| 2732 | pParam->early_stop_scan_max_threshold; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 2733 | pMac->isCoalesingInIBSSAllowed = |
| 2734 | pParam->isCoalesingInIBSSAllowed; |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 2735 | |
Gupta, Kapil | c68ad46 | 2016-02-01 19:17:23 +0530 | [diff] [blame] | 2736 | pMac->roam.configParam.roam_params.dense_rssi_thresh_offset = |
| 2737 | pParam->roam_dense_rssi_thresh_offset; |
| 2738 | pMac->roam.configParam.roam_params.dense_min_aps_cnt = |
| 2739 | pParam->roam_dense_min_aps; |
| 2740 | pMac->roam.configParam.roam_params.traffic_threshold = |
| 2741 | pParam->roam_dense_traffic_thresh; |
| 2742 | |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 2743 | pMac->roam.configParam.scan_adaptive_dwell_mode = |
| 2744 | pParam->scan_adaptive_dwell_mode; |
| 2745 | pMac->roam.configParam.roamscan_adaptive_dwell_mode = |
| 2746 | pParam->roamscan_adaptive_dwell_mode; |
| 2747 | |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 2748 | pMac->roam.configParam.per_roam_config.enable = |
| 2749 | pParam->per_roam_config.enable; |
| 2750 | pMac->roam.configParam.per_roam_config.tx_high_rate_thresh = |
| 2751 | pParam->per_roam_config.tx_high_rate_thresh; |
| 2752 | pMac->roam.configParam.per_roam_config.rx_high_rate_thresh = |
| 2753 | pParam->per_roam_config.rx_high_rate_thresh; |
| 2754 | pMac->roam.configParam.per_roam_config.tx_low_rate_thresh = |
| 2755 | pParam->per_roam_config.tx_low_rate_thresh; |
| 2756 | pMac->roam.configParam.per_roam_config.rx_low_rate_thresh = |
| 2757 | pParam->per_roam_config.rx_low_rate_thresh; |
| 2758 | pMac->roam.configParam.per_roam_config.tx_rate_thresh_percnt = |
| 2759 | pParam->per_roam_config.tx_rate_thresh_percnt; |
| 2760 | pMac->roam.configParam.per_roam_config.rx_rate_thresh_percnt = |
| 2761 | pParam->per_roam_config.rx_rate_thresh_percnt; |
| 2762 | pMac->roam.configParam.per_roam_config.per_rest_time = |
| 2763 | pParam->per_roam_config.per_rest_time; |
Kapil Gupta | 957827b | 2017-02-13 15:47:04 +0530 | [diff] [blame] | 2764 | pMac->roam.configParam.per_roam_config.tx_per_mon_time = |
| 2765 | pParam->per_roam_config.tx_per_mon_time; |
| 2766 | pMac->roam.configParam.per_roam_config.rx_per_mon_time = |
| 2767 | pParam->per_roam_config.rx_per_mon_time; |
Selvaraj, Sridhar | 0641fab | 2017-05-17 16:02:00 +0530 | [diff] [blame] | 2768 | pMac->roam.configParam.per_roam_config.min_candidate_rssi = |
| 2769 | pParam->per_roam_config.min_candidate_rssi; |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 2770 | |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 2771 | pMac->fEnableDebugLog = pParam->fEnableDebugLog; |
| 2772 | |
| 2773 | /* update interface configuration */ |
| 2774 | pMac->sme.max_intf_count = pParam->max_intf_count; |
| 2775 | |
| 2776 | pMac->enable5gEBT = pParam->enable5gEBT; |
| 2777 | pMac->sme.enableSelfRecovery = pParam->enableSelfRecovery; |
| 2778 | |
| 2779 | pMac->f_sta_miracast_mcc_rest_time_val = |
| 2780 | pParam->f_sta_miracast_mcc_rest_time_val; |
| 2781 | #ifdef FEATURE_AP_MCC_CH_AVOIDANCE |
| 2782 | pMac->sap.sap_channel_avoidance = |
| 2783 | pParam->sap_channel_avoidance; |
| 2784 | #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ |
| 2785 | |
| 2786 | pMac->f_prefer_non_dfs_on_radar = |
| 2787 | pParam->f_prefer_non_dfs_on_radar; |
| 2788 | |
| 2789 | pMac->sme.ps_global_info.ps_enabled = |
| 2790 | pParam->is_ps_enabled; |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2791 | pMac->sme.ps_global_info.auto_bmps_timer_val = |
| 2792 | pParam->auto_bmps_timer_val; |
Abhishek Singh | 165bc60 | 2016-03-21 12:43:00 +0530 | [diff] [blame] | 2793 | pMac->roam.configParam.ignore_peer_ht_opmode = |
| 2794 | pParam->ignore_peer_ht_opmode; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 2795 | pMac->fine_time_meas_cap = pParam->fine_time_meas_cap; |
| 2796 | pMac->dual_mac_feature_disable = |
| 2797 | pParam->dual_mac_feature_disable; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 2798 | pMac->roam.configParam.early_stop_scan_enable = |
| 2799 | pParam->early_stop_scan_enable; |
| 2800 | pMac->roam.configParam.early_stop_scan_min_threshold = |
| 2801 | pParam->early_stop_scan_min_threshold; |
| 2802 | pMac->roam.configParam.early_stop_scan_max_threshold = |
| 2803 | pParam->early_stop_scan_max_threshold; |
Abhishek Singh | 10ecf58 | 2016-05-04 17:48:59 +0530 | [diff] [blame] | 2804 | pMac->roam.configParam.enable_edca_params = |
| 2805 | pParam->enable_edca_params; |
| 2806 | pMac->roam.configParam.edca_vo_cwmin = pParam->edca_vo_cwmin; |
| 2807 | pMac->roam.configParam.edca_vi_cwmin = pParam->edca_vi_cwmin; |
| 2808 | pMac->roam.configParam.edca_bk_cwmin = pParam->edca_bk_cwmin; |
| 2809 | pMac->roam.configParam.edca_be_cwmin = pParam->edca_be_cwmin; |
| 2810 | |
| 2811 | pMac->roam.configParam.edca_vo_cwmax = pParam->edca_vo_cwmax; |
| 2812 | pMac->roam.configParam.edca_vi_cwmax = pParam->edca_vi_cwmax; |
| 2813 | pMac->roam.configParam.edca_bk_cwmax = pParam->edca_bk_cwmax; |
| 2814 | pMac->roam.configParam.edca_be_cwmax = pParam->edca_be_cwmax; |
| 2815 | |
| 2816 | pMac->roam.configParam.edca_vo_aifs = pParam->edca_vo_aifs; |
| 2817 | pMac->roam.configParam.edca_vi_aifs = pParam->edca_vi_aifs; |
| 2818 | pMac->roam.configParam.edca_bk_aifs = pParam->edca_bk_aifs; |
| 2819 | pMac->roam.configParam.edca_be_aifs = pParam->edca_be_aifs; |
| 2820 | |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 2821 | pMac->roam.configParam.enable_fatal_event = |
| 2822 | pParam->enable_fatal_event; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 2823 | pMac->roam.configParam.sta_roam_policy.dfs_mode = |
| 2824 | pParam->sta_roam_policy_params.dfs_mode; |
| 2825 | pMac->roam.configParam.sta_roam_policy.skip_unsafe_channels = |
| 2826 | pParam->sta_roam_policy_params.skip_unsafe_channels; |
Zhang Qian | 65e2e8d | 2017-07-11 11:56:43 +0800 | [diff] [blame] | 2827 | pMac->roam.configParam.sta_roam_policy.sap_operating_band = |
| 2828 | pParam->sta_roam_policy_params.sap_operating_band; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2829 | |
Padma, Santhosh Kumar | a711967 | 2016-08-16 16:05:14 +0530 | [diff] [blame] | 2830 | pMac->roam.configParam.tx_aggregation_size = |
| 2831 | pParam->tx_aggregation_size; |
| 2832 | pMac->roam.configParam.rx_aggregation_size = |
| 2833 | pParam->rx_aggregation_size; |
Selvaraj, Sridhar | 4f684bb | 2017-01-19 15:59:23 +0530 | [diff] [blame] | 2834 | pMac->roam.configParam.enable_bcast_probe_rsp = |
| 2835 | pParam->enable_bcast_probe_rsp; |
Selvaraj, Sridhar | a521aab | 2017-03-25 16:42:34 +0530 | [diff] [blame] | 2836 | pMac->roam.configParam.qcn_ie_support = |
| 2837 | pParam->qcn_ie_support; |
Selvaraj, Sridhar | 97ce658 | 2017-01-20 17:06:34 +0530 | [diff] [blame] | 2838 | pMac->roam.configParam.fils_max_chan_guard_time = |
| 2839 | pParam->fils_max_chan_guard_time; |
Selvaraj, Sridhar | 57ce4df | 2017-05-29 18:30:49 +0530 | [diff] [blame] | 2840 | pMac->roam.configParam.disallow_duration = |
| 2841 | pParam->disallow_duration; |
| 2842 | pMac->roam.configParam.rssi_channel_penalization = |
| 2843 | pParam->rssi_channel_penalization; |
| 2844 | pMac->roam.configParam.num_disallowed_aps = |
| 2845 | pParam->num_disallowed_aps; |
Padma, Santhosh Kumar | a711967 | 2016-08-16 16:05:14 +0530 | [diff] [blame] | 2846 | |
Krishna Kumaar Natarajan | 90bb6f1 | 2017-03-03 21:05:52 -0800 | [diff] [blame] | 2847 | csr_update_he_config_param(pMac, pParam); |
Gupta, Kapil | c68ad46 | 2016-02-01 19:17:23 +0530 | [diff] [blame] | 2848 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2849 | return status; |
| 2850 | } |
| 2851 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2852 | QDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2853 | { |
| 2854 | int i; |
| 2855 | tCsrConfig *cfg_params = &pMac->roam.configParam; |
| 2856 | |
| 2857 | if (!pParam) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2858 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2859 | |
Naveen Rawat | 2b6e3c9 | 2017-03-20 13:59:07 -0700 | [diff] [blame] | 2860 | pParam->pkt_err_disconn_th = cfg_params->pkt_err_disconn_th; |
Naveen Rawat | b2fc413 | 2017-05-10 20:42:05 -0700 | [diff] [blame] | 2861 | pParam->is_force_1x1 = cfg_params->is_force_1x1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2862 | pParam->WMMSupportMode = cfg_params->WMMSupportMode; |
| 2863 | pParam->Is11eSupportEnabled = cfg_params->Is11eSupportEnabled; |
| 2864 | pParam->FragmentationThreshold = cfg_params->FragmentationThreshold; |
| 2865 | pParam->Is11dSupportEnabled = cfg_params->Is11dSupportEnabled; |
| 2866 | pParam->Is11dSupportEnabledOriginal = |
| 2867 | cfg_params->Is11dSupportEnabledOriginal; |
| 2868 | pParam->Is11hSupportEnabled = cfg_params->Is11hSupportEnabled; |
| 2869 | pParam->channelBondingMode24GHz = csr_convert_phy_cb_state_to_ini_value( |
| 2870 | cfg_params->channelBondingMode24GHz); |
| 2871 | pParam->channelBondingMode5GHz = csr_convert_phy_cb_state_to_ini_value( |
| 2872 | cfg_params->channelBondingMode5GHz); |
| 2873 | pParam->RTSThreshold = cfg_params->RTSThreshold; |
| 2874 | pParam->phyMode = cfg_params->phyMode; |
| 2875 | pParam->shortSlotTime = cfg_params->shortSlotTime; |
| 2876 | pParam->HeartbeatThresh24 = cfg_params->HeartbeatThresh24; |
| 2877 | pParam->HeartbeatThresh50 = cfg_params->HeartbeatThresh50; |
| 2878 | pParam->ProprietaryRatesEnabled = cfg_params->ProprietaryRatesEnabled; |
| 2879 | pParam->TxRate = cfg_params->TxRate; |
| 2880 | pParam->AdHocChannel24 = cfg_params->AdHocChannel24; |
| 2881 | pParam->AdHocChannel5G = cfg_params->AdHocChannel5G; |
| 2882 | pParam->bandCapability = cfg_params->bandCapability; |
| 2883 | pParam->cbChoice = cfg_params->cbChoice; |
| 2884 | pParam->nActiveMaxChnTime = cfg_params->nActiveMaxChnTime; |
| 2885 | pParam->nActiveMinChnTime = cfg_params->nActiveMinChnTime; |
| 2886 | pParam->nPassiveMaxChnTime = cfg_params->nPassiveMaxChnTime; |
| 2887 | pParam->nPassiveMinChnTime = cfg_params->nPassiveMinChnTime; |
| 2888 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 2889 | pParam->nActiveMaxChnTimeConc = cfg_params->nActiveMaxChnTimeConc; |
| 2890 | pParam->nActiveMinChnTimeConc = cfg_params->nActiveMinChnTimeConc; |
| 2891 | pParam->nPassiveMaxChnTimeConc = cfg_params->nPassiveMaxChnTimeConc; |
| 2892 | pParam->nPassiveMinChnTimeConc = cfg_params->nPassiveMinChnTimeConc; |
| 2893 | pParam->nRestTimeConc = cfg_params->nRestTimeConc; |
Agrawal Ashish | 17bb390 | 2016-05-05 13:29:40 +0530 | [diff] [blame] | 2894 | pParam->min_rest_time_conc = cfg_params->min_rest_time_conc; |
| 2895 | pParam->idle_time_conc = cfg_params->idle_time_conc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2896 | #endif |
| 2897 | pParam->eBand = cfg_params->eBand; |
| 2898 | pParam->nScanResultAgeCount = cfg_params->agingCount; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2899 | pParam->bCatRssiOffset = cfg_params->bCatRssiOffset; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2900 | pParam->fSupplicantCountryCodeHasPriority = |
| 2901 | cfg_params->fSupplicantCountryCodeHasPriority; |
| 2902 | pParam->vccRssiThreshold = cfg_params->vccRssiThreshold; |
| 2903 | pParam->vccUlMacLossThreshold = cfg_params->vccUlMacLossThreshold; |
| 2904 | pParam->nTxPowerCap = cfg_params->nTxPowerCap; |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 2905 | pParam->allow_tpc_from_ap = cfg_params->allow_tpc_from_ap; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2906 | pParam->statsReqPeriodicity = cfg_params->statsReqPeriodicity; |
| 2907 | pParam->statsReqPeriodicityInPS = cfg_params->statsReqPeriodicityInPS; |
| 2908 | pParam->addTSWhenACMIsOff = cfg_params->addTSWhenACMIsOff; |
| 2909 | pParam->fValidateList = cfg_params->fValidateList; |
| 2910 | pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d; |
| 2911 | pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan; |
| 2912 | pParam->fScanTwice = cfg_params->fScanTwice; |
| 2913 | pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl; |
| 2914 | pParam->fEnableMCCMode = cfg_params->fenableMCCMode; |
| 2915 | pParam->fAllowMCCGODiffBI = cfg_params->fAllowMCCGODiffBI; |
| 2916 | pParam->scanCfgAgingTime = pMac->scan.scanResultCfgAgingTime; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2917 | qdf_mem_copy(&pParam->neighborRoamConfig, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2918 | &cfg_params->neighborRoamConfig, |
| 2919 | sizeof(tCsrNeighborRoamConfigParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2920 | pParam->nVhtChannelWidth = cfg_params->nVhtChannelWidth; |
Kiran Kumar Lokere | 5302ab6 | 2015-12-16 16:03:16 -0800 | [diff] [blame] | 2921 | pParam->enable_txbf_sap_mode = |
| 2922 | cfg_params->enable_txbf_sap_mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2923 | pParam->enableVhtFor24GHz = cfg_params->enableVhtFor24GHz; |
| 2924 | pParam->ignore_peer_erp_info = cfg_params->ignore_peer_erp_info; |
| 2925 | pParam->enable2x2 = cfg_params->enable2x2; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2926 | qdf_mem_copy(&cfg_params->csr11rConfig, &pParam->csr11rConfig, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2927 | sizeof(tCsr11rConfigParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2928 | pParam->isFastTransitionEnabled = cfg_params->isFastTransitionEnabled; |
| 2929 | pParam->RoamRssiDiff = cfg_params->RoamRssiDiff; |
| 2930 | pParam->nRoamPrefer5GHz = cfg_params->nRoamPrefer5GHz; |
| 2931 | pParam->nRoamIntraBand = cfg_params->nRoamIntraBand; |
| 2932 | pParam->isWESModeEnabled = cfg_params->isWESModeEnabled; |
| 2933 | pParam->nProbes = cfg_params->nProbes; |
| 2934 | pParam->nRoamScanHomeAwayTime = cfg_params->nRoamScanHomeAwayTime; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2935 | pParam->isRoamOffloadScanEnabled = cfg_params->isRoamOffloadScanEnabled; |
| 2936 | pParam->bFastRoamInConIniFeatureEnabled = |
| 2937 | cfg_params->bFastRoamInConIniFeatureEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2938 | pParam->isFastRoamIniFeatureEnabled = |
| 2939 | cfg_params->isFastRoamIniFeatureEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2940 | #ifdef FEATURE_WLAN_ESE |
| 2941 | pParam->isEseIniFeatureEnabled = cfg_params->isEseIniFeatureEnabled; |
| 2942 | #endif |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2943 | qdf_mem_copy(&pParam->neighborRoamConfig, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2944 | &cfg_params->neighborRoamConfig, |
| 2945 | sizeof(tCsrNeighborRoamConfigParams)); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2946 | sme_debug("Num of Channels in CFG Channel List: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2947 | cfg_params->neighborRoamConfig. |
| 2948 | neighborScanChanList.numChannels); |
| 2949 | for (i = 0; i < cfg_params->neighborRoamConfig. |
| 2950 | neighborScanChanList.numChannels; i++) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 2951 | sme_debug("%d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2952 | cfg_params->neighborRoamConfig. |
| 2953 | neighborScanChanList.channelList[i]); |
| 2954 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2955 | |
| 2956 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 2957 | pParam->cc_switch_mode = cfg_params->cc_switch_mode; |
| 2958 | #endif |
Krunal Soni | a2c0e41 | 2017-05-04 14:12:41 +0530 | [diff] [blame] | 2959 | pParam->enable_tx_ldpc = cfg_params->tx_ldpc_enable; |
| 2960 | pParam->enable_rx_ldpc = cfg_params->rx_ldpc_enable; |
Krunal Soni | 158bfe6 | 2017-08-02 12:33:08 -0700 | [diff] [blame] | 2961 | pParam->disable_high_ht_mcs_2x2 = cfg_params->disable_high_ht_mcs_2x2; |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 2962 | pParam->max_amsdu_num = cfg_params->max_amsdu_num; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2963 | pParam->nSelect5GHzMargin = cfg_params->nSelect5GHzMargin; |
| 2964 | pParam->isCoalesingInIBSSAllowed = cfg_params->isCoalesingInIBSSAllowed; |
| 2965 | pParam->allowDFSChannelRoam = cfg_params->allowDFSChannelRoam; |
| 2966 | pParam->nInitialDwellTime = cfg_params->nInitialDwellTime; |
| 2967 | pParam->initial_scan_no_dfs_chnl = cfg_params->initial_scan_no_dfs_chnl; |
| 2968 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2969 | pParam->isRoamOffloadEnabled = cfg_params->isRoamOffloadEnabled; |
| 2970 | #endif |
| 2971 | pParam->enable_dot11p = pMac->enable_dot11p; |
| 2972 | csr_set_channels(pMac, pParam); |
| 2973 | pParam->obssEnabled = cfg_params->obssEnabled; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 2974 | pParam->vendor_vht_sap = |
| 2975 | pMac->roam.configParam.vendor_vht_sap; |
Gupta, Kapil | c68ad46 | 2016-02-01 19:17:23 +0530 | [diff] [blame] | 2976 | pParam->roam_dense_rssi_thresh_offset = |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 2977 | cfg_params->roam_params.dense_rssi_thresh_offset; |
Gupta, Kapil | c68ad46 | 2016-02-01 19:17:23 +0530 | [diff] [blame] | 2978 | pParam->roam_dense_min_aps = |
| 2979 | cfg_params->roam_params.dense_min_aps_cnt; |
| 2980 | pParam->roam_dense_traffic_thresh = |
| 2981 | cfg_params->roam_params.traffic_threshold; |
| 2982 | |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 2983 | pParam->scan_adaptive_dwell_mode = |
| 2984 | cfg_params->scan_adaptive_dwell_mode; |
| 2985 | pParam->roamscan_adaptive_dwell_mode = |
| 2986 | cfg_params->roamscan_adaptive_dwell_mode; |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 2987 | |
| 2988 | pParam->per_roam_config.enable = cfg_params->per_roam_config.enable; |
| 2989 | pParam->per_roam_config.tx_high_rate_thresh = |
| 2990 | cfg_params->per_roam_config.tx_high_rate_thresh; |
| 2991 | pParam->per_roam_config.rx_high_rate_thresh = |
| 2992 | cfg_params->per_roam_config.rx_high_rate_thresh; |
| 2993 | pParam->per_roam_config.tx_low_rate_thresh = |
| 2994 | cfg_params->per_roam_config.tx_low_rate_thresh; |
| 2995 | pParam->per_roam_config.rx_low_rate_thresh = |
| 2996 | cfg_params->per_roam_config.rx_low_rate_thresh; |
| 2997 | pParam->per_roam_config.tx_rate_thresh_percnt = |
| 2998 | cfg_params->per_roam_config.tx_rate_thresh_percnt; |
| 2999 | pParam->per_roam_config.rx_rate_thresh_percnt = |
| 3000 | cfg_params->per_roam_config.rx_rate_thresh_percnt; |
| 3001 | pParam->per_roam_config.per_rest_time = |
| 3002 | cfg_params->per_roam_config.per_rest_time; |
Kapil Gupta | 957827b | 2017-02-13 15:47:04 +0530 | [diff] [blame] | 3003 | pParam->per_roam_config.tx_per_mon_time = |
| 3004 | cfg_params->per_roam_config.tx_per_mon_time; |
| 3005 | pParam->per_roam_config.rx_per_mon_time = |
| 3006 | cfg_params->per_roam_config.rx_per_mon_time; |
Selvaraj, Sridhar | 0641fab | 2017-05-17 16:02:00 +0530 | [diff] [blame] | 3007 | pParam->per_roam_config.min_candidate_rssi = |
| 3008 | cfg_params->per_roam_config.min_candidate_rssi; |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 3009 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3010 | pParam->conc_custom_rule1 = cfg_params->conc_custom_rule1; |
| 3011 | pParam->conc_custom_rule2 = cfg_params->conc_custom_rule2; |
| 3012 | pParam->is_sta_connection_in_5gz_enabled = |
| 3013 | cfg_params->is_sta_connection_in_5gz_enabled; |
| 3014 | pParam->sendDeauthBeforeCon = |
| 3015 | cfg_params->sendDeauthBeforeCon; |
| 3016 | pParam->max_scan_count = pMac->scan.max_scan_count; |
Varun Reddy Yeturu | 044bda2 | 2015-11-21 22:03:40 -0800 | [diff] [blame] | 3017 | pParam->first_scan_bucket_threshold = |
| 3018 | pMac->first_scan_bucket_threshold; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 3019 | #ifdef FEATURE_AP_MCC_CH_AVOIDANCE |
| 3020 | pParam->sap_channel_avoidance = pMac->sap.sap_channel_avoidance; |
| 3021 | #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ |
| 3022 | pParam->max_intf_count = pMac->sme.max_intf_count; |
| 3023 | pParam->enableSelfRecovery = pMac->sme.enableSelfRecovery; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 3024 | pParam->f_prefer_non_dfs_on_radar = |
| 3025 | pMac->f_prefer_non_dfs_on_radar; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 3026 | pParam->fine_time_meas_cap = pMac->fine_time_meas_cap; |
| 3027 | pParam->dual_mac_feature_disable = |
| 3028 | pMac->dual_mac_feature_disable; |
| 3029 | pParam->is_ps_enabled = pMac->sme.ps_global_info.ps_enabled; |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 3030 | pParam->auto_bmps_timer_val = |
| 3031 | pMac->sme.ps_global_info.auto_bmps_timer_val; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 3032 | pParam->fEnableDebugLog = pMac->fEnableDebugLog; |
| 3033 | pParam->enable5gEBT = pMac->enable5gEBT; |
| 3034 | pParam->f_sta_miracast_mcc_rest_time_val = |
| 3035 | pMac->f_sta_miracast_mcc_rest_time_val; |
Krunal Soni | 1878d3a | 2016-01-14 13:00:44 -0800 | [diff] [blame] | 3036 | pParam->early_stop_scan_enable = |
| 3037 | pMac->roam.configParam.early_stop_scan_enable; |
| 3038 | pParam->early_stop_scan_min_threshold = |
| 3039 | pMac->roam.configParam.early_stop_scan_min_threshold; |
| 3040 | pParam->early_stop_scan_max_threshold = |
| 3041 | pMac->roam.configParam.early_stop_scan_max_threshold; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 3042 | pParam->obss_width_interval = |
| 3043 | pMac->roam.configParam.obss_width_interval; |
| 3044 | pParam->obss_active_dwelltime = |
| 3045 | pMac->roam.configParam.obss_active_dwelltime; |
| 3046 | pParam->obss_passive_dwelltime = |
| 3047 | pMac->roam.configParam.obss_passive_dwelltime; |
Abhishek Singh | 165bc60 | 2016-03-21 12:43:00 +0530 | [diff] [blame] | 3048 | pParam->ignore_peer_ht_opmode = |
| 3049 | pMac->roam.configParam.ignore_peer_ht_opmode; |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 3050 | pParam->enableHtSmps = pMac->roam.configParam.enableHtSmps; |
| 3051 | pParam->htSmps = pMac->roam.configParam.htSmps; |
| 3052 | pParam->send_smps_action = pMac->roam.configParam.send_smps_action; |
Abhishek Singh | 10ecf58 | 2016-05-04 17:48:59 +0530 | [diff] [blame] | 3053 | |
| 3054 | pParam->enable_edca_params = |
| 3055 | pMac->roam.configParam.enable_edca_params; |
| 3056 | pParam->edca_vo_cwmin = pMac->roam.configParam.edca_vo_cwmin; |
| 3057 | pParam->edca_vi_cwmin = pMac->roam.configParam.edca_vi_cwmin; |
| 3058 | pParam->edca_bk_cwmin = pMac->roam.configParam.edca_bk_cwmin; |
| 3059 | pParam->edca_be_cwmin = pMac->roam.configParam.edca_be_cwmin; |
| 3060 | |
| 3061 | pParam->edca_vo_cwmax = pMac->roam.configParam.edca_vo_cwmax; |
| 3062 | pParam->edca_vi_cwmax = pMac->roam.configParam.edca_vi_cwmax; |
| 3063 | pParam->edca_bk_cwmax = pMac->roam.configParam.edca_bk_cwmax; |
| 3064 | pParam->edca_be_cwmax = pMac->roam.configParam.edca_be_cwmax; |
| 3065 | |
| 3066 | pParam->edca_vo_aifs = pMac->roam.configParam.edca_vo_aifs; |
| 3067 | pParam->edca_vi_aifs = pMac->roam.configParam.edca_vi_aifs; |
| 3068 | pParam->edca_bk_aifs = pMac->roam.configParam.edca_bk_aifs; |
| 3069 | pParam->edca_be_aifs = pMac->roam.configParam.edca_be_aifs; |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 3070 | pParam->enable_fatal_event = |
| 3071 | pMac->roam.configParam.enable_fatal_event; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 3072 | pParam->sta_roam_policy_params.dfs_mode = |
| 3073 | pMac->roam.configParam.sta_roam_policy.dfs_mode; |
| 3074 | pParam->sta_roam_policy_params.skip_unsafe_channels = |
| 3075 | pMac->roam.configParam.sta_roam_policy.skip_unsafe_channels; |
Padma, Santhosh Kumar | a711967 | 2016-08-16 16:05:14 +0530 | [diff] [blame] | 3076 | pParam->tx_aggregation_size = |
| 3077 | pMac->roam.configParam.tx_aggregation_size; |
| 3078 | pParam->rx_aggregation_size = |
| 3079 | pMac->roam.configParam.rx_aggregation_size; |
Selvaraj, Sridhar | 4f684bb | 2017-01-19 15:59:23 +0530 | [diff] [blame] | 3080 | pParam->enable_bcast_probe_rsp = |
| 3081 | pMac->roam.configParam.enable_bcast_probe_rsp; |
Selvaraj, Sridhar | a521aab | 2017-03-25 16:42:34 +0530 | [diff] [blame] | 3082 | pParam->qcn_ie_support = |
| 3083 | pMac->roam.configParam.qcn_ie_support; |
Selvaraj, Sridhar | 97ce658 | 2017-01-20 17:06:34 +0530 | [diff] [blame] | 3084 | pParam->fils_max_chan_guard_time = |
| 3085 | pMac->roam.configParam.fils_max_chan_guard_time; |
Selvaraj, Sridhar | 57ce4df | 2017-05-29 18:30:49 +0530 | [diff] [blame] | 3086 | pParam->disallow_duration = |
| 3087 | pMac->roam.configParam.disallow_duration; |
| 3088 | pParam->rssi_channel_penalization = |
| 3089 | pMac->roam.configParam.rssi_channel_penalization; |
| 3090 | pParam->num_disallowed_aps = |
| 3091 | pMac->roam.configParam.num_disallowed_aps; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 3092 | |
Krishna Kumaar Natarajan | 90bb6f1 | 2017-03-03 21:05:52 -0800 | [diff] [blame] | 3093 | csr_get_he_config_param(pParam, pMac); |
| 3094 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3095 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3096 | } |
| 3097 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3098 | QDF_STATUS csr_set_phy_mode(tHalHandle hHal, uint32_t phyMode, eCsrBand eBand, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3099 | bool *pfRestartNeeded) |
| 3100 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3101 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3102 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3103 | bool fRestartNeeded = false; |
| 3104 | eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3105 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3106 | if (eCSR_BAND_24 == eBand) { |
| 3107 | if (CSR_IS_RADIO_A_ONLY(pMac)) |
| 3108 | goto end; |
| 3109 | if (eCSR_DOT11_MODE_11a & phyMode) |
| 3110 | goto end; |
| 3111 | } |
| 3112 | if (eCSR_BAND_5G == eBand) { |
| 3113 | if (CSR_IS_RADIO_BG_ONLY(pMac)) |
| 3114 | goto end; |
| 3115 | if ((eCSR_DOT11_MODE_11b & phyMode) |
| 3116 | || (eCSR_DOT11_MODE_11b_ONLY & phyMode) |
| 3117 | || (eCSR_DOT11_MODE_11g & phyMode) |
| 3118 | || (eCSR_DOT11_MODE_11g_ONLY & phyMode)) |
| 3119 | goto end; |
| 3120 | } |
| 3121 | if (eCSR_DOT11_MODE_AUTO & phyMode) |
| 3122 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 3123 | else { |
| 3124 | /* Check for dual band and higher capability first */ |
| 3125 | if (eCSR_DOT11_MODE_11n_ONLY & phyMode) { |
| 3126 | if (eCSR_DOT11_MODE_11n_ONLY != phyMode) |
| 3127 | goto end; |
| 3128 | newPhyMode = eCSR_DOT11_MODE_11n_ONLY; |
| 3129 | } else if (eCSR_DOT11_MODE_11g_ONLY & phyMode) { |
| 3130 | if (eCSR_DOT11_MODE_11g_ONLY != phyMode) |
| 3131 | goto end; |
| 3132 | if (eCSR_BAND_5G == eBand) |
| 3133 | goto end; |
| 3134 | newPhyMode = eCSR_DOT11_MODE_11g_ONLY; |
| 3135 | eBand = eCSR_BAND_24; |
| 3136 | } else if (eCSR_DOT11_MODE_11b_ONLY & phyMode) { |
| 3137 | if (eCSR_DOT11_MODE_11b_ONLY != phyMode) |
| 3138 | goto end; |
| 3139 | if (eCSR_BAND_5G == eBand) |
| 3140 | goto end; |
| 3141 | newPhyMode = eCSR_DOT11_MODE_11b_ONLY; |
| 3142 | eBand = eCSR_BAND_24; |
| 3143 | } else if (eCSR_DOT11_MODE_11n & phyMode) { |
| 3144 | newPhyMode = eCSR_DOT11_MODE_11n; |
| 3145 | } else if (eCSR_DOT11_MODE_abg & phyMode) { |
| 3146 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 3147 | } else if (eCSR_DOT11_MODE_11a & phyMode) { |
| 3148 | if ((eCSR_DOT11_MODE_11g & phyMode) |
| 3149 | || (eCSR_DOT11_MODE_11b & phyMode)) { |
| 3150 | if (eCSR_BAND_ALL == eBand) |
| 3151 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 3152 | else |
| 3153 | goto end; |
| 3154 | } else { |
| 3155 | newPhyMode = eCSR_DOT11_MODE_11a; |
| 3156 | eBand = eCSR_BAND_5G; |
| 3157 | } |
| 3158 | } else if (eCSR_DOT11_MODE_11g & phyMode) { |
| 3159 | newPhyMode = eCSR_DOT11_MODE_11g; |
| 3160 | eBand = eCSR_BAND_24; |
| 3161 | } else if (eCSR_DOT11_MODE_11b & phyMode) { |
| 3162 | newPhyMode = eCSR_DOT11_MODE_11b; |
| 3163 | eBand = eCSR_BAND_24; |
| 3164 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3165 | sme_err("can't recognize phymode 0x%08X", phyMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3166 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 3167 | } |
| 3168 | } |
| 3169 | /* Done validating */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3170 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3171 | /* Now we need to check whether a restart is needed. */ |
| 3172 | if (eBand != pMac->roam.configParam.eBand) { |
| 3173 | fRestartNeeded = true; |
| 3174 | goto end; |
| 3175 | } |
| 3176 | if (newPhyMode != pMac->roam.configParam.phyMode) { |
| 3177 | fRestartNeeded = true; |
| 3178 | goto end; |
| 3179 | } |
| 3180 | end: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3181 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3182 | pMac->roam.configParam.eBand = eBand; |
| 3183 | pMac->roam.configParam.phyMode = newPhyMode; |
| 3184 | if (pfRestartNeeded) |
| 3185 | *pfRestartNeeded = fRestartNeeded; |
| 3186 | } |
| 3187 | return status; |
| 3188 | } |
| 3189 | |
| 3190 | /** |
| 3191 | * csr_prune_ch_list() - prunes the channel list to keep only a type of channels |
| 3192 | * @ch_lst: existing channel list |
| 3193 | * @is_24_GHz: indicates if 2.5 GHz or 5 GHz channels are required |
| 3194 | * |
| 3195 | * Return: void |
| 3196 | */ |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 3197 | static void csr_prune_ch_list(tCsrChannel *ch_lst, bool is_24_GHz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3198 | { |
| 3199 | uint8_t idx = 0, num_channels = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3200 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3201 | for ( ; idx < ch_lst->numChannels; idx++) { |
| 3202 | if (is_24_GHz) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 3203 | if (WLAN_REG_IS_24GHZ_CH(ch_lst->channelList[idx])) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3204 | ch_lst->channelList[num_channels] = |
| 3205 | ch_lst->channelList[idx]; |
| 3206 | num_channels++; |
| 3207 | } |
| 3208 | } else { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 3209 | if (WLAN_REG_IS_5GHZ_CH(ch_lst->channelList[idx])) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3210 | ch_lst->channelList[num_channels] = |
| 3211 | ch_lst->channelList[idx]; |
| 3212 | num_channels++; |
| 3213 | } |
| 3214 | } |
| 3215 | } |
| 3216 | /* |
| 3217 | * Cleanup the rest of channels. Note we only need to clean up the |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3218 | * channels if we had to trim the list. Calling qdf_mem_set() with a 0 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3219 | * size is going to throw asserts on the debug builds so let's be a bit |
| 3220 | * smarter about that. Zero out the reset of the channels only if we |
| 3221 | * need to. The amount of memory to clear is the number of channesl that |
| 3222 | * we trimmed (ch_lst->numChannels - num_channels) times the size of a |
| 3223 | * channel in the structure. |
| 3224 | */ |
| 3225 | if (ch_lst->numChannels > num_channels) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3226 | qdf_mem_set(&ch_lst->channelList[num_channels], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3227 | sizeof(ch_lst->channelList[0]) * |
| 3228 | (ch_lst->numChannels - num_channels), 0); |
| 3229 | } |
| 3230 | ch_lst->numChannels = num_channels; |
| 3231 | } |
| 3232 | |
| 3233 | /** |
| 3234 | * csr_prune_channel_list_for_mode() - prunes the channel list |
| 3235 | * @mac_ctx: global mac context |
| 3236 | * @ch_lst: existing channel list |
| 3237 | * |
| 3238 | * Prunes the channel list according to band stored in mac_ctx |
| 3239 | * |
| 3240 | * Return: void |
| 3241 | */ |
| 3242 | void csr_prune_channel_list_for_mode(tpAniSirGlobal mac_ctx, |
| 3243 | tCsrChannel *ch_lst) |
| 3244 | { |
| 3245 | /* for dual band NICs, don't need to trim the channel list.... */ |
| 3246 | if (CSR_IS_OPEARTING_DUAL_BAND(mac_ctx)) |
| 3247 | return; |
| 3248 | /* |
| 3249 | * 2.4 GHz band operation requires the channel list to be trimmed to |
| 3250 | * the 2.4 GHz channels only |
| 3251 | */ |
| 3252 | if (CSR_IS_24_BAND_ONLY(mac_ctx)) |
| 3253 | csr_prune_ch_list(ch_lst, true); |
| 3254 | else if (CSR_IS_5G_BAND_ONLY(mac_ctx)) |
| 3255 | csr_prune_ch_list(ch_lst, false); |
| 3256 | } |
| 3257 | |
| 3258 | #define INFRA_AP_DEFAULT_CHANNEL 6 |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3259 | QDF_STATUS csr_is_valid_channel(tpAniSirGlobal pMac, uint8_t chnNum) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3260 | { |
| 3261 | uint8_t index = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3262 | QDF_STATUS status = QDF_STATUS_E_NOSUPPORT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3263 | |
| 3264 | /* regulatory check */ |
| 3265 | for (index = 0; index < pMac->scan.base_channels.numChannels; |
| 3266 | index++) { |
| 3267 | if (pMac->scan.base_channels.channelList[index] == chnNum) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3268 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3269 | break; |
| 3270 | } |
| 3271 | } |
| 3272 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3273 | if (status == QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3274 | /* dfs nol */ |
| 3275 | for (index = 0; |
| 3276 | index < |
| 3277 | pMac->sap.SapDfsInfo.numCurrentRegDomainDfsChannels; |
| 3278 | index++) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3279 | tSapDfsNolInfo *dfsChan = &pMac->sap.SapDfsInfo. |
| 3280 | sapDfsChannelNolList[index]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3281 | if ((dfsChan->dfs_channel_number == chnNum) |
| 3282 | && (dfsChan->radar_status_flag == |
| 3283 | eSAP_DFS_CHANNEL_UNAVAILABLE)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3284 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 3285 | QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3286 | FL("channel %d is in dfs nol"), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3287 | chnNum); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3288 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3289 | break; |
| 3290 | } |
| 3291 | } |
| 3292 | } |
| 3293 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3294 | if (QDF_STATUS_SUCCESS != status) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3295 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3296 | FL("channel %d is not available"), chnNum); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3297 | } |
| 3298 | |
| 3299 | return status; |
| 3300 | } |
| 3301 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3302 | QDF_STATUS csr_get_channel_and_power_list(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3303 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3304 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3305 | uint8_t num20MHzChannelsFound = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3306 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3307 | uint8_t Index = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 3309 | qdf_status = wlan_reg_get_channel_list_with_power(pMac->pdev, |
| 3310 | pMac->scan.defaultPowerTable, |
| 3311 | &num20MHzChannelsFound); |
Amar Singhal | 7ccdc4f | 2015-10-30 15:10:05 -0700 | [diff] [blame] | 3312 | |
| 3313 | if ((QDF_STATUS_SUCCESS != qdf_status) || |
| 3314 | (num20MHzChannelsFound == 0)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3315 | sme_err("failed to get channels"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3316 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3317 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3318 | if (num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3319 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3320 | pMac->scan.numChannelsDefault = num20MHzChannelsFound; |
| 3321 | /* Move the channel list to the global data */ |
| 3322 | /* structure -- this will be used as the scan list */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3323 | for (Index = 0; Index < num20MHzChannelsFound; Index++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3324 | pMac->scan.base_channels.channelList[Index] = |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 3325 | pMac->scan.defaultPowerTable[Index].chan_num; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3326 | pMac->scan.base_channels.numChannels = |
| 3327 | num20MHzChannelsFound; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3328 | } |
| 3329 | return status; |
| 3330 | } |
| 3331 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3332 | QDF_STATUS csr_apply_channel_and_power_list(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3333 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3334 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3335 | |
| 3336 | csr_prune_channel_list_for_mode(pMac, &pMac->scan.base_channels); |
| 3337 | csr_save_channel_power_for_band(pMac, false); |
| 3338 | csr_save_channel_power_for_band(pMac, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3339 | csr_apply_channel_power_info_to_fw(pMac, |
| 3340 | &pMac->scan.base_channels, |
| 3341 | pMac->scan.countryCodeCurrent); |
| 3342 | |
| 3343 | csr_init_operating_classes((tHalHandle) pMac); |
| 3344 | return status; |
| 3345 | } |
| 3346 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3347 | static QDF_STATUS csr_init11d_info(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3348 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3349 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3350 | uint8_t index; |
| 3351 | uint32_t count = 0; |
| 3352 | tSirMacChanInfo *pChanInfo; |
| 3353 | tSirMacChanInfo *pChanInfoStart; |
| 3354 | bool applyConfig = true; |
| 3355 | |
| 3356 | pMac->scan.currentCountryRSSI = -128; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3357 | if (!ps11dinfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3358 | return status; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3359 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3360 | if (ps11dinfo->Channels.numChannels |
| 3361 | && (WNI_CFG_VALID_CHANNEL_LIST_LEN >= |
| 3362 | ps11dinfo->Channels.numChannels)) { |
| 3363 | pMac->scan.base_channels.numChannels = |
| 3364 | ps11dinfo->Channels.numChannels; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3365 | qdf_mem_copy(pMac->scan.base_channels.channelList, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3366 | ps11dinfo->Channels.channelList, |
| 3367 | ps11dinfo->Channels.numChannels); |
| 3368 | } else { |
| 3369 | /* No change */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3370 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3371 | } |
| 3372 | /* legacy maintenance */ |
| 3373 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3374 | qdf_mem_copy(pMac->scan.countryCodeDefault, ps11dinfo->countryCode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3375 | WNI_CFG_COUNTRY_CODE_LEN); |
| 3376 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3377 | /* Tush: at csropen get this initialized with default, |
| 3378 | * during csr reset if this already set with some value |
| 3379 | * no need initilaize with default again |
| 3380 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3381 | if (0 == pMac->scan.countryCodeCurrent[0]) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3382 | qdf_mem_copy(pMac->scan.countryCodeCurrent, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3383 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 3384 | } |
| 3385 | /* need to add the max power channel list */ |
| 3386 | pChanInfo = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3387 | qdf_mem_malloc(sizeof(tSirMacChanInfo) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3388 | WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 3389 | if (pChanInfo != NULL) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3390 | pChanInfoStart = pChanInfo; |
| 3391 | for (index = 0; index < ps11dinfo->Channels.numChannels; |
| 3392 | index++) { |
| 3393 | pChanInfo->firstChanNum = |
| 3394 | ps11dinfo->ChnPower[index].firstChannel; |
| 3395 | pChanInfo->numChannels = |
| 3396 | ps11dinfo->ChnPower[index].numChannels; |
| 3397 | pChanInfo->maxTxPower = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3398 | QDF_MIN(ps11dinfo->ChnPower[index].maxtxPower, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3399 | pMac->roam.configParam.nTxPowerCap); |
| 3400 | pChanInfo++; |
| 3401 | count++; |
| 3402 | } |
| 3403 | if (count) { |
| 3404 | csr_save_to_channel_power2_g_5_g(pMac, |
| 3405 | count * |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3406 | sizeof(tSirMacChanInfo), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3407 | pChanInfoStart); |
| 3408 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3409 | qdf_mem_free(pChanInfoStart); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3410 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3411 | /* Only apply them to CFG when not in STOP state. |
| 3412 | * Otherwise they will be applied later |
| 3413 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3414 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3415 | for (index = 0; index < CSR_ROAM_SESSION_MAX; index++) { |
| 3416 | if ((CSR_IS_SESSION_VALID(pMac, index)) |
| 3417 | && CSR_IS_ROAM_STOP(pMac, index)) { |
| 3418 | applyConfig = false; |
| 3419 | } |
| 3420 | } |
| 3421 | |
| 3422 | if (true == applyConfig) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3423 | /* Apply the base channel list, power info, |
| 3424 | * and set the Country code. |
| 3425 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3426 | csr_apply_channel_power_info_to_fw(pMac, |
| 3427 | &pMac->scan. |
| 3428 | base_channels, |
| 3429 | pMac->scan. |
| 3430 | countryCodeCurrent); |
| 3431 | } |
| 3432 | } |
| 3433 | return status; |
| 3434 | } |
| 3435 | |
| 3436 | /* Initialize the Channel + Power List in the local cache and in the CFG */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3437 | QDF_STATUS csr_init_channel_power_list(tpAniSirGlobal pMac, |
| 3438 | tCsr11dinfo *ps11dinfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | { |
| 3440 | uint8_t index; |
| 3441 | uint32_t count = 0; |
| 3442 | tSirMacChanInfo *pChanInfo; |
| 3443 | tSirMacChanInfo *pChanInfoStart; |
| 3444 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3445 | if (!ps11dinfo || !pMac) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3446 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3447 | |
| 3448 | pChanInfo = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3449 | qdf_mem_malloc(sizeof(tSirMacChanInfo) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3450 | WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 3451 | if (pChanInfo != NULL) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3452 | pChanInfoStart = pChanInfo; |
| 3453 | |
| 3454 | for (index = 0; index < ps11dinfo->Channels.numChannels; |
| 3455 | index++) { |
| 3456 | pChanInfo->firstChanNum = |
| 3457 | ps11dinfo->ChnPower[index].firstChannel; |
| 3458 | pChanInfo->numChannels = |
| 3459 | ps11dinfo->ChnPower[index].numChannels; |
| 3460 | pChanInfo->maxTxPower = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3461 | QDF_MIN(ps11dinfo->ChnPower[index].maxtxPower, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3462 | pMac->roam.configParam.nTxPowerCap); |
| 3463 | pChanInfo++; |
| 3464 | count++; |
| 3465 | } |
| 3466 | if (count) { |
| 3467 | csr_save_to_channel_power2_g_5_g(pMac, |
| 3468 | count * |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3469 | sizeof(tSirMacChanInfo), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3470 | pChanInfoStart); |
| 3471 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3472 | qdf_mem_free(pChanInfoStart); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3473 | } |
| 3474 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3475 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3476 | } |
| 3477 | |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3478 | /** |
| 3479 | * csr_roam_remove_duplicate_cmd_from_list()- Remove duplicate roam cmd from |
| 3480 | * list |
| 3481 | * |
| 3482 | * @mac_ctx: pointer to global mac |
| 3483 | * @session_id: session id for the cmd |
| 3484 | * @list: pending list from which cmd needs to be removed |
| 3485 | * @command: cmd to be removed, can be NULL |
| 3486 | * @roam_reason: cmd with reason to be removed |
| 3487 | * |
| 3488 | * Remove duplicate command from the pending list. |
| 3489 | * |
| 3490 | * Return: void |
| 3491 | */ |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 3492 | static void csr_roam_remove_duplicate_pending_cmd_from_list( |
| 3493 | tpAniSirGlobal mac_ctx, |
| 3494 | uint32_t session_id, |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3495 | tSmeCmd *command, eCsrRoamReason roam_reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3496 | { |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3497 | tListElem *entry, *next_entry; |
| 3498 | tSmeCmd *dup_cmd; |
| 3499 | tDblLinkList local_list; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3500 | |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3501 | qdf_mem_zero(&local_list, sizeof(tDblLinkList)); |
| 3502 | if (!QDF_IS_STATUS_SUCCESS(csr_ll_open(mac_ctx->hHdd, &local_list))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3503 | sme_err("failed to open list"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3504 | return; |
| 3505 | } |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 3506 | csr_nonscan_pending_ll_lock(mac_ctx); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 3507 | entry = csr_nonscan_pending_ll_peek_head(mac_ctx, LL_ACCESS_NOLOCK); |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3508 | while (entry) { |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 3509 | next_entry = csr_nonscan_pending_ll_next(mac_ctx, entry, |
| 3510 | LL_ACCESS_NOLOCK); |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3511 | dup_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 3512 | /* |
| 3513 | * Remove the previous command if.. |
| 3514 | * - the new roam command is for the same RoamReason... |
| 3515 | * - the new roam command is a NewProfileList. |
| 3516 | * - the new roam command is a Forced Dissoc |
| 3517 | * - the new roam command is from an 802.11 OID |
| 3518 | * (OID_SSID or OID_BSSID). |
| 3519 | */ |
| 3520 | if ((command && (command->sessionId == dup_cmd->sessionId) && |
| 3521 | ((command->command == dup_cmd->command) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3522 | /* |
| 3523 | * This peermac check is requried for Softap/GO |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3524 | * scenarios. for STA scenario below OR check will |
| 3525 | * suffice as command will always be NULL for |
| 3526 | * STA scenarios |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3527 | */ |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3528 | (!qdf_mem_cmp(dup_cmd->u.roamCmd.peerMac, |
| 3529 | command->u.roamCmd.peerMac, |
| 3530 | sizeof(QDF_MAC_ADDR_SIZE))) && |
| 3531 | ((command->u.roamCmd.roamReason == |
| 3532 | dup_cmd->u.roamCmd.roamReason) || |
| 3533 | (eCsrForcedDisassoc == |
| 3534 | command->u.roamCmd.roamReason) || |
| 3535 | (eCsrHddIssued == |
| 3536 | command->u.roamCmd.roamReason)))) || |
| 3537 | /* OR if pCommand is NULL */ |
| 3538 | ((session_id == dup_cmd->sessionId) && |
| 3539 | (eSmeCommandRoam == dup_cmd->command) && |
| 3540 | ((eCsrForcedDisassoc == roam_reason) || |
| 3541 | (eCsrHddIssued == roam_reason)))) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3542 | sme_debug("RoamReason: %d", |
| 3543 | dup_cmd->u.roamCmd.roamReason); |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3544 | /* Remove the roam command from the pending list */ |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 3545 | if (csr_nonscan_pending_ll_remove_entry(mac_ctx, |
| 3546 | entry, LL_ACCESS_NOLOCK)) |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3547 | csr_ll_insert_tail(&local_list, entry, |
| 3548 | LL_ACCESS_NOLOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3549 | } |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3550 | entry = next_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3551 | } |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 3552 | csr_nonscan_pending_ll_unlock(mac_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3553 | |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3554 | while ((entry = csr_ll_remove_head(&local_list, LL_ACCESS_NOLOCK))) { |
| 3555 | dup_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3556 | /* Tell caller that the command is cancelled */ |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3557 | csr_roam_call_callback(mac_ctx, dup_cmd->sessionId, NULL, |
| 3558 | dup_cmd->u.roamCmd.roamId, |
| 3559 | eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 3560 | csr_release_command(mac_ctx, dup_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3561 | } |
Abhishek Singh | d86d983 | 2015-12-30 17:18:13 +0530 | [diff] [blame] | 3562 | csr_ll_close(&local_list); |
| 3563 | } |
| 3564 | |
| 3565 | /** |
| 3566 | * csr_roam_remove_duplicate_command()- Remove duplicate roam cmd |
| 3567 | * from pending lists. |
| 3568 | * |
| 3569 | * @mac_ctx: pointer to global mac |
| 3570 | * @session_id: session id for the cmd |
| 3571 | * @command: cmd to be removed, can be null |
| 3572 | * @roam_reason: cmd with reason to be removed |
| 3573 | * |
| 3574 | * Remove duplicate command from the sme and roam pending list. |
| 3575 | * |
| 3576 | * Return: void |
| 3577 | */ |
| 3578 | void csr_roam_remove_duplicate_command(tpAniSirGlobal mac_ctx, |
| 3579 | uint32_t session_id, tSmeCmd *command, |
| 3580 | eCsrRoamReason roam_reason) |
| 3581 | { |
| 3582 | /* Always lock active list before locking pending lists */ |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 3583 | csr_nonscan_active_ll_lock(mac_ctx); |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 3584 | csr_roam_remove_duplicate_pending_cmd_from_list(mac_ctx, |
| 3585 | session_id, command, roam_reason); |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 3586 | csr_nonscan_active_ll_unlock(mac_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3587 | } |
| 3588 | |
| 3589 | /** |
| 3590 | * csr_roam_populate_channels() - Helper function to populate channels |
| 3591 | * @beacon_ies: pointer to beacon ie |
| 3592 | * @roam_info: Roaming related information |
| 3593 | * @chan1: center freq 1 |
| 3594 | * @chan2: center freq2 |
| 3595 | * |
| 3596 | * This function will issue populate chan1 and chan2 based on beacon ie |
| 3597 | * |
| 3598 | * Return: none. |
| 3599 | */ |
| 3600 | static void csr_roam_populate_channels(tDot11fBeaconIEs *beacon_ies, |
| 3601 | tCsrRoamInfo *roam_info, |
| 3602 | uint8_t *chan1, uint8_t *chan2) |
| 3603 | { |
| 3604 | ePhyChanBondState phy_state; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3605 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3606 | if (beacon_ies->VHTOperation.present) { |
| 3607 | *chan1 = beacon_ies->VHTOperation.chanCenterFreqSeg1; |
| 3608 | *chan2 = beacon_ies->VHTOperation.chanCenterFreqSeg2; |
| 3609 | roam_info->chan_info.info = MODE_11AC_VHT80; |
| 3610 | } else if (beacon_ies->HTInfo.present) { |
| 3611 | if (beacon_ies->HTInfo.recommendedTxWidthSet == |
| 3612 | eHT_CHANNEL_WIDTH_40MHZ) { |
| 3613 | phy_state = beacon_ies->HTInfo.secondaryChannelOffset; |
| 3614 | if (phy_state == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 3615 | *chan1 = beacon_ies->HTInfo.primaryChannel + |
| 3616 | CSR_CB_CENTER_CHANNEL_OFFSET; |
| 3617 | else if (phy_state == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
| 3618 | *chan1 = beacon_ies->HTInfo.primaryChannel - |
| 3619 | CSR_CB_CENTER_CHANNEL_OFFSET; |
| 3620 | else |
| 3621 | *chan1 = beacon_ies->HTInfo.primaryChannel; |
| 3622 | |
| 3623 | roam_info->chan_info.info = MODE_11NA_HT40; |
| 3624 | } else { |
| 3625 | *chan1 = beacon_ies->HTInfo.primaryChannel; |
| 3626 | roam_info->chan_info.info = MODE_11NA_HT20; |
| 3627 | } |
| 3628 | *chan2 = 0; |
| 3629 | } else { |
| 3630 | *chan1 = 0; |
| 3631 | *chan2 = 0; |
| 3632 | roam_info->chan_info.info = MODE_11A; |
| 3633 | } |
| 3634 | } |
| 3635 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3636 | QDF_STATUS csr_roam_call_callback(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3637 | tCsrRoamInfo *pRoamInfo, uint32_t roamId, |
| 3638 | eRoamCmdStatus u1, eCsrRoamResult u2) |
| 3639 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3640 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3641 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 3642 | uint32_t rssi = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3643 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3644 | WLAN_HOST_DIAG_EVENT_DEF(connectionStatus, |
| 3645 | host_event_wlan_status_payload_type); |
| 3646 | #endif |
| 3647 | tCsrRoamSession *pSession; |
| 3648 | tDot11fBeaconIEs *beacon_ies = NULL; |
| 3649 | uint8_t chan1, chan2; |
| 3650 | |
| 3651 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3652 | sme_err("Session ID: %d is not valid", sessionId); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3653 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3654 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3655 | } |
| 3656 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 3657 | |
| 3658 | if (false == pSession->sessionActive) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3659 | sme_debug("Session is not Active"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3660 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3661 | } |
| 3662 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3663 | sme_debug("Received RoamCmdStatus %d with Roam Result %d", u1, u2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3664 | |
| 3665 | if (eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && |
| 3666 | eCSR_ROAM_RESULT_ASSOCIATED == u2 && pRoamInfo) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3667 | sme_info("Assoc complete result: %d status: %d reason: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3668 | u2, pRoamInfo->statusCode, pRoamInfo->reasonCode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3669 | beacon_ies = qdf_mem_malloc(sizeof(tDot11fBeaconIEs)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3670 | if ((NULL != beacon_ies) && (NULL != pRoamInfo->pBssDesc)) { |
| 3671 | status = csr_parse_bss_description_ies( |
| 3672 | (tHalHandle) pMac, pRoamInfo->pBssDesc, |
| 3673 | beacon_ies); |
| 3674 | csr_roam_populate_channels(beacon_ies, pRoamInfo, |
| 3675 | &chan1, &chan2); |
| 3676 | if (0 != chan1) |
| 3677 | pRoamInfo->chan_info.band_center_freq1 = |
| 3678 | cds_chan_to_freq(chan1); |
| 3679 | else |
| 3680 | pRoamInfo->chan_info.band_center_freq1 = 0; |
| 3681 | if (0 != chan2) |
| 3682 | pRoamInfo->chan_info.band_center_freq2 = |
| 3683 | cds_chan_to_freq(chan2); |
| 3684 | else |
| 3685 | pRoamInfo->chan_info.band_center_freq2 = 0; |
| 3686 | } else { |
| 3687 | pRoamInfo->chan_info.band_center_freq1 = 0; |
| 3688 | pRoamInfo->chan_info.band_center_freq2 = 0; |
| 3689 | pRoamInfo->chan_info.info = 0; |
| 3690 | } |
| 3691 | pRoamInfo->chan_info.chan_id = |
| 3692 | pRoamInfo->u.pConnectedProfile->operationChannel; |
| 3693 | pRoamInfo->chan_info.mhz = |
| 3694 | cds_chan_to_freq(pRoamInfo->chan_info.chan_id); |
| 3695 | pRoamInfo->chan_info.reg_info_1 = |
| 3696 | (csr_get_cfg_max_tx_power(pMac, |
| 3697 | pRoamInfo->chan_info.chan_id) << 16); |
| 3698 | pRoamInfo->chan_info.reg_info_2 = |
| 3699 | (csr_get_cfg_max_tx_power(pMac, |
| 3700 | pRoamInfo->chan_info.chan_id) << 8); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3701 | qdf_mem_free(beacon_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3702 | } else if ((u1 == eCSR_ROAM_FT_REASSOC_FAILED) |
| 3703 | && (pSession->bRefAssocStartCnt)) { |
| 3704 | /* |
| 3705 | * Decrement bRefAssocStartCnt for FT reassoc failure. |
| 3706 | * Reason: For FT reassoc failures, we first call |
| 3707 | * csr_roam_call_callback before notifying a failed roam |
| 3708 | * completion through csr_roam_complete. The latter in |
| 3709 | * turn calls csr_roam_process_results which tries to |
| 3710 | * once again call csr_roam_call_callback if bRefAssocStartCnt |
| 3711 | * is non-zero. Since this is redundant for FT reassoc |
| 3712 | * failure, decrement bRefAssocStartCnt. |
| 3713 | */ |
| 3714 | pSession->bRefAssocStartCnt--; |
| 3715 | } else if (u1 == eCSR_ROAM_SET_CHANNEL_RSP && u2 == |
| 3716 | eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS) |
| 3717 | pSession->connectedProfile.operationChannel = |
| 3718 | pRoamInfo->channelChangeRespEvent->newChannelNumber; |
| 3719 | |
| 3720 | if (NULL != pSession->callback) { |
| 3721 | if (pRoamInfo) { |
| 3722 | pRoamInfo->sessionId = (uint8_t) sessionId; |
| 3723 | /* |
| 3724 | * the reasonCode will be passed to supplicant by |
| 3725 | * cfg80211_disconnected. Based on the document, |
| 3726 | * the reason code passed to supplicant needs to set |
| 3727 | * to 0 if unknow. eSIR_BEACON_MISSED reason code is not |
| 3728 | * recognizable so that we set to 0 instead. |
| 3729 | */ |
| 3730 | pRoamInfo->reasonCode = |
| 3731 | (pRoamInfo->reasonCode == eSIR_BEACON_MISSED) ? |
| 3732 | 0 : pRoamInfo->reasonCode; |
| 3733 | } |
| 3734 | status = pSession->callback(pSession->pContext, pRoamInfo, |
| 3735 | roamId, u1, u2); |
| 3736 | } |
| 3737 | /* |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 3738 | * EVENT_WLAN_STATUS_V2: eCSR_ROAM_ASSOCIATION_COMPLETION, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3739 | * eCSR_ROAM_LOSTLINK, |
| 3740 | * eCSR_ROAM_DISASSOCIATED, |
| 3741 | */ |
| 3742 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3743 | qdf_mem_set(&connectionStatus, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3744 | sizeof(host_event_wlan_status_payload_type), 0); |
| 3745 | |
| 3746 | if ((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) |
| 3747 | && (eCSR_ROAM_RESULT_ASSOCIATED == u2) && pRoamInfo) { |
| 3748 | connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 3749 | connectionStatus.bssType = |
| 3750 | pRoamInfo->u.pConnectedProfile->BSSType; |
| 3751 | |
| 3752 | if (NULL != pRoamInfo->pBssDesc) { |
| 3753 | connectionStatus.rssi = |
| 3754 | pRoamInfo->pBssDesc->rssi * (-1); |
| 3755 | connectionStatus.channel = |
| 3756 | pRoamInfo->pBssDesc->channelId; |
| 3757 | } |
| 3758 | if (cfg_set_int(pMac, WNI_CFG_CURRENT_RSSI, |
| 3759 | connectionStatus.rssi) == eSIR_FAILURE) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3760 | sme_err("Can't pass WNI_CFG_CURRENT_RSSI to cfg"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3761 | |
| 3762 | connectionStatus.qosCapability = |
| 3763 | pRoamInfo->u.pConnectedProfile->qosConnection; |
| 3764 | connectionStatus.authType = |
| 3765 | (uint8_t) diag_auth_type_from_csr_type( |
| 3766 | pRoamInfo->u.pConnectedProfile->AuthType); |
| 3767 | connectionStatus.encryptionType = |
| 3768 | (uint8_t) diag_enc_type_from_csr_type( |
| 3769 | pRoamInfo->u.pConnectedProfile->EncryptionType); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3770 | qdf_mem_copy(connectionStatus.ssid, |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 3771 | pRoamInfo->u.pConnectedProfile->SSID.ssId, |
| 3772 | pRoamInfo->u.pConnectedProfile->SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3773 | |
| 3774 | connectionStatus.reason = eCSR_REASON_UNSPECIFIED; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3775 | qdf_mem_copy(&pMac->sme.eventPayload, &connectionStatus, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3776 | sizeof(host_event_wlan_status_payload_type)); |
| 3777 | WLAN_HOST_DIAG_EVENT_REPORT(&connectionStatus, |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 3778 | EVENT_WLAN_STATUS_V2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3779 | } |
| 3780 | if ((eCSR_ROAM_MIC_ERROR_IND == u1) |
| 3781 | || (eCSR_ROAM_RESULT_MIC_FAILURE == u2)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3782 | qdf_mem_copy(&connectionStatus, &pMac->sme.eventPayload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3783 | sizeof(host_event_wlan_status_payload_type)); |
| 3784 | if (IS_SIR_STATUS_SUCCESS(wlan_cfg_get_int(pMac, |
| 3785 | WNI_CFG_CURRENT_RSSI, &rssi))) |
| 3786 | connectionStatus.rssi = rssi; |
| 3787 | |
| 3788 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 3789 | connectionStatus.reason = eCSR_REASON_MIC_ERROR; |
| 3790 | WLAN_HOST_DIAG_EVENT_REPORT(&connectionStatus, |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 3791 | EVENT_WLAN_STATUS_V2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3792 | } |
| 3793 | if (eCSR_ROAM_RESULT_FORCED == u2) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3794 | qdf_mem_copy(&connectionStatus, &pMac->sme.eventPayload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3795 | sizeof(host_event_wlan_status_payload_type)); |
| 3796 | if (IS_SIR_STATUS_SUCCESS(wlan_cfg_get_int(pMac, |
| 3797 | WNI_CFG_CURRENT_RSSI, &rssi))) |
| 3798 | connectionStatus.rssi = rssi; |
| 3799 | |
| 3800 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 3801 | connectionStatus.reason = eCSR_REASON_USER_REQUESTED; |
| 3802 | WLAN_HOST_DIAG_EVENT_REPORT(&connectionStatus, |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 3803 | EVENT_WLAN_STATUS_V2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3804 | } |
| 3805 | if (eCSR_ROAM_RESULT_DISASSOC_IND == u2) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3806 | qdf_mem_copy(&connectionStatus, &pMac->sme.eventPayload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3807 | sizeof(host_event_wlan_status_payload_type)); |
| 3808 | if (IS_SIR_STATUS_SUCCESS(wlan_cfg_get_int(pMac, |
| 3809 | WNI_CFG_CURRENT_RSSI, &rssi))) |
| 3810 | connectionStatus.rssi = rssi; |
| 3811 | |
| 3812 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 3813 | connectionStatus.reason = eCSR_REASON_DISASSOC; |
| 3814 | if (pRoamInfo) |
| 3815 | connectionStatus.reasonDisconnect = |
| 3816 | pRoamInfo->reasonCode; |
| 3817 | |
| 3818 | WLAN_HOST_DIAG_EVENT_REPORT(&connectionStatus, |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 3819 | EVENT_WLAN_STATUS_V2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3820 | } |
| 3821 | if (eCSR_ROAM_RESULT_DEAUTH_IND == u2) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3822 | qdf_mem_copy(&connectionStatus, &pMac->sme.eventPayload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3823 | sizeof(host_event_wlan_status_payload_type)); |
| 3824 | if (IS_SIR_STATUS_SUCCESS(wlan_cfg_get_int(pMac, |
| 3825 | WNI_CFG_CURRENT_RSSI, &rssi))) |
| 3826 | connectionStatus.rssi = rssi; |
| 3827 | |
| 3828 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 3829 | connectionStatus.reason = eCSR_REASON_DEAUTH; |
| 3830 | if (pRoamInfo) |
| 3831 | connectionStatus.reasonDisconnect = |
| 3832 | pRoamInfo->reasonCode; |
| 3833 | WLAN_HOST_DIAG_EVENT_REPORT(&connectionStatus, |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 3834 | EVENT_WLAN_STATUS_V2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3835 | } |
| 3836 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 3837 | return status; |
| 3838 | } |
| 3839 | |
| 3840 | /* Returns whether handoff is currently in progress or not */ |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 3841 | static |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3842 | bool csr_roam_is_handoff_in_progress(tpAniSirGlobal pMac, uint8_t sessionId) |
| 3843 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3844 | return csr_neighbor_roam_is_handoff_in_progress(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3845 | } |
| 3846 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 3847 | static |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3848 | QDF_STATUS csr_roam_issue_disassociate(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3849 | eCsrRoamSubState NewSubstate, |
| 3850 | bool fMICFailure) |
| 3851 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3852 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3853 | struct qdf_mac_addr bssId = QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3854 | uint16_t reasonCode; |
| 3855 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 3856 | |
| 3857 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3858 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3859 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3860 | } |
| 3861 | |
| 3862 | if (fMICFailure) { |
| 3863 | reasonCode = eSIR_MAC_MIC_FAILURE_REASON; |
| 3864 | } else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF) { |
| 3865 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON; |
| 3866 | } else if (eCSR_ROAM_SUBSTATE_DISASSOC_STA_HAS_LEFT == NewSubstate) { |
| 3867 | reasonCode = eSIR_MAC_DISASSOC_LEAVING_BSS_REASON; |
| 3868 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3869 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3870 | "set to reason code eSIR_MAC_DISASSOC_LEAVING_BSS_REASON and set back NewSubstate"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3871 | } else { |
| 3872 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 3873 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3874 | if ((csr_roam_is_handoff_in_progress(pMac, sessionId)) && |
| 3875 | (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)) { |
| 3876 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = |
| 3877 | &pMac->roam.neighborRoamInfo[sessionId]; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3878 | qdf_copy_macaddr(&bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3879 | pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs. |
| 3880 | bssid); |
Deepak Dhamdhere | add334b | 2016-01-09 23:40:33 -0800 | [diff] [blame] | 3881 | } else if (pSession->pConnectBssDesc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3882 | qdf_mem_copy(&bssId.bytes, pSession->pConnectBssDesc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3883 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3884 | } |
| 3885 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3886 | sme_debug("CSR Attempting to Disassociate Bssid=" MAC_ADDRESS_STR |
| 3887 | " subState: %s reason: %d", MAC_ADDR_ARRAY(bssId.bytes), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3888 | mac_trace_getcsr_roam_sub_state(NewSubstate), reasonCode); |
| 3889 | |
| 3890 | csr_roam_substate_change(pMac, NewSubstate, sessionId); |
| 3891 | |
| 3892 | status = csr_send_mb_disassoc_req_msg(pMac, sessionId, bssId.bytes, |
| 3893 | reasonCode); |
| 3894 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3895 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3896 | csr_roam_link_down(pMac, sessionId); |
| 3897 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 3898 | /* no need to tell QoS that we are disassociating, it will be |
| 3899 | * taken care off in assoc req for HO |
| 3900 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3901 | if (eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate) { |
| 3902 | /* notify QoS module that disassoc happening */ |
| 3903 | sme_qos_csr_event_ind(pMac, (uint8_t) sessionId, |
| 3904 | SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 3905 | } |
| 3906 | #endif |
| 3907 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3908 | sme_warn("csr_send_mb_disassoc_req_msg failed status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3909 | status); |
| 3910 | } |
| 3911 | |
| 3912 | return status; |
| 3913 | } |
| 3914 | |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 3915 | /** |
| 3916 | * csr_roam_issue_disassociate_sta_cmd() - disassociate a associated station |
| 3917 | * @sessionId: Session Id for Soft AP |
| 3918 | * @p_del_sta_params: Pointer to parameters of the station to disassoc |
| 3919 | * |
| 3920 | * CSR function that HDD calls to delete a associated station |
| 3921 | * |
| 3922 | * Return: QDF_STATUS_SUCCESS on success or another QDF_STATUS_* on error |
| 3923 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3924 | QDF_STATUS csr_roam_issue_disassociate_sta_cmd(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3925 | uint32_t sessionId, |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 3926 | struct tagCsrDelStaParams |
| 3927 | *p_del_sta_params) |
| 3928 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3929 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3930 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3931 | tSmeCmd *pCommand; |
| 3932 | |
| 3933 | do { |
| 3934 | pCommand = csr_get_command_buffer(pMac); |
| 3935 | if (!pCommand) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3936 | sme_err("fail to get command buffer"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3937 | status = QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3938 | break; |
| 3939 | } |
| 3940 | pCommand->command = eSmeCommandRoam; |
| 3941 | pCommand->sessionId = (uint8_t) sessionId; |
| 3942 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta; |
Deepthi Gowri | b3bfefd | 2016-09-13 15:14:34 +0530 | [diff] [blame] | 3943 | qdf_mem_copy(pCommand->u.roamCmd.peerMac, |
| 3944 | p_del_sta_params->peerMacAddr.bytes, |
| 3945 | sizeof(pCommand->u.roamCmd.peerMac)); |
| 3946 | pCommand->u.roamCmd.reason = |
| 3947 | (tSirMacReasonCodes)p_del_sta_params->reason_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3948 | status = csr_queue_sme_command(pMac, pCommand, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3949 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3950 | sme_err("fail to send message status: %d", status); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 3951 | csr_release_command(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3952 | } |
| 3953 | } while (0); |
| 3954 | |
| 3955 | return status; |
| 3956 | } |
| 3957 | |
| 3958 | /** |
| 3959 | * csr_roam_issue_deauthSta() - delete a associated station |
| 3960 | * @sessionId: Session Id for Soft AP |
| 3961 | * @pDelStaParams: Pointer to parameters of the station to deauthenticate |
| 3962 | * |
| 3963 | * CSR function that HDD calls to delete a associated station |
| 3964 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 3965 | * Return: QDF_STATUS_SUCCESS on success or another QDF_STATUS_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3966 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3967 | QDF_STATUS csr_roam_issue_deauth_sta_cmd(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3968 | uint32_t sessionId, |
| 3969 | struct tagCsrDelStaParams *pDelStaParams) |
| 3970 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3971 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3972 | tSmeCmd *pCommand; |
| 3973 | |
| 3974 | do { |
| 3975 | pCommand = csr_get_command_buffer(pMac); |
| 3976 | if (!pCommand) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3977 | sme_err("fail to get command buffer"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3978 | status = QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3979 | break; |
| 3980 | } |
| 3981 | pCommand->command = eSmeCommandRoam; |
| 3982 | pCommand->sessionId = (uint8_t) sessionId; |
| 3983 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3984 | qdf_mem_copy(pCommand->u.roamCmd.peerMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3985 | pDelStaParams->peerMacAddr.bytes, |
| 3986 | sizeof(tSirMacAddr)); |
| 3987 | pCommand->u.roamCmd.reason = |
| 3988 | (tSirMacReasonCodes)pDelStaParams->reason_code; |
| 3989 | status = csr_queue_sme_command(pMac, pCommand, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3990 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 3991 | sme_err("fail to send message status: %d", status); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 3992 | csr_release_command(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3993 | } |
| 3994 | } while (0); |
| 3995 | |
| 3996 | return status; |
| 3997 | } |
| 3998 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3999 | static QDF_STATUS |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4000 | csr_send_mb_tkip_counter_measures_req_msg(tpAniSirGlobal pMac, |
| 4001 | uint32_t sessionId, bool bEnable, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4002 | struct qdf_mac_addr *bssId) |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4003 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4004 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4005 | tSirSmeTkipCntrMeasReq *pMsg; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4006 | |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4007 | do { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4008 | pMsg = qdf_mem_malloc(sizeof(tSirSmeTkipCntrMeasReq)); |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4009 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4010 | status = QDF_STATUS_E_NOMEM; |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4011 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4012 | status = QDF_STATUS_SUCCESS; |
| 4013 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4014 | break; |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4015 | pMsg->messageType = eWNI_SME_TKIP_CNTR_MEAS_REQ; |
| 4016 | pMsg->length = sizeof(tSirSmeTkipCntrMeasReq); |
| 4017 | pMsg->sessionId = sessionId; |
| 4018 | pMsg->transactionId = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 4019 | qdf_copy_macaddr(&pMsg->bssId, bssId); |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4020 | pMsg->bEnable = bEnable; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 4021 | status = umac_send_mb_message_to_mac(pMsg); |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4022 | } while (0); |
| 4023 | return status; |
| 4024 | } |
| 4025 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4026 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4027 | csr_roam_issue_tkip_counter_measures(tpAniSirGlobal pMac, uint32_t sessionId, |
| 4028 | bool bEnable) |
| 4029 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4030 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4031 | struct qdf_mac_addr bssId = QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4032 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4033 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4034 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4035 | sme_err("csr_roam_issue_tkip_counter_measures:CSR Session not found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4036 | return status; |
| 4037 | } |
| 4038 | if (pSession->pConnectBssDesc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4039 | qdf_mem_copy(bssId.bytes, pSession->pConnectBssDesc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4040 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4041 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4042 | sme_err("csr_roam_issue_tkip_counter_measures:Connected BSS Description in CSR Session not found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4043 | return status; |
| 4044 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4045 | sme_debug("CSR issuing tkip counter measures for Bssid:" MAC_ADDRESS_STR" Enable: %d", |
| 4046 | MAC_ADDR_ARRAY(bssId.bytes), bEnable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4047 | status = |
| 4048 | csr_send_mb_tkip_counter_measures_req_msg(pMac, sessionId, |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 4049 | bEnable, &bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4050 | return status; |
| 4051 | } |
| 4052 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4053 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4054 | csr_roam_get_associated_stas(tpAniSirGlobal pMac, uint32_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4055 | QDF_MODULE_ID modId, void *pUsrContext, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4056 | void *pfnSapEventCallback, uint8_t *pAssocStasBuf) |
| 4057 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4058 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4059 | struct qdf_mac_addr bssId = QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4060 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4061 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4062 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4063 | sme_err("csr_roam_get_associated_stas:CSR Session not found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4064 | return status; |
| 4065 | } |
| 4066 | if (pSession->pConnectBssDesc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4067 | qdf_mem_copy(bssId.bytes, pSession->pConnectBssDesc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4068 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4069 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4070 | sme_err("csr_roam_get_associated_stas:Connected BSS Description in CSR Session not found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4071 | return status; |
| 4072 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4073 | sme_debug("CSR getting associated stations for Bssid: " MAC_ADDRESS_STR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4074 | MAC_ADDR_ARRAY(bssId.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4075 | status = |
| 4076 | csr_send_mb_get_associated_stas_req_msg(pMac, sessionId, modId, |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 4077 | bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4078 | pUsrContext, |
| 4079 | pfnSapEventCallback, |
| 4080 | pAssocStasBuf); |
| 4081 | return status; |
| 4082 | } |
| 4083 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4084 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4085 | csr_roam_get_wps_session_overlap(tpAniSirGlobal pMac, uint32_t sessionId, |
| 4086 | void *pUsrContext, void *pfnSapEventCallback, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4087 | struct qdf_mac_addr pRemoveMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4088 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4089 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4090 | struct qdf_mac_addr bssId = QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4091 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 4092 | |
| 4093 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4094 | sme_err("csr_roam_get_wps_session_overlap:CSR Session not found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4095 | return status; |
| 4096 | } |
| 4097 | if (pSession->pConnectBssDesc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4098 | qdf_mem_copy(bssId.bytes, pSession->pConnectBssDesc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4099 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4100 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4101 | sme_err("csr_roam_get_wps_session_overlap:Connected BSS Description in CSR Session not found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4102 | return status; |
| 4103 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4104 | sme_debug("CSR getting WPS Session Overlap for Bssid: " MAC_ADDRESS_STR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4105 | MAC_ADDR_ARRAY(bssId.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | |
Srinivas Girigowda | edcfab9 | 2015-11-24 15:21:41 -0800 | [diff] [blame] | 4107 | status = csr_send_mb_get_wpspbc_sessions(pMac, sessionId, bssId, |
| 4108 | pUsrContext, pfnSapEventCallback, pRemoveMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4109 | |
| 4110 | return status; |
| 4111 | } |
| 4112 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 4113 | static |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4114 | QDF_STATUS csr_roam_issue_deauth(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4115 | eCsrRoamSubState NewSubstate) |
| 4116 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4117 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4118 | struct qdf_mac_addr bssId = QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4119 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 4120 | |
| 4121 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4122 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4123 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4124 | } |
| 4125 | |
| 4126 | if (pSession->pConnectBssDesc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4127 | qdf_mem_copy(bssId.bytes, pSession->pConnectBssDesc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4128 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4129 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4130 | sme_debug("CSR Attempting to Deauth Bssid= " MAC_ADDRESS_STR, |
| 4131 | MAC_ADDR_ARRAY(bssId.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4132 | csr_roam_substate_change(pMac, NewSubstate, sessionId); |
| 4133 | |
| 4134 | status = |
| 4135 | csr_send_mb_deauth_req_msg(pMac, sessionId, bssId.bytes, |
| 4136 | eSIR_MAC_DEAUTH_LEAVING_BSS_REASON); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4137 | if (QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4138 | csr_roam_link_down(pMac, sessionId); |
| 4139 | else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4140 | sme_err("csr_send_mb_deauth_req_msg failed with status %d Session ID: %d" |
| 4141 | MAC_ADDRESS_STR, status, sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4142 | MAC_ADDR_ARRAY(bssId.bytes)); |
| 4143 | } |
| 4144 | |
| 4145 | return status; |
| 4146 | } |
| 4147 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4148 | QDF_STATUS csr_roam_save_connected_bss_desc(tpAniSirGlobal pMac, |
| 4149 | uint32_t sessionId, |
| 4150 | tSirBssDescription *pBssDesc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4151 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4152 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4153 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 4154 | uint32_t size; |
| 4155 | |
| 4156 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4157 | sme_err(" session %d not found ", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4158 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4159 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4160 | /* If no BSS description was found in this connection |
| 4161 | * (happens with start IBSS), then nix the BSS description |
| 4162 | * that we keep around for the connected BSS) and get out. |
| 4163 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4164 | if (NULL == pBssDesc) { |
| 4165 | csr_free_connect_bss_desc(pMac, sessionId); |
| 4166 | } else { |
| 4167 | size = pBssDesc->length + sizeof(pBssDesc->length); |
| 4168 | if (NULL != pSession->pConnectBssDesc) { |
| 4169 | if (((pSession->pConnectBssDesc->length) + |
| 4170 | sizeof(pSession->pConnectBssDesc->length)) < |
| 4171 | size) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4172 | /* not enough room for the new BSS, |
| 4173 | * pMac->roam.pConnectBssDesc is freed inside |
| 4174 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4175 | csr_free_connect_bss_desc(pMac, sessionId); |
| 4176 | } |
| 4177 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4178 | if (NULL == pSession->pConnectBssDesc) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4179 | pSession->pConnectBssDesc = qdf_mem_malloc(size); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4180 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4181 | if (NULL == pSession->pConnectBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4182 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4183 | else |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4184 | qdf_mem_copy(pSession->pConnectBssDesc, pBssDesc, size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4185 | } |
| 4186 | return status; |
| 4187 | } |
| 4188 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 4189 | static |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4190 | QDF_STATUS csr_roam_prepare_bss_config(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4191 | tCsrRoamProfile *pProfile, |
| 4192 | tSirBssDescription *pBssDesc, |
| 4193 | tBssConfigParam *pBssConfig, |
| 4194 | tDot11fBeaconIEs *pIes) |
| 4195 | { |
| 4196 | eCsrCfgDot11Mode cfgDot11Mode; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4197 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4198 | QDF_ASSERT(pIes != NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4199 | if (pIes == NULL) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4200 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4201 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4202 | qdf_mem_copy(&pBssConfig->BssCap, &pBssDesc->capabilityInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4203 | sizeof(tSirMacCapabilityInfo)); |
| 4204 | /* get qos */ |
| 4205 | pBssConfig->qosType = csr_get_qo_s_from_bss_desc(pMac, pBssDesc, pIes); |
| 4206 | /* get SSID */ |
| 4207 | if (pIes->SSID.present) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4208 | qdf_mem_copy(&pBssConfig->SSID.ssId, pIes->SSID.ssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4209 | pIes->SSID.num_ssid); |
| 4210 | pBssConfig->SSID.length = pIes->SSID.num_ssid; |
| 4211 | } else |
| 4212 | pBssConfig->SSID.length = 0; |
| 4213 | if (csr_is_nullssid(pBssConfig->SSID.ssId, pBssConfig->SSID.length)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4214 | sme_warn("BSS desc SSID is a wild card"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4215 | /* Return failed if profile doesn't have an SSID either. */ |
| 4216 | if (pProfile->SSIDs.numOfSSIDs == 0) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4217 | sme_warn("BSS desc and profile doesn't have SSID"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4218 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4219 | } |
| 4220 | } |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 4221 | if (WLAN_REG_IS_5GHZ_CH(pBssDesc->channelId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4222 | pBssConfig->eBand = eCSR_BAND_5G; |
| 4223 | else |
| 4224 | pBssConfig->eBand = eCSR_BAND_24; |
| 4225 | /* phymode */ |
| 4226 | if (csr_is_phy_mode_match(pMac, pProfile->phyMode, pBssDesc, |
| 4227 | pProfile, &cfgDot11Mode, pIes)) { |
| 4228 | pBssConfig->uCfgDot11Mode = cfgDot11Mode; |
| 4229 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4230 | sme_warn("Can not find match phy mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4231 | /* force it */ |
| 4232 | if (eCSR_BAND_24 == pBssConfig->eBand) |
| 4233 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 4234 | else |
| 4235 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 4236 | } |
Padma, Santhosh Kumar | 19f5765 | 2017-05-26 18:03:45 +0530 | [diff] [blame] | 4237 | |
| 4238 | sme_debug("phyMode=%d, uCfgDot11Mode=%d", |
| 4239 | pProfile->phyMode, pBssConfig->uCfgDot11Mode); |
| 4240 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4241 | /* Qos */ |
| 4242 | if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && |
| 4243 | (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) { |
| 4244 | /* |
| 4245 | * Joining BSS is not 11n capable and WMM is disabled on client. |
| 4246 | * Disable QoS and WMM |
| 4247 | */ |
| 4248 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 4249 | } |
| 4250 | |
| 4251 | if (((pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N) |
| 4252 | || (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC)) |
| 4253 | && ((pBssConfig->qosType != eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP) |
| 4254 | || (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_HCF) |
| 4255 | || (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_eDCF))) { |
| 4256 | /* Joining BSS is 11n capable and WMM is disabled on AP. */ |
| 4257 | /* Assume all HT AP's are QOS AP's and enable WMM */ |
| 4258 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 4259 | } |
| 4260 | /* auth type */ |
| 4261 | switch (pProfile->negotiatedAuthType) { |
| 4262 | default: |
| 4263 | case eCSR_AUTH_TYPE_WPA: |
| 4264 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 4265 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 4266 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 4267 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 4268 | break; |
| 4269 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 4270 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 4271 | break; |
| 4272 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 4273 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 4274 | break; |
| 4275 | } |
| 4276 | /* short slot time */ |
| 4277 | if (eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode) |
| 4278 | pBssConfig->uShortSlotTime = |
| 4279 | pMac->roam.configParam.shortSlotTime; |
| 4280 | else |
| 4281 | pBssConfig->uShortSlotTime = 0; |
| 4282 | |
| 4283 | if (pBssConfig->BssCap.ibss) |
| 4284 | /* We don't support 11h on IBSS */ |
| 4285 | pBssConfig->f11hSupport = false; |
| 4286 | else |
| 4287 | pBssConfig->f11hSupport = |
| 4288 | pMac->roam.configParam.Is11hSupportEnabled; |
| 4289 | /* power constraint */ |
| 4290 | pBssConfig->uPowerLimit = |
| 4291 | csr_get11h_power_constraint(pMac, &pIes->PowerConstraints); |
| 4292 | /* heartbeat */ |
| 4293 | if (CSR_IS_11A_BSS(pBssDesc)) |
| 4294 | pBssConfig->uHeartBeatThresh = |
| 4295 | pMac->roam.configParam.HeartbeatThresh50; |
| 4296 | else |
| 4297 | pBssConfig->uHeartBeatThresh = |
| 4298 | pMac->roam.configParam.HeartbeatThresh24; |
| 4299 | |
| 4300 | /* |
| 4301 | * Join timeout: if we find a BeaconInterval in the BssDescription, |
| 4302 | * then set the Join Timeout to be 10 x the BeaconInterval. |
| 4303 | */ |
| 4304 | if (pBssDesc->beaconInterval) |
| 4305 | /* Make sure it is bigger than the minimal */ |
| 4306 | pBssConfig->uJoinTimeOut = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4307 | QDF_MAX(10 * pBssDesc->beaconInterval, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4308 | CSR_JOIN_FAILURE_TIMEOUT_MIN); |
| 4309 | else |
| 4310 | pBssConfig->uJoinTimeOut = |
| 4311 | CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 4312 | /* validate CB */ |
Krishna Kumaar Natarajan | f86c6ed | 2017-03-27 11:36:29 -0700 | [diff] [blame] | 4313 | if ((pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N) || |
| 4314 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N_ONLY) || |
| 4315 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC) || |
| 4316 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC_ONLY) || |
| 4317 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AX) || |
| 4318 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AX_ONLY)) |
Kiran Kumar Lokere | 35fb524 | 2017-03-10 20:16:44 -0800 | [diff] [blame] | 4319 | pBssConfig->cbMode = csr_get_cb_mode_from_ies(pMac, |
| 4320 | pBssDesc->channelId, pIes); |
| 4321 | else |
| 4322 | pBssConfig->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4323 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4324 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4325 | } |
| 4326 | |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 4327 | QDF_STATUS csr_roam_prepare_bss_config_from_profile(tpAniSirGlobal pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4328 | tCsrRoamProfile *pProfile, |
| 4329 | tBssConfigParam *pBssConfig, |
| 4330 | tSirBssDescription *pBssDesc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4331 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4332 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4333 | uint8_t operationChannel = 0; |
| 4334 | uint8_t qAPisEnabled = false; |
| 4335 | /* SSID */ |
| 4336 | pBssConfig->SSID.length = 0; |
| 4337 | if (pProfile->SSIDs.numOfSSIDs) { |
| 4338 | /* only use the first one */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4339 | qdf_mem_copy(&pBssConfig->SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4340 | &pProfile->SSIDs.SSIDList[0].SSID, |
| 4341 | sizeof(tSirMacSSid)); |
| 4342 | } else { |
| 4343 | /* SSID must present */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4344 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4345 | } |
| 4346 | /* Settomg up the capabilities */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4347 | if (csr_is_bss_type_ibss(pProfile->BSSType)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4348 | pBssConfig->BssCap.ibss = 1; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4349 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4350 | pBssConfig->BssCap.ess = 1; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4351 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4352 | if (eCSR_ENCRYPT_TYPE_NONE != |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4353 | pProfile->EncryptionType.encryptionType[0]) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4354 | pBssConfig->BssCap.privacy = 1; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4355 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4356 | pBssConfig->eBand = pMac->roam.configParam.eBand; |
| 4357 | /* phymode */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4358 | if (pProfile->ChannelInfo.ChannelList) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4359 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4360 | pBssConfig->uCfgDot11Mode = csr_roam_get_phy_mode_band_for_bss(pMac, |
| 4361 | pProfile, operationChannel, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4362 | &pBssConfig->eBand); |
| 4363 | /* QOS */ |
| 4364 | /* Is this correct to always set to this // *** */ |
| 4365 | if (pBssConfig->BssCap.ess == 1) { |
| 4366 | /*For Softap case enable WMM */ |
| 4367 | if (CSR_IS_INFRA_AP(pProfile) |
| 4368 | && (eCsrRoamWmmNoQos != |
| 4369 | pMac->roam.configParam.WMMSupportMode)) { |
| 4370 | qAPisEnabled = true; |
| 4371 | } else |
| 4372 | if (csr_roam_get_qos_info_from_bss(pMac, pBssDesc) == |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4373 | QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4374 | qAPisEnabled = true; |
| 4375 | } else { |
| 4376 | qAPisEnabled = false; |
| 4377 | } |
| 4378 | } else { |
| 4379 | qAPisEnabled = true; |
| 4380 | } |
| 4381 | if ((eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && |
| 4382 | qAPisEnabled) || |
| 4383 | ((eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && |
| 4384 | qAPisEnabled))) { |
| 4385 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 4386 | } else { |
| 4387 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 4388 | } |
| 4389 | |
| 4390 | /* auth type */ |
| 4391 | /* Take the preferred Auth type. */ |
| 4392 | switch (pProfile->AuthType.authType[0]) { |
| 4393 | default: |
| 4394 | case eCSR_AUTH_TYPE_WPA: |
| 4395 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 4396 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 4397 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 4398 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 4399 | break; |
| 4400 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 4401 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 4402 | break; |
| 4403 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 4404 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 4405 | break; |
| 4406 | } |
| 4407 | /* short slot time */ |
| 4408 | if (WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode) { |
| 4409 | pBssConfig->uShortSlotTime = |
| 4410 | pMac->roam.configParam.shortSlotTime; |
| 4411 | } else { |
| 4412 | pBssConfig->uShortSlotTime = 0; |
| 4413 | } |
| 4414 | /* power constraint. We don't support 11h on IBSS */ |
| 4415 | pBssConfig->f11hSupport = false; |
| 4416 | pBssConfig->uPowerLimit = 0; |
| 4417 | /* heartbeat */ |
| 4418 | if (eCSR_BAND_5G == pBssConfig->eBand) { |
| 4419 | pBssConfig->uHeartBeatThresh = |
| 4420 | pMac->roam.configParam.HeartbeatThresh50; |
| 4421 | } else { |
| 4422 | pBssConfig->uHeartBeatThresh = |
| 4423 | pMac->roam.configParam.HeartbeatThresh24; |
| 4424 | } |
| 4425 | /* Join timeout */ |
| 4426 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 4427 | |
| 4428 | return status; |
| 4429 | } |
| 4430 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4431 | static QDF_STATUS csr_roam_get_qos_info_from_bss(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4432 | tSirBssDescription *pBssDesc) |
| 4433 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4434 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4435 | tDot11fBeaconIEs *pIes = NULL; |
| 4436 | |
| 4437 | do { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4438 | if (!QDF_IS_STATUS_SUCCESS( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4439 | csr_get_parsed_bss_description_ies( |
| 4440 | pMac, pBssDesc, &pIes))) { |
| 4441 | /* err msg */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4442 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4443 | "csr_roam_get_qos_info_from_bss() failed"); |
| 4444 | break; |
| 4445 | } |
| 4446 | /* check if the AP is QAP & it supports APSD */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4447 | if (CSR_IS_QOS_BSS(pIes)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4448 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4449 | } while (0); |
| 4450 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4451 | if (NULL != pIes) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4452 | qdf_mem_free(pIes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4453 | |
| 4454 | return status; |
| 4455 | } |
| 4456 | |
| 4457 | void csr_set_cfg_privacy(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 4458 | bool fPrivacy) |
| 4459 | { |
| 4460 | /* |
| 4461 | * the only difference between this function and |
| 4462 | * the csr_set_cfg_privacyFromProfile() is the setting of the privacy |
| 4463 | * CFG based on the advertised privacy setting from the AP for WPA |
| 4464 | * associations. See note below in this function... |
| 4465 | */ |
| 4466 | uint32_t PrivacyEnabled = 0, RsnEnabled = 0, WepDefaultKeyId = 0; |
| 4467 | uint32_t WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 4468 | uint32_t Key0Length = 0, Key1Length = 0, Key2Length = 0, Key3Length = 0; |
| 4469 | |
| 4470 | /* Reserve for the biggest key */ |
| 4471 | uint8_t Key0[WNI_CFG_WEP_DEFAULT_KEY_1_LEN]; |
| 4472 | uint8_t Key1[WNI_CFG_WEP_DEFAULT_KEY_2_LEN]; |
| 4473 | uint8_t Key2[WNI_CFG_WEP_DEFAULT_KEY_3_LEN]; |
| 4474 | uint8_t Key3[WNI_CFG_WEP_DEFAULT_KEY_4_LEN]; |
| 4475 | |
| 4476 | switch (pProfile->negotiatedUCEncryptionType) { |
| 4477 | case eCSR_ENCRYPT_TYPE_NONE: |
| 4478 | /* for NO encryption, turn off Privacy and Rsn. */ |
| 4479 | PrivacyEnabled = 0; |
| 4480 | RsnEnabled = 0; |
| 4481 | /* clear out the WEP keys that may be hanging around. */ |
| 4482 | Key0Length = 0; |
| 4483 | Key1Length = 0; |
| 4484 | Key2Length = 0; |
| 4485 | Key3Length = 0; |
| 4486 | break; |
| 4487 | |
| 4488 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 4489 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 4490 | |
| 4491 | /* Privacy is ON. NO RSN for Wep40 static key. */ |
| 4492 | PrivacyEnabled = 1; |
| 4493 | RsnEnabled = 0; |
| 4494 | /* Set the Wep default key ID. */ |
| 4495 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 4496 | /* Wep key size if 5 bytes (40 bits). */ |
| 4497 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 4498 | /* |
| 4499 | * set encryption keys in the CFG database or |
| 4500 | * clear those that are not present in this profile. |
| 4501 | */ |
| 4502 | if (pProfile->Keys.KeyLength[0]) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4503 | qdf_mem_copy(Key0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4504 | pProfile->Keys.KeyMaterial[0], |
| 4505 | WNI_CFG_WEP_KEY_LENGTH_5); |
| 4506 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 4507 | } else { |
| 4508 | Key0Length = 0; |
| 4509 | } |
| 4510 | |
| 4511 | if (pProfile->Keys.KeyLength[1]) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4512 | qdf_mem_copy(Key1, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4513 | pProfile->Keys.KeyMaterial[1], |
| 4514 | WNI_CFG_WEP_KEY_LENGTH_5); |
| 4515 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 4516 | } else { |
| 4517 | Key1Length = 0; |
| 4518 | } |
| 4519 | |
| 4520 | if (pProfile->Keys.KeyLength[2]) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4521 | qdf_mem_copy(Key2, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4522 | pProfile->Keys.KeyMaterial[2], |
| 4523 | WNI_CFG_WEP_KEY_LENGTH_5); |
| 4524 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 4525 | } else { |
| 4526 | Key2Length = 0; |
| 4527 | } |
| 4528 | |
| 4529 | if (pProfile->Keys.KeyLength[3]) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4530 | qdf_mem_copy(Key3, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4531 | pProfile->Keys.KeyMaterial[3], |
| 4532 | WNI_CFG_WEP_KEY_LENGTH_5); |
| 4533 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 4534 | } else { |
| 4535 | Key3Length = 0; |
| 4536 | } |
| 4537 | break; |
| 4538 | |
| 4539 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 4540 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 4541 | |
| 4542 | /* Privacy is ON. NO RSN for Wep40 static key. */ |
| 4543 | PrivacyEnabled = 1; |
| 4544 | RsnEnabled = 0; |
| 4545 | /* Set the Wep default key ID. */ |
| 4546 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 4547 | /* Wep key size if 13 bytes (104 bits). */ |
| 4548 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13; |
| 4549 | /* |
| 4550 | * set encryption keys in the CFG database or clear |
| 4551 | * those that are not present in this profile. |
| 4552 | */ |
| 4553 | if (pProfile->Keys.KeyLength[0]) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4554 | qdf_mem_copy(Key0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4555 | pProfile->Keys.KeyMaterial[0], |
| 4556 | WNI_CFG_WEP_KEY_LENGTH_13); |
| 4557 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 4558 | } else { |
| 4559 | Key0Length = 0; |
| 4560 | } |
| 4561 | |
| 4562 | if (pProfile->Keys.KeyLength[1]) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4563 | qdf_mem_copy(Key1, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4564 | pProfile->Keys.KeyMaterial[1], |
| 4565 | WNI_CFG_WEP_KEY_LENGTH_13); |
| 4566 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 4567 | } else { |
| 4568 | Key1Length = 0; |
| 4569 | } |
| 4570 | |
| 4571 | if (pProfile->Keys.KeyLength[2]) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4572 | qdf_mem_copy(Key2, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4573 | pProfile->Keys.KeyMaterial[2], |
| 4574 | WNI_CFG_WEP_KEY_LENGTH_13); |
| 4575 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 4576 | } else { |
| 4577 | Key2Length = 0; |
| 4578 | } |
| 4579 | |
| 4580 | if (pProfile->Keys.KeyLength[3]) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4581 | qdf_mem_copy(Key3, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4582 | pProfile->Keys.KeyMaterial[3], |
| 4583 | WNI_CFG_WEP_KEY_LENGTH_13); |
| 4584 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 4585 | } else { |
| 4586 | Key3Length = 0; |
| 4587 | } |
| 4588 | break; |
| 4589 | |
| 4590 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 4591 | case eCSR_ENCRYPT_TYPE_AES: |
| 4592 | #ifdef FEATURE_WLAN_WAPI |
| 4593 | case eCSR_ENCRYPT_TYPE_WPI: |
| 4594 | #endif /* FEATURE_WLAN_WAPI */ |
| 4595 | /* |
| 4596 | * this is the only difference between this function and |
| 4597 | * the csr_set_cfg_privacyFromProfile(). |
| 4598 | * (setting of the privacy CFG based on the advertised |
| 4599 | * privacy setting from AP for WPA/WAPI associations). |
| 4600 | */ |
| 4601 | PrivacyEnabled = (0 != fPrivacy); |
| 4602 | /* turn on RSN enabled for WPA associations */ |
| 4603 | RsnEnabled = 1; |
| 4604 | /* clear static WEP keys that may be hanging around. */ |
| 4605 | Key0Length = 0; |
| 4606 | Key1Length = 0; |
| 4607 | Key2Length = 0; |
| 4608 | Key3Length = 0; |
| 4609 | break; |
| 4610 | default: |
| 4611 | PrivacyEnabled = 0; |
| 4612 | RsnEnabled = 0; |
| 4613 | break; |
| 4614 | } |
| 4615 | |
| 4616 | cfg_set_int(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled); |
| 4617 | cfg_set_int(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled); |
| 4618 | cfg_set_str(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length); |
| 4619 | cfg_set_str(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length); |
| 4620 | cfg_set_str(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length); |
| 4621 | cfg_set_str(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length); |
| 4622 | cfg_set_int(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength); |
| 4623 | cfg_set_int(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId); |
| 4624 | } |
| 4625 | |
| 4626 | static void csr_set_cfg_ssid(tpAniSirGlobal pMac, tSirMacSSid *pSSID) |
| 4627 | { |
| 4628 | uint32_t len = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4629 | |
| 4630 | if (pSSID->length <= WNI_CFG_SSID_LEN) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4631 | len = pSSID->length; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4632 | cfg_set_str(pMac, WNI_CFG_SSID, (uint8_t *) pSSID->ssId, len); |
| 4633 | } |
| 4634 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 4635 | static QDF_STATUS csr_set_qos_to_cfg(tpAniSirGlobal pMac, uint32_t sessionId, |
| 4636 | eCsrMediaAccessType qosType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4637 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4638 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4639 | uint32_t QoSEnabled; |
| 4640 | uint32_t WmeEnabled; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4641 | /* set the CFG enable/disable variables based on the |
| 4642 | * qosType being configured. |
| 4643 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4644 | switch (qosType) { |
| 4645 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p: |
| 4646 | QoSEnabled = false; |
| 4647 | WmeEnabled = true; |
| 4648 | break; |
| 4649 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP: |
| 4650 | QoSEnabled = false; |
| 4651 | WmeEnabled = true; |
| 4652 | break; |
| 4653 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify: |
| 4654 | QoSEnabled = false; |
| 4655 | WmeEnabled = true; |
| 4656 | break; |
| 4657 | case eCSR_MEDIUM_ACCESS_11e_eDCF: |
| 4658 | QoSEnabled = true; |
| 4659 | WmeEnabled = false; |
| 4660 | break; |
| 4661 | case eCSR_MEDIUM_ACCESS_11e_HCF: |
| 4662 | QoSEnabled = true; |
| 4663 | WmeEnabled = false; |
| 4664 | break; |
| 4665 | default: |
| 4666 | case eCSR_MEDIUM_ACCESS_DCF: |
| 4667 | QoSEnabled = false; |
| 4668 | WmeEnabled = false; |
| 4669 | break; |
| 4670 | } |
| 4671 | /* save the WMM setting for later use */ |
| 4672 | pMac->roam.roamSession[sessionId].fWMMConnection = (bool) WmeEnabled; |
| 4673 | pMac->roam.roamSession[sessionId].fQOSConnection = (bool) QoSEnabled; |
| 4674 | return status; |
| 4675 | } |
| 4676 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4677 | static QDF_STATUS csr_get_rate_set(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4678 | tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, |
| 4679 | tSirBssDescription *pBssDesc, |
| 4680 | tDot11fBeaconIEs *pIes, |
| 4681 | tSirMacRateSet *pOpRateSet, |
| 4682 | tSirMacRateSet *pExRateSet) |
| 4683 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4684 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4685 | int i; |
| 4686 | eCsrCfgDot11Mode cfgDot11Mode; |
| 4687 | uint8_t *pDstRate; |
| 4688 | uint16_t rateBitmap = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4689 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4690 | qdf_mem_set(pOpRateSet, sizeof(tSirMacRateSet), 0); |
| 4691 | qdf_mem_set(pExRateSet, sizeof(tSirMacRateSet), 0); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4692 | QDF_ASSERT(pIes != NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4693 | |
| 4694 | if (NULL == pIes) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4695 | sme_err("failed to parse BssDesc"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4696 | return status; |
| 4697 | } |
| 4698 | |
| 4699 | csr_is_phy_mode_match(pMac, phyMode, pBssDesc, pProfile, |
| 4700 | &cfgDot11Mode, pIes); |
| 4701 | /* |
| 4702 | * Originally, we thought that for 11a networks, the 11a rates |
| 4703 | * are always in the Operational Rate set & for 11b and 11g |
| 4704 | * networks, the 11b rates appear in the Operational Rate set. |
| 4705 | * Consequently, in either case, we would blindly put the rates |
| 4706 | * we support into our Operational Rate set. |
| 4707 | * (including the basic rates, which we've already verified are |
| 4708 | * supported earlier in the roaming decision). |
| 4709 | * However, it turns out that this is not always the case. |
| 4710 | * Some AP's (e.g. D-Link DI-784) ram 11g rates into the |
| 4711 | * Operational Rate set too. Now, we're a little more careful. |
| 4712 | */ |
| 4713 | pDstRate = pOpRateSet->rate; |
| 4714 | if (pIes->SuppRates.present) { |
| 4715 | for (i = 0; i < pIes->SuppRates.num_rates; i++) { |
| 4716 | if (csr_rates_is_dot11_rate_supported(pMac, |
| 4717 | pIes->SuppRates.rates[i]) && |
| 4718 | !csr_check_rate_bitmap( |
| 4719 | pIes->SuppRates.rates[i], |
| 4720 | rateBitmap)) { |
| 4721 | csr_add_rate_bitmap(pIes->SuppRates. |
| 4722 | rates[i], &rateBitmap); |
| 4723 | *pDstRate++ = pIes->SuppRates.rates[i]; |
| 4724 | pOpRateSet->numRates++; |
| 4725 | } |
| 4726 | } |
| 4727 | } |
Abhishek Singh | 1011238 | 2015-12-03 16:06:59 +0530 | [diff] [blame] | 4728 | /* |
| 4729 | * If there are Extended Rates in the beacon, we will reflect the |
| 4730 | * extended rates that we support in our Extended Operational Rate |
| 4731 | * set. |
| 4732 | */ |
| 4733 | if (pIes->ExtSuppRates.present) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4734 | pDstRate = pExRateSet->rate; |
| 4735 | for (i = 0; i < pIes->ExtSuppRates.num_rates; i++) { |
| 4736 | if (csr_rates_is_dot11_rate_supported(pMac, |
| 4737 | pIes->ExtSuppRates.rates[i]) && |
| 4738 | !csr_check_rate_bitmap( |
| 4739 | pIes->ExtSuppRates.rates[i], |
| 4740 | rateBitmap)) { |
| 4741 | *pDstRate++ = pIes->ExtSuppRates.rates[i]; |
| 4742 | pExRateSet->numRates++; |
| 4743 | } |
| 4744 | } |
| 4745 | } |
| 4746 | if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4747 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4748 | return status; |
| 4749 | } |
| 4750 | |
| 4751 | static void csr_set_cfg_rate_set(tpAniSirGlobal pMac, eCsrPhyMode phyMode, |
| 4752 | tCsrRoamProfile *pProfile, |
| 4753 | tSirBssDescription *pBssDesc, |
| 4754 | tDot11fBeaconIEs *pIes) |
| 4755 | { |
| 4756 | int i; |
| 4757 | uint8_t *pDstRate; |
| 4758 | eCsrCfgDot11Mode cfgDot11Mode; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4759 | /* leave enough room for the max number of rates */ |
| 4760 | uint8_t OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4761 | uint32_t OperationalRatesLength = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4762 | /* leave enough room for the max number of rates */ |
| 4763 | uint8_t ExtendedOperationalRates |
| 4764 | [CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4765 | uint32_t ExtendedOperationalRatesLength = 0; |
| 4766 | uint8_t MCSRateIdxSet[SIZE_OF_SUPPORTED_MCS_SET]; |
| 4767 | uint32_t MCSRateLength = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4768 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4769 | QDF_ASSERT(pIes != NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4770 | if (NULL != pIes) { |
| 4771 | csr_is_phy_mode_match(pMac, phyMode, pBssDesc, pProfile, |
| 4772 | &cfgDot11Mode, pIes); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4773 | /* Originally, we thought that for 11a networks, the 11a rates |
| 4774 | * are always in the Operational Rate set & for 11b and 11g |
| 4775 | * networks, the 11b rates appear in the Operational Rate set. |
| 4776 | * Consequently, in either case, we would blindly put the rates |
| 4777 | * we support into our Operational Rate set (including the basic |
| 4778 | * rates, which we have already verified are supported earlier |
| 4779 | * in the roaming decision). However, it turns out that this is |
| 4780 | * not always the case. Some AP's (e.g. D-Link DI-784) ram 11g |
| 4781 | * rates into the Operational Rate set, too. Now, we're a |
| 4782 | * little more careful: |
| 4783 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4784 | pDstRate = OperationalRates; |
| 4785 | if (pIes->SuppRates.present) { |
| 4786 | for (i = 0; i < pIes->SuppRates.num_rates; i++) { |
| 4787 | if (csr_rates_is_dot11_rate_supported |
| 4788 | (pMac, pIes->SuppRates.rates[i]) |
| 4789 | && (OperationalRatesLength < |
| 4790 | CSR_DOT11_SUPPORTED_RATES_MAX)) { |
| 4791 | *pDstRate++ = pIes->SuppRates.rates[i]; |
| 4792 | OperationalRatesLength++; |
| 4793 | } |
| 4794 | } |
| 4795 | } |
| 4796 | if (eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 4797 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 4798 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4799 | /* If there are Extended Rates in the beacon, we will |
| 4800 | * reflect those extended rates that we support in out |
| 4801 | * Extended Operational Rate set: |
| 4802 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4803 | pDstRate = ExtendedOperationalRates; |
| 4804 | if (pIes->ExtSuppRates.present) { |
| 4805 | for (i = 0; i < pIes->ExtSuppRates.num_rates; |
| 4806 | i++) { |
| 4807 | if (csr_rates_is_dot11_rate_supported |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4808 | (pMac, pIes->ExtSuppRates. |
| 4809 | rates[i]) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4810 | && (ExtendedOperationalRatesLength < |
| 4811 | CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX)) { |
| 4812 | *pDstRate++ = |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4813 | pIes->ExtSuppRates. |
| 4814 | rates[i]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4815 | ExtendedOperationalRatesLength++; |
| 4816 | } |
| 4817 | } |
| 4818 | } |
| 4819 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4820 | /* Enable proprietary MAC features if peer node is Airgo node |
| 4821 | * and STA user wants to use them For ANI network companions, |
| 4822 | * we need to populate the proprietary rate set with any |
| 4823 | * proprietary rates we found in the beacon, only if user allows |
| 4824 | * them. |
| 4825 | */ |
| 4826 | /* No proprietary modes... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4827 | /* Get MCS Rate */ |
| 4828 | pDstRate = MCSRateIdxSet; |
| 4829 | if (pIes->HTCaps.present) { |
| 4830 | for (i = 0; i < VALID_MAX_MCS_INDEX; i++) { |
| 4831 | if ((unsigned int)pIes->HTCaps. |
| 4832 | supportedMCSSet[0] & (1 << i)) { |
| 4833 | MCSRateLength++; |
| 4834 | *pDstRate++ = i; |
| 4835 | } |
| 4836 | } |
| 4837 | } |
| 4838 | /* Set the operational rate set CFG variables... */ |
| 4839 | cfg_set_str(pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
| 4840 | OperationalRates, OperationalRatesLength); |
| 4841 | cfg_set_str(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 4842 | ExtendedOperationalRates, |
| 4843 | ExtendedOperationalRatesLength); |
| 4844 | cfg_set_str(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, |
| 4845 | MCSRateLength); |
| 4846 | } /* Parsing BSSDesc */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4847 | else |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 4848 | sme_err("failed to parse BssDesc"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4849 | } |
| 4850 | |
| 4851 | static void csr_set_cfg_rate_set_from_profile(tpAniSirGlobal pMac, |
| 4852 | tCsrRoamProfile *pProfile) |
| 4853 | { |
| 4854 | tSirMacRateSetIE DefaultSupportedRates11a = { SIR_MAC_RATESET_EID, |
| 4855 | {8, |
| 4856 | {SIR_MAC_RATE_6, |
| 4857 | SIR_MAC_RATE_9, |
| 4858 | SIR_MAC_RATE_12, |
| 4859 | SIR_MAC_RATE_18, |
| 4860 | SIR_MAC_RATE_24, |
| 4861 | SIR_MAC_RATE_36, |
| 4862 | SIR_MAC_RATE_48, |
| 4863 | SIR_MAC_RATE_54} } }; |
| 4864 | tSirMacRateSetIE DefaultSupportedRates11b = { SIR_MAC_RATESET_EID, |
| 4865 | {4, |
| 4866 | {SIR_MAC_RATE_1, |
| 4867 | SIR_MAC_RATE_2, |
| 4868 | SIR_MAC_RATE_5_5, |
| 4869 | SIR_MAC_RATE_11} } }; |
| 4870 | |
| 4871 | tSirMacPropRateSet DefaultSupportedPropRates = { 3, |
| 4872 | {SIR_MAC_RATE_72, |
| 4873 | SIR_MAC_RATE_96, |
| 4874 | SIR_MAC_RATE_108} }; |
| 4875 | eCsrCfgDot11Mode cfgDot11Mode; |
| 4876 | eCsrBand eBand; |
| 4877 | /* leave enough room for the max number of rates */ |
| 4878 | uint8_t OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 4879 | uint32_t OperationalRatesLength = 0; |
| 4880 | /* leave enough room for the max number of rates */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4881 | uint8_t ExtendedOperationalRates |
| 4882 | [CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4883 | uint32_t ExtendedOperationalRatesLength = 0; |
| 4884 | /* leave enough room for the max number of proprietary rates */ |
| 4885 | uint8_t ProprietaryOperationalRates[4]; |
| 4886 | uint32_t ProprietaryOperationalRatesLength = 0; |
| 4887 | uint32_t PropRatesEnable = 0; |
| 4888 | uint8_t operationChannel = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4889 | |
| 4890 | if (pProfile->ChannelInfo.ChannelList) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4891 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4892 | cfgDot11Mode = csr_roam_get_phy_mode_band_for_bss(pMac, pProfile, |
| 4893 | operationChannel, |
| 4894 | &eBand); |
| 4895 | /* For 11a networks, the 11a rates go into the Operational Rate set. |
| 4896 | * For 11b and 11g networks, the 11b rates appear in the Operational |
| 4897 | * Rate set. In either case, we can blindly put the rates we support |
| 4898 | * into our Operational Rate set (including the basic rates, which we |
| 4899 | * have already verified are supported earlier in the roaming decision). |
| 4900 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4901 | if (eCSR_BAND_5G == eBand) { |
| 4902 | /* 11a rates into the Operational Rate Set. */ |
| 4903 | OperationalRatesLength = |
| 4904 | DefaultSupportedRates11a.supportedRateSet.numRates * |
| 4905 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4906 | qdf_mem_copy(OperationalRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4907 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 4908 | OperationalRatesLength); |
| 4909 | |
| 4910 | /* Nothing in the Extended rate set. */ |
| 4911 | ExtendedOperationalRatesLength = 0; |
| 4912 | /* populate proprietary rates if user allows them */ |
| 4913 | if (pMac->roam.configParam.ProprietaryRatesEnabled) { |
| 4914 | ProprietaryOperationalRatesLength = |
| 4915 | DefaultSupportedPropRates.numPropRates * |
| 4916 | sizeof(*DefaultSupportedPropRates.propRate); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4917 | qdf_mem_copy(ProprietaryOperationalRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4918 | DefaultSupportedPropRates.propRate, |
| 4919 | ProprietaryOperationalRatesLength); |
| 4920 | } else { |
| 4921 | /* No proprietary modes */ |
| 4922 | ProprietaryOperationalRatesLength = 0; |
| 4923 | } |
| 4924 | } else if (eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode) { |
| 4925 | /* 11b rates into the Operational Rate Set. */ |
| 4926 | OperationalRatesLength = |
| 4927 | DefaultSupportedRates11b.supportedRateSet.numRates * |
| 4928 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4929 | qdf_mem_copy(OperationalRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4930 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 4931 | OperationalRatesLength); |
| 4932 | /* Nothing in the Extended rate set. */ |
| 4933 | ExtendedOperationalRatesLength = 0; |
| 4934 | /* No proprietary modes */ |
| 4935 | ProprietaryOperationalRatesLength = 0; |
| 4936 | } else { |
| 4937 | /* 11G */ |
| 4938 | |
| 4939 | /* 11b rates into the Operational Rate Set. */ |
| 4940 | OperationalRatesLength = |
| 4941 | DefaultSupportedRates11b.supportedRateSet.numRates * |
| 4942 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4943 | qdf_mem_copy(OperationalRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4944 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 4945 | OperationalRatesLength); |
| 4946 | |
| 4947 | /* 11a rates go in the Extended rate set. */ |
| 4948 | ExtendedOperationalRatesLength = |
| 4949 | DefaultSupportedRates11a.supportedRateSet.numRates * |
| 4950 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4951 | qdf_mem_copy(ExtendedOperationalRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4952 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 4953 | ExtendedOperationalRatesLength); |
| 4954 | |
| 4955 | /* populate proprietary rates if user allows them */ |
| 4956 | if (pMac->roam.configParam.ProprietaryRatesEnabled) { |
| 4957 | ProprietaryOperationalRatesLength = |
| 4958 | DefaultSupportedPropRates.numPropRates * |
| 4959 | sizeof(*DefaultSupportedPropRates.propRate); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4960 | qdf_mem_copy(ProprietaryOperationalRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4961 | DefaultSupportedPropRates.propRate, |
| 4962 | ProprietaryOperationalRatesLength); |
| 4963 | } else { |
| 4964 | /* No proprietary modes */ |
| 4965 | ProprietaryOperationalRatesLength = 0; |
| 4966 | } |
| 4967 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4968 | /* set this to 1 if prop. rates need to be advertised in to the |
| 4969 | * IBSS beacon and user wants to use them |
| 4970 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4971 | if (ProprietaryOperationalRatesLength |
| 4972 | && pMac->roam.configParam.ProprietaryRatesEnabled) { |
| 4973 | PropRatesEnable = 1; |
| 4974 | } else { |
| 4975 | PropRatesEnable = 0; |
| 4976 | } |
| 4977 | |
| 4978 | /* Set the operational rate set CFG variables... */ |
| 4979 | cfg_set_str(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 4980 | OperationalRatesLength); |
| 4981 | cfg_set_str(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 4982 | ExtendedOperationalRates, |
| 4983 | ExtendedOperationalRatesLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4984 | cfg_set_str(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 4985 | ProprietaryOperationalRates, |
| 4986 | ProprietaryOperationalRatesLength); |
| 4987 | } |
| 4988 | |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 4989 | void csr_roam_ccm_cfg_set_callback(tpAniSirGlobal pMac, int32_t result, |
| 4990 | uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4991 | { |
| 4992 | tListElem *pEntry = |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 4993 | csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4994 | uint32_t sessionId; |
| 4995 | tSmeCmd *pCommand = NULL; |
| 4996 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4997 | tCsrRoamSession *pSession = NULL; |
| 4998 | #endif |
| 4999 | if (NULL == pEntry) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5000 | sme_err("CFG_CNF with active list empty"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5001 | return; |
| 5002 | } |
| 5003 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 5004 | sessionId = pCommand->sessionId; |
| 5005 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5006 | pSession = &pMac->roam.roamSession[sessionId]; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 5007 | if (pSession->roam_synch_in_progress) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 5008 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5009 | "LFR3:csr_roam_cfg_set_callback"); |
| 5010 | } |
| 5011 | #endif |
| 5012 | |
| 5013 | if (CSR_IS_ROAM_JOINING(pMac, sessionId) |
| 5014 | && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) { |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 5015 | csr_roaming_state_config_cnf_processor(pMac, pCommand, |
| 5016 | (uint32_t) result, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5017 | } |
| 5018 | } |
| 5019 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5020 | /* pIes may be NULL */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5021 | QDF_STATUS csr_roam_set_bss_config_cfg(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5022 | tCsrRoamProfile *pProfile, |
| 5023 | tSirBssDescription *pBssDesc, |
| 5024 | tBssConfigParam *pBssConfig, |
| 5025 | tDot11fBeaconIEs *pIes, bool resetCountry) |
| 5026 | { |
| 5027 | tSirRetStatus status; |
| 5028 | uint32_t cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 5029 | uint8_t channel = 0; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 5030 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5031 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5032 | /* Make sure we have the domain info for the BSS we try to connect to. |
| 5033 | * Do we need to worry about sequence for OSs that are not Windows?? |
| 5034 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5035 | if (pBssDesc) { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5036 | if ((QDF_SAP_MODE != |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 5037 | csr_get_session_persona(pMac, sessionId)) && |
| 5038 | csr_learn_11dcountry_information( |
| 5039 | pMac, pBssDesc, pIes, true)) { |
| 5040 | csr_apply_country_information(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5041 | } |
Kiran Kumar Lokere | 3beeb95 | 2017-05-02 18:40:24 -0700 | [diff] [blame] | 5042 | if ((wlan_reg_11d_enabled_on_host(pMac->psoc)) && pIes) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5043 | if (!pIes->Country.present) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5044 | csr_apply_channel_power_info_wrapper(pMac); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5045 | else |
| 5046 | /* Let's also update the below to make sure |
| 5047 | * we don't update CC while connected to an |
| 5048 | * AP which is advertising some CC |
| 5049 | */ |
| 5050 | qdf_mem_copy(pMac->scan.currentCountryBssid. |
| 5051 | bytes, pBssDesc->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5052 | sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5053 | } |
| 5054 | } |
| 5055 | /* Qos */ |
| 5056 | csr_set_qos_to_cfg(pMac, sessionId, pBssConfig->qosType); |
| 5057 | /* SSID */ |
| 5058 | csr_set_cfg_ssid(pMac, &pBssConfig->SSID); |
| 5059 | |
| 5060 | /* Auth type */ |
| 5061 | cfg_set_int(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType); |
| 5062 | /* encryption type */ |
| 5063 | csr_set_cfg_privacy(pMac, pProfile, (bool) pBssConfig->BssCap.privacy); |
| 5064 | /* short slot time */ |
| 5065 | cfg_set_int(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, |
| 5066 | pBssConfig->uShortSlotTime); |
| 5067 | /* 11d */ |
| 5068 | cfg_set_int(pMac, WNI_CFG_11D_ENABLED, |
| 5069 | ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : |
| 5070 | pProfile->ieee80211d)); |
| 5071 | cfg_set_int(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, |
| 5072 | pBssConfig->uPowerLimit); |
| 5073 | /* CB */ |
| 5074 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5075 | if (CSR_IS_INFRA_AP(pProfile) || CSR_IS_IBSS(pProfile)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5076 | channel = pProfile->operationChannel; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5077 | else if (pBssDesc) |
| 5078 | channel = pBssDesc->channelId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5079 | if (0 != channel) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 5080 | /* for now if we are on 2.4 Ghz, CB will be always disabled */ |
| 5081 | if (WLAN_REG_IS_24GHZ_CH(channel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5082 | cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 5083 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5084 | cfgCb = pBssConfig->cbMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5085 | } |
| 5086 | /* Rate */ |
| 5087 | /* Fixed Rate */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5088 | if (pBssDesc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5089 | csr_set_cfg_rate_set(pMac, (eCsrPhyMode) pProfile->phyMode, |
| 5090 | pProfile, pBssDesc, pIes); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5091 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5092 | csr_set_cfg_rate_set_from_profile(pMac, pProfile); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 5093 | status = cfg_set_int(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, |
| 5094 | pBssConfig->uJoinTimeOut); |
| 5095 | /* Any roaming related changes should be above this line */ |
Arif Hussain | 557920f | 2016-09-07 16:03:46 -0700 | [diff] [blame] | 5096 | if (pSession && pSession->roam_synch_in_progress) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5097 | sme_debug("Roam synch is in progress Session_id: %d", |
| 5098 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5099 | return QDF_STATUS_SUCCESS; |
Arif Hussain | 557920f | 2016-09-07 16:03:46 -0700 | [diff] [blame] | 5100 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5101 | /* Make this the last CFG to set. The callback will trigger a |
| 5102 | * join_req Join time out |
| 5103 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5104 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId); |
| 5105 | |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 5106 | csr_roam_ccm_cfg_set_callback(pMac, status, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5107 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5108 | } |
| 5109 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 5110 | static |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5111 | QDF_STATUS csr_roam_stop_network(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5112 | tCsrRoamProfile *pProfile, |
| 5113 | tSirBssDescription *pBssDesc, |
| 5114 | tDot11fBeaconIEs *pIes) |
| 5115 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5116 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5117 | tBssConfigParam *pBssConfig; |
| 5118 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5119 | |
| 5120 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5121 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5122 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5123 | } |
| 5124 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5125 | pBssConfig = qdf_mem_malloc(sizeof(tBssConfigParam)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5126 | if (NULL == pBssConfig) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5127 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5128 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5129 | sme_debug("session id: %d", sessionId); |
Padma, Santhosh Kumar | cd35f53 | 2016-12-27 12:07:39 +0530 | [diff] [blame] | 5130 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5131 | status = csr_roam_prepare_bss_config(pMac, pProfile, pBssDesc, |
| 5132 | pBssConfig, pIes); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5133 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5134 | eCsrRoamSubState substate; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5135 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5136 | substate = eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING; |
| 5137 | pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 5138 | /* This will allow to pass cbMode during join req */ |
| 5139 | pSession->bssParams.cbMode = pBssConfig->cbMode; |
| 5140 | /* For IBSS, we need to prepare some more information */ |
| 5141 | if (csr_is_bss_type_ibss(pProfile->BSSType) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5142 | CSR_IS_INFRA_AP(pProfile)) |
| 5143 | csr_roam_prepare_bss_params(pMac, sessionId, pProfile, |
| 5144 | pBssDesc, pBssConfig, pIes); |
| 5145 | |
| 5146 | /* |
| 5147 | * If we are in an IBSS, then stop the IBSS... |
| 5148 | * Not worry about WDS connection for now |
| 5149 | */ |
| 5150 | if (csr_is_conn_state_ibss(pMac, sessionId)) { |
| 5151 | status = csr_roam_issue_stop_bss(pMac, sessionId, |
| 5152 | substate); |
| 5153 | } else if (csr_is_conn_state_infra(pMac, sessionId)) { |
| 5154 | /* |
| 5155 | * the new Bss is an Ibss OR we are roaming from |
| 5156 | * Infra to Infra across SSIDs |
| 5157 | * (roaming to a new SSID)... |
| 5158 | * Not worry about WDS connection for now |
| 5159 | */ |
| 5160 | if (pBssDesc && (csr_is_ibss_bss_desc(pBssDesc) || |
| 5161 | !csr_is_ssid_equal(pMac, |
| 5162 | pSession->pConnectBssDesc, |
| 5163 | pBssDesc, pIes))) |
| 5164 | status = csr_roam_issue_disassociate(pMac, |
| 5165 | sessionId, substate, false); |
| 5166 | else if (pBssDesc) |
| 5167 | /* |
| 5168 | * In an infra & going to an infra network with |
| 5169 | * the same SSID. This calls for a reassoc seq. |
| 5170 | * So issue the CFG sets for this new AP. Set |
| 5171 | * parameters for this Bss. |
| 5172 | */ |
| 5173 | status = csr_roam_set_bss_config_cfg(pMac, |
| 5174 | sessionId, pProfile, pBssDesc, |
| 5175 | pBssConfig, pIes, false); |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 5176 | } else if (pBssDesc || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5177 | CSR_IS_INFRA_AP(pProfile)) { |
| 5178 | /* |
| 5179 | * Neither in IBSS nor in Infra. We can go ahead and set |
| 5180 | * the cfg for tne new network... nothing to stop. |
| 5181 | */ |
| 5182 | bool is11rRoamingFlag = false; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5183 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5184 | is11rRoamingFlag = csr_roam_is11r_assoc(pMac, |
| 5185 | sessionId); |
| 5186 | /* Set parameters for this Bss. */ |
| 5187 | status = csr_roam_set_bss_config_cfg(pMac, sessionId, |
| 5188 | pProfile, pBssDesc, pBssConfig, pIes, |
| 5189 | is11rRoamingFlag); |
| 5190 | } |
| 5191 | } /* Success getting BSS config info */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5192 | qdf_mem_free(pBssConfig); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5193 | return status; |
| 5194 | } |
| 5195 | |
| 5196 | /** |
| 5197 | * csr_roam_state_for_same_profile() - Determine roam state for same profile |
| 5198 | * @mac_ctx: pointer to mac context |
| 5199 | * @profile: Roam profile |
| 5200 | * @session: Roam session |
| 5201 | * @session_id: session id |
| 5202 | * @ies_local: local ies |
| 5203 | * @bss_descr: bss description |
| 5204 | * |
| 5205 | * This function will determine the roam state for same profile |
| 5206 | * |
| 5207 | * Return: Roaming state. |
| 5208 | */ |
| 5209 | static eCsrJoinState csr_roam_state_for_same_profile(tpAniSirGlobal mac_ctx, |
| 5210 | tCsrRoamProfile *profile, tCsrRoamSession *session, |
| 5211 | uint32_t session_id, tDot11fBeaconIEs *ies_local, |
| 5212 | tSirBssDescription *bss_descr) |
| 5213 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5214 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5215 | tBssConfigParam bssConfig; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5216 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5217 | if (csr_roam_is_same_profile_keys(mac_ctx, &session->connectedProfile, |
| 5218 | profile)) |
| 5219 | return eCsrReassocToSelfNoCapChange; |
| 5220 | /* The key changes */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5221 | qdf_mem_set(&bssConfig, sizeof(bssConfig), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5222 | status = csr_roam_prepare_bss_config(mac_ctx, profile, bss_descr, |
| 5223 | &bssConfig, ies_local); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5224 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5225 | session->bssParams.uCfgDot11Mode = |
| 5226 | bssConfig.uCfgDot11Mode; |
| 5227 | session->bssParams.cbMode = |
| 5228 | bssConfig.cbMode; |
| 5229 | /* reapply the cfg including keys so reassoc happens. */ |
| 5230 | status = csr_roam_set_bss_config_cfg(mac_ctx, session_id, |
| 5231 | profile, bss_descr, &bssConfig, |
| 5232 | ies_local, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5233 | if (QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5234 | return eCsrContinueRoaming; |
| 5235 | } |
| 5236 | |
| 5237 | return eCsrStopRoaming; |
| 5238 | |
| 5239 | } |
| 5240 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 5241 | static eCsrJoinState csr_roam_join(tpAniSirGlobal pMac, uint32_t sessionId, |
| 5242 | tCsrScanResultInfo *pScanResult, |
| 5243 | tCsrRoamProfile *pProfile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5244 | { |
| 5245 | eCsrJoinState eRoamState = eCsrContinueRoaming; |
| 5246 | tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor; |
| 5247 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *) (pScanResult->pvIes); |
| 5248 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5249 | |
| 5250 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5251 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5252 | return eCsrStopRoaming; |
| 5253 | } |
| 5254 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5255 | if (!pIesLocal && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5256 | !QDF_IS_STATUS_SUCCESS(csr_get_parsed_bss_description_ies(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5257 | pBssDesc, &pIesLocal))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5258 | sme_err("fail to parse IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5259 | return eCsrStopRoaming; |
| 5260 | } |
| 5261 | if (csr_is_infra_bss_desc(pBssDesc)) { |
| 5262 | /* |
| 5263 | * If we are connected in infra mode and the join bss descr is |
| 5264 | * for the same BssID, then we are attempting to join the AP we |
| 5265 | * are already connected with. In that case, see if the Bss or |
| 5266 | * sta capabilities have changed and handle the changes |
| 5267 | * without disturbing the current association |
| 5268 | */ |
| 5269 | |
| 5270 | if (csr_is_conn_state_connected_infra(pMac, sessionId) && |
| 5271 | csr_is_bss_id_equal(pMac, |
| 5272 | pBssDesc, pSession->pConnectBssDesc) && |
| 5273 | csr_is_ssid_equal(pMac, pSession->pConnectBssDesc, |
| 5274 | pBssDesc, pIesLocal)) { |
| 5275 | /* |
| 5276 | * Check to see if the Auth type has changed in the |
| 5277 | * profile. If so, we don't want to reassociate with |
| 5278 | * authenticating first. To force this, stop the |
| 5279 | * current association (Disassociate) and then re 'Join' |
| 5280 | * the AP, wihch will force an Authentication (with the |
| 5281 | * new Auth type) followed by a new Association. |
| 5282 | */ |
| 5283 | if (csr_is_same_profile(pMac, |
| 5284 | &pSession->connectedProfile, pProfile)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5285 | sme_warn("detect same profile"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5286 | eRoamState = |
| 5287 | csr_roam_state_for_same_profile(pMac, |
| 5288 | pProfile, pSession, sessionId, |
| 5289 | pIesLocal, pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5290 | } else if (!QDF_IS_STATUS_SUCCESS( |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5291 | csr_roam_issue_disassociate( |
| 5292 | pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5293 | sessionId, |
| 5294 | eCSR_ROAM_SUBSTATE_DISASSOC_REQ, |
| 5295 | false))) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5296 | sme_err("fail disassoc session %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5297 | sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5298 | eRoamState = eCsrStopRoaming; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5299 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5300 | } else if (!QDF_IS_STATUS_SUCCESS(csr_roam_stop_network(pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5301 | sessionId, pProfile, pBssDesc, pIesLocal))) |
| 5302 | /* we used to pre-auth here with open auth |
| 5303 | * networks but that wasn't working so well. |
| 5304 | * stop the existing network before attempting |
| 5305 | * to join the new network. |
| 5306 | */ |
| 5307 | eRoamState = eCsrStopRoaming; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5308 | } else if (!QDF_IS_STATUS_SUCCESS(csr_roam_stop_network(pMac, sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5309 | pProfile, pBssDesc, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5310 | pIesLocal))) |
| 5311 | eRoamState = eCsrStopRoaming; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5312 | |
| 5313 | if (pIesLocal && !pScanResult->pvIes) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5314 | qdf_mem_free(pIesLocal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5315 | return eRoamState; |
| 5316 | } |
| 5317 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 5318 | static |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5319 | QDF_STATUS csr_roam_should_roam(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5320 | tSirBssDescription *pBssDesc, uint32_t roamId) |
| 5321 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5322 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5323 | tCsrRoamInfo roamInfo; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5324 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5325 | qdf_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5326 | roamInfo.pBssDesc = pBssDesc; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5327 | status = csr_roam_call_callback(pMac, sessionId, &roamInfo, roamId, |
| 5328 | eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5329 | return status; |
| 5330 | } |
| 5331 | |
| 5332 | /* In case no matching BSS is found, use whatever default we can find */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5333 | static void csr_roam_assign_default_param(tpAniSirGlobal pMac, |
| 5334 | tSmeCmd *pCommand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5335 | { |
| 5336 | /* Need to get all negotiated types in place first */ |
| 5337 | /* auth type */ |
| 5338 | /* Take the preferred Auth type. */ |
| 5339 | switch (pCommand->u.roamCmd.roamProfile.AuthType.authType[0]) { |
| 5340 | default: |
| 5341 | case eCSR_AUTH_TYPE_WPA: |
| 5342 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 5343 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 5344 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5345 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = |
| 5346 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5347 | break; |
| 5348 | |
| 5349 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5350 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = |
| 5351 | eCSR_AUTH_TYPE_SHARED_KEY; |
| 5352 | break; |
| 5353 | |
| 5354 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 5355 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = |
| 5356 | eCSR_AUTH_TYPE_AUTOSWITCH; |
| 5357 | break; |
| 5358 | } |
| 5359 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5360 | pCommand->u.roamCmd.roamProfile.EncryptionType. |
| 5361 | encryptionType[0]; |
| 5362 | /* In this case, the multicast encryption needs to follow the |
| 5363 | * uncast ones. |
| 5364 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5365 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5366 | pCommand->u.roamCmd.roamProfile.EncryptionType. |
| 5367 | encryptionType[0]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5368 | } |
| 5369 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5370 | static void csr_set_abort_roaming_command(tpAniSirGlobal pMac, |
| 5371 | tSmeCmd *pCommand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5372 | { |
| 5373 | switch (pCommand->u.roamCmd.roamReason) { |
| 5374 | case eCsrLostLink1: |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 5375 | pCommand->u.roamCmd.roamReason = eCsrLostLink1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5376 | break; |
| 5377 | case eCsrLostLink2: |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 5378 | pCommand->u.roamCmd.roamReason = eCsrLostLink2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5379 | break; |
| 5380 | case eCsrLostLink3: |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 5381 | pCommand->u.roamCmd.roamReason = eCsrLostLink3; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5382 | break; |
| 5383 | default: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5384 | sme_err("aborting roaming reason %d not recognized", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5385 | pCommand->u.roamCmd.roamReason); |
| 5386 | break; |
| 5387 | } |
| 5388 | } |
| 5389 | |
| 5390 | /** |
| 5391 | * csr_roam_select_bss() - Handle join scenario based on profile |
| 5392 | * @mac_ctx: Global MAC Context |
| 5393 | * @roam_bss_entry: The next BSS to join |
| 5394 | * @csr_result_info: Result of join |
| 5395 | * @csr_scan_result: Global scan result |
| 5396 | * @session_id: SME Session ID |
| 5397 | * @roam_id: Roaming ID |
| 5398 | * @roam_state: Current roaming state |
| 5399 | * @bss_list: BSS List |
| 5400 | * |
| 5401 | * Return: true if the entire BSS list is done, false otherwise. |
| 5402 | */ |
| 5403 | static bool csr_roam_select_bss(tpAniSirGlobal mac_ctx, |
| 5404 | tListElem *roam_bss_entry, tCsrScanResultInfo **csr_result_info, |
| 5405 | tCsrScanResult **csr_scan_result, uint32_t session_id, |
| 5406 | uint32_t roam_id, eCsrJoinState *roam_state, |
| 5407 | tScanResultList *bss_list) |
| 5408 | { |
| 5409 | uint8_t conc_channel = 0; |
| 5410 | bool status = false; |
| 5411 | tCsrScanResult *scan_result = NULL; |
| 5412 | tCsrScanResultInfo *result = NULL; |
| 5413 | |
| 5414 | while (roam_bss_entry) { |
| 5415 | scan_result = GET_BASE_ADDR(roam_bss_entry, tCsrScanResult, |
| 5416 | Link); |
| 5417 | /* |
| 5418 | * If concurrency enabled take the |
| 5419 | * concurrent connected channel first. |
| 5420 | * Valid multichannel concurrent |
| 5421 | * sessions exempted |
| 5422 | */ |
| 5423 | result = &scan_result->Result; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 5424 | if (policy_mgr_concurrent_open_sessions_running(mac_ctx->psoc) |
| 5425 | && !csr_is_valid_mc_concurrent_session(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5426 | session_id, &result->BssDescriptor)) { |
| 5427 | conc_channel = csr_get_concurrent_operation_channel( |
| 5428 | mac_ctx); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5429 | sme_debug("csr Conc Channel: %d", conc_channel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5430 | if ((conc_channel) && (conc_channel == |
| 5431 | result->BssDescriptor.channelId)) { |
| 5432 | /* |
| 5433 | * make this 0 because we do not want the below |
| 5434 | * check to pass as we don't want to connect on |
| 5435 | * other channel |
| 5436 | */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5437 | sme_debug("Conc chnl match: %d", conc_channel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5438 | conc_channel = 0; |
| 5439 | } |
| 5440 | } |
| 5441 | |
| 5442 | /* Ok to roam this */ |
| 5443 | if (!conc_channel && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5444 | QDF_IS_STATUS_SUCCESS(csr_roam_should_roam(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5445 | session_id, &result->BssDescriptor, roam_id))) { |
| 5446 | status = false; |
| 5447 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5448 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5449 | *roam_state = eCsrStopRoamingDueToConcurrency; |
| 5450 | status = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5451 | roam_bss_entry = csr_ll_next(&bss_list->List, roam_bss_entry, |
| 5452 | LL_ACCESS_LOCK); |
| 5453 | } |
| 5454 | *csr_result_info = result; |
| 5455 | *csr_scan_result = scan_result; |
| 5456 | return status; |
| 5457 | } |
| 5458 | |
| 5459 | /** |
| 5460 | * csr_roam_join_handle_profile() - Handle join scenario based on profile |
| 5461 | * @mac_ctx: Global MAC Context |
| 5462 | * @session_id: SME Session ID |
| 5463 | * @cmd: Command |
| 5464 | * @roam_info_ptr: Pointed to the roaming info for join |
| 5465 | * @roam_state: Current roaming state |
| 5466 | * @result: Result of join |
| 5467 | * @scan_result: Global scan result |
| 5468 | * |
| 5469 | * Return: None |
| 5470 | */ |
| 5471 | static void csr_roam_join_handle_profile(tpAniSirGlobal mac_ctx, |
| 5472 | uint32_t session_id, tSmeCmd *cmd, tCsrRoamInfo *roam_info_ptr, |
| 5473 | eCsrJoinState *roam_state, tCsrScanResultInfo *result, |
| 5474 | tCsrScanResult *scan_result) |
| 5475 | { |
| 5476 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5477 | uint8_t acm_mask = 0; |
| 5478 | #endif |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5479 | QDF_STATUS status; |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 5480 | tCsrRoamSession *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5481 | tCsrRoamProfile *profile = &cmd->u.roamCmd.roamProfile; |
| 5482 | tDot11fBeaconIEs *ies_local = NULL; |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 5483 | |
| 5484 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5485 | sme_err("Invalid session id %d", session_id); |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 5486 | return; |
| 5487 | } |
| 5488 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 5489 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5490 | /* |
| 5491 | * We have something to roam, tell HDD when it is infra. |
| 5492 | * For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5493 | */ |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 5494 | if (CSR_IS_INFRASTRUCTURE(profile) && roam_info_ptr) { |
| 5495 | if (session->bRefAssocStartCnt) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5496 | session->bRefAssocStartCnt--; |
| 5497 | roam_info_ptr->pProfile = profile; |
| 5498 | /* |
| 5499 | * Complete the last assoc attempt as a |
| 5500 | * new one is about to be tried |
| 5501 | */ |
| 5502 | csr_roam_call_callback(mac_ctx, session_id, |
| 5503 | roam_info_ptr, cmd->u.roamCmd.roamId, |
| 5504 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5505 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 5506 | } |
| 5507 | /* If roaming has stopped, don't continue the roaming command */ |
| 5508 | if (!CSR_IS_ROAMING(session) && CSR_IS_ROAMING_COMMAND(cmd)) { |
| 5509 | /* No need to complete roaming as it already complete */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5510 | sme_debug("Roam cmd(reason %d)aborted as roam complete", |
| 5511 | cmd->u.roamCmd.roamReason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5512 | *roam_state = eCsrStopRoaming; |
| 5513 | csr_set_abort_roaming_command(mac_ctx, cmd); |
| 5514 | return; |
| 5515 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5516 | qdf_mem_set(roam_info_ptr, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5517 | if (!scan_result) |
| 5518 | cmd->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 5519 | else |
| 5520 | ies_local = scan_result->Result.pvIes; |
| 5521 | |
Naveen Rawat | 48f51d0 | 2016-07-22 10:15:08 -0700 | [diff] [blame] | 5522 | if (!result) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5523 | sme_err(" cannot parse IEs"); |
Naveen Rawat | 48f51d0 | 2016-07-22 10:15:08 -0700 | [diff] [blame] | 5524 | *roam_state = eCsrStopRoaming; |
| 5525 | return; |
| 5526 | } else if (scan_result && !ies_local && |
| 5527 | (!QDF_IS_STATUS_SUCCESS( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5528 | csr_get_parsed_bss_description_ies( |
Naveen Rawat | 48f51d0 | 2016-07-22 10:15:08 -0700 | [diff] [blame] | 5529 | mac_ctx, &result->BssDescriptor, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5530 | &ies_local)))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5531 | sme_err(" cannot parse IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5532 | *roam_state = eCsrStopRoaming; |
| 5533 | return; |
| 5534 | } |
Naveen Rawat | 48f51d0 | 2016-07-22 10:15:08 -0700 | [diff] [blame] | 5535 | roam_info_ptr->pBssDesc = &result->BssDescriptor; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5536 | cmd->u.roamCmd.pLastRoamBss = roam_info_ptr->pBssDesc; |
| 5537 | /* dont put uapsd_mask if BSS doesn't support uAPSD */ |
| 5538 | if (scan_result && cmd->u.roamCmd.roamProfile.uapsd_mask |
| 5539 | && CSR_IS_QOS_BSS(ies_local) |
| 5540 | && CSR_IS_UAPSD_BSS(ies_local)) { |
| 5541 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Naveen Rawat | 48f51d0 | 2016-07-22 10:15:08 -0700 | [diff] [blame] | 5542 | acm_mask = sme_qos_get_acm_mask(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5543 | &result->BssDescriptor, ies_local); |
| 5544 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT */ |
| 5545 | } else { |
| 5546 | cmd->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 5547 | } |
Naveen Rawat | 48f51d0 | 2016-07-22 10:15:08 -0700 | [diff] [blame] | 5548 | if (ies_local && !result->pvIes) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5549 | qdf_mem_free(ies_local); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5550 | roam_info_ptr->pProfile = profile; |
| 5551 | session->bRefAssocStartCnt++; |
| 5552 | csr_roam_call_callback(mac_ctx, session_id, roam_info_ptr, |
| 5553 | cmd->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_START, |
| 5554 | eCSR_ROAM_RESULT_NONE); |
| 5555 | } |
| 5556 | if (NULL != cmd->u.roamCmd.pRoamBssEntry) { |
| 5557 | /* |
| 5558 | * We have BSS |
| 5559 | * Need to assign these value because |
| 5560 | * they are used in csr_is_same_profile |
| 5561 | */ |
| 5562 | scan_result = GET_BASE_ADDR(cmd->u.roamCmd.pRoamBssEntry, |
| 5563 | tCsrScanResult, Link); |
| 5564 | /* |
| 5565 | * The OSEN IE doesn't provide the cipher suite.Therefore set |
| 5566 | * to constant value of AES |
| 5567 | */ |
| 5568 | if (cmd->u.roamCmd.roamProfile.bOSENAssociation) { |
| 5569 | cmd->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 5570 | eCSR_ENCRYPT_TYPE_AES; |
| 5571 | cmd->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 5572 | eCSR_ENCRYPT_TYPE_AES; |
| 5573 | } else { |
| 5574 | /* Negotiated while building scan result. */ |
| 5575 | cmd->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 5576 | scan_result->ucEncryptionType; |
| 5577 | cmd->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 5578 | scan_result->mcEncryptionType; |
| 5579 | } |
| 5580 | cmd->u.roamCmd.roamProfile.negotiatedAuthType = |
| 5581 | scan_result->authType; |
| 5582 | if (CSR_IS_START_IBSS(&cmd->u.roamCmd.roamProfile)) { |
| 5583 | if (csr_is_same_profile(mac_ctx, |
| 5584 | &session->connectedProfile, profile)) { |
| 5585 | *roam_state = eCsrStartIbssSameIbss; |
| 5586 | return; |
| 5587 | } |
| 5588 | } |
| 5589 | if (cmd->u.roamCmd.fReassocToSelfNoCapChange) { |
| 5590 | /* trying to connect to the one already connected */ |
| 5591 | cmd->u.roamCmd.fReassocToSelfNoCapChange = false; |
| 5592 | *roam_state = eCsrReassocToSelfNoCapChange; |
| 5593 | return; |
| 5594 | } |
| 5595 | /* Attempt to Join this Bss... */ |
| 5596 | *roam_state = csr_roam_join(mac_ctx, session_id, |
| 5597 | &scan_result->Result, profile); |
| 5598 | return; |
| 5599 | } |
| 5600 | |
| 5601 | /* For an IBSS profile, then we need to start the IBSS. */ |
| 5602 | if (CSR_IS_START_IBSS(profile)) { |
| 5603 | bool same_ibss = false; |
| 5604 | /* Attempt to start this IBSS... */ |
| 5605 | csr_roam_assign_default_param(mac_ctx, cmd); |
| 5606 | status = csr_roam_start_ibss(mac_ctx, session_id, |
| 5607 | profile, &same_ibss); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5608 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5609 | if (same_ibss) |
| 5610 | *roam_state = eCsrStartIbssSameIbss; |
| 5611 | else |
| 5612 | *roam_state = eCsrContinueRoaming; |
| 5613 | } else { |
| 5614 | /* it somehow fail need to stop */ |
| 5615 | *roam_state = eCsrStopRoaming; |
| 5616 | } |
| 5617 | return; |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 5618 | } else if (CSR_IS_INFRA_AP(profile)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5619 | /* Attempt to start this WDS... */ |
| 5620 | csr_roam_assign_default_param(mac_ctx, cmd); |
| 5621 | /* For AP WDS, we dont have any BSSDescription */ |
| 5622 | status = csr_roam_start_wds(mac_ctx, session_id, profile, NULL); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5623 | if (QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5624 | *roam_state = eCsrContinueRoaming; |
| 5625 | else |
| 5626 | *roam_state = eCsrStopRoaming; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 5627 | } else if (CSR_IS_NDI(profile)) { |
| 5628 | csr_roam_assign_default_param(mac_ctx, cmd); |
| 5629 | status = csr_roam_start_ndi(mac_ctx, session_id, profile); |
| 5630 | if (QDF_IS_STATUS_SUCCESS(status)) |
| 5631 | *roam_state = eCsrContinueRoaming; |
| 5632 | else |
| 5633 | *roam_state = eCsrStopRoaming; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5634 | } else { |
| 5635 | /* Nothing we can do */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5636 | sme_warn("cannot continue without BSS list"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5637 | *roam_state = eCsrStopRoaming; |
| 5638 | return; |
| 5639 | } |
| 5640 | |
| 5641 | } |
| 5642 | /** |
| 5643 | * csr_roam_join_next_bss() - Pick the next BSS for join |
| 5644 | * @mac_ctx: Global MAC Context |
| 5645 | * @cmd: Command |
| 5646 | * @use_same_bss: Use Same BSS to Join |
| 5647 | * |
| 5648 | * Return: The Join State |
| 5649 | */ |
| 5650 | static eCsrJoinState csr_roam_join_next_bss(tpAniSirGlobal mac_ctx, |
| 5651 | tSmeCmd *cmd, bool use_same_bss) |
| 5652 | { |
| 5653 | tCsrScanResult *scan_result = NULL; |
| 5654 | eCsrJoinState roam_state = eCsrStopRoaming; |
| 5655 | tScanResultList *bss_list = |
| 5656 | (tScanResultList *) cmd->u.roamCmd.hBSSList; |
| 5657 | bool done = false; |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 5658 | tCsrRoamInfo *roam_info = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5659 | uint32_t session_id = cmd->sessionId; |
| 5660 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); |
| 5661 | tCsrRoamProfile *profile = &cmd->u.roamCmd.roamProfile; |
| 5662 | tCsrRoamJoinStatus *join_status; |
| 5663 | tCsrScanResultInfo *result = NULL; |
| 5664 | |
| 5665 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5666 | sme_err("session %d not found", session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5667 | return eCsrStopRoaming; |
| 5668 | } |
| 5669 | |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 5670 | roam_info = qdf_mem_malloc(sizeof (*roam_info)); |
| 5671 | if (!roam_info) { |
| 5672 | sme_err("failed to allocate memory"); |
| 5673 | return eCsrStopRoaming; |
| 5674 | } |
| 5675 | qdf_mem_copy(&roam_info->bssid, &session->joinFailStatusCode.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5676 | sizeof(tSirMacAddr)); |
| 5677 | /* |
| 5678 | * When handling AP's capability change, continue to associate |
| 5679 | * to same BSS and make sure pRoamBssEntry is not Null. |
| 5680 | */ |
| 5681 | if ((NULL != bss_list) && |
| 5682 | ((false == use_same_bss) || |
| 5683 | (cmd->u.roamCmd.pRoamBssEntry == NULL))) { |
| 5684 | if (cmd->u.roamCmd.pRoamBssEntry == NULL) { |
| 5685 | /* Try the first BSS */ |
| 5686 | cmd->u.roamCmd.pLastRoamBss = NULL; |
| 5687 | cmd->u.roamCmd.pRoamBssEntry = |
| 5688 | csr_ll_peek_head(&bss_list->List, |
| 5689 | LL_ACCESS_LOCK); |
| 5690 | } else { |
| 5691 | cmd->u.roamCmd.pRoamBssEntry = |
| 5692 | csr_ll_next(&bss_list->List, |
| 5693 | cmd->u.roamCmd.pRoamBssEntry, |
| 5694 | LL_ACCESS_LOCK); |
| 5695 | /* |
| 5696 | * Done with all the BSSs. |
| 5697 | * In this case, will tell HDD the |
| 5698 | * completion |
| 5699 | */ |
| 5700 | if (NULL == cmd->u.roamCmd.pRoamBssEntry) |
| 5701 | goto end; |
| 5702 | /* |
| 5703 | * We need to indicate to HDD that we |
| 5704 | * are done with this one. |
| 5705 | */ |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 5706 | roam_info->pBssDesc = cmd->u.roamCmd.pLastRoamBss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5707 | join_status = &session->joinFailStatusCode; |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 5708 | roam_info->statusCode = join_status->statusCode; |
| 5709 | roam_info->reasonCode = join_status->reasonCode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5710 | } |
| 5711 | done = csr_roam_select_bss(mac_ctx, |
| 5712 | cmd->u.roamCmd.pRoamBssEntry, &result, |
| 5713 | &scan_result, session_id, cmd->u.roamCmd.roamId, |
| 5714 | &roam_state, bss_list); |
| 5715 | if (done) |
| 5716 | goto end; |
| 5717 | } |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 5718 | roam_info->u.pConnectedProfile = &session->connectedProfile; |
Naveen Rawat | a395d25 | 2016-06-15 11:07:24 -0700 | [diff] [blame] | 5719 | |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 5720 | csr_roam_join_handle_profile(mac_ctx, session_id, cmd, roam_info, |
Naveen Rawat | 696a930 | 2016-06-15 11:07:24 -0700 | [diff] [blame] | 5721 | &roam_state, result, scan_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5722 | end: |
| 5723 | if ((eCsrStopRoaming == roam_state) && CSR_IS_INFRASTRUCTURE(profile) && |
| 5724 | (session->bRefAssocStartCnt > 0)) { |
| 5725 | /* |
| 5726 | * Need to indicate association_completion if association_start |
| 5727 | * has been done |
| 5728 | */ |
| 5729 | session->bRefAssocStartCnt--; |
| 5730 | /* |
| 5731 | * Complete the last assoc attempte as a |
| 5732 | * new one is about to be tried |
| 5733 | */ |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 5734 | roam_info->pProfile = profile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5735 | csr_roam_call_callback(mac_ctx, session_id, |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 5736 | roam_info, cmd->u.roamCmd.roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5737 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5738 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 5739 | } |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 5740 | qdf_mem_free(roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5741 | |
| 5742 | return roam_state; |
| 5743 | } |
| 5744 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5745 | static QDF_STATUS csr_roam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5746 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5747 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5748 | eCsrJoinState RoamState; |
| 5749 | eCsrRoamSubState substate; |
| 5750 | uint32_t sessionId = pCommand->sessionId; |
| 5751 | |
| 5752 | /* Attept to join a Bss... */ |
| 5753 | RoamState = csr_roam_join_next_bss(pMac, pCommand, false); |
| 5754 | |
| 5755 | /* if nothing to join.. */ |
| 5756 | if ((eCsrStopRoaming == RoamState) || |
| 5757 | (eCsrStopRoamingDueToConcurrency == RoamState)) { |
| 5758 | bool fComplete = false; |
| 5759 | /* and if connected in Infrastructure mode... */ |
| 5760 | if (csr_is_conn_state_infra(pMac, sessionId)) { |
| 5761 | /* ... then we need to issue a disassociation */ |
| 5762 | substate = eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN; |
| 5763 | status = csr_roam_issue_disassociate(pMac, sessionId, |
| 5764 | substate, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5765 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5766 | sme_warn("fail issuing disassoc status = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5767 | status); |
| 5768 | /* |
| 5769 | * roam command is completed by caller in the |
| 5770 | * failed case |
| 5771 | */ |
| 5772 | fComplete = true; |
| 5773 | } |
| 5774 | } else if (csr_is_conn_state_ibss(pMac, sessionId)) { |
| 5775 | status = csr_roam_issue_stop_bss(pMac, sessionId, |
| 5776 | eCSR_ROAM_SUBSTATE_STOP_BSS_REQ); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5777 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5778 | sme_warn("fail issuing stop bss status = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5779 | status); |
| 5780 | /* |
| 5781 | * roam command is completed by caller in the |
| 5782 | * failed case |
| 5783 | */ |
| 5784 | fComplete = true; |
| 5785 | } |
| 5786 | } else if (csr_is_conn_state_connected_infra_ap(pMac, |
| 5787 | sessionId)) { |
| 5788 | substate = eCSR_ROAM_SUBSTATE_STOP_BSS_REQ; |
| 5789 | status = csr_roam_issue_stop_bss(pMac, sessionId, |
| 5790 | substate); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5791 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5792 | sme_warn("fail issuing stop bss status = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5793 | status); |
| 5794 | /* |
| 5795 | * roam command is completed by caller in the |
| 5796 | * failed case |
| 5797 | */ |
| 5798 | fComplete = true; |
| 5799 | } |
| 5800 | } else { |
| 5801 | fComplete = true; |
| 5802 | } |
| 5803 | |
| 5804 | if (fComplete) { |
| 5805 | /* otherwise, we can complete the Roam command here. */ |
| 5806 | if (eCsrStopRoamingDueToConcurrency == RoamState) |
| 5807 | csr_roam_complete(pMac, |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 5808 | eCsrJoinFailureDueToConcurrency, NULL, |
| 5809 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5810 | else |
| 5811 | csr_roam_complete(pMac, |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 5812 | eCsrNothingToJoin, NULL, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5813 | } |
| 5814 | } else if (eCsrReassocToSelfNoCapChange == RoamState) { |
| 5815 | csr_roam_complete(pMac, eCsrSilentlyStopRoamingSaveState, |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 5816 | NULL, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5817 | } else if (eCsrStartIbssSameIbss == RoamState) { |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 5818 | csr_roam_complete(pMac, eCsrSilentlyStopRoaming, NULL, |
| 5819 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5820 | } |
| 5821 | |
| 5822 | return status; |
| 5823 | } |
| 5824 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 5825 | static |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5826 | QDF_STATUS csr_process_ft_reassoc_roam_command(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5827 | tSmeCmd *pCommand) |
| 5828 | { |
| 5829 | uint32_t sessionId; |
| 5830 | tCsrRoamSession *pSession; |
| 5831 | tCsrScanResult *pScanResult = NULL; |
| 5832 | tSirBssDescription *pBssDesc = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5833 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5834 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5835 | sessionId = pCommand->sessionId; |
| 5836 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5837 | |
| 5838 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5839 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5840 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5841 | } |
| 5842 | |
| 5843 | if (CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) { |
| 5844 | /* the roaming is cancelled. Simply complete the command */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5845 | sme_debug("Roam command canceled"); |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 5846 | csr_roam_complete(pMac, eCsrNothingToJoin, NULL, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5847 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5848 | } |
| 5849 | if (pCommand->u.roamCmd.pRoamBssEntry) { |
| 5850 | pScanResult = |
| 5851 | GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, |
| 5852 | tCsrScanResult, Link); |
| 5853 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 5854 | } else { |
| 5855 | /* the roaming is cancelled. Simply complete the command */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5856 | sme_debug("Roam command canceled"); |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 5857 | csr_roam_complete(pMac, eCsrNothingToJoin, NULL, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5858 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5859 | } |
| 5860 | status = csr_roam_issue_reassociate(pMac, sessionId, pBssDesc, |
| 5861 | (tDot11fBeaconIEs *) (pScanResult-> |
| 5862 | Result.pvIes), |
| 5863 | &pCommand->u.roamCmd.roamProfile); |
| 5864 | return status; |
| 5865 | } |
| 5866 | |
| 5867 | /** |
| 5868 | * csr_roam_trigger_reassociate() - Helper function to trigger reassociate |
| 5869 | * @mac_ctx: pointer to mac context |
| 5870 | * @cmd: sme command |
| 5871 | * @roam_info: Roaming infor structure |
| 5872 | * @session_ptr: session pointer |
| 5873 | * @session_id: session id |
| 5874 | * |
| 5875 | * This function will trigger reassociate. |
| 5876 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5877 | * Return: QDF_STATUS for success or failure. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5878 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5879 | static QDF_STATUS csr_roam_trigger_reassociate(tpAniSirGlobal mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5880 | tSmeCmd *cmd, tCsrRoamInfo *roam_info, |
| 5881 | tCsrRoamSession *session_ptr, uint32_t session_id) |
| 5882 | { |
| 5883 | tDot11fBeaconIEs *pIes = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5884 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5885 | |
| 5886 | if (session_ptr->pConnectBssDesc) { |
| 5887 | status = csr_get_parsed_bss_description_ies(mac_ctx, |
| 5888 | session_ptr->pConnectBssDesc, &pIes); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5889 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5890 | sme_err("fail to parse IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5891 | } else { |
| 5892 | roam_info->reasonCode = |
| 5893 | eCsrRoamReasonStaCapabilityChanged; |
| 5894 | csr_roam_call_callback(mac_ctx, session_ptr->sessionId, |
| 5895 | roam_info, 0, eCSR_ROAM_ROAMING_START, |
| 5896 | eCSR_ROAM_RESULT_NONE); |
| 5897 | session_ptr->roamingReason = eCsrReassocRoaming; |
| 5898 | roam_info->pBssDesc = session_ptr->pConnectBssDesc; |
| 5899 | roam_info->pProfile = &cmd->u.roamCmd.roamProfile; |
| 5900 | session_ptr->bRefAssocStartCnt++; |
| 5901 | csr_roam_call_callback(mac_ctx, session_id, roam_info, |
| 5902 | cmd->u.roamCmd.roamId, |
| 5903 | eCSR_ROAM_ASSOCIATION_START, |
| 5904 | eCSR_ROAM_RESULT_NONE); |
| 5905 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5906 | sme_debug("calling csr_roam_issue_reassociate"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5907 | status = csr_roam_issue_reassociate(mac_ctx, session_id, |
| 5908 | session_ptr->pConnectBssDesc, pIes, |
| 5909 | &cmd->u.roamCmd.roamProfile); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5910 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5911 | sme_err("failed status %d", status); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 5912 | csr_release_command(mac_ctx, cmd); |
Zhu Jianmin | e5594d1 | 2017-07-11 12:22:46 +0800 | [diff] [blame] | 5913 | } else { |
| 5914 | csr_neighbor_roam_state_transition(mac_ctx, |
| 5915 | eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING, |
| 5916 | session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5917 | } |
| 5918 | |
Zhu Jianmin | e5594d1 | 2017-07-11 12:22:46 +0800 | [diff] [blame] | 5919 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5920 | qdf_mem_free(pIes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5921 | pIes = NULL; |
| 5922 | } |
| 5923 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5924 | sme_err("reassoc to same AP failed as connected BSS is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5925 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5926 | } |
| 5927 | return status; |
| 5928 | } |
| 5929 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5930 | QDF_STATUS csr_roam_process_command(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5931 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5932 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5933 | tCsrRoamInfo roamInfo; |
| 5934 | uint32_t sessionId = pCommand->sessionId; |
| 5935 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5936 | |
| 5937 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5938 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5939 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5940 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5941 | sme_debug("Roam Reason: %d sessionId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5942 | pCommand->u.roamCmd.roamReason, sessionId); |
| 5943 | |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 5944 | pSession->disconnect_reason = pCommand->u.roamCmd.disconnect_reason; |
| 5945 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5946 | switch (pCommand->u.roamCmd.roamReason) { |
| 5947 | case eCsrForcedDisassoc: |
| 5948 | if (eCSR_ROAMING_STATE_IDLE == pMac->roam.curState[sessionId]) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5949 | sme_err("Ignore eCsrForcedDisassoc cmd on roam state %d", |
| 5950 | eCSR_ROAMING_STATE_IDLE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5951 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5952 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5953 | status = csr_roam_process_disassoc_deauth(pMac, pCommand, |
| 5954 | true, false); |
| 5955 | csr_free_roam_profile(pMac, sessionId); |
| 5956 | break; |
| 5957 | case eCsrSmeIssuedDisassocForHandoff: |
| 5958 | /* Not to free pMac->roam.pCurRoamProfile (via |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 5959 | * csr_free_roam_profile) because its needed after disconnect |
| 5960 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5961 | status = csr_roam_process_disassoc_deauth(pMac, pCommand, |
| 5962 | true, false); |
| 5963 | |
| 5964 | break; |
| 5965 | case eCsrForcedDisassocMICFailure: |
| 5966 | status = csr_roam_process_disassoc_deauth(pMac, pCommand, |
| 5967 | true, true); |
| 5968 | csr_free_roam_profile(pMac, sessionId); |
| 5969 | break; |
| 5970 | case eCsrForcedDeauth: |
| 5971 | status = csr_roam_process_disassoc_deauth(pMac, pCommand, |
| 5972 | false, false); |
| 5973 | csr_free_roam_profile(pMac, sessionId); |
| 5974 | break; |
| 5975 | case eCsrHddIssuedReassocToSameAP: |
| 5976 | case eCsrSmeIssuedReassocToSameAP: |
| 5977 | status = csr_roam_trigger_reassociate(pMac, pCommand, &roamInfo, |
| 5978 | pSession, sessionId); |
| 5979 | break; |
| 5980 | case eCsrCapsChange: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5981 | sme_err("received eCsrCapsChange "); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5982 | csr_roam_state_change(pMac, eCSR_ROAMING_STATE_JOINING, |
| 5983 | sessionId); |
| 5984 | status = csr_roam_issue_disassociate(pMac, sessionId, |
| 5985 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, |
| 5986 | false); |
| 5987 | break; |
| 5988 | case eCsrSmeIssuedFTReassoc: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 5989 | sme_debug("received FT Reassoc Req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5990 | status = csr_process_ft_reassoc_roam_command(pMac, pCommand); |
| 5991 | break; |
| 5992 | |
| 5993 | case eCsrStopBss: |
| 5994 | csr_roam_state_change(pMac, eCSR_ROAMING_STATE_JOINING, |
| 5995 | sessionId); |
| 5996 | status = csr_roam_issue_stop_bss(pMac, sessionId, |
| 5997 | eCSR_ROAM_SUBSTATE_STOP_BSS_REQ); |
| 5998 | break; |
| 5999 | |
| 6000 | case eCsrForcedDisassocSta: |
| 6001 | csr_roam_state_change(pMac, eCSR_ROAMING_STATE_JOINING, |
| 6002 | sessionId); |
| 6003 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, |
| 6004 | sessionId); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6005 | sme_debug("Disassociate issued with reason: %d", |
yeshwanth sriram guntuka | 46f004f | 2017-02-07 12:22:31 +0530 | [diff] [blame] | 6006 | pCommand->u.roamCmd.reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6007 | status = csr_send_mb_disassoc_req_msg(pMac, sessionId, |
| 6008 | pCommand->u.roamCmd.peerMac, |
| 6009 | pCommand->u.roamCmd.reason); |
| 6010 | break; |
| 6011 | |
| 6012 | case eCsrForcedDeauthSta: |
| 6013 | csr_roam_state_change(pMac, eCSR_ROAMING_STATE_JOINING, |
| 6014 | sessionId); |
| 6015 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, |
| 6016 | sessionId); |
| 6017 | status = csr_send_mb_deauth_req_msg(pMac, sessionId, |
| 6018 | pCommand->u.roamCmd.peerMac, |
| 6019 | pCommand->u.roamCmd.reason); |
| 6020 | break; |
| 6021 | |
| 6022 | case eCsrPerformPreauth: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6023 | sme_debug("Attempting FT PreAuth Req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6024 | status = csr_roam_issue_ft_preauth_req(pMac, sessionId, |
| 6025 | pCommand->u.roamCmd.pLastRoamBss); |
| 6026 | break; |
| 6027 | default: |
| 6028 | csr_roam_state_change(pMac, eCSR_ROAMING_STATE_JOINING, |
| 6029 | sessionId); |
| 6030 | |
| 6031 | if (pCommand->u.roamCmd.fUpdateCurRoamProfile) { |
| 6032 | /* Remember the roaming profile */ |
| 6033 | csr_free_roam_profile(pMac, sessionId); |
| 6034 | pSession->pCurRoamProfile = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6035 | qdf_mem_malloc(sizeof(tCsrRoamProfile)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6036 | if (NULL != pSession->pCurRoamProfile) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6037 | csr_roam_copy_profile(pMac, |
| 6038 | pSession->pCurRoamProfile, |
| 6039 | &pCommand->u.roamCmd.roamProfile); |
| 6040 | } |
| 6041 | } |
| 6042 | /* |
| 6043 | * At this point original uapsd_mask is saved in |
| 6044 | * pCurRoamProfile. uapsd_mask in the pCommand may change from |
| 6045 | * this point on. Attempt to roam with the new scan results |
| 6046 | * (if we need to..) |
| 6047 | */ |
| 6048 | status = csr_roam(pMac, pCommand); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6049 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6050 | sme_warn("csr_roam() failed with status = 0x%08X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6051 | status); |
| 6052 | break; |
| 6053 | } |
| 6054 | return status; |
| 6055 | } |
| 6056 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6057 | void csr_reinit_roam_cmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 6058 | { |
| 6059 | if (pCommand->u.roamCmd.fReleaseBssList) { |
| 6060 | csr_scan_result_purge(pMac, pCommand->u.roamCmd.hBSSList); |
| 6061 | pCommand->u.roamCmd.fReleaseBssList = false; |
| 6062 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 6063 | } |
| 6064 | if (pCommand->u.roamCmd.fReleaseProfile) { |
| 6065 | csr_release_profile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 6066 | pCommand->u.roamCmd.fReleaseProfile = false; |
| 6067 | } |
| 6068 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 6069 | /* Because u.roamCmd is union and share with scanCmd and StatusChange */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6070 | qdf_mem_set(&pCommand->u.roamCmd, sizeof(tRoamCmd), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6071 | } |
| 6072 | |
| 6073 | void csr_reinit_wm_status_change_cmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 6074 | { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6075 | qdf_mem_set(&pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6076 | 0); |
| 6077 | } |
| 6078 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 6079 | void csr_roam_complete(tpAniSirGlobal mac_ctx, eCsrRoamCompleteResult Result, |
| 6080 | void *Context, uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6081 | { |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 6082 | tSmeCmd *sme_cmd; |
| 6083 | struct wlan_serialization_command *cmd; |
| 6084 | |
| 6085 | cmd = wlan_serialization_peek_head_active_cmd_using_psoc( |
| 6086 | mac_ctx->psoc, false); |
| 6087 | if (!cmd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6088 | sme_err("Roam completion called but cmd is not active"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 6089 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6090 | } |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 6091 | sme_cmd = cmd->umac_cmd; |
| 6092 | if (!sme_cmd) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 6093 | sme_err("sme_cmd is NULL"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 6094 | return; |
| 6095 | } |
| 6096 | if (eSmeCommandRoam == sme_cmd->command) { |
| 6097 | csr_roam_process_results(mac_ctx, sme_cmd, Result, Context); |
| 6098 | csr_release_command(mac_ctx, sme_cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6099 | } |
| 6100 | } |
| 6101 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 6102 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6103 | void csr_reset_pmkid_candidate_list(tpAniSirGlobal pMac, uint32_t sessionId) |
| 6104 | { |
| 6105 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 6106 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6107 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 6108 | sme_err("session: %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6109 | return; |
| 6110 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6111 | qdf_mem_set(&(pSession->PmkidCandidateInfo[0]), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6112 | sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED, 0); |
| 6113 | pSession->NumPmkidCandidate = 0; |
| 6114 | } |
| 6115 | |
| 6116 | #ifdef FEATURE_WLAN_WAPI |
| 6117 | void csr_reset_bkid_candidate_list(tpAniSirGlobal pMac, uint32_t sessionId) |
| 6118 | { |
| 6119 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 6120 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6121 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 6122 | sme_err("session: %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6123 | return; |
| 6124 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6125 | qdf_mem_set(&(pSession->BkidCandidateInfo[0]), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6126 | sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED, 0); |
| 6127 | pSession->NumBkidCandidate = 0; |
| 6128 | } |
| 6129 | #endif /* FEATURE_WLAN_WAPI */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6130 | |
| 6131 | /** |
| 6132 | * csr_roam_save_params() - Helper function to save params |
| 6133 | * @mac_ctx: pointer to mac context |
| 6134 | * @session_ptr: Session pointer |
| 6135 | * @auth_type: auth type |
| 6136 | * @ie_ptr: pointer to ie |
| 6137 | * @ie_local: pointr to local ie |
| 6138 | * |
| 6139 | * This function will save params to session |
| 6140 | * |
| 6141 | * Return: none. |
| 6142 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6143 | static QDF_STATUS csr_roam_save_params(tpAniSirGlobal mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6144 | tCsrRoamSession *session_ptr, |
| 6145 | eCsrAuthType auth_type, |
| 6146 | tDot11fBeaconIEs *ie_ptr, |
| 6147 | tDot11fBeaconIEs *ie_local) |
| 6148 | { |
| 6149 | uint32_t nIeLen; |
| 6150 | uint8_t *pIeBuf; |
| 6151 | |
| 6152 | if ((eCSR_AUTH_TYPE_RSN == auth_type) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6153 | (eCSR_AUTH_TYPE_FT_RSN == auth_type) || |
| 6154 | (eCSR_AUTH_TYPE_FT_RSN_PSK == auth_type) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6155 | #if defined WLAN_FEATURE_11W |
| 6156 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == auth_type) || |
| 6157 | (eCSR_AUTH_TYPE_RSN_8021X_SHA256 == auth_type) || |
| 6158 | #endif |
| 6159 | (eCSR_AUTH_TYPE_RSN_PSK == auth_type)) { |
| 6160 | if (ie_local->RSN.present) { |
| 6161 | tDot11fIERSN *rsnie = &ie_local->RSN; |
| 6162 | /* |
| 6163 | * Calculate the actual length |
| 6164 | * version + gp_cipher_suite + pwise_cipher_suite_count |
| 6165 | * + akm_suite_count + reserved + pwise_cipher_suites |
| 6166 | */ |
| 6167 | nIeLen = 8 + 2 + 2 |
| 6168 | + (rsnie->pwise_cipher_suite_count * 4) |
| 6169 | + (rsnie->akm_suite_count * 4); |
| 6170 | if (rsnie->pmkid_count) |
| 6171 | /* pmkid */ |
| 6172 | nIeLen += 2 + rsnie->pmkid_count * 4; |
| 6173 | |
| 6174 | /* nIeLen doesn't count EID and length fields */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6175 | session_ptr->pWpaRsnRspIE = qdf_mem_malloc(nIeLen + 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6176 | if (NULL == session_ptr->pWpaRsnRspIE) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6177 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6178 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6179 | session_ptr->pWpaRsnRspIE[0] = DOT11F_EID_RSN; |
| 6180 | session_ptr->pWpaRsnRspIE[1] = (uint8_t) nIeLen; |
| 6181 | /* copy upto akm_suites */ |
| 6182 | pIeBuf = session_ptr->pWpaRsnRspIE + 2; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6183 | qdf_mem_copy(pIeBuf, &rsnie->version, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6184 | sizeof(rsnie->version)); |
| 6185 | pIeBuf += sizeof(rsnie->version); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6186 | qdf_mem_copy(pIeBuf, &rsnie->gp_cipher_suite, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6187 | sizeof(rsnie->gp_cipher_suite)); |
| 6188 | pIeBuf += sizeof(rsnie->gp_cipher_suite); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6189 | qdf_mem_copy(pIeBuf, &rsnie->pwise_cipher_suite_count, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6190 | sizeof(rsnie->pwise_cipher_suite_count)); |
| 6191 | pIeBuf += sizeof(rsnie->pwise_cipher_suite_count); |
| 6192 | if (rsnie->pwise_cipher_suite_count) { |
| 6193 | /* copy pwise_cipher_suites */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6194 | qdf_mem_copy(pIeBuf, rsnie->pwise_cipher_suites, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6195 | rsnie->pwise_cipher_suite_count * 4); |
| 6196 | pIeBuf += rsnie->pwise_cipher_suite_count * 4; |
| 6197 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6198 | qdf_mem_copy(pIeBuf, &rsnie->akm_suite_count, 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6199 | pIeBuf += 2; |
| 6200 | if (rsnie->akm_suite_count) { |
| 6201 | /* copy akm_suites */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6202 | qdf_mem_copy(pIeBuf, rsnie->akm_suites, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6203 | rsnie->akm_suite_count * 4); |
| 6204 | pIeBuf += rsnie->akm_suite_count * 4; |
| 6205 | } |
| 6206 | /* copy the rest */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6207 | qdf_mem_copy(pIeBuf, rsnie->akm_suites + |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6208 | rsnie->akm_suite_count * 4, |
| 6209 | 2 + rsnie->pmkid_count * 4); |
| 6210 | session_ptr->nWpaRsnRspIeLength = nIeLen + 2; |
| 6211 | } |
| 6212 | } else if ((eCSR_AUTH_TYPE_WPA == auth_type) || |
| 6213 | (eCSR_AUTH_TYPE_WPA_PSK == auth_type)) { |
| 6214 | if (ie_local->WPA.present) { |
| 6215 | tDot11fIEWPA *wpaie = &ie_local->WPA; |
| 6216 | /* Calculate the actual length wpaie */ |
| 6217 | nIeLen = 12 + 2 /* auth_suite_count */ |
| 6218 | + wpaie->unicast_cipher_count * 4 |
| 6219 | + wpaie->auth_suite_count * 4; |
| 6220 | |
| 6221 | /* The WPA capabilities follows the Auth Suite |
| 6222 | * (two octects)-- this field is optional, and |
| 6223 | * we always "send" zero, so just remove it. This is |
| 6224 | * consistent with our assumptions in the frames |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 6225 | * compiler; nIeLen doesn't count EID & length fields |
| 6226 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6227 | session_ptr->pWpaRsnRspIE = qdf_mem_malloc(nIeLen + 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6228 | if (NULL == session_ptr->pWpaRsnRspIE) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6229 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6230 | session_ptr->pWpaRsnRspIE[0] = DOT11F_EID_WPA; |
| 6231 | session_ptr->pWpaRsnRspIE[1] = (uint8_t) nIeLen; |
| 6232 | pIeBuf = session_ptr->pWpaRsnRspIE + 2; |
| 6233 | /* Copy WPA OUI */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6234 | qdf_mem_copy(pIeBuf, &csr_wpa_oui[1], 4); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6235 | pIeBuf += 4; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6236 | qdf_mem_copy(pIeBuf, &wpaie->version, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6237 | 8 + wpaie->unicast_cipher_count * 4); |
| 6238 | pIeBuf += 8 + wpaie->unicast_cipher_count * 4; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6239 | qdf_mem_copy(pIeBuf, &wpaie->auth_suite_count, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6240 | 2 + wpaie->auth_suite_count * 4); |
| 6241 | pIeBuf += wpaie->auth_suite_count * 4; |
| 6242 | session_ptr->nWpaRsnRspIeLength = nIeLen + 2; |
| 6243 | } |
| 6244 | } |
| 6245 | #ifdef FEATURE_WLAN_WAPI |
| 6246 | else if ((eCSR_AUTH_TYPE_WAPI_WAI_PSK == auth_type) || |
| 6247 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == |
| 6248 | auth_type)) { |
| 6249 | if (ie_local->WAPI.present) { |
| 6250 | tDot11fIEWAPI *wapi_ie = &ie_local->WAPI; |
| 6251 | /* Calculate the actual length of wapi ie*/ |
| 6252 | nIeLen = 4 + 2 /* pwise_cipher_suite_count */ |
| 6253 | + wapi_ie->akm_suite_count * 4 |
| 6254 | + wapi_ie->unicast_cipher_suite_count * 4 |
| 6255 | + 6; /* gp_cipher_suite + preauth + reserved */ |
| 6256 | |
| 6257 | if (wapi_ie->bkid_count) |
| 6258 | nIeLen += 2 + wapi_ie->bkid_count * 4; |
| 6259 | |
| 6260 | /* nIeLen doesn't count EID and length fields */ |
| 6261 | session_ptr->pWapiRspIE = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6262 | qdf_mem_malloc(nIeLen + 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6263 | if (NULL == session_ptr->pWapiRspIE) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6264 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6265 | session_ptr->pWapiRspIE[0] = DOT11F_EID_WAPI; |
| 6266 | session_ptr->pWapiRspIE[1] = (uint8_t) nIeLen; |
| 6267 | pIeBuf = session_ptr->pWapiRspIE + 2; |
| 6268 | /* copy upto akm_suite_count */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6269 | qdf_mem_copy(pIeBuf, &wapi_ie->version, 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6270 | pIeBuf += 4; |
| 6271 | if (wapi_ie->akm_suite_count) { |
| 6272 | /* copy akm_suites */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6273 | qdf_mem_copy(pIeBuf, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6274 | wapi_ie->akm_suites, |
| 6275 | wapi_ie->akm_suite_count * 4); |
| 6276 | pIeBuf += wapi_ie->akm_suite_count * 4; |
| 6277 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6278 | qdf_mem_copy(pIeBuf, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6279 | &wapi_ie->unicast_cipher_suite_count, 2); |
| 6280 | pIeBuf += 2; |
| 6281 | if (wapi_ie->unicast_cipher_suite_count) { |
| 6282 | uint16_t suite_size = |
| 6283 | wapi_ie->unicast_cipher_suite_count * 4; |
| 6284 | /* copy pwise_cipher_suites */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6285 | qdf_mem_copy(pIeBuf, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6286 | wapi_ie->unicast_cipher_suites, |
| 6287 | suite_size); |
| 6288 | pIeBuf += suite_size; |
| 6289 | } |
| 6290 | /* gp_cipher_suite */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6291 | qdf_mem_copy(pIeBuf, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6292 | wapi_ie->multicast_cipher_suite, 4); |
| 6293 | pIeBuf += 4; |
| 6294 | /* preauth + reserved */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6295 | qdf_mem_copy(pIeBuf, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6296 | wapi_ie->multicast_cipher_suite + 4, 2); |
| 6297 | pIeBuf += 2; |
| 6298 | if (wapi_ie->bkid_count) { |
| 6299 | /* bkid_count */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6300 | qdf_mem_copy(pIeBuf, &wapi_ie->bkid_count, 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6301 | pIeBuf += 2; |
| 6302 | /* copy akm_suites */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6303 | qdf_mem_copy(pIeBuf, wapi_ie->bkid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6304 | wapi_ie->bkid_count * 4); |
| 6305 | pIeBuf += wapi_ie->bkid_count * 4; |
| 6306 | } |
| 6307 | session_ptr->nWapiRspIeLength = nIeLen + 2; |
| 6308 | } |
| 6309 | } |
| 6310 | #endif /* FEATURE_WLAN_WAPI */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6311 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6312 | } |
| 6313 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6314 | static QDF_STATUS csr_roam_save_security_rsp_ie(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6315 | uint32_t sessionId, |
| 6316 | eCsrAuthType authType, |
| 6317 | tSirBssDescription *pSirBssDesc, |
| 6318 | tDot11fBeaconIEs *pIes) |
| 6319 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6320 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6321 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 6322 | tDot11fBeaconIEs *pIesLocal = pIes; |
| 6323 | |
| 6324 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6325 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6326 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6327 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6328 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6329 | sme_debug("authType %d session %d", authType, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6330 | if ((eCSR_AUTH_TYPE_WPA == authType) || |
| 6331 | (eCSR_AUTH_TYPE_WPA_PSK == authType) || |
| 6332 | (eCSR_AUTH_TYPE_RSN == authType) || |
| 6333 | (eCSR_AUTH_TYPE_RSN_PSK == authType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6334 | || (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 6335 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6336 | #ifdef FEATURE_WLAN_WAPI |
| 6337 | || (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 6338 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType) |
| 6339 | #endif /* FEATURE_WLAN_WAPI */ |
| 6340 | #ifdef WLAN_FEATURE_11W |
| 6341 | || (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) || |
| 6342 | (eCSR_AUTH_TYPE_RSN_8021X_SHA256 == authType) |
| 6343 | #endif /* FEATURE_WLAN_WAPI */ |
| 6344 | ) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6345 | if (!pIesLocal && !QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6346 | (csr_get_parsed_bss_description_ies(pMac, |
| 6347 | pSirBssDesc, &pIesLocal))) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6348 | sme_err(" cannot parse IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6349 | if (pIesLocal) { |
| 6350 | status = csr_roam_save_params(pMac, pSession, authType, |
| 6351 | pIes, pIesLocal); |
| 6352 | if (!pIes) |
| 6353 | /* locally allocated */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6354 | qdf_mem_free(pIesLocal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6355 | } |
| 6356 | } |
| 6357 | return status; |
| 6358 | } |
| 6359 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6360 | /* Returns whether the current association is a 11r assoc or not */ |
| 6361 | bool csr_roam_is11r_assoc(tpAniSirGlobal pMac, uint8_t sessionId) |
| 6362 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6363 | return csr_neighbor_roam_is11r_assoc(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6364 | } |
Deepak Dhamdhere | add334b | 2016-01-09 23:40:33 -0800 | [diff] [blame] | 6365 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6366 | /* Returns whether "Legacy Fast Roaming" is currently enabled...or not */ |
| 6367 | bool csr_roam_is_fast_roam_enabled(tpAniSirGlobal pMac, uint32_t sessionId) |
| 6368 | { |
| 6369 | tCsrRoamSession *pSession = NULL; |
| 6370 | |
| 6371 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 6372 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 6373 | if (NULL != pSession->pCurRoamProfile) { |
| 6374 | if (pSession->pCurRoamProfile->csrPersona != |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6375 | QDF_STA_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6376 | return false; |
| 6377 | } |
| 6378 | } |
| 6379 | } |
| 6380 | if (true == CSR_IS_FASTROAM_IN_CONCURRENCY_INI_FEATURE_ENABLED(pMac)) { |
| 6381 | return pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
| 6382 | } else { |
| 6383 | return pMac->roam.configParam.isFastRoamIniFeatureEnabled && |
| 6384 | (!csr_is_concurrent_session_running(pMac)); |
| 6385 | } |
| 6386 | } |
| 6387 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6388 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 6389 | static eCsrPhyMode csr_roamdot11mode_to_phymode(uint8_t dot11mode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6390 | { |
| 6391 | eCsrPhyMode phymode = eCSR_DOT11_MODE_abg; |
| 6392 | |
| 6393 | switch (dot11mode) { |
| 6394 | case WNI_CFG_DOT11_MODE_ALL: |
| 6395 | phymode = eCSR_DOT11_MODE_abg; |
| 6396 | break; |
| 6397 | case WNI_CFG_DOT11_MODE_11A: |
| 6398 | phymode = eCSR_DOT11_MODE_11a; |
| 6399 | break; |
| 6400 | case WNI_CFG_DOT11_MODE_11B: |
| 6401 | phymode = eCSR_DOT11_MODE_11b; |
| 6402 | break; |
| 6403 | case WNI_CFG_DOT11_MODE_11G: |
| 6404 | phymode = eCSR_DOT11_MODE_11g; |
| 6405 | break; |
| 6406 | case WNI_CFG_DOT11_MODE_11N: |
| 6407 | phymode = eCSR_DOT11_MODE_11n; |
| 6408 | break; |
| 6409 | case WNI_CFG_DOT11_MODE_11G_ONLY: |
| 6410 | phymode = eCSR_DOT11_MODE_11g_ONLY; |
| 6411 | break; |
| 6412 | case WNI_CFG_DOT11_MODE_11N_ONLY: |
| 6413 | phymode = eCSR_DOT11_MODE_11n_ONLY; |
| 6414 | break; |
| 6415 | case WNI_CFG_DOT11_MODE_11AC: |
| 6416 | phymode = eCSR_DOT11_MODE_11ac; |
| 6417 | break; |
| 6418 | case WNI_CFG_DOT11_MODE_11AC_ONLY: |
| 6419 | phymode = eCSR_DOT11_MODE_11ac_ONLY; |
| 6420 | break; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 6421 | case WNI_CFG_DOT11_MODE_11AX: |
| 6422 | phymode = eCSR_DOT11_MODE_11ax; |
| 6423 | break; |
| 6424 | case WNI_CFG_DOT11_MODE_11AX_ONLY: |
| 6425 | phymode = eCSR_DOT11_MODE_11ax_ONLY; |
| 6426 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6427 | default: |
| 6428 | break; |
| 6429 | } |
| 6430 | |
| 6431 | return phymode; |
| 6432 | } |
| 6433 | #endif |
| 6434 | |
| 6435 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 6436 | static void csr_roam_synch_clean_up(tpAniSirGlobal mac, uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6437 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 6438 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6439 | struct roam_offload_synch_fail *roam_offload_failed = NULL; |
| 6440 | tCsrRoamSession *session = &mac->roam.roamSession[session_id]; |
| 6441 | |
| 6442 | /* Clean up the roam synch in progress for LFR3 */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6443 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6444 | "%s: Roam Synch Failed, Clean Up", __func__); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 6445 | session->roam_synch_in_progress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6446 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6447 | roam_offload_failed = qdf_mem_malloc( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6448 | sizeof(struct roam_offload_synch_fail)); |
| 6449 | if (NULL == roam_offload_failed) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6450 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 6451 | "%s: unable to allocate memory for roam synch fail", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6452 | __func__); |
| 6453 | return; |
| 6454 | } |
| 6455 | |
| 6456 | roam_offload_failed->session_id = session_id; |
| 6457 | msg.type = WMA_ROAM_OFFLOAD_SYNCH_FAIL; |
| 6458 | msg.reserved = 0; |
| 6459 | msg.bodyptr = roam_offload_failed; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 6460 | if (!QDF_IS_STATUS_SUCCESS(scheduler_post_msg(QDF_MODULE_ID_WMA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6461 | &msg))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 6462 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6463 | "%s: Unable to post WMA_ROAM_OFFLOAD_SYNCH_FAIL to WMA", |
| 6464 | __func__); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6465 | qdf_mem_free(roam_offload_failed); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6466 | } |
| 6467 | } |
| 6468 | #endif |
| 6469 | |
| 6470 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 6471 | /** |
| 6472 | * csr_roam_copy_ht_profile() - Copy from src to dst |
| 6473 | * @dst_profile: Destination HT profile |
| 6474 | * @src_profile: Source HT profile |
| 6475 | * |
| 6476 | * Copy the HT profile from the given source to destination |
| 6477 | * |
| 6478 | * Return: None |
| 6479 | */ |
| 6480 | static void csr_roam_copy_ht_profile(tCsrRoamHTProfile *dst_profile, |
| 6481 | tSirSmeHTProfile *src_profile) |
| 6482 | { |
| 6483 | dst_profile->phymode = |
| 6484 | csr_roamdot11mode_to_phymode(src_profile->dot11mode); |
| 6485 | dst_profile->htCapability = src_profile->htCapability; |
| 6486 | dst_profile->htSupportedChannelWidthSet = |
| 6487 | src_profile->htSupportedChannelWidthSet; |
| 6488 | dst_profile->htRecommendedTxWidthSet = |
| 6489 | src_profile->htRecommendedTxWidthSet; |
| 6490 | dst_profile->htSecondaryChannelOffset = |
| 6491 | src_profile->htSecondaryChannelOffset; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6492 | dst_profile->vhtCapability = src_profile->vhtCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6493 | dst_profile->apCenterChan = src_profile->apCenterChan; |
| 6494 | dst_profile->apChanWidth = src_profile->apChanWidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6495 | } |
| 6496 | #endif |
| 6497 | |
| 6498 | /** |
| 6499 | * csr_roam_process_results_default() - Process the result for start bss |
| 6500 | * @mac_ctx: Global MAC Context |
| 6501 | * @cmd: Command to be processed |
| 6502 | * @context: Additional data in context of the cmd |
| 6503 | * |
| 6504 | * Return: None |
| 6505 | */ |
| 6506 | static void csr_roam_process_results_default(tpAniSirGlobal mac_ctx, |
| 6507 | tSmeCmd *cmd, void *context, eCsrRoamCompleteResult res) |
| 6508 | { |
| 6509 | uint32_t session_id = cmd->sessionId; |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 6510 | tCsrRoamSession *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6511 | tCsrRoamInfo roam_info; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6512 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6513 | |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 6514 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6515 | sme_err("Invalid session id %d", session_id); |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 6516 | return; |
| 6517 | } |
| 6518 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 6519 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6520 | sme_debug("receives no association indication"); |
| 6521 | sme_debug("Assoc ref count: %d", session->bRefAssocStartCnt); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6522 | if (CSR_IS_INFRASTRUCTURE(&session->connectedProfile) |
| 6523 | || CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ(mac_ctx, session_id)) { |
| 6524 | /* |
| 6525 | * do not free for the other profiles as we need |
| 6526 | * to send down stop BSS later |
| 6527 | */ |
| 6528 | csr_free_connect_bss_desc(mac_ctx, session_id); |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 6529 | csr_roam_free_connect_profile(&session->connectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6530 | csr_roam_free_connected_info(mac_ctx, &session->connectedInfo); |
| 6531 | csr_set_default_dot11_mode(mac_ctx); |
| 6532 | } |
| 6533 | |
| 6534 | switch (cmd->u.roamCmd.roamReason) { |
| 6535 | /* |
| 6536 | * If this transition is because of an 802.11 OID, then we |
| 6537 | * transition back to INIT state so we sit waiting for more |
| 6538 | * OIDs to be issued and we don't start the IDLE timer. |
| 6539 | */ |
| 6540 | case eCsrSmeIssuedFTReassoc: |
| 6541 | case eCsrSmeIssuedAssocToSimilarAP: |
| 6542 | case eCsrHddIssued: |
| 6543 | case eCsrSmeIssuedDisassocForHandoff: |
| 6544 | csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_IDLE, |
| 6545 | session_id); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6546 | qdf_mem_set(&roam_info, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6547 | roam_info.pBssDesc = cmd->u.roamCmd.pLastRoamBss; |
| 6548 | roam_info.pProfile = &cmd->u.roamCmd.roamProfile; |
| 6549 | roam_info.statusCode = session->joinFailStatusCode.statusCode; |
| 6550 | roam_info.reasonCode = session->joinFailStatusCode.reasonCode; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6551 | qdf_mem_copy(&roam_info.bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6552 | &session->joinFailStatusCode.bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6553 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6554 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6555 | /* |
| 6556 | * If Join fails while Handoff is in progress, indicate |
| 6557 | * disassociated event to supplicant to reconnect |
| 6558 | */ |
| 6559 | if (csr_roam_is_handoff_in_progress(mac_ctx, session_id)) { |
| 6560 | csr_neighbor_roam_indicate_connect(mac_ctx, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6561 | (uint8_t)session_id, QDF_STATUS_E_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6562 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6563 | if (session->bRefAssocStartCnt > 0) { |
| 6564 | session->bRefAssocStartCnt--; |
| 6565 | if (eCsrJoinFailureDueToConcurrency == res) |
| 6566 | csr_roam_call_callback(mac_ctx, session_id, |
| 6567 | &roam_info, cmd->u.roamCmd.roamId, |
| 6568 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 6569 | eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6570 | else |
| 6571 | csr_roam_call_callback(mac_ctx, session_id, |
| 6572 | &roam_info, cmd->u.roamCmd.roamId, |
| 6573 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 6574 | eCSR_ROAM_RESULT_FAILURE); |
| 6575 | } else { |
| 6576 | /* |
| 6577 | * bRefAssocStartCnt is not incremented when |
| 6578 | * eRoamState == eCsrStopRoamingDueToConcurrency |
| 6579 | * in csr_roam_join_next_bss API. so handle this in |
| 6580 | * else case by sending assoc failure |
| 6581 | */ |
| 6582 | csr_roam_call_callback(mac_ctx, session_id, |
| 6583 | &roam_info, cmd->u.scanCmd.roamId, |
| 6584 | eCSR_ROAM_ASSOCIATION_FAILURE, |
| 6585 | eCSR_ROAM_RESULT_FAILURE); |
| 6586 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6587 | sme_debug("roam(reason %d) failed", cmd->u.roamCmd.roamReason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6588 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6589 | sme_qos_update_hand_off((uint8_t) session_id, false); |
| 6590 | sme_qos_csr_event_ind(mac_ctx, (uint8_t) session_id, |
| 6591 | SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 6592 | #endif |
| 6593 | csr_roam_completion(mac_ctx, session_id, NULL, cmd, |
| 6594 | eCSR_ROAM_RESULT_FAILURE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6595 | break; |
| 6596 | case eCsrHddIssuedReassocToSameAP: |
| 6597 | case eCsrSmeIssuedReassocToSameAP: |
| 6598 | csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_IDLE, |
| 6599 | session_id); |
| 6600 | |
| 6601 | csr_roam_call_callback(mac_ctx, session_id, NULL, |
| 6602 | cmd->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, |
| 6603 | eCSR_ROAM_RESULT_FORCED); |
| 6604 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6605 | sme_qos_csr_event_ind(mac_ctx, (uint8_t) session_id, |
| 6606 | SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 6607 | #endif |
| 6608 | csr_roam_completion(mac_ctx, session_id, NULL, cmd, |
| 6609 | eCSR_ROAM_RESULT_FAILURE, false); |
| 6610 | break; |
| 6611 | case eCsrForcedDisassoc: |
| 6612 | case eCsrForcedDeauth: |
| 6613 | case eCsrSmeIssuedIbssJoinFailure: |
| 6614 | csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_IDLE, |
| 6615 | session_id); |
| 6616 | |
| 6617 | if (eCsrSmeIssuedIbssJoinFailure == cmd->u.roamCmd.roamReason) |
| 6618 | /* notify HDD that IBSS join failed */ |
| 6619 | csr_roam_call_callback(mac_ctx, session_id, NULL, 0, |
| 6620 | eCSR_ROAM_IBSS_IND, |
| 6621 | eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 6622 | else |
| 6623 | csr_roam_call_callback(mac_ctx, session_id, NULL, |
| 6624 | cmd->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, |
| 6625 | eCSR_ROAM_RESULT_FORCED); |
| 6626 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6627 | sme_qos_csr_event_ind(mac_ctx, (uint8_t) session_id, |
| 6628 | SME_QOS_CSR_DISCONNECT_IND, |
| 6629 | NULL); |
| 6630 | #endif |
| 6631 | csr_roam_link_down(mac_ctx, session_id); |
| 6632 | |
| 6633 | if (mac_ctx->roam.deauthRspStatus == eSIR_SME_DEAUTH_STATUS) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6634 | sme_warn("FW still in connected state"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6635 | break; |
| 6636 | } |
| 6637 | break; |
| 6638 | case eCsrForcedIbssLeave: |
| 6639 | csr_roam_call_callback(mac_ctx, session_id, NULL, |
| 6640 | cmd->u.roamCmd.roamId, eCSR_ROAM_IBSS_LEAVE, |
| 6641 | eCSR_ROAM_RESULT_IBSS_STOP); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 6642 | session->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6643 | break; |
| 6644 | case eCsrForcedDisassocMICFailure: |
| 6645 | csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_IDLE, |
| 6646 | session_id); |
| 6647 | |
| 6648 | csr_roam_call_callback(mac_ctx, session_id, NULL, |
| 6649 | cmd->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, |
| 6650 | eCSR_ROAM_RESULT_MIC_FAILURE); |
| 6651 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6652 | sme_qos_csr_event_ind(mac_ctx, (uint8_t) session_id, |
| 6653 | SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 6654 | #endif |
| 6655 | break; |
| 6656 | case eCsrStopBss: |
| 6657 | csr_roam_call_callback(mac_ctx, session_id, NULL, |
| 6658 | cmd->u.roamCmd.roamId, eCSR_ROAM_INFRA_IND, |
| 6659 | eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 6660 | break; |
| 6661 | case eCsrForcedDisassocSta: |
| 6662 | case eCsrForcedDeauthSta: |
| 6663 | csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_JOINED, |
| 6664 | session_id); |
| 6665 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 6666 | if (CSR_IS_SESSION_VALID(mac_ctx, session_id) && |
| 6667 | CSR_IS_INFRA_AP(&session->connectedProfile)) { |
| 6668 | roam_info.u.pConnectedProfile = |
| 6669 | &session->connectedProfile; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6670 | qdf_mem_copy(roam_info.peerMac.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6671 | cmd->u.roamCmd.peerMac, |
| 6672 | sizeof(tSirMacAddr)); |
| 6673 | roam_info.reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 6674 | roam_info.statusCode = eSIR_SME_SUCCESS; |
| 6675 | status = csr_roam_call_callback(mac_ctx, session_id, |
| 6676 | &roam_info, cmd->u.roamCmd.roamId, |
| 6677 | eCSR_ROAM_LOSTLINK, |
| 6678 | eCSR_ROAM_RESULT_FORCED); |
| 6679 | } |
| 6680 | break; |
| 6681 | case eCsrLostLink1: |
| 6682 | /* if lost link roam1 failed, then issue lost link Scan2 ... */ |
| 6683 | csr_scan_request_lost_link2(mac_ctx, session_id); |
| 6684 | break; |
| 6685 | case eCsrLostLink2: |
| 6686 | /* if lost link roam2 failed, then issue lost link scan3 ... */ |
| 6687 | csr_scan_request_lost_link3(mac_ctx, session_id); |
| 6688 | break; |
| 6689 | case eCsrLostLink3: |
| 6690 | default: |
| 6691 | csr_roam_state_change(mac_ctx, |
| 6692 | eCSR_ROAMING_STATE_IDLE, session_id); |
| 6693 | |
| 6694 | /* We are done with one round of lostlink roaming here */ |
| 6695 | csr_scan_handle_failed_lostlink3(mac_ctx, session_id); |
| 6696 | break; |
| 6697 | } |
| 6698 | } |
| 6699 | |
| 6700 | /** |
| 6701 | * csr_roam_process_start_bss_success() - Process the result for start bss |
| 6702 | * @mac_ctx: Global MAC Context |
| 6703 | * @cmd: Command to be processed |
| 6704 | * @context: Additional data in context of the cmd |
| 6705 | * |
| 6706 | * Return: None |
| 6707 | */ |
| 6708 | static void csr_roam_process_start_bss_success(tpAniSirGlobal mac_ctx, |
| 6709 | tSmeCmd *cmd, void *context) |
| 6710 | { |
| 6711 | uint32_t session_id = cmd->sessionId; |
| 6712 | tCsrRoamProfile *profile = &cmd->u.roamCmd.roamProfile; |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 6713 | tCsrRoamSession *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6714 | tSirBssDescription *bss_desc = NULL; |
| 6715 | tCsrRoamInfo roam_info; |
| 6716 | tSirSmeStartBssRsp *start_bss_rsp = NULL; |
| 6717 | tCsrScanResult *scan_res = NULL; |
| 6718 | eRoamCmdStatus roam_status; |
| 6719 | eCsrRoamResult roam_result; |
| 6720 | tDot11fBeaconIEs *ies_ptr = NULL; |
| 6721 | tSirMacAddr bcast_mac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6722 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6723 | host_log_ibss_pkt_type *ibss_log; |
| 6724 | uint32_t bi; |
| 6725 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 6726 | tSirSmeHTProfile *src_profile = NULL; |
| 6727 | tCsrRoamHTProfile *dst_profile = NULL; |
| 6728 | #endif |
| 6729 | |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 6730 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6731 | sme_err("Invalid session id %d", session_id); |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 6732 | return; |
| 6733 | } |
| 6734 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 6735 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6736 | /* |
| 6737 | * on the StartBss Response, LIM is returning the Bss Description that |
| 6738 | * we are beaconing. Add this Bss Description to our scan results and |
| 6739 | * chain the Profile to this Bss Description. On a Start BSS, there was |
| 6740 | * no detected Bss description (no partner) so we issued the Start Bss |
| 6741 | * to start the Ibss without any Bss description. Lim was kind enough |
| 6742 | * to return the Bss Description that we start beaconing for the newly |
| 6743 | * started Ibss. |
| 6744 | */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6745 | sme_debug("receives start BSS ok indication"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6746 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6747 | start_bss_rsp = (tSirSmeStartBssRsp *) context; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6748 | qdf_mem_set(&roam_info, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6749 | if (CSR_IS_IBSS(profile)) |
| 6750 | session->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 6751 | else if (CSR_IS_INFRA_AP(profile)) |
| 6752 | session->connectState = |
| 6753 | eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 6754 | else if (CSR_IS_NDI(profile)) |
| 6755 | session->connectState = eCSR_CONNECT_STATE_TYPE_NDI_STARTED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6756 | else |
| 6757 | session->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 6758 | |
| 6759 | bss_desc = &start_bss_rsp->bssDescription; |
| 6760 | if (CSR_IS_NDI(profile)) { |
| 6761 | csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_JOINED, |
| 6762 | session_id); |
| 6763 | csr_roam_save_ndi_connected_info(mac_ctx, session_id, profile, |
| 6764 | bss_desc); |
| 6765 | roam_info.u.pConnectedProfile = &session->connectedProfile; |
| 6766 | qdf_mem_copy(&roam_info.bssid, &bss_desc->bssId, |
| 6767 | sizeof(struct qdf_mac_addr)); |
Naveen Rawat | cb186cf | 2016-07-11 13:47:19 -0700 | [diff] [blame] | 6768 | } else { |
| 6769 | csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_JOINED, |
| 6770 | session_id); |
| 6771 | if (!QDF_IS_STATUS_SUCCESS |
| 6772 | (csr_get_parsed_bss_description_ies(mac_ctx, bss_desc, |
| 6773 | &ies_ptr))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6774 | sme_warn("cannot parse IBSS IEs"); |
Naveen Rawat | cb186cf | 2016-07-11 13:47:19 -0700 | [diff] [blame] | 6775 | roam_info.pBssDesc = bss_desc; |
| 6776 | csr_roam_call_callback(mac_ctx, session_id, &roam_info, |
| 6777 | cmd->u.roamCmd.roamId, eCSR_ROAM_IBSS_IND, |
| 6778 | eCSR_ROAM_RESULT_IBSS_START_FAILED); |
| 6779 | return; |
| 6780 | } |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 6781 | } |
Naveen Rawat | 334c51b | 2017-05-05 17:33:32 -0700 | [diff] [blame] | 6782 | if (!CSR_IS_INFRA_AP(profile) && !CSR_IS_NDI(profile)) { |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 6783 | scan_res = |
| 6784 | csr_scan_append_bss_description(mac_ctx, |
| 6785 | bss_desc, ies_ptr, false, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6786 | session_id); |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 6787 | } |
| 6788 | csr_roam_save_connected_bss_desc(mac_ctx, session_id, bss_desc); |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 6789 | csr_roam_free_connect_profile(&session->connectedProfile); |
| 6790 | csr_roam_free_connected_info(mac_ctx, &session->connectedInfo); |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 6791 | csr_roam_save_connected_infomation(mac_ctx, session_id, |
| 6792 | profile, bss_desc, ies_ptr); |
| 6793 | qdf_mem_copy(&roam_info.bssid, &bss_desc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6794 | sizeof(struct qdf_mac_addr)); |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 6795 | /* We are done with the IEs so free it */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6796 | qdf_mem_free(ies_ptr); |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 6797 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 6798 | WLAN_HOST_DIAG_LOG_ALLOC(ibss_log, |
| 6799 | host_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 6800 | if (ibss_log) { |
| 6801 | if (CSR_INVALID_SCANRESULT_HANDLE == |
| 6802 | cmd->u.roamCmd.hBSSList) { |
| 6803 | /* |
| 6804 | * We start the IBSS (didn't find any |
| 6805 | * matched IBSS out there) |
| 6806 | */ |
| 6807 | ibss_log->eventId = |
| 6808 | WLAN_IBSS_EVENT_START_IBSS_RSP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6809 | } else { |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 6810 | ibss_log->eventId = |
| 6811 | WLAN_IBSS_EVENT_JOIN_IBSS_RSP; |
| 6812 | } |
| 6813 | if (bss_desc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6814 | qdf_mem_copy(ibss_log->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6815 | bss_desc->bssId, QDF_MAC_ADDR_SIZE); |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 6816 | ibss_log->operatingChannel = |
| 6817 | bss_desc->channelId; |
| 6818 | } |
| 6819 | if (IS_SIR_STATUS_SUCCESS(wlan_cfg_get_int( |
| 6820 | mac_ctx, |
| 6821 | WNI_CFG_BEACON_INTERVAL, |
| 6822 | &bi))) |
| 6823 | /* U8 is not enough for BI */ |
| 6824 | ibss_log->beaconInterval = (uint8_t) bi; |
| 6825 | WLAN_HOST_DIAG_LOG_REPORT(ibss_log); |
| 6826 | } |
| 6827 | #endif |
| 6828 | /* |
| 6829 | * Only set context for non-WDS_STA. We don't even need it for |
| 6830 | * WDS_AP. But since the encryption. |
| 6831 | * is WPA2-PSK so it won't matter. |
| 6832 | */ |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 6833 | if (session->pCurRoamProfile && |
| 6834 | !CSR_IS_INFRA_AP(session->pCurRoamProfile)) { |
| 6835 | if (CSR_IS_ENC_TYPE_STATIC( |
| 6836 | profile->negotiatedUCEncryptionType)) { |
| 6837 | /* |
| 6838 | * Issue the set Context request to LIM to establish |
| 6839 | * the Broadcast STA context for the Ibss. In Rome IBSS |
| 6840 | * case, dummy key installation will break proper BSS |
| 6841 | * key installation, so skip it. |
| 6842 | */ |
| 6843 | if (!CSR_IS_IBSS(session->pCurRoamProfile)) { |
| 6844 | /* NO keys. these key parameters don't matter */ |
| 6845 | csr_roam_issue_set_context_req(mac_ctx, |
| 6846 | session_id, |
| 6847 | profile->negotiatedMCEncryptionType, |
| 6848 | bss_desc, &bcast_mac, false, |
| 6849 | false, eSIR_TX_RX, 0, 0, NULL, 0); |
| 6850 | } |
| 6851 | } |
| 6852 | if (CSR_IS_IBSS(session->pCurRoamProfile) && |
| 6853 | (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == |
| 6854 | profile->negotiatedUCEncryptionType || |
| 6855 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == |
| 6856 | profile->negotiatedUCEncryptionType || |
| 6857 | eCSR_ENCRYPT_TYPE_TKIP == |
| 6858 | profile->negotiatedUCEncryptionType || |
| 6859 | eCSR_ENCRYPT_TYPE_AES == |
| 6860 | profile->negotiatedUCEncryptionType)) { |
| 6861 | roam_info.fAuthRequired = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6862 | } |
| 6863 | } |
| 6864 | /* |
| 6865 | * Only tell upper layer is we start the BSS because Vista doesn't like |
| 6866 | * multiple connection indications. If we don't start the BSS ourself, |
| 6867 | * handler of eSIR_SME_JOINED_NEW_BSS will trigger the connection start |
| 6868 | * indication in Vista |
| 6869 | */ |
| 6870 | if (!CSR_IS_JOIN_TO_IBSS(profile)) { |
| 6871 | roam_status = eCSR_ROAM_IBSS_IND; |
| 6872 | roam_result = eCSR_ROAM_RESULT_IBSS_STARTED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6873 | if (CSR_IS_INFRA_AP(profile)) { |
| 6874 | roam_status = eCSR_ROAM_INFRA_IND; |
| 6875 | roam_result = eCSR_ROAM_RESULT_INFRA_STARTED; |
| 6876 | } |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 6877 | roam_info.staId = (uint8_t) start_bss_rsp->staId; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 6878 | if (CSR_IS_NDI(profile)) { |
| 6879 | csr_roam_update_ndp_return_params(mac_ctx, |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 6880 | eCsrStartBssSuccess, |
| 6881 | &roam_status, |
| 6882 | &roam_result, |
| 6883 | &roam_info); |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 6884 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6885 | /* |
| 6886 | * Only tell upper layer is we start the BSS because Vista |
| 6887 | * doesn't like multiple connection indications. If we don't |
| 6888 | * start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS |
| 6889 | * will trigger the connection start indication in Vista |
| 6890 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6891 | roam_info.statusCode = session->joinFailStatusCode.statusCode; |
| 6892 | roam_info.reasonCode = session->joinFailStatusCode.reasonCode; |
| 6893 | /* We start the IBSS (didn't find any matched IBSS out there) */ |
| 6894 | roam_info.pBssDesc = bss_desc; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 6895 | if (bss_desc) |
| 6896 | qdf_mem_copy(roam_info.bssid.bytes, bss_desc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6897 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6898 | if (!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
| 6899 | (csr_is_concurrent_session_running(mac_ctx))) { |
| 6900 | mac_ctx->roam.configParam.doBMPSWorkaround = 1; |
| 6901 | } |
| 6902 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 6903 | dst_profile = &session->connectedProfile.HTProfile; |
| 6904 | src_profile = &start_bss_rsp->HTProfile; |
| 6905 | if (mac_ctx->roam.configParam.cc_switch_mode |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 6906 | != QDF_MCC_TO_SCC_SWITCH_DISABLE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6907 | csr_roam_copy_ht_profile(dst_profile, src_profile); |
| 6908 | #endif |
| 6909 | csr_roam_call_callback(mac_ctx, session_id, &roam_info, |
| 6910 | cmd->u.roamCmd.roamId, |
| 6911 | roam_status, roam_result); |
| 6912 | } |
| 6913 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6914 | } |
| 6915 | |
| 6916 | /** |
| 6917 | * csr_roam_process_join_res() - Process the Join results |
| 6918 | * @mac_ctx: Global MAC Context |
| 6919 | * @result: Result after the command was processed |
| 6920 | * @cmd: Command to be processed |
| 6921 | * @context: Additional data in context of the cmd |
| 6922 | * |
| 6923 | * Process the join results which are obtained in a succesful join |
| 6924 | * |
| 6925 | * Return: None |
| 6926 | */ |
| 6927 | static void csr_roam_process_join_res(tpAniSirGlobal mac_ctx, |
| 6928 | eCsrRoamCompleteResult res, tSmeCmd *cmd, void *context) |
| 6929 | { |
| 6930 | tSirMacAddr bcast_mac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 6931 | sme_QosAssocInfo assoc_info; |
| 6932 | uint32_t key_timeout_interval = 0; |
| 6933 | uint8_t acm_mask = 0; /* HDD needs ACM mask in assoc rsp callback */ |
| 6934 | uint32_t session_id = cmd->sessionId; |
| 6935 | tCsrRoamProfile *profile = &cmd->u.roamCmd.roamProfile; |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 6936 | tCsrRoamSession *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6937 | tSirBssDescription *bss_desc = NULL; |
| 6938 | tCsrScanResult *scan_res = NULL; |
| 6939 | sme_qos_csr_event_indType ind_qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6940 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 6941 | tSirSmeHTProfile *src_profile = NULL; |
| 6942 | tCsrRoamHTProfile *dst_profile = NULL; |
| 6943 | #endif |
| 6944 | tCsrRoamConnectedProfile *conn_profile = NULL; |
| 6945 | tDot11fBeaconIEs *ies_ptr = NULL; |
| 6946 | tCsrRoamInfo roam_info; |
| 6947 | struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info; |
| 6948 | tSirSmeJoinRsp *join_rsp = (tSirSmeJoinRsp *) context; |
| 6949 | uint32_t len; |
| 6950 | |
Nishank Aggarwal | 68d3927 | 2017-05-15 17:05:14 +0530 | [diff] [blame] | 6951 | if (!join_rsp) { |
| 6952 | sme_err("join_rsp is NULL"); |
| 6953 | return; |
| 6954 | } |
| 6955 | |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 6956 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6957 | sme_err("Invalid session id %d", session_id); |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 6958 | return; |
| 6959 | } |
| 6960 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 6961 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6962 | conn_profile = &session->connectedProfile; |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 6963 | if (eCsrReassocSuccess == res) { |
| 6964 | roam_info.reassoc = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6965 | ind_qos = SME_QOS_CSR_REASSOC_COMPLETE; |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 6966 | } else { |
| 6967 | roam_info.reassoc = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6968 | ind_qos = SME_QOS_CSR_ASSOC_COMPLETE; |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 6969 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 6970 | sme_debug("receives association indication"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6971 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6972 | /* always free the memory here */ |
| 6973 | if (session->pWpaRsnRspIE) { |
| 6974 | session->nWpaRsnRspIeLength = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6975 | qdf_mem_free(session->pWpaRsnRspIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6976 | session->pWpaRsnRspIE = NULL; |
| 6977 | } |
| 6978 | #ifdef FEATURE_WLAN_WAPI |
| 6979 | if (session->pWapiRspIE) { |
| 6980 | session->nWapiRspIeLength = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6981 | qdf_mem_free(session->pWapiRspIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6982 | session->pWapiRspIE = NULL; |
| 6983 | } |
| 6984 | #endif /* FEATURE_WLAN_WAPI */ |
| 6985 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6986 | session->maxRetryCount = 0; |
| 6987 | csr_roam_stop_join_retry_timer(mac_ctx, session_id); |
| 6988 | #endif |
| 6989 | /* |
| 6990 | * Reset remain_in_power_active_till_dhcp as |
| 6991 | * it might have been set by last failed secured connection. |
| 6992 | * It should be set only for secured connection. |
| 6993 | */ |
| 6994 | ps_global_info->remain_in_power_active_till_dhcp = false; |
| 6995 | if (CSR_IS_INFRASTRUCTURE(profile)) |
| 6996 | session->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 6997 | else |
| 6998 | session->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED; |
| 6999 | /* |
| 7000 | * Use the last connected bssdesc for reassoc-ing to the same AP. |
| 7001 | * NOTE: What to do when reassoc to a different AP??? |
| 7002 | */ |
| 7003 | if ((eCsrHddIssuedReassocToSameAP == cmd->u.roamCmd.roamReason) |
| 7004 | || (eCsrSmeIssuedReassocToSameAP == |
| 7005 | cmd->u.roamCmd.roamReason)) { |
| 7006 | bss_desc = session->pConnectBssDesc; |
| 7007 | if (bss_desc) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7008 | qdf_mem_copy(&roam_info.bssid, &bss_desc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7009 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7010 | } else { |
| 7011 | if (cmd->u.roamCmd.pRoamBssEntry) { |
| 7012 | scan_res = GET_BASE_ADDR(cmd->u.roamCmd.pRoamBssEntry, |
| 7013 | tCsrScanResult, Link); |
| 7014 | if (scan_res != NULL) { |
| 7015 | bss_desc = &scan_res->Result.BssDescriptor; |
| 7016 | ies_ptr = (tDot11fBeaconIEs *) |
| 7017 | (scan_res->Result.pvIes); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7018 | qdf_mem_copy(&roam_info.bssid, &bss_desc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7019 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7020 | } |
| 7021 | } |
| 7022 | } |
| 7023 | if (bss_desc) { |
| 7024 | roam_info.staId = STA_INVALID_IDX; |
| 7025 | csr_roam_save_connected_infomation(mac_ctx, session_id, |
| 7026 | profile, bss_desc, ies_ptr); |
| 7027 | /* Save WPA/RSN IE */ |
| 7028 | csr_roam_save_security_rsp_ie(mac_ctx, session_id, |
| 7029 | profile->negotiatedAuthType, bss_desc, ies_ptr); |
| 7030 | #ifdef FEATURE_WLAN_ESE |
| 7031 | roam_info.isESEAssoc = conn_profile->isESEAssoc; |
| 7032 | #endif |
| 7033 | |
| 7034 | /* |
| 7035 | * csr_roam_state_change also affects sub-state. |
| 7036 | * Hence, csr_roam_state_change happens first and then |
| 7037 | * substate change. |
| 7038 | * Moving even save profile above so that below |
| 7039 | * mentioned conditon is also met. |
| 7040 | * JEZ100225: Moved to after saving the profile. |
| 7041 | * Fix needed in main/latest |
| 7042 | */ |
| 7043 | csr_roam_state_change(mac_ctx, |
| 7044 | eCSR_ROAMING_STATE_JOINED, session_id); |
| 7045 | |
| 7046 | /* |
| 7047 | * Make sure the Set Context is issued before link |
| 7048 | * indication to NDIS. After link indication is |
| 7049 | * made to NDIS, frames could start flowing. |
| 7050 | * If we have not set context with LIM, the frames |
| 7051 | * will be dropped for the security context may not |
| 7052 | * be set properly. |
| 7053 | * |
| 7054 | * this was causing issues in the 2c_wlan_wep WHQL test |
| 7055 | * when the SetContext was issued after the link |
| 7056 | * indication. (Link Indication happens in the |
| 7057 | * profFSMSetConnectedInfra call). |
| 7058 | * |
| 7059 | * this reordering was done on titan_prod_usb branch |
| 7060 | * and is being replicated here. |
| 7061 | */ |
| 7062 | |
| 7063 | if (CSR_IS_ENC_TYPE_STATIC |
| 7064 | (profile->negotiatedUCEncryptionType) && |
| 7065 | !profile->bWPSAssociation) { |
| 7066 | /* |
| 7067 | * Issue the set Context request to LIM to establish |
| 7068 | * the Unicast STA context |
| 7069 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7070 | if (!QDF_IS_STATUS_SUCCESS( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7071 | csr_roam_issue_set_context_req(mac_ctx, |
| 7072 | session_id, |
| 7073 | profile->negotiatedUCEncryptionType, |
| 7074 | bss_desc, &(bss_desc->bssId), |
| 7075 | false, true, |
| 7076 | eSIR_TX_RX, 0, 0, NULL, 0))) { |
| 7077 | /* NO keys. these key parameters don't matter */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7078 | sme_err("Set context for unicast fail"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7079 | csr_roam_substate_change(mac_ctx, |
| 7080 | eCSR_ROAM_SUBSTATE_NONE, session_id); |
| 7081 | } |
| 7082 | /* |
| 7083 | * Issue the set Context request to LIM |
| 7084 | * to establish the Broadcast STA context |
| 7085 | * NO keys. these key parameters don't matter |
| 7086 | */ |
| 7087 | csr_roam_issue_set_context_req(mac_ctx, session_id, |
| 7088 | profile->negotiatedMCEncryptionType, |
| 7089 | bss_desc, &bcast_mac, false, false, |
| 7090 | eSIR_TX_RX, 0, 0, NULL, 0); |
| 7091 | } else { |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 7092 | /* Need to wait for supplicant authtication */ |
| 7093 | roam_info.fAuthRequired = true; |
| 7094 | /* |
| 7095 | * Set the substate to WaitForKey in case |
| 7096 | * authentiation is needed |
| 7097 | */ |
| 7098 | csr_roam_substate_change(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7099 | eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, |
| 7100 | session_id); |
| 7101 | |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 7102 | /* |
| 7103 | * Set remain_in_power_active_till_dhcp to make |
| 7104 | * sure we wait for until keys are set before |
| 7105 | * going into BMPS. |
| 7106 | */ |
| 7107 | ps_global_info->remain_in_power_active_till_dhcp |
| 7108 | = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7109 | |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 7110 | if (profile->bWPSAssociation) |
| 7111 | key_timeout_interval = |
| 7112 | CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD; |
| 7113 | else |
| 7114 | key_timeout_interval = |
| 7115 | CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7116 | |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 7117 | /* Save session_id in case of timeout */ |
| 7118 | mac_ctx->roam.WaitForKeyTimerInfo.sessionId = |
| 7119 | (uint8_t) session_id; |
| 7120 | /* |
| 7121 | * This time should be long enough for the rest |
| 7122 | * of the process plus setting key |
| 7123 | */ |
| 7124 | if (!QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7125 | (csr_roam_start_wait_for_key_timer( |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 7126 | mac_ctx, key_timeout_interval)) |
| 7127 | ) { |
| 7128 | /* Reset state so nothing is blocked. */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7129 | sme_err("Failed preauth timer start"); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 7130 | csr_roam_substate_change(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7131 | eCSR_ROAM_SUBSTATE_NONE, |
| 7132 | session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7133 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7134 | } |
| 7135 | |
| 7136 | assoc_info.pBssDesc = bss_desc; /* could be NULL */ |
| 7137 | assoc_info.pProfile = profile; |
| 7138 | if (context) { |
| 7139 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 7140 | if (session->roam_synch_in_progress) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7141 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 7142 | QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7143 | FL("LFR3:Clear Connected info")); |
| 7144 | #endif |
| 7145 | csr_roam_free_connected_info(mac_ctx, |
| 7146 | &session->connectedInfo); |
| 7147 | len = join_rsp->assocReqLength + |
| 7148 | join_rsp->assocRspLength + |
| 7149 | join_rsp->beaconLength; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7150 | len += join_rsp->parsedRicRspLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7151 | #ifdef FEATURE_WLAN_ESE |
| 7152 | len += join_rsp->tspecIeLen; |
| 7153 | #endif |
| 7154 | if (len) { |
| 7155 | session->connectedInfo.pbFrames = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7156 | qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7157 | if (session->connectedInfo.pbFrames != |
| 7158 | NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7159 | qdf_mem_copy( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7160 | session->connectedInfo.pbFrames, |
| 7161 | join_rsp->frames, len); |
| 7162 | session->connectedInfo.nAssocReqLength = |
| 7163 | join_rsp->assocReqLength; |
| 7164 | session->connectedInfo.nAssocRspLength = |
| 7165 | join_rsp->assocRspLength; |
| 7166 | session->connectedInfo.nBeaconLength = |
| 7167 | join_rsp->beaconLength; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7168 | session->connectedInfo.nRICRspLength = |
| 7169 | join_rsp->parsedRicRspLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7170 | #ifdef FEATURE_WLAN_ESE |
| 7171 | session->connectedInfo.nTspecIeLength = |
| 7172 | join_rsp->tspecIeLen; |
| 7173 | #endif |
| 7174 | roam_info.nAssocReqLength = |
| 7175 | join_rsp->assocReqLength; |
| 7176 | roam_info.nAssocRspLength = |
| 7177 | join_rsp->assocRspLength; |
| 7178 | roam_info.nBeaconLength = |
| 7179 | join_rsp->beaconLength; |
| 7180 | roam_info.pbFrames = |
| 7181 | session->connectedInfo.pbFrames; |
| 7182 | } |
| 7183 | } |
| 7184 | if (cmd->u.roamCmd.fReassoc) |
| 7185 | roam_info.fReassocReq = |
| 7186 | roam_info.fReassocRsp = true; |
| 7187 | conn_profile->vht_channel_width = |
| 7188 | join_rsp->vht_channel_width; |
| 7189 | session->connectedInfo.staId = |
| 7190 | (uint8_t) join_rsp->staId; |
| 7191 | roam_info.staId = (uint8_t) join_rsp->staId; |
| 7192 | roam_info.ucastSig = (uint8_t) join_rsp->ucastSig; |
| 7193 | roam_info.bcastSig = (uint8_t) join_rsp->bcastSig; |
| 7194 | roam_info.timingMeasCap = join_rsp->timingMeasCap; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 7195 | roam_info.chan_info.nss = join_rsp->nss; |
| 7196 | roam_info.chan_info.rate_flags = |
| 7197 | join_rsp->max_rate_flags; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7198 | #ifdef FEATURE_WLAN_TDLS |
| 7199 | roam_info.tdls_prohibited = join_rsp->tdls_prohibited; |
| 7200 | roam_info.tdls_chan_swit_prohibited = |
| 7201 | join_rsp->tdls_chan_swit_prohibited; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7202 | sme_debug("tdls:prohibit: %d chan_swit_prohibit: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7203 | roam_info.tdls_prohibited, |
| 7204 | roam_info.tdls_chan_swit_prohibited); |
| 7205 | #endif |
| 7206 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 7207 | src_profile = &join_rsp->HTProfile; |
| 7208 | dst_profile = &conn_profile->HTProfile; |
| 7209 | if (mac_ctx->roam.configParam.cc_switch_mode |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 7210 | != QDF_MCC_TO_SCC_SWITCH_DISABLE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7211 | csr_roam_copy_ht_profile(dst_profile, |
| 7212 | src_profile); |
| 7213 | #endif |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 7214 | roam_info.vht_caps = join_rsp->vht_caps; |
| 7215 | roam_info.ht_caps = join_rsp->ht_caps; |
| 7216 | roam_info.hs20vendor_ie = join_rsp->hs20vendor_ie; |
| 7217 | roam_info.ht_operation = join_rsp->ht_operation; |
| 7218 | roam_info.vht_operation = join_rsp->vht_operation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7219 | } else { |
| 7220 | if (cmd->u.roamCmd.fReassoc) { |
| 7221 | roam_info.fReassocReq = |
| 7222 | roam_info.fReassocRsp = true; |
| 7223 | roam_info.nAssocReqLength = |
| 7224 | session->connectedInfo.nAssocReqLength; |
| 7225 | roam_info.nAssocRspLength = |
| 7226 | session->connectedInfo.nAssocRspLength; |
| 7227 | roam_info.nBeaconLength = |
| 7228 | session->connectedInfo.nBeaconLength; |
| 7229 | roam_info.pbFrames = |
| 7230 | session->connectedInfo.pbFrames; |
| 7231 | } |
| 7232 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7233 | /* |
| 7234 | * Update the staId from the previous connected profile info |
| 7235 | * as the reassociation is triggred at SME/HDD |
| 7236 | */ |
| 7237 | |
| 7238 | if ((eCsrHddIssuedReassocToSameAP == |
| 7239 | cmd->u.roamCmd.roamReason) || |
| 7240 | (eCsrSmeIssuedReassocToSameAP == |
| 7241 | cmd->u.roamCmd.roamReason)) |
| 7242 | roam_info.staId = session->connectedInfo.staId; |
| 7243 | |
| 7244 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 7245 | /* |
| 7246 | * Indicate SME-QOS with reassoc success event, |
| 7247 | * only after copying the frames |
| 7248 | */ |
| 7249 | sme_qos_csr_event_ind(mac_ctx, (uint8_t) session_id, ind_qos, |
| 7250 | &assoc_info); |
| 7251 | #endif |
| 7252 | roam_info.pBssDesc = bss_desc; |
| 7253 | roam_info.statusCode = |
| 7254 | session->joinFailStatusCode.statusCode; |
| 7255 | roam_info.reasonCode = |
| 7256 | session->joinFailStatusCode.reasonCode; |
| 7257 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 7258 | acm_mask = sme_qos_get_acm_mask(mac_ctx, bss_desc, NULL); |
| 7259 | #endif |
| 7260 | conn_profile->acm_mask = acm_mask; |
| 7261 | /* |
| 7262 | * start UAPSD if uapsd_mask is not 0 because HDD will |
| 7263 | * configure for trigger frame It may be better to let QoS do |
| 7264 | * this???? |
| 7265 | */ |
| 7266 | if (conn_profile->modifyProfileFields.uapsd_mask) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7267 | sme_err( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7268 | " uapsd_mask (0x%X) set, request UAPSD now", |
| 7269 | conn_profile->modifyProfileFields.uapsd_mask); |
| 7270 | sme_ps_start_uapsd(mac_ctx, session_id, |
| 7271 | NULL, NULL); |
| 7272 | } |
| 7273 | conn_profile->dot11Mode = session->bssParams.uCfgDot11Mode; |
| 7274 | roam_info.u.pConnectedProfile = conn_profile; |
| 7275 | |
| 7276 | if (session->bRefAssocStartCnt > 0) { |
| 7277 | session->bRefAssocStartCnt--; |
| 7278 | if (!IS_FEATURE_SUPPORTED_BY_FW |
| 7279 | (SLM_SESSIONIZATION) && |
| 7280 | (csr_is_concurrent_session_running(mac_ctx))) { |
| 7281 | mac_ctx->roam.configParam.doBMPSWorkaround = 1; |
| 7282 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7283 | csr_roam_call_callback(mac_ctx, session_id, &roam_info, |
| 7284 | cmd->u.roamCmd.roamId, |
| 7285 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 7286 | eCSR_ROAM_RESULT_ASSOCIATED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7287 | } |
| 7288 | |
| 7289 | csr_roam_completion(mac_ctx, session_id, NULL, cmd, |
| 7290 | eCSR_ROAM_RESULT_NONE, true); |
| 7291 | csr_reset_pmkid_candidate_list(mac_ctx, session_id); |
| 7292 | #ifdef FEATURE_WLAN_WAPI |
| 7293 | csr_reset_bkid_candidate_list(mac_ctx, session_id); |
| 7294 | #endif |
| 7295 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7296 | sme_warn("Roam command doesn't have a BSS desc"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7297 | } |
| 7298 | /* Not to signal link up because keys are yet to be set. |
| 7299 | * The linkup function will overwrite the sub-state that |
| 7300 | * we need to keep at this point. |
| 7301 | */ |
| 7302 | if (!CSR_IS_WAIT_FOR_KEY(mac_ctx, session_id)) { |
| 7303 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 7304 | if (session->roam_synch_in_progress) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7305 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 7306 | QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7307 | FL |
| 7308 | ("NO CSR_IS_WAIT_FOR_KEY -> csr_roam_link_up")); |
| 7309 | } |
| 7310 | #endif |
| 7311 | csr_roam_link_up(mac_ctx, conn_profile->bssid); |
| 7312 | } |
| 7313 | } |
| 7314 | |
| 7315 | /** |
| 7316 | * csr_roam_process_results() - Process the Roam Results |
| 7317 | * @mac_ctx: Global MAC Context |
| 7318 | * @cmd: Command that has been processed |
| 7319 | * @res: Results available after processing the command |
| 7320 | * @context: Context |
| 7321 | * |
| 7322 | * Process the available results and make an appropriate decision |
| 7323 | * |
| 7324 | * Return: true if the command can be released, else not. |
| 7325 | */ |
| 7326 | static bool csr_roam_process_results(tpAniSirGlobal mac_ctx, tSmeCmd *cmd, |
| 7327 | eCsrRoamCompleteResult res, void *context) |
| 7328 | { |
| 7329 | bool release_cmd = true; |
| 7330 | tSirBssDescription *bss_desc = NULL; |
| 7331 | tCsrRoamInfo roam_info; |
| 7332 | uint32_t session_id = cmd->sessionId; |
| 7333 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); |
| 7334 | tCsrRoamProfile *profile = &cmd->u.roamCmd.roamProfile; |
| 7335 | eRoamCmdStatus roam_status; |
| 7336 | eCsrRoamResult roam_result; |
| 7337 | host_log_ibss_pkt_type *ibss_log; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 7338 | tSirSmeStartBssRsp *start_bss_rsp = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7339 | |
| 7340 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7341 | sme_err("session %d not found ", session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7342 | return false; |
| 7343 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7344 | |
| 7345 | sme_debug("Processing ROAM results..."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7346 | switch (res) { |
| 7347 | case eCsrJoinSuccess: |
| 7348 | case eCsrReassocSuccess: |
| 7349 | csr_roam_process_join_res(mac_ctx, res, cmd, context); |
| 7350 | break; |
| 7351 | case eCsrStartBssSuccess: |
| 7352 | csr_roam_process_start_bss_success(mac_ctx, cmd, context); |
| 7353 | break; |
| 7354 | case eCsrStartBssFailure: |
| 7355 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7356 | WLAN_HOST_DIAG_LOG_ALLOC(ibss_log, |
| 7357 | host_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 7358 | if (ibss_log) { |
| 7359 | ibss_log->status = WLAN_IBSS_STATUS_FAILURE; |
| 7360 | WLAN_HOST_DIAG_LOG_REPORT(ibss_log); |
| 7361 | } |
| 7362 | #endif |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 7363 | start_bss_rsp = (tSirSmeStartBssRsp *)context; |
| 7364 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7365 | roam_status = eCSR_ROAM_IBSS_IND; |
| 7366 | roam_result = eCSR_ROAM_RESULT_IBSS_STARTED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7367 | if (CSR_IS_INFRA_AP(profile)) { |
| 7368 | roam_status = eCSR_ROAM_INFRA_IND; |
| 7369 | roam_result = eCSR_ROAM_RESULT_INFRA_START_FAILED; |
| 7370 | } |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 7371 | if (CSR_IS_NDI(profile)) { |
| 7372 | csr_roam_update_ndp_return_params(mac_ctx, |
| 7373 | eCsrStartBssFailure, |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 7374 | &roam_status, &roam_result, &roam_info); |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 7375 | } |
| 7376 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7377 | if (context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7378 | bss_desc = (tSirBssDescription *) context; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7379 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7380 | bss_desc = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7381 | roam_info.pBssDesc = bss_desc; |
| 7382 | csr_roam_call_callback(mac_ctx, session_id, &roam_info, |
| 7383 | cmd->u.roamCmd.roamId, roam_status, |
| 7384 | roam_result); |
| 7385 | csr_set_default_dot11_mode(mac_ctx); |
| 7386 | break; |
| 7387 | case eCsrSilentlyStopRoaming: |
| 7388 | /* |
| 7389 | * We are here because we try to start the same IBSS. |
| 7390 | * No message to PE. return the roaming state to Joined. |
| 7391 | */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7392 | sme_debug("receives silently stop roam ind"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7393 | csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_JOINED, |
| 7394 | session_id); |
| 7395 | csr_roam_substate_change(mac_ctx, eCSR_ROAM_SUBSTATE_NONE, |
| 7396 | session_id); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7397 | qdf_mem_set(&roam_info, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7398 | roam_info.pBssDesc = session->pConnectBssDesc; |
| 7399 | if (roam_info.pBssDesc) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7400 | qdf_mem_copy(&roam_info.bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7401 | &roam_info.pBssDesc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7402 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7403 | /* |
| 7404 | * Since there is no change in the current state, simply pass |
| 7405 | * back no result otherwise HDD may be mistakenly mark to |
| 7406 | * disconnected state. |
| 7407 | */ |
| 7408 | csr_roam_call_callback(mac_ctx, session_id, &roam_info, |
| 7409 | cmd->u.roamCmd.roamId, |
| 7410 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE); |
| 7411 | break; |
| 7412 | case eCsrSilentlyStopRoamingSaveState: |
| 7413 | /* We are here because we try to connect to the same AP */ |
| 7414 | /* No message to PE */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7415 | sme_debug("receives silently stop roaming indication"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7416 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7417 | |
| 7418 | /* to aviod resetting the substate to NONE */ |
| 7419 | mac_ctx->roam.curState[session_id] = eCSR_ROAMING_STATE_JOINED; |
| 7420 | /* |
| 7421 | * No need to change substate to wai_for_key because there |
| 7422 | * is no state change |
| 7423 | */ |
| 7424 | roam_info.pBssDesc = session->pConnectBssDesc; |
| 7425 | if (roam_info.pBssDesc) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7426 | qdf_mem_copy(&roam_info.bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7427 | &roam_info.pBssDesc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7428 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7429 | roam_info.statusCode = session->joinFailStatusCode.statusCode; |
| 7430 | roam_info.reasonCode = session->joinFailStatusCode.reasonCode; |
| 7431 | roam_info.nBeaconLength = session->connectedInfo.nBeaconLength; |
| 7432 | roam_info.nAssocReqLength = |
| 7433 | session->connectedInfo.nAssocReqLength; |
| 7434 | roam_info.nAssocRspLength = |
| 7435 | session->connectedInfo.nAssocRspLength; |
| 7436 | roam_info.pbFrames = session->connectedInfo.pbFrames; |
| 7437 | roam_info.staId = session->connectedInfo.staId; |
| 7438 | roam_info.u.pConnectedProfile = &session->connectedProfile; |
Abhishek Singh | acfdc92 | 2015-12-30 17:31:21 +0530 | [diff] [blame] | 7439 | if (0 == roam_info.staId) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 7440 | QDF_ASSERT(0); |
Abhishek Singh | acfdc92 | 2015-12-30 17:31:21 +0530 | [diff] [blame] | 7441 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7442 | session->bRefAssocStartCnt--; |
| 7443 | csr_roam_call_callback(mac_ctx, session_id, &roam_info, |
| 7444 | cmd->u.roamCmd.roamId, |
| 7445 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 7446 | eCSR_ROAM_RESULT_ASSOCIATED); |
| 7447 | csr_roam_completion(mac_ctx, session_id, NULL, cmd, |
| 7448 | eCSR_ROAM_RESULT_ASSOCIATED, true); |
| 7449 | break; |
| 7450 | case eCsrReassocFailure: |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 7451 | /* |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7452 | * Currently Reassoc failure is handled through eCsrJoinFailure |
| 7453 | * Need to revisit for eCsrReassocFailure handling |
| 7454 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7455 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 7456 | sme_qos_csr_event_ind(mac_ctx, (uint8_t) session_id, |
| 7457 | SME_QOS_CSR_REASSOC_FAILURE, NULL); |
| 7458 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7459 | break; |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 7460 | case eCsrStopBssSuccess: |
| 7461 | if (CSR_IS_NDI(profile)) { |
| 7462 | csr_roam_update_ndp_return_params(mac_ctx, res, |
| 7463 | &roam_status, &roam_result, &roam_info); |
| 7464 | csr_roam_call_callback(mac_ctx, session_id, &roam_info, |
| 7465 | cmd->u.roamCmd.roamId, |
| 7466 | roam_status, roam_result); |
| 7467 | } |
| 7468 | break; |
| 7469 | case eCsrStopBssFailure: |
| 7470 | if (CSR_IS_NDI(profile)) { |
| 7471 | csr_roam_update_ndp_return_params(mac_ctx, res, |
| 7472 | &roam_status, &roam_result, &roam_info); |
| 7473 | csr_roam_call_callback(mac_ctx, session_id, &roam_info, |
| 7474 | cmd->u.roamCmd.roamId, |
| 7475 | roam_status, roam_result); |
| 7476 | } |
| 7477 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7478 | case eCsrJoinFailure: |
| 7479 | case eCsrNothingToJoin: |
| 7480 | case eCsrJoinFailureDueToConcurrency: |
| 7481 | default: |
| 7482 | csr_roam_process_results_default(mac_ctx, cmd, context, res); |
| 7483 | break; |
| 7484 | } |
| 7485 | return release_cmd; |
| 7486 | } |
| 7487 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7488 | QDF_STATUS csr_roam_copy_profile(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7489 | tCsrRoamProfile *pDstProfile, |
| 7490 | tCsrRoamProfile *pSrcProfile) |
| 7491 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7492 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7493 | uint32_t size = 0; |
| 7494 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7495 | qdf_mem_set(pDstProfile, sizeof(tCsrRoamProfile), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7496 | if (pSrcProfile->BSSIDs.numOfBSSIDs) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7497 | size = sizeof(struct qdf_mac_addr) * pSrcProfile->BSSIDs. |
| 7498 | numOfBSSIDs; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7499 | pDstProfile->BSSIDs.bssid = qdf_mem_malloc(size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7500 | if (NULL == pDstProfile->BSSIDs.bssid) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7501 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7502 | goto end; |
| 7503 | } |
| 7504 | pDstProfile->BSSIDs.numOfBSSIDs = |
| 7505 | pSrcProfile->BSSIDs.numOfBSSIDs; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7506 | qdf_mem_copy(pDstProfile->BSSIDs.bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7507 | pSrcProfile->BSSIDs.bssid, size); |
| 7508 | } |
| 7509 | if (pSrcProfile->SSIDs.numOfSSIDs) { |
| 7510 | size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7511 | pDstProfile->SSIDs.SSIDList = qdf_mem_malloc(size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7512 | if (NULL == pDstProfile->SSIDs.SSIDList) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7513 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7514 | goto end; |
| 7515 | } |
| 7516 | pDstProfile->SSIDs.numOfSSIDs = |
| 7517 | pSrcProfile->SSIDs.numOfSSIDs; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7518 | qdf_mem_copy(pDstProfile->SSIDs.SSIDList, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7519 | pSrcProfile->SSIDs.SSIDList, size); |
| 7520 | } |
| 7521 | if (pSrcProfile->nWPAReqIELength) { |
| 7522 | pDstProfile->pWPAReqIE = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7523 | qdf_mem_malloc(pSrcProfile->nWPAReqIELength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7524 | if (NULL == pDstProfile->pWPAReqIE) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7525 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7526 | goto end; |
| 7527 | } |
| 7528 | pDstProfile->nWPAReqIELength = |
| 7529 | pSrcProfile->nWPAReqIELength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7530 | qdf_mem_copy(pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7531 | pSrcProfile->nWPAReqIELength); |
| 7532 | } |
| 7533 | if (pSrcProfile->nRSNReqIELength) { |
| 7534 | pDstProfile->pRSNReqIE = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7535 | qdf_mem_malloc(pSrcProfile->nRSNReqIELength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7536 | if (NULL == pDstProfile->pRSNReqIE) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7537 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7538 | goto end; |
| 7539 | } |
| 7540 | pDstProfile->nRSNReqIELength = |
| 7541 | pSrcProfile->nRSNReqIELength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7542 | qdf_mem_copy(pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7543 | pSrcProfile->nRSNReqIELength); |
| 7544 | } |
| 7545 | #ifdef FEATURE_WLAN_WAPI |
| 7546 | if (pSrcProfile->nWAPIReqIELength) { |
| 7547 | pDstProfile->pWAPIReqIE = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7548 | qdf_mem_malloc(pSrcProfile->nWAPIReqIELength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7549 | if (NULL == pDstProfile->pWAPIReqIE) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7550 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7551 | goto end; |
| 7552 | } |
| 7553 | pDstProfile->nWAPIReqIELength = |
| 7554 | pSrcProfile->nWAPIReqIELength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7555 | qdf_mem_copy(pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7556 | pSrcProfile->nWAPIReqIELength); |
| 7557 | } |
| 7558 | #endif /* FEATURE_WLAN_WAPI */ |
| 7559 | if (pSrcProfile->nAddIEScanLength) { |
| 7560 | pDstProfile->pAddIEScan = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7561 | qdf_mem_malloc(pSrcProfile->nAddIEScanLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7562 | if (NULL == pDstProfile->pAddIEScan) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7563 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7564 | goto end; |
| 7565 | } |
| 7566 | pDstProfile->nAddIEScanLength = |
| 7567 | pSrcProfile->nAddIEScanLength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7568 | qdf_mem_copy(pDstProfile->pAddIEScan, pSrcProfile->pAddIEScan, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7569 | pSrcProfile->nAddIEScanLength); |
| 7570 | } |
| 7571 | if (pSrcProfile->nAddIEAssocLength) { |
| 7572 | pDstProfile->pAddIEAssoc = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7573 | qdf_mem_malloc(pSrcProfile->nAddIEAssocLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7574 | if (NULL == pDstProfile->pAddIEAssoc) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7575 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7576 | goto end; |
| 7577 | } |
| 7578 | pDstProfile->nAddIEAssocLength = |
| 7579 | pSrcProfile->nAddIEAssocLength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7580 | qdf_mem_copy(pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7581 | pSrcProfile->nAddIEAssocLength); |
| 7582 | } |
| 7583 | if (pSrcProfile->ChannelInfo.ChannelList) { |
| 7584 | pDstProfile->ChannelInfo.ChannelList = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7585 | qdf_mem_malloc(pSrcProfile->ChannelInfo. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7586 | numOfChannels); |
| 7587 | if (NULL == pDstProfile->ChannelInfo.ChannelList) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7588 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7589 | goto end; |
| 7590 | } |
| 7591 | pDstProfile->ChannelInfo.numOfChannels = |
| 7592 | pSrcProfile->ChannelInfo.numOfChannels; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7593 | qdf_mem_copy(pDstProfile->ChannelInfo.ChannelList, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7594 | pSrcProfile->ChannelInfo.ChannelList, |
| 7595 | pSrcProfile->ChannelInfo.numOfChannels); |
| 7596 | } |
| 7597 | pDstProfile->AuthType = pSrcProfile->AuthType; |
| 7598 | pDstProfile->EncryptionType = pSrcProfile->EncryptionType; |
| 7599 | pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType; |
| 7600 | pDstProfile->negotiatedUCEncryptionType = |
| 7601 | pSrcProfile->negotiatedUCEncryptionType; |
| 7602 | pDstProfile->negotiatedMCEncryptionType = |
| 7603 | pSrcProfile->negotiatedMCEncryptionType; |
| 7604 | pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType; |
| 7605 | #ifdef WLAN_FEATURE_11W |
| 7606 | pDstProfile->MFPEnabled = pSrcProfile->MFPEnabled; |
| 7607 | pDstProfile->MFPRequired = pSrcProfile->MFPRequired; |
| 7608 | pDstProfile->MFPCapable = pSrcProfile->MFPCapable; |
| 7609 | #endif |
| 7610 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 7611 | pDstProfile->phyMode = pSrcProfile->phyMode; |
| 7612 | pDstProfile->csrPersona = pSrcProfile->csrPersona; |
| 7613 | |
| 7614 | #ifdef FEATURE_WLAN_WAPI |
| 7615 | if (csr_is_profile_wapi(pSrcProfile)) |
| 7616 | if (pDstProfile->phyMode & eCSR_DOT11_MODE_11n) |
| 7617 | pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 7618 | #endif /* FEATURE_WLAN_WAPI */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7619 | pDstProfile->ch_params.ch_width = pSrcProfile->ch_params.ch_width; |
| 7620 | pDstProfile->ch_params.center_freq_seg0 = |
| 7621 | pSrcProfile->ch_params.center_freq_seg0; |
| 7622 | pDstProfile->ch_params.center_freq_seg1 = |
| 7623 | pSrcProfile->ch_params.center_freq_seg1; |
| 7624 | pDstProfile->ch_params.sec_ch_offset = |
| 7625 | pSrcProfile->ch_params.sec_ch_offset; |
| 7626 | /*Save the WPS info */ |
| 7627 | pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation; |
| 7628 | pDstProfile->bOSENAssociation = pSrcProfile->bOSENAssociation; |
| 7629 | pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask; |
| 7630 | pDstProfile->beaconInterval = pSrcProfile->beaconInterval; |
| 7631 | pDstProfile->privacy = pSrcProfile->privacy; |
| 7632 | pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq; |
| 7633 | pDstProfile->csr80211AuthType = pSrcProfile->csr80211AuthType; |
| 7634 | pDstProfile->dtimPeriod = pSrcProfile->dtimPeriod; |
| 7635 | pDstProfile->ApUapsdEnable = pSrcProfile->ApUapsdEnable; |
| 7636 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = |
| 7637 | pSrcProfile->SSIDs.SSIDList[0].ssidHidden; |
| 7638 | pDstProfile->protEnabled = pSrcProfile->protEnabled; |
| 7639 | pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled; |
| 7640 | pDstProfile->cfg_protection = pSrcProfile->cfg_protection; |
| 7641 | pDstProfile->wps_state = pSrcProfile->wps_state; |
| 7642 | pDstProfile->ieee80211d = pSrcProfile->ieee80211d; |
| 7643 | pDstProfile->sap_dot11mc = pSrcProfile->sap_dot11mc; |
Sreelakshmi Konamki | bda5bbf | 2016-09-12 18:38:10 +0530 | [diff] [blame] | 7644 | pDstProfile->do_not_roam = pSrcProfile->do_not_roam; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7645 | qdf_mem_copy(&pDstProfile->Keys, &pSrcProfile->Keys, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7646 | sizeof(pDstProfile->Keys)); |
| 7647 | #ifdef WLAN_FEATURE_11W |
| 7648 | pDstProfile->MFPEnabled = pSrcProfile->MFPEnabled; |
| 7649 | pDstProfile->MFPRequired = pSrcProfile->MFPRequired; |
| 7650 | pDstProfile->MFPCapable = pSrcProfile->MFPCapable; |
| 7651 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7652 | if (pSrcProfile->MDID.mdiePresent) { |
| 7653 | pDstProfile->MDID.mdiePresent = 1; |
| 7654 | pDstProfile->MDID.mobilityDomain = |
| 7655 | pSrcProfile->MDID.mobilityDomain; |
| 7656 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7657 | qdf_mem_copy(&pDstProfile->addIeParams, &pSrcProfile->addIeParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7658 | sizeof(tSirAddIeParams)); |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 7659 | if (pSrcProfile->supported_rates.numRates) { |
| 7660 | qdf_mem_copy(pDstProfile->supported_rates.rate, |
| 7661 | pSrcProfile->supported_rates.rate, |
| 7662 | pSrcProfile->supported_rates.numRates); |
| 7663 | pDstProfile->supported_rates.numRates = |
| 7664 | pSrcProfile->supported_rates.numRates; |
| 7665 | } |
| 7666 | if (pSrcProfile->extended_rates.numRates) { |
| 7667 | qdf_mem_copy(pDstProfile->extended_rates.rate, |
| 7668 | pSrcProfile->extended_rates.rate, |
| 7669 | pSrcProfile->extended_rates.numRates); |
| 7670 | pDstProfile->extended_rates.numRates = |
| 7671 | pSrcProfile->extended_rates.numRates; |
| 7672 | } |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 7673 | pDstProfile->cac_duration_ms = pSrcProfile->cac_duration_ms; |
| 7674 | pDstProfile->dfs_regdomain = pSrcProfile->dfs_regdomain; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7675 | end: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7676 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7677 | csr_release_profile(pMac, pDstProfile); |
| 7678 | pDstProfile = NULL; |
| 7679 | } |
| 7680 | |
| 7681 | return status; |
| 7682 | } |
| 7683 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7684 | QDF_STATUS csr_roam_copy_connected_profile(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7685 | uint32_t sessionId, tCsrRoamProfile *pDstProfile) |
| 7686 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7687 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7688 | tCsrRoamConnectedProfile *pSrcProfile = |
| 7689 | &pMac->roam.roamSession[sessionId].connectedProfile; |
| 7690 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7691 | qdf_mem_set(pDstProfile, sizeof(tCsrRoamProfile), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7692 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7693 | pDstProfile->BSSIDs.bssid = qdf_mem_malloc(sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7694 | if (NULL == pDstProfile->BSSIDs.bssid) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7695 | status = QDF_STATUS_E_NOMEM; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7696 | sme_err("failed to allocate memory for BSSID " |
| 7697 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7698 | MAC_ADDR_ARRAY(pSrcProfile->bssid.bytes)); |
| 7699 | goto end; |
| 7700 | } |
| 7701 | pDstProfile->BSSIDs.numOfBSSIDs = 1; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 7702 | qdf_copy_macaddr(pDstProfile->BSSIDs.bssid, &pSrcProfile->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7703 | |
Yingying Tang | d566107 | 2016-10-20 17:53:01 +0800 | [diff] [blame] | 7704 | if (pSrcProfile->SSID.length > 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7705 | pDstProfile->SSIDs.SSIDList = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7706 | qdf_mem_malloc(sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7707 | if (NULL == pDstProfile->SSIDs.SSIDList) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7708 | status = QDF_STATUS_E_NOMEM; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7709 | sme_err("failed to allocate memory for SSID " |
| 7710 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7711 | MAC_ADDR_ARRAY(pSrcProfile->bssid.bytes)); |
| 7712 | goto end; |
| 7713 | } |
| 7714 | pDstProfile->SSIDs.numOfSSIDs = 1; |
| 7715 | pDstProfile->SSIDs.SSIDList[0].handoffPermitted = |
| 7716 | pSrcProfile->handoffPermitted; |
| 7717 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = |
| 7718 | pSrcProfile->ssidHidden; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7719 | qdf_mem_copy(&pDstProfile->SSIDs.SSIDList[0].SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7720 | &pSrcProfile->SSID, sizeof(tSirMacSSid)); |
| 7721 | } |
| 7722 | if (pSrcProfile->nAddIEAssocLength) { |
| 7723 | pDstProfile->pAddIEAssoc = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7724 | qdf_mem_malloc(pSrcProfile->nAddIEAssocLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7725 | if (NULL == pDstProfile->pAddIEAssoc) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7726 | status = QDF_STATUS_E_NOMEM; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7727 | sme_err("failed to allocate mem for additional ie"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7728 | goto end; |
| 7729 | } |
| 7730 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7731 | qdf_mem_copy(pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7732 | pSrcProfile->nAddIEAssocLength); |
| 7733 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7734 | pDstProfile->ChannelInfo.ChannelList = qdf_mem_malloc(1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7735 | if (NULL == pDstProfile->ChannelInfo.ChannelList) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7736 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7737 | goto end; |
| 7738 | } |
| 7739 | pDstProfile->ChannelInfo.numOfChannels = 1; |
| 7740 | pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel; |
| 7741 | pDstProfile->AuthType.numEntries = 1; |
| 7742 | pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; |
| 7743 | pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; |
| 7744 | pDstProfile->EncryptionType.numEntries = 1; |
| 7745 | pDstProfile->EncryptionType.encryptionType[0] = |
| 7746 | pSrcProfile->EncryptionType; |
| 7747 | pDstProfile->negotiatedUCEncryptionType = |
| 7748 | pSrcProfile->EncryptionType; |
| 7749 | pDstProfile->mcEncryptionType.numEntries = 1; |
| 7750 | pDstProfile->mcEncryptionType.encryptionType[0] = |
| 7751 | pSrcProfile->mcEncryptionType; |
| 7752 | pDstProfile->negotiatedMCEncryptionType = |
| 7753 | pSrcProfile->mcEncryptionType; |
| 7754 | pDstProfile->BSSType = pSrcProfile->BSSType; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 7755 | qdf_mem_copy(&pDstProfile->Keys, &pSrcProfile->Keys, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7756 | sizeof(pDstProfile->Keys)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7757 | if (pSrcProfile->MDID.mdiePresent) { |
| 7758 | pDstProfile->MDID.mdiePresent = 1; |
| 7759 | pDstProfile->MDID.mobilityDomain = |
| 7760 | pSrcProfile->MDID.mobilityDomain; |
| 7761 | } |
Krunal Soni | b2f1304 | 2015-11-02 18:41:08 -0800 | [diff] [blame] | 7762 | #ifdef WLAN_FEATURE_11W |
| 7763 | pDstProfile->MFPEnabled = pSrcProfile->MFPEnabled; |
| 7764 | pDstProfile->MFPRequired = pSrcProfile->MFPRequired; |
| 7765 | pDstProfile->MFPCapable = pSrcProfile->MFPCapable; |
| 7766 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7767 | |
| 7768 | end: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7769 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7770 | csr_release_profile(pMac, pDstProfile); |
| 7771 | pDstProfile = NULL; |
| 7772 | } |
| 7773 | |
| 7774 | return status; |
| 7775 | } |
| 7776 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7777 | QDF_STATUS csr_roam_issue_connect(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7778 | tCsrRoamProfile *pProfile, |
| 7779 | tScanResultHandle hBSSList, |
| 7780 | eCsrRoamReason reason, uint32_t roamId, |
| 7781 | bool fImediate, bool fClearScan) |
| 7782 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7783 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7784 | tSmeCmd *pCommand; |
| 7785 | |
| 7786 | pCommand = csr_get_command_buffer(pMac); |
| 7787 | if (NULL == pCommand) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7788 | sme_err(" fail to get command buffer"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7789 | status = QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7790 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7791 | if (fClearScan) |
| 7792 | csr_scan_abort_mac_scan_not_for_connect(pMac, |
| 7793 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7794 | pCommand->u.roamCmd.fReleaseProfile = false; |
| 7795 | if (NULL == pProfile) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7796 | /* We can roam now |
| 7797 | * Since pProfile is NULL, we need to build our own |
| 7798 | * profile, set everything to default We can only |
| 7799 | * support open and no encryption |
| 7800 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7801 | pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; |
| 7802 | pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = |
| 7803 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 7804 | pCommand->u.roamCmd.roamProfile.EncryptionType. |
| 7805 | numEntries = 1; |
| 7806 | pCommand->u.roamCmd.roamProfile.EncryptionType. |
| 7807 | encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 7808 | pCommand->u.roamCmd.roamProfile.csrPersona = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 7809 | QDF_STA_MODE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7810 | } else { |
| 7811 | /* make a copy of the profile */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7812 | status = csr_roam_copy_profile(pMac, &pCommand->u. |
| 7813 | roamCmd.roamProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7814 | pProfile); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7815 | if (QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7816 | pCommand->u.roamCmd.fReleaseProfile = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7817 | } |
| 7818 | |
| 7819 | pCommand->command = eSmeCommandRoam; |
| 7820 | pCommand->sessionId = (uint8_t) sessionId; |
| 7821 | pCommand->u.roamCmd.hBSSList = hBSSList; |
| 7822 | pCommand->u.roamCmd.roamId = roamId; |
| 7823 | pCommand->u.roamCmd.roamReason = reason; |
| 7824 | /* We need to free the BssList when the command is done */ |
| 7825 | pCommand->u.roamCmd.fReleaseBssList = true; |
| 7826 | pCommand->u.roamCmd.fUpdateCurRoamProfile = true; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7827 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 7828 | FL("CSR PERSONA=%d"), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7829 | pCommand->u.roamCmd.roamProfile.csrPersona); |
| 7830 | status = csr_queue_sme_command(pMac, pCommand, fImediate); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7831 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7832 | sme_err("fail to send message status: %d", status); |
| 7833 | csr_release_command_roam(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7834 | } |
| 7835 | } |
| 7836 | |
| 7837 | return status; |
| 7838 | } |
| 7839 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7840 | QDF_STATUS csr_roam_issue_reassoc(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7841 | tCsrRoamProfile *pProfile, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7842 | tCsrRoamModifyProfileFields |
| 7843 | *pMmodProfileFields, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7844 | eCsrRoamReason reason, uint32_t roamId, |
| 7845 | bool fImediate) |
| 7846 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7847 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7848 | tSmeCmd *pCommand; |
| 7849 | |
| 7850 | pCommand = csr_get_command_buffer(pMac); |
| 7851 | if (NULL == pCommand) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7852 | sme_err("fail to get command buffer"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7853 | status = QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7854 | } else { |
| 7855 | csr_scan_abort_mac_scan_not_for_connect(pMac, sessionId); |
| 7856 | if (pProfile) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7857 | /* This is likely trying to reassoc to |
| 7858 | * different profile |
| 7859 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7860 | pCommand->u.roamCmd.fReleaseProfile = false; |
| 7861 | /* make a copy of the profile */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7862 | status = csr_roam_copy_profile(pMac, &pCommand->u. |
| 7863 | roamCmd.roamProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7864 | pProfile); |
| 7865 | pCommand->u.roamCmd.fUpdateCurRoamProfile = true; |
| 7866 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7867 | status = csr_roam_copy_connected_profile(pMac, |
| 7868 | sessionId, |
| 7869 | &pCommand->u.roamCmd. |
| 7870 | roamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7871 | /* how to update WPA/WPA2 info in roamProfile?? */ |
| 7872 | pCommand->u.roamCmd.roamProfile.uapsd_mask = |
| 7873 | pMmodProfileFields->uapsd_mask; |
| 7874 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7875 | if (QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7876 | pCommand->u.roamCmd.fReleaseProfile = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7877 | pCommand->command = eSmeCommandRoam; |
| 7878 | pCommand->sessionId = (uint8_t) sessionId; |
| 7879 | pCommand->u.roamCmd.roamId = roamId; |
| 7880 | pCommand->u.roamCmd.roamReason = reason; |
| 7881 | /* We need to free the BssList when the command is done */ |
| 7882 | /* For reassoc there is no BSS list, so the bool set to false */ |
| 7883 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 7884 | pCommand->u.roamCmd.fReleaseBssList = false; |
| 7885 | pCommand->u.roamCmd.fReassoc = true; |
| 7886 | csr_roam_remove_duplicate_command(pMac, sessionId, pCommand, |
| 7887 | reason); |
| 7888 | status = csr_queue_sme_command(pMac, pCommand, fImediate); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7889 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7890 | sme_err("fail to send message status = %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7891 | csr_roam_completion(pMac, sessionId, NULL, pCommand, |
| 7892 | eCSR_ROAM_RESULT_FAILURE, false); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 7893 | csr_release_command(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7894 | } |
| 7895 | } |
| 7896 | return status; |
| 7897 | } |
| 7898 | |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 7899 | QDF_STATUS csr_dequeue_roam_command(tpAniSirGlobal pMac, eCsrRoamReason reason, |
| 7900 | uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7901 | { |
| 7902 | tListElem *pEntry; |
| 7903 | tSmeCmd *pCommand; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7904 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 7905 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_LOCK); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7906 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7907 | if (pEntry) { |
| 7908 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7909 | if ((eSmeCommandRoam == pCommand->command) && |
| 7910 | (eCsrPerformPreauth == reason)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7911 | sme_debug("DQ-Command = %d, Reason = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7912 | pCommand->command, |
| 7913 | pCommand->u.roamCmd.roamReason); |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 7914 | if (csr_nonscan_active_ll_remove_entry(pMac, pEntry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7915 | LL_ACCESS_LOCK)) { |
| 7916 | csr_release_command_preauth(pMac, pCommand); |
| 7917 | } |
| 7918 | } else if ((eSmeCommandRoam == pCommand->command) && |
| 7919 | (eCsrSmeIssuedFTReassoc == reason)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7920 | sme_debug("DQ-Command = %d, Reason = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7921 | pCommand->command, |
| 7922 | pCommand->u.roamCmd.roamReason); |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 7923 | if (csr_nonscan_active_ll_remove_entry(pMac, pEntry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7924 | LL_ACCESS_LOCK)) { |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 7925 | csr_release_command(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7926 | } |
| 7927 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7928 | sme_err("Command = %d, Reason = %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7929 | pCommand->command, |
| 7930 | pCommand->u.roamCmd.roamReason); |
| 7931 | } |
| 7932 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7933 | sme_err("pEntry NULL for eWNI_SME_FT_PRE_AUTH_RSP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7934 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7935 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7936 | } |
| 7937 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7938 | QDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7939 | tCsrRoamProfile *pProfile, |
| 7940 | uint32_t *pRoamId) |
| 7941 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7942 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7943 | tScanResultHandle hBSSList; |
| 7944 | tCsrScanResultFilter *pScanFilter; |
| 7945 | uint32_t roamId = 0; |
| 7946 | bool fCallCallback = false; |
| 7947 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Selvaraj, Sridhar | dc2ac8e | 2017-05-12 15:32:45 +0530 | [diff] [blame] | 7948 | tSirBssDescription *first_ap_profile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7949 | |
| 7950 | if (NULL == pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7951 | sme_err("session does not exist for given sessionId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7952 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7953 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7954 | } |
| 7955 | |
| 7956 | if (NULL == pProfile) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7957 | sme_err("No profile specified"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 7958 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7959 | } |
Selvaraj, Sridhar | dc2ac8e | 2017-05-12 15:32:45 +0530 | [diff] [blame] | 7960 | |
| 7961 | first_ap_profile = qdf_mem_malloc(sizeof(*first_ap_profile)); |
| 7962 | if (NULL == first_ap_profile) { |
| 7963 | sme_err("malloc fails for first_ap_profile"); |
| 7964 | return QDF_STATUS_E_NOMEM; |
| 7965 | } |
| 7966 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7967 | /* Initialize the count before proceeding with the Join requests */ |
| 7968 | pSession->join_bssid_count = 0; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 7969 | sme_debug( |
| 7970 | "called BSSType = %s (%d) authtype = %d encryType = %d", |
Rajeev Kumar | 43e25b1 | 2016-04-15 16:26:36 -0700 | [diff] [blame] | 7971 | sme_bss_type_to_string(pProfile->BSSType), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7972 | pProfile->BSSType, pProfile->AuthType.authType[0], |
| 7973 | pProfile->EncryptionType.encryptionType[0]); |
| 7974 | csr_roam_cancel_roaming(pMac, sessionId); |
| 7975 | csr_scan_remove_fresh_scan_command(pMac, sessionId); |
Sandeep Puligilla | df6454a | 2016-10-21 16:10:59 -0700 | [diff] [blame] | 7976 | csr_scan_abort_all_scans(pMac, eCSR_SCAN_ABORT_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7977 | csr_roam_remove_duplicate_command(pMac, sessionId, NULL, eCsrHddIssued); |
| 7978 | /* Check whether ssid changes */ |
| 7979 | if (csr_is_conn_state_connected(pMac, sessionId) && |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7980 | pProfile->SSIDs.numOfSSIDs && !csr_is_ssid_in_list(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7981 | &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7982 | csr_roam_issue_disassociate_cmd(pMac, sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7983 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Abhishek Singh | acfdc92 | 2015-12-30 17:31:21 +0530 | [diff] [blame] | 7984 | /* |
| 7985 | * If roamSession.connectState is disconnecting that mean |
| 7986 | * disconnect was received with scan for ssid in progress |
| 7987 | * and dropped. This state will ensure that connect will |
| 7988 | * not be issued from scan for ssid completion. Thus |
| 7989 | * if this fresh connect also issue scan for ssid the connect |
| 7990 | * command will be dropped assuming disconnect is in progress. |
| 7991 | * Thus reset connectState here |
| 7992 | */ |
| 7993 | if (eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTING == |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 7994 | pMac->roam.roamSession[sessionId].connectState) |
| 7995 | pMac->roam.roamSession[sessionId].connectState = |
| 7996 | eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 7997 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 7998 | pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; |
| 7999 | #endif |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8000 | pScanFilter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8001 | if (NULL == pScanFilter) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8002 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8003 | goto end; |
| 8004 | } |
| 8005 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8006 | /* Try to connect to any BSS */ |
| 8007 | if (NULL == pProfile) { |
| 8008 | /* No encryption */ |
| 8009 | pScanFilter->EncryptionType.numEntries = 1; |
| 8010 | pScanFilter->EncryptionType.encryptionType[0] = |
| 8011 | eCSR_ENCRYPT_TYPE_NONE; |
| 8012 | } else { |
| 8013 | /* Here is the profile we need to connect to */ |
| 8014 | status = csr_roam_prepare_filter_from_profile(pMac, |
| 8015 | pProfile, pScanFilter); |
| 8016 | } |
| 8017 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 8018 | if (pRoamId) |
| 8019 | *pRoamId = roamId; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8020 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8021 | qdf_mem_free(pScanFilter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8022 | goto end; |
| 8023 | } |
| 8024 | |
| 8025 | /*Save the WPS info */ |
| 8026 | if (NULL != pProfile) { |
| 8027 | pScanFilter->bWPSAssociation = |
| 8028 | pProfile->bWPSAssociation; |
| 8029 | pScanFilter->bOSENAssociation = |
| 8030 | pProfile->bOSENAssociation; |
| 8031 | } else { |
| 8032 | pScanFilter->bWPSAssociation = 0; |
| 8033 | pScanFilter->bOSENAssociation = 0; |
| 8034 | } |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 8035 | if (pProfile && CSR_IS_INFRA_AP(pProfile)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8036 | /* This can be started right away */ |
| 8037 | status = csr_roam_issue_connect(pMac, sessionId, pProfile, NULL, |
| 8038 | eCsrHddIssued, roamId, false, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8039 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8040 | sme_err("CSR failed to issue start BSS cmd with status: 0x%08X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8041 | status); |
| 8042 | fCallCallback = true; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8043 | } else |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8044 | sme_debug("Connect request to proceed for sap mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8045 | |
| 8046 | csr_free_scan_filter(pMac, pScanFilter); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8047 | qdf_mem_free(pScanFilter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8048 | goto end; |
| 8049 | } |
| 8050 | status = csr_scan_get_result(pMac, pScanFilter, &hBSSList); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8051 | sme_debug("csr_scan_get_result Status: %d", status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8052 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8053 | /* check if set hw mode needs to be done */ |
Krunal Soni | 3091bcc | 2016-06-23 12:28:21 -0700 | [diff] [blame] | 8054 | if ((pScanFilter->csrPersona == QDF_STA_MODE) || |
| 8055 | (pScanFilter->csrPersona == QDF_P2P_CLIENT_MODE)) { |
Ajit Pal Singh | 64aff0c | 2017-06-20 16:35:26 +0530 | [diff] [blame] | 8056 | bool ok; |
| 8057 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8058 | csr_get_bssdescr_from_scan_handle(hBSSList, |
Selvaraj, Sridhar | dc2ac8e | 2017-05-12 15:32:45 +0530 | [diff] [blame] | 8059 | first_ap_profile); |
Ajit Pal Singh | 64aff0c | 2017-06-20 16:35:26 +0530 | [diff] [blame] | 8060 | status = policy_mgr_is_chan_ok_for_dnbs(pMac->psoc, |
| 8061 | first_ap_profile->channelId, &ok); |
| 8062 | if (QDF_IS_STATUS_ERROR(status)) { |
| 8063 | sme_debug("policy_mgr_is_chan_ok_for_dnbs():error:%d", |
| 8064 | status); |
| 8065 | csr_scan_result_purge(pMac, hBSSList); |
| 8066 | fCallCallback = true; |
| 8067 | goto error; |
| 8068 | } |
| 8069 | if (!ok) { |
| 8070 | sme_debug("chan:%d not ok for DNBS", |
| 8071 | first_ap_profile->channelId); |
| 8072 | csr_scan_result_purge(pMac, hBSSList); |
| 8073 | fCallCallback = true; |
| 8074 | status = QDF_STATUS_E_INVAL; |
| 8075 | goto error; |
| 8076 | } |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 8077 | status = policy_mgr_handle_conc_multiport(pMac->psoc, |
Selvaraj, Sridhar | dc2ac8e | 2017-05-12 15:32:45 +0530 | [diff] [blame] | 8078 | sessionId, first_ap_profile->channelId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8079 | if ((QDF_IS_STATUS_SUCCESS(status)) && |
Chandrasekaran, Manishekar | 430ee2e | 2015-11-16 16:28:30 +0530 | [diff] [blame] | 8080 | (!csr_wait_for_connection_update(pMac, true))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8081 | sme_debug("conn update error"); |
Chandrasekaran, Manishekar | 430ee2e | 2015-11-16 16:28:30 +0530 | [diff] [blame] | 8082 | csr_scan_result_purge(pMac, hBSSList); |
| 8083 | fCallCallback = true; |
Abhishek Singh | 471652b | 2017-04-14 12:28:32 +0530 | [diff] [blame] | 8084 | status = QDF_STATUS_E_TIMEOUT; |
Chandrasekaran, Manishekar | 430ee2e | 2015-11-16 16:28:30 +0530 | [diff] [blame] | 8085 | goto error; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8086 | } else if (status == QDF_STATUS_E_FAILURE) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8087 | sme_debug("conn update error"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8088 | csr_scan_result_purge(pMac, hBSSList); |
| 8089 | fCallCallback = true; |
| 8090 | goto error; |
| 8091 | } |
| 8092 | } |
| 8093 | |
| 8094 | status = csr_roam_issue_connect(pMac, sessionId, pProfile, |
| 8095 | hBSSList, eCsrHddIssued, roamId, false, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8096 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8097 | sme_err("CSR failed to issue connect cmd with status: 0x%08X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8098 | status); |
| 8099 | csr_scan_result_purge(pMac, hBSSList); |
| 8100 | fCallCallback = true; |
| 8101 | } |
| 8102 | } else if (NULL != pProfile) { |
| 8103 | /* Check whether it is for start ibss */ |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 8104 | if (CSR_IS_START_IBSS(pProfile) || |
| 8105 | CSR_IS_NDI(pProfile)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8106 | status = csr_roam_issue_connect(pMac, sessionId, |
| 8107 | pProfile, NULL, eCsrHddIssued, |
| 8108 | roamId, false, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8109 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8110 | sme_err("Failed with status = 0x%08X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8111 | status); |
| 8112 | fCallCallback = true; |
| 8113 | } |
| 8114 | } else { |
| 8115 | /* scan for this SSID */ |
| 8116 | status = csr_scan_for_ssid(pMac, sessionId, pProfile, |
| 8117 | roamId, true); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8118 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8119 | sme_err("CSR failed to issue SSID scan cmd with status: 0x%08X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8120 | status); |
| 8121 | fCallCallback = true; |
| 8122 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8123 | sme_debug("SSID scan requested"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8124 | } |
| 8125 | } |
| 8126 | } else { |
| 8127 | fCallCallback = true; |
| 8128 | } |
| 8129 | |
| 8130 | error: |
| 8131 | if (NULL != pProfile) |
| 8132 | /* |
| 8133 | * we need to free memory for filter |
| 8134 | * if profile exists |
| 8135 | */ |
| 8136 | csr_free_scan_filter(pMac, pScanFilter); |
| 8137 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8138 | qdf_mem_free(pScanFilter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8139 | end: |
| 8140 | /* tell the caller if we fail to trigger a join request */ |
| 8141 | if (fCallCallback) { |
| 8142 | csr_roam_call_callback(pMac, sessionId, NULL, roamId, |
| 8143 | eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 8144 | } |
Selvaraj, Sridhar | dc2ac8e | 2017-05-12 15:32:45 +0530 | [diff] [blame] | 8145 | qdf_mem_free(first_ap_profile); |
| 8146 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8147 | return status; |
| 8148 | } |
| 8149 | |
| 8150 | /** |
| 8151 | * csr_roam_reassoc() - process reassoc command |
| 8152 | * @mac_ctx: mac global context |
| 8153 | * @session_id: session id |
| 8154 | * @profile: roam profile |
| 8155 | * @mod_fields: AC info being modified in reassoc |
| 8156 | * @roam_id: roam id to be populated |
| 8157 | * |
| 8158 | * Return: status of operation |
| 8159 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8160 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8161 | csr_roam_reassoc(tpAniSirGlobal mac_ctx, uint32_t session_id, |
| 8162 | tCsrRoamProfile *profile, |
| 8163 | tCsrRoamModifyProfileFields mod_fields, |
| 8164 | uint32_t *roam_id) |
| 8165 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8166 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8167 | bool fCallCallback = true; |
| 8168 | uint32_t roamId = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8169 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8170 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8171 | if (NULL == profile) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8172 | sme_err("No profile specified"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8173 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8174 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8175 | sme_debug( |
| 8176 | "called BSSType = %s (%d) authtype = %d encryType = %d", |
Rajeev Kumar | 43e25b1 | 2016-04-15 16:26:36 -0700 | [diff] [blame] | 8177 | sme_bss_type_to_string(profile->BSSType), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8178 | profile->BSSType, profile->AuthType.authType[0], |
| 8179 | profile->EncryptionType.encryptionType[0]); |
| 8180 | csr_roam_cancel_roaming(mac_ctx, session_id); |
| 8181 | csr_scan_remove_fresh_scan_command(mac_ctx, session_id); |
| 8182 | csr_scan_abort_mac_scan_not_for_connect(mac_ctx, session_id); |
| 8183 | csr_roam_remove_duplicate_command(mac_ctx, session_id, NULL, |
| 8184 | eCsrHddIssuedReassocToSameAP); |
| 8185 | if (csr_is_conn_state_connected(mac_ctx, session_id)) { |
| 8186 | if (profile) { |
| 8187 | if (profile->SSIDs.numOfSSIDs && |
| 8188 | csr_is_ssid_in_list(mac_ctx, |
| 8189 | &session->connectedProfile.SSID, |
| 8190 | &profile->SSIDs)) { |
| 8191 | fCallCallback = false; |
| 8192 | } else { |
| 8193 | /* |
| 8194 | * Connected SSID did not match with what is |
| 8195 | * asked in profile |
| 8196 | */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8197 | sme_debug("SSID mismatch"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8198 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8199 | } else if (qdf_mem_cmp(&mod_fields, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8200 | &session->connectedProfile.modifyProfileFields, |
| 8201 | sizeof(tCsrRoamModifyProfileFields))) { |
| 8202 | fCallCallback = false; |
| 8203 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8204 | sme_debug( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8205 | /* |
| 8206 | * Either the profile is NULL or none of the |
| 8207 | * fields in tCsrRoamModifyProfileFields got |
| 8208 | * modified |
| 8209 | */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8210 | "Profile NULL or nothing to modify"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8211 | } |
| 8212 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8213 | sme_debug("Not connected! No need to reassoc"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8214 | } |
| 8215 | if (!fCallCallback) { |
| 8216 | roamId = GET_NEXT_ROAM_ID(&mac_ctx->roam); |
| 8217 | if (roam_id) |
| 8218 | *roam_id = roamId; |
| 8219 | status = csr_roam_issue_reassoc(mac_ctx, session_id, profile, |
| 8220 | &mod_fields, eCsrHddIssuedReassocToSameAP, |
| 8221 | roamId, false); |
| 8222 | } else { |
| 8223 | status = csr_roam_call_callback(mac_ctx, session_id, NULL, |
| 8224 | roamId, eCSR_ROAM_FAILED, |
| 8225 | eCSR_ROAM_RESULT_FAILURE); |
| 8226 | } |
| 8227 | return status; |
| 8228 | } |
| 8229 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 8230 | static QDF_STATUS csr_roam_join_last_profile(tpAniSirGlobal pMac, |
| 8231 | uint32_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8232 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8233 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8234 | tScanResultHandle hBSSList = NULL; |
| 8235 | tCsrScanResultFilter *pScanFilter = NULL; |
| 8236 | uint32_t roamId; |
| 8237 | tCsrRoamProfile *pProfile = NULL; |
| 8238 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8239 | |
| 8240 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8241 | sme_err("session %d not found ", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8242 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8243 | } |
| 8244 | |
| 8245 | if (pSession->pCurRoamProfile) { |
| 8246 | csr_scan_abort_mac_scan_not_for_connect(pMac, sessionId); |
| 8247 | /* We have to make a copy of pCurRoamProfile because it |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8248 | * will be free inside csr_roam_issue_connect |
| 8249 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8250 | pProfile = qdf_mem_malloc(sizeof(tCsrRoamProfile)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8251 | if (NULL == pProfile) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8252 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8253 | goto end; |
| 8254 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8255 | status = csr_roam_copy_profile(pMac, pProfile, |
| 8256 | pSession->pCurRoamProfile); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8257 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8258 | goto end; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8259 | pScanFilter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8260 | if (NULL == pScanFilter) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8261 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8262 | goto end; |
| 8263 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8264 | status = csr_roam_prepare_filter_from_profile(pMac, pProfile, |
| 8265 | pScanFilter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8266 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8267 | goto end; |
| 8268 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 8269 | status = csr_scan_get_result(pMac, pScanFilter, &hBSSList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8270 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8271 | /* we want to put the last connected BSS to the |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8272 | * very beginning, if possible |
| 8273 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8274 | csr_move_bss_to_head_from_bssid(pMac, |
| 8275 | &pSession->connectedProfile.bssid, hBSSList); |
| 8276 | status = csr_roam_issue_connect(pMac, sessionId, |
| 8277 | pProfile, hBSSList, eCsrHddIssued, |
| 8278 | roamId, false, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8279 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8280 | csr_scan_result_purge(pMac, hBSSList); |
| 8281 | goto end; |
| 8282 | } |
| 8283 | } else { |
| 8284 | /* scan for this SSID only incase AP suppresses SSID */ |
| 8285 | status = csr_scan_for_ssid(pMac, sessionId, pProfile, |
| 8286 | roamId, true); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8287 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8288 | goto end; |
| 8289 | } |
| 8290 | } /* We have a profile */ |
| 8291 | else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8292 | sme_warn("cannot find a roaming profile"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8293 | goto end; |
| 8294 | } |
| 8295 | end: |
| 8296 | if (pScanFilter) { |
| 8297 | csr_free_scan_filter(pMac, pScanFilter); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8298 | qdf_mem_free(pScanFilter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8299 | } |
| 8300 | if (NULL != pProfile) { |
| 8301 | csr_release_profile(pMac, pProfile); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8302 | qdf_mem_free(pProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8303 | } |
| 8304 | return status; |
| 8305 | } |
| 8306 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8307 | QDF_STATUS csr_roam_reconnect(tpAniSirGlobal pMac, uint32_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8308 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8309 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8310 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8311 | if (csr_is_conn_state_connected(pMac, sessionId)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8312 | status = csr_roam_issue_disassociate_cmd(pMac, sessionId, |
| 8313 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 8314 | if (QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8315 | status = csr_roam_join_last_profile(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8316 | } |
| 8317 | return status; |
| 8318 | } |
| 8319 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8320 | QDF_STATUS csr_roam_connect_to_last_profile(tpAniSirGlobal pMac, |
| 8321 | uint32_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8322 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8323 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8324 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8325 | csr_roam_cancel_roaming(pMac, sessionId); |
| 8326 | csr_roam_remove_duplicate_command(pMac, sessionId, NULL, eCsrHddIssued); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8327 | if (csr_is_conn_state_disconnected(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8328 | status = csr_roam_join_last_profile(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8329 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8330 | return status; |
| 8331 | } |
| 8332 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8333 | QDF_STATUS csr_roam_process_disassoc_deauth(tpAniSirGlobal pMac, |
| 8334 | tSmeCmd *pCommand, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8335 | bool fDisassoc, bool fMICFailure) |
| 8336 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8337 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8338 | bool fComplete = false; |
| 8339 | eCsrRoamSubState NewSubstate; |
| 8340 | uint32_t sessionId = pCommand->sessionId; |
| 8341 | |
| 8342 | if (CSR_IS_WAIT_FOR_KEY(pMac, sessionId)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8343 | sme_debug("Stop Wait for key timer and change substate to eCSR_ROAM_SUBSTATE_NONE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8344 | csr_roam_stop_wait_for_key_timer(pMac); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8345 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_NONE, |
| 8346 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8347 | } |
| 8348 | /* change state to 'Roaming'... */ |
| 8349 | csr_roam_state_change(pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 8350 | |
| 8351 | if (csr_is_conn_state_ibss(pMac, sessionId)) { |
| 8352 | /* If we are in an IBSS, then stop the IBSS... */ |
| 8353 | status = |
| 8354 | csr_roam_issue_stop_bss(pMac, sessionId, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8355 | eCSR_ROAM_SUBSTATE_STOP_BSS_REQ); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8356 | fComplete = (!QDF_IS_STATUS_SUCCESS(status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8357 | } else if (csr_is_conn_state_infra(pMac, sessionId)) { |
| 8358 | /* |
| 8359 | * in Infrastructure, we need to disassociate from the |
| 8360 | * Infrastructure network... |
| 8361 | */ |
| 8362 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
| 8363 | if (eCsrSmeIssuedDisassocForHandoff == |
| 8364 | pCommand->u.roamCmd.roamReason) { |
| 8365 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF; |
| 8366 | } else |
| 8367 | if ((eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason) |
| 8368 | && (eSIR_MAC_DISASSOC_LEAVING_BSS_REASON == |
| 8369 | pCommand->u.roamCmd.reason)) { |
| 8370 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_STA_HAS_LEFT; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8371 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 8372 | "set to substate eCSR_ROAM_SUBSTATE_DISASSOC_STA_HAS_LEFT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8373 | } |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 8374 | if (eCsrSmeIssuedDisassocForHandoff != |
| 8375 | pCommand->u.roamCmd.roamReason) { |
| 8376 | /* |
| 8377 | * If we are in neighbor preauth done state then |
| 8378 | * on receiving disassoc or deauth we dont roam |
| 8379 | * instead we just disassoc from current ap and |
| 8380 | * then go to disconnected state. |
| 8381 | * This happens for ESE and 11r FT connections ONLY. |
| 8382 | */ |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 8383 | if (csr_roam_is11r_assoc(pMac, sessionId) && |
| 8384 | (csr_neighbor_roam_state_preauth_done(pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8385 | sessionId))) |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 8386 | csr_neighbor_roam_tranistion_preauth_done_to_disconnected( |
| 8387 | pMac, sessionId); |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 8388 | #ifdef FEATURE_WLAN_ESE |
| 8389 | if (csr_roam_is_ese_assoc(pMac, sessionId) && |
| 8390 | (csr_neighbor_roam_state_preauth_done(pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8391 | sessionId))) |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 8392 | csr_neighbor_roam_tranistion_preauth_done_to_disconnected( |
| 8393 | pMac, sessionId); |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 8394 | #endif |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 8395 | if (csr_roam_is_fast_roam_enabled(pMac, sessionId) && |
| 8396 | (csr_neighbor_roam_state_preauth_done(pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8397 | sessionId))) |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 8398 | csr_neighbor_roam_tranistion_preauth_done_to_disconnected( |
| 8399 | pMac, sessionId); |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 8400 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8401 | if (fDisassoc) |
| 8402 | status = csr_roam_issue_disassociate(pMac, sessionId, |
| 8403 | NewSubstate, |
| 8404 | fMICFailure); |
| 8405 | else |
| 8406 | status = csr_roam_issue_deauth(pMac, sessionId, |
| 8407 | eCSR_ROAM_SUBSTATE_DEAUTH_REQ); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8408 | fComplete = (!QDF_IS_STATUS_SUCCESS(status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8409 | } else { |
| 8410 | /* we got a dis-assoc request while not connected to any peer */ |
| 8411 | /* just complete the command */ |
| 8412 | fComplete = true; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8413 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8414 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8415 | if (fComplete) |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 8416 | csr_roam_complete(pMac, eCsrNothingToJoin, NULL, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8417 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8418 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8419 | if (csr_is_conn_state_infra(pMac, sessionId)) { |
| 8420 | /* Set the state to disconnect here */ |
| 8421 | pMac->roam.roamSession[sessionId].connectState = |
| 8422 | eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8423 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8424 | } else |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8425 | sme_warn(" failed with status %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8426 | return status; |
| 8427 | } |
| 8428 | |
| 8429 | /** |
| 8430 | * csr_prepare_disconnect_command() - function to prepare disconnect command |
| 8431 | * @mac: pointer to global mac structure |
| 8432 | * @session_id: sme session index |
| 8433 | * @sme_cmd: pointer to sme command being prepared |
| 8434 | * |
| 8435 | * Function to prepare internal sme disconnect command |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8436 | * Return: QDF_STATUS_SUCCESS on success else QDF_STATUS_E_RESOURCES on failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8437 | */ |
| 8438 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8439 | QDF_STATUS csr_prepare_disconnect_command(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8440 | uint32_t session_id, tSmeCmd **sme_cmd) |
| 8441 | { |
| 8442 | tSmeCmd *command; |
| 8443 | |
| 8444 | command = csr_get_command_buffer(mac); |
| 8445 | if (!command) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8446 | sme_err("fail to get command buffer"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8447 | return QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8448 | } |
| 8449 | |
| 8450 | command->command = eSmeCommandRoam; |
| 8451 | command->sessionId = (uint8_t)session_id; |
| 8452 | command->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 8453 | |
| 8454 | *sme_cmd = command; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8455 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8456 | } |
| 8457 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8458 | QDF_STATUS csr_roam_issue_disassociate_cmd(tpAniSirGlobal pMac, |
| 8459 | uint32_t sessionId, |
| 8460 | eCsrRoamDisconnectReason reason) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8461 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8462 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8463 | tSmeCmd *pCommand; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8464 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8465 | do { |
| 8466 | pCommand = csr_get_command_buffer(pMac); |
| 8467 | if (!pCommand) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8468 | sme_err(" fail to get command buffer"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8469 | status = QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8470 | break; |
| 8471 | } |
| 8472 | /* Change the substate in case it is wait-for-key */ |
| 8473 | if (CSR_IS_WAIT_FOR_KEY(pMac, sessionId)) { |
| 8474 | csr_roam_stop_wait_for_key_timer(pMac); |
| 8475 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_NONE, |
| 8476 | sessionId); |
| 8477 | } |
| 8478 | pCommand->command = eSmeCommandRoam; |
| 8479 | pCommand->sessionId = (uint8_t) sessionId; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8480 | sme_debug( |
| 8481 | "Disassociate reason: %d, sessionId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8482 | reason, sessionId); |
| 8483 | switch (reason) { |
| 8484 | case eCSR_DISCONNECT_REASON_MIC_ERROR: |
| 8485 | pCommand->u.roamCmd.roamReason = |
| 8486 | eCsrForcedDisassocMICFailure; |
| 8487 | break; |
| 8488 | case eCSR_DISCONNECT_REASON_DEAUTH: |
| 8489 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauth; |
| 8490 | break; |
| 8491 | case eCSR_DISCONNECT_REASON_HANDOFF: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8492 | pCommand->u.roamCmd.roamReason = |
| 8493 | eCsrSmeIssuedDisassocForHandoff; |
| 8494 | break; |
| 8495 | case eCSR_DISCONNECT_REASON_UNSPECIFIED: |
| 8496 | case eCSR_DISCONNECT_REASON_DISASSOC: |
| 8497 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 8498 | break; |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 8499 | case eCSR_DISCONNECT_REASON_ROAM_HO_FAIL: |
| 8500 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 8501 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8502 | case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE: |
| 8503 | pCommand->u.roamCmd.roamReason = |
| 8504 | eCsrSmeIssuedIbssJoinFailure; |
| 8505 | break; |
| 8506 | case eCSR_DISCONNECT_REASON_IBSS_LEAVE: |
| 8507 | pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave; |
| 8508 | break; |
| 8509 | case eCSR_DISCONNECT_REASON_STA_HAS_LEFT: |
| 8510 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 8511 | pCommand->u.roamCmd.reason = |
| 8512 | eSIR_MAC_DISASSOC_LEAVING_BSS_REASON; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8513 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 8514 | "SME convert to internal reason code eCsrStaHasLeft"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8515 | break; |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 8516 | case eCSR_DISCONNECT_REASON_NDI_DELETE: |
| 8517 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 8518 | pCommand->u.roamCmd.roamProfile.BSSType = |
| 8519 | eCSR_BSS_TYPE_NDI; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8520 | default: |
| 8521 | break; |
| 8522 | } |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 8523 | pCommand->u.roamCmd.disconnect_reason = reason; |
Abhishek Singh | b7b2a3b | 2015-12-03 16:09:38 +0530 | [diff] [blame] | 8524 | status = csr_queue_sme_command(pMac, pCommand, true); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8525 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8526 | sme_err("fail to send message status: %d", status); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 8527 | csr_release_command(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8528 | } |
| 8529 | } while (0); |
| 8530 | return status; |
| 8531 | } |
| 8532 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8533 | QDF_STATUS csr_roam_issue_stop_bss_cmd(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8534 | bool fHighPriority) |
| 8535 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8536 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8537 | tSmeCmd *pCommand; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8538 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8539 | pCommand = csr_get_command_buffer(pMac); |
| 8540 | if (NULL != pCommand) { |
| 8541 | /* Change the substate in case it is wait-for-key */ |
| 8542 | if (CSR_IS_WAIT_FOR_KEY(pMac, sessionId)) { |
| 8543 | csr_roam_stop_wait_for_key_timer(pMac); |
| 8544 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_NONE, |
| 8545 | sessionId); |
| 8546 | } |
| 8547 | pCommand->command = eSmeCommandRoam; |
| 8548 | pCommand->sessionId = (uint8_t) sessionId; |
| 8549 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 8550 | status = csr_queue_sme_command(pMac, pCommand, fHighPriority); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8551 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8552 | sme_err("fail to send message status: %d", status); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 8553 | csr_release_command(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8554 | } |
| 8555 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8556 | sme_err("fail to get command buffer"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8557 | status = QDF_STATUS_E_RESOURCES; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8558 | } |
| 8559 | return status; |
| 8560 | } |
| 8561 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8562 | QDF_STATUS csr_roam_disconnect_internal(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8563 | eCsrRoamDisconnectReason reason) |
| 8564 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8565 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8566 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8567 | |
| 8568 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8569 | sme_err("session: %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8570 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8571 | } |
| 8572 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 8573 | /* Stop the retry */ |
| 8574 | pSession->maxRetryCount = 0; |
| 8575 | csr_roam_stop_join_retry_timer(pMac, sessionId); |
| 8576 | #endif |
| 8577 | /* Not to call cancel roaming here */ |
| 8578 | /* Only issue disconnect when necessary */ |
| 8579 | if (csr_is_conn_state_connected(pMac, sessionId) |
| 8580 | || csr_is_bss_type_ibss(pSession->connectedProfile.BSSType) |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 8581 | || csr_is_roam_command_waiting_for_session(pMac, sessionId) |
| 8582 | || CSR_IS_CONN_NDI(&pSession->connectedProfile)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8583 | sme_debug("called"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8584 | status = csr_roam_issue_disassociate_cmd(pMac, sessionId, |
| 8585 | reason); |
| 8586 | } else { |
kaliu | 154d789 | 2015-12-30 17:27:58 +0530 | [diff] [blame] | 8587 | pMac->roam.roamSession[sessionId].connectState = |
| 8588 | eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTING; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8589 | csr_scan_abort_scan_for_ssid(pMac, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8590 | status = QDF_STATUS_CMD_NOT_QUEUED; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8591 | sme_debug("Disconnect cmd not queued, Roam command is not present return with status: %d", |
| 8592 | status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8593 | } |
| 8594 | return status; |
| 8595 | } |
| 8596 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8597 | QDF_STATUS csr_roam_disconnect(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8598 | eCsrRoamDisconnectReason reason) |
| 8599 | { |
| 8600 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8601 | |
| 8602 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8603 | sme_err("session: %d not found ", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8604 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8605 | } |
| 8606 | |
| 8607 | csr_roam_cancel_roaming(pMac, sessionId); |
| 8608 | csr_roam_remove_duplicate_command(pMac, sessionId, NULL, |
| 8609 | eCsrForcedDisassoc); |
| 8610 | |
| 8611 | return csr_roam_disconnect_internal(pMac, sessionId, reason); |
| 8612 | } |
| 8613 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8614 | QDF_STATUS csr_roam_save_connected_infomation(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8615 | uint32_t sessionId, |
| 8616 | tCsrRoamProfile *pProfile, |
| 8617 | tSirBssDescription *pSirBssDesc, |
| 8618 | tDot11fBeaconIEs *pIes) |
| 8619 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8620 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8621 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 8622 | uint8_t index; |
| 8623 | tCsrRoamSession *pSession = NULL; |
| 8624 | tCsrRoamConnectedProfile *pConnectProfile = NULL; |
| 8625 | |
| 8626 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8627 | if (NULL == pSession) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8628 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8629 | "session: %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8630 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8631 | } |
Padma, Santhosh Kumar | cd35f53 | 2016-12-27 12:07:39 +0530 | [diff] [blame] | 8632 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8633 | sme_debug("session id: %d", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8634 | pConnectProfile = &pSession->connectedProfile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8635 | if (pConnectProfile->pAddIEAssoc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8636 | qdf_mem_free(pConnectProfile->pAddIEAssoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8637 | pConnectProfile->pAddIEAssoc = NULL; |
| 8638 | } |
Varun Reddy Yeturu | d521600 | 2016-02-03 17:09:09 -0800 | [diff] [blame] | 8639 | /* |
| 8640 | * In case of LFR2.0, the connected profile is copied into a temporary |
| 8641 | * profile and cleared and then is copied back. This is not needed for |
| 8642 | * LFR3.0, since the profile is not cleared. |
| 8643 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 8644 | if (!pSession->roam_synch_in_progress) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8645 | qdf_mem_set(&pSession->connectedProfile, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 8646 | sizeof(tCsrRoamConnectedProfile), 0); |
| 8647 | pConnectProfile->AuthType = pProfile->negotiatedAuthType; |
| 8648 | pConnectProfile->AuthInfo = pProfile->AuthType; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 8649 | pConnectProfile->EncryptionType = |
| 8650 | pProfile->negotiatedUCEncryptionType; |
| 8651 | pConnectProfile->EncryptionInfo = pProfile->EncryptionType; |
| 8652 | pConnectProfile->mcEncryptionType = |
| 8653 | pProfile->negotiatedMCEncryptionType; |
| 8654 | pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; |
| 8655 | pConnectProfile->BSSType = pProfile->BSSType; |
| 8656 | pConnectProfile->modifyProfileFields.uapsd_mask = |
| 8657 | pProfile->uapsd_mask; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8658 | qdf_mem_copy(&pConnectProfile->Keys, &pProfile->Keys, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 8659 | sizeof(tCsrKeys)); |
| 8660 | if (pProfile->nAddIEAssocLength) { |
| 8661 | pConnectProfile->pAddIEAssoc = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8662 | qdf_mem_malloc(pProfile->nAddIEAssocLength); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 8663 | if (NULL == pConnectProfile->pAddIEAssoc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8664 | status = QDF_STATUS_E_NOMEM; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 8665 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8666 | status = QDF_STATUS_SUCCESS; |
| 8667 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8668 | sme_err("Failed to allocate memory for IE"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8669 | return QDF_STATUS_E_FAILURE; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 8670 | } |
| 8671 | pConnectProfile->nAddIEAssocLength = |
| 8672 | pProfile->nAddIEAssocLength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8673 | qdf_mem_copy(pConnectProfile->pAddIEAssoc, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 8674 | pProfile->pAddIEAssoc, |
| 8675 | pProfile->nAddIEAssocLength); |
| 8676 | } |
| 8677 | #ifdef WLAN_FEATURE_11W |
| 8678 | pConnectProfile->MFPEnabled = pProfile->MFPEnabled; |
| 8679 | pConnectProfile->MFPRequired = pProfile->MFPRequired; |
| 8680 | pConnectProfile->MFPCapable = pProfile->MFPCapable; |
| 8681 | #endif |
| 8682 | } |
| 8683 | /* Save bssid */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8684 | pConnectProfile->operationChannel = pSirBssDesc->channelId; |
| 8685 | pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8686 | if (!pConnectProfile->beaconInterval) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8687 | sme_err("ERROR: Beacon interval is ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8688 | csr_get_bss_id_bss_desc(pMac, pSirBssDesc, &pConnectProfile->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8689 | if (pSirBssDesc->mdiePresent) { |
| 8690 | pConnectProfile->MDID.mdiePresent = 1; |
| 8691 | pConnectProfile->MDID.mobilityDomain = |
| 8692 | (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]); |
| 8693 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8694 | if (NULL == pIesTemp) |
| 8695 | status = csr_get_parsed_bss_description_ies(pMac, pSirBssDesc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8696 | &pIesTemp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8697 | #ifdef FEATURE_WLAN_ESE |
| 8698 | if ((csr_is_profile_ese(pProfile) || |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8699 | (QDF_IS_STATUS_SUCCESS(status) && (pIesTemp->ESEVersion.present) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8700 | && (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM))) |
| 8701 | && (pMac->roam.configParam.isEseIniFeatureEnabled)) { |
| 8702 | pConnectProfile->isESEAssoc = 1; |
| 8703 | } |
| 8704 | #endif |
| 8705 | /* save ssid */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8706 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8707 | if (pIesTemp->SSID.present) { |
| 8708 | pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8709 | qdf_mem_copy(pConnectProfile->SSID.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8710 | pIesTemp->SSID.ssid, |
| 8711 | pIesTemp->SSID.num_ssid); |
| 8712 | } |
| 8713 | /* Save the bss desc */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8714 | status = csr_roam_save_connected_bss_desc(pMac, sessionId, |
| 8715 | pSirBssDesc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8716 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8717 | if (CSR_IS_QOS_BSS(pIesTemp) || pIesTemp->HTCaps.present) |
| 8718 | /* Some HT AP's dont send WMM IE so in that case we |
| 8719 | * assume all HT Ap's are Qos Enabled AP's |
| 8720 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8721 | pConnectProfile->qap = true; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8722 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8723 | pConnectProfile->qap = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8724 | |
| 8725 | if (pIesTemp->ExtCap.present) { |
| 8726 | struct s_ext_cap *p_ext_cap = (struct s_ext_cap *) |
| 8727 | pIesTemp->ExtCap.bytes; |
| 8728 | pConnectProfile->proxyARPService = p_ext_cap-> |
| 8729 | proxy_arp_service; |
| 8730 | } |
| 8731 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8732 | if (NULL == pIes) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8733 | /* Free memory if it allocated locally */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8734 | qdf_mem_free(pIesTemp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8735 | } |
| 8736 | /* Save Qos connection */ |
| 8737 | pConnectProfile->qosConnection = |
| 8738 | pMac->roam.roamSession[sessionId].fWMMConnection; |
| 8739 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8740 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8741 | csr_free_connect_bss_desc(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8742 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8743 | for (index = 0; index < pProfile->SSIDs.numOfSSIDs; index++) { |
| 8744 | if ((pProfile->SSIDs.SSIDList[index].SSID.length == |
| 8745 | pConnectProfile->SSID.length) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8746 | && (!qdf_mem_cmp(pProfile->SSIDs.SSIDList[index].SSID. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8747 | ssId, pConnectProfile->SSID.ssId, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8748 | pConnectProfile->SSID.length))) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8749 | pConnectProfile->handoffPermitted = pProfile->SSIDs. |
| 8750 | SSIDList[index].handoffPermitted; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8751 | break; |
| 8752 | } |
| 8753 | pConnectProfile->handoffPermitted = false; |
| 8754 | } |
| 8755 | |
| 8756 | return status; |
| 8757 | } |
| 8758 | |
| 8759 | |
Abhishek Singh | b1d73ab | 2015-12-03 16:14:00 +0530 | [diff] [blame] | 8760 | bool is_disconnect_pending(tpAniSirGlobal pmac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8761 | uint8_t sessionid) |
| 8762 | { |
| 8763 | tListElem *entry = NULL; |
| 8764 | tListElem *next_entry = NULL; |
| 8765 | tSmeCmd *command = NULL; |
| 8766 | bool disconnect_cmd_exist = false; |
| 8767 | |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 8768 | csr_nonscan_pending_ll_lock(pmac); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 8769 | entry = csr_nonscan_pending_ll_peek_head(pmac, LL_ACCESS_NOLOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8770 | while (entry) { |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 8771 | next_entry = csr_nonscan_pending_ll_next(pmac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8772 | entry, LL_ACCESS_NOLOCK); |
| 8773 | |
| 8774 | command = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 8775 | if (command && CSR_IS_DISCONNECT_COMMAND(command) && |
| 8776 | command->sessionId == sessionid){ |
| 8777 | disconnect_cmd_exist = true; |
| 8778 | break; |
| 8779 | } |
| 8780 | entry = next_entry; |
| 8781 | } |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 8782 | csr_nonscan_pending_ll_unlock(pmac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8783 | return disconnect_cmd_exist; |
| 8784 | } |
| 8785 | |
| 8786 | static void csr_roam_join_rsp_processor(tpAniSirGlobal pMac, |
| 8787 | tSirSmeJoinRsp *pSmeJoinRsp) |
| 8788 | { |
| 8789 | tListElem *pEntry = NULL; |
| 8790 | tSmeCmd *pCommand = NULL; |
| 8791 | tCsrRoamSession *session_ptr; |
| 8792 | |
| 8793 | if (pSmeJoinRsp) { |
| 8794 | session_ptr = CSR_GET_SESSION(pMac, pSmeJoinRsp->sessionId); |
| 8795 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8796 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8797 | FL("Sme Join Response is NULL")); |
| 8798 | return; |
| 8799 | } |
| 8800 | if (!session_ptr) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8801 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8802 | ("session %d not found"), pSmeJoinRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8803 | return; |
| 8804 | } |
| 8805 | /* The head of the active list is the request we sent */ |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 8806 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_LOCK); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8807 | if (pEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8808 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8809 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8810 | if (eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode) { |
| 8811 | if (pCommand |
| 8812 | && eCsrSmeIssuedAssocToSimilarAP == |
| 8813 | pCommand->u.roamCmd.roamReason) { |
| 8814 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 8815 | sme_qos_csr_event_ind(pMac, pSmeJoinRsp->sessionId, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8816 | SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8817 | #endif |
| 8818 | } |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 8819 | |
| 8820 | session_ptr->supported_nss_1x1 = |
| 8821 | pSmeJoinRsp->supported_nss_1x1; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8822 | sme_debug("SME session supported nss: %d", |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 8823 | session_ptr->supported_nss_1x1); |
| 8824 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8825 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8826 | * The join bssid count can be reset as soon as |
| 8827 | * we are done with the join requests and returning |
| 8828 | * the response to upper layers |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8829 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8830 | session_ptr->join_bssid_count = 0; |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 8831 | csr_roam_complete(pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp, |
| 8832 | pSmeJoinRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8833 | } else { |
| 8834 | uint32_t roamId = 0; |
| 8835 | bool is_dis_pending; |
| 8836 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8837 | /* The head of the active list is the request we sent |
| 8838 | * Try to get back the same profile and roam again |
| 8839 | */ |
| 8840 | if (pCommand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8841 | roamId = pCommand->u.roamCmd.roamId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8842 | session_ptr->joinFailStatusCode.statusCode = |
| 8843 | pSmeJoinRsp->statusCode; |
| 8844 | session_ptr->joinFailStatusCode.reasonCode = |
| 8845 | pSmeJoinRsp->protStatusCode; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8846 | sme_warn("SmeJoinReq failed with statusCode= 0x%08X [%d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8847 | pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8848 | /* If Join fails while Handoff is in progress, indicate |
| 8849 | * disassociated event to supplicant to reconnect |
| 8850 | */ |
| 8851 | if (csr_roam_is_handoff_in_progress(pMac, |
| 8852 | pSmeJoinRsp->sessionId)) { |
| 8853 | csr_roam_call_callback(pMac, pSmeJoinRsp->sessionId, |
| 8854 | NULL, roamId, |
| 8855 | eCSR_ROAM_DISASSOCIATED, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8856 | eCSR_ROAM_RESULT_FORCED); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8857 | /* Should indicate neighbor roam algorithm about the |
| 8858 | * connect failure here |
| 8859 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8860 | csr_neighbor_roam_indicate_connect(pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8861 | pSmeJoinRsp->sessionId, |
| 8862 | QDF_STATUS_E_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8863 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8864 | /* |
| 8865 | * if userspace has issued disconnection, |
| 8866 | * driver should not continue connecting |
| 8867 | */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8868 | is_dis_pending = is_disconnect_pending(pMac, |
| 8869 | session_ptr->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8870 | if (pCommand && (session_ptr->join_bssid_count < |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8871 | CSR_MAX_BSSID_COUNT) && !is_dis_pending) |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 8872 | csr_roam(pMac, pCommand); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8873 | else { |
| 8874 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8875 | * When the upper layers issue a connect command, there |
| 8876 | * is a roam command with reason eCsrHddIssued that |
| 8877 | * gets enqueued and an associated timer for the SME |
| 8878 | * command timeout is started which is currently 120 |
| 8879 | * seconds. This command would be dequeued only upon |
| 8880 | * succesfull connections. In case of join failures, if |
| 8881 | * there are too many BSS in the cache, and if we fail |
| 8882 | * Join requests with all of them, there is a chance of |
| 8883 | * timing out the above timer. |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8884 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8885 | if (session_ptr->join_bssid_count >= |
| 8886 | CSR_MAX_BSSID_COUNT) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8887 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 8888 | QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8889 | "Excessive Join Req Failures"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8890 | |
| 8891 | if (is_dis_pending) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 8892 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 8893 | QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8894 | "disconnect is pending, complete roam"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8895 | |
Abhishek Singh | 6e4621c | 2017-03-31 13:13:10 +0530 | [diff] [blame] | 8896 | if (session_ptr->bRefAssocStartCnt) |
| 8897 | session_ptr->bRefAssocStartCnt--; |
| 8898 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8899 | session_ptr->join_bssid_count = 0; |
Abhishek Singh | 6e4621c | 2017-03-31 13:13:10 +0530 | [diff] [blame] | 8900 | |
| 8901 | csr_roam_call_callback(pMac, session_ptr->sessionId, |
| 8902 | NULL, roamId, |
| 8903 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 8904 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 8905 | |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 8906 | csr_roam_complete(pMac, eCsrNothingToJoin, NULL, |
| 8907 | pSmeJoinRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8908 | } |
| 8909 | } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */ |
| 8910 | } |
| 8911 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 8912 | static QDF_STATUS csr_roam_issue_join(tpAniSirGlobal pMac, uint32_t sessionId, |
| 8913 | tSirBssDescription *pSirBssDesc, |
| 8914 | tDot11fBeaconIEs *pIes, |
| 8915 | tCsrRoamProfile *pProfile, |
| 8916 | uint32_t roamId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8917 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8918 | QDF_STATUS status; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8919 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8920 | sme_debug("Attempting to Join Bssid= " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8921 | MAC_ADDR_ARRAY(pSirBssDesc->bssId)); |
| 8922 | |
| 8923 | /* Set the roaming substate to 'join attempt'... */ |
| 8924 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
| 8925 | /* attempt to Join this BSS... */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8926 | status = csr_send_join_req_msg(pMac, sessionId, pSirBssDesc, pProfile, |
| 8927 | pIes, eWNI_SME_JOIN_REQ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8928 | return status; |
| 8929 | } |
| 8930 | |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 8931 | static void |
| 8932 | csr_roam_reissue_roam_command(tpAniSirGlobal pMac, uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8933 | { |
| 8934 | tListElem *pEntry; |
| 8935 | tSmeCmd *pCommand; |
| 8936 | tCsrRoamInfo roamInfo; |
| 8937 | uint32_t sessionId; |
| 8938 | tCsrRoamSession *pSession; |
| 8939 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 8940 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8941 | if (NULL == pEntry) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8942 | sme_err("Disassoc rsp can't continue, no active CMD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8943 | return; |
| 8944 | } |
| 8945 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 8946 | if (eSmeCommandRoam != pCommand->command) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8947 | sme_err("Active cmd, is not a roaming CMD"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8948 | return; |
| 8949 | } |
| 8950 | sessionId = pCommand->sessionId; |
| 8951 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8952 | |
| 8953 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8954 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8955 | return; |
| 8956 | } |
| 8957 | |
| 8958 | if (!pCommand->u.roamCmd.fStopWds) { |
| 8959 | if (pSession->bRefAssocStartCnt > 0) { |
| 8960 | /* |
| 8961 | * bRefAssocStartCnt was incremented in |
| 8962 | * csr_roam_join_next_bss when the roam command issued |
| 8963 | * previously. As part of reissuing the roam command |
| 8964 | * again csr_roam_join_next_bss is going increment |
| 8965 | * RefAssocStartCnt. So make sure to decrement the |
| 8966 | * bRefAssocStartCnt |
| 8967 | */ |
| 8968 | pSession->bRefAssocStartCnt--; |
| 8969 | } |
| 8970 | if (eCsrStopRoaming == csr_roam_join_next_bss(pMac, pCommand, |
| 8971 | true)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8972 | sme_warn("Failed to reissue join command"); |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 8973 | csr_roam_complete(pMac, eCsrNothingToJoin, NULL, |
| 8974 | session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8975 | } |
| 8976 | return; |
| 8977 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 8978 | qdf_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8979 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 8980 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 8981 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 8982 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 8983 | csr_roam_call_callback(pMac, sessionId, &roamInfo, |
| 8984 | pCommand->u.roamCmd.roamId, |
| 8985 | eCSR_ROAM_INFRA_IND, |
| 8986 | eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8987 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 8988 | if (!QDF_IS_STATUS_SUCCESS(csr_roam_issue_stop_bss(pMac, sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8989 | eCSR_ROAM_SUBSTATE_STOP_BSS_REQ))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 8990 | sme_err("Failed to reissue stop_bss command for WDS"); |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 8991 | csr_roam_complete(pMac, eCsrNothingToJoin, NULL, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8992 | } |
| 8993 | } |
| 8994 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 8995 | bool csr_is_roam_command_waiting_for_session(tpAniSirGlobal pMac, |
| 8996 | uint32_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 8997 | { |
| 8998 | bool fRet = false; |
| 8999 | tListElem *pEntry; |
| 9000 | tSmeCmd *pCommand = NULL; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9001 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9002 | /* alwasy lock active list before locking pending list */ |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 9003 | csr_nonscan_active_ll_lock(pMac); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 9004 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_NOLOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9005 | if (pEntry) { |
| 9006 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 9007 | if ((eSmeCommandRoam == pCommand->command) |
| 9008 | && (sessionId == pCommand->sessionId)) { |
| 9009 | fRet = true; |
| 9010 | } |
| 9011 | } |
| 9012 | if (false == fRet) { |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 9013 | csr_nonscan_pending_ll_lock(pMac); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 9014 | pEntry = csr_nonscan_pending_ll_peek_head(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9015 | LL_ACCESS_NOLOCK); |
| 9016 | while (pEntry) { |
| 9017 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 9018 | if ((eSmeCommandRoam == pCommand->command) |
| 9019 | && (sessionId == pCommand->sessionId)) { |
| 9020 | fRet = true; |
| 9021 | break; |
| 9022 | } |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 9023 | pEntry = csr_nonscan_pending_ll_next(pMac, pEntry, |
| 9024 | LL_ACCESS_NOLOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9025 | } |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 9026 | csr_nonscan_pending_ll_unlock(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9027 | } |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 9028 | csr_nonscan_active_ll_unlock(pMac); |
| 9029 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9030 | return fRet; |
| 9031 | } |
| 9032 | |
| 9033 | bool csr_is_roam_command_waiting(tpAniSirGlobal pMac) |
| 9034 | { |
| 9035 | bool fRet = false; |
| 9036 | uint32_t i; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9037 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9038 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 9039 | fRet = csr_is_roam_command_waiting_for_session(pMac, i); |
| 9040 | if (CSR_IS_SESSION_VALID(pMac, i) |
| 9041 | && (fRet)) { |
| 9042 | break; |
| 9043 | } |
| 9044 | } |
| 9045 | return fRet; |
| 9046 | } |
| 9047 | |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9048 | bool csr_is_scan_for_roam_command_active(tpAniSirGlobal pMac, |
| 9049 | uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9050 | { |
| 9051 | bool fRet = false; |
| 9052 | tListElem *pEntry; |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 9053 | tSmeCmd *pCommand; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9054 | /* alwasy lock active list before locking pending list */ |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 9055 | csr_nonscan_active_ll_lock(pMac); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 9056 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_NOLOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9057 | if (pEntry) { |
Krunal Soni | 78618d9 | 2017-02-14 21:46:31 -0800 | [diff] [blame] | 9058 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 9059 | if ((eSmeCommandScan == pCommand->command) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9060 | ((eCsrScanForSsid == pCommand->u.scanCmd.reason) || |
| 9061 | (eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason))) { |
| 9062 | fRet = true; |
| 9063 | } |
| 9064 | } |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 9065 | csr_nonscan_active_ll_unlock(pMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9066 | return fRet; |
| 9067 | } |
| 9068 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9069 | static void |
| 9070 | csr_roaming_state_config_cnf_processor(tpAniSirGlobal mac_ctx, |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 9071 | tSmeCmd *cmd, uint32_t result, uint8_t sme_session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9072 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9073 | tCsrScanResult *scan_result = NULL; |
| 9074 | tSirBssDescription *bss_desc = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9075 | uint32_t session_id; |
| 9076 | tCsrRoamSession *session; |
| 9077 | tDot11fBeaconIEs *local_ies = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9078 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9079 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 9080 | if (NULL == cmd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9081 | sme_err("given sme cmd is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9082 | return; |
| 9083 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9084 | session_id = cmd->sessionId; |
| 9085 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 9086 | |
| 9087 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9088 | sme_err("session %d not found", session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9089 | return; |
| 9090 | } |
| 9091 | |
| 9092 | if (CSR_IS_ROAMING(session) && session->fCancelRoaming) { |
| 9093 | /* the roaming is cancelled. Simply complete the command */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9094 | sme_warn("Roam command canceled"); |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9095 | csr_roam_complete(mac_ctx, eCsrNothingToJoin, NULL, |
| 9096 | sme_session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9097 | return; |
| 9098 | } |
| 9099 | |
| 9100 | /* If the roaming has stopped, not to continue the roaming command */ |
| 9101 | if (!CSR_IS_ROAMING(session) && CSR_IS_ROAMING_COMMAND(cmd)) { |
| 9102 | /* No need to complete roaming here as it already completes */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9103 | sme_warn( |
| 9104 | "Roam cmd (reason %d) aborted(roaming completed)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9105 | cmd->u.roamCmd.roamReason); |
| 9106 | csr_set_abort_roaming_command(mac_ctx, cmd); |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9107 | csr_roam_complete(mac_ctx, eCsrNothingToJoin, NULL, |
| 9108 | sme_session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9109 | return; |
| 9110 | } |
| 9111 | |
| 9112 | if (!IS_SIR_STATUS_SUCCESS(result)) { |
| 9113 | /* |
| 9114 | * In the event the configuration failed, for infra let the roam |
| 9115 | * processor attempt to join something else... |
| 9116 | */ |
| 9117 | if (cmd->u.roamCmd.pRoamBssEntry |
| 9118 | && CSR_IS_INFRASTRUCTURE(&cmd->u.roamCmd.roamProfile)) { |
| 9119 | csr_roam(mac_ctx, cmd); |
| 9120 | } else { |
| 9121 | /* We need to complete the command */ |
| 9122 | if (csr_is_bss_type_ibss |
| 9123 | (cmd->u.roamCmd.roamProfile.BSSType)) { |
| 9124 | csr_roam_complete(mac_ctx, eCsrStartBssFailure, |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9125 | NULL, sme_session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9126 | } else { |
| 9127 | csr_roam_complete(mac_ctx, eCsrNothingToJoin, |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9128 | NULL, sme_session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9129 | } |
| 9130 | } |
| 9131 | return; |
| 9132 | } |
| 9133 | |
| 9134 | /* we have active entry */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9135 | sme_debug("Cfg sequence complete"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9136 | /* |
| 9137 | * Successfully set the configuration parameters for the new Bss. |
| 9138 | * Attempt to join the roaming Bss |
| 9139 | */ |
| 9140 | if (cmd->u.roamCmd.pRoamBssEntry) { |
| 9141 | scan_result = GET_BASE_ADDR(cmd->u.roamCmd.pRoamBssEntry, |
| 9142 | tCsrScanResult, |
| 9143 | Link); |
| 9144 | bss_desc = &scan_result->Result.BssDescriptor; |
| 9145 | } |
| 9146 | if (csr_is_bss_type_ibss(cmd->u.roamCmd.roamProfile.BSSType) |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 9147 | || CSR_IS_INFRA_AP(&cmd->u.roamCmd.roamProfile) |
| 9148 | || CSR_IS_NDI(&cmd->u.roamCmd.roamProfile)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9149 | if (!QDF_IS_STATUS_SUCCESS(csr_roam_issue_start_bss(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9150 | session_id, &session->bssParams, |
| 9151 | &cmd->u.roamCmd.roamProfile, |
| 9152 | bss_desc, |
| 9153 | cmd->u.roamCmd.roamId))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9154 | sme_err("CSR start BSS failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9155 | /* We need to complete the command */ |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9156 | csr_roam_complete(mac_ctx, eCsrStartBssFailure, NULL, |
| 9157 | sme_session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9158 | } |
| 9159 | return; |
| 9160 | } |
| 9161 | |
| 9162 | if (!cmd->u.roamCmd.pRoamBssEntry) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9163 | sme_err("pRoamBssEntry is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9164 | /* We need to complete the command */ |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9165 | csr_roam_complete(mac_ctx, eCsrJoinFailure, NULL, |
| 9166 | sme_session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9167 | return; |
| 9168 | } |
| 9169 | |
| 9170 | if (NULL == scan_result) { |
| 9171 | /* If we are roaming TO an Infrastructure BSS... */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9172 | QDF_ASSERT(scan_result != NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9173 | return; |
| 9174 | } |
| 9175 | |
| 9176 | if (!csr_is_infra_bss_desc(bss_desc)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9177 | sme_warn("found BSSType mismatching the one in BSS descp"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9178 | return; |
| 9179 | } |
| 9180 | |
| 9181 | local_ies = (tDot11fBeaconIEs *) scan_result->Result.pvIes; |
| 9182 | if (!local_ies) { |
| 9183 | status = csr_get_parsed_bss_description_ies(mac_ctx, bss_desc, |
| 9184 | &local_ies); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9185 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9186 | return; |
| 9187 | } |
| 9188 | |
| 9189 | if (csr_is_conn_state_connected_infra(mac_ctx, session_id)) { |
| 9190 | if (csr_is_ssid_equal(mac_ctx, session->pConnectBssDesc, |
| 9191 | bss_desc, local_ies)) { |
| 9192 | cmd->u.roamCmd.fReassoc = true; |
| 9193 | csr_roam_issue_reassociate(mac_ctx, session_id, |
| 9194 | bss_desc, local_ies, |
| 9195 | &cmd->u.roamCmd.roamProfile); |
| 9196 | } else { |
| 9197 | /* |
| 9198 | * otherwise, we have to issue a new Join request to LIM |
| 9199 | * because we disassociated from the previously |
| 9200 | * associated AP. |
| 9201 | */ |
| 9202 | status = csr_roam_issue_join(mac_ctx, session_id, |
| 9203 | bss_desc, local_ies, |
| 9204 | &cmd->u.roamCmd.roamProfile, |
| 9205 | cmd->u.roamCmd.roamId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9206 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9207 | /* try something else */ |
| 9208 | csr_roam(mac_ctx, cmd); |
| 9209 | } |
| 9210 | } |
| 9211 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9212 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9213 | /* |
| 9214 | * We need to come with other way to figure out that this is |
| 9215 | * because of HO in BMP The below API will be only available for |
| 9216 | * Android as it uses a different HO algorithm. Reassoc request |
| 9217 | * will be used only for ESE and 11r handoff whereas other |
| 9218 | * legacy roaming should use join request |
| 9219 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9220 | if (csr_roam_is_handoff_in_progress(mac_ctx, session_id) |
| 9221 | && csr_roam_is11r_assoc(mac_ctx, session_id)) { |
| 9222 | status = csr_roam_issue_reassociate(mac_ctx, |
| 9223 | session_id, bss_desc, |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 9224 | local_ies, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9225 | &cmd->u.roamCmd.roamProfile); |
| 9226 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9227 | #ifdef FEATURE_WLAN_ESE |
| 9228 | if (csr_roam_is_handoff_in_progress(mac_ctx, session_id) |
| 9229 | && csr_roam_is_ese_assoc(mac_ctx, session_id)) { |
| 9230 | /* Now serialize the reassoc command. */ |
| 9231 | status = csr_roam_issue_reassociate_cmd(mac_ctx, |
| 9232 | session_id); |
| 9233 | } else |
| 9234 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9235 | if (csr_roam_is_handoff_in_progress(mac_ctx, session_id) |
| 9236 | && csr_roam_is_fast_roam_enabled(mac_ctx, session_id)) { |
| 9237 | /* Now serialize the reassoc command. */ |
| 9238 | status = csr_roam_issue_reassociate_cmd(mac_ctx, |
| 9239 | session_id); |
Deepak Dhamdhere | ecce974 | 2015-11-08 01:16:43 -0800 | [diff] [blame] | 9240 | } else { |
| 9241 | /* |
| 9242 | * else we are not connected and attempting to Join. |
| 9243 | * Issue the Join request. |
| 9244 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9245 | status = csr_roam_issue_join(mac_ctx, session_id, |
| 9246 | bss_desc, |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 9247 | local_ies, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9248 | &cmd->u.roamCmd.roamProfile, |
| 9249 | cmd->u.roamCmd.roamId); |
| 9250 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9251 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9252 | /* try something else */ |
| 9253 | csr_roam(mac_ctx, cmd); |
| 9254 | } |
| 9255 | } |
| 9256 | if (!scan_result->Result.pvIes) { |
| 9257 | /* Locally allocated */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9258 | qdf_mem_free(local_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9259 | } |
| 9260 | } |
| 9261 | |
| 9262 | static void csr_roam_roaming_state_reassoc_rsp_processor(tpAniSirGlobal pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9263 | tpSirSmeJoinRsp pSmeJoinRsp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9264 | { |
| 9265 | eCsrRoamCompleteResult result; |
| 9266 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = |
| 9267 | &pMac->roam.neighborRoamInfo[pSmeJoinRsp->sessionId]; |
| 9268 | tCsrRoamInfo roamInfo; |
| 9269 | uint32_t roamId = 0; |
Archana Ramachandran | 5482d6a | 2016-03-29 17:09:22 -0700 | [diff] [blame] | 9270 | tCsrRoamSession *csr_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9271 | |
| 9272 | if (eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9273 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9274 | "CSR SmeReassocReq Successful"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9275 | result = eCsrReassocSuccess; |
Archana Ramachandran | 5482d6a | 2016-03-29 17:09:22 -0700 | [diff] [blame] | 9276 | csr_session = CSR_GET_SESSION(pMac, pSmeJoinRsp->sessionId); |
| 9277 | if (NULL != csr_session) { |
| 9278 | csr_session->supported_nss_1x1 = |
| 9279 | pSmeJoinRsp->supported_nss_1x1; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9280 | sme_debug("SME session supported nss: %d", |
Archana Ramachandran | 5482d6a | 2016-03-29 17:09:22 -0700 | [diff] [blame] | 9281 | csr_session->supported_nss_1x1); |
| 9282 | } |
Deepak Dhamdhere | 42b5c11 | 2015-11-07 00:23:22 -0800 | [diff] [blame] | 9283 | /* |
| 9284 | * Since the neighbor roam algorithm uses reassoc req for |
| 9285 | * handoff instead of join, we need the response contents while |
| 9286 | * processing the result in csr_roam_process_results() |
| 9287 | */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9288 | if (csr_roam_is_handoff_in_progress(pMac, |
| 9289 | pSmeJoinRsp->sessionId)) { |
| 9290 | /* Need to dig more on indicating events to |
| 9291 | * SME QoS module |
| 9292 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9293 | sme_qos_csr_event_ind(pMac, pSmeJoinRsp->sessionId, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9294 | SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9295 | csr_roam_complete(pMac, result, pSmeJoinRsp, |
| 9296 | pSmeJoinRsp->sessionId); |
Deepak Dhamdhere | 42b5c11 | 2015-11-07 00:23:22 -0800 | [diff] [blame] | 9297 | } else { |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9298 | csr_roam_complete(pMac, result, NULL, |
| 9299 | pSmeJoinRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9300 | } |
| 9301 | } |
| 9302 | /* Should we handle this similar to handling the join failure? Is it ok |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9303 | * to call csr_roam_complete() with state as CsrJoinFailure |
| 9304 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9305 | else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9306 | sme_warn( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9307 | "CSR SmeReassocReq failed with statusCode= 0x%08X [%d]", |
| 9308 | pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode); |
| 9309 | result = eCsrReassocFailure; |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 9310 | cds_flush_logs(WLAN_LOG_TYPE_FATAL, |
| 9311 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 9312 | WLAN_LOG_REASON_ROAM_FAIL, |
| 9313 | true, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9314 | if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == |
| 9315 | pSmeJoinRsp->statusCode) |
| 9316 | || (eSIR_SME_FT_REASSOC_FAILURE == |
| 9317 | pSmeJoinRsp->statusCode) |
| 9318 | || (eSIR_SME_INVALID_PARAMETERS == |
| 9319 | pSmeJoinRsp->statusCode)) { |
| 9320 | /* Inform HDD to turn off FT flag in HDD */ |
| 9321 | if (pNeighborRoamInfo) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9322 | qdf_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9323 | csr_roam_call_callback(pMac, |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 9324 | pSmeJoinRsp->sessionId, |
| 9325 | &roamInfo, roamId, |
| 9326 | eCSR_ROAM_FT_REASSOC_FAILED, |
| 9327 | eCSR_ROAM_RESULT_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9328 | /* |
| 9329 | * Since the above callback sends a disconnect |
| 9330 | * to HDD, we should clean-up our state |
| 9331 | * machine as well to be in sync with the upper |
| 9332 | * layers. There is no need to send a disassoc |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9333 | * since: 1) we will never reassoc to the |
| 9334 | * current AP in LFR, and 2) there is no need |
| 9335 | * to issue a disassoc to the AP with which we |
| 9336 | * were trying to reassoc. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9337 | */ |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9338 | csr_roam_complete(pMac, eCsrJoinFailure, NULL, |
| 9339 | pSmeJoinRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9340 | return; |
| 9341 | } |
| 9342 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9343 | /* In the event that the Reassociation fails, then we need to |
| 9344 | * Disassociate the current association and keep roaming. Note |
| 9345 | * that we will attempt to Join the AP instead of a Reassoc |
| 9346 | * since we may have attempted a 'Reassoc to self', which AP's |
| 9347 | * that don't support Reassoc will force a Disassoc. The |
| 9348 | * isassoc rsp message will remove the command from active list |
| 9349 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9350 | if (!QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9351 | (csr_roam_issue_disassociate |
| 9352 | (pMac, pSmeJoinRsp->sessionId, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9353 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, |
| 9354 | false))) { |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9355 | csr_roam_complete(pMac, eCsrJoinFailure, NULL, |
| 9356 | pSmeJoinRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9357 | } |
| 9358 | } |
| 9359 | } |
| 9360 | |
| 9361 | static void csr_roam_roaming_state_stop_bss_rsp_processor(tpAniSirGlobal pMac, |
| 9362 | tSirSmeRsp *pSmeRsp) |
| 9363 | { |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 9364 | eCsrRoamCompleteResult result_code = eCsrNothingToJoin; |
Naveen Rawat | efd71c3 | 2016-10-25 17:05:47 -0700 | [diff] [blame] | 9365 | tCsrRoamProfile *profile; |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 9366 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9367 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9368 | { |
| 9369 | host_log_ibss_pkt_type *pIbssLog; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9370 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9371 | WLAN_HOST_DIAG_LOG_ALLOC(pIbssLog, host_log_ibss_pkt_type, |
| 9372 | LOG_WLAN_IBSS_C); |
| 9373 | if (pIbssLog) { |
| 9374 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9375 | if (eSIR_SME_SUCCESS != pSmeRsp->statusCode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9376 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9377 | WLAN_HOST_DIAG_LOG_REPORT(pIbssLog); |
| 9378 | } |
| 9379 | } |
| 9380 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 9381 | pMac->roam.roamSession[pSmeRsp->sessionId].connectState = |
| 9382 | eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 9383 | if (CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ(pMac, pSmeRsp->sessionId)) { |
Naveen Rawat | efd71c3 | 2016-10-25 17:05:47 -0700 | [diff] [blame] | 9384 | profile = |
| 9385 | pMac->roam.roamSession[pSmeRsp->sessionId].pCurRoamProfile; |
| 9386 | if (profile && CSR_IS_CONN_NDI(profile)) { |
Deepak Dhamdhere | 13983f2 | 2016-05-31 19:06:09 -0700 | [diff] [blame] | 9387 | result_code = eCsrStopBssSuccess; |
| 9388 | if (pSmeRsp->statusCode != eSIR_SME_SUCCESS) |
| 9389 | result_code = eCsrStopBssFailure; |
| 9390 | } |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9391 | csr_roam_complete(pMac, result_code, NULL, pSmeRsp->sessionId); |
Naveen Rawat | efd71c3 | 2016-10-25 17:05:47 -0700 | [diff] [blame] | 9392 | } else if (CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE(pMac, |
| 9393 | pSmeRsp->sessionId)) { |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9394 | csr_roam_reissue_roam_command(pMac, pSmeRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9395 | } |
| 9396 | } |
| 9397 | |
| 9398 | /** |
| 9399 | * csr_dequeue_command() - removes a command from active cmd list |
| 9400 | * @pMac: mac global context |
| 9401 | * |
| 9402 | * Return: void |
| 9403 | */ |
| 9404 | static void |
| 9405 | csr_dequeue_command(tpAniSirGlobal mac_ctx) |
| 9406 | { |
| 9407 | bool fRemoveCmd; |
| 9408 | tSmeCmd *cmd = NULL; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 9409 | tListElem *entry = csr_nonscan_active_ll_peek_head(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9410 | LL_ACCESS_LOCK); |
| 9411 | if (!entry) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9412 | sme_err("NO commands are active"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9413 | return; |
| 9414 | } |
| 9415 | |
| 9416 | cmd = GET_BASE_ADDR(entry, tSmeCmd, Link); |
| 9417 | /* |
| 9418 | * If the head of the queue is Active and it is a given cmd type, remove |
| 9419 | * and put this on the Free queue. |
| 9420 | */ |
| 9421 | if (eSmeCommandRoam != cmd->command) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9422 | sme_err("Roam command not active"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9423 | return; |
| 9424 | } |
| 9425 | /* |
| 9426 | * we need to process the result first before removing it from active |
| 9427 | * list because state changes still happening insides |
| 9428 | * roamQProcessRoamResults so no other roam command should be issued. |
| 9429 | */ |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 9430 | fRemoveCmd = csr_nonscan_active_ll_remove_entry(mac_ctx, entry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9431 | LL_ACCESS_LOCK); |
| 9432 | if (cmd->u.roamCmd.fReleaseProfile) { |
| 9433 | csr_release_profile(mac_ctx, &cmd->u.roamCmd.roamProfile); |
| 9434 | cmd->u.roamCmd.fReleaseProfile = false; |
| 9435 | } |
| 9436 | if (fRemoveCmd) |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 9437 | csr_release_command(mac_ctx, cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9438 | else |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9439 | sme_err("fail to remove cmd reason %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9440 | cmd->u.roamCmd.roamReason); |
| 9441 | } |
| 9442 | |
| 9443 | /** |
| 9444 | * csr_post_roam_failure() - post roam failure back to csr and issues a disassoc |
| 9445 | * @pMac: mac global context |
| 9446 | * @session_id: session id |
| 9447 | * @roam_info: roam info struct |
| 9448 | * @scan_filter: scan filter to free |
| 9449 | * @cur_roam_profile: current csr roam profile |
| 9450 | * |
| 9451 | * Return: void |
| 9452 | */ |
| 9453 | static void |
| 9454 | csr_post_roam_failure(tpAniSirGlobal mac_ctx, |
| 9455 | uint32_t session_id, |
| 9456 | tCsrRoamInfo *roam_info, |
| 9457 | tCsrScanResultFilter *scan_filter, |
| 9458 | tCsrRoamProfile *cur_roam_profile) |
| 9459 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9460 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9461 | |
| 9462 | if (scan_filter) { |
| 9463 | csr_free_scan_filter(mac_ctx, scan_filter); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9464 | qdf_mem_free(scan_filter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9465 | } |
| 9466 | if (cur_roam_profile) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9467 | qdf_mem_free(cur_roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9468 | |
| 9469 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 9470 | csr_roam_synch_clean_up(mac_ctx, session_id); |
| 9471 | #endif |
| 9472 | /* Inform the upper layers that the reassoc failed */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9473 | qdf_mem_zero(roam_info, sizeof(tCsrRoamInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9474 | csr_roam_call_callback(mac_ctx, session_id, roam_info, 0, |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 9475 | eCSR_ROAM_FT_REASSOC_FAILED, |
| 9476 | eCSR_ROAM_RESULT_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9477 | /* |
| 9478 | * Issue a disassoc request so that PE/LIM uses this to clean-up the FT |
| 9479 | * session. Upon success, we would re-enter this routine after receiving |
| 9480 | * the disassoc response and will fall into the reassoc fail sub-state. |
| 9481 | * And, eventually call csr_roam_complete which would remove the roam |
| 9482 | * command from SME active queue. |
| 9483 | */ |
| 9484 | status = csr_roam_issue_disassociate(mac_ctx, session_id, |
| 9485 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9486 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9487 | sme_err( |
| 9488 | "csr_roam_issue_disassociate failed, status %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9489 | status); |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9490 | csr_roam_complete(mac_ctx, eCsrJoinFailure, NULL, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9491 | } |
| 9492 | } |
| 9493 | |
| 9494 | /** |
| 9495 | * csr_check_profile_in_scan_cache() - finds if roam profile is present in scan |
| 9496 | * cache or not |
| 9497 | * @pMac: mac global context |
| 9498 | * @scan_filter: out param, scan filter |
| 9499 | * @neighbor_roam_info: roam info struct |
| 9500 | * @hBSSList: scan result |
| 9501 | * |
| 9502 | * Return: true if found else false. |
| 9503 | */ |
| 9504 | static bool |
| 9505 | csr_check_profile_in_scan_cache(tpAniSirGlobal mac_ctx, |
| 9506 | tCsrScanResultFilter **scan_filter, |
| 9507 | tpCsrNeighborRoamControlInfo neighbor_roam_info, |
| 9508 | tScanResultHandle *hBSSList) |
| 9509 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9510 | QDF_STATUS status; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9511 | *scan_filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9512 | if (NULL == *scan_filter) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9513 | sme_err("alloc for ScanFilter failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9514 | return false; |
| 9515 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9516 | (*scan_filter)->scan_filter_for_roam = 1; |
| 9517 | status = csr_roam_prepare_filter_from_profile(mac_ctx, |
| 9518 | &neighbor_roam_info->csrNeighborRoamProfile, |
| 9519 | *scan_filter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9520 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9521 | sme_err( |
| 9522 | "failed to prepare scan filter, status %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9523 | status); |
| 9524 | return false; |
| 9525 | } |
| 9526 | status = csr_scan_get_result(mac_ctx, *scan_filter, hBSSList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9527 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9528 | sme_err( |
| 9529 | "csr_scan_get_result failed, status %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9530 | status); |
| 9531 | return false; |
| 9532 | } |
| 9533 | return true; |
| 9534 | } |
| 9535 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 9536 | static |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9537 | void csr_roam_roaming_state_disassoc_rsp_processor(tpAniSirGlobal pMac, |
| 9538 | tSirSmeDisassocRsp *pSmeRsp) |
| 9539 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9540 | tScanResultHandle hBSSList; |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 9541 | tCsrRoamInfo *roamInfo; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9542 | tCsrScanResultFilter *pScanFilter = NULL; |
| 9543 | uint32_t roamId = 0; |
| 9544 | tCsrRoamProfile *pCurRoamProfile = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9545 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9546 | uint32_t sessionId; |
| 9547 | tCsrRoamSession *pSession; |
| 9548 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL; |
| 9549 | tSirSmeDisassocRsp SmeDisassocRsp; |
| 9550 | |
| 9551 | csr_ser_des_unpack_diassoc_rsp((uint8_t *) pSmeRsp, &SmeDisassocRsp); |
| 9552 | sessionId = SmeDisassocRsp.sessionId; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9553 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, "sessionId %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9554 | sessionId); |
| 9555 | |
| 9556 | if (csr_is_conn_state_infra(pMac, sessionId)) { |
| 9557 | pMac->roam.roamSession[sessionId].connectState = |
| 9558 | eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 9559 | } |
| 9560 | |
| 9561 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 9562 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9563 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9564 | return; |
| 9565 | } |
| 9566 | |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 9567 | roamInfo = qdf_mem_malloc(sizeof(*roamInfo)); |
| 9568 | |
| 9569 | if (!roamInfo) { |
| 9570 | sme_err("failed to allocate memory"); |
| 9571 | return; |
| 9572 | } |
| 9573 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9574 | if (CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN(pMac, sessionId)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9575 | sme_debug("***eCsrNothingToJoin***"); |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9576 | csr_roam_complete(pMac, eCsrNothingToJoin, NULL, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9577 | } else if (CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED(pMac, sessionId) || |
| 9578 | CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ(pMac, sessionId)) { |
| 9579 | if (eSIR_SME_SUCCESS == SmeDisassocRsp.statusCode) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9580 | sme_debug("CSR force disassociated successful"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9581 | /* |
| 9582 | * A callback to HDD will be issued from |
| 9583 | * csr_roam_complete so no need to do anything here |
| 9584 | */ |
| 9585 | } |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9586 | csr_roam_complete(pMac, eCsrNothingToJoin, NULL, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9587 | } else if (CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9588 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9589 | "CSR SmeDisassocReq due to HO on session %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9590 | sessionId); |
| 9591 | pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9592 | /* |
| 9593 | * First ensure if the roam profile is in the scan cache. |
| 9594 | * If not, post a reassoc failure and disconnect. |
| 9595 | */ |
| 9596 | if (!csr_check_profile_in_scan_cache(pMac, &pScanFilter, |
| 9597 | pNeighborRoamInfo, &hBSSList)) |
| 9598 | goto POST_ROAM_FAILURE; |
| 9599 | |
| 9600 | /* |
| 9601 | * After ensuring that the roam profile is in the scan result |
| 9602 | * list, dequeue the command from the active list. |
| 9603 | */ |
| 9604 | csr_dequeue_command(pMac); |
| 9605 | |
| 9606 | /* notify HDD about handoff and provide the BSSID too */ |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 9607 | roamInfo->reasonCode = eCsrRoamReasonBetterAP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9608 | |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 9609 | qdf_copy_macaddr(&roamInfo->bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9610 | pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid); |
| 9611 | |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 9612 | csr_roam_call_callback(pMac, sessionId, roamInfo, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9613 | eCSR_ROAM_ROAMING_START, |
| 9614 | eCSR_ROAM_RESULT_NONE); |
| 9615 | |
| 9616 | /* |
| 9617 | * Copy the connected profile to apply the same for this |
| 9618 | * connection as well |
| 9619 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9620 | pCurRoamProfile = qdf_mem_malloc(sizeof(tCsrRoamProfile)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9621 | if (pCurRoamProfile != NULL) { |
| 9622 | /* |
| 9623 | * notify sub-modules like QoS etc. that handoff |
| 9624 | * happening |
| 9625 | */ |
| 9626 | sme_qos_csr_event_ind(pMac, sessionId, |
| 9627 | SME_QOS_CSR_HANDOFF_ASSOC_REQ, |
| 9628 | NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9629 | csr_roam_copy_profile(pMac, pCurRoamProfile, |
| 9630 | pSession->pCurRoamProfile); |
| 9631 | /* make sure to put it at the head of the cmd queue */ |
| 9632 | status = csr_roam_issue_connect(pMac, sessionId, |
| 9633 | pCurRoamProfile, hBSSList, |
| 9634 | eCsrSmeIssuedAssocToSimilarAP, |
| 9635 | roamId, true, false); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9636 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9637 | sme_err( |
| 9638 | "issue_connect failed. status %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9639 | status); |
| 9640 | |
| 9641 | csr_release_profile(pMac, pCurRoamProfile); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9642 | qdf_mem_free(pCurRoamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9643 | csr_free_scan_filter(pMac, pScanFilter); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9644 | qdf_mem_free(pScanFilter); |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 9645 | qdf_mem_free(roamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9646 | return; |
| 9647 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9648 | csr_scan_result_purge(pMac, hBSSList); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9649 | |
| 9650 | POST_ROAM_FAILURE: |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 9651 | csr_post_roam_failure(pMac, sessionId, roamInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9652 | pScanFilter, pCurRoamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9653 | } /* else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) ) */ |
| 9654 | else if (CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL(pMac, sessionId)) { |
| 9655 | /* Disassoc due to Reassoc failure falls into this codepath */ |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9656 | csr_roam_complete(pMac, eCsrJoinFailure, NULL, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9657 | } else { |
| 9658 | if (eSIR_SME_SUCCESS == SmeDisassocRsp.statusCode) { |
| 9659 | /* |
| 9660 | * Successfully disassociated from the 'old' Bss. |
| 9661 | * We get Disassociate response in three conditions. |
| 9662 | * 1) The case where we are disasociating from an Infra |
| 9663 | * Bss to start an IBSS. |
| 9664 | * 2) When we are disassociating from an Infra Bss to |
| 9665 | * join an IBSS or a new infra network. |
| 9666 | * 3) Where we are doing an Infra to Infra roam between |
| 9667 | * networks with different SSIDs. |
| 9668 | * In all cases, we set the new Bss configuration here |
| 9669 | * and attempt to join |
| 9670 | */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9671 | sme_debug("Disassociated successfully"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9672 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9673 | sme_err( |
| 9674 | "DisassocReq failed, statusCode= 0x%08X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9675 | SmeDisassocRsp.statusCode); |
| 9676 | } |
| 9677 | /* We are not done yet. Get the data and continue roaming */ |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9678 | csr_roam_reissue_roam_command(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9679 | } |
Kapil Gupta | ffa2602 | 2017-08-16 12:20:09 +0530 | [diff] [blame] | 9680 | qdf_mem_free(roamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9681 | } |
| 9682 | |
| 9683 | static void csr_roam_roaming_state_deauth_rsp_processor(tpAniSirGlobal pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9684 | tSirSmeDeauthRsp *pSmeRsp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9685 | { |
| 9686 | tSirResultCodes statusCode; |
| 9687 | /* No one is sending eWNI_SME_DEAUTH_REQ to PE. */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9688 | sme_debug("is no-op"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9689 | statusCode = csr_get_de_auth_rsp_status_code(pSmeRsp); |
| 9690 | pMac->roam.deauthRspStatus = statusCode; |
| 9691 | if (CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ(pMac, pSmeRsp->sessionId)) { |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9692 | csr_roam_complete(pMac, eCsrNothingToJoin, NULL, |
| 9693 | pSmeRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9694 | } else { |
| 9695 | if (eSIR_SME_SUCCESS == statusCode) { |
| 9696 | /* Successfully deauth from the 'old' Bss... */ |
| 9697 | /* */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9698 | sme_debug( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9699 | "CSR SmeDeauthReq disassociated Successfully"); |
| 9700 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9701 | sme_warn( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9702 | "SmeDeauthReq failed with statusCode= 0x%08X", |
| 9703 | statusCode); |
| 9704 | } |
| 9705 | /* We are not done yet. Get the data and continue roaming */ |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9706 | csr_roam_reissue_roam_command(pMac, pSmeRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9707 | } |
| 9708 | } |
| 9709 | |
| 9710 | static void csr_roam_roaming_state_start_bss_rsp_processor(tpAniSirGlobal pMac, |
| 9711 | tSirSmeStartBssRsp * |
| 9712 | pSmeStartBssRsp) |
| 9713 | { |
| 9714 | eCsrRoamCompleteResult result; |
| 9715 | |
| 9716 | if (eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9717 | sme_debug("SmeStartBssReq Successful"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9718 | result = eCsrStartBssSuccess; |
| 9719 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9720 | sme_warn("SmeStartBssReq failed with statusCode= 0x%08X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9721 | pSmeStartBssRsp->statusCode); |
| 9722 | /* Let csr_roam_complete decide what to do */ |
| 9723 | result = eCsrStartBssFailure; |
| 9724 | } |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 9725 | csr_roam_complete(pMac, result, pSmeStartBssRsp, |
| 9726 | pSmeStartBssRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9727 | } |
| 9728 | |
| 9729 | /** |
| 9730 | * csr_roaming_state_msg_processor() - process roaming messages |
| 9731 | * @pMac: mac global context |
| 9732 | * @pMsgBuf: message buffer |
| 9733 | * |
| 9734 | * We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of |
| 9735 | * strucutres. It depends on how the message is constructed. If the message is |
| 9736 | * sent by lim_send_sme_rsp, the pMsgBuf is only a generic response and can only |
| 9737 | * be used as pointer to tSirSmeRsp. For the messages where sender allocates |
| 9738 | * memory for specific structures, then it can be cast accordingly. |
| 9739 | * |
| 9740 | * Return: status of operation |
| 9741 | */ |
| 9742 | void csr_roaming_state_msg_processor(tpAniSirGlobal pMac, void *pMsgBuf) |
| 9743 | { |
| 9744 | tSirSmeRsp *pSmeRsp; |
| 9745 | tSmeIbssPeerInd *pIbssPeerInd; |
| 9746 | tCsrRoamInfo roamInfo; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9747 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9748 | pSmeRsp = (tSirSmeRsp *) pMsgBuf; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9749 | sme_debug("Message %d[0x%04X] received in substate %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9750 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 9751 | mac_trace_getcsr_roam_sub_state( |
| 9752 | pMac->roam.curSubState[pSmeRsp->sessionId])); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9753 | |
| 9754 | switch (pSmeRsp->messageType) { |
| 9755 | |
| 9756 | case eWNI_SME_JOIN_RSP: |
| 9757 | /* in Roaming state, process the Join response message... */ |
| 9758 | if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId)) |
| 9759 | /* We sent a JOIN_REQ */ |
| 9760 | csr_roam_join_rsp_processor(pMac, |
| 9761 | (tSirSmeJoinRsp *) pSmeRsp); |
| 9762 | break; |
| 9763 | case eWNI_SME_REASSOC_RSP: |
| 9764 | /* or the Reassociation response message... */ |
| 9765 | if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ(pMac, pSmeRsp->sessionId)) |
| 9766 | csr_roam_roaming_state_reassoc_rsp_processor(pMac, |
| 9767 | (tpSirSmeJoinRsp) pSmeRsp); |
| 9768 | break; |
| 9769 | case eWNI_SME_STOP_BSS_RSP: |
| 9770 | /* or the Stop Bss response message... */ |
| 9771 | csr_roam_roaming_state_stop_bss_rsp_processor(pMac, pSmeRsp); |
| 9772 | break; |
| 9773 | case eWNI_SME_DISASSOC_RSP: |
| 9774 | /* or the Disassociate response message... */ |
| 9775 | if (CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ(pMac, pSmeRsp->sessionId) |
| 9776 | || CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN(pMac, |
| 9777 | pSmeRsp->sessionId) |
| 9778 | || CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL(pMac, |
| 9779 | pSmeRsp->sessionId) |
| 9780 | || CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED(pMac, |
| 9781 | pSmeRsp->sessionId) |
| 9782 | || CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE(pMac, |
| 9783 | pSmeRsp->sessionId) |
| 9784 | || CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, |
| 9785 | pSmeRsp->sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 9786 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9787 | "eWNI_SME_DISASSOC_RSP subState = %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9788 | mac_trace_getcsr_roam_sub_state( |
| 9789 | pMac->roam.curSubState[pSmeRsp->sessionId])); |
| 9790 | csr_roam_roaming_state_disassoc_rsp_processor(pMac, |
| 9791 | (tSirSmeDisassocRsp *) pSmeRsp); |
| 9792 | } |
| 9793 | break; |
| 9794 | case eWNI_SME_DEAUTH_RSP: |
| 9795 | /* or the Deauthentication response message... */ |
Selvaraj, Sridhar | fd889b5 | 2016-06-24 12:37:04 +0530 | [diff] [blame] | 9796 | if (CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ(pMac, pSmeRsp->sessionId)) { |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 9797 | csr_remove_nonscan_cmd_from_pending_list(pMac, |
Selvaraj, Sridhar | fd889b5 | 2016-06-24 12:37:04 +0530 | [diff] [blame] | 9798 | pSmeRsp->sessionId, |
Selvaraj, Sridhar | fd889b5 | 2016-06-24 12:37:04 +0530 | [diff] [blame] | 9799 | eSmeCommandWmStatusChange); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9800 | csr_roam_roaming_state_deauth_rsp_processor(pMac, |
| 9801 | (tSirSmeDeauthRsp *) pSmeRsp); |
Selvaraj, Sridhar | fd889b5 | 2016-06-24 12:37:04 +0530 | [diff] [blame] | 9802 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9803 | break; |
| 9804 | case eWNI_SME_START_BSS_RSP: |
| 9805 | /* or the Start BSS response message... */ |
| 9806 | if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ(pMac, |
| 9807 | pSmeRsp->sessionId)) |
| 9808 | csr_roam_roaming_state_start_bss_rsp_processor(pMac, |
| 9809 | (tSirSmeStartBssRsp *) pSmeRsp); |
| 9810 | break; |
| 9811 | /* In case CSR issues STOP_BSS, we need to tell HDD about peer departed |
| 9812 | * becasue PE is removing them |
| 9813 | */ |
| 9814 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 9815 | pIbssPeerInd = (tSmeIbssPeerInd *) pSmeRsp; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9816 | sme_err("Peer departed ntf from LIM in joining state"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9817 | qdf_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9818 | roamInfo.staId = (uint8_t) pIbssPeerInd->staId; |
| 9819 | roamInfo.ucastSig = (uint8_t) pIbssPeerInd->ucastSig; |
| 9820 | roamInfo.bcastSig = (uint8_t) pIbssPeerInd->bcastSig; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 9821 | qdf_copy_macaddr(&roamInfo.peerMac, &pIbssPeerInd->peer_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9822 | csr_roam_call_callback(pMac, pSmeRsp->sessionId, &roamInfo, 0, |
| 9823 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 9824 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 9825 | break; |
| 9826 | case eWNI_SME_GET_RSSI_REQ: |
| 9827 | { |
| 9828 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq *) pMsgBuf; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9829 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9830 | if (NULL != pGetRssiReq->rssiCallback) |
| 9831 | ((tCsrRssiCallback) pGetRssiReq->rssiCallback) |
| 9832 | (pGetRssiReq->lastRSSI, pGetRssiReq->staId, |
| 9833 | pGetRssiReq->pDevContext); |
| 9834 | else |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9835 | sme_err("pGetRssiReq->rssiCallback is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9836 | } |
| 9837 | break; |
| 9838 | default: |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9839 | sme_debug("Unexpected message type: %d[0x%X] received in substate %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9840 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 9841 | mac_trace_getcsr_roam_sub_state( |
| 9842 | pMac->roam.curSubState[pSmeRsp->sessionId])); |
| 9843 | /* If we are connected, check the link status change */ |
| 9844 | if (!csr_is_conn_state_disconnected(pMac, pSmeRsp->sessionId)) |
| 9845 | csr_roam_check_for_link_status_change(pMac, pSmeRsp); |
| 9846 | break; |
| 9847 | } |
| 9848 | } |
| 9849 | |
| 9850 | void csr_roam_joined_state_msg_processor(tpAniSirGlobal pMac, void *pMsgBuf) |
| 9851 | { |
| 9852 | tSirSmeRsp *pSirMsg = (tSirSmeRsp *) pMsgBuf; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9853 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9854 | switch (pSirMsg->messageType) { |
| 9855 | case eWNI_SME_GET_STATISTICS_RSP: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9856 | sme_debug("Stats rsp from PE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9857 | csr_roam_stats_rsp_processor(pMac, pSirMsg); |
| 9858 | break; |
| 9859 | case eWNI_SME_UPPER_LAYER_ASSOC_CNF: |
| 9860 | { |
| 9861 | tCsrRoamSession *pSession; |
| 9862 | tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; |
| 9863 | tCsrRoamInfo roamInfo; |
| 9864 | tCsrRoamInfo *pRoamInfo = NULL; |
| 9865 | uint32_t sessionId; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9866 | QDF_STATUS status; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9867 | |
| 9868 | sme_debug("ASSOCIATION confirmation can be given to upper layer "); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9869 | qdf_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9870 | pRoamInfo = &roamInfo; |
| 9871 | pUpperLayerAssocCnf = |
| 9872 | (tSirSmeAssocIndToUpperLayerCnf *) pMsgBuf; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9873 | status = csr_roam_get_session_id_from_bssid(pMac, |
| 9874 | (struct qdf_mac_addr *) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9875 | pUpperLayerAssocCnf-> |
| 9876 | bssId, &sessionId); |
| 9877 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 9878 | |
| 9879 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 9880 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9881 | return; |
| 9882 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9883 | /* send the status code as Success */ |
| 9884 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9885 | pRoamInfo->u.pConnectedProfile = |
| 9886 | &pSession->connectedProfile; |
| 9887 | pRoamInfo->staId = (uint8_t) pUpperLayerAssocCnf->aid; |
| 9888 | pRoamInfo->rsnIELen = |
| 9889 | (uint8_t) pUpperLayerAssocCnf->rsnIE.length; |
| 9890 | pRoamInfo->prsnIE = |
| 9891 | pUpperLayerAssocCnf->rsnIE.rsnIEdata; |
| 9892 | #ifdef FEATURE_WLAN_WAPI |
| 9893 | pRoamInfo->wapiIELen = |
| 9894 | (uint8_t) pUpperLayerAssocCnf->wapiIE.length; |
| 9895 | pRoamInfo->pwapiIE = |
| 9896 | pUpperLayerAssocCnf->wapiIE.wapiIEdata; |
| 9897 | #endif |
| 9898 | pRoamInfo->addIELen = |
| 9899 | (uint8_t) pUpperLayerAssocCnf->addIE.length; |
| 9900 | pRoamInfo->paddIE = |
| 9901 | pUpperLayerAssocCnf->addIE.addIEdata; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9902 | qdf_mem_copy(pRoamInfo->peerMac.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9903 | pUpperLayerAssocCnf->peerMacAddr, |
| 9904 | sizeof(tSirMacAddr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9905 | qdf_mem_copy(&pRoamInfo->bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9906 | pUpperLayerAssocCnf->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 9907 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9908 | pRoamInfo->wmmEnabledSta = |
| 9909 | pUpperLayerAssocCnf->wmmEnabledSta; |
| 9910 | pRoamInfo->timingMeasCap = |
| 9911 | pUpperLayerAssocCnf->timingMeasCap; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9912 | qdf_mem_copy(&pRoamInfo->chan_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9913 | &pUpperLayerAssocCnf->chan_info, |
| 9914 | sizeof(tSirSmeChanInfo)); |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 9915 | pRoamInfo->ampdu = pUpperLayerAssocCnf->ampdu; |
| 9916 | pRoamInfo->sgi_enable = pUpperLayerAssocCnf->sgi_enable; |
| 9917 | pRoamInfo->tx_stbc = pUpperLayerAssocCnf->tx_stbc; |
| 9918 | pRoamInfo->tx_stbc = pUpperLayerAssocCnf->rx_stbc; |
| 9919 | pRoamInfo->ch_width = pUpperLayerAssocCnf->ch_width; |
| 9920 | pRoamInfo->mode = pUpperLayerAssocCnf->mode; |
| 9921 | pRoamInfo->max_supp_idx = pUpperLayerAssocCnf->max_supp_idx; |
| 9922 | pRoamInfo->max_ext_idx = pUpperLayerAssocCnf->max_ext_idx; |
| 9923 | pRoamInfo->max_mcs_idx = pUpperLayerAssocCnf->max_mcs_idx; |
| 9924 | pRoamInfo->rx_mcs_map = pUpperLayerAssocCnf->rx_mcs_map; |
| 9925 | pRoamInfo->tx_mcs_map = pUpperLayerAssocCnf->tx_mcs_map; |
gaolez | 7bb1e74 | 2017-03-21 16:37:38 +0800 | [diff] [blame] | 9926 | pRoamInfo->ecsa_capable = pUpperLayerAssocCnf->ecsa_capable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9927 | if (CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile)) { |
| 9928 | pMac->roam.roamSession[sessionId].connectState = |
| 9929 | eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED; |
| 9930 | pRoamInfo->fReassocReq = |
| 9931 | pUpperLayerAssocCnf->reassocReq; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9932 | status = csr_roam_call_callback(pMac, sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9933 | pRoamInfo, 0, |
| 9934 | eCSR_ROAM_INFRA_IND, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9935 | eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9936 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9937 | } |
| 9938 | break; |
| 9939 | default: |
| 9940 | csr_roam_check_for_link_status_change(pMac, pSirMsg); |
| 9941 | break; |
| 9942 | } |
| 9943 | } |
| 9944 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9945 | QDF_STATUS csr_roam_issue_set_context_req(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9946 | uint32_t sessionId, |
| 9947 | eCsrEncryptionType EncryptType, |
| 9948 | tSirBssDescription *pBssDescription, |
| 9949 | tSirMacAddr *bssId, bool addKey, |
| 9950 | bool fUnicast, |
| 9951 | tAniKeyDirection aniKeyDirection, |
| 9952 | uint8_t keyId, uint16_t keyLength, |
| 9953 | uint8_t *pKey, uint8_t paeRole) |
| 9954 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 9955 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9956 | tAniEdType edType; |
| 9957 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9958 | sme_debug("sessionId: %d EncryptType: %d", sessionId, EncryptType); |
Padma, Santhosh Kumar | cd35f53 | 2016-12-27 12:07:39 +0530 | [diff] [blame] | 9959 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9960 | if (eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9961 | EncryptType = eCSR_ENCRYPT_TYPE_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9962 | |
| 9963 | edType = csr_translate_encrypt_type_to_ed_type(EncryptType); |
| 9964 | |
| 9965 | /* |
| 9966 | * Allow 0 keys to be set for the non-WPA encrypt types. For WPA encrypt |
| 9967 | * types, the num keys must be non-zero or LIM will reject the set |
| 9968 | * context (assumes the SET_CONTEXT does not occur until the keys are |
| 9969 | * distrubuted). |
| 9970 | */ |
| 9971 | if (CSR_IS_ENC_TYPE_STATIC(EncryptType) || addKey) { |
| 9972 | tCsrRoamSetKey setKey; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9973 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9974 | setKey.encType = EncryptType; |
| 9975 | setKey.keyDirection = aniKeyDirection; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9976 | qdf_mem_copy(&setKey.peerMac, bssId, sizeof(struct |
| 9977 | qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9978 | /* 0 for supplicant */ |
| 9979 | setKey.paeRole = paeRole; |
| 9980 | /* Key index */ |
| 9981 | setKey.keyId = keyId; |
| 9982 | setKey.keyLength = keyLength; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 9983 | if (keyLength) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 9984 | qdf_mem_copy(setKey.Key, pKey, keyLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9985 | status = csr_roam_issue_set_key_command(pMac, sessionId, |
| 9986 | &setKey, 0); |
| 9987 | } |
| 9988 | return status; |
| 9989 | } |
| 9990 | |
| 9991 | /** |
| 9992 | * csr_update_key_cmd() - update key info in set key command |
| 9993 | * @mac_ctx: mac global context |
| 9994 | * @session: roam session |
| 9995 | * @set_key: input set key command |
| 9996 | * @set_key_cmd: set key command to update |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 9997 | * @is_key_valid: indicates if key is valid |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 9998 | * |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 9999 | * This function will validate the key length, adjust if too long. It will |
| 10000 | * update is_key_valid flag to false if some error has occured key are local. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10001 | * |
| 10002 | * Return: status of operation |
| 10003 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10004 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10005 | csr_update_key_cmd(tpAniSirGlobal mac_ctx, tCsrRoamSession *session, |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10006 | tCsrRoamSetKey *set_key, tSetKeyCmd *set_key_cmd, |
| 10007 | bool *is_key_valid) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10008 | { |
| 10009 | switch (set_key->encType) { |
| 10010 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 10011 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 10012 | /* KeyLength maybe 0 for static WEP */ |
| 10013 | if (set_key->keyLength) { |
| 10014 | if (set_key->keyLength < CSR_WEP40_KEY_LEN) { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10015 | sme_warn("Invalid WEP40 keylength [= %d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10016 | set_key->keyLength); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10017 | *is_key_valid = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10018 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10019 | } |
| 10020 | |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10021 | set_key_cmd->keyLength = CSR_WEP40_KEY_LEN; |
| 10022 | qdf_mem_copy(set_key_cmd->Key, set_key->Key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10023 | CSR_WEP40_KEY_LEN); |
| 10024 | } |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10025 | *is_key_valid = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10026 | break; |
| 10027 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 10028 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 10029 | /* KeyLength maybe 0 for static WEP */ |
| 10030 | if (set_key->keyLength) { |
| 10031 | if (set_key->keyLength < CSR_WEP104_KEY_LEN) { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10032 | sme_warn("Invalid WEP104 keylength [= %d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10033 | set_key->keyLength); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10034 | *is_key_valid = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10035 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10036 | } |
| 10037 | |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10038 | set_key_cmd->keyLength = CSR_WEP104_KEY_LEN; |
| 10039 | qdf_mem_copy(set_key_cmd->Key, set_key->Key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10040 | CSR_WEP104_KEY_LEN); |
| 10041 | } |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10042 | *is_key_valid = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10043 | break; |
| 10044 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 10045 | if (set_key->keyLength < CSR_TKIP_KEY_LEN) { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10046 | sme_warn("Invalid TKIP keylength [= %d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10047 | set_key->keyLength); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10048 | *is_key_valid = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10049 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10050 | } |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10051 | set_key_cmd->keyLength = CSR_TKIP_KEY_LEN; |
| 10052 | qdf_mem_copy(set_key_cmd->Key, set_key->Key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10053 | CSR_TKIP_KEY_LEN); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10054 | *is_key_valid = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10055 | break; |
| 10056 | case eCSR_ENCRYPT_TYPE_AES: |
| 10057 | if (set_key->keyLength < CSR_AES_KEY_LEN) { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10058 | sme_warn("Invalid AES/CCMP keylength [= %d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10059 | set_key->keyLength); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10060 | *is_key_valid = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10061 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10062 | } |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10063 | set_key_cmd->keyLength = CSR_AES_KEY_LEN; |
| 10064 | qdf_mem_copy(set_key_cmd->Key, set_key->Key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10065 | CSR_AES_KEY_LEN); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10066 | *is_key_valid = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10067 | break; |
| 10068 | #ifdef FEATURE_WLAN_WAPI |
| 10069 | case eCSR_ENCRYPT_TYPE_WPI: |
| 10070 | if (set_key->keyLength < CSR_WAPI_KEY_LEN) { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10071 | sme_warn("Invalid WAPI keylength [= %d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10072 | set_key->keyLength); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10073 | *is_key_valid = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10074 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10075 | } |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10076 | set_key_cmd->keyLength = CSR_WAPI_KEY_LEN; |
| 10077 | qdf_mem_copy(set_key_cmd->Key, set_key->Key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10078 | CSR_WAPI_KEY_LEN); |
| 10079 | if (session->pCurRoamProfile) { |
| 10080 | session->pCurRoamProfile->negotiatedUCEncryptionType = |
| 10081 | eCSR_ENCRYPT_TYPE_WPI; |
| 10082 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10083 | sme_err("pCurRoamProfile is NULL"); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10084 | *is_key_valid = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10085 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10086 | } |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10087 | *is_key_valid = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10088 | break; |
| 10089 | #endif /* FEATURE_WLAN_WAPI */ |
| 10090 | #ifdef FEATURE_WLAN_ESE |
| 10091 | case eCSR_ENCRYPT_TYPE_KRK: |
| 10092 | /* no need to enqueue KRK key request, since they are local */ |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10093 | *is_key_valid = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10094 | if (set_key->keyLength < CSR_KRK_KEY_LEN) { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10095 | sme_warn("Invalid KRK keylength [= %d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10096 | set_key->keyLength); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10097 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10098 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10099 | qdf_mem_copy(session->eseCckmInfo.krk, set_key->Key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10100 | CSR_KRK_KEY_LEN); |
| 10101 | session->eseCckmInfo.reassoc_req_num = 1; |
| 10102 | session->eseCckmInfo.krk_plumbed = true; |
| 10103 | break; |
| 10104 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 10105 | case eCSR_ENCRYPT_TYPE_BTK: |
| 10106 | /* no need to enqueue KRK key request, since they are local */ |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10107 | *is_key_valid = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10108 | if (set_key->keyLength < SIR_BTK_KEY_LEN) { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10109 | sme_warn("LFR3:Invalid BTK keylength [= %d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10110 | set_key->keyLength); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10111 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10112 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10113 | qdf_mem_copy(session->eseCckmInfo.btk, set_key->Key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10114 | SIR_BTK_KEY_LEN); |
| 10115 | break; |
| 10116 | #endif |
| 10117 | #endif /* FEATURE_WLAN_ESE */ |
| 10118 | #ifdef WLAN_FEATURE_11W |
| 10119 | /* Check for 11w BIP */ |
| 10120 | case eCSR_ENCRYPT_TYPE_AES_CMAC: |
| 10121 | if (set_key->keyLength < CSR_AES_KEY_LEN) { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10122 | sme_warn("Invalid AES/CCMP keylength [= %d]", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10123 | set_key->keyLength); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10124 | *is_key_valid = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10125 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10126 | } |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10127 | set_key_cmd->keyLength = CSR_AES_KEY_LEN; |
| 10128 | qdf_mem_copy(set_key_cmd->Key, set_key->Key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10129 | CSR_AES_KEY_LEN); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10130 | *is_key_valid = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10131 | break; |
| 10132 | #endif /* WLAN_FEATURE_11W */ |
| 10133 | default: |
| 10134 | /* for open security also we want to enqueue command */ |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10135 | *is_key_valid = true; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10136 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10137 | } /* end of switch */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10138 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10139 | } |
| 10140 | |
| 10141 | |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10142 | static QDF_STATUS csr_roam_issue_set_key_command(tpAniSirGlobal mac_ctx, |
| 10143 | uint32_t session_id, |
| 10144 | tCsrRoamSetKey *set_key, |
| 10145 | uint32_t roam_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10146 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10147 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10148 | bool is_key_valid = true; |
| 10149 | tSetKeyCmd set_key_cmd; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10150 | #if defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_WAPI) |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10151 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10152 | |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10153 | if (NULL == session) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10154 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10155 | "session %d not found", session_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10156 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10157 | } |
| 10158 | #endif /* FEATURE_WLAN_ESE */ |
| 10159 | |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10160 | qdf_mem_zero(&set_key_cmd, sizeof(tSetKeyCmd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10161 | /* |
| 10162 | * following function will validate the key length, Adjust if too long. |
| 10163 | * for static WEP the keys are not set thru' SetContextReq |
| 10164 | * |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10165 | * it will update bool is_key_valid, to false if some error has occured |
| 10166 | * key are local. enqueue sme command only if is_key_valid is true |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10167 | * status is indication of success or failure and will be returned to |
| 10168 | * called of current function if command is not enqueued due to key req |
| 10169 | * being local |
| 10170 | */ |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10171 | status = csr_update_key_cmd(mac_ctx, session, set_key, |
| 10172 | &set_key_cmd, &is_key_valid); |
| 10173 | if (is_key_valid) { |
| 10174 | set_key_cmd.roamId = roam_id; |
| 10175 | set_key_cmd.encType = set_key->encType; |
| 10176 | set_key_cmd.keyDirection = set_key->keyDirection; |
| 10177 | qdf_copy_macaddr(&set_key_cmd.peermac, |
| 10178 | &set_key->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10179 | /* 0 for supplicant */ |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10180 | set_key_cmd.paeRole = set_key->paeRole; |
| 10181 | set_key_cmd.keyId = set_key->keyId; |
| 10182 | qdf_mem_copy(set_key_cmd.keyRsc, set_key->keyRsc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10183 | CSR_MAX_RSC_LEN); |
| 10184 | /* |
| 10185 | * Always put set key to the head of the Q because it is the |
| 10186 | * only thing to get executed in case of WT_KEY state |
| 10187 | */ |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10188 | sme_debug("set key req for session-%d authtype-%d", |
| 10189 | session_id, set_key->encType); |
| 10190 | status = csr_roam_send_set_key_cmd(mac_ctx, session_id, |
| 10191 | &set_key_cmd); |
| 10192 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 10193 | sme_err("fail to send message status = %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10194 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10195 | return status; |
| 10196 | } |
| 10197 | |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10198 | QDF_STATUS csr_roam_send_set_key_cmd(tpAniSirGlobal mac_ctx, |
| 10199 | uint32_t session_id, tSetKeyCmd *set_key_cmd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10200 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10201 | QDF_STATUS status; |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10202 | uint8_t num_keys = (set_key_cmd->keyLength) ? 1 : 0; |
| 10203 | tAniEdType ed_type = csr_translate_encrypt_type_to_ed_type( |
| 10204 | set_key_cmd->encType); |
| 10205 | bool unicast = (set_key_cmd->peermac.bytes[0] == 0xFF) ? false : true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10206 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10207 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10208 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10209 | WLAN_HOST_DIAG_EVENT_DEF(setKeyEvent, |
| 10210 | host_event_wlan_security_payload_type); |
| 10211 | |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10212 | if (NULL == session) { |
| 10213 | sme_err("session %d not found", session_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10214 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10215 | } |
| 10216 | |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10217 | if (eSIR_ED_NONE != ed_type) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10218 | qdf_mem_set(&setKeyEvent, |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10219 | sizeof(host_event_wlan_security_payload_type), 0); |
| 10220 | if (qdf_is_macaddr_group(&set_key_cmd->peermac)) { |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 10221 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_BCAST_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10222 | setKeyEvent.encryptionModeMulticast = |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10223 | (uint8_t) diag_enc_type_from_csr_type( |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10224 | set_key_cmd->encType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10225 | setKeyEvent.encryptionModeUnicast = |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10226 | (uint8_t) diag_enc_type_from_csr_type(session-> |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10227 | connectedProfile. |
| 10228 | EncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10229 | } else { |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 10230 | setKeyEvent.eventId = |
| 10231 | WLAN_SECURITY_EVENT_SET_UNICAST_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10232 | setKeyEvent.encryptionModeUnicast = |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10233 | (uint8_t) diag_enc_type_from_csr_type( |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10234 | set_key_cmd->encType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10235 | setKeyEvent.encryptionModeMulticast = |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10236 | (uint8_t) diag_enc_type_from_csr_type(session-> |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10237 | connectedProfile. |
| 10238 | mcEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10239 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10240 | qdf_mem_copy(setKeyEvent.bssid, |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10241 | session->connectedProfile.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10242 | QDF_MAC_ADDR_SIZE); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10243 | if (CSR_IS_ENC_TYPE_STATIC(set_key_cmd->encType)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10244 | uint32_t defKeyId; |
| 10245 | /* It has to be static WEP here */ |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10246 | if (IS_SIR_STATUS_SUCCESS(wlan_cfg_get_int(mac_ctx, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10247 | WNI_CFG_WEP_DEFAULT_KEYID, |
| 10248 | &defKeyId))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10249 | setKeyEvent.keyId = (uint8_t) defKeyId; |
| 10250 | } |
| 10251 | } else { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10252 | setKeyEvent.keyId = set_key_cmd->keyId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10253 | } |
| 10254 | setKeyEvent.authMode = |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10255 | (uint8_t) diag_auth_type_from_csr_type(session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10256 | connectedProfile. |
| 10257 | AuthType); |
| 10258 | WLAN_HOST_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 10259 | } |
| 10260 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10261 | if (csr_is_set_key_allowed(mac_ctx, session_id)) { |
| 10262 | status = csr_send_mb_set_context_req_msg(mac_ctx, session_id, |
| 10263 | set_key_cmd->peermac, |
| 10264 | num_keys, ed_type, unicast, |
| 10265 | set_key_cmd->keyDirection, |
| 10266 | set_key_cmd->keyId, |
| 10267 | set_key_cmd->keyLength, |
| 10268 | set_key_cmd->Key, |
| 10269 | set_key_cmd->paeRole, |
| 10270 | set_key_cmd->keyRsc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10271 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10272 | sme_warn(" cannot process not connected"); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10273 | /* Set this status so the error handling take |
| 10274 | * care of the case. |
| 10275 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10276 | status = QDF_STATUS_CSR_WRONG_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10277 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10278 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10279 | sme_err(" error status %d", status); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10280 | csr_roam_call_callback(mac_ctx, session_id, NULL, |
| 10281 | set_key_cmd->roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10282 | eCSR_ROAM_SET_KEY_COMPLETE, |
| 10283 | eCSR_ROAM_RESULT_FAILURE); |
| 10284 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10285 | if (eSIR_ED_NONE != ed_type) { |
| 10286 | if (qdf_is_macaddr_group(&set_key_cmd->peermac)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10287 | setKeyEvent.eventId = |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 10288 | WLAN_SECURITY_EVENT_SET_BCAST_RSP; |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 10289 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10290 | setKeyEvent.eventId = |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 10291 | WLAN_SECURITY_EVENT_SET_UNICAST_RSP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10292 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 10293 | WLAN_HOST_DIAG_EVENT_REPORT(&setKeyEvent, |
| 10294 | EVENT_WLAN_SECURITY); |
| 10295 | } |
| 10296 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 10297 | } |
| 10298 | return status; |
| 10299 | } |
| 10300 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10301 | QDF_STATUS csr_roam_set_key(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10302 | tCsrRoamSetKey *pSetKey, uint32_t roamId) |
| 10303 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10304 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10305 | |
| 10306 | if (!csr_is_set_key_allowed(pMac, sessionId)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10307 | status = QDF_STATUS_CSR_WRONG_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10308 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10309 | status = csr_roam_issue_set_key_command(pMac, sessionId, |
| 10310 | pSetKey, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10311 | } |
| 10312 | return status; |
| 10313 | } |
| 10314 | |
| 10315 | /* |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10316 | * Prepare a filter base on a profile for parsing the scan results. |
| 10317 | * Upon successful return, caller MUST call csr_free_scan_filter on |
| 10318 | *pScanFilter when it is done with the filter. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10319 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10320 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10321 | csr_roam_prepare_filter_from_profile(tpAniSirGlobal mac_ctx, |
| 10322 | tCsrRoamProfile *profile, |
| 10323 | tCsrScanResultFilter *scan_fltr) |
| 10324 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10325 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10326 | uint32_t size = 0; |
| 10327 | uint8_t idx = 0; |
| 10328 | tCsrChannelInfo *fltr_ch_info = &scan_fltr->ChannelInfo; |
| 10329 | tCsrChannelInfo *profile_ch_info = &profile->ChannelInfo; |
| 10330 | struct roam_ext_params *roam_params; |
| 10331 | uint8_t i; |
| 10332 | |
| 10333 | roam_params = &mac_ctx->roam.configParam.roam_params; |
| 10334 | |
| 10335 | if (profile->BSSIDs.numOfBSSIDs) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10336 | size = sizeof(struct qdf_mac_addr) * profile->BSSIDs. |
| 10337 | numOfBSSIDs; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10338 | scan_fltr->BSSIDs.bssid = qdf_mem_malloc(size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10339 | if (NULL == scan_fltr->BSSIDs.bssid) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10340 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10341 | goto free_filter; |
| 10342 | } |
| 10343 | scan_fltr->BSSIDs.numOfBSSIDs = profile->BSSIDs.numOfBSSIDs; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10344 | qdf_mem_copy(scan_fltr->BSSIDs.bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10345 | profile->BSSIDs.bssid, size); |
| 10346 | } |
| 10347 | |
| 10348 | if (profile->SSIDs.numOfSSIDs) { |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 10349 | scan_fltr->SSIDs.numOfSSIDs = profile->SSIDs.numOfSSIDs; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10350 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10351 | ("No of Allowed List:%d"), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10352 | roam_params->num_ssid_allowed_list); |
| 10353 | if (scan_fltr->scan_filter_for_roam |
| 10354 | && roam_params->num_ssid_allowed_list) { |
| 10355 | scan_fltr->SSIDs.numOfSSIDs = |
| 10356 | roam_params->num_ssid_allowed_list; |
| 10357 | size = sizeof(tCsrSSIDInfo) * |
| 10358 | scan_fltr->SSIDs.numOfSSIDs; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10359 | scan_fltr->SSIDs.SSIDList = qdf_mem_malloc(size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10360 | if (NULL == scan_fltr->SSIDs.SSIDList) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10361 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10362 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10363 | status = QDF_STATUS_SUCCESS; |
| 10364 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10365 | goto free_filter; |
| 10366 | for (i = 0; |
| 10367 | i < roam_params->num_ssid_allowed_list; |
| 10368 | i++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10369 | qdf_mem_copy((void *) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10370 | scan_fltr->SSIDs.SSIDList[i].SSID.ssId, |
| 10371 | roam_params->ssid_allowed_list[i].ssId, |
| 10372 | roam_params->ssid_allowed_list[i].length); |
| 10373 | scan_fltr->SSIDs.SSIDList[i].SSID.length = |
| 10374 | roam_params->ssid_allowed_list[i].length; |
| 10375 | scan_fltr->SSIDs.SSIDList[i].handoffPermitted = |
| 10376 | 1; |
| 10377 | scan_fltr->SSIDs.SSIDList[i].ssidHidden = 0; |
| 10378 | } |
| 10379 | } else { |
| 10380 | size = sizeof(tCsrSSIDInfo) * |
| 10381 | profile->SSIDs.numOfSSIDs; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10382 | scan_fltr->SSIDs.SSIDList = qdf_mem_malloc(size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10383 | if (NULL == scan_fltr->SSIDs.SSIDList) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10384 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10385 | goto free_filter; |
| 10386 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10387 | qdf_mem_copy(scan_fltr->SSIDs.SSIDList, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10388 | profile->SSIDs.SSIDList, size); |
| 10389 | } |
| 10390 | } |
| 10391 | |
| 10392 | if (!profile_ch_info->ChannelList |
| 10393 | || (profile_ch_info->ChannelList[0] == 0)) { |
| 10394 | fltr_ch_info->numOfChannels = 0; |
| 10395 | fltr_ch_info->ChannelList = NULL; |
| 10396 | } else if (profile_ch_info->numOfChannels) { |
| 10397 | fltr_ch_info->numOfChannels = 0; |
| 10398 | fltr_ch_info->ChannelList = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10399 | qdf_mem_malloc(sizeof(*(fltr_ch_info->ChannelList)) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10400 | profile_ch_info->numOfChannels); |
| 10401 | if (NULL == fltr_ch_info->ChannelList) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10402 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10403 | goto free_filter; |
| 10404 | } |
| 10405 | |
| 10406 | for (idx = 0; idx < profile_ch_info->numOfChannels; idx++) { |
| 10407 | if (csr_roam_is_channel_valid(mac_ctx, |
| 10408 | profile_ch_info->ChannelList[idx])) { |
| 10409 | fltr_ch_info-> |
| 10410 | ChannelList[fltr_ch_info->numOfChannels] |
| 10411 | = profile_ch_info->ChannelList[idx]; |
| 10412 | fltr_ch_info->numOfChannels++; |
| 10413 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10414 | sme_debug( |
| 10415 | "Channel (%d) is invalid", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10416 | profile_ch_info->ChannelList[idx]); |
| 10417 | } |
| 10418 | } |
| 10419 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10420 | sme_err("Channel list empty"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10421 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10422 | goto free_filter; |
| 10423 | } |
| 10424 | scan_fltr->uapsd_mask = profile->uapsd_mask; |
| 10425 | scan_fltr->authType = profile->AuthType; |
| 10426 | scan_fltr->EncryptionType = profile->EncryptionType; |
| 10427 | scan_fltr->mcEncryptionType = profile->mcEncryptionType; |
| 10428 | scan_fltr->BSSType = profile->BSSType; |
| 10429 | scan_fltr->phyMode = profile->phyMode; |
| 10430 | #ifdef FEATURE_WLAN_WAPI |
| 10431 | /* |
| 10432 | * check if user asked for WAPI with 11n or auto mode, in that |
| 10433 | * case modify the phymode to 11g |
| 10434 | */ |
| 10435 | if (csr_is_profile_wapi(profile)) { |
| 10436 | if (scan_fltr->phyMode & eCSR_DOT11_MODE_11n) |
| 10437 | scan_fltr->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 10438 | if (scan_fltr->phyMode & eCSR_DOT11_MODE_AUTO) |
| 10439 | scan_fltr->phyMode &= ~eCSR_DOT11_MODE_AUTO; |
| 10440 | if (!scan_fltr->phyMode) |
| 10441 | scan_fltr->phyMode = eCSR_DOT11_MODE_11g; |
| 10442 | } |
| 10443 | #endif /* FEATURE_WLAN_WAPI */ |
| 10444 | /*Save the WPS info */ |
| 10445 | scan_fltr->bWPSAssociation = profile->bWPSAssociation; |
| 10446 | scan_fltr->bOSENAssociation = profile->bOSENAssociation; |
| 10447 | if (profile->countryCode[0]) { |
| 10448 | /* |
| 10449 | * This causes the matching function to use countryCode as one |
| 10450 | * of the criteria. |
| 10451 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10452 | qdf_mem_copy(scan_fltr->countryCode, profile->countryCode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10453 | WNI_CFG_COUNTRY_CODE_LEN); |
| 10454 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10455 | if (profile->MDID.mdiePresent) { |
| 10456 | scan_fltr->MDID.mdiePresent = 1; |
| 10457 | scan_fltr->MDID.mobilityDomain = profile->MDID.mobilityDomain; |
| 10458 | } |
Abhishek Singh | 3c9910e | 2017-01-06 17:56:47 +0530 | [diff] [blame] | 10459 | qdf_mem_copy(scan_fltr->bssid_hint.bytes, |
| 10460 | profile->bssid_hint.bytes, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10461 | |
| 10462 | #ifdef WLAN_FEATURE_11W |
| 10463 | /* Management Frame Protection */ |
| 10464 | scan_fltr->MFPEnabled = profile->MFPEnabled; |
| 10465 | scan_fltr->MFPRequired = profile->MFPRequired; |
| 10466 | scan_fltr->MFPCapable = profile->MFPCapable; |
| 10467 | #endif |
| 10468 | scan_fltr->csrPersona = profile->csrPersona; |
| 10469 | |
| 10470 | free_filter: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10471 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10472 | csr_free_scan_filter(mac_ctx, scan_fltr); |
| 10473 | |
| 10474 | return status; |
| 10475 | } |
| 10476 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 10477 | static |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10478 | bool csr_roam_issue_wm_status_change(tpAniSirGlobal pMac, uint32_t sessionId, |
| 10479 | eCsrRoamWmStatusChangeTypes Type, |
| 10480 | tSirSmeRsp *pSmeRsp) |
| 10481 | { |
| 10482 | bool fCommandQueued = false; |
| 10483 | tSmeCmd *pCommand; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10484 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10485 | do { |
| 10486 | /* Validate the type is ok... */ |
| 10487 | if ((eCsrDisassociated != Type) |
| 10488 | && (eCsrDeauthenticated != Type)) |
| 10489 | break; |
| 10490 | pCommand = csr_get_command_buffer(pMac); |
| 10491 | if (!pCommand) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10492 | sme_err(" fail to get command buffer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10493 | break; |
| 10494 | } |
| 10495 | /* Change the substate in case it is waiting for key */ |
| 10496 | if (CSR_IS_WAIT_FOR_KEY(pMac, sessionId)) { |
| 10497 | csr_roam_stop_wait_for_key_timer(pMac); |
| 10498 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_NONE, |
| 10499 | sessionId); |
| 10500 | } |
| 10501 | pCommand->command = eSmeCommandWmStatusChange; |
| 10502 | pCommand->sessionId = (uint8_t) sessionId; |
| 10503 | pCommand->u.wmStatusChangeCmd.Type = Type; |
| 10504 | if (eCsrDisassociated == Type) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10505 | qdf_mem_copy(&pCommand->u.wmStatusChangeCmd.u. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10506 | DisassocIndMsg, pSmeRsp, |
| 10507 | sizeof(pCommand->u.wmStatusChangeCmd.u. |
| 10508 | DisassocIndMsg)); |
| 10509 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10510 | qdf_mem_copy(&pCommand->u.wmStatusChangeCmd.u. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10511 | DeauthIndMsg, pSmeRsp, |
| 10512 | sizeof(pCommand->u.wmStatusChangeCmd.u. |
| 10513 | DeauthIndMsg)); |
| 10514 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10515 | if (QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10516 | (csr_queue_sme_command(pMac, pCommand, true))) { |
| 10517 | fCommandQueued = true; |
| 10518 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10519 | sme_err("fail to send message"); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 10520 | csr_release_command(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10521 | } |
| 10522 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10523 | /* AP has issued Dissac/Deauth, Set the operating mode |
| 10524 | * value to configured value |
| 10525 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10526 | csr_set_default_dot11_mode(pMac); |
| 10527 | } while (0); |
| 10528 | return fCommandQueued; |
| 10529 | } |
| 10530 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10531 | static QDF_STATUS csr_send_snr_request(void *pGetRssiReq) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10532 | { |
| 10533 | void *wma_handle; |
| 10534 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10535 | wma_handle = cds_get_context(QDF_MODULE_ID_WMA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10536 | if (!wma_handle) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10537 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10538 | "wma_handle is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10539 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10540 | } |
| 10541 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10542 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10543 | wma_send_snr_request(wma_handle, pGetRssiReq)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 10544 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10545 | "Failed to Trigger wma stats request"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10546 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10547 | } |
| 10548 | |
| 10549 | /* dont send success, otherwise call back |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10550 | * will released with out values |
| 10551 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10552 | return QDF_STATUS_E_BUSY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10553 | } |
| 10554 | |
| 10555 | static void csr_update_rssi(tpAniSirGlobal pMac, void *pMsg) |
| 10556 | { |
| 10557 | int8_t rssi = 0; |
| 10558 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq *) pMsg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10559 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10560 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10561 | if (pGetRssiReq) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10562 | if (NULL != pGetRssiReq->p_cds_context) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10563 | qdf_status = csr_send_snr_request(pGetRssiReq); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10564 | else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10565 | sme_err("GetRssiReq->p_cds_context is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10566 | return; |
| 10567 | } |
| 10568 | |
| 10569 | if (NULL != pGetRssiReq->rssiCallback) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10570 | if (qdf_status != QDF_STATUS_E_BUSY) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10571 | ((tCsrRssiCallback) (pGetRssiReq->rssiCallback)) |
| 10572 | (rssi, pGetRssiReq->staId, |
| 10573 | pGetRssiReq->pDevContext); |
| 10574 | else |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10575 | sme_debug("rssi request is posted. waiting for reply"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10576 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10577 | sme_err("GetRssiReq->rssiCallback is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10578 | return; |
| 10579 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10580 | } else |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10581 | sme_err("pGetRssiReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10582 | |
| 10583 | } |
| 10584 | |
| 10585 | static void csr_update_snr(tpAniSirGlobal pMac, void *pMsg) |
| 10586 | { |
| 10587 | tAniGetSnrReq *pGetSnrReq = (tAniGetSnrReq *) pMsg; |
| 10588 | |
| 10589 | if (pGetSnrReq) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10590 | if (QDF_STATUS_SUCCESS != wma_get_snr(pGetSnrReq)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10591 | sme_err("Error in wma_get_snr"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10592 | return; |
| 10593 | } |
| 10594 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10595 | } else |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10596 | sme_err("pGetSnrReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10597 | } |
| 10598 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10599 | static QDF_STATUS csr_send_reset_ap_caps_changed(tpAniSirGlobal pMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10600 | struct qdf_mac_addr *bssId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10601 | { |
| 10602 | tpSirResetAPCapsChange pMsg; |
| 10603 | uint16_t len; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10604 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10605 | |
| 10606 | /* Create the message and send to lim */ |
| 10607 | len = sizeof(tSirResetAPCapsChange); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10608 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10609 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10610 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10611 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10612 | status = QDF_STATUS_SUCCESS; |
Srinivas Girigowda | 40567b9 | 2015-09-24 15:17:25 -0700 | [diff] [blame] | 10613 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10614 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10615 | pMsg->messageType = eWNI_SME_RESET_AP_CAPS_CHANGED; |
| 10616 | pMsg->length = len; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 10617 | qdf_copy_macaddr(&pMsg->bssId, bssId); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10618 | sme_debug( |
| 10619 | "CSR reset caps change for Bssid= " MAC_ADDRESS_STR, |
Srinivas Girigowda | 40567b9 | 2015-09-24 15:17:25 -0700 | [diff] [blame] | 10620 | MAC_ADDR_ARRAY(pMsg->bssId.bytes)); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 10621 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10622 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10623 | sme_err("Memory allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10624 | } |
| 10625 | return status; |
| 10626 | } |
| 10627 | |
| 10628 | static void |
| 10629 | csr_roam_chk_lnk_assoc_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 10630 | { |
| 10631 | tCsrRoamSession *session; |
| 10632 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10633 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10634 | tCsrRoamInfo *roam_info_ptr = NULL; |
| 10635 | tSirSmeAssocInd *pAssocInd; |
| 10636 | tCsrRoamInfo roam_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10637 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10638 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10639 | sme_debug("Receive WNI_SME_ASSOC_IND from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10640 | pAssocInd = (tSirSmeAssocInd *) msg_ptr; |
| 10641 | status = csr_roam_get_session_id_from_bssid(mac_ctx, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10642 | (struct qdf_mac_addr *) pAssocInd->bssId, |
| 10643 | &sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10644 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10645 | sme_debug("Couldn't find session_id for given BSSID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10646 | return; |
| 10647 | } |
| 10648 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 10649 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10650 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10651 | return; |
| 10652 | } |
| 10653 | roam_info_ptr = &roam_info; |
| 10654 | /* Required for indicating the frames to upper layer */ |
| 10655 | roam_info_ptr->assocReqLength = pAssocInd->assocReqLength; |
| 10656 | roam_info_ptr->assocReqPtr = pAssocInd->assocReqPtr; |
| 10657 | roam_info_ptr->beaconPtr = pAssocInd->beaconPtr; |
| 10658 | roam_info_ptr->beaconLength = pAssocInd->beaconLength; |
| 10659 | roam_info_ptr->statusCode = eSIR_SME_SUCCESS; |
| 10660 | roam_info_ptr->u.pConnectedProfile = &session->connectedProfile; |
| 10661 | roam_info_ptr->staId = (uint8_t) pAssocInd->staId; |
| 10662 | roam_info_ptr->rsnIELen = (uint8_t) pAssocInd->rsnIE.length; |
| 10663 | roam_info_ptr->prsnIE = pAssocInd->rsnIE.rsnIEdata; |
| 10664 | #ifdef FEATURE_WLAN_WAPI |
| 10665 | roam_info_ptr->wapiIELen = (uint8_t) pAssocInd->wapiIE.length; |
| 10666 | roam_info_ptr->pwapiIE = pAssocInd->wapiIE.wapiIEdata; |
| 10667 | #endif |
| 10668 | roam_info_ptr->addIELen = (uint8_t) pAssocInd->addIE.length; |
| 10669 | roam_info_ptr->paddIE = pAssocInd->addIE.addIEdata; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10670 | qdf_mem_copy(roam_info_ptr->peerMac.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10671 | pAssocInd->peerMacAddr, |
| 10672 | sizeof(tSirMacAddr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10673 | qdf_mem_copy(roam_info_ptr->bssid.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10674 | pAssocInd->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10675 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10676 | roam_info_ptr->wmmEnabledSta = pAssocInd->wmmEnabledSta; |
| 10677 | roam_info_ptr->timingMeasCap = pAssocInd->timingMeasCap; |
gaolez | 7bb1e74 | 2017-03-21 16:37:38 +0800 | [diff] [blame] | 10678 | roam_info_ptr->ecsa_capable = pAssocInd->ecsa_capable; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10679 | qdf_mem_copy(&roam_info_ptr->chan_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10680 | &pAssocInd->chan_info, |
| 10681 | sizeof(tSirSmeChanInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10682 | if (CSR_IS_INFRA_AP(roam_info_ptr->u.pConnectedProfile)) { |
| 10683 | if (session->pCurRoamProfile && |
| 10684 | CSR_IS_ENC_TYPE_STATIC( |
| 10685 | session->pCurRoamProfile->negotiatedUCEncryptionType)) { |
| 10686 | /* NO keys... these key parameters don't matter. */ |
| 10687 | csr_roam_issue_set_context_req(mac_ctx, sessionId, |
| 10688 | session->pCurRoamProfile->negotiatedUCEncryptionType, |
| 10689 | session->pConnectBssDesc, |
| 10690 | &(roam_info_ptr->peerMac.bytes), |
| 10691 | false, true, eSIR_TX_RX, 0, 0, NULL, 0); |
| 10692 | roam_info_ptr->fAuthRequired = false; |
| 10693 | } else { |
| 10694 | roam_info_ptr->fAuthRequired = true; |
| 10695 | } |
| 10696 | status = csr_roam_call_callback(mac_ctx, sessionId, |
| 10697 | roam_info_ptr, 0, eCSR_ROAM_INFRA_IND, |
| 10698 | eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10699 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10700 | /* Refused due to Mac filtering */ |
| 10701 | roam_info_ptr->statusCode = eSIR_SME_ASSOC_REFUSED; |
| 10702 | } |
| 10703 | |
| 10704 | /* Send Association completion message to PE */ |
| 10705 | status = csr_send_assoc_cnf_msg(mac_ctx, pAssocInd, status); |
| 10706 | /* |
| 10707 | * send a message to CSR itself just to avoid the EAPOL frames going |
| 10708 | * OTA before association response |
| 10709 | */ |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 10710 | if (CSR_IS_INFRA_AP(roam_info_ptr->u.pConnectedProfile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10711 | && (roam_info_ptr->statusCode != eSIR_SME_ASSOC_REFUSED)) { |
| 10712 | roam_info_ptr->fReassocReq = pAssocInd->reassocReq; |
| 10713 | status = csr_send_assoc_ind_to_upper_layer_cnf_msg(mac_ctx, |
| 10714 | pAssocInd, status, sessionId); |
| 10715 | } |
| 10716 | } |
| 10717 | |
| 10718 | static void |
| 10719 | csr_roam_chk_lnk_disassoc_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 10720 | { |
| 10721 | tCsrRoamSession *session; |
| 10722 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10723 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10724 | tSirSmeDisassocInd *pDisassocInd; |
Aggarwal Nishank | 51dece4 | 2016-08-24 12:11:19 +0530 | [diff] [blame] | 10725 | tSmeCmd *cmd; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10726 | |
Aggarwal Nishank | 51dece4 | 2016-08-24 12:11:19 +0530 | [diff] [blame] | 10727 | cmd = qdf_mem_malloc(sizeof(*cmd)); |
| 10728 | if (NULL == cmd) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10729 | sme_err("memory allocation failed for size: %zu", sizeof(*cmd)); |
Aggarwal Nishank | 51dece4 | 2016-08-24 12:11:19 +0530 | [diff] [blame] | 10730 | return; |
| 10731 | } |
| 10732 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10733 | /* |
| 10734 | * Check if AP dis-associated us because of MIC failure. If so, |
| 10735 | * then we need to take action immediately and not wait till the |
| 10736 | * the WmStatusChange requests is pushed and processed |
| 10737 | */ |
| 10738 | pDisassocInd = (tSirSmeDisassocInd *) msg_ptr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10739 | status = csr_roam_get_session_id_from_bssid(mac_ctx, |
Srinivas Girigowda | e13cc34 | 2016-01-05 17:07:53 -0800 | [diff] [blame] | 10740 | &pDisassocInd->bssid, &sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10741 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10742 | sme_err("Session Id not found for BSSID "MAC_ADDRESS_STR, |
Srinivas Girigowda | e13cc34 | 2016-01-05 17:07:53 -0800 | [diff] [blame] | 10743 | MAC_ADDR_ARRAY(pDisassocInd->bssid.bytes)); |
Aggarwal Nishank | 51dece4 | 2016-08-24 12:11:19 +0530 | [diff] [blame] | 10744 | qdf_mem_free(cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10745 | return; |
| 10746 | } |
| 10747 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10748 | sme_err("DISASSOCIATION from peer =" MAC_ADDRESS_STR "reason: %d status: %d session: %d", |
Srinivas Girigowda | e13cc34 | 2016-01-05 17:07:53 -0800 | [diff] [blame] | 10749 | MAC_ADDR_ARRAY(pDisassocInd->peer_macaddr.bytes), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10750 | pDisassocInd->reasonCode, |
Srinivas Girigowda | 0ee9644 | 2016-08-17 19:10:56 -0700 | [diff] [blame] | 10751 | pDisassocInd->statusCode, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10752 | /* |
| 10753 | * If we are in neighbor preauth done state then on receiving |
| 10754 | * disassoc or deauth we dont roam instead we just disassoc |
| 10755 | * from current ap and then go to disconnected state |
| 10756 | * This happens for ESE and 11r FT connections ONLY. |
| 10757 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10758 | if (csr_roam_is11r_assoc(mac_ctx, sessionId) && |
| 10759 | (csr_neighbor_roam_state_preauth_done(mac_ctx, sessionId))) |
| 10760 | csr_neighbor_roam_tranistion_preauth_done_to_disconnected( |
| 10761 | mac_ctx, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10762 | #ifdef FEATURE_WLAN_ESE |
| 10763 | if (csr_roam_is_ese_assoc(mac_ctx, sessionId) && |
| 10764 | (csr_neighbor_roam_state_preauth_done(mac_ctx, sessionId))) |
| 10765 | csr_neighbor_roam_tranistion_preauth_done_to_disconnected( |
| 10766 | mac_ctx, sessionId); |
| 10767 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10768 | if (csr_roam_is_fast_roam_enabled(mac_ctx, sessionId) && |
| 10769 | (csr_neighbor_roam_state_preauth_done(mac_ctx, sessionId))) |
| 10770 | csr_neighbor_roam_tranistion_preauth_done_to_disconnected( |
| 10771 | mac_ctx, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10772 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 10773 | if (!session) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 10774 | sme_err("session: %d not found", sessionId); |
Aggarwal Nishank | 51dece4 | 2016-08-24 12:11:19 +0530 | [diff] [blame] | 10775 | qdf_mem_free(cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10776 | return; |
| 10777 | } |
| 10778 | if (csr_is_conn_state_infra(mac_ctx, sessionId)) |
| 10779 | session->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 10780 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 10781 | sme_qos_csr_event_ind(mac_ctx, (uint8_t) sessionId, |
| 10782 | SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 10783 | #endif |
| 10784 | csr_roam_link_down(mac_ctx, sessionId); |
| 10785 | csr_roam_issue_wm_status_change(mac_ctx, sessionId, |
| 10786 | eCsrDisassociated, msg_ptr); |
| 10787 | if (CSR_IS_INFRA_AP(&session->connectedProfile)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10788 | /* |
| 10789 | * STA/P2P client got disassociated so remove any pending |
| 10790 | * deauth commands in sme pending list |
| 10791 | */ |
Aggarwal Nishank | 51dece4 | 2016-08-24 12:11:19 +0530 | [diff] [blame] | 10792 | cmd->command = eSmeCommandRoam; |
| 10793 | cmd->sessionId = (uint8_t) sessionId; |
| 10794 | cmd->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 10795 | qdf_mem_copy(cmd->u.roamCmd.peerMac, |
Srinivas Girigowda | e13cc34 | 2016-01-05 17:07:53 -0800 | [diff] [blame] | 10796 | pDisassocInd->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 10797 | QDF_MAC_ADDR_SIZE); |
Aggarwal Nishank | 51dece4 | 2016-08-24 12:11:19 +0530 | [diff] [blame] | 10798 | csr_roam_remove_duplicate_command(mac_ctx, sessionId, cmd, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10799 | eCsrForcedDeauthSta); |
| 10800 | } |
Aggarwal Nishank | 51dece4 | 2016-08-24 12:11:19 +0530 | [diff] [blame] | 10801 | qdf_mem_free(cmd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10802 | } |
| 10803 | |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 10804 | /** |
| 10805 | * csr_roam_send_disconnect_done_indication() - Send disconnect ind to HDD. |
| 10806 | * |
| 10807 | * @mac_ctx: mac global context |
| 10808 | * @msg_ptr: incoming message |
| 10809 | * |
| 10810 | * This function gives final disconnect event to HDD after all cleanup in |
| 10811 | * lower layers is done. |
| 10812 | * |
| 10813 | * Return: None |
| 10814 | */ |
| 10815 | static void |
| 10816 | csr_roam_send_disconnect_done_indication(tpAniSirGlobal mac_ctx, tSirSmeRsp |
| 10817 | *msg_ptr) |
| 10818 | { |
| 10819 | struct sir_sme_discon_done_ind *discon_ind = |
| 10820 | (struct sir_sme_discon_done_ind *)(msg_ptr); |
| 10821 | tCsrRoamInfo roam_info; |
| 10822 | tCsrRoamSession *session; |
| 10823 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10824 | sme_debug("eWNI_SME_DISCONNECT_DONE_IND RC:%d", |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 10825 | discon_ind->reason_code); |
| 10826 | |
| 10827 | if (CSR_IS_SESSION_VALID(mac_ctx, discon_ind->session_id)) { |
| 10828 | roam_info.reasonCode = discon_ind->reason_code; |
| 10829 | roam_info.statusCode = eSIR_SME_STA_NOT_ASSOCIATED; |
| 10830 | qdf_mem_copy(roam_info.peerMac.bytes, discon_ind->peer_mac, |
| 10831 | ETH_ALEN); |
| 10832 | csr_roam_call_callback(mac_ctx, discon_ind->session_id, |
| 10833 | &roam_info, 0, eCSR_ROAM_LOSTLINK, |
| 10834 | eCSR_ROAM_RESULT_DISASSOC_IND); |
| 10835 | session = CSR_GET_SESSION(mac_ctx, discon_ind->session_id); |
| 10836 | if (session && |
| 10837 | !CSR_IS_INFRA_AP(&session->connectedProfile)) |
| 10838 | csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_IDLE, |
| 10839 | discon_ind->session_id); |
| 10840 | |
| 10841 | } else |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10842 | sme_err("Inactive session %d", |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 10843 | discon_ind->session_id); |
| 10844 | } |
| 10845 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10846 | static void |
| 10847 | csr_roam_chk_lnk_deauth_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 10848 | { |
| 10849 | tCsrRoamSession *session; |
| 10850 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10851 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10852 | tSirSmeDeauthInd *pDeauthInd; |
| 10853 | tCsrRoamInfo roam_info; |
| 10854 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10855 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10856 | sme_debug("DEAUTHENTICATION Indication from MAC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10857 | pDeauthInd = (tpSirSmeDeauthInd) msg_ptr; |
| 10858 | status = csr_roam_get_session_id_from_bssid(mac_ctx, |
Srinivas Girigowda | 9ee9a5c | 2016-01-04 15:51:05 -0800 | [diff] [blame] | 10859 | &pDeauthInd->bssid, |
| 10860 | &sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10861 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10862 | return; |
| 10863 | /* If we are in neighbor preauth done state then on receiving |
| 10864 | * disassoc or deauth we dont roam instead we just disassoc |
| 10865 | * from current ap and then go to disconnected state |
| 10866 | * This happens for ESE and 11r FT connections ONLY. |
| 10867 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10868 | if (csr_roam_is11r_assoc(mac_ctx, sessionId) && |
| 10869 | (csr_neighbor_roam_state_preauth_done(mac_ctx, sessionId))) |
| 10870 | csr_neighbor_roam_tranistion_preauth_done_to_disconnected( |
| 10871 | mac_ctx, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10872 | #ifdef FEATURE_WLAN_ESE |
| 10873 | if (csr_roam_is_ese_assoc(mac_ctx, sessionId) && |
| 10874 | (csr_neighbor_roam_state_preauth_done(mac_ctx, sessionId))) |
| 10875 | csr_neighbor_roam_tranistion_preauth_done_to_disconnected( |
| 10876 | mac_ctx, sessionId); |
| 10877 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10878 | if (csr_roam_is_fast_roam_enabled(mac_ctx, sessionId) && |
| 10879 | (csr_neighbor_roam_state_preauth_done(mac_ctx, sessionId))) |
| 10880 | csr_neighbor_roam_tranistion_preauth_done_to_disconnected( |
| 10881 | mac_ctx, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10882 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 10883 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10884 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10885 | return; |
| 10886 | } |
| 10887 | |
| 10888 | if (csr_is_conn_state_infra(mac_ctx, sessionId)) |
| 10889 | session->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 10890 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 10891 | sme_qos_csr_event_ind(mac_ctx, (uint8_t) sessionId, |
| 10892 | SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 10893 | #endif |
| 10894 | csr_roam_link_down(mac_ctx, sessionId); |
| 10895 | csr_roam_issue_wm_status_change(mac_ctx, sessionId, |
| 10896 | eCsrDeauthenticated, |
| 10897 | msg_ptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10898 | } |
| 10899 | |
| 10900 | static void |
| 10901 | csr_roam_chk_lnk_swt_ch_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 10902 | { |
| 10903 | tCsrRoamSession *session; |
| 10904 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10905 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10906 | tpSirSmeSwitchChannelInd pSwitchChnInd; |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 10907 | tCsrRoamInfo roamInfo; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10908 | |
| 10909 | /* in case of STA, the SWITCH_CHANNEL originates from its AP */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10910 | sme_debug("eWNI_SME_SWITCH_CHL_IND from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10911 | pSwitchChnInd = (tpSirSmeSwitchChannelInd) msg_ptr; |
| 10912 | /* Update with the new channel id. The channel id is hidden in the |
| 10913 | * statusCode. |
| 10914 | */ |
| 10915 | status = csr_roam_get_session_id_from_bssid(mac_ctx, |
Srinivas Girigowda | 591c565 | 2015-12-30 17:39:50 -0800 | [diff] [blame] | 10916 | &pSwitchChnInd->bssid, &sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10917 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10918 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 10919 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10920 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10921 | return; |
| 10922 | } |
| 10923 | session->connectedProfile.operationChannel = |
| 10924 | (uint8_t) pSwitchChnInd->newChannelId; |
| 10925 | if (session->pConnectBssDesc) { |
| 10926 | session->pConnectBssDesc->channelId = |
| 10927 | (uint8_t) pSwitchChnInd->newChannelId; |
| 10928 | } |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 10929 | |
| 10930 | qdf_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
| 10931 | roamInfo.chan_info.chan_id = pSwitchChnInd->newChannelId; |
Manishekar Chandrasekaran | ec26759 | 2016-05-26 19:10:04 +0530 | [diff] [blame] | 10932 | roamInfo.chan_info.ch_width = |
| 10933 | pSwitchChnInd->chan_params.ch_width; |
| 10934 | roamInfo.chan_info.sec_ch_offset = |
| 10935 | pSwitchChnInd->chan_params.sec_ch_offset; |
| 10936 | roamInfo.chan_info.band_center_freq1 = |
| 10937 | pSwitchChnInd->chan_params.center_freq_seg0; |
| 10938 | roamInfo.chan_info.band_center_freq2 = |
| 10939 | pSwitchChnInd->chan_params.center_freq_seg1; |
bings | 58ce862 | 2017-07-10 15:55:36 +0800 | [diff] [blame] | 10940 | if (CSR_IS_PHY_MODE_11ac(mac_ctx->roam.configParam.phyMode)) |
| 10941 | roamInfo.mode = SIR_SME_PHY_MODE_VHT; |
| 10942 | else if (CSR_IS_PHY_MODE_11n(mac_ctx->roam.configParam.phyMode)) |
| 10943 | roamInfo.mode = SIR_SME_PHY_MODE_HT; |
| 10944 | else |
| 10945 | roamInfo.mode = SIR_SME_PHY_MODE_LEGACY; |
| 10946 | |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 10947 | status = csr_roam_call_callback(mac_ctx, sessionId, |
| 10948 | &roamInfo, 0, eCSR_ROAM_STA_CHANNEL_SWITCH, |
| 10949 | eCSR_ROAM_RESULT_NONE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10950 | } |
| 10951 | } |
| 10952 | |
| 10953 | static void |
| 10954 | csr_roam_chk_lnk_deauth_rsp(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 10955 | { |
| 10956 | tCsrRoamSession *session; |
| 10957 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10958 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10959 | tCsrRoamInfo *roam_info_ptr = NULL; |
| 10960 | tSirSmeDeauthRsp *pDeauthRsp = (tSirSmeDeauthRsp *) msg_ptr; |
| 10961 | tCsrRoamInfo roam_info; |
| 10962 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10963 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10964 | sme_debug("eWNI_SME_DEAUTH_RSP from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10965 | sessionId = pDeauthRsp->sessionId; |
| 10966 | if (!CSR_IS_SESSION_VALID(mac_ctx, sessionId)) |
| 10967 | return; |
| 10968 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 10969 | if (CSR_IS_INFRA_AP(&session->connectedProfile)) { |
| 10970 | roam_info_ptr = &roam_info; |
| 10971 | roam_info_ptr->u.pConnectedProfile = &session->connectedProfile; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 10972 | qdf_copy_macaddr(&roam_info_ptr->peerMac, |
Srinivas Girigowda | 9cf95c5 | 2016-01-04 16:17:15 -0800 | [diff] [blame] | 10973 | &pDeauthRsp->peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10974 | roam_info_ptr->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 10975 | roam_info_ptr->statusCode = pDeauthRsp->statusCode; |
| 10976 | status = csr_roam_call_callback(mac_ctx, sessionId, |
| 10977 | roam_info_ptr, 0, |
| 10978 | eCSR_ROAM_LOSTLINK, |
| 10979 | eCSR_ROAM_RESULT_FORCED); |
| 10980 | } |
| 10981 | } |
| 10982 | |
| 10983 | static void |
| 10984 | csr_roam_chk_lnk_disassoc_rsp(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 10985 | { |
| 10986 | tCsrRoamSession *session; |
| 10987 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 10988 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10989 | tCsrRoamInfo *roam_info_ptr = NULL; |
| 10990 | tCsrRoamInfo roam_info; |
| 10991 | /* |
| 10992 | * session id is invalid here so cant use it to access the array |
| 10993 | * curSubstate as index |
| 10994 | */ |
| 10995 | tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *) msg_ptr; |
| 10996 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 10997 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 10998 | sme_debug("eWNI_SME_DISASSOC_RSP from SME "); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 10999 | sessionId = pDisassocRsp->sessionId; |
| 11000 | if (!CSR_IS_SESSION_VALID(mac_ctx, sessionId)) |
| 11001 | return; |
| 11002 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 11003 | if (CSR_IS_INFRA_AP(&session->connectedProfile)) { |
| 11004 | roam_info_ptr = &roam_info; |
| 11005 | roam_info_ptr->u.pConnectedProfile = &session->connectedProfile; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11006 | qdf_copy_macaddr(&roam_info_ptr->peerMac, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 11007 | &pDisassocRsp->peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11008 | roam_info_ptr->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 11009 | roam_info_ptr->statusCode = pDisassocRsp->statusCode; |
| 11010 | status = csr_roam_call_callback(mac_ctx, sessionId, |
| 11011 | roam_info_ptr, 0, |
| 11012 | eCSR_ROAM_LOSTLINK, |
| 11013 | eCSR_ROAM_RESULT_FORCED); |
| 11014 | } |
| 11015 | } |
| 11016 | |
| 11017 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11018 | static void |
| 11019 | csr_roam_diag_mic_fail(tpAniSirGlobal mac_ctx, uint32_t sessionId) |
| 11020 | { |
| 11021 | WLAN_HOST_DIAG_EVENT_DEF(secEvent, |
| 11022 | host_event_wlan_security_payload_type); |
| 11023 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11024 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11025 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11026 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11027 | return; |
| 11028 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11029 | qdf_mem_set(&secEvent, sizeof(host_event_wlan_security_payload_type), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11030 | 0); |
| 11031 | secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR; |
| 11032 | secEvent.encryptionModeMulticast = |
| 11033 | (uint8_t) diag_enc_type_from_csr_type( |
| 11034 | session->connectedProfile.mcEncryptionType); |
| 11035 | secEvent.encryptionModeUnicast = |
| 11036 | (uint8_t) diag_enc_type_from_csr_type( |
| 11037 | session->connectedProfile.EncryptionType); |
| 11038 | secEvent.authMode = |
| 11039 | (uint8_t) diag_auth_type_from_csr_type( |
| 11040 | session->connectedProfile.AuthType); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11041 | qdf_mem_copy(secEvent.bssid, session->connectedProfile.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11042 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11043 | WLAN_HOST_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 11044 | } |
| 11045 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 11046 | |
| 11047 | static void |
| 11048 | csr_roam_chk_lnk_mic_fail_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 11049 | { |
| 11050 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11051 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11052 | tCsrRoamInfo *roam_info_ptr = NULL; |
| 11053 | tCsrRoamInfo roam_info; |
| 11054 | tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd) msg_ptr; |
| 11055 | eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 11056 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11057 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11058 | status = csr_roam_get_session_id_from_bssid(mac_ctx, |
Srinivas Girigowda | 37c133b | 2015-09-24 16:14:15 -0700 | [diff] [blame] | 11059 | &pMicInd->bssId, &sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11060 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11061 | qdf_mem_set(&roam_info, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11062 | roam_info.u.pMICFailureInfo = &pMicInd->info; |
| 11063 | roam_info_ptr = &roam_info; |
| 11064 | if (pMicInd->info.multicast) |
| 11065 | result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP; |
| 11066 | else |
| 11067 | result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 11068 | csr_roam_call_callback(mac_ctx, sessionId, roam_info_ptr, 0, |
| 11069 | eCSR_ROAM_MIC_ERROR_IND, result); |
| 11070 | } |
| 11071 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11072 | csr_roam_diag_mic_fail(mac_ctx, sessionId); |
| 11073 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 11074 | } |
| 11075 | |
| 11076 | static void |
| 11077 | csr_roam_chk_lnk_pbs_probe_req_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 11078 | { |
| 11079 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11080 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11081 | tCsrRoamInfo roam_info; |
| 11082 | tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd) msg_ptr; |
| 11083 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11084 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11085 | sme_debug("WPS PBC Probe request Indication from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11086 | |
| 11087 | status = csr_roam_get_session_id_from_bssid(mac_ctx, |
Srinivas Girigowda | d6673be | 2015-11-24 14:18:13 -0800 | [diff] [blame] | 11088 | &pProbeReqInd->bssid, &sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11089 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11090 | qdf_mem_set(&roam_info, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11091 | roam_info.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq; |
| 11092 | csr_roam_call_callback(mac_ctx, sessionId, &roam_info, |
| 11093 | 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, |
| 11094 | eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 11095 | } |
| 11096 | } |
| 11097 | |
| 11098 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11099 | static void |
| 11100 | csr_roam_diag_joined_new_bss(tpAniSirGlobal mac_ctx, |
| 11101 | tSirSmeNewBssInfo *pNewBss) |
| 11102 | { |
| 11103 | host_log_ibss_pkt_type *pIbssLog; |
| 11104 | uint32_t bi; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11105 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11106 | WLAN_HOST_DIAG_LOG_ALLOC(pIbssLog, host_log_ibss_pkt_type, |
| 11107 | LOG_WLAN_IBSS_C); |
| 11108 | if (!pIbssLog) |
| 11109 | return; |
| 11110 | pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING; |
| 11111 | if (pNewBss) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11112 | qdf_copy_macaddr(&pIbssLog->bssid, &pNewBss->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11113 | if (pNewBss->ssId.length) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11114 | qdf_mem_copy(pIbssLog->ssid, pNewBss->ssId.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11115 | pNewBss->ssId.length); |
| 11116 | pIbssLog->operatingChannel = pNewBss->channelNumber; |
| 11117 | } |
| 11118 | if (IS_SIR_STATUS_SUCCESS(wlan_cfg_get_int(mac_ctx, |
| 11119 | WNI_CFG_BEACON_INTERVAL, |
| 11120 | &bi))) |
| 11121 | /* U8 is not enough for beacon interval */ |
| 11122 | pIbssLog->beaconInterval = (uint8_t) bi; |
| 11123 | WLAN_HOST_DIAG_LOG_REPORT(pIbssLog); |
| 11124 | } |
| 11125 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 11126 | |
| 11127 | static void |
| 11128 | csr_roam_chk_lnk_wm_status_change_ntf(tpAniSirGlobal mac_ctx, |
| 11129 | tSirSmeRsp *msg_ptr) |
| 11130 | { |
| 11131 | tCsrRoamSession *session; |
| 11132 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11133 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11134 | tCsrRoamInfo *roam_info_ptr = NULL; |
| 11135 | tSirSmeWmStatusChangeNtf *pStatusChangeMsg; |
| 11136 | tCsrRoamInfo roam_info; |
| 11137 | tSirSmeApNewCaps *pApNewCaps; |
| 11138 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 11139 | tSirMacAddr Broadcastaddr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
| 11140 | tSirSmeNewBssInfo *pNewBss; |
| 11141 | eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED; |
| 11142 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11143 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11144 | pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *) msg_ptr; |
| 11145 | switch (pStatusChangeMsg->statusChangeCode) { |
| 11146 | case eSIR_SME_IBSS_ACTIVE: |
| 11147 | sessionId = csr_find_ibss_session(mac_ctx); |
| 11148 | if (CSR_SESSION_ID_INVALID == sessionId) |
| 11149 | break; |
| 11150 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 11151 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11152 | sme_err("session %d not found", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11153 | sessionId); |
| 11154 | return; |
| 11155 | } |
| 11156 | session->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED; |
| 11157 | if (session->pConnectBssDesc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11158 | qdf_mem_copy(&roam_info.bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11159 | session->pConnectBssDesc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11160 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11161 | roam_info.u.pConnectedProfile = |
| 11162 | &session->connectedProfile; |
| 11163 | roam_info_ptr = &roam_info; |
| 11164 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11165 | sme_err("CSR: connected BSS is empty"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11166 | } |
| 11167 | result = eCSR_ROAM_RESULT_IBSS_CONNECT; |
| 11168 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 11169 | break; |
| 11170 | |
| 11171 | case eSIR_SME_IBSS_INACTIVE: |
| 11172 | sessionId = csr_find_ibss_session(mac_ctx); |
| 11173 | if (CSR_SESSION_ID_INVALID != sessionId) { |
| 11174 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 11175 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11176 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11177 | return; |
| 11178 | } |
| 11179 | session->connectState = |
| 11180 | eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 11181 | result = eCSR_ROAM_RESULT_IBSS_INACTIVE; |
| 11182 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 11183 | } |
| 11184 | break; |
| 11185 | |
| 11186 | case eSIR_SME_JOINED_NEW_BSS: |
| 11187 | /* IBSS coalescing. */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11188 | sme_debug("CSR: eSIR_SME_JOINED_NEW_BSS received from PE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11189 | sessionId = csr_find_ibss_session(mac_ctx); |
| 11190 | if (CSR_SESSION_ID_INVALID == sessionId) |
| 11191 | break; |
| 11192 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 11193 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11194 | sme_err("session %d not found", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11195 | sessionId); |
| 11196 | return; |
| 11197 | } |
| 11198 | /* update the connection state information */ |
| 11199 | pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo; |
| 11200 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11201 | csr_roam_diag_joined_new_bss(mac_ctx, pNewBss); |
| 11202 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 11203 | csr_roam_update_connected_profile_from_new_bss(mac_ctx, |
| 11204 | sessionId, |
| 11205 | pNewBss); |
| 11206 | |
| 11207 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 11208 | session->connectedProfile.EncryptionType)) { |
| 11209 | csr_roam_issue_set_context_req(mac_ctx, |
| 11210 | sessionId, |
| 11211 | session->connectedProfile.EncryptionType, |
| 11212 | session->pConnectBssDesc, |
| 11213 | &Broadcastaddr, false, false, |
| 11214 | eSIR_TX_RX, 0, 0, NULL, 0); |
| 11215 | } |
| 11216 | result = eCSR_ROAM_RESULT_IBSS_COALESCED; |
| 11217 | roamStatus = eCSR_ROAM_IBSS_IND; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11218 | qdf_mem_copy(&roam_info.bssid, &pNewBss->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11219 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11220 | roam_info_ptr = &roam_info; |
| 11221 | /* This BSSID is the real BSSID, save it */ |
| 11222 | if (session->pConnectBssDesc) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11223 | qdf_mem_copy(session->pConnectBssDesc->bssId, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11224 | &pNewBss->bssId, sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11225 | break; |
| 11226 | |
| 11227 | /* |
| 11228 | * detection by LIM that the capabilities of the associated |
| 11229 | * AP have changed. |
| 11230 | */ |
| 11231 | case eSIR_SME_AP_CAPS_CHANGED: |
| 11232 | pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11233 | sme_debug("CSR handling eSIR_SME_AP_CAPS_CHANGED"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11234 | status = csr_roam_get_session_id_from_bssid(mac_ctx, |
Srinivas Girigowda | 26ebb19 | 2015-09-24 15:12:09 -0700 | [diff] [blame] | 11235 | &pApNewCaps->bssId, &sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11236 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11237 | break; |
| 11238 | if (eCSR_ROAMING_STATE_JOINED == |
| 11239 | mac_ctx->roam.curState[sessionId] |
| 11240 | && ((eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC |
| 11241 | == mac_ctx->roam.curSubState[sessionId]) |
| 11242 | || (eCSR_ROAM_SUBSTATE_NONE == |
| 11243 | mac_ctx->roam.curSubState[sessionId]) |
| 11244 | || (eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC |
| 11245 | == mac_ctx->roam.curSubState[sessionId]) |
| 11246 | || (eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC == |
| 11247 | mac_ctx->roam.curSubState[sessionId]))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11248 | sme_warn("Calling csr_roam_disconnect_internal"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11249 | csr_roam_disconnect_internal(mac_ctx, sessionId, |
| 11250 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 11251 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11252 | sme_warn("Skipping the new scan as CSR is in state: %s and sub-state: %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11253 | mac_trace_getcsr_roam_state( |
| 11254 | mac_ctx->roam.curState[sessionId]), |
| 11255 | mac_trace_getcsr_roam_sub_state( |
| 11256 | mac_ctx->roam.curSubState[sessionId])); |
| 11257 | /* We ignore the caps change event if CSR is not in full |
| 11258 | * connected state. Send one event to PE to reset |
| 11259 | * limSentCapsChangeNtf Once limSentCapsChangeNtf set |
| 11260 | * 0, lim can send sub sequent CAPS change event |
| 11261 | * otherwise lim cannot send any CAPS change events to |
| 11262 | * SME |
| 11263 | */ |
| 11264 | csr_send_reset_ap_caps_changed(mac_ctx, |
| 11265 | &pApNewCaps->bssId); |
| 11266 | } |
| 11267 | break; |
| 11268 | |
| 11269 | default: |
| 11270 | roamStatus = eCSR_ROAM_FAILED; |
| 11271 | result = eCSR_ROAM_RESULT_NONE; |
| 11272 | break; |
| 11273 | } /* end switch on statusChangeCode */ |
| 11274 | if (eCSR_ROAM_RESULT_NONE != result) { |
| 11275 | csr_roam_call_callback(mac_ctx, sessionId, roam_info_ptr, 0, |
| 11276 | roamStatus, result); |
| 11277 | } |
| 11278 | } |
| 11279 | |
| 11280 | static void |
| 11281 | csr_roam_chk_lnk_ibss_new_peer_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 11282 | { |
| 11283 | tCsrRoamSession *session; |
| 11284 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11285 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11286 | tCsrRoamInfo *roam_info_ptr = NULL; |
| 11287 | tSmeIbssPeerInd *pIbssPeerInd = (tSmeIbssPeerInd *) msg_ptr; |
| 11288 | tCsrRoamInfo roam_info; |
| 11289 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11290 | host_log_ibss_pkt_type *pIbssLog; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11291 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11292 | WLAN_HOST_DIAG_LOG_ALLOC(pIbssLog, host_log_ibss_pkt_type, |
| 11293 | LOG_WLAN_IBSS_C); |
| 11294 | if (pIbssLog) { |
| 11295 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11296 | qdf_copy_macaddr(&pIbssLog->peer_macaddr, |
Srinivas Girigowda | 01d1c3c | 2015-11-25 16:54:41 -0800 | [diff] [blame] | 11297 | &pIbssPeerInd->peer_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11298 | WLAN_HOST_DIAG_LOG_REPORT(pIbssLog); |
| 11299 | } |
| 11300 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 11301 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11302 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11303 | sessionId = csr_find_ibss_session(mac_ctx); |
| 11304 | if (CSR_SESSION_ID_INVALID == sessionId) |
| 11305 | return; |
| 11306 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 11307 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11308 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11309 | return; |
| 11310 | } |
| 11311 | /* |
| 11312 | * Issue the set Context request to LIM to establish the Unicast STA |
| 11313 | * context for the new peer... |
| 11314 | */ |
| 11315 | if (!session->pConnectBssDesc) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11316 | sme_warn("CSR: connected BSS is empty"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11317 | goto callback_and_free; |
| 11318 | } |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11319 | qdf_copy_macaddr(&roam_info.peerMac, &pIbssPeerInd->peer_addr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11320 | qdf_mem_copy(&roam_info.bssid, session->pConnectBssDesc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11321 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11322 | if (pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11323 | roam_info.pbFrames = qdf_mem_malloc((pIbssPeerInd->mesgLen - |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11324 | sizeof(tSmeIbssPeerInd))); |
| 11325 | if (NULL == roam_info.pbFrames) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11326 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11327 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11328 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11329 | roam_info.nBeaconLength = pIbssPeerInd->mesgLen - |
| 11330 | sizeof(tSmeIbssPeerInd); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11331 | qdf_mem_copy(roam_info.pbFrames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11332 | ((uint8_t *) pIbssPeerInd) + |
| 11333 | sizeof(tSmeIbssPeerInd), |
| 11334 | roam_info.nBeaconLength); |
| 11335 | } |
| 11336 | roam_info.staId = (uint8_t) pIbssPeerInd->staId; |
| 11337 | roam_info.ucastSig = (uint8_t) pIbssPeerInd->ucastSig; |
| 11338 | roam_info.bcastSig = (uint8_t) pIbssPeerInd->bcastSig; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11339 | roam_info.pBssDesc = qdf_mem_malloc( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11340 | session->pConnectBssDesc->length); |
| 11341 | if (NULL == roam_info.pBssDesc) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11342 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11343 | if (roam_info.pbFrames) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11344 | qdf_mem_free(roam_info.pbFrames); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11345 | if (roam_info.pBssDesc) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11346 | qdf_mem_free(roam_info.pBssDesc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11347 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11348 | status = QDF_STATUS_SUCCESS; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11349 | qdf_mem_copy(roam_info.pBssDesc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11350 | session->pConnectBssDesc, |
| 11351 | session->pConnectBssDesc->length); |
| 11352 | roam_info_ptr = &roam_info; |
| 11353 | } |
| 11354 | } else { |
| 11355 | roam_info_ptr = &roam_info; |
| 11356 | } |
| 11357 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 11358 | session->connectedProfile.EncryptionType)) { |
| 11359 | /* NO keys. these key parameters don't matter */ |
| 11360 | csr_roam_issue_set_context_req(mac_ctx, sessionId, |
| 11361 | session->connectedProfile.EncryptionType, |
Srinivas Girigowda | 01d1c3c | 2015-11-25 16:54:41 -0800 | [diff] [blame] | 11362 | session->pConnectBssDesc, |
| 11363 | &pIbssPeerInd->peer_addr.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11364 | false, true, eSIR_TX_RX, 0, 0, NULL, 0); |
| 11365 | } |
| 11366 | |
| 11367 | callback_and_free: |
| 11368 | /* send up the sec type for the new peer */ |
| 11369 | if (roam_info_ptr) |
| 11370 | roam_info_ptr->u.pConnectedProfile = &session->connectedProfile; |
| 11371 | csr_roam_call_callback(mac_ctx, sessionId, roam_info_ptr, 0, |
| 11372 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 11373 | eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
| 11374 | if (roam_info_ptr) { |
| 11375 | if (roam_info.pbFrames) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11376 | qdf_mem_free(roam_info.pbFrames); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11377 | if (roam_info.pBssDesc) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11378 | qdf_mem_free(roam_info.pBssDesc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11379 | } |
| 11380 | } |
| 11381 | |
| 11382 | static void |
| 11383 | csr_roam_chk_lnk_ibss_peer_departed_ind(tpAniSirGlobal mac_ctx, |
| 11384 | tSirSmeRsp *msg_ptr) |
| 11385 | { |
| 11386 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
| 11387 | tCsrRoamInfo roam_info; |
| 11388 | tSmeIbssPeerInd *pIbssPeerInd; |
| 11389 | |
| 11390 | if (NULL == msg_ptr) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11391 | sme_err("IBSS peer ind. message is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11392 | return; |
| 11393 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11394 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11395 | pIbssPeerInd = (tSmeIbssPeerInd *) msg_ptr; |
| 11396 | sessionId = csr_find_ibss_session(mac_ctx); |
| 11397 | if (CSR_SESSION_ID_INVALID != sessionId) { |
| 11398 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11399 | host_log_ibss_pkt_type *pIbssLog; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11400 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11401 | WLAN_HOST_DIAG_LOG_ALLOC(pIbssLog, host_log_ibss_pkt_type, |
| 11402 | LOG_WLAN_IBSS_C); |
| 11403 | if (pIbssLog) { |
| 11404 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE; |
| 11405 | if (pIbssPeerInd) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11406 | qdf_copy_macaddr(&pIbssLog->peer_macaddr, |
Srinivas Girigowda | 01d1c3c | 2015-11-25 16:54:41 -0800 | [diff] [blame] | 11407 | &pIbssPeerInd->peer_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11408 | } |
| 11409 | WLAN_HOST_DIAG_LOG_REPORT(pIbssLog); |
| 11410 | } |
| 11411 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11412 | sme_debug("CSR: Peer departed notification from LIM"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11413 | roam_info.staId = (uint8_t) pIbssPeerInd->staId; |
| 11414 | roam_info.ucastSig = (uint8_t) pIbssPeerInd->ucastSig; |
| 11415 | roam_info.bcastSig = (uint8_t) pIbssPeerInd->bcastSig; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11416 | qdf_copy_macaddr(&roam_info.peerMac, &pIbssPeerInd->peer_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11417 | csr_roam_call_callback(mac_ctx, sessionId, &roam_info, 0, |
| 11418 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 11419 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 11420 | } |
| 11421 | } |
| 11422 | |
| 11423 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11424 | static void |
| 11425 | csr_roam_diag_set_ctx_rsp(tpAniSirGlobal mac_ctx, |
| 11426 | tCsrRoamSession *session, |
| 11427 | tSirSmeSetContextRsp *pRsp) |
| 11428 | { |
| 11429 | WLAN_HOST_DIAG_EVENT_DEF(setKeyEvent, |
| 11430 | host_event_wlan_security_payload_type); |
| 11431 | if (eCSR_ENCRYPT_TYPE_NONE == |
| 11432 | session->connectedProfile.EncryptionType) |
| 11433 | return; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11434 | qdf_mem_set(&setKeyEvent, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11435 | sizeof(host_event_wlan_security_payload_type), 0); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11436 | if (qdf_is_macaddr_group(&pRsp->peer_macaddr)) |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 11437 | setKeyEvent.eventId = |
| 11438 | WLAN_SECURITY_EVENT_SET_BCAST_RSP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11439 | else |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 11440 | setKeyEvent.eventId = |
| 11441 | WLAN_SECURITY_EVENT_SET_UNICAST_RSP; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11442 | setKeyEvent.encryptionModeMulticast = |
| 11443 | (uint8_t) diag_enc_type_from_csr_type( |
| 11444 | session->connectedProfile.mcEncryptionType); |
| 11445 | setKeyEvent.encryptionModeUnicast = |
| 11446 | (uint8_t) diag_enc_type_from_csr_type( |
| 11447 | session->connectedProfile.EncryptionType); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11448 | qdf_mem_copy(setKeyEvent.bssid, session->connectedProfile.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 11449 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11450 | setKeyEvent.authMode = |
| 11451 | (uint8_t) diag_auth_type_from_csr_type( |
| 11452 | session->connectedProfile.AuthType); |
| 11453 | if (eSIR_SME_SUCCESS != pRsp->statusCode) |
| 11454 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 11455 | WLAN_HOST_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 11456 | } |
| 11457 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 11458 | |
| 11459 | static void |
| 11460 | csr_roam_chk_lnk_set_ctx_rsp(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 11461 | { |
| 11462 | tCsrRoamSession *session; |
| 11463 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11464 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11465 | tCsrRoamInfo *roam_info_ptr = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11466 | tCsrRoamInfo roam_info; |
| 11467 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 11468 | tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *) msg_ptr; |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 11469 | |
| 11470 | |
| 11471 | if (!pRsp) { |
| 11472 | sme_err("set key response is NULL"); |
| 11473 | return; |
| 11474 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11475 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11476 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 11477 | sessionId = pRsp->sessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11478 | session = CSR_GET_SESSION(mac_ctx, sessionId); |
| 11479 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11480 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11481 | return; |
| 11482 | } |
| 11483 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11484 | csr_roam_diag_set_ctx_rsp(mac_ctx, session, pRsp); |
| 11485 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 11486 | if (CSR_IS_WAIT_FOR_KEY(mac_ctx, sessionId)) { |
| 11487 | csr_roam_stop_wait_for_key_timer(mac_ctx); |
| 11488 | /* We are done with authentication, whethere succeed or not */ |
| 11489 | csr_roam_substate_change(mac_ctx, eCSR_ROAM_SUBSTATE_NONE, |
| 11490 | sessionId); |
| 11491 | /* We do it here because this linkup function is not called |
| 11492 | * after association when a key needs to be set. |
| 11493 | */ |
| 11494 | if (csr_is_conn_state_connected_infra(mac_ctx, sessionId)) |
| 11495 | csr_roam_link_up(mac_ctx, |
| 11496 | session->connectedProfile.bssid); |
| 11497 | } |
| 11498 | if (eSIR_SME_SUCCESS == pRsp->statusCode) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11499 | qdf_copy_macaddr(&roam_info.peerMac, &pRsp->peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11500 | /* Make sure we install the GTK before indicating to HDD as |
| 11501 | * authenticated. This is to prevent broadcast packets go out |
| 11502 | * after PTK and before GTK. |
| 11503 | */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11504 | if (qdf_is_macaddr_broadcast(&pRsp->peer_macaddr)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11505 | tpSirSetActiveModeSetBncFilterReq pMsg; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11506 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11507 | pMsg = qdf_mem_malloc( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11508 | sizeof(tSirSetActiveModeSetBncFilterReq)); |
Naveen Rawat | 63ad2b6 | 2016-11-17 11:38:21 -0800 | [diff] [blame] | 11509 | if (NULL == pMsg) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11510 | sme_err("Malloc failed"); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 11511 | return; |
Naveen Rawat | 63ad2b6 | 2016-11-17 11:38:21 -0800 | [diff] [blame] | 11512 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11513 | pMsg->messageType = eWNI_SME_SET_BCN_FILTER_REQ; |
Sreelakshmi Konamki | 336e16e | 2016-09-07 14:35:22 +0530 | [diff] [blame] | 11514 | pMsg->length = sizeof(tSirSetActiveModeSetBncFilterReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11515 | pMsg->seesionId = sessionId; |
Sreelakshmi Konamki | 336e16e | 2016-09-07 14:35:22 +0530 | [diff] [blame] | 11516 | qdf_copy_macaddr(&pMsg->bssid, |
| 11517 | &session->connectedProfile.bssid); |
| 11518 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 11519 | status = umac_send_mb_message_to_mac(pMsg); |
Sandeep Puligilla | 829d6ac | 2016-08-11 17:27:50 -0700 | [diff] [blame] | 11520 | /* |
| 11521 | * OBSS SCAN Indication will be sent to Firmware |
| 11522 | * to start OBSS Scan |
| 11523 | */ |
| 11524 | if (CSR_IS_CHANNEL_24GHZ( |
| 11525 | session->connectedProfile.operationChannel) |
| 11526 | && (session->connectState == |
| 11527 | eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED) |
| 11528 | && session->pCurRoamProfile |
| 11529 | && ((QDF_P2P_CLIENT_MODE == |
| 11530 | session->pCurRoamProfile->csrPersona) |
| 11531 | || (QDF_STA_MODE == |
| 11532 | session->pCurRoamProfile->csrPersona))) { |
| 11533 | struct sme_obss_ht40_scanind_msg *msg; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11534 | |
Sandeep Puligilla | 829d6ac | 2016-08-11 17:27:50 -0700 | [diff] [blame] | 11535 | msg = qdf_mem_malloc(sizeof( |
| 11536 | struct sme_obss_ht40_scanind_msg)); |
Naveen Rawat | 63ad2b6 | 2016-11-17 11:38:21 -0800 | [diff] [blame] | 11537 | if (NULL == msg) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11538 | sme_err("Malloc failed"); |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 11539 | return; |
Naveen Rawat | 63ad2b6 | 2016-11-17 11:38:21 -0800 | [diff] [blame] | 11540 | } |
Sandeep Puligilla | 829d6ac | 2016-08-11 17:27:50 -0700 | [diff] [blame] | 11541 | msg->msg_type = eWNI_SME_HT40_OBSS_SCAN_IND; |
| 11542 | msg->length = |
| 11543 | sizeof(struct sme_obss_ht40_scanind_msg); |
| 11544 | qdf_copy_macaddr(&msg->mac_addr, |
| 11545 | &session->connectedProfile.bssid); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 11546 | status = umac_send_mb_message_to_mac(msg); |
Sandeep Puligilla | 829d6ac | 2016-08-11 17:27:50 -0700 | [diff] [blame] | 11547 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11548 | result = eCSR_ROAM_RESULT_AUTHENTICATED; |
| 11549 | } else { |
| 11550 | result = eCSR_ROAM_RESULT_NONE; |
| 11551 | } |
| 11552 | roam_info_ptr = &roam_info; |
| 11553 | } else { |
| 11554 | result = eCSR_ROAM_RESULT_FAILURE; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11555 | sme_err( |
| 11556 | "CSR: setkey command failed(err=%d) PeerMac " |
| 11557 | MAC_ADDRESS_STR, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 11558 | pRsp->statusCode, |
| 11559 | MAC_ADDR_ARRAY(pRsp->peer_macaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11560 | } |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 11561 | /* keeping roam_id = 0 as nobody is using roam_id for set_key */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11562 | csr_roam_call_callback(mac_ctx, sessionId, &roam_info, |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 11563 | 0, eCSR_ROAM_SET_KEY_COMPLETE, result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11564 | /* Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS |
| 11565 | * can go ahead and initiate the TSPEC if any are pending |
| 11566 | */ |
| 11567 | sme_qos_csr_event_ind(mac_ctx, (uint8_t) sessionId, |
| 11568 | SME_QOS_CSR_SET_KEY_SUCCESS_IND, NULL); |
| 11569 | #ifdef FEATURE_WLAN_ESE |
| 11570 | /* Send Adjacent AP repot to new AP. */ |
| 11571 | if (result == eCSR_ROAM_RESULT_AUTHENTICATED |
| 11572 | && session->isPrevApInfoValid |
| 11573 | && session->connectedProfile.isESEAssoc) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11574 | csr_send_ese_adjacent_ap_rep_ind(mac_ctx, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11575 | session->isPrevApInfoValid = false; |
| 11576 | } |
| 11577 | #endif |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 11578 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11579 | } |
| 11580 | |
| 11581 | |
| 11582 | static void |
| 11583 | csr_roam_chk_lnk_max_assoc_exceeded(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) |
| 11584 | { |
| 11585 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
| 11586 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
| 11587 | tCsrRoamInfo roam_info; |
| 11588 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 11589 | qdf_mem_set(&roam_info, sizeof(roam_info), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11590 | pSmeMaxAssocInd = (tSmeMaxAssocInd *) msg_ptr; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11591 | sme_debug( |
| 11592 | "max assoc have been reached, new peer cannot be accepted"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11593 | sessionId = pSmeMaxAssocInd->sessionId; |
| 11594 | roam_info.sessionId = sessionId; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 11595 | qdf_copy_macaddr(&roam_info.peerMac, &pSmeMaxAssocInd->peer_mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11596 | csr_roam_call_callback(mac_ctx, sessionId, &roam_info, 0, |
| 11597 | eCSR_ROAM_INFRA_IND, |
| 11598 | eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 11599 | } |
| 11600 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11601 | void csr_roam_check_for_link_status_change(tpAniSirGlobal pMac, |
| 11602 | tSirSmeRsp *pSirMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11603 | { |
| 11604 | if (NULL == pSirMsg) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11605 | sme_err("pSirMsg is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11606 | return; |
| 11607 | } |
| 11608 | switch (pSirMsg->messageType) { |
| 11609 | case eWNI_SME_ASSOC_IND: |
| 11610 | csr_roam_chk_lnk_assoc_ind(pMac, pSirMsg); |
| 11611 | break; |
| 11612 | case eWNI_SME_DISASSOC_IND: |
| 11613 | csr_roam_chk_lnk_disassoc_ind(pMac, pSirMsg); |
| 11614 | break; |
Hanumantha Reddy Pothula | 3e5d6aa | 2016-09-08 15:21:54 +0530 | [diff] [blame] | 11615 | case eWNI_SME_DISCONNECT_DONE_IND: |
| 11616 | csr_roam_send_disconnect_done_indication(pMac, pSirMsg); |
| 11617 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11618 | case eWNI_SME_DEAUTH_IND: |
| 11619 | csr_roam_chk_lnk_deauth_ind(pMac, pSirMsg); |
| 11620 | break; |
| 11621 | case eWNI_SME_SWITCH_CHL_IND: |
| 11622 | csr_roam_chk_lnk_swt_ch_ind(pMac, pSirMsg); |
| 11623 | break; |
| 11624 | case eWNI_SME_DEAUTH_RSP: |
| 11625 | csr_roam_chk_lnk_deauth_rsp(pMac, pSirMsg); |
| 11626 | break; |
| 11627 | case eWNI_SME_DISASSOC_RSP: |
| 11628 | csr_roam_chk_lnk_disassoc_rsp(pMac, pSirMsg); |
| 11629 | break; |
| 11630 | case eWNI_SME_MIC_FAILURE_IND: |
| 11631 | csr_roam_chk_lnk_mic_fail_ind(pMac, pSirMsg); |
| 11632 | break; |
| 11633 | case eWNI_SME_WPS_PBC_PROBE_REQ_IND: |
| 11634 | csr_roam_chk_lnk_pbs_probe_req_ind(pMac, pSirMsg); |
| 11635 | break; |
| 11636 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 11637 | csr_roam_chk_lnk_wm_status_change_ntf(pMac, pSirMsg); |
| 11638 | break; |
| 11639 | case eWNI_SME_IBSS_NEW_PEER_IND: |
| 11640 | csr_roam_chk_lnk_ibss_new_peer_ind(pMac, pSirMsg); |
| 11641 | break; |
| 11642 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 11643 | csr_roam_chk_lnk_ibss_peer_departed_ind(pMac, pSirMsg); |
| 11644 | break; |
| 11645 | case eWNI_SME_SETCONTEXT_RSP: |
| 11646 | csr_roam_chk_lnk_set_ctx_rsp(pMac, pSirMsg); |
| 11647 | break; |
| 11648 | case eWNI_SME_GET_STATISTICS_RSP: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11649 | sme_debug("Stats rsp from PE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11650 | csr_roam_stats_rsp_processor(pMac, pSirMsg); |
| 11651 | break; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 11652 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11653 | case eWNI_SME_GET_TSM_STATS_RSP: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11654 | sme_debug("TSM Stats rsp from PE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11655 | csr_tsm_stats_rsp_processor(pMac, pSirMsg); |
| 11656 | break; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 11657 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11658 | case eWNI_SME_GET_RSSI_REQ: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11659 | sme_debug("GetRssiReq from self"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11660 | csr_update_rssi(pMac, pSirMsg); |
| 11661 | break; |
| 11662 | case eWNI_SME_GET_SNR_REQ: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11663 | sme_debug("GetSnrReq from self"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11664 | csr_update_snr(pMac, pSirMsg); |
| 11665 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11666 | case eWNI_SME_FT_PRE_AUTH_RSP: |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11667 | csr_roam_ft_pre_auth_rsp_processor(pMac, |
| 11668 | (tpSirFTPreAuthRsp) pSirMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11669 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11670 | case eWNI_SME_MAX_ASSOC_EXCEEDED: |
| 11671 | csr_roam_chk_lnk_max_assoc_exceeded(pMac, pSirMsg); |
| 11672 | break; |
| 11673 | case eWNI_SME_CANDIDATE_FOUND_IND: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11674 | sme_debug("Candidate found indication from PE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11675 | csr_neighbor_roam_candidate_found_ind_hdlr(pMac, pSirMsg); |
| 11676 | break; |
| 11677 | case eWNI_SME_HANDOFF_REQ: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11678 | sme_debug("Handoff Req from self"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11679 | csr_neighbor_roam_handoff_req_hdlr(pMac, pSirMsg); |
| 11680 | break; |
| 11681 | default: |
| 11682 | break; |
| 11683 | } /* end switch on message type */ |
| 11684 | } |
| 11685 | |
| 11686 | void csr_call_roaming_completion_callback(tpAniSirGlobal pMac, |
| 11687 | tCsrRoamSession *pSession, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11688 | tCsrRoamInfo *pRoamInfo, |
| 11689 | uint32_t roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11690 | eCsrRoamResult roamResult) |
| 11691 | { |
| 11692 | if (pSession) { |
| 11693 | if (pSession->bRefAssocStartCnt) { |
| 11694 | pSession->bRefAssocStartCnt--; |
| 11695 | |
| 11696 | if (0 != pSession->bRefAssocStartCnt) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 11697 | QDF_ASSERT(pSession->bRefAssocStartCnt == 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11698 | return; |
| 11699 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11700 | /* Need to call association_completion because there |
| 11701 | * is an assoc_start pending. |
| 11702 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11703 | csr_roam_call_callback(pMac, pSession->sessionId, NULL, |
| 11704 | roamId, |
| 11705 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 11706 | eCSR_ROAM_RESULT_FAILURE); |
| 11707 | } |
| 11708 | csr_roam_call_callback(pMac, pSession->sessionId, pRoamInfo, |
| 11709 | roamId, eCSR_ROAM_ROAMING_COMPLETION, |
| 11710 | roamResult); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11711 | } else |
| 11712 | sme_err("pSession is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11713 | } |
| 11714 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11715 | QDF_STATUS csr_roam_start_roaming(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11716 | eCsrRoamingReason roamingReason) |
| 11717 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11718 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11719 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11720 | if (CSR_IS_LOSTLINK_ROAMING(roamingReason) && |
| 11721 | (false == pMac->roam.roamSession[sessionId].fCancelRoaming)) { |
| 11722 | status = csr_scan_request_lost_link1(pMac, sessionId); |
| 11723 | } |
| 11724 | return status; |
| 11725 | } |
| 11726 | |
| 11727 | /* return a bool to indicate whether roaming completed or continue. */ |
| 11728 | bool csr_roam_complete_roaming(tpAniSirGlobal pMac, uint32_t sessionId, |
| 11729 | bool fForce, eCsrRoamResult roamResult) |
| 11730 | { |
| 11731 | bool fCompleted = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11732 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11733 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11734 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11735 | sme_err("session %d not found ", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11736 | return false; |
| 11737 | } |
| 11738 | /* Check whether time is up */ |
| 11739 | if (pSession->fCancelRoaming || fForce || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11740 | eCsrReassocRoaming == pSession->roamingReason || |
| 11741 | eCsrDynamicRoaming == pSession->roamingReason) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11742 | sme_debug("indicates roaming completion"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11743 | if (pSession->fCancelRoaming |
| 11744 | && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11745 | /* roaming is cancelled, tell HDD to indicate disconnect |
| 11746 | * Because LIM overload deauth_ind for both deauth frame |
| 11747 | * and missed beacon we need to use this logic to |
| 11748 | * detinguish it. For missed beacon, LIM set reason to |
| 11749 | * be eSIR_BEACON_MISSED |
| 11750 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11751 | if (eSIR_BEACON_MISSED == pSession->roamingStatusCode) { |
| 11752 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 11753 | } else if (eCsrLostlinkRoamingDisassoc == |
| 11754 | pSession->roamingReason) { |
| 11755 | roamResult = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 11756 | } else if (eCsrLostlinkRoamingDeauth == |
| 11757 | pSession->roamingReason) { |
| 11758 | roamResult = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 11759 | } else { |
| 11760 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 11761 | } |
| 11762 | } |
| 11763 | csr_call_roaming_completion_callback(pMac, pSession, NULL, 0, |
| 11764 | roamResult); |
| 11765 | pSession->roamingReason = eCsrNotRoaming; |
| 11766 | } else { |
| 11767 | pSession->roamResult = roamResult; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11768 | if (!QDF_IS_STATUS_SUCCESS(csr_roam_start_roaming_timer(pMac, |
| 11769 | sessionId, QDF_MC_TIMER_TO_SEC_UNIT))) { |
| 11770 | csr_call_roaming_completion_callback(pMac, pSession, |
| 11771 | NULL, 0, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11772 | pSession->roamingReason = eCsrNotRoaming; |
| 11773 | } else { |
| 11774 | fCompleted = false; |
| 11775 | } |
| 11776 | } |
| 11777 | return fCompleted; |
| 11778 | } |
| 11779 | |
| 11780 | void csr_roam_cancel_roaming(tpAniSirGlobal pMac, uint32_t sessionId) |
| 11781 | { |
| 11782 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 11783 | |
| 11784 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11785 | sme_err("session: %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11786 | return; |
| 11787 | } |
| 11788 | |
| 11789 | if (CSR_IS_ROAMING(pSession)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11790 | sme_debug("Cancel roaming"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11791 | pSession->fCancelRoaming = true; |
| 11792 | if (CSR_IS_ROAM_JOINING(pMac, sessionId) |
| 11793 | && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11794 | /* No need to do anything in here because the handler |
| 11795 | * takes care of it |
| 11796 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11797 | } else { |
| 11798 | eCsrRoamResult roamResult = |
| 11799 | CSR_IS_LOSTLINK_ROAMING(pSession-> |
| 11800 | roamingReason) ? |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11801 | eCSR_ROAM_RESULT_LOSTLINK : |
| 11802 | eCSR_ROAM_RESULT_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11803 | /* Roaming is stopped after here */ |
| 11804 | csr_roam_complete_roaming(pMac, sessionId, true, |
| 11805 | roamResult); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11806 | /* Since CSR may be in lostlink roaming situation, |
| 11807 | * abort all roaming related activities |
| 11808 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11809 | csr_scan_abort_mac_scan(pMac, sessionId, |
yeshwanth sriram guntuka | 310b3ac | 2016-11-15 23:25:26 +0530 | [diff] [blame] | 11810 | INVALID_SCAN_ID, eCSR_SCAN_ABORT_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11811 | csr_roam_stop_roaming_timer(pMac, sessionId); |
| 11812 | } |
| 11813 | } |
| 11814 | } |
| 11815 | |
| 11816 | void csr_roam_roaming_timer_handler(void *pv) |
| 11817 | { |
| 11818 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *) pv; |
| 11819 | tpAniSirGlobal pMac = pInfo->pMac; |
| 11820 | uint32_t sessionId = pInfo->sessionId; |
| 11821 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 11822 | |
| 11823 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11824 | sme_err(" session %d not found ", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11825 | return; |
| 11826 | } |
| 11827 | |
| 11828 | if (false == pSession->fCancelRoaming) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11829 | if (!QDF_IS_STATUS_SUCCESS(csr_roam_start_roaming(pMac, |
| 11830 | sessionId, pSession->roamingReason))) { |
| 11831 | csr_call_roaming_completion_callback(pMac, pSession, |
| 11832 | NULL, 0, |
| 11833 | pSession->roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11834 | pSession->roamingReason = eCsrNotRoaming; |
| 11835 | } |
| 11836 | } |
| 11837 | } |
| 11838 | |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 11839 | /** |
| 11840 | * csr_roam_roaming_offload_timeout_handler() - Handler for roaming failure |
| 11841 | * @timer_data: Carries the mac_ctx and session info |
| 11842 | * |
| 11843 | * This function would be invoked when the roaming_offload_timer expires. |
| 11844 | * The timer is waiting in anticipation of a related roaming event from |
| 11845 | * the firmware after receiving the ROAM_START event. |
| 11846 | * |
| 11847 | * Return: None |
| 11848 | */ |
| 11849 | void csr_roam_roaming_offload_timeout_handler(void *timer_data) |
| 11850 | { |
| 11851 | tCsrTimerInfo *timer_info = (tCsrTimerInfo *) timer_data; |
| 11852 | |
| 11853 | if (timer_info) { |
| 11854 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11855 | "LFR3:roaming offload timer expired, session: %d", |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 11856 | timer_info->sessionId); |
| 11857 | } else { |
| 11858 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11859 | "Invalid Session"); |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 11860 | return; |
| 11861 | } |
| 11862 | csr_roam_disconnect(timer_info->pMac, timer_info->sessionId, |
| 11863 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 11864 | } |
| 11865 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11866 | QDF_STATUS csr_roam_start_roaming_timer(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11867 | uint32_t interval) |
| 11868 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11869 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11870 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 11871 | |
| 11872 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11873 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11874 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11875 | } |
| 11876 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11877 | sme_debug("csrScanStartRoamingTimer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11878 | pSession->roamingTimerInfo.sessionId = (uint8_t) sessionId; |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 11879 | status = qdf_mc_timer_start(&pSession->hTimerRoaming, |
| 11880 | interval / QDF_MC_TIMER_TO_MS_UNIT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11881 | |
| 11882 | return status; |
| 11883 | } |
| 11884 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11885 | QDF_STATUS csr_roam_stop_roaming_timer(tpAniSirGlobal pMac, uint32_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11886 | { |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 11887 | return qdf_mc_timer_stop |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11888 | (&pMac->roam.roamSession[sessionId].hTimerRoaming); |
| 11889 | } |
| 11890 | |
| 11891 | void csr_roam_wait_for_key_time_out_handler(void *pv) |
| 11892 | { |
| 11893 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *) pv; |
| 11894 | tpAniSirGlobal pMac = pInfo->pMac; |
| 11895 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, pInfo->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11896 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11897 | |
| 11898 | if (pSession == NULL) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11899 | sme_err("session not found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11900 | return; |
| 11901 | } |
| 11902 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11903 | sme_debug("WaitForKey timer expired in state: %s sub-state: %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11904 | mac_trace_get_neighbour_roam_state(pMac->roam. |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11905 | neighborRoamInfo[pInfo->sessionId]. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11906 | neighborRoamState), |
| 11907 | mac_trace_getcsr_roam_sub_state(pMac->roam. |
| 11908 | curSubState[pInfo->sessionId])); |
| 11909 | |
| 11910 | if (CSR_IS_WAIT_FOR_KEY(pMac, pInfo->sessionId)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11911 | if (csr_neighbor_roam_is_handoff_in_progress(pMac, |
| 11912 | pInfo->sessionId)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11913 | /* |
| 11914 | * Enable heartbeat timer when hand-off is in progress |
| 11915 | * and Key Wait timer expired. |
| 11916 | */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11917 | sme_debug("Enabling HB timer after WaitKey expiry nHBCount: %d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11918 | pMac->roam.configParam.HeartbeatThresh24); |
| 11919 | cfg_set_int(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11920 | pMac->roam.configParam.HeartbeatThresh24); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11921 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11922 | sme_debug("SME pre-auth state timeout"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11923 | |
| 11924 | /* Change the substate so command queue is unblocked. */ |
| 11925 | if (CSR_ROAM_SESSION_MAX > pInfo->sessionId) { |
| 11926 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_NONE, |
| 11927 | pInfo->sessionId); |
| 11928 | } |
| 11929 | |
| 11930 | if (csr_is_conn_state_connected_infra(pMac, pInfo->sessionId)) { |
| 11931 | csr_roam_link_up(pMac, |
| 11932 | pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11933 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11934 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11935 | csr_roam_disconnect(pMac, pInfo->sessionId, |
| 11936 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 11937 | sme_release_global_lock(&pMac->sme); |
| 11938 | } |
| 11939 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11940 | sme_err("session not found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11941 | } |
| 11942 | } |
| 11943 | |
| 11944 | } |
| 11945 | |
Yingying Tang | 87f0139 | 2017-03-22 17:29:54 +0800 | [diff] [blame] | 11946 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 11947 | /** |
| 11948 | * csr_roam_roaming_offload_timer_action() - API to start/stop the timer |
| 11949 | * @mac_ctx: MAC Context |
| 11950 | * @interval: Value to be set for the timer |
| 11951 | * @session_id: Session on which the timer should be operated |
| 11952 | * @action: Start/Stop action for the timer |
| 11953 | * |
| 11954 | * API to start/stop the roaming offload timer |
| 11955 | * |
| 11956 | * Return: None |
| 11957 | */ |
| 11958 | void csr_roam_roaming_offload_timer_action(tpAniSirGlobal mac_ctx, |
| 11959 | uint32_t interval, uint8_t session_id, |
| 11960 | uint8_t action) |
| 11961 | { |
| 11962 | tCsrRoamSession *csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 11963 | |
| 11964 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11965 | ("LFR3: timer action %d, session %d, intvl %d"), |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 11966 | action, session_id, interval); |
| 11967 | if (mac_ctx) { |
| 11968 | csr_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 11969 | } else { |
| 11970 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11971 | ("LFR3: Invalid MAC Context")); |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 11972 | return; |
| 11973 | } |
| 11974 | if (!csr_session) { |
| 11975 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 11976 | ("LFR3: session %d not found"), session_id); |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 11977 | return; |
| 11978 | } |
| 11979 | csr_session->roamingTimerInfo.sessionId = (uint8_t) session_id; |
| 11980 | if (action == ROAMING_OFFLOAD_TIMER_START) |
| 11981 | qdf_mc_timer_start(&csr_session->roaming_offload_timer, |
| 11982 | interval / QDF_MC_TIMER_TO_MS_UNIT); |
| 11983 | if (action == ROAMING_OFFLOAD_TIMER_STOP) |
| 11984 | qdf_mc_timer_stop(&csr_session->roaming_offload_timer); |
| 11985 | |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 11986 | } |
Yingying Tang | 87f0139 | 2017-03-22 17:29:54 +0800 | [diff] [blame] | 11987 | #endif |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 11988 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 11989 | static QDF_STATUS csr_roam_start_wait_for_key_timer(tpAniSirGlobal pMac, |
| 11990 | uint32_t interval) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11991 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 11992 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11993 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = |
| 11994 | &pMac->roam.neighborRoamInfo[pMac->roam.WaitForKeyTimerInfo. |
| 11995 | sessionId]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11996 | if (csr_neighbor_roam_is_handoff_in_progress(pMac, |
Deepak Dhamdhere | ecce974 | 2015-11-08 01:16:43 -0800 | [diff] [blame] | 11997 | pMac->roam.WaitForKeyTimerInfo. |
| 11998 | sessionId)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 11999 | /* Disable heartbeat timer when hand-off is in progress */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12000 | sme_debug("disabling HB timer in state: %s sub-state: %s", |
Deepak Dhamdhere | ecce974 | 2015-11-08 01:16:43 -0800 | [diff] [blame] | 12001 | mac_trace_get_neighbour_roam_state( |
| 12002 | pNeighborRoamInfo->neighborRoamState), |
| 12003 | mac_trace_getcsr_roam_sub_state( |
| 12004 | pMac->roam.curSubState[pMac->roam. |
| 12005 | WaitForKeyTimerInfo.sessionId])); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12006 | cfg_set_int(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0); |
| 12007 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12008 | sme_debug("csrScanStartWaitForKeyTimer"); |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 12009 | status = qdf_mc_timer_start(&pMac->roam.hTimerWaitForKey, |
| 12010 | interval / QDF_MC_TIMER_TO_MS_UNIT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12011 | |
| 12012 | return status; |
| 12013 | } |
| 12014 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12015 | QDF_STATUS csr_roam_stop_wait_for_key_timer(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12016 | { |
| 12017 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = |
| 12018 | &pMac->roam.neighborRoamInfo[pMac->roam.WaitForKeyTimerInfo. |
| 12019 | sessionId]; |
| 12020 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12021 | sme_debug("WaitForKey timer stopped in state: %s sub-state: %s", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12022 | mac_trace_get_neighbour_roam_state(pNeighborRoamInfo-> |
| 12023 | neighborRoamState), |
| 12024 | mac_trace_getcsr_roam_sub_state(pMac->roam. |
| 12025 | curSubState[pMac->roam. |
| 12026 | WaitForKeyTimerInfo. |
| 12027 | sessionId])); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12028 | if (csr_neighbor_roam_is_handoff_in_progress(pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12029 | pMac->roam.WaitForKeyTimerInfo. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12030 | sessionId)) { |
| 12031 | /* |
| 12032 | * Enable heartbeat timer when hand-off is in progress |
| 12033 | * and Key Wait timer got stopped for some reason |
| 12034 | */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12035 | sme_debug("Enabling HB timer after WaitKey stop nHBCount: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12036 | pMac->roam.configParam.HeartbeatThresh24); |
| 12037 | cfg_set_int(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 12038 | pMac->roam.configParam.HeartbeatThresh24); |
| 12039 | } |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 12040 | return qdf_mc_timer_stop(&pMac->roam.hTimerWaitForKey); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12041 | } |
| 12042 | |
| 12043 | void csr_roam_completion(tpAniSirGlobal pMac, uint32_t sessionId, |
| 12044 | tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, |
| 12045 | eCsrRoamResult roamResult, bool fSuccess) |
| 12046 | { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12047 | eRoamCmdStatus roamStatus = csr_get_roam_complete_status(pMac, |
| 12048 | sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12049 | uint32_t roamId = 0; |
| 12050 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 12051 | |
| 12052 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12053 | sme_err("session: %d not found ", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12054 | return; |
| 12055 | } |
| 12056 | |
| 12057 | if (pCommand) { |
| 12058 | roamId = pCommand->u.roamCmd.roamId; |
| 12059 | if (sessionId != pCommand->sessionId) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12060 | QDF_ASSERT(sessionId == pCommand->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12061 | return; |
| 12062 | } |
| 12063 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12064 | if (eCSR_ROAM_ROAMING_COMPLETION == roamStatus) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12065 | /* if success, force roaming completion */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12066 | csr_roam_complete_roaming(pMac, sessionId, fSuccess, |
| 12067 | roamResult); |
| 12068 | else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12069 | if (pSession->bRefAssocStartCnt != 0) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12070 | QDF_ASSERT(pSession->bRefAssocStartCnt == 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12071 | return; |
| 12072 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12073 | sme_debug("indicates association completion roamResult: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12074 | roamResult); |
| 12075 | csr_roam_call_callback(pMac, sessionId, pRoamInfo, roamId, |
| 12076 | roamStatus, roamResult); |
| 12077 | } |
| 12078 | } |
| 12079 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 12080 | static |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12081 | QDF_STATUS csr_roam_lost_link(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12082 | uint32_t type, tSirSmeRsp *pSirMsg) |
| 12083 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12084 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12085 | tSirSmeDeauthInd *pDeauthIndMsg = NULL; |
| 12086 | tSirSmeDisassocInd *pDisassocIndMsg = NULL; |
| 12087 | eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12088 | tCsrRoamInfo roamInfo; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12089 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 12090 | |
| 12091 | if (!pSession) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12092 | sme_err("session: %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12093 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12094 | } |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 12095 | #ifndef NAPIER_SCAN |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12096 | pSession->fCancelRoaming = false; |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 12097 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12098 | if (eWNI_SME_DISASSOC_IND == type) { |
| 12099 | result = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 12100 | pDisassocIndMsg = (tSirSmeDisassocInd *) pSirMsg; |
| 12101 | pSession->roamingStatusCode = pDisassocIndMsg->statusCode; |
| 12102 | pSession->joinFailStatusCode.reasonCode = |
| 12103 | pDisassocIndMsg->reasonCode; |
| 12104 | } else if (eWNI_SME_DEAUTH_IND == type) { |
| 12105 | result = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 12106 | pDeauthIndMsg = (tSirSmeDeauthInd *) pSirMsg; |
| 12107 | pSession->roamingStatusCode = pDeauthIndMsg->statusCode; |
Selvaraj, Sridhar | c7d8089 | 2016-09-29 11:56:45 +0530 | [diff] [blame] | 12108 | pSession->joinFailStatusCode.reasonCode = |
| 12109 | pDeauthIndMsg->reasonCode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12110 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12111 | sme_warn("gets an unknown type (%d)", type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12112 | result = eCSR_ROAM_RESULT_NONE; |
| 12113 | pSession->joinFailStatusCode.reasonCode = 1; |
| 12114 | } |
| 12115 | |
| 12116 | /* call profile lost link routine here */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12117 | if (!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12118 | csr_roam_call_callback(pMac, sessionId, NULL, 0, |
| 12119 | eCSR_ROAM_LOSTLINK_DETECTED, result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12120 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12121 | if (eWNI_SME_DISASSOC_IND == type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12122 | status = csr_send_mb_disassoc_cnf_msg(pMac, pDisassocIndMsg); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12123 | else if (eWNI_SME_DEAUTH_IND == type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12124 | status = csr_send_mb_deauth_cnf_msg(pMac, pDeauthIndMsg); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12125 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12126 | /* prepare to tell HDD to disconnect */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12127 | qdf_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12128 | roamInfo.statusCode = (tSirResultCodes) pSession->roamingStatusCode; |
| 12129 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 12130 | if (eWNI_SME_DISASSOC_IND == type) { |
| 12131 | /* staMacAddr */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 12132 | qdf_copy_macaddr(&roamInfo.peerMac, |
Srinivas Girigowda | e13cc34 | 2016-01-05 17:07:53 -0800 | [diff] [blame] | 12133 | &pDisassocIndMsg->peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12134 | roamInfo.staId = (uint8_t) pDisassocIndMsg->staId; |
| 12135 | roamInfo.reasonCode = pDisassocIndMsg->reasonCode; |
| 12136 | } else if (eWNI_SME_DEAUTH_IND == type) { |
| 12137 | /* staMacAddr */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 12138 | qdf_copy_macaddr(&roamInfo.peerMac, |
Srinivas Girigowda | 9ee9a5c | 2016-01-04 15:51:05 -0800 | [diff] [blame] | 12139 | &pDeauthIndMsg->peer_macaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12140 | roamInfo.staId = (uint8_t) pDeauthIndMsg->staId; |
| 12141 | roamInfo.reasonCode = pDeauthIndMsg->reasonCode; |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 12142 | roamInfo.rxRssi = pDeauthIndMsg->rssi; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12143 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12144 | sme_debug("roamInfo.staId: %d", roamInfo.staId); |
Sandeep Puligilla | a330c8c | 2017-03-09 18:03:21 -0800 | [diff] [blame] | 12145 | /* Dont initiate internal driver based roaming after disconnection*/ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12146 | return status; |
| 12147 | } |
| 12148 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12149 | |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 12150 | static void csr_roam_wm_status_change_complete(tpAniSirGlobal pMac, |
| 12151 | uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12152 | { |
| 12153 | tListElem *pEntry; |
| 12154 | tSmeCmd *pCommand; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12155 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 12156 | pEntry = csr_nonscan_active_ll_peek_head(pMac, LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12157 | if (pEntry) { |
| 12158 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 12159 | if (eSmeCommandWmStatusChange == pCommand->command) { |
| 12160 | /* Nothing to process in a Lost Link completion.... It just kicks off a */ |
| 12161 | /* roaming sequence. */ |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 12162 | if (csr_nonscan_active_ll_remove_entry(pMac, pEntry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12163 | LL_ACCESS_LOCK)) { |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 12164 | csr_release_command(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12165 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12166 | sme_err( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12167 | " ******csr_roam_wm_status_change_complete fail to release command"); |
| 12168 | } |
| 12169 | |
| 12170 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12171 | sme_warn( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12172 | "CSR: WmStatusChange Completion called but LOST LINK command is not ACTIVE ..."); |
| 12173 | } |
| 12174 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12175 | sme_warn( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12176 | "CSR: WmStatusChange Completion called but NO commands are ACTIVE ..."); |
| 12177 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12178 | } |
| 12179 | |
| 12180 | void csr_roam_process_wm_status_change_command(tpAniSirGlobal pMac, |
| 12181 | tSmeCmd *pCommand) |
| 12182 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12183 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12184 | tSirSmeRsp *pSirSmeMsg; |
| 12185 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, pCommand->sessionId); |
| 12186 | |
| 12187 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12188 | sme_err("session %d not found", pCommand->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12189 | return; |
| 12190 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12191 | sme_debug("session:%d, CmdType : %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12192 | pCommand->sessionId, pCommand->u.wmStatusChangeCmd.Type); |
| 12193 | |
| 12194 | switch (pCommand->u.wmStatusChangeCmd.Type) { |
| 12195 | case eCsrDisassociated: |
| 12196 | pSirSmeMsg = |
| 12197 | (tSirSmeRsp *) &pCommand->u.wmStatusChangeCmd.u. |
| 12198 | DisassocIndMsg; |
| 12199 | status = |
| 12200 | csr_roam_lost_link(pMac, pCommand->sessionId, |
| 12201 | eWNI_SME_DISASSOC_IND, pSirSmeMsg); |
| 12202 | break; |
| 12203 | case eCsrDeauthenticated: |
| 12204 | pSirSmeMsg = |
| 12205 | (tSirSmeRsp *) &pCommand->u.wmStatusChangeCmd.u. |
| 12206 | DeauthIndMsg; |
| 12207 | status = |
| 12208 | csr_roam_lost_link(pMac, pCommand->sessionId, |
| 12209 | eWNI_SME_DEAUTH_IND, pSirSmeMsg); |
| 12210 | break; |
| 12211 | default: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12212 | sme_warn("gets an unknown command %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12213 | pCommand->u.wmStatusChangeCmd.Type); |
| 12214 | break; |
| 12215 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12216 | /* Lost Link just triggers a roaming sequence. We can complte the |
| 12217 | * Lost Link command here since there is nothing else to do. |
| 12218 | */ |
Krunal Soni | f358302 | 2017-02-10 17:18:10 -0800 | [diff] [blame] | 12219 | csr_roam_wm_status_change_complete(pMac, pCommand->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12220 | } |
| 12221 | |
| 12222 | |
| 12223 | /** |
| 12224 | * csr_compute_mode_and_band() - computes dot11mode |
| 12225 | * @pMac: mac global context |
| 12226 | * @dot11_mode: out param, do11 mode calculated |
| 12227 | * @band: out param, band caclculated |
| 12228 | * @opr_ch: operating channels |
| 12229 | * |
| 12230 | * This function finds dot11 mode based on current mode, operating channel and |
| 12231 | * fw supported modes. |
| 12232 | * |
| 12233 | * Return: void |
| 12234 | */ |
| 12235 | static void |
| 12236 | csr_compute_mode_and_band(tpAniSirGlobal mac_ctx, |
| 12237 | eCsrCfgDot11Mode *dot11_mode, |
| 12238 | eCsrBand *band, |
| 12239 | uint8_t opr_ch) |
| 12240 | { |
| 12241 | bool vht_24_ghz = mac_ctx->roam.configParam.enableVhtFor24GHz; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 12242 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12243 | switch (mac_ctx->roam.configParam.uCfgDot11Mode) { |
| 12244 | case eCSR_CFG_DOT11_MODE_11A: |
| 12245 | *dot11_mode = eCSR_CFG_DOT11_MODE_11A; |
| 12246 | *band = eCSR_BAND_5G; |
| 12247 | break; |
| 12248 | case eCSR_CFG_DOT11_MODE_11B: |
| 12249 | *dot11_mode = eCSR_CFG_DOT11_MODE_11B; |
| 12250 | *band = eCSR_BAND_24; |
| 12251 | break; |
| 12252 | case eCSR_CFG_DOT11_MODE_11G: |
| 12253 | *dot11_mode = eCSR_CFG_DOT11_MODE_11G; |
| 12254 | *band = eCSR_BAND_24; |
| 12255 | break; |
| 12256 | case eCSR_CFG_DOT11_MODE_11N: |
| 12257 | *dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
| 12258 | *band = CSR_GET_BAND(opr_ch); |
| 12259 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12260 | case eCSR_CFG_DOT11_MODE_11AC: |
| 12261 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) { |
| 12262 | /* |
| 12263 | * If the operating channel is in 2.4 GHz band, check |
| 12264 | * for INI item to disable VHT operation in 2.4 GHz band |
| 12265 | */ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12266 | if (WLAN_REG_IS_24GHZ_CH(opr_ch) && !vht_24_ghz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12267 | /* Disable 11AC operation */ |
| 12268 | *dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
| 12269 | else |
| 12270 | *dot11_mode = eCSR_CFG_DOT11_MODE_11AC; |
| 12271 | } else { |
| 12272 | *dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
| 12273 | } |
| 12274 | *band = CSR_GET_BAND(opr_ch); |
| 12275 | break; |
| 12276 | case eCSR_CFG_DOT11_MODE_11AC_ONLY: |
| 12277 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) { |
| 12278 | /* |
| 12279 | * If the operating channel is in 2.4 GHz band, check |
| 12280 | * for INI item to disable VHT operation in 2.4 GHz band |
| 12281 | */ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12282 | if (WLAN_REG_IS_24GHZ_CH(opr_ch) && !vht_24_ghz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12283 | /* Disable 11AC operation */ |
| 12284 | *dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
| 12285 | else |
| 12286 | *dot11_mode = eCSR_CFG_DOT11_MODE_11AC_ONLY; |
| 12287 | } else { |
| 12288 | *dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
| 12289 | } |
| 12290 | *band = CSR_GET_BAND(opr_ch); |
| 12291 | break; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 12292 | case eCSR_CFG_DOT11_MODE_11AX: |
| 12293 | case eCSR_CFG_DOT11_MODE_11AX_ONLY: |
| 12294 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) { |
| 12295 | *dot11_mode = mac_ctx->roam.configParam.uCfgDot11Mode; |
| 12296 | } else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) { |
| 12297 | /* |
| 12298 | * If the operating channel is in 2.4 GHz band, check |
| 12299 | * for INI item to disable VHT operation in 2.4 GHz band |
| 12300 | */ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12301 | if (WLAN_REG_IS_24GHZ_CH(opr_ch) && !vht_24_ghz) |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 12302 | /* Disable 11AC operation */ |
| 12303 | *dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
| 12304 | else |
| 12305 | *dot11_mode = eCSR_CFG_DOT11_MODE_11AC; |
| 12306 | } else { |
| 12307 | *dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
| 12308 | } |
| 12309 | *band = CSR_GET_BAND(opr_ch); |
| 12310 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12311 | case eCSR_CFG_DOT11_MODE_AUTO: |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 12312 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) { |
| 12313 | *dot11_mode = eCSR_CFG_DOT11_MODE_11AX; |
| 12314 | } else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12315 | /* |
| 12316 | * If the operating channel is in 2.4 GHz band, |
| 12317 | * check for INI item to disable VHT operation |
| 12318 | * in 2.4 GHz band |
| 12319 | */ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12320 | if (WLAN_REG_IS_24GHZ_CH(opr_ch) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12321 | && !vht_24_ghz) |
| 12322 | /* Disable 11AC operation */ |
| 12323 | *dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
| 12324 | else |
| 12325 | *dot11_mode = eCSR_CFG_DOT11_MODE_11AC; |
| 12326 | } else { |
| 12327 | *dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
| 12328 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12329 | *band = CSR_GET_BAND(opr_ch); |
| 12330 | break; |
| 12331 | default: |
| 12332 | /* |
| 12333 | * Global dot11 Mode setting is 11a/b/g. use the channel number |
| 12334 | * to determine the Mode setting. |
| 12335 | */ |
| 12336 | if (eCSR_OPERATING_CHANNEL_AUTO == opr_ch) { |
| 12337 | *band = mac_ctx->roam.configParam.eBand; |
| 12338 | if (eCSR_BAND_24 == *band) { |
| 12339 | /* |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12340 | * See reason in else if ( WLAN_REG_IS_24GHZ_CH |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12341 | * (opr_ch) ) to pick 11B |
| 12342 | */ |
| 12343 | *dot11_mode = eCSR_CFG_DOT11_MODE_11B; |
| 12344 | } else { |
| 12345 | /* prefer 5GHz */ |
| 12346 | *band = eCSR_BAND_5G; |
| 12347 | *dot11_mode = eCSR_CFG_DOT11_MODE_11A; |
| 12348 | } |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12349 | } else if (WLAN_REG_IS_24GHZ_CH(opr_ch)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12350 | /* |
| 12351 | * WiFi tests require IBSS networks to start in 11b mode |
| 12352 | * without any change to the default parameter settings |
| 12353 | * on the adapter. We use ACU to start an IBSS through |
| 12354 | * creation of a startIBSS profile. This startIBSS |
| 12355 | * profile has Auto MACProtocol and the adapter property |
| 12356 | * setting for dot11Mode is also AUTO. So in this case, |
| 12357 | * let's start the IBSS network in 11b mode instead of |
| 12358 | * 11g mode. So this is for Auto=profile->MacProtocol && |
| 12359 | * Auto=Global. dot11Mode && profile->channel is < 14, |
| 12360 | * then start the IBSS in b mode. |
| 12361 | * |
| 12362 | * Note: we used to have this start as an 11g IBSS for |
| 12363 | * best performance. now to specify that the user will |
| 12364 | * have to set the do11Mode in the property page to 11g |
| 12365 | * to force it. |
| 12366 | */ |
| 12367 | *dot11_mode = eCSR_CFG_DOT11_MODE_11B; |
| 12368 | *band = eCSR_BAND_24; |
| 12369 | } else { |
| 12370 | /* else, it's a 5.0GHz channel. Set mode to 11a. */ |
| 12371 | *dot11_mode = eCSR_CFG_DOT11_MODE_11A; |
| 12372 | *band = eCSR_BAND_5G; |
| 12373 | } |
| 12374 | break; |
| 12375 | } /* switch */ |
| 12376 | } |
| 12377 | |
| 12378 | /** |
| 12379 | * csr_roam_get_phy_mode_band_for_bss() - This function returns band and mode |
| 12380 | * information. |
| 12381 | * @mac_ctx: mac global context |
| 12382 | * @profile: bss profile |
| 12383 | * @band: out param, band caclculated |
| 12384 | * @opr_ch: operating channels |
| 12385 | * |
| 12386 | * This function finds dot11 mode based on current mode, operating channel and |
| 12387 | * fw supported modes. The only tricky part is that if phyMode is set to 11abg, |
| 12388 | * this function may return eCSR_CFG_DOT11_MODE_11B instead of |
| 12389 | * eCSR_CFG_DOT11_MODE_11G if everything is set to auto-pick. |
| 12390 | * |
| 12391 | * Return: dot11mode |
| 12392 | */ |
| 12393 | static eCsrCfgDot11Mode |
| 12394 | csr_roam_get_phy_mode_band_for_bss(tpAniSirGlobal mac_ctx, |
| 12395 | tCsrRoamProfile *profile, |
| 12396 | uint8_t opr_chn, |
| 12397 | eCsrBand *p_band) |
| 12398 | { |
| 12399 | eCsrBand band; |
| 12400 | eCsrCfgDot11Mode curr_mode = mac_ctx->roam.configParam.uCfgDot11Mode; |
| 12401 | eCsrCfgDot11Mode cfg_dot11_mode = |
| 12402 | csr_get_cfg_dot11_mode_from_csr_phy_mode(profile, |
| 12403 | (eCsrPhyMode) profile->phyMode, |
| 12404 | mac_ctx->roam.configParam.ProprietaryRatesEnabled); |
| 12405 | |
| 12406 | /* |
| 12407 | * If the global setting for dot11Mode is set to auto/abg, we overwrite |
| 12408 | * the setting in the profile. |
| 12409 | */ |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 12410 | if ((!CSR_IS_INFRA_AP(profile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12411 | && ((eCSR_CFG_DOT11_MODE_AUTO == curr_mode) |
| 12412 | || (eCSR_CFG_DOT11_MODE_ABG == curr_mode))) |
| 12413 | || (eCSR_CFG_DOT11_MODE_AUTO == cfg_dot11_mode) |
| 12414 | || (eCSR_CFG_DOT11_MODE_ABG == cfg_dot11_mode)) { |
| 12415 | csr_compute_mode_and_band(mac_ctx, &cfg_dot11_mode, |
| 12416 | &band, opr_chn); |
| 12417 | } /* if( eCSR_CFG_DOT11_MODE_ABG == cfg_dot11_mode ) */ |
| 12418 | else { |
| 12419 | /* dot11 mode is set, lets pick the band */ |
| 12420 | if (eCSR_OPERATING_CHANNEL_AUTO == opr_chn) { |
| 12421 | /* channel is Auto also. */ |
| 12422 | band = mac_ctx->roam.configParam.eBand; |
| 12423 | if (eCSR_BAND_ALL == band) { |
| 12424 | /* prefer 5GHz */ |
| 12425 | band = eCSR_BAND_5G; |
| 12426 | } |
| 12427 | } else{ |
| 12428 | band = CSR_GET_BAND(opr_chn); |
| 12429 | } |
| 12430 | } |
| 12431 | if (p_band) |
| 12432 | *p_band = band; |
| 12433 | |
| 12434 | if (opr_chn == 14) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12435 | sme_err("Switching to Dot11B mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12436 | cfg_dot11_mode = eCSR_CFG_DOT11_MODE_11B; |
| 12437 | } |
| 12438 | |
Gupta, Kapil | 76ed25e | 2016-04-22 15:13:55 +0530 | [diff] [blame] | 12439 | if (IS_24G_CH(opr_chn) && |
| 12440 | (false == mac_ctx->roam.configParam.enableVhtFor24GHz) && |
| 12441 | (eCSR_CFG_DOT11_MODE_11AC == cfg_dot11_mode || |
| 12442 | eCSR_CFG_DOT11_MODE_11AC_ONLY == cfg_dot11_mode)) |
| 12443 | cfg_dot11_mode = eCSR_CFG_DOT11_MODE_11N; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12444 | /* |
| 12445 | * Incase of WEP Security encryption type is coming as part of add key. |
| 12446 | * So while STart BSS dont have information |
| 12447 | */ |
| 12448 | if ((!CSR_IS_11n_ALLOWED(profile->EncryptionType.encryptionType[0]) |
| 12449 | || ((profile->privacy == 1) |
| 12450 | && (profile->EncryptionType.encryptionType[0] == |
| 12451 | eCSR_ENCRYPT_TYPE_NONE))) |
| 12452 | && ((eCSR_CFG_DOT11_MODE_11N == cfg_dot11_mode) || |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 12453 | (eCSR_CFG_DOT11_MODE_11AC == cfg_dot11_mode))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12454 | /* We cannot do 11n here */ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12455 | if (WLAN_REG_IS_24GHZ_CH(opr_chn)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12456 | cfg_dot11_mode = eCSR_CFG_DOT11_MODE_11G; |
| 12457 | else |
| 12458 | cfg_dot11_mode = eCSR_CFG_DOT11_MODE_11A; |
| 12459 | } |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 12460 | sme_debug("dot11mode: %d", cfg_dot11_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12461 | return cfg_dot11_mode; |
| 12462 | } |
| 12463 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12464 | QDF_STATUS csr_roam_issue_stop_bss(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12465 | eCsrRoamSubState NewSubstate) |
| 12466 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12467 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12468 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 12469 | |
| 12470 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12471 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12472 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12473 | } |
| 12474 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 12475 | { |
| 12476 | host_log_ibss_pkt_type *pIbssLog; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12477 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12478 | WLAN_HOST_DIAG_LOG_ALLOC(pIbssLog, host_log_ibss_pkt_type, |
| 12479 | LOG_WLAN_IBSS_C); |
| 12480 | if (pIbssLog) { |
| 12481 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ; |
| 12482 | WLAN_HOST_DIAG_LOG_REPORT(pIbssLog); |
| 12483 | } |
| 12484 | } |
| 12485 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 12486 | /* Set the roaming substate to 'stop Bss request'... */ |
| 12487 | csr_roam_substate_change(pMac, NewSubstate, sessionId); |
| 12488 | |
| 12489 | /* attempt to stop the Bss (reason code is ignored...) */ |
| 12490 | status = csr_send_mb_stop_bss_req_msg(pMac, sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12491 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12492 | sme_warn( |
| 12493 | "csr_send_mb_stop_bss_req_msg failed with status %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12494 | status); |
| 12495 | } |
| 12496 | return status; |
| 12497 | } |
| 12498 | |
| 12499 | /* pNumChan is a caller allocated space with the sizeof pChannels */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12500 | QDF_STATUS csr_get_cfg_valid_channels(tpAniSirGlobal pMac, uint8_t *pChannels, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12501 | uint32_t *pNumChan) |
| 12502 | { |
Edhar, Mahesh Kumar | eb31abd | 2016-01-21 17:50:47 +0530 | [diff] [blame] | 12503 | uint8_t num_chan_temp = 0; |
| 12504 | int i; |
| 12505 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12506 | if (!IS_SIR_STATUS_SUCCESS(wlan_cfg_get_str(pMac, |
| 12507 | WNI_CFG_VALID_CHANNEL_LIST, |
| 12508 | (uint8_t *) pChannels, pNumChan))) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12509 | return QDF_STATUS_E_FAILURE; |
Edhar, Mahesh Kumar | eb31abd | 2016-01-21 17:50:47 +0530 | [diff] [blame] | 12510 | |
| 12511 | for (i = 0; i < *pNumChan; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12512 | if (!WLAN_REG_IS_11P_CH(pChannels[i])) { |
Edhar, Mahesh Kumar | eb31abd | 2016-01-21 17:50:47 +0530 | [diff] [blame] | 12513 | pChannels[num_chan_temp] = pChannels[i]; |
| 12514 | num_chan_temp++; |
| 12515 | } |
| 12516 | } |
| 12517 | |
| 12518 | *pNumChan = num_chan_temp; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12519 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12520 | } |
| 12521 | |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 12522 | int8_t csr_get_cfg_max_tx_power(tpAniSirGlobal pMac, uint8_t channel) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12523 | { |
| 12524 | uint32_t cfgLength = 0; |
| 12525 | uint16_t cfgId = 0; |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 12526 | int8_t maxTxPwr = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12527 | uint8_t *pCountryInfo = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12528 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12529 | uint8_t count = 0; |
| 12530 | uint8_t firstChannel; |
| 12531 | uint8_t maxChannels; |
| 12532 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12533 | if (WLAN_REG_IS_5GHZ_CH(channel)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12534 | cfgId = WNI_CFG_MAX_TX_POWER_5; |
| 12535 | cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12536 | } else if (WLAN_REG_IS_24GHZ_CH(channel)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12537 | cfgId = WNI_CFG_MAX_TX_POWER_2_4; |
| 12538 | cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN; |
| 12539 | } else |
| 12540 | return maxTxPwr; |
| 12541 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12542 | pCountryInfo = qdf_mem_malloc(cfgLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12543 | if (NULL == pCountryInfo) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12544 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12545 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12546 | status = QDF_STATUS_SUCCESS; |
| 12547 | if (status != QDF_STATUS_SUCCESS) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 12548 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12549 | "%s: failed to allocate memory, status = %d", |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12550 | __func__, status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12551 | goto error; |
| 12552 | } |
| 12553 | if (wlan_cfg_get_str(pMac, cfgId, (uint8_t *)pCountryInfo, |
| 12554 | &cfgLength) != eSIR_SUCCESS) { |
| 12555 | goto error; |
| 12556 | } |
| 12557 | /* Identify the channel and maxtxpower */ |
| 12558 | while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) { |
| 12559 | firstChannel = pCountryInfo[count++]; |
| 12560 | maxChannels = pCountryInfo[count++]; |
| 12561 | maxTxPwr = pCountryInfo[count++]; |
| 12562 | |
| 12563 | if ((channel >= firstChannel) && |
| 12564 | (channel < (firstChannel + maxChannels))) { |
| 12565 | break; |
| 12566 | } |
| 12567 | } |
| 12568 | |
| 12569 | error: |
| 12570 | if (NULL != pCountryInfo) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12571 | qdf_mem_free(pCountryInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12572 | |
| 12573 | return maxTxPwr; |
| 12574 | } |
| 12575 | |
| 12576 | bool csr_roam_is_channel_valid(tpAniSirGlobal pMac, uint8_t channel) |
| 12577 | { |
| 12578 | bool fValid = false; |
| 12579 | uint32_t idxValidChannels; |
| 12580 | uint32_t len = sizeof(pMac->roam.validChannelList); |
| 12581 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12582 | if (QDF_IS_STATUS_SUCCESS(csr_get_cfg_valid_channels(pMac, |
| 12583 | pMac->roam.validChannelList, &len))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12584 | for (idxValidChannels = 0; (idxValidChannels < len); |
| 12585 | idxValidChannels++) { |
| 12586 | if (channel == |
| 12587 | pMac->roam.validChannelList[idxValidChannels]) { |
| 12588 | fValid = true; |
| 12589 | break; |
| 12590 | } |
| 12591 | } |
| 12592 | } |
| 12593 | pMac->roam.numValidChannels = len; |
| 12594 | return fValid; |
| 12595 | } |
| 12596 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12597 | /* This function check and validate whether the NIC can do CB (40MHz) */ |
| 12598 | static ePhyChanBondState csr_get_cb_mode_from_ies(tpAniSirGlobal pMac, |
| 12599 | uint8_t primaryChn, |
| 12600 | tDot11fBeaconIEs *pIes) |
| 12601 | { |
| 12602 | ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 12603 | uint8_t centerChn; |
| 12604 | uint32_t ChannelBondingMode; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12605 | if (WLAN_REG_IS_24GHZ_CH(primaryChn)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12606 | ChannelBondingMode = |
| 12607 | pMac->roam.configParam.channelBondingMode24GHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12608 | } else { |
| 12609 | ChannelBondingMode = |
| 12610 | pMac->roam.configParam.channelBondingMode5GHz; |
| 12611 | } |
| 12612 | |
| 12613 | if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE == ChannelBondingMode) |
| 12614 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 12615 | |
| 12616 | /* Figure what the other side's CB mode */ |
| 12617 | if (!(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == |
| 12618 | pIes->HTCaps.supportedChannelWidthSet))) { |
| 12619 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 12620 | } |
| 12621 | |
Konamki, Sreelakshmi | ec14e6a | 2015-07-15 12:43:29 +0530 | [diff] [blame] | 12622 | /* In Case WPA2 and TKIP is the only one cipher suite in Pairwise */ |
| 12623 | if ((pIes->RSN.present && (pIes->RSN.pwise_cipher_suite_count == 1) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12624 | !memcmp(&(pIes->RSN.pwise_cipher_suites[0][0]), |
Konamki, Sreelakshmi | ec14e6a | 2015-07-15 12:43:29 +0530 | [diff] [blame] | 12625 | "\x00\x0f\xac\x02", 4)) |
Abhishek Singh | 1e39fc2 | 2015-12-18 11:23:44 +0530 | [diff] [blame] | 12626 | /* In Case only WPA1 is supported and TKIP is |
| 12627 | * the only one cipher suite in Unicast. |
Konamki, Sreelakshmi | ec14e6a | 2015-07-15 12:43:29 +0530 | [diff] [blame] | 12628 | */ |
Abhishek Singh | 1e39fc2 | 2015-12-18 11:23:44 +0530 | [diff] [blame] | 12629 | || (!pIes->RSN.present && (pIes->WPA.present && |
| 12630 | (pIes->WPA.unicast_cipher_count == 1) && |
| 12631 | !memcmp(&(pIes->WPA.unicast_ciphers[0][0]), |
| 12632 | "\x00\x50\xf2\x02", 4)))) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12633 | sme_debug("No channel bonding in TKIP mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12634 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 12635 | } |
| 12636 | |
| 12637 | if (!pIes->HTInfo.present) |
| 12638 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 12639 | |
| 12640 | /* |
| 12641 | * This is called during INFRA STA/CLIENT and should use the merged |
| 12642 | * value of supported channel width and recommended tx width as per |
| 12643 | * standard |
| 12644 | */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12645 | sme_debug("scws %u rtws %u sco %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12646 | pIes->HTCaps.supportedChannelWidthSet, |
| 12647 | pIes->HTInfo.recommendedTxWidthSet, |
| 12648 | pIes->HTInfo.secondaryChannelOffset); |
| 12649 | |
| 12650 | if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ) |
| 12651 | eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset; |
| 12652 | else |
| 12653 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 12654 | |
| 12655 | switch (eRet) { |
| 12656 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 12657 | centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET; |
| 12658 | break; |
| 12659 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 12660 | centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET; |
| 12661 | break; |
| 12662 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 12663 | default: |
| 12664 | centerChn = primaryChn; |
| 12665 | break; |
| 12666 | } |
| 12667 | |
Amar Singhal | 7ccdc4f | 2015-10-30 15:10:05 -0700 | [diff] [blame] | 12668 | if ((PHY_SINGLE_CHANNEL_CENTERED != eRet) && |
| 12669 | (QDF_STATUS_SUCCESS != sme_check_ch_in_band(pMac, |
| 12670 | centerChn - 2, 2))) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12671 | sme_err("Invalid center channel (%d), disable 40MHz mode", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12672 | centerChn); |
| 12673 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 12674 | } |
| 12675 | return eRet; |
| 12676 | } |
| 12677 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 12678 | static bool csr_is_encryption_in_list(tpAniSirGlobal pMac, |
| 12679 | tCsrEncryptionList *pCipherList, |
| 12680 | eCsrEncryptionType encryptionType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12681 | { |
| 12682 | bool fFound = false; |
| 12683 | uint32_t idx; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12684 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12685 | for (idx = 0; idx < pCipherList->numEntries; idx++) { |
| 12686 | if (pCipherList->encryptionType[idx] == encryptionType) { |
| 12687 | fFound = true; |
| 12688 | break; |
| 12689 | } |
| 12690 | } |
| 12691 | return fFound; |
| 12692 | } |
| 12693 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 12694 | static bool csr_is_auth_in_list(tpAniSirGlobal pMac, tCsrAuthList *pAuthList, |
| 12695 | eCsrAuthType authType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12696 | { |
| 12697 | bool fFound = false; |
| 12698 | uint32_t idx; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12699 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12700 | for (idx = 0; idx < pAuthList->numEntries; idx++) { |
| 12701 | if (pAuthList->authType[idx] == authType) { |
| 12702 | fFound = true; |
| 12703 | break; |
| 12704 | } |
| 12705 | } |
| 12706 | return fFound; |
| 12707 | } |
| 12708 | |
| 12709 | bool csr_is_same_profile(tpAniSirGlobal pMac, |
| 12710 | tCsrRoamConnectedProfile *pProfile1, |
| 12711 | tCsrRoamProfile *pProfile2) |
| 12712 | { |
| 12713 | uint32_t i; |
| 12714 | bool fCheck = false; |
| 12715 | tCsrScanResultFilter *pScanFilter = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12716 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12717 | |
| 12718 | if (!(pProfile1 && pProfile2)) |
| 12719 | return fCheck; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12720 | pScanFilter = qdf_mem_malloc(sizeof(tCsrScanResultFilter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12721 | if (NULL == pScanFilter) |
| 12722 | return fCheck; |
| 12723 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12724 | status = csr_roam_prepare_filter_from_profile(pMac, pProfile2, |
| 12725 | pScanFilter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12726 | if (!(QDF_IS_STATUS_SUCCESS(status))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12727 | goto free_scan_filter; |
| 12728 | |
| 12729 | for (i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++) { |
| 12730 | fCheck = csr_is_ssid_match(pMac, |
| 12731 | pScanFilter->SSIDs.SSIDList[i].SSID.ssId, |
| 12732 | pScanFilter->SSIDs.SSIDList[i].SSID.length, |
| 12733 | pProfile1->SSID.ssId, |
| 12734 | pProfile1->SSID.length, |
| 12735 | false); |
| 12736 | if (fCheck) |
| 12737 | break; |
| 12738 | } |
| 12739 | if (!fCheck) |
| 12740 | goto free_scan_filter; |
| 12741 | |
| 12742 | if (!csr_is_auth_in_list(pMac, &pProfile2->AuthType, |
| 12743 | pProfile1->AuthType) |
| 12744 | || (pProfile2->BSSType != pProfile1->BSSType) |
| 12745 | || !csr_is_encryption_in_list(pMac, &pProfile2->EncryptionType, |
| 12746 | pProfile1->EncryptionType)) { |
| 12747 | fCheck = false; |
| 12748 | goto free_scan_filter; |
| 12749 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12750 | if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent) { |
| 12751 | if (pProfile1->MDID.mobilityDomain |
| 12752 | != pProfile2->MDID.mobilityDomain) { |
| 12753 | fCheck = false; |
| 12754 | goto free_scan_filter; |
| 12755 | } |
| 12756 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12757 | /* Match found */ |
| 12758 | fCheck = true; |
| 12759 | free_scan_filter: |
| 12760 | csr_free_scan_filter(pMac, pScanFilter); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12761 | qdf_mem_free(pScanFilter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12762 | return fCheck; |
| 12763 | } |
| 12764 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12765 | static bool csr_roam_is_same_profile_keys(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12766 | tCsrRoamConnectedProfile *pConnProfile, |
| 12767 | tCsrRoamProfile *pProfile2) |
| 12768 | { |
| 12769 | bool fCheck = false; |
| 12770 | int i; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12771 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12772 | do { |
| 12773 | /* Only check for static WEP */ |
| 12774 | if (!csr_is_encryption_in_list |
| 12775 | (pMac, &pProfile2->EncryptionType, |
| 12776 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) |
| 12777 | && !csr_is_encryption_in_list(pMac, |
| 12778 | &pProfile2->EncryptionType, |
| 12779 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 12780 | fCheck = true; |
| 12781 | break; |
| 12782 | } |
| 12783 | if (!csr_is_encryption_in_list |
| 12784 | (pMac, &pProfile2->EncryptionType, |
| 12785 | pConnProfile->EncryptionType)) |
| 12786 | break; |
| 12787 | if (pConnProfile->Keys.defaultIndex != |
| 12788 | pProfile2->Keys.defaultIndex) |
| 12789 | break; |
| 12790 | for (i = 0; i < CSR_MAX_NUM_KEY; i++) { |
| 12791 | if (pConnProfile->Keys.KeyLength[i] != |
| 12792 | pProfile2->Keys.KeyLength[i]) |
| 12793 | break; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12794 | if (qdf_mem_cmp(&pConnProfile->Keys.KeyMaterial[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12795 | &pProfile2->Keys.KeyMaterial[i], |
| 12796 | pProfile2->Keys.KeyLength[i])) { |
| 12797 | break; |
| 12798 | } |
| 12799 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12800 | if (i == CSR_MAX_NUM_KEY) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12801 | fCheck = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12802 | } while (0); |
| 12803 | return fCheck; |
| 12804 | } |
| 12805 | |
| 12806 | /* IBSS */ |
| 12807 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 12808 | static uint8_t csr_roam_get_ibss_start_channel_number50(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12809 | { |
| 12810 | uint8_t channel = 0; |
| 12811 | uint32_t idx; |
| 12812 | uint32_t idxValidChannels; |
| 12813 | bool fFound = false; |
| 12814 | uint32_t len = sizeof(pMac->roam.validChannelList); |
| 12815 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12816 | if (eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam. |
| 12817 | AdHocChannel5G) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12818 | channel = pMac->roam.configParam.AdHocChannel5G; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12819 | if (!csr_roam_is_channel_valid(pMac, channel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12820 | channel = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12821 | } |
| 12822 | if (0 == channel |
| 12823 | && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 12824 | QDF_IS_STATUS_SUCCESS(csr_get_cfg_valid_channels |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12825 | (pMac, (uint8_t *) pMac->roam. |
| 12826 | validChannelList, &len))) { |
Sandeep Puligilla | 80038de | 2017-05-10 10:43:29 -0700 | [diff] [blame] | 12827 | for (idx = 0; (idx < CSR_NUM_IBSS_START_CHAN_50) && !fFound; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12828 | idx++) { |
| 12829 | for (idxValidChannels = 0; |
| 12830 | (idxValidChannels < len) && !fFound; |
| 12831 | idxValidChannels++) { |
| 12832 | if (csr_start_ibss_channels50[idx] == |
| 12833 | pMac->roam. |
| 12834 | validChannelList[idxValidChannels]) { |
| 12835 | fFound = true; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12836 | channel = |
| 12837 | csr_start_ibss_channels50[idx]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12838 | } |
| 12839 | } |
| 12840 | } |
| 12841 | /* |
| 12842 | * this is rare, but if it does happen, |
| 12843 | * we find anyone in 11a bandwidth and |
| 12844 | * return the first 11a channel found! |
| 12845 | */ |
| 12846 | if (!fFound) { |
| 12847 | for (idxValidChannels = 0; idxValidChannels < len; |
| 12848 | idxValidChannels++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 12849 | if (WLAN_REG_IS_5GHZ_CH(pMac->roam. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12850 | validChannelList[idxValidChannels])) { |
| 12851 | /* the max channel# in 11g is 14 */ |
| 12852 | if (idxValidChannels < |
Sandeep Puligilla | 80038de | 2017-05-10 10:43:29 -0700 | [diff] [blame] | 12853 | CSR_NUM_IBSS_START_CHAN_50) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12854 | channel = |
| 12855 | pMac->roam.validChannelList |
| 12856 | [idxValidChannels]; |
| 12857 | } |
| 12858 | break; |
| 12859 | } |
| 12860 | } |
| 12861 | } |
| 12862 | } /* if */ |
| 12863 | |
| 12864 | return channel; |
| 12865 | } |
| 12866 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 12867 | static uint8_t csr_roam_get_ibss_start_channel_number24(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12868 | { |
| 12869 | uint8_t channel = 1; |
| 12870 | uint32_t idx; |
| 12871 | uint32_t idxValidChannels; |
| 12872 | bool fFound = false; |
| 12873 | uint32_t len = sizeof(pMac->roam.validChannelList); |
| 12874 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12875 | if (eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam. |
| 12876 | AdHocChannel24) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12877 | channel = pMac->roam.configParam.AdHocChannel24; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12878 | if (!csr_roam_is_channel_valid(pMac, channel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12879 | channel = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12880 | } |
| 12881 | |
| 12882 | if (0 == channel |
| 12883 | && |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12884 | QDF_IS_STATUS_SUCCESS(csr_get_cfg_valid_channels(pMac, |
| 12885 | (uint8_t *) pMac->roam.validChannelList, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12886 | &len))) { |
| 12887 | for (idx = 0; (idx < CSR_NUM_IBSS_START_CHANNELS_24) && !fFound; |
| 12888 | idx++) { |
| 12889 | for (idxValidChannels = 0; |
| 12890 | (idxValidChannels < len) && !fFound; |
| 12891 | idxValidChannels++) { |
| 12892 | if (csr_start_ibss_channels24[idx] == |
| 12893 | pMac->roam. |
| 12894 | validChannelList[idxValidChannels]) { |
| 12895 | fFound = true; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 12896 | channel = |
| 12897 | csr_start_ibss_channels24[idx]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12898 | } |
| 12899 | } |
| 12900 | } |
| 12901 | } |
| 12902 | |
| 12903 | return channel; |
| 12904 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12905 | /** |
| 12906 | * csr_populate_basic_rates() - populates OFDM or CCK rates |
| 12907 | * @rates: rate struct to populate |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 12908 | * @is_ofdm_rates: true: ofdm rates, false: cck rates |
| 12909 | * @is_basic_rates: indicates if rates are to be masked with |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12910 | * CSR_DOT11_BASIC_RATE_MASK |
| 12911 | * |
| 12912 | * This function will populate OFDM or CCK rates |
| 12913 | * |
| 12914 | * Return: void |
| 12915 | */ |
| 12916 | static void |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 12917 | csr_populate_basic_rates(tSirMacRateSet *rate_set, bool is_ofdm_rates, |
| 12918 | bool is_basic_rates) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12919 | { |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 12920 | int i = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12921 | uint8_t ofdm_rates[8] = { |
| 12922 | SIR_MAC_RATE_6, |
| 12923 | SIR_MAC_RATE_9, |
| 12924 | SIR_MAC_RATE_12, |
| 12925 | SIR_MAC_RATE_18, |
| 12926 | SIR_MAC_RATE_24, |
| 12927 | SIR_MAC_RATE_36, |
| 12928 | SIR_MAC_RATE_48, |
| 12929 | SIR_MAC_RATE_54 |
| 12930 | }; |
| 12931 | uint8_t cck_rates[4] = { |
| 12932 | SIR_MAC_RATE_1, |
| 12933 | SIR_MAC_RATE_2, |
| 12934 | SIR_MAC_RATE_5_5, |
| 12935 | SIR_MAC_RATE_11 |
| 12936 | }; |
| 12937 | |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 12938 | if (is_ofdm_rates == true) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12939 | rate_set->numRates = 8; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12940 | qdf_mem_copy(rate_set->rate, ofdm_rates, sizeof(ofdm_rates)); |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 12941 | if (is_basic_rates) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12942 | rate_set->rate[0] |= CSR_DOT11_BASIC_RATE_MASK; |
| 12943 | rate_set->rate[2] |= CSR_DOT11_BASIC_RATE_MASK; |
| 12944 | rate_set->rate[4] |= CSR_DOT11_BASIC_RATE_MASK; |
| 12945 | } |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 12946 | for (i = 0; i < rate_set->numRates; i++) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12947 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 12948 | ("Default OFDM rate is %2x"), rate_set->rate[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12949 | } else { |
| 12950 | rate_set->numRates = 4; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 12951 | qdf_mem_copy(rate_set->rate, cck_rates, sizeof(cck_rates)); |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 12952 | if (is_basic_rates) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12953 | rate_set->rate[0] |= CSR_DOT11_BASIC_RATE_MASK; |
| 12954 | rate_set->rate[1] |= CSR_DOT11_BASIC_RATE_MASK; |
| 12955 | rate_set->rate[2] |= CSR_DOT11_BASIC_RATE_MASK; |
| 12956 | rate_set->rate[3] |= CSR_DOT11_BASIC_RATE_MASK; |
| 12957 | } |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 12958 | for (i = 0; i < rate_set->numRates; i++) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 12959 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 12960 | ("Default CCK rate is %2x"), rate_set->rate[i]); |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 12961 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 12962 | } |
| 12963 | } |
| 12964 | |
| 12965 | /** |
| 12966 | * csr_convert_mode_to_nw_type() - convert mode into network type |
| 12967 | * @dot11_mode: dot11_mode |
| 12968 | * @band: 2.4 or 5 GHz |
| 12969 | * |
| 12970 | * Return: tSirNwType |
| 12971 | */ |
| 12972 | static tSirNwType |
| 12973 | csr_convert_mode_to_nw_type(eCsrCfgDot11Mode dot11_mode, eCsrBand band) |
| 12974 | { |
| 12975 | switch (dot11_mode) { |
| 12976 | case eCSR_CFG_DOT11_MODE_11G: |
| 12977 | return eSIR_11G_NW_TYPE; |
| 12978 | case eCSR_CFG_DOT11_MODE_11B: |
| 12979 | return eSIR_11B_NW_TYPE; |
| 12980 | case eCSR_CFG_DOT11_MODE_11A: |
| 12981 | return eSIR_11A_NW_TYPE; |
| 12982 | case eCSR_CFG_DOT11_MODE_11N: |
| 12983 | default: |
| 12984 | /* |
| 12985 | * Because LIM only verifies it against 11a, 11b or 11g, set |
| 12986 | * only 11g or 11a here |
| 12987 | */ |
| 12988 | if (eCSR_BAND_24 == band) |
| 12989 | return eSIR_11G_NW_TYPE; |
| 12990 | else |
| 12991 | return eSIR_11A_NW_TYPE; |
| 12992 | } |
| 12993 | return eSIR_DONOT_USE_NW_TYPE; |
| 12994 | } |
| 12995 | |
| 12996 | /** |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 12997 | * csr_merge_supported_and_extended_rates() - merge supported rates and |
| 12998 | * extended rates |
| 12999 | * @rates: merged rates |
| 13000 | * @supported_rates: supported rates |
| 13001 | * @extended_rates: extended rates |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 13002 | * |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13003 | * Return: None |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 13004 | */ |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13005 | static void csr_merge_supported_and_extended_rates( |
| 13006 | struct merged_mac_rate_set *rates, |
| 13007 | tSirMacRateSet *supported_rates, |
| 13008 | tSirMacRateSet *extended_rates) |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 13009 | { |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13010 | int i; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13011 | |
Ravi Joshi | b398c85 | 2017-07-18 17:55:21 -0700 | [diff] [blame] | 13012 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 13013 | FL("supported_rates: %d extended_rates: %d"), |
| 13014 | supported_rates->numRates, extended_rates->numRates); |
| 13015 | |
| 13016 | if (supported_rates->numRates > SIR_MAC_RATESET_EID_MAX) |
| 13017 | supported_rates->numRates = SIR_MAC_RATESET_EID_MAX; |
| 13018 | |
| 13019 | if (extended_rates->numRates > SIR_MAC_RATESET_EID_MAX) |
| 13020 | extended_rates->numRates = SIR_MAC_RATESET_EID_MAX; |
| 13021 | |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13022 | qdf_mem_copy(rates->rate, |
| 13023 | supported_rates->rate, |
| 13024 | supported_rates->numRates); |
| 13025 | rates->num_rates = supported_rates->numRates; |
| 13026 | |
| 13027 | qdf_mem_copy(rates->rate + rates->num_rates, |
| 13028 | extended_rates->rate, |
| 13029 | extended_rates->numRates); |
| 13030 | rates->num_rates += extended_rates->numRates; |
| 13031 | |
| 13032 | for (i = 0; i < rates->num_rates; i++) |
| 13033 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 13034 | FL("Merge rate is %2x"), rates->rate[i]); |
| 13035 | } |
| 13036 | |
| 13037 | /** |
| 13038 | * csr_populate_intersection_driver_and_hostpd_rates() - populate |
| 13039 | * intersection of driver rates and hostapd rates |
| 13040 | * @pParam: csr roam start bss params |
| 13041 | * @driver_rates: rates generated by driver |
| 13042 | * @hostapd_rates: rates generated by hostapd |
| 13043 | * |
| 13044 | * Return: None |
| 13045 | */ |
| 13046 | static void csr_populate_intersection_driver_and_hostpd_rates( |
| 13047 | struct tagCsrRoamStartBssParams *param, |
| 13048 | struct merged_mac_rate_set *driver_rates, |
| 13049 | struct merged_mac_rate_set *hostapd_rates) |
| 13050 | { |
| 13051 | int i, j; |
| 13052 | struct merged_mac_rate_set rates; |
| 13053 | uint8_t driver_rate, hostapd_rate; |
| 13054 | tSirMacRateSet *opr_rates = ¶m->operationalRateSet; |
| 13055 | tSirMacRateSet *ext_rates = ¶m->extendedRateSet; |
| 13056 | |
| 13057 | rates.num_rates = 0; |
| 13058 | |
| 13059 | for (i = 0; i < driver_rates->num_rates; i++) { |
| 13060 | driver_rate = driver_rates->rate[i]; |
| 13061 | if (CSR_IS_BASIC_RATE(driver_rate)) |
| 13062 | BITS_OFF(driver_rate, |
| 13063 | CSR_DOT11_BASIC_RATE_MASK); |
| 13064 | |
| 13065 | for (j = 0; j < hostapd_rates->num_rates; j++) { |
| 13066 | hostapd_rate = hostapd_rates->rate[j]; |
| 13067 | if (CSR_IS_BASIC_RATE(hostapd_rate)) |
| 13068 | BITS_OFF(hostapd_rate, |
| 13069 | CSR_DOT11_BASIC_RATE_MASK); |
| 13070 | |
| 13071 | if (driver_rate == hostapd_rate) { |
| 13072 | if (CSR_IS_BASIC_RATE(driver_rates->rate[i]) || |
| 13073 | CSR_IS_BASIC_RATE(hostapd_rates->rate[j])) |
| 13074 | BITS_ON(driver_rate, |
| 13075 | CSR_DOT11_BASIC_RATE_MASK); |
| 13076 | |
| 13077 | rates.rate[rates.num_rates++] = driver_rate; |
| 13078 | break; |
| 13079 | } |
| 13080 | } |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 13081 | } |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13082 | |
| 13083 | for (i = 0; i < rates.num_rates; i++) |
| 13084 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 13085 | FL("Intersection rate is %2x"), rates.rate[i]); |
| 13086 | |
| 13087 | opr_rates->numRates = 0; |
| 13088 | ext_rates->numRates = 0; |
| 13089 | if (rates.num_rates <= MAX_NUM_SUPPORTED_RATES) { |
| 13090 | opr_rates->numRates = rates.num_rates; |
| 13091 | qdf_mem_copy(opr_rates->rate, |
| 13092 | rates.rate, |
| 13093 | opr_rates->numRates); |
| 13094 | } else { |
| 13095 | opr_rates->numRates = MAX_NUM_SUPPORTED_RATES; |
| 13096 | qdf_mem_copy(opr_rates->rate, |
| 13097 | rates.rate, |
| 13098 | MAX_NUM_SUPPORTED_RATES); |
| 13099 | ext_rates->numRates = rates.num_rates - MAX_NUM_SUPPORTED_RATES; |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 13100 | qdf_mem_copy(ext_rates->rate, |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13101 | rates.rate + MAX_NUM_SUPPORTED_RATES, |
| 13102 | ext_rates->numRates); |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 13103 | } |
| 13104 | } |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13105 | |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 13106 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13107 | * csr_roam_get_bss_start_parms() - get bss start param from profile |
| 13108 | * @pMac: mac global context |
| 13109 | * @pProfile: roam profile |
| 13110 | * @pParam: out param, start bss params |
Krunal Soni | 8f8507c | 2016-12-20 13:54:34 -0800 | [diff] [blame] | 13111 | * @skip_hostapd_rate: to skip given hostapd's rate |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13112 | * |
| 13113 | * This function populates start bss param from roam profile |
| 13114 | * |
| 13115 | * Return: void |
| 13116 | */ |
| 13117 | static void |
| 13118 | csr_roam_get_bss_start_parms(tpAniSirGlobal pMac, |
| 13119 | tCsrRoamProfile *pProfile, |
Krunal Soni | 8f8507c | 2016-12-20 13:54:34 -0800 | [diff] [blame] | 13120 | tCsrRoamStartBssParams *pParam, |
| 13121 | bool skip_hostapd_rate) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13122 | { |
| 13123 | eCsrBand band; |
| 13124 | uint8_t opr_ch = 0; |
| 13125 | tSirNwType nw_type; |
| 13126 | uint8_t tmp_opr_ch = 0; |
| 13127 | tSirMacRateSet *opr_rates = &pParam->operationalRateSet; |
| 13128 | tSirMacRateSet *ext_rates = &pParam->extendedRateSet; |
| 13129 | |
| 13130 | if (pProfile->ChannelInfo.numOfChannels |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13131 | && pProfile->ChannelInfo.ChannelList) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13132 | tmp_opr_ch = pProfile->ChannelInfo.ChannelList[0]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13133 | |
| 13134 | pParam->uCfgDot11Mode = csr_roam_get_phy_mode_band_for_bss(pMac, |
| 13135 | pProfile, tmp_opr_ch, &band); |
| 13136 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13137 | if (((pProfile->csrPersona == QDF_P2P_CLIENT_MODE) |
| 13138 | || (pProfile->csrPersona == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13139 | && (pParam->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11B)) { |
| 13140 | /* This should never happen */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13141 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13142 | "For P2P (persona %d) dot11_mode is 11B", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13143 | pProfile->csrPersona); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13144 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13145 | } |
| 13146 | |
| 13147 | nw_type = csr_convert_mode_to_nw_type(pParam->uCfgDot11Mode, band); |
| 13148 | ext_rates->numRates = 0; |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13149 | |
| 13150 | switch (nw_type) { |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 13151 | default: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13152 | sme_err( |
| 13153 | "sees an unknown pSirNwType (%d)", |
| 13154 | nw_type); |
Agrawal Ashish | 06e76d2 | 2016-08-18 16:44:48 +0530 | [diff] [blame] | 13155 | case eSIR_11A_NW_TYPE: |
| 13156 | csr_populate_basic_rates(opr_rates, true, true); |
| 13157 | if (eCSR_OPERATING_CHANNEL_ANY != tmp_opr_ch) { |
| 13158 | opr_ch = tmp_opr_ch; |
| 13159 | break; |
| 13160 | } |
| 13161 | opr_ch = csr_roam_get_ibss_start_channel_number50(pMac); |
| 13162 | if (0 == opr_ch && |
| 13163 | CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && |
| 13164 | CSR_IS_PHY_MODE_DUAL_BAND( |
| 13165 | pMac->roam.configParam.phyMode)) { |
| 13166 | /* |
| 13167 | * We could not find a 5G channel by auto pick, |
| 13168 | * let's try 2.4G channels. We only do this here |
| 13169 | * because csr_roam_get_phy_mode_band_for_bss |
| 13170 | * always picks 11a for AUTO |
| 13171 | */ |
| 13172 | nw_type = eSIR_11B_NW_TYPE; |
| 13173 | opr_ch = |
| 13174 | csr_roam_get_ibss_start_channel_number24(pMac); |
| 13175 | csr_populate_basic_rates(opr_rates, false, |
| 13176 | true); |
| 13177 | } |
| 13178 | break; |
| 13179 | case eSIR_11B_NW_TYPE: |
| 13180 | csr_populate_basic_rates(opr_rates, false, true); |
| 13181 | if (eCSR_OPERATING_CHANNEL_ANY == tmp_opr_ch) |
| 13182 | opr_ch = |
| 13183 | csr_roam_get_ibss_start_channel_number24(pMac); |
| 13184 | else |
| 13185 | opr_ch = tmp_opr_ch; |
| 13186 | break; |
| 13187 | case eSIR_11G_NW_TYPE: |
| 13188 | /* For P2P Client and P2P GO, disable 11b rates */ |
| 13189 | if ((pProfile->csrPersona == QDF_P2P_CLIENT_MODE) || |
| 13190 | (pProfile->csrPersona == QDF_P2P_GO_MODE) || |
| 13191 | (eCSR_CFG_DOT11_MODE_11G_ONLY == |
| 13192 | pParam->uCfgDot11Mode)) { |
| 13193 | csr_populate_basic_rates(opr_rates, true, true); |
| 13194 | } else { |
| 13195 | csr_populate_basic_rates(opr_rates, false, |
| 13196 | true); |
| 13197 | csr_populate_basic_rates(ext_rates, true, |
| 13198 | false); |
| 13199 | } |
| 13200 | if (eCSR_OPERATING_CHANNEL_ANY == tmp_opr_ch) |
| 13201 | opr_ch = |
| 13202 | csr_roam_get_ibss_start_channel_number24(pMac); |
| 13203 | else |
| 13204 | opr_ch = tmp_opr_ch; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13205 | break; |
| 13206 | } |
Ravi Joshi | b398c85 | 2017-07-18 17:55:21 -0700 | [diff] [blame] | 13207 | |
| 13208 | pParam->operationChn = opr_ch; |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13209 | |
| 13210 | if (pProfile->supported_rates.numRates || |
| 13211 | pProfile->extended_rates.numRates) { |
| 13212 | struct merged_mac_rate_set rates_driver, rates_hostapd; |
| 13213 | |
Ravi Joshi | b398c85 | 2017-07-18 17:55:21 -0700 | [diff] [blame] | 13214 | qdf_mem_zero(&rates_driver, |
| 13215 | sizeof(struct merged_mac_rate_set)); |
| 13216 | qdf_mem_zero(&rates_hostapd, |
| 13217 | sizeof(struct merged_mac_rate_set)); |
| 13218 | |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13219 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 13220 | "Merge rates driver"); |
| 13221 | csr_merge_supported_and_extended_rates(&rates_driver, |
| 13222 | opr_rates, |
| 13223 | ext_rates); |
| 13224 | |
| 13225 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 13226 | "Merge rates hostapd"); |
| 13227 | csr_merge_supported_and_extended_rates(&rates_hostapd, |
| 13228 | &pProfile->supported_rates, |
| 13229 | &pProfile->extended_rates); |
| 13230 | |
| 13231 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 13232 | "Populate rates intersection"); |
| 13233 | csr_populate_intersection_driver_and_hostpd_rates(pParam, |
| 13234 | &rates_driver, |
| 13235 | &rates_hostapd); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13236 | } |
lifeng | e9245fc | 2017-02-22 17:23:19 +0800 | [diff] [blame] | 13237 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13238 | pParam->sirNwType = nw_type; |
| 13239 | pParam->ch_params.ch_width = pProfile->ch_params.ch_width; |
| 13240 | pParam->ch_params.center_freq_seg0 = |
| 13241 | pProfile->ch_params.center_freq_seg0; |
| 13242 | pParam->ch_params.center_freq_seg1 = |
| 13243 | pProfile->ch_params.center_freq_seg1; |
| 13244 | pParam->ch_params.sec_ch_offset = |
| 13245 | pProfile->ch_params.sec_ch_offset; |
| 13246 | } |
| 13247 | |
| 13248 | static void |
| 13249 | csr_roam_get_bss_start_parms_from_bss_desc(tpAniSirGlobal pMac, |
| 13250 | tSirBssDescription *pBssDesc, |
| 13251 | tDot11fBeaconIEs *pIes, |
| 13252 | tCsrRoamStartBssParams *pParam) |
| 13253 | { |
| 13254 | if (!pParam) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13255 | sme_err("BSS param's pointer is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13256 | return; |
| 13257 | } |
| 13258 | |
| 13259 | pParam->sirNwType = pBssDesc->nwType; |
| 13260 | pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
| 13261 | pParam->operationChn = pBssDesc->channelId; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13262 | qdf_mem_copy(&pParam->bssid, pBssDesc->bssId, |
| 13263 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13264 | |
| 13265 | if (!pIes) { |
| 13266 | pParam->ssId.length = 0; |
| 13267 | pParam->operationalRateSet.numRates = 0; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13268 | sme_err("IEs struct pointer is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13269 | return; |
| 13270 | } |
| 13271 | |
| 13272 | if (pIes->SuppRates.present) { |
| 13273 | pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates; |
| 13274 | if (pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13275 | sme_err( |
| 13276 | "num_rates: %d > max val, resetting", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13277 | pIes->SuppRates.num_rates); |
| 13278 | pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 13279 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13280 | qdf_mem_copy(pParam->operationalRateSet.rate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13281 | pIes->SuppRates.rates, |
| 13282 | sizeof(*pIes->SuppRates.rates) * |
| 13283 | pIes->SuppRates.num_rates); |
| 13284 | } |
| 13285 | if (pIes->ExtSuppRates.present) { |
| 13286 | pParam->extendedRateSet.numRates = pIes->ExtSuppRates.num_rates; |
| 13287 | if (pIes->ExtSuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13288 | sme_err( |
| 13289 | "num_rates: %d > max val, resetting", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13290 | pIes->ExtSuppRates.num_rates); |
| 13291 | pIes->ExtSuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 13292 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13293 | qdf_mem_copy(pParam->extendedRateSet.rate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13294 | pIes->ExtSuppRates.rates, |
| 13295 | sizeof(*pIes->ExtSuppRates.rates) * |
| 13296 | pIes->ExtSuppRates.num_rates); |
| 13297 | } |
| 13298 | if (pIes->SSID.present) { |
| 13299 | pParam->ssId.length = pIes->SSID.num_ssid; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13300 | qdf_mem_copy(pParam->ssId.ssId, pIes->SSID.ssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13301 | pParam->ssId.length); |
| 13302 | } |
| 13303 | pParam->cbMode = csr_get_cb_mode_from_ies(pMac, pParam->operationChn, |
| 13304 | pIes); |
| 13305 | } |
| 13306 | |
| 13307 | static void csr_roam_determine_max_rate_for_ad_hoc(tpAniSirGlobal pMac, |
| 13308 | tSirMacRateSet *pSirRateSet) |
| 13309 | { |
| 13310 | uint8_t MaxRate = 0; |
| 13311 | uint32_t i; |
| 13312 | uint8_t *pRate; |
| 13313 | |
| 13314 | pRate = pSirRateSet->rate; |
| 13315 | for (i = 0; i < pSirRateSet->numRates; i++) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13316 | MaxRate = CSR_MAX(MaxRate, (pRate[i] & |
| 13317 | (~CSR_DOT11_BASIC_RATE_MASK))); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13318 | } |
| 13319 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13320 | /* Save the max rate in the connected state information. |
| 13321 | * modify LastRates variable as well |
| 13322 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13323 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13324 | } |
| 13325 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13326 | QDF_STATUS csr_roam_issue_start_bss(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13327 | tCsrRoamStartBssParams *pParam, |
| 13328 | tCsrRoamProfile *pProfile, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13329 | tSirBssDescription *pBssDesc, |
| 13330 | uint32_t roamId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13331 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13332 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13333 | eCsrBand eBand; |
| 13334 | /* Set the roaming substate to 'Start BSS attempt'... */ |
| 13335 | csr_roam_substate_change(pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, |
| 13336 | sessionId); |
| 13337 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 13338 | /* Need to figure out whether we need to log WDS??? */ |
| 13339 | if (CSR_IS_IBSS(pProfile)) { |
| 13340 | host_log_ibss_pkt_type *pIbssLog; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13341 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13342 | WLAN_HOST_DIAG_LOG_ALLOC(pIbssLog, host_log_ibss_pkt_type, |
| 13343 | LOG_WLAN_IBSS_C); |
| 13344 | if (pIbssLog) { |
| 13345 | if (pBssDesc) { |
| 13346 | pIbssLog->eventId = |
| 13347 | WLAN_IBSS_EVENT_JOIN_IBSS_REQ; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13348 | qdf_mem_copy(pIbssLog->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13349 | pBssDesc->bssId, QDF_MAC_ADDR_SIZE); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13350 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13351 | pIbssLog->eventId = |
| 13352 | WLAN_IBSS_EVENT_START_IBSS_REQ; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13353 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13354 | qdf_mem_copy(pIbssLog->ssid, pParam->ssId.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13355 | pParam->ssId.length); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13356 | if (pProfile->ChannelInfo.numOfChannels == 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13357 | pIbssLog->channelSetting = AUTO_PICK; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13358 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13359 | pIbssLog->channelSetting = SPECIFIED; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13360 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13361 | pIbssLog->operatingChannel = pParam->operationChn; |
| 13362 | WLAN_HOST_DIAG_LOG_REPORT(pIbssLog); |
| 13363 | } |
| 13364 | } |
| 13365 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 13366 | /* Put RSN information in for Starting BSS */ |
| 13367 | pParam->nRSNIELength = (uint16_t) pProfile->nRSNReqIELength; |
| 13368 | pParam->pRSNIE = pProfile->pRSNReqIE; |
| 13369 | |
| 13370 | pParam->privacy = pProfile->privacy; |
| 13371 | pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq; |
| 13372 | pParam->authType = pProfile->csr80211AuthType; |
| 13373 | pParam->beaconInterval = pProfile->beaconInterval; |
| 13374 | pParam->dtimPeriod = pProfile->dtimPeriod; |
| 13375 | pParam->ApUapsdEnable = pProfile->ApUapsdEnable; |
| 13376 | pParam->ssidHidden = pProfile->SSIDs.SSIDList[0].ssidHidden; |
| 13377 | if (CSR_IS_INFRA_AP(pProfile) && (pParam->operationChn != 0)) { |
| 13378 | if (csr_is_valid_channel(pMac, pParam->operationChn) != |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13379 | QDF_STATUS_SUCCESS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13380 | pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13381 | } |
| 13382 | pParam->protEnabled = pProfile->protEnabled; |
| 13383 | pParam->obssProtEnabled = pProfile->obssProtEnabled; |
| 13384 | pParam->ht_protection = pProfile->cfg_protection; |
| 13385 | pParam->wps_state = pProfile->wps_state; |
| 13386 | |
| 13387 | pParam->uCfgDot11Mode = |
| 13388 | csr_roam_get_phy_mode_band_for_bss(pMac, pProfile, |
| 13389 | pParam-> |
| 13390 | operationChn, |
| 13391 | &eBand); |
| 13392 | pParam->bssPersona = pProfile->csrPersona; |
| 13393 | |
| 13394 | #ifdef WLAN_FEATURE_11W |
| 13395 | pParam->mfpCapable = (0 != pProfile->MFPCapable); |
| 13396 | pParam->mfpRequired = (0 != pProfile->MFPRequired); |
| 13397 | #endif |
| 13398 | |
| 13399 | pParam->addIeParams.probeRespDataLen = |
| 13400 | pProfile->addIeParams.probeRespDataLen; |
| 13401 | pParam->addIeParams.probeRespData_buff = |
| 13402 | pProfile->addIeParams.probeRespData_buff; |
| 13403 | |
| 13404 | pParam->addIeParams.assocRespDataLen = |
| 13405 | pProfile->addIeParams.assocRespDataLen; |
| 13406 | pParam->addIeParams.assocRespData_buff = |
| 13407 | pProfile->addIeParams.assocRespData_buff; |
| 13408 | |
| 13409 | if (CSR_IS_IBSS(pProfile)) { |
| 13410 | pParam->addIeParams.probeRespBCNDataLen = |
| 13411 | pProfile->nWPAReqIELength; |
| 13412 | pParam->addIeParams.probeRespBCNData_buff = pProfile->pWPAReqIE; |
| 13413 | } else { |
| 13414 | pParam->addIeParams.probeRespBCNDataLen = |
| 13415 | pProfile->addIeParams.probeRespBCNDataLen; |
| 13416 | pParam->addIeParams.probeRespBCNData_buff = |
| 13417 | pProfile->addIeParams.probeRespBCNData_buff; |
| 13418 | } |
| 13419 | pParam->sap_dot11mc = pProfile->sap_dot11mc; |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 13420 | pParam->cac_duration_ms = pProfile->cac_duration_ms; |
| 13421 | pParam->dfs_regdomain = pProfile->dfs_regdomain; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13422 | |
| 13423 | /* When starting an IBSS, start on the channel from the Profile. */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13424 | status = csr_send_mb_start_bss_req_msg(pMac, sessionId, |
| 13425 | pProfile->BSSType, pParam, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13426 | pBssDesc); |
| 13427 | return status; |
| 13428 | } |
| 13429 | |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 13430 | void csr_roam_prepare_bss_params(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13431 | tCsrRoamProfile *pProfile, |
| 13432 | tSirBssDescription *pBssDesc, |
| 13433 | tBssConfigParam *pBssConfig, |
| 13434 | tDot11fBeaconIEs *pIes) |
| 13435 | { |
| 13436 | uint8_t Channel; |
| 13437 | ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
| 13438 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13439 | |
| 13440 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13441 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13442 | return; |
| 13443 | } |
| 13444 | |
| 13445 | if (pBssDesc) { |
| 13446 | csr_roam_get_bss_start_parms_from_bss_desc(pMac, pBssDesc, pIes, |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 13447 | &pSession->bssParams); |
| 13448 | if (CSR_IS_NDI(pProfile)) { |
| 13449 | qdf_copy_macaddr(&pSession->bssParams.bssid, |
| 13450 | &pSession->selfMacAddr); |
| 13451 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13452 | } else { |
Krunal Soni | 8f8507c | 2016-12-20 13:54:34 -0800 | [diff] [blame] | 13453 | csr_roam_get_bss_start_parms(pMac, pProfile, |
| 13454 | &pSession->bssParams, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13455 | /* Use the first SSID */ |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 13456 | if (pProfile->SSIDs.numOfSSIDs) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13457 | qdf_mem_copy(&pSession->bssParams.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13458 | pProfile->SSIDs.SSIDList, |
| 13459 | sizeof(tSirMacSSid)); |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 13460 | if (pProfile->BSSIDs.numOfBSSIDs) |
| 13461 | /* Use the first BSSID */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13462 | qdf_mem_copy(&pSession->bssParams.bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13463 | pProfile->BSSIDs.bssid, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13464 | sizeof(struct qdf_mac_addr)); |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 13465 | else |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13466 | qdf_mem_set(&pSession->bssParams.bssid, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13467 | sizeof(struct qdf_mac_addr), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13468 | } |
| 13469 | Channel = pSession->bssParams.operationChn; |
| 13470 | /* Set operating channel in pProfile which will be used */ |
| 13471 | /* in csr_roam_set_bss_config_cfg() to determine channel bonding */ |
| 13472 | /* mode and will be configured in CFG later */ |
| 13473 | pProfile->operationChannel = Channel; |
| 13474 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13475 | if (Channel == 0) |
| 13476 | sme_err("CSR cannot find a channel to start IBSS"); |
| 13477 | else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13478 | csr_roam_determine_max_rate_for_ad_hoc(pMac, |
| 13479 | &pSession->bssParams. |
| 13480 | operationalRateSet); |
| 13481 | if (CSR_IS_INFRA_AP(pProfile) || CSR_IS_START_IBSS(pProfile)) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 13482 | if (WLAN_REG_IS_24GHZ_CH(Channel)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13483 | cbMode = |
| 13484 | pMac->roam.configParam. |
| 13485 | channelBondingMode24GHz; |
| 13486 | } else { |
| 13487 | cbMode = |
| 13488 | pMac->roam.configParam. |
| 13489 | channelBondingMode5GHz; |
| 13490 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13491 | sme_debug("## cbMode %d", cbMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13492 | pBssConfig->cbMode = cbMode; |
| 13493 | pSession->bssParams.cbMode = cbMode; |
| 13494 | } |
| 13495 | } |
| 13496 | } |
| 13497 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13498 | static QDF_STATUS csr_roam_start_ibss(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13499 | tCsrRoamProfile *pProfile, |
| 13500 | bool *pfSameIbss) |
| 13501 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13502 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13503 | bool fSameIbss = false; |
| 13504 | |
| 13505 | if (csr_is_conn_state_ibss(pMac, sessionId)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13506 | /* Check if any profile parameter has changed ? If any profile |
| 13507 | * parameter has changed then stop old BSS and start a new one |
| 13508 | * with new parameters |
| 13509 | */ |
| 13510 | if (csr_is_same_profile(pMac, |
| 13511 | &pMac->roam.roamSession[sessionId]. |
| 13512 | connectedProfile, pProfile)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13513 | fSameIbss = true; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13514 | else |
| 13515 | status = csr_roam_issue_stop_bss(pMac, sessionId, |
| 13516 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING); |
| 13517 | |
| 13518 | } else if (csr_is_conn_state_connected_infra(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13519 | /* Disassociate from the connected Infrastructure network... */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13520 | status = csr_roam_issue_disassociate(pMac, sessionId, |
| 13521 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13522 | false); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13523 | else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13524 | tBssConfigParam *pBssConfig; |
| 13525 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13526 | pBssConfig = qdf_mem_malloc(sizeof(tBssConfigParam)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13527 | if (NULL == pBssConfig) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13528 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13529 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13530 | status = QDF_STATUS_SUCCESS; |
| 13531 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13532 | /* there is no Bss description before we start an IBSS |
| 13533 | * so we need to adopt all Bss configuration parameters |
| 13534 | * from the Profile. |
| 13535 | */ |
| 13536 | status = csr_roam_prepare_bss_config_from_profile(pMac, |
| 13537 | pProfile, |
| 13538 | pBssConfig, |
| 13539 | NULL); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13540 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13541 | /* save dotMode */ |
| 13542 | pMac->roam.roamSession[sessionId].bssParams. |
| 13543 | uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 13544 | /* Prepare some more parameters for this IBSS */ |
| 13545 | csr_roam_prepare_bss_params(pMac, sessionId, |
| 13546 | pProfile, NULL, |
| 13547 | pBssConfig, NULL); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13548 | status = csr_roam_set_bss_config_cfg(pMac, |
| 13549 | sessionId, |
| 13550 | pProfile, NULL, |
| 13551 | pBssConfig, |
| 13552 | NULL, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13553 | } |
| 13554 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13555 | qdf_mem_free(pBssConfig); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13556 | } /* Allocate memory */ |
| 13557 | } |
| 13558 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13559 | if (pfSameIbss) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13560 | *pfSameIbss = fSameIbss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13561 | return status; |
| 13562 | } |
| 13563 | |
| 13564 | static void csr_roam_update_connected_profile_from_new_bss(tpAniSirGlobal pMac, |
| 13565 | uint32_t sessionId, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13566 | tSirSmeNewBssInfo *pNewBss) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13567 | { |
| 13568 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13569 | |
| 13570 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13571 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13572 | return; |
| 13573 | } |
| 13574 | |
| 13575 | if (pNewBss) { |
| 13576 | /* Set the operating channel. */ |
| 13577 | pSession->connectedProfile.operationChannel = |
| 13578 | pNewBss->channelNumber; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13579 | /* move the BSSId from the BSS description into the connected |
| 13580 | * state information. |
| 13581 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13582 | qdf_mem_copy(&pSession->connectedProfile.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13583 | &(pNewBss->bssId), sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13584 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13585 | } |
| 13586 | |
| 13587 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13588 | QDF_STATUS csr_roam_set_psk_pmk(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13589 | uint8_t *pPSK_PMK, size_t pmk_len) |
| 13590 | { |
| 13591 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13592 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13593 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13594 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13595 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13596 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13597 | qdf_mem_copy(pSession->psk_pmk, pPSK_PMK, sizeof(pSession->psk_pmk)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13598 | pSession->pmk_len = pmk_len; |
Naveen Rawat | 5f1111b | 2017-03-31 17:36:20 -0700 | [diff] [blame] | 13599 | csr_roam_offload_scan(pMac, sessionId, |
| 13600 | ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 13601 | REASON_ROAM_PSK_PMK_CHANGED); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13602 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13603 | } |
| 13604 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 13605 | |
| 13606 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 13607 | static void |
| 13608 | csr_roam_diag_set_pmkid(tCsrRoamSession *pSession) |
| 13609 | { |
| 13610 | WLAN_HOST_DIAG_EVENT_DEF(secEvent, |
| 13611 | host_event_wlan_security_payload_type); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13612 | qdf_mem_set(&secEvent, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13613 | sizeof(host_event_wlan_security_payload_type), 0); |
| 13614 | secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE; |
| 13615 | secEvent.encryptionModeMulticast = |
| 13616 | (uint8_t) diag_enc_type_from_csr_type( |
| 13617 | pSession->connectedProfile.mcEncryptionType); |
| 13618 | secEvent.encryptionModeUnicast = |
| 13619 | (uint8_t) diag_enc_type_from_csr_type( |
| 13620 | pSession->connectedProfile.EncryptionType); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13621 | qdf_mem_copy(secEvent.bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13622 | pSession->connectedProfile.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13623 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13624 | secEvent.authMode = (uint8_t) diag_auth_type_from_csr_type( |
| 13625 | pSession->connectedProfile.AuthType); |
| 13626 | WLAN_HOST_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 13627 | } |
| 13628 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 13629 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13630 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13631 | csr_roam_set_pmkid_cache(tpAniSirGlobal pMac, uint32_t sessionId, |
| 13632 | tPmkidCacheInfo *pPMKIDCache, uint32_t numItems, |
| 13633 | bool update_entire_cache) |
| 13634 | { |
| 13635 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13636 | uint32_t i = 0; |
| 13637 | tPmkidCacheInfo *pmksa; |
| 13638 | |
| 13639 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13640 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13641 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13642 | } |
| 13643 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13644 | sme_debug("numItems = %d", numItems); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13645 | |
| 13646 | if (numItems > CSR_MAX_PMKID_ALLOWED) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13647 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13648 | |
| 13649 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 13650 | csr_roam_diag_set_pmkid(pSession); |
| 13651 | #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ |
| 13652 | |
| 13653 | if (update_entire_cache) { |
| 13654 | if (numItems && pPMKIDCache) { |
| 13655 | pSession->NumPmkidCache = (uint16_t) numItems; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13656 | qdf_mem_copy(pSession->PmkidCacheInfo, pPMKIDCache, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13657 | sizeof(tPmkidCacheInfo) * numItems); |
| 13658 | pSession->curr_cache_idx = (uint16_t)numItems; |
| 13659 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13660 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13661 | } |
| 13662 | |
| 13663 | for (i = 0; i < numItems; i++) { |
| 13664 | pmksa = &pPMKIDCache[i]; |
| 13665 | |
| 13666 | /* Delete the entry if present */ |
| 13667 | csr_roam_del_pmkid_from_cache(pMac, sessionId, |
| 13668 | pmksa->BSSID.bytes, false); |
| 13669 | |
| 13670 | /* Add entry to the cache */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 13671 | qdf_copy_macaddr( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13672 | &pSession->PmkidCacheInfo[pSession->curr_cache_idx].BSSID, |
| 13673 | &pmksa->BSSID); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13674 | qdf_mem_copy( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13675 | pSession->PmkidCacheInfo[pSession->curr_cache_idx].PMKID, |
| 13676 | pmksa->PMKID, CSR_RSN_PMKID_SIZE); |
| 13677 | |
| 13678 | /* Increment the CSR local cache index */ |
| 13679 | if (pSession->curr_cache_idx < (CSR_MAX_PMKID_ALLOWED - 1)) |
| 13680 | pSession->curr_cache_idx++; |
| 13681 | else |
| 13682 | pSession->curr_cache_idx = 0; |
| 13683 | |
| 13684 | pSession->NumPmkidCache++; |
| 13685 | if (pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) |
| 13686 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 13687 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13688 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13689 | } |
| 13690 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13691 | QDF_STATUS csr_roam_del_pmkid_from_cache(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13692 | uint32_t sessionId, |
| 13693 | const uint8_t *pBSSId, |
| 13694 | bool flush_cache) |
| 13695 | { |
| 13696 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13697 | bool fMatchFound = false; |
| 13698 | uint32_t Index; |
| 13699 | uint32_t curr_idx; |
| 13700 | uint32_t i; |
| 13701 | |
| 13702 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13703 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13704 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13705 | } |
| 13706 | |
| 13707 | /* Check if there are no entries to delete */ |
| 13708 | if (0 == pSession->NumPmkidCache) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13709 | sme_debug("No entries to delete/Flush"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13710 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13711 | } |
| 13712 | |
| 13713 | if (flush_cache) { |
| 13714 | /* Flush the entire cache */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13715 | qdf_mem_zero(pSession->PmkidCacheInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13716 | sizeof(tPmkidCacheInfo) * CSR_MAX_PMKID_ALLOWED); |
| 13717 | pSession->NumPmkidCache = 0; |
| 13718 | pSession->curr_cache_idx = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13719 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13720 | } |
| 13721 | |
| 13722 | /* !flush_cache - so look up in the cache */ |
| 13723 | for (Index = 0; Index < CSR_MAX_PMKID_ALLOWED; Index++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13724 | if (!qdf_mem_cmp(pSession->PmkidCacheInfo[Index].BSSID.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 13725 | pBSSId, QDF_MAC_ADDR_SIZE)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13726 | fMatchFound = 1; |
| 13727 | |
| 13728 | /* Clear this - the matched entry */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13729 | qdf_mem_zero(&pSession->PmkidCacheInfo[Index], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13730 | sizeof(tPmkidCacheInfo)); |
| 13731 | break; |
| 13732 | } |
| 13733 | } |
| 13734 | |
| 13735 | if (Index == CSR_MAX_PMKID_ALLOWED && !fMatchFound) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13736 | sme_debug("No such PMKSA entry exists" |
| 13737 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pBSSId)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13738 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13739 | } |
| 13740 | |
| 13741 | /* Match Found, Readjust the other entries */ |
| 13742 | curr_idx = pSession->curr_cache_idx; |
| 13743 | if (Index < curr_idx) { |
| 13744 | for (i = Index; i < (curr_idx - 1); i++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13745 | qdf_mem_copy(&pSession->PmkidCacheInfo[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13746 | &pSession->PmkidCacheInfo[i + 1], |
| 13747 | sizeof(tPmkidCacheInfo)); |
| 13748 | } |
| 13749 | |
| 13750 | pSession->curr_cache_idx--; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13751 | qdf_mem_zero(&pSession->PmkidCacheInfo |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13752 | [pSession->curr_cache_idx], |
| 13753 | sizeof(tPmkidCacheInfo)); |
| 13754 | } else if (Index > curr_idx) { |
| 13755 | for (i = Index; i > (curr_idx); i--) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13756 | qdf_mem_copy(&pSession->PmkidCacheInfo[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13757 | &pSession->PmkidCacheInfo[i - 1], |
| 13758 | sizeof(tPmkidCacheInfo)); |
| 13759 | } |
| 13760 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13761 | qdf_mem_zero(&pSession->PmkidCacheInfo |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13762 | [pSession->curr_cache_idx], |
| 13763 | sizeof(tPmkidCacheInfo)); |
| 13764 | } |
| 13765 | |
| 13766 | /* Decrement the count since an entry has been deleted */ |
| 13767 | pSession->NumPmkidCache--; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13768 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13769 | } |
| 13770 | |
| 13771 | uint32_t csr_roam_get_num_pmkid_cache(tpAniSirGlobal pMac, uint32_t sessionId) |
| 13772 | { |
| 13773 | return pMac->roam.roamSession[sessionId].NumPmkidCache; |
| 13774 | } |
| 13775 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13776 | QDF_STATUS csr_roam_get_pmkid_cache(tpAniSirGlobal pMac, uint32_t sessionId, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13777 | uint32_t *pNum, tPmkidCacheInfo *pPmkidCache) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13778 | { |
| 13779 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13780 | tPmkidCacheInfo *pmksa; |
| 13781 | uint16_t i, j; |
| 13782 | |
| 13783 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13784 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13785 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13786 | } |
| 13787 | |
| 13788 | if (!pNum || !pPmkidCache) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13789 | sme_err("Either pNum or pPmkidCache is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13790 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13791 | } |
| 13792 | |
| 13793 | if (pSession->NumPmkidCache == 0) { |
| 13794 | *pNum = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13795 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13796 | } |
| 13797 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13798 | if (*pNum < pSession->NumPmkidCache) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13799 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13800 | |
| 13801 | if (pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13802 | sme_err("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13803 | pSession->NumPmkidCache); |
| 13804 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 13805 | } |
| 13806 | |
| 13807 | for (i = 0, j = 0; ((j < pSession->NumPmkidCache) && |
| 13808 | (i < CSR_MAX_PMKID_ALLOWED)); i++) { |
| 13809 | /* Fill the valid entries */ |
| 13810 | pmksa = &pSession->PmkidCacheInfo[i]; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 13811 | if (!qdf_is_macaddr_zero(&pmksa->BSSID)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13812 | qdf_mem_copy(pPmkidCache, pmksa, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13813 | sizeof(tPmkidCacheInfo)); |
| 13814 | pPmkidCache++; |
| 13815 | j++; |
| 13816 | } |
| 13817 | } |
| 13818 | |
| 13819 | *pNum = pSession->NumPmkidCache; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13820 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13821 | } |
| 13822 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13823 | QDF_STATUS csr_roam_get_wpa_rsn_req_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13824 | uint32_t *pLen, uint8_t *pBuf) |
| 13825 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13826 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13827 | uint32_t len; |
| 13828 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13829 | |
| 13830 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13831 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13832 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13833 | } |
| 13834 | |
| 13835 | if (pLen) { |
| 13836 | len = *pLen; |
| 13837 | *pLen = pSession->nWpaRsnReqIeLength; |
| 13838 | if (pBuf) { |
| 13839 | if (len >= pSession->nWpaRsnReqIeLength) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13840 | qdf_mem_copy(pBuf, pSession->pWpaRsnReqIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13841 | pSession->nWpaRsnReqIeLength); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13842 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13843 | } |
| 13844 | } |
| 13845 | } |
| 13846 | return status; |
| 13847 | } |
| 13848 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13849 | QDF_STATUS csr_roam_get_wpa_rsn_rsp_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13850 | uint32_t *pLen, uint8_t *pBuf) |
| 13851 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13852 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13853 | uint32_t len; |
| 13854 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13855 | |
| 13856 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13857 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13858 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13859 | } |
| 13860 | |
| 13861 | if (pLen) { |
| 13862 | len = *pLen; |
| 13863 | *pLen = pSession->nWpaRsnRspIeLength; |
| 13864 | if (pBuf) { |
| 13865 | if (len >= pSession->nWpaRsnRspIeLength) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13866 | qdf_mem_copy(pBuf, pSession->pWpaRsnRspIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13867 | pSession->nWpaRsnRspIeLength); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13868 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13869 | } |
| 13870 | } |
| 13871 | } |
| 13872 | return status; |
| 13873 | } |
| 13874 | |
| 13875 | #ifdef FEATURE_WLAN_WAPI |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13876 | QDF_STATUS csr_roam_get_wapi_req_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13877 | uint32_t *pLen, uint8_t *pBuf) |
| 13878 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13879 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13880 | uint32_t len; |
| 13881 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13882 | |
| 13883 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13884 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13885 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13886 | } |
| 13887 | |
| 13888 | if (pLen) { |
| 13889 | len = *pLen; |
| 13890 | *pLen = pSession->nWapiReqIeLength; |
| 13891 | if (pBuf) { |
| 13892 | if (len >= pSession->nWapiReqIeLength) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13893 | qdf_mem_copy(pBuf, pSession->pWapiReqIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13894 | pSession->nWapiReqIeLength); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13895 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13896 | } |
| 13897 | } |
| 13898 | } |
| 13899 | return status; |
| 13900 | } |
| 13901 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13902 | QDF_STATUS csr_roam_get_wapi_rsp_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13903 | uint32_t *pLen, uint8_t *pBuf) |
| 13904 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13905 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13906 | uint32_t len; |
| 13907 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13908 | |
| 13909 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13910 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13911 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13912 | } |
| 13913 | |
| 13914 | if (pLen) { |
| 13915 | len = *pLen; |
| 13916 | *pLen = pSession->nWapiRspIeLength; |
| 13917 | if (pBuf) { |
| 13918 | if (len >= pSession->nWapiRspIeLength) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13919 | qdf_mem_copy(pBuf, pSession->pWapiRspIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13920 | pSession->nWapiRspIeLength); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13921 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13922 | } |
| 13923 | } |
| 13924 | } |
| 13925 | return status; |
| 13926 | } |
| 13927 | #endif /* FEATURE_WLAN_WAPI */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13928 | eRoamCmdStatus csr_get_roam_complete_status(tpAniSirGlobal pMac, |
| 13929 | uint32_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13930 | { |
| 13931 | eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION; |
| 13932 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13933 | |
| 13934 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13935 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13936 | return retStatus; |
| 13937 | } |
| 13938 | |
| 13939 | if (CSR_IS_ROAMING(pSession)) { |
| 13940 | retStatus = eCSR_ROAM_ROAMING_COMPLETION; |
| 13941 | pSession->fRoaming = false; |
| 13942 | } |
| 13943 | return retStatus; |
| 13944 | } |
| 13945 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13946 | static QDF_STATUS csr_roam_start_wds(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13947 | tCsrRoamProfile *pProfile, |
| 13948 | tSirBssDescription *pBssDesc) |
| 13949 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13950 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13951 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 13952 | tBssConfigParam bssConfig; |
| 13953 | |
| 13954 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 13955 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13956 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13957 | } |
| 13958 | |
| 13959 | if (csr_is_conn_state_ibss(pMac, sessionId)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13960 | status = csr_roam_issue_stop_bss(pMac, sessionId, |
| 13961 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13962 | } else if (csr_is_conn_state_connected_infra(pMac, sessionId)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13963 | /* Disassociate from the connected Infrastructure network.*/ |
| 13964 | status = csr_roam_issue_disassociate(pMac, sessionId, |
| 13965 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13966 | false); |
| 13967 | } else { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13968 | /* We don't expect Bt-AMP HDD not to disconnect the last |
| 13969 | * connection first at this time. Otherwise we need to add |
| 13970 | * code to handle the situation just like IBSS. Though for |
| 13971 | * WDS station, we need to send disassoc to PE first then |
| 13972 | * send stop_bss to PE, before we can continue. |
| 13973 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13974 | |
| 13975 | if (csr_is_conn_state_wds(pMac, sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 13976 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13977 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13978 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13979 | qdf_mem_set(&bssConfig, sizeof(tBssConfigParam), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13980 | /* Assume HDD provide bssid in profile */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 13981 | qdf_copy_macaddr(&pSession->bssParams.bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13982 | pProfile->BSSIDs.bssid); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 13983 | /* there is no Bss description before we start an WDS so we |
| 13984 | * need to adopt all Bss configuration parameters from the |
| 13985 | * Profile. |
| 13986 | */ |
| 13987 | status = csr_roam_prepare_bss_config_from_profile(pMac, |
| 13988 | pProfile, |
| 13989 | &bssConfig, |
| 13990 | pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 13991 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13992 | /* Save profile for late use */ |
| 13993 | csr_free_roam_profile(pMac, sessionId); |
| 13994 | pSession->pCurRoamProfile = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 13995 | qdf_mem_malloc(sizeof(tCsrRoamProfile)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13996 | if (pSession->pCurRoamProfile != NULL) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 13997 | csr_roam_copy_profile(pMac, |
| 13998 | pSession->pCurRoamProfile, |
| 13999 | pProfile); |
| 14000 | } |
| 14001 | /* Prepare some more parameters for this WDS */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14002 | csr_roam_prepare_bss_params(pMac, sessionId, pProfile, |
| 14003 | NULL, &bssConfig, NULL); |
| 14004 | status = csr_roam_set_bss_config_cfg(pMac, sessionId, |
| 14005 | pProfile, NULL, |
| 14006 | &bssConfig, NULL, |
| 14007 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14008 | } |
| 14009 | } |
| 14010 | |
| 14011 | return status; |
| 14012 | } |
| 14013 | |
| 14014 | /** |
| 14015 | * csr_add_supported_5Ghz_channels()- Add valid 5Ghz channels |
| 14016 | * in Join req. |
| 14017 | * @mac_ctx: pointer to global mac structure |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 14018 | * @chan_list: Pointer to channel list buffer to populate |
| 14019 | * @num_chan: Pointer to number of channels value to update |
| 14020 | * @supp_chan_ie: Boolean to check if we need to populate as IE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14021 | * |
| 14022 | * This function is called to update valid 5Ghz channels |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 14023 | * in Join req. If @supp_chan_ie is true, supported channels IE |
| 14024 | * format[chan num 1, num of channels 1, chan num 2, num of |
| 14025 | * channels 2, ..] is populated. Else, @chan_list would be a list |
| 14026 | * of supported channels[chan num 1, chan num 2..] |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14027 | * |
| 14028 | * Return: void |
| 14029 | */ |
| 14030 | static void csr_add_supported_5Ghz_channels(tpAniSirGlobal mac_ctx, |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 14031 | uint8_t *chan_list, |
| 14032 | uint8_t *num_chnl, |
| 14033 | bool supp_chan_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14034 | { |
| 14035 | uint16_t i, j; |
| 14036 | uint32_t size = 0; |
| 14037 | |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 14038 | if (!chan_list) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 14039 | sme_err("chan_list buffer NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14040 | return; |
| 14041 | } |
| 14042 | |
| 14043 | size = sizeof(mac_ctx->roam.validChannelList); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14044 | if (QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14045 | (csr_get_cfg_valid_channels(mac_ctx, |
| 14046 | (uint8_t *) mac_ctx->roam.validChannelList, |
| 14047 | &size))) { |
| 14048 | for (i = 0, j = 0; i < size; i++) { |
| 14049 | /* Only add 5ghz channels.*/ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14050 | if (WLAN_REG_IS_5GHZ_CH |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14051 | (mac_ctx->roam.validChannelList[i])) { |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 14052 | chan_list[j] |
| 14053 | = mac_ctx->roam.validChannelList[i]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14054 | j++; |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 14055 | |
| 14056 | if (supp_chan_ie) { |
| 14057 | chan_list[j] = 1; |
| 14058 | j++; |
| 14059 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14060 | } |
| 14061 | } |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 14062 | *num_chnl = (uint8_t)j; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14063 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 14064 | sme_err("can not find any valid channel"); |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 14065 | *num_chnl = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14066 | } |
| 14067 | } |
| 14068 | |
| 14069 | /** |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 14070 | * csr_set_ldpc_exception() - to set allow any LDPC exception permitted |
| 14071 | * @mac_ctx: Pointer to mac context |
| 14072 | * @session: Pointer to SME/CSR session |
| 14073 | * @channel: Given channel number where connection will go |
| 14074 | * @usr_cfg_rx_ldpc: User provided RX LDPC setting |
| 14075 | * |
| 14076 | * This API will check if hardware allows LDPC to be enabled for provided |
| 14077 | * channel and user has enabled the RX LDPC selection |
| 14078 | * |
| 14079 | * Return: QDF_STATUS |
| 14080 | */ |
| 14081 | static QDF_STATUS csr_set_ldpc_exception(tpAniSirGlobal mac_ctx, |
| 14082 | tCsrRoamSession *session, uint8_t channel, |
| 14083 | bool usr_cfg_rx_ldpc) |
| 14084 | { |
| 14085 | if (!mac_ctx) { |
Varun Reddy Yeturu | 5a18365 | 2016-09-09 15:36:00 -0700 | [diff] [blame] | 14086 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14087 | "mac_ctx is NULL"); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 14088 | return QDF_STATUS_E_FAILURE; |
| 14089 | } |
| 14090 | if (!session) { |
Varun Reddy Yeturu | 5a18365 | 2016-09-09 15:36:00 -0700 | [diff] [blame] | 14091 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 14092 | "session is NULL"); |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 14093 | return QDF_STATUS_E_FAILURE; |
| 14094 | } |
| 14095 | if (usr_cfg_rx_ldpc && wma_is_rx_ldpc_supported_for_channel(channel)) { |
| 14096 | session->htConfig.ht_rx_ldpc = 1; |
| 14097 | session->vht_config.ldpc_coding = 1; |
| 14098 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_HIGH, |
| 14099 | "LDPC enable for chnl[%d]", channel); |
| 14100 | } else { |
| 14101 | session->htConfig.ht_rx_ldpc = 0; |
| 14102 | session->vht_config.ldpc_coding = 0; |
| 14103 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_HIGH, |
| 14104 | "LDPC disable for chnl[%d]", channel); |
| 14105 | } |
| 14106 | return QDF_STATUS_SUCCESS; |
| 14107 | } |
| 14108 | |
Abhishek Singh | cfb4448 | 2017-03-10 12:42:37 +0530 | [diff] [blame] | 14109 | #ifdef WLAN_FEATURE_11W |
| 14110 | /** |
Srinivas Girigowda | 6519b93 | 2017-08-03 14:10:57 -0700 | [diff] [blame] | 14111 | * csr_is_mfpc_capable() - is MFPC capable |
| 14112 | * @ies: AP information element |
| 14113 | * |
| 14114 | * Return: true if MFPC capable, false otherwise |
| 14115 | */ |
| 14116 | bool csr_is_mfpc_capable(struct sDot11fIERSN *rsn) |
| 14117 | { |
| 14118 | bool mfpc_capable = false; |
| 14119 | |
| 14120 | if (rsn && rsn->present && |
| 14121 | ((rsn->RSN_Cap[0] >> 7) & 0x01)) |
| 14122 | mfpc_capable = true; |
| 14123 | |
| 14124 | return mfpc_capable; |
| 14125 | } |
| 14126 | |
| 14127 | /** |
Abhishek Singh | cfb4448 | 2017-03-10 12:42:37 +0530 | [diff] [blame] | 14128 | * csr_set_mgmt_enc_type() - set mgmt enc type for PMF |
| 14129 | * @profile: roam profile |
| 14130 | * @ies: AP ie |
| 14131 | * @csr_join_req: csr join req |
| 14132 | * |
| 14133 | * Return: void |
| 14134 | */ |
| 14135 | static void csr_set_mgmt_enc_type(tCsrRoamProfile *profile, |
| 14136 | tDot11fBeaconIEs *ies, tSirSmeJoinReq *csr_join_req) |
| 14137 | { |
| 14138 | if (profile->MFPEnabled) |
| 14139 | csr_join_req->MgmtEncryptionType = eSIR_ED_AES_128_CMAC; |
| 14140 | else |
| 14141 | csr_join_req->MgmtEncryptionType = eSIR_ED_NONE; |
| 14142 | if (profile->MFPEnabled && |
| 14143 | !(profile->MFPRequired) && |
Srinivas Girigowda | 6519b93 | 2017-08-03 14:10:57 -0700 | [diff] [blame] | 14144 | !csr_is_mfpc_capable(&ies->RSN)) |
Abhishek Singh | cfb4448 | 2017-03-10 12:42:37 +0530 | [diff] [blame] | 14145 | csr_join_req->MgmtEncryptionType = eSIR_ED_NONE; |
| 14146 | } |
| 14147 | #else |
| 14148 | static inline void csr_set_mgmt_enc_type(tCsrRoamProfile *profile, |
| 14149 | tDot11fBeaconIEs *pIes, tSirSmeJoinReq *csr_join_req) |
| 14150 | { |
| 14151 | } |
| 14152 | #endif |
| 14153 | |
| 14154 | |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 14155 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14156 | * The communication between HDD and LIM is thru mailbox (MB). |
| 14157 | * Both sides will access the data structure "tSirSmeJoinReq". |
| 14158 | * The rule is, while the components of "tSirSmeJoinReq" can be accessed in the |
| 14159 | * regular way like tSirSmeJoinReq.assocType, this guideline stops at component |
| 14160 | * tSirRSNie; |
| 14161 | * any acces to the components after tSirRSNie is forbidden because the space |
| 14162 | * from tSirRSNie is squeezed with the component "tSirBssDescription" and since |
| 14163 | * the size of actual 'tSirBssDescription' varies, the receiving side should |
| 14164 | * keep in mind not to access the components DIRECTLY after tSirRSNie. |
| 14165 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14166 | QDF_STATUS csr_send_join_req_msg(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14167 | tSirBssDescription *pBssDescription, |
| 14168 | tCsrRoamProfile *pProfile, |
| 14169 | tDot11fBeaconIEs *pIes, uint16_t messageType) |
| 14170 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14171 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14172 | uint8_t acm_mask = 0, uapsd_mask; |
| 14173 | uint16_t msgLen, ieLen; |
| 14174 | tSirMacRateSet OpRateSet; |
| 14175 | tSirMacRateSet ExRateSet; |
| 14176 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 14177 | uint32_t dwTmp, ucDot11Mode = 0; |
Selvaraj, Sridhar | dc2ac8e | 2017-05-12 15:32:45 +0530 | [diff] [blame] | 14178 | uint8_t *wpaRsnIE = NULL; |
Prakash Dhavali | 2aa7f89 | 2016-12-02 09:56:09 -0800 | [diff] [blame] | 14179 | uint8_t txBFCsnValue = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14180 | tSirSmeJoinReq *csr_join_req; |
| 14181 | tSirMacCapabilityInfo *pAP_capabilityInfo; |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 14182 | bool fTmp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14183 | int8_t pwrLimit = 0; |
| 14184 | struct ps_global_info *ps_global_info = &pMac->sme.ps_global_info; |
| 14185 | struct ps_params *ps_param = &ps_global_info->ps_params[sessionId]; |
| 14186 | uint8_t ese_config = 0; |
Varun Reddy Yeturu | 7fc616d | 2016-04-25 17:03:56 -0700 | [diff] [blame] | 14187 | tpCsrNeighborRoamControlInfo neigh_roam_info; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 14188 | uint32_t value = 0, value1 = 0; |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 14189 | QDF_STATUS packetdump_timer_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14190 | |
| 14191 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 14192 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14193 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14194 | } |
| 14195 | /* To satisfy klockworks */ |
| 14196 | if (NULL == pBssDescription) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 14197 | sme_err(" pBssDescription is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14198 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14199 | } |
Varun Reddy Yeturu | 7fc616d | 2016-04-25 17:03:56 -0700 | [diff] [blame] | 14200 | neigh_roam_info = &pMac->roam.neighborRoamInfo[sessionId]; |
| 14201 | if ((eWNI_SME_REASSOC_REQ == messageType) || |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14202 | WLAN_REG_IS_5GHZ_CH(pBssDescription->channelId) || |
Varun Reddy Yeturu | 7fc616d | 2016-04-25 17:03:56 -0700 | [diff] [blame] | 14203 | (abs(pBssDescription->rssi) < |
Varun Reddy Yeturu | f64252a | 2016-05-13 15:02:03 -0700 | [diff] [blame] | 14204 | (neigh_roam_info->cfgParams.neighborLookupThreshold - |
Varun Reddy Yeturu | 7fc616d | 2016-04-25 17:03:56 -0700 | [diff] [blame] | 14205 | neigh_roam_info->cfgParams.hi_rssi_scan_rssi_delta))) { |
| 14206 | pSession->disable_hi_rssi = true; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 14207 | sme_debug( |
| 14208 | "Disabling HI_RSSI feature, AP channel=%d, rssi=%d", |
Varun Reddy Yeturu | 7fc616d | 2016-04-25 17:03:56 -0700 | [diff] [blame] | 14209 | pBssDescription->channelId, pBssDescription->rssi); |
| 14210 | } else { |
| 14211 | pSession->disable_hi_rssi = false; |
| 14212 | } |
| 14213 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14214 | |
| 14215 | do { |
| 14216 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 14217 | pSession->joinFailStatusCode.reasonCode = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14218 | qdf_mem_copy(&pSession->joinFailStatusCode.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14219 | &pBssDescription->bssId, sizeof(tSirMacAddr)); |
| 14220 | /* |
| 14221 | * the tSirSmeJoinReq which includes a single |
| 14222 | * bssDescription. it includes a single uint32_t for the |
| 14223 | * IE fields, but the length field in the bssDescription |
| 14224 | * needs to be interpreted to determine length of IE fields |
| 14225 | * So, take the size of the tSirSmeJoinReq, subtract size of |
| 14226 | * bssDescription, add the number of bytes indicated by the |
| 14227 | * length field of the bssDescription, add the size of length |
| 14228 | * field because it not included in the lenghth field. |
| 14229 | */ |
| 14230 | msgLen = sizeof(tSirSmeJoinReq) - sizeof(*pBssDescription) + |
| 14231 | pBssDescription->length + |
| 14232 | sizeof(pBssDescription->length) + |
| 14233 | /* |
| 14234 | * add in the size of the WPA IE that |
| 14235 | * we may build. |
| 14236 | */ |
| 14237 | sizeof(tCsrWpaIe) + sizeof(tCsrWpaAuthIe) + |
| 14238 | sizeof(uint16_t); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14239 | csr_join_req = qdf_mem_malloc(msgLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14240 | if (NULL == csr_join_req) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14241 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14242 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14243 | status = QDF_STATUS_SUCCESS; |
| 14244 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14245 | break; |
Selvaraj, Sridhar | dc2ac8e | 2017-05-12 15:32:45 +0530 | [diff] [blame] | 14246 | |
| 14247 | wpaRsnIE = qdf_mem_malloc(DOT11F_IE_RSN_MAX_LEN); |
| 14248 | if (NULL == wpaRsnIE) |
| 14249 | status = QDF_STATUS_E_NOMEM; |
| 14250 | |
| 14251 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 14252 | break; |
| 14253 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14254 | csr_join_req->messageType = messageType; |
| 14255 | csr_join_req->length = msgLen; |
| 14256 | csr_join_req->sessionId = (uint8_t) sessionId; |
| 14257 | csr_join_req->transactionId = 0; |
| 14258 | if (pIes->SSID.present && pIes->SSID.num_ssid) { |
| 14259 | csr_join_req->ssId.length = pIes->SSID.num_ssid; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14260 | qdf_mem_copy(&csr_join_req->ssId.ssId, pIes->SSID.ssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14261 | pIes->SSID.num_ssid); |
| 14262 | } else |
| 14263 | csr_join_req->ssId.length = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14264 | qdf_mem_copy(&csr_join_req->selfMacAddr, &pSession->selfMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14265 | sizeof(tSirMacAddr)); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14266 | sme_err("Connecting to ssid:%.*s bssid: "MAC_ADDRESS_STR" rssi: %d channel: %d country_code: %c%c", |
Srinivas Girigowda | f2599dd | 2015-11-16 18:20:46 -0800 | [diff] [blame] | 14267 | pIes->SSID.num_ssid, pIes->SSID.ssid, |
| 14268 | MAC_ADDR_ARRAY(pBssDescription->bssId), |
| 14269 | pBssDescription->rssi, pBssDescription->channelId, |
| 14270 | pMac->scan.countryCodeCurrent[0], |
| 14271 | pMac->scan.countryCodeCurrent[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14272 | /* bsstype */ |
| 14273 | dwTmp = csr_translate_bsstype_to_mac_type |
| 14274 | (pProfile->BSSType); |
Rajeev Kumar | c9a50e7 | 2016-04-15 15:18:42 -0700 | [diff] [blame] | 14275 | csr_join_req->bsstype = dwTmp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14276 | /* dot11mode */ |
| 14277 | ucDot11Mode = |
| 14278 | csr_translate_to_wni_cfg_dot11_mode(pMac, |
| 14279 | pSession->bssParams. |
| 14280 | uCfgDot11Mode); |
| 14281 | if (pBssDescription->channelId <= 14 |
| 14282 | && false == pMac->roam.configParam.enableVhtFor24GHz |
| 14283 | && WNI_CFG_DOT11_MODE_11AC == ucDot11Mode) { |
| 14284 | /* Need to disable VHT operation in 2.4 GHz band */ |
| 14285 | ucDot11Mode = WNI_CFG_DOT11_MODE_11N; |
| 14286 | } |
| 14287 | csr_join_req->dot11mode = (uint8_t) ucDot11Mode; |
Padma, Santhosh Kumar | 19f5765 | 2017-05-26 18:03:45 +0530 | [diff] [blame] | 14288 | sme_debug("dot11mode=%d, uCfgDot11Mode=%d", |
| 14289 | csr_join_req->dot11mode, |
| 14290 | pSession->bssParams.uCfgDot11Mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14291 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 14292 | csr_join_req->cc_switch_mode = |
| 14293 | pMac->roam.configParam.cc_switch_mode; |
| 14294 | #endif |
| 14295 | csr_join_req->staPersona = (uint8_t) pProfile->csrPersona; |
Abhishek Singh | f78bd2d | 2016-04-27 16:47:56 +0530 | [diff] [blame] | 14296 | csr_join_req->wps_registration = pProfile->bWPSAssociation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14297 | csr_join_req->cbMode = (uint8_t) pSession->bssParams.cbMode; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14298 | sme_debug("CSR PERSONA: %d CSR CbMode: %d", |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 14299 | pProfile->csrPersona, pSession->bssParams.cbMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14300 | csr_join_req->uapsdPerAcBitmask = pProfile->uapsd_mask; |
Naveen Rawat | cd11831 | 2016-11-22 10:46:21 -0800 | [diff] [blame] | 14301 | pSession->uapsd_mask = pProfile->uapsd_mask; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14302 | status = |
| 14303 | csr_get_rate_set(pMac, pProfile, |
| 14304 | (eCsrPhyMode) pProfile->phyMode, |
| 14305 | pBssDescription, pIes, &OpRateSet, |
| 14306 | &ExRateSet); |
| 14307 | ps_param->uapsd_per_ac_bit_mask = |
| 14308 | pProfile->uapsd_mask; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14309 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14310 | /* OperationalRateSet */ |
| 14311 | if (OpRateSet.numRates) { |
| 14312 | csr_join_req->operationalRateSet.numRates = |
| 14313 | OpRateSet.numRates; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14314 | qdf_mem_copy(&csr_join_req->operationalRateSet. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14315 | rate, OpRateSet.rate, |
| 14316 | OpRateSet.numRates); |
| 14317 | } else |
| 14318 | csr_join_req->operationalRateSet.numRates = 0; |
| 14319 | |
| 14320 | /* ExtendedRateSet */ |
| 14321 | if (ExRateSet.numRates) { |
| 14322 | csr_join_req->extendedRateSet.numRates = |
| 14323 | ExRateSet.numRates; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14324 | qdf_mem_copy(&csr_join_req->extendedRateSet. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14325 | rate, ExRateSet.rate, |
| 14326 | ExRateSet.numRates); |
| 14327 | } else |
| 14328 | csr_join_req->extendedRateSet.numRates = 0; |
| 14329 | } else { |
| 14330 | csr_join_req->operationalRateSet.numRates = 0; |
| 14331 | csr_join_req->extendedRateSet.numRates = 0; |
| 14332 | } |
| 14333 | /* rsnIE */ |
| 14334 | if (csr_is_profile_wpa(pProfile)) { |
| 14335 | /* Insert the Wpa IE into the join request */ |
| 14336 | ieLen = |
| 14337 | csr_retrieve_wpa_ie(pMac, pProfile, |
| 14338 | pBssDescription, pIes, |
| 14339 | (tCsrWpaIe *) (wpaRsnIE)); |
| 14340 | } else if (csr_is_profile_rsn(pProfile)) { |
| 14341 | /* Insert the RSN IE into the join request */ |
| 14342 | ieLen = |
| 14343 | csr_retrieve_rsn_ie(pMac, sessionId, pProfile, |
| 14344 | pBssDescription, pIes, |
| 14345 | (tCsrRSNIe *) (wpaRsnIE)); |
| 14346 | } |
| 14347 | #ifdef FEATURE_WLAN_WAPI |
| 14348 | else if (csr_is_profile_wapi(pProfile)) { |
| 14349 | /* Insert the WAPI IE into the join request */ |
| 14350 | ieLen = |
| 14351 | csr_retrieve_wapi_ie(pMac, sessionId, pProfile, |
| 14352 | pBssDescription, pIes, |
| 14353 | (tCsrWapiIe *) (wpaRsnIE)); |
| 14354 | } |
| 14355 | #endif /* FEATURE_WLAN_WAPI */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14356 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14357 | ieLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14358 | /* remember the IE for future use */ |
| 14359 | if (ieLen) { |
| 14360 | if (ieLen > DOT11F_IE_RSN_MAX_LEN) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14361 | sme_err("WPA RSN IE length :%d is more than DOT11F_IE_RSN_MAX_LEN, resetting to %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14362 | ieLen, DOT11F_IE_RSN_MAX_LEN); |
| 14363 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 14364 | } |
| 14365 | #ifdef FEATURE_WLAN_WAPI |
| 14366 | if (csr_is_profile_wapi(pProfile)) { |
| 14367 | /* Check whether we need to allocate more mem */ |
| 14368 | if (ieLen > pSession->nWapiReqIeLength) { |
| 14369 | if (pSession->pWapiReqIE |
| 14370 | && pSession->nWapiReqIeLength) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14371 | qdf_mem_free(pSession-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14372 | pWapiReqIE); |
| 14373 | } |
| 14374 | pSession->pWapiReqIE = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14375 | qdf_mem_malloc(ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14376 | if (NULL == pSession->pWapiReqIE) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14377 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14378 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14379 | status = QDF_STATUS_SUCCESS; |
| 14380 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14381 | break; |
| 14382 | } |
| 14383 | pSession->nWapiReqIeLength = ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14384 | qdf_mem_copy(pSession->pWapiReqIE, wpaRsnIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14385 | ieLen); |
| 14386 | csr_join_req->rsnIE.length = ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14387 | qdf_mem_copy(&csr_join_req->rsnIE.rsnIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14388 | wpaRsnIE, ieLen); |
| 14389 | } else /* should be WPA/WPA2 otherwise */ |
| 14390 | #endif /* FEATURE_WLAN_WAPI */ |
| 14391 | { |
| 14392 | /* Check whether we need to allocate more mem */ |
| 14393 | if (ieLen > pSession->nWpaRsnReqIeLength) { |
| 14394 | if (pSession->pWpaRsnReqIE |
| 14395 | && pSession->nWpaRsnReqIeLength) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14396 | qdf_mem_free(pSession-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14397 | pWpaRsnReqIE); |
| 14398 | } |
| 14399 | pSession->pWpaRsnReqIE = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14400 | qdf_mem_malloc(ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14401 | if (NULL == pSession->pWpaRsnReqIE) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14402 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14403 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14404 | status = QDF_STATUS_SUCCESS; |
| 14405 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14406 | break; |
| 14407 | } |
| 14408 | pSession->nWpaRsnReqIeLength = ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14409 | qdf_mem_copy(pSession->pWpaRsnReqIE, wpaRsnIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14410 | ieLen); |
| 14411 | csr_join_req->rsnIE.length = ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14412 | qdf_mem_copy(&csr_join_req->rsnIE.rsnIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14413 | wpaRsnIE, ieLen); |
| 14414 | } |
| 14415 | } else { |
| 14416 | /* free whatever old info */ |
| 14417 | pSession->nWpaRsnReqIeLength = 0; |
| 14418 | if (pSession->pWpaRsnReqIE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14419 | qdf_mem_free(pSession->pWpaRsnReqIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14420 | pSession->pWpaRsnReqIE = NULL; |
| 14421 | } |
| 14422 | #ifdef FEATURE_WLAN_WAPI |
| 14423 | pSession->nWapiReqIeLength = 0; |
| 14424 | if (pSession->pWapiReqIE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14425 | qdf_mem_free(pSession->pWapiReqIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14426 | pSession->pWapiReqIE = NULL; |
| 14427 | } |
| 14428 | #endif /* FEATURE_WLAN_WAPI */ |
| 14429 | csr_join_req->rsnIE.length = 0; |
| 14430 | } |
| 14431 | #ifdef FEATURE_WLAN_ESE |
| 14432 | if (eWNI_SME_JOIN_REQ == messageType) |
| 14433 | csr_join_req->cckmIE.length = 0; |
| 14434 | else if (eWNI_SME_REASSOC_REQ == messageType) { |
| 14435 | /* cckmIE */ |
| 14436 | if (csr_is_profile_ese(pProfile)) { |
| 14437 | /* Insert the CCKM IE into the join request */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14438 | ieLen = pSession->suppCckmIeInfo.cckmIeLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14439 | qdf_mem_copy((void *)(wpaRsnIE), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14440 | pSession->suppCckmIeInfo.cckmIe, |
| 14441 | ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14442 | } else |
| 14443 | ieLen = 0; |
| 14444 | /* |
| 14445 | * If present, copy the IE into the |
| 14446 | * eWNI_SME_REASSOC_REQ message buffer |
| 14447 | */ |
| 14448 | if (ieLen) { |
| 14449 | /* |
| 14450 | * Copy the CCKM IE over from the temp |
| 14451 | * buffer (wpaRsnIE) |
| 14452 | */ |
| 14453 | csr_join_req->cckmIE.length = ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14454 | qdf_mem_copy(&csr_join_req->cckmIE.cckmIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14455 | wpaRsnIE, ieLen); |
| 14456 | } else |
| 14457 | csr_join_req->cckmIE.length = 0; |
| 14458 | } |
| 14459 | #endif /* FEATURE_WLAN_ESE */ |
| 14460 | /* addIEScan */ |
| 14461 | if (pProfile->nAddIEScanLength && pProfile->pAddIEScan) { |
| 14462 | ieLen = pProfile->nAddIEScanLength; |
| 14463 | if (ieLen > pSession->nAddIEScanLength) { |
| 14464 | if (pSession->pAddIEScan |
| 14465 | && pSession->nAddIEScanLength) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14466 | qdf_mem_free(pSession->pAddIEScan); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14467 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14468 | pSession->pAddIEScan = qdf_mem_malloc(ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14469 | if (NULL == pSession->pAddIEScan) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14470 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14471 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14472 | status = QDF_STATUS_SUCCESS; |
| 14473 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14474 | break; |
| 14475 | } |
| 14476 | pSession->nAddIEScanLength = ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14477 | qdf_mem_copy(pSession->pAddIEScan, pProfile->pAddIEScan, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14478 | ieLen); |
| 14479 | csr_join_req->addIEScan.length = ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14480 | qdf_mem_copy(&csr_join_req->addIEScan.addIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14481 | pProfile->pAddIEScan, ieLen); |
| 14482 | } else { |
| 14483 | pSession->nAddIEScanLength = 0; |
| 14484 | if (pSession->pAddIEScan) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14485 | qdf_mem_free(pSession->pAddIEScan); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14486 | pSession->pAddIEScan = NULL; |
| 14487 | } |
| 14488 | csr_join_req->addIEScan.length = 0; |
| 14489 | } |
| 14490 | /* addIEAssoc */ |
| 14491 | if (pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) { |
| 14492 | ieLen = pProfile->nAddIEAssocLength; |
| 14493 | if (ieLen > pSession->nAddIEAssocLength) { |
| 14494 | if (pSession->pAddIEAssoc |
| 14495 | && pSession->nAddIEAssocLength) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14496 | qdf_mem_free(pSession->pAddIEAssoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14497 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14498 | pSession->pAddIEAssoc = qdf_mem_malloc(ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14499 | if (NULL == pSession->pAddIEAssoc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14500 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14501 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14502 | status = QDF_STATUS_SUCCESS; |
| 14503 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14504 | break; |
| 14505 | } |
| 14506 | pSession->nAddIEAssocLength = ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14507 | qdf_mem_copy(pSession->pAddIEAssoc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14508 | pProfile->pAddIEAssoc, ieLen); |
| 14509 | csr_join_req->addIEAssoc.length = ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14510 | qdf_mem_copy(&csr_join_req->addIEAssoc.addIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14511 | pProfile->pAddIEAssoc, ieLen); |
| 14512 | } else { |
| 14513 | pSession->nAddIEAssocLength = 0; |
| 14514 | if (pSession->pAddIEAssoc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14515 | qdf_mem_free(pSession->pAddIEAssoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14516 | pSession->pAddIEAssoc = NULL; |
| 14517 | } |
| 14518 | csr_join_req->addIEAssoc.length = 0; |
| 14519 | } |
| 14520 | |
| 14521 | if (eWNI_SME_REASSOC_REQ == messageType) { |
| 14522 | /* Unmask any AC in reassoc that is ACM-set */ |
| 14523 | uapsd_mask = (uint8_t) pProfile->uapsd_mask; |
| 14524 | if (uapsd_mask && (NULL != pBssDescription)) { |
| 14525 | if (CSR_IS_QOS_BSS(pIes) |
| 14526 | && CSR_IS_UAPSD_BSS(pIes)) |
| 14527 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 14528 | acm_mask = |
| 14529 | sme_qos_get_acm_mask(pMac, |
| 14530 | pBssDescription, |
| 14531 | pIes); |
| 14532 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT */ |
| 14533 | else |
| 14534 | uapsd_mask = 0; |
| 14535 | } |
| 14536 | } |
| 14537 | |
| 14538 | csr_join_req->UCEncryptionType = |
| 14539 | csr_translate_encrypt_type_to_ed_type |
| 14540 | (pProfile->negotiatedUCEncryptionType); |
| 14541 | |
| 14542 | csr_join_req->MCEncryptionType = |
| 14543 | csr_translate_encrypt_type_to_ed_type |
| 14544 | (pProfile->negotiatedMCEncryptionType); |
Abhishek Singh | cfb4448 | 2017-03-10 12:42:37 +0530 | [diff] [blame] | 14545 | csr_set_mgmt_enc_type(pProfile, pIes, csr_join_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14546 | #ifdef FEATURE_WLAN_ESE |
| 14547 | ese_config = pMac->roam.configParam.isEseIniFeatureEnabled; |
| 14548 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14549 | pProfile->MDID.mdiePresent = pBssDescription->mdiePresent; |
| 14550 | if (csr_is_profile11r(pProfile) |
| 14551 | #ifdef FEATURE_WLAN_ESE |
| 14552 | && |
| 14553 | !((pProfile->negotiatedAuthType == |
| 14554 | eCSR_AUTH_TYPE_OPEN_SYSTEM) && (pIes->ESEVersion.present) |
| 14555 | && (ese_config)) |
| 14556 | #endif |
| 14557 | ) |
| 14558 | csr_join_req->is11Rconnection = true; |
| 14559 | else |
| 14560 | csr_join_req->is11Rconnection = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14561 | #ifdef FEATURE_WLAN_ESE |
| 14562 | if (true == ese_config) |
| 14563 | csr_join_req->isESEFeatureIniEnabled = true; |
| 14564 | else |
| 14565 | csr_join_req->isESEFeatureIniEnabled = false; |
| 14566 | |
| 14567 | /* A profile can not be both ESE and 11R. But an 802.11R AP |
| 14568 | * may be advertising support for ESE as well. So if we are |
| 14569 | * associating Open or explicitly ESE then we will get ESE. |
| 14570 | * If we are associating explictly 11R only then we will get |
| 14571 | * 11R. |
| 14572 | */ |
| 14573 | if ((csr_is_profile_ese(pProfile) || |
| 14574 | ((pIes->ESEVersion.present) && |
| 14575 | (pProfile->negotiatedAuthType == |
| 14576 | eCSR_AUTH_TYPE_OPEN_SYSTEM))) |
| 14577 | && (ese_config)) |
| 14578 | csr_join_req->isESEconnection = true; |
| 14579 | else |
| 14580 | csr_join_req->isESEconnection = false; |
| 14581 | |
| 14582 | if (eWNI_SME_JOIN_REQ == messageType) { |
| 14583 | tESETspecInfo eseTspec; |
| 14584 | /* |
| 14585 | * ESE-Tspec IEs in the ASSOC request is presently not |
| 14586 | * supported. so nullify the TSPEC parameters |
| 14587 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14588 | qdf_mem_set(&eseTspec, sizeof(tESETspecInfo), 0); |
| 14589 | qdf_mem_copy(&csr_join_req->eseTspecInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14590 | &eseTspec, sizeof(tESETspecInfo)); |
| 14591 | } else if (eWNI_SME_REASSOC_REQ == messageType) { |
| 14592 | if ((csr_is_profile_ese(pProfile) || |
| 14593 | ((pIes->ESEVersion.present) |
| 14594 | && (pProfile->negotiatedAuthType == |
| 14595 | eCSR_AUTH_TYPE_OPEN_SYSTEM))) && |
| 14596 | (ese_config)) { |
| 14597 | tESETspecInfo eseTspec; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14598 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14599 | qdf_mem_set(&eseTspec, sizeof(tESETspecInfo), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14600 | 0); |
| 14601 | eseTspec.numTspecs = |
| 14602 | sme_qos_ese_retrieve_tspec_info(pMac, |
| 14603 | sessionId, |
| 14604 | (tTspecInfo *) &eseTspec. |
| 14605 | tspec[0]); |
| 14606 | csr_join_req->eseTspecInfo.numTspecs = |
| 14607 | eseTspec.numTspecs; |
| 14608 | if (eseTspec.numTspecs) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14609 | qdf_mem_copy(&csr_join_req->eseTspecInfo |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14610 | .tspec[0], |
| 14611 | &eseTspec.tspec[0], |
| 14612 | (eseTspec.numTspecs * |
| 14613 | sizeof(tTspecInfo))); |
| 14614 | } |
| 14615 | } else { |
| 14616 | tESETspecInfo eseTspec; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14617 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14618 | * ESE-Tspec IEs in the ASSOC request is |
| 14619 | * presently not supported. so nullify the TSPEC |
| 14620 | * parameters |
| 14621 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14622 | qdf_mem_set(&eseTspec, sizeof(tESETspecInfo), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14623 | 0); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14624 | qdf_mem_copy(&csr_join_req->eseTspecInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14625 | &eseTspec, |
| 14626 | sizeof(tESETspecInfo)); |
| 14627 | } |
| 14628 | } |
| 14629 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14630 | if (ese_config |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14631 | || csr_roam_is_fast_roam_enabled(pMac, sessionId)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14632 | csr_join_req->isFastTransitionEnabled = true; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14633 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14634 | csr_join_req->isFastTransitionEnabled = false; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14635 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14636 | if (csr_roam_is_fast_roam_enabled(pMac, sessionId)) |
| 14637 | csr_join_req->isFastRoamIniFeatureEnabled = true; |
| 14638 | else |
| 14639 | csr_join_req->isFastRoamIniFeatureEnabled = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14640 | |
| 14641 | csr_join_req->txLdpcIniFeatureEnabled = |
Krunal Soni | a2c0e41 | 2017-05-04 14:12:41 +0530 | [diff] [blame] | 14642 | (uint8_t) pMac->roam.configParam.tx_ldpc_enable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14643 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14644 | if ((csr_is11h_supported(pMac)) && |
| 14645 | (WLAN_REG_IS_5GHZ_CH(pBssDescription->channelId)) && |
| 14646 | (pIes->Country.present) && |
| 14647 | (!pMac->roam.configParam. |
| 14648 | fSupplicantCountryCodeHasPriority)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14649 | csr_save_to_channel_power2_g_5_g(pMac, |
| 14650 | pIes->Country.num_triplets * |
| 14651 | sizeof(tSirMacChanInfo), |
| 14652 | (tSirMacChanInfo *) |
| 14653 | (&pIes->Country.triplets[0])); |
| 14654 | csr_apply_power2_current(pMac); |
| 14655 | } |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 14656 | /* |
| 14657 | * If RX LDPC has been disabled for 2.4GHz channels and enabled |
Krunal Soni | d292a6b | 2016-10-27 17:25:23 -0700 | [diff] [blame] | 14658 | * for 5Ghz for STA like persona then here is how to handle |
| 14659 | * those cases (by now channel has been decided). |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 14660 | */ |
Krunal Soni | d292a6b | 2016-10-27 17:25:23 -0700 | [diff] [blame] | 14661 | if (eSIR_INFRASTRUCTURE_MODE == csr_join_req->bsstype || |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 14662 | !policy_mgr_is_dbs_enable(pMac->psoc)) |
Krunal Soni | 0193b6f | 2016-08-15 15:53:43 -0700 | [diff] [blame] | 14663 | csr_set_ldpc_exception(pMac, pSession, |
| 14664 | pBssDescription->channelId, |
Krunal Soni | a2c0e41 | 2017-05-04 14:12:41 +0530 | [diff] [blame] | 14665 | pMac->roam.configParam.rx_ldpc_enable); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14666 | qdf_mem_copy(&csr_join_req->htConfig, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14667 | &pSession->htConfig, sizeof(tSirHTConfig)); |
Sandeep Puligilla | 9891743 | 2016-06-10 13:50:28 -0700 | [diff] [blame] | 14668 | qdf_mem_copy(&csr_join_req->vht_config, &pSession->vht_config, |
| 14669 | sizeof(pSession->vht_config)); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14670 | sme_debug("ht capability 0x%x VHT capability 0x%x", |
Sandeep Puligilla | 9891743 | 2016-06-10 13:50:28 -0700 | [diff] [blame] | 14671 | (unsigned int)(*(uint32_t *) &csr_join_req->htConfig), |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14672 | (unsigned int)(*(uint32_t *) &csr_join_req-> |
| 14673 | vht_config)); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 14674 | |
| 14675 | if (IS_DOT11_MODE_HE(csr_join_req->dot11mode)) |
| 14676 | csr_join_req_copy_he_cap(csr_join_req, pSession); |
| 14677 | |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 14678 | if (wlan_cfg_get_int(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, |
| 14679 | &value) != eSIR_SUCCESS) |
| 14680 | QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 14681 | ("Failed to get SU beamformee capability")); |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 14682 | if (wlan_cfg_get_int(pMac, |
| 14683 | WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, |
| 14684 | &value1) != eSIR_SUCCESS) |
| 14685 | QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 14686 | ("Failed to get CSN beamformee capability")); |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 14687 | |
| 14688 | csr_join_req->vht_config.su_beam_formee = value; |
Abhishek Singh | d8162ca | 2017-04-11 11:54:54 +0530 | [diff] [blame] | 14689 | |
| 14690 | /* Set BF CSN value only if SU Bformee is enabled */ |
| 14691 | if (csr_join_req->vht_config.su_beam_formee) { |
Prakash Dhavali | 2aa7f89 | 2016-12-02 09:56:09 -0800 | [diff] [blame] | 14692 | txBFCsnValue = (uint8_t)value1; |
| 14693 | if (IS_BSS_VHT_CAPABLE(pIes->VHTCaps) && |
Arif Hussain | c6aa1ce | 2016-12-01 18:03:17 -0800 | [diff] [blame] | 14694 | pIes->VHTCaps.csnofBeamformerAntSup) |
Prakash Dhavali | 2aa7f89 | 2016-12-02 09:56:09 -0800 | [diff] [blame] | 14695 | txBFCsnValue = QDF_MIN(txBFCsnValue, |
Arif Hussain | c6aa1ce | 2016-12-01 18:03:17 -0800 | [diff] [blame] | 14696 | pIes->VHTCaps.csnofBeamformerAntSup); |
| 14697 | else if (IS_BSS_VHT_CAPABLE( |
| 14698 | pIes->vendor_vht_ie.VHTCaps) |
| 14699 | && pIes->vendor_vht_ie.VHTCaps. |
| 14700 | csnofBeamformerAntSup) |
Prakash Dhavali | 2aa7f89 | 2016-12-02 09:56:09 -0800 | [diff] [blame] | 14701 | txBFCsnValue = QDF_MIN(txBFCsnValue, |
| 14702 | pIes->vendor_vht_ie. |
Arif Hussain | c6aa1ce | 2016-12-01 18:03:17 -0800 | [diff] [blame] | 14703 | VHTCaps.csnofBeamformerAntSup); |
Prakash Dhavali | 2aa7f89 | 2016-12-02 09:56:09 -0800 | [diff] [blame] | 14704 | } |
| 14705 | csr_join_req->vht_config.csnof_beamformer_antSup = txBFCsnValue; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14706 | |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 14707 | if (wlan_cfg_get_int(pMac, |
Abhishek Singh | d8162ca | 2017-04-11 11:54:54 +0530 | [diff] [blame] | 14708 | WNI_CFG_VHT_SU_BEAMFORMER_CAP, &value) |
| 14709 | != eSIR_SUCCESS) |
| 14710 | sme_err("Failed to get SU beamformer capability"); |
| 14711 | |
| 14712 | /* |
| 14713 | * Set SU Bformer only if SU Bformer is enabled in INI |
| 14714 | * and AP is SU Bformee capable |
| 14715 | */ |
| 14716 | if (value && !((IS_BSS_VHT_CAPABLE(pIes->VHTCaps) && |
| 14717 | pIes->VHTCaps.suBeamformeeCap) || |
| 14718 | (IS_BSS_VHT_CAPABLE( |
| 14719 | pIes->vendor_vht_ie.VHTCaps) |
| 14720 | && pIes->vendor_vht_ie.VHTCaps. |
| 14721 | suBeamformeeCap))) |
| 14722 | value = 0; |
| 14723 | |
| 14724 | csr_join_req->vht_config.su_beam_former = value; |
| 14725 | |
| 14726 | /* Set num soundingdim value to 0 if SU Bformer is disabled */ |
| 14727 | if (!csr_join_req->vht_config.su_beam_former) |
| 14728 | csr_join_req->vht_config.num_soundingdim = 0; |
| 14729 | |
| 14730 | if (wlan_cfg_get_int(pMac, |
| 14731 | WNI_CFG_VHT_MU_BEAMFORMEE_CAP, &value) |
| 14732 | != eSIR_SUCCESS) |
| 14733 | sme_err("Failed to get CSN beamformee capability"); |
| 14734 | /* |
| 14735 | * Set MU Bformee only if SU Bformee is enabled and |
| 14736 | * MU Bformee is enabled in INI |
| 14737 | */ |
| 14738 | if (value && csr_join_req->vht_config.su_beam_formee) |
| 14739 | csr_join_req->vht_config.mu_beam_formee = 1; |
| 14740 | else |
| 14741 | csr_join_req->vht_config.mu_beam_formee = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14742 | |
| 14743 | csr_join_req->enableVhtpAid = |
| 14744 | (uint8_t) pMac->roam.configParam.enableVhtpAid; |
| 14745 | |
| 14746 | csr_join_req->enableVhtGid = |
| 14747 | (uint8_t) pMac->roam.configParam.enableVhtGid; |
| 14748 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14749 | csr_join_req->enableAmpduPs = |
| 14750 | (uint8_t) pMac->roam.configParam.enableAmpduPs; |
| 14751 | |
| 14752 | csr_join_req->enableHtSmps = |
| 14753 | (uint8_t) pMac->roam.configParam.enableHtSmps; |
| 14754 | |
| 14755 | csr_join_req->htSmps = (uint8_t) pMac->roam.configParam.htSmps; |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 14756 | csr_join_req->send_smps_action = |
| 14757 | pMac->roam.configParam.send_smps_action; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14758 | |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 14759 | csr_join_req->max_amsdu_num = |
| 14760 | (uint8_t) pMac->roam.configParam.max_amsdu_num; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14761 | |
| 14762 | if (pMac->roam.roamSession[sessionId].fWMMConnection) |
| 14763 | csr_join_req->isWMEenabled = true; |
| 14764 | else |
| 14765 | csr_join_req->isWMEenabled = false; |
| 14766 | |
| 14767 | if (pMac->roam.roamSession[sessionId].fQOSConnection) |
| 14768 | csr_join_req->isQosEnabled = true; |
| 14769 | else |
| 14770 | csr_join_req->isQosEnabled = false; |
| 14771 | |
| 14772 | if (pProfile->bOSENAssociation) |
| 14773 | csr_join_req->isOSENConnection = true; |
| 14774 | else |
| 14775 | csr_join_req->isOSENConnection = false; |
| 14776 | |
Krishna Kumaar Natarajan | f599c6e | 2015-11-03 11:44:03 -0800 | [diff] [blame] | 14777 | /* Fill rrm config parameters */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14778 | qdf_mem_copy(&csr_join_req->rrm_config, |
Krishna Kumaar Natarajan | f599c6e | 2015-11-03 11:44:03 -0800 | [diff] [blame] | 14779 | &pMac->rrm.rrmSmeContext.rrmConfig, |
| 14780 | sizeof(struct rrm_config_param)); |
| 14781 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14782 | pAP_capabilityInfo = |
| 14783 | (tSirMacCapabilityInfo *) |
| 14784 | &pBssDescription->capabilityInfo; |
| 14785 | /* |
| 14786 | * tell the target AP my 11H capability only if both AP and STA |
| 14787 | * support |
| 14788 | * 11H and the channel being used is 11a |
| 14789 | */ |
| 14790 | if (csr_is11h_supported(pMac) && pAP_capabilityInfo->spectrumMgt |
| 14791 | && eSIR_11A_NW_TYPE == pBssDescription->nwType) { |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 14792 | fTmp = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14793 | } else |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 14794 | fTmp = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14795 | |
| 14796 | csr_join_req->spectrumMgtIndicator = fTmp; |
| 14797 | csr_join_req->powerCap.minTxPower = MIN_TX_PWR_CAP; |
| 14798 | /* |
| 14799 | * This is required for 11k test VoWiFi Ent: Test 2. |
| 14800 | * We need the power capabilities for Assoc Req. |
| 14801 | * This macro is provided by the halPhyCfg.h. We pick our |
| 14802 | * max and min capability by the halPhy provided macros |
Selvaraj, Sridhar | 94be8ba | 2017-05-04 17:08:54 +0530 | [diff] [blame] | 14803 | * Any change in this power cap IE should also be done |
| 14804 | * in csr_update_driver_assoc_ies() which would send |
| 14805 | * assoc IE's to FW which is used for LFR3 roaming |
| 14806 | * ie. used in reassociation requests from FW. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14807 | */ |
| 14808 | pwrLimit = csr_get_cfg_max_tx_power(pMac, |
| 14809 | pBssDescription->channelId); |
Agrawal Ashish | 6b48ee2 | 2017-02-21 20:54:53 +0530 | [diff] [blame] | 14810 | if (0 != pwrLimit && pwrLimit < MAX_TX_PWR_CAP) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14811 | csr_join_req->powerCap.maxTxPower = pwrLimit; |
| 14812 | else |
| 14813 | csr_join_req->powerCap.maxTxPower = MAX_TX_PWR_CAP; |
| 14814 | |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 14815 | csr_add_supported_5Ghz_channels(pMac, |
| 14816 | csr_join_req->supportedChannels.channelList, |
| 14817 | &csr_join_req->supportedChannels.numChnl, |
| 14818 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14819 | |
| 14820 | csr_join_req->uapsdPerAcBitmask = (uint8_t)pProfile->uapsd_mask; |
| 14821 | /* Move the entire BssDescription into the join request. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14822 | qdf_mem_copy(&csr_join_req->bssDescription, pBssDescription, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14823 | pBssDescription->length + |
| 14824 | sizeof(pBssDescription->length)); |
| 14825 | |
| 14826 | /* |
| 14827 | * conc_custom_rule1: |
| 14828 | * If SAP comes up first and STA comes up later then SAP |
| 14829 | * need to follow STA's channel in 2.4Ghz. In following if |
| 14830 | * condition we are adding sanity check, just to make sure that |
| 14831 | * if this rule is enabled then don't allow STA to connect on |
| 14832 | * 5gz channel and also by this time SAP's channel should be the |
| 14833 | * same as STA's channel. |
| 14834 | */ |
| 14835 | if (pMac->roam.configParam.conc_custom_rule1) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14836 | if ((0 == pMac->roam.configParam. |
| 14837 | is_sta_connection_in_5gz_enabled) && |
| 14838 | WLAN_REG_IS_5GHZ_CH(pBssDescription-> |
| 14839 | channelId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 14840 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 14841 | QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 14842 | "STA-conn on 5G isn't allowed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14843 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14844 | break; |
| 14845 | } |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14846 | if (!WLAN_REG_IS_5GHZ_CH(pBssDescription->channelId) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14847 | (false == csr_is_conn_allow_2g_band(pMac, |
| 14848 | pBssDescription->channelId))) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14849 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14850 | break; |
| 14851 | } |
| 14852 | } |
| 14853 | |
| 14854 | /* |
| 14855 | * conc_custom_rule2: |
| 14856 | * If P2PGO comes up first and STA comes up later then P2PGO |
| 14857 | * need to follow STA's channel in 5Ghz. In following if |
| 14858 | * condition we are just adding sanity check to make sure that |
| 14859 | * by this time P2PGO's channel is same as STA's channel. |
| 14860 | */ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 14861 | if (pMac->roam.configParam.conc_custom_rule2 && |
| 14862 | !WLAN_REG_IS_24GHZ_CH(pBssDescription->channelId) && |
| 14863 | (!csr_is_conn_allow_5g_band(pMac, |
| 14864 | pBssDescription->channelId))) { |
| 14865 | status = QDF_STATUS_E_FAILURE; |
| 14866 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14867 | } |
Selvaraj, Sridhar | 05ea079 | 2017-05-17 12:17:03 +0530 | [diff] [blame] | 14868 | |
| 14869 | if (pSession->pCurRoamProfile->csrPersona == QDF_STA_MODE) |
| 14870 | csr_join_req->enable_bcast_probe_rsp = |
| 14871 | pMac->roam.configParam.enable_bcast_probe_rsp; |
| 14872 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14873 | status = umac_send_mb_message_to_mac(csr_join_req); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14874 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14875 | /* |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14876 | * umac_send_mb_message_to_mac would've released the mem |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14877 | * allocated by csr_join_req. Let's make it defensive by |
| 14878 | * assigning NULL to the pointer. |
| 14879 | */ |
| 14880 | csr_join_req = NULL; |
| 14881 | break; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14882 | } |
| 14883 | |
| 14884 | if (pProfile->csrPersona == QDF_STA_MODE) { |
| 14885 | sme_debug("Invoking packetdump register API"); |
| 14886 | wlan_register_txrx_packetdump(); |
| 14887 | packetdump_timer_status = qdf_mc_timer_start( |
| 14888 | &pMac->roam.packetdump_timer, |
| 14889 | (PKT_DUMP_TIMER_DURATION * |
| 14890 | QDF_MC_TIMER_TO_SEC_UNIT)/ |
| 14891 | QDF_MC_TIMER_TO_MS_UNIT); |
| 14892 | if (!QDF_IS_STATUS_SUCCESS(packetdump_timer_status)) |
| 14893 | sme_err("cannot start packetdump timer status: %d", |
| 14894 | packetdump_timer_status); |
| 14895 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14896 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14897 | if (eWNI_SME_JOIN_REQ == messageType) { |
| 14898 | /* Notify QoS module that join happening */ |
| 14899 | pSession->join_bssid_count++; |
| 14900 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 14901 | "BSSID Count: %d", pSession->join_bssid_count); |
| 14902 | sme_qos_csr_event_ind(pMac, (uint8_t) sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14903 | SME_QOS_CSR_JOIN_REQ, NULL); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 14904 | } else if (eWNI_SME_REASSOC_REQ == messageType) |
| 14905 | /* Notify QoS module that reassoc happening */ |
| 14906 | sme_qos_csr_event_ind(pMac, (uint8_t) sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14907 | SME_QOS_CSR_REASSOC_REQ, |
| 14908 | NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14909 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14910 | } while (0); |
| 14911 | |
| 14912 | /* Clean up the memory in case of any failure */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14913 | if (!QDF_IS_STATUS_SUCCESS(status) && (NULL != csr_join_req)) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14914 | qdf_mem_free(csr_join_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14915 | |
Selvaraj, Sridhar | dc2ac8e | 2017-05-12 15:32:45 +0530 | [diff] [blame] | 14916 | if (wpaRsnIE) |
| 14917 | qdf_mem_free(wpaRsnIE); |
| 14918 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14919 | return status; |
| 14920 | } |
| 14921 | |
| 14922 | /* */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14923 | QDF_STATUS csr_send_mb_disassoc_req_msg(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14924 | tSirMacAddr bssId, uint16_t reasonCode) |
| 14925 | { |
| 14926 | tSirSmeDisassocReq *pMsg; |
| 14927 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 14928 | |
| 14929 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14930 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14931 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14932 | pMsg = qdf_mem_malloc(sizeof(tSirSmeDisassocReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14933 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14934 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14935 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14936 | pMsg->messageType = eWNI_SME_DISASSOC_REQ; |
| 14937 | pMsg->length = sizeof(tSirSmeDisassocReq); |
| 14938 | pMsg->sessionId = sessionId; |
| 14939 | pMsg->transactionId = 0; |
| 14940 | if ((pSession->pCurRoamProfile != NULL) |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 14941 | && (CSR_IS_INFRA_AP(pSession->pCurRoamProfile))) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14942 | qdf_mem_copy(&pMsg->bssid.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14943 | &pSession->selfMacAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14944 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14945 | qdf_mem_copy(&pMsg->peer_macaddr.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14946 | bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14947 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14948 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14949 | qdf_mem_copy(&pMsg->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14950 | bssId, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14951 | qdf_mem_copy(&pMsg->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14952 | bssId, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14953 | } |
| 14954 | pMsg->reasonCode = reasonCode; |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 14955 | pMsg->process_ho_fail = (pSession->disconnect_reason == |
| 14956 | eCSR_DISCONNECT_REASON_ROAM_HO_FAIL) ? true : false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14957 | /* |
| 14958 | * The state will be DISASSOC_HANDOFF only when we are doing |
| 14959 | * handoff. Here we should not send the disassoc over the air |
| 14960 | * to the AP |
| 14961 | */ |
Selvaraj, Sridhar | 0ab6862 | 2017-04-24 14:21:27 +0530 | [diff] [blame] | 14962 | if ((CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
| 14963 | && csr_roam_is11r_assoc(pMac, sessionId)) || |
| 14964 | pMsg->process_ho_fail) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14965 | /* Set DoNotSendOverTheAir flag to 1 only for handoff case */ |
| 14966 | pMsg->doNotSendOverTheAir = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR; |
| 14967 | } |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14968 | return umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14969 | } |
| 14970 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14971 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14972 | csr_send_mb_get_associated_stas_req_msg(tpAniSirGlobal pMac, uint32_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 14973 | QDF_MODULE_ID modId, |
| 14974 | struct qdf_mac_addr bssid, |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 14975 | void *pUsrContext, |
| 14976 | void *pfnSapEventCallback, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14977 | uint8_t *pAssocStasBuf) |
| 14978 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14979 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14980 | tSirSmeGetAssocSTAsReq *pMsg; |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 14981 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14982 | pMsg = qdf_mem_malloc(sizeof(*pMsg)); |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 14983 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14984 | return QDF_STATUS_E_NOMEM; |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 14985 | |
| 14986 | pMsg->messageType = eWNI_SME_GET_ASSOC_STAS_REQ; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 14987 | qdf_copy_macaddr(&pMsg->bssid, &bssid); |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 14988 | pMsg->modId = modId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14989 | qdf_mem_copy(pMsg->pUsrContext, pUsrContext, sizeof(void *)); |
| 14990 | qdf_mem_copy(pMsg->pSapEventCallback, |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 14991 | pfnSapEventCallback, sizeof(void *)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 14992 | qdf_mem_copy(pMsg->pAssocStasArray, pAssocStasBuf, sizeof(void *)); |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 14993 | pMsg->length = sizeof(*pMsg); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 14994 | status = umac_send_mb_message_to_mac(pMsg); |
Srinivas Girigowda | 61de4bb | 2015-11-25 15:46:41 -0800 | [diff] [blame] | 14995 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 14996 | return status; |
| 14997 | } |
| 14998 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 14999 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15000 | csr_send_mb_get_wpspbc_sessions(tpAniSirGlobal pMac, uint32_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15001 | struct qdf_mac_addr bssid, void *pUsrContext, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15002 | void *pfnSapEventCallback, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15003 | struct qdf_mac_addr remove_mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15004 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15005 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15006 | tSirSmeGetWPSPBCSessionsReq *pMsg; |
| 15007 | |
| 15008 | do { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15009 | pMsg = qdf_mem_malloc(sizeof(tSirSmeGetWPSPBCSessionsReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15010 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15011 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15012 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15013 | status = QDF_STATUS_SUCCESS; |
| 15014 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15015 | break; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15016 | qdf_mem_set(pMsg, sizeof(tSirSmeGetWPSPBCSessionsReq), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15017 | pMsg->messageType = eWNI_SME_GET_WPSPBC_SESSION_REQ; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15018 | qdf_mem_copy(pMsg->pUsrContext, pUsrContext, sizeof(void *)); |
| 15019 | qdf_mem_copy(pMsg->pSapEventCallback, pfnSapEventCallback, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15020 | sizeof(void *)); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15021 | qdf_copy_macaddr(&pMsg->bssid, &bssid); |
| 15022 | qdf_copy_macaddr(&pMsg->remove_mac, &remove_mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15023 | pMsg->length = sizeof(struct sSirSmeGetWPSPBCSessionsReq); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15024 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15025 | } while (0); |
| 15026 | return status; |
| 15027 | } |
| 15028 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15029 | QDF_STATUS csr_send_chng_mcc_beacon_interval(tpAniSirGlobal pMac, |
| 15030 | uint32_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15031 | { |
| 15032 | tpSirChangeBIParams pMsg; |
| 15033 | uint16_t len = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15034 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15035 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 15036 | |
| 15037 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15038 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15039 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15040 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15041 | /* NO need to update the Beacon Params if update beacon parameter flag |
| 15042 | * is not set |
| 15043 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15044 | if (!pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15045 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15046 | |
| 15047 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = |
| 15048 | false; |
| 15049 | |
| 15050 | /* Create the message and send to lim */ |
| 15051 | len = sizeof(tSirChangeBIParams); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15052 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15053 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15054 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15055 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15056 | status = QDF_STATUS_SUCCESS; |
| 15057 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15058 | pMsg->messageType = eWNI_SME_CHNG_MCC_BEACON_INTERVAL; |
| 15059 | pMsg->length = len; |
| 15060 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15061 | qdf_copy_macaddr(&pMsg->bssid, &pSession->selfMacAddr); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15062 | sme_debug( |
| 15063 | "CSR Attempting to change BI for Bssid= " |
| 15064 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMsg->bssid.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15065 | pMsg->sessionId = sessionId; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15066 | sme_debug("session %d BeaconInterval %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15067 | sessionId, |
| 15068 | pMac->roam.roamSession[sessionId].bssParams. |
| 15069 | beaconInterval); |
| 15070 | pMsg->beaconInterval = |
| 15071 | pMac->roam.roamSession[sessionId].bssParams.beaconInterval; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15072 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15073 | } |
| 15074 | return status; |
| 15075 | } |
| 15076 | |
| 15077 | #ifdef QCA_HT_2040_COEX |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15078 | QDF_STATUS csr_set_ht2040_mode(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15079 | ePhyChanBondState cbMode, bool obssEnabled) |
| 15080 | { |
| 15081 | tpSirSetHT2040Mode pMsg; |
| 15082 | uint16_t len = 0; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15083 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15084 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 15085 | |
| 15086 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15087 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15088 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15089 | } |
| 15090 | |
| 15091 | /* Create the message and send to lim */ |
| 15092 | len = sizeof(tSirSetHT2040Mode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15093 | pMsg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15094 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15095 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15096 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15097 | status = QDF_STATUS_SUCCESS; |
| 15098 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15099 | qdf_mem_set(pMsg, sizeof(tSirSetHT2040Mode), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15100 | pMsg->messageType = eWNI_SME_SET_HT_2040_MODE; |
| 15101 | pMsg->length = len; |
| 15102 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15103 | qdf_copy_macaddr(&pMsg->bssid, &pSession->selfMacAddr); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15104 | sme_debug( |
| 15105 | "CSR Attempting to set HT20/40 mode for Bssid= " |
| 15106 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMsg->bssid.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15107 | pMsg->sessionId = sessionId; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15108 | sme_debug(" session %d HT20/40 mode %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15109 | sessionId, cbMode); |
| 15110 | pMsg->cbMode = cbMode; |
| 15111 | pMsg->obssEnabled = obssEnabled; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15112 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15113 | } |
| 15114 | return status; |
| 15115 | } |
| 15116 | #endif |
| 15117 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15118 | QDF_STATUS csr_send_mb_deauth_req_msg(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15119 | tSirMacAddr bssId, uint16_t reasonCode) |
| 15120 | { |
| 15121 | tSirSmeDeauthReq *pMsg; |
| 15122 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 15123 | |
| 15124 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15125 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15126 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15127 | pMsg = qdf_mem_malloc(sizeof(tSirSmeDeauthReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15128 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15129 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15130 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15131 | qdf_mem_set(pMsg, sizeof(tSirSmeDeauthReq), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15132 | pMsg->messageType = eWNI_SME_DEAUTH_REQ; |
| 15133 | pMsg->length = sizeof(tSirSmeDeauthReq); |
| 15134 | pMsg->sessionId = sessionId; |
| 15135 | pMsg->transactionId = 0; |
| 15136 | |
| 15137 | if ((pSession->pCurRoamProfile != NULL) |
Sandeep Puligilla | ee029ad | 2015-10-26 18:58:00 -0700 | [diff] [blame] | 15138 | && (CSR_IS_INFRA_AP(pSession->pCurRoamProfile))) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15139 | qdf_mem_copy(&pMsg->bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15140 | &pSession->selfMacAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15141 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15142 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15143 | qdf_mem_copy(&pMsg->bssid, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15144 | bssId, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15145 | } |
| 15146 | |
| 15147 | /* Set the peer MAC address before sending the message to LIM */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15148 | qdf_mem_copy(&pMsg->peer_macaddr.bytes, bssId, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15149 | pMsg->reasonCode = reasonCode; |
| 15150 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15151 | return umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15152 | } |
| 15153 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15154 | QDF_STATUS csr_send_mb_disassoc_cnf_msg(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15155 | tpSirSmeDisassocInd pDisassocInd) |
| 15156 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15157 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15158 | tSirSmeDisassocCnf *pMsg; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15159 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15160 | do { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15161 | pMsg = qdf_mem_malloc(sizeof(tSirSmeDisassocCnf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15162 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15163 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15164 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15165 | status = QDF_STATUS_SUCCESS; |
| 15166 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15167 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15168 | pMsg->messageType = eWNI_SME_DISASSOC_CNF; |
| 15169 | pMsg->statusCode = eSIR_SME_SUCCESS; |
| 15170 | pMsg->length = sizeof(tSirSmeDisassocCnf); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15171 | qdf_copy_macaddr(&pMsg->peer_macaddr, |
Srinivas Girigowda | e13cc34 | 2016-01-05 17:07:53 -0800 | [diff] [blame] | 15172 | &pDisassocInd->peer_macaddr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15173 | status = QDF_STATUS_SUCCESS; |
| 15174 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15175 | qdf_mem_free(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15176 | break; |
| 15177 | } |
| 15178 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15179 | qdf_copy_macaddr(&pMsg->bssid, &pDisassocInd->bssid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15180 | status = QDF_STATUS_SUCCESS; |
| 15181 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15182 | qdf_mem_free(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15183 | break; |
| 15184 | } |
| 15185 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15186 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15187 | } while (0); |
| 15188 | return status; |
| 15189 | } |
| 15190 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15191 | QDF_STATUS csr_send_mb_deauth_cnf_msg(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15192 | tpSirSmeDeauthInd pDeauthInd) |
| 15193 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15194 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15195 | tSirSmeDeauthCnf *pMsg; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15196 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15197 | do { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15198 | pMsg = qdf_mem_malloc(sizeof(tSirSmeDeauthCnf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15199 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15200 | status = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15201 | else |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15202 | status = QDF_STATUS_SUCCESS; |
| 15203 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15204 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15205 | pMsg->messageType = eWNI_SME_DEAUTH_CNF; |
| 15206 | pMsg->statusCode = eSIR_SME_SUCCESS; |
| 15207 | pMsg->length = sizeof(tSirSmeDeauthCnf); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15208 | qdf_copy_macaddr(&pMsg->bssid, &pDeauthInd->bssid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15209 | status = QDF_STATUS_SUCCESS; |
| 15210 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15211 | qdf_mem_free(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15212 | break; |
| 15213 | } |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15214 | qdf_copy_macaddr(&pMsg->peer_macaddr, |
Srinivas Girigowda | 5f3c81a | 2016-01-04 21:47:19 -0800 | [diff] [blame] | 15215 | &pDeauthInd->peer_macaddr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15216 | status = QDF_STATUS_SUCCESS; |
| 15217 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15218 | qdf_mem_free(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15219 | break; |
| 15220 | } |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15221 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15222 | } while (0); |
| 15223 | return status; |
| 15224 | } |
| 15225 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15226 | QDF_STATUS csr_send_assoc_cnf_msg(tpAniSirGlobal pMac, tpSirSmeAssocInd |
| 15227 | pAssocInd, QDF_STATUS Halstatus) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15228 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15229 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15230 | tSirSmeAssocCnf *pMsg; |
| 15231 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15232 | sme_debug("Posting eWNI_SME_ASSOC_CNF to LIM.HalStatus: %d", Halstatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15233 | do { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15234 | pMsg = qdf_mem_malloc(sizeof(tSirSmeAssocCnf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15235 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15236 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15237 | pMsg->messageType = eWNI_SME_ASSOC_CNF; |
| 15238 | pMsg->length = sizeof(tSirSmeAssocCnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15239 | if (QDF_IS_STATUS_SUCCESS(Halstatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15240 | pMsg->statusCode = eSIR_SME_SUCCESS; |
| 15241 | else |
| 15242 | pMsg->statusCode = eSIR_SME_ASSOC_REFUSED; |
| 15243 | /* bssId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15244 | qdf_mem_copy(pMsg->bssid.bytes, pAssocInd->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15245 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15246 | /* peerMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15247 | qdf_mem_copy(pMsg->peer_macaddr.bytes, pAssocInd->peerMacAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15248 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15249 | /* aid */ |
| 15250 | pMsg->aid = pAssocInd->aid; |
| 15251 | /* alternateBssId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15252 | qdf_mem_copy(pMsg->alternate_bssid.bytes, pAssocInd->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15253 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15254 | /* alternateChannelId */ |
| 15255 | pMsg->alternateChannelId = 11; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15256 | /* pMsg is freed by umac_send_mb_message_to_mac in anycase*/ |
| 15257 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15258 | } while (0); |
| 15259 | return status; |
| 15260 | } |
| 15261 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15262 | QDF_STATUS csr_send_assoc_ind_to_upper_layer_cnf_msg(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15263 | tpSirSmeAssocInd pAssocInd, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15264 | QDF_STATUS Halstatus, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15265 | uint8_t sessionId) |
| 15266 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 15267 | struct scheduler_msg msgQ = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15268 | tSirSmeAssocIndToUpperLayerCnf *pMsg; |
| 15269 | uint8_t *pBuf; |
| 15270 | tSirResultCodes statusCode; |
| 15271 | uint16_t wTmp; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15272 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15273 | do { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15274 | pMsg = qdf_mem_malloc(sizeof(tSirSmeAssocIndToUpperLayerCnf)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15275 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15276 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15277 | |
| 15278 | pMsg->messageType = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 15279 | pMsg->length = sizeof(tSirSmeAssocIndToUpperLayerCnf); |
| 15280 | |
| 15281 | pMsg->sessionId = sessionId; |
| 15282 | |
| 15283 | pBuf = (uint8_t *) &pMsg->statusCode; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15284 | if (QDF_IS_STATUS_SUCCESS(Halstatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15285 | statusCode = eSIR_SME_SUCCESS; |
| 15286 | else |
| 15287 | statusCode = eSIR_SME_ASSOC_REFUSED; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15288 | qdf_mem_copy(pBuf, &statusCode, sizeof(tSirResultCodes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15289 | /* bssId */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15290 | pBuf = (uint8_t *)&pMsg->bssId; |
| 15291 | qdf_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, |
| 15292 | sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15293 | /* peerMacAddr */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15294 | pBuf = (uint8_t *)&pMsg->peerMacAddr; |
| 15295 | qdf_mem_copy((tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, |
| 15296 | sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15297 | /* StaId */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15298 | pBuf = (uint8_t *)&pMsg->aid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15299 | wTmp = pAssocInd->staId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15300 | qdf_mem_copy(pBuf, &wTmp, sizeof(uint16_t)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15301 | /* alternateBssId */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15302 | pBuf = (uint8_t *)&pMsg->alternateBssId; |
| 15303 | qdf_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, |
| 15304 | sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15305 | /* alternateChannelId */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15306 | pBuf = (uint8_t *)&pMsg->alternateChannelId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15307 | *pBuf = 11; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15308 | /* |
| 15309 | * Instead of copying roam Info,just copy WmmEnabled, |
| 15310 | * RsnIE information. |
| 15311 | * Wmm |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15312 | */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15313 | pBuf = (uint8_t *)&pMsg->wmmEnabledSta; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15314 | *pBuf = pAssocInd->wmmEnabledSta; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15315 | /* RSN IE */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15316 | pBuf = (uint8_t *)&pMsg->rsnIE; |
| 15317 | qdf_mem_copy((tSirRSNie *)pBuf, &pAssocInd->rsnIE, |
| 15318 | sizeof(tSirRSNie)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15319 | #ifdef FEATURE_WLAN_WAPI |
| 15320 | /* WAPI IE */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15321 | pBuf = (uint8_t *)&pMsg->wapiIE; |
| 15322 | qdf_mem_copy((tSirWAPIie *)pBuf, &pAssocInd->wapiIE, |
| 15323 | sizeof(tSirWAPIie)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15324 | #endif |
| 15325 | /* Additional IE */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15326 | pBuf = (uint8_t *)&pMsg->addIE; |
| 15327 | qdf_mem_copy((tSirAddie *)pBuf, &pAssocInd->addIE, |
| 15328 | sizeof(tSirAddie)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15329 | /* reassocReq */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15330 | pBuf = (uint8_t *)&pMsg->reassocReq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15331 | *pBuf = pAssocInd->reassocReq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15332 | /* timingMeasCap */ |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15333 | pBuf = (uint8_t *)&pMsg->timingMeasCap; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15334 | *pBuf = pAssocInd->timingMeasCap; |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15335 | /* chan_info */ |
| 15336 | pBuf = (uint8_t *)&pMsg->chan_info; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15337 | qdf_mem_copy((void *)pBuf, &pAssocInd->chan_info, |
Will Huang | 558f808 | 2017-05-31 16:22:24 +0800 | [diff] [blame] | 15338 | sizeof(tSirSmeChanInfo)); |
| 15339 | /* ampdu */ |
| 15340 | pBuf = (uint8_t *)&pMsg->ampdu; |
| 15341 | *((bool *)pBuf) = pAssocInd->ampdu; |
| 15342 | /* sgi_enable */ |
| 15343 | pBuf = (uint8_t *)&pMsg->sgi_enable; |
| 15344 | *((bool *)pBuf) = pAssocInd->sgi_enable; |
| 15345 | /* tx stbc */ |
| 15346 | pBuf = (uint8_t *)&pMsg->tx_stbc; |
| 15347 | *((bool *)pBuf) = pAssocInd->tx_stbc; |
| 15348 | /* ch_width */ |
| 15349 | pBuf = (uint8_t *)&pMsg->ch_width; |
| 15350 | *((tSirMacHTChannelWidth *)pBuf) = pAssocInd->ch_width; |
| 15351 | /* mode */ |
| 15352 | pBuf = (uint8_t *)&pMsg->mode; |
| 15353 | *((enum sir_sme_phy_mode *)pBuf) = pAssocInd->mode; |
| 15354 | /* rx stbc */ |
| 15355 | pBuf = (uint8_t *)&pMsg->rx_stbc; |
| 15356 | *((bool *)pBuf) = pAssocInd->rx_stbc; |
| 15357 | /* max supported idx */ |
| 15358 | pBuf = (uint8_t *)&pMsg->max_supp_idx; |
| 15359 | *pBuf = pAssocInd->max_supp_idx; |
| 15360 | /* max extended idx */ |
| 15361 | pBuf = (uint8_t *)&pMsg->max_ext_idx; |
| 15362 | *pBuf = pAssocInd->max_ext_idx; |
| 15363 | /* max ht mcs idx */ |
| 15364 | pBuf = (uint8_t *)&pMsg->max_mcs_idx; |
| 15365 | *pBuf = pAssocInd->max_mcs_idx; |
| 15366 | /* vht rx mcs map */ |
| 15367 | pBuf = (uint8_t *)&pMsg->rx_mcs_map; |
| 15368 | *pBuf = pAssocInd->rx_mcs_map; |
| 15369 | /* vht tx mcs map */ |
| 15370 | pBuf = (uint8_t *)&pMsg->tx_mcs_map; |
| 15371 | *pBuf = pAssocInd->tx_mcs_map; |
| 15372 | |
gaolez | 7bb1e74 | 2017-03-21 16:37:38 +0800 | [diff] [blame] | 15373 | pBuf = (uint8_t *)&pMsg->ecsa_capable; |
| 15374 | *pBuf = pAssocInd->ecsa_capable; |
| 15375 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15376 | msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 15377 | msgQ.bodyptr = pMsg; |
| 15378 | msgQ.bodyval = 0; |
| 15379 | sys_process_mmh_msg(pMac, &msgQ); |
| 15380 | } while (0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15381 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15382 | } |
| 15383 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15384 | QDF_STATUS csr_send_mb_set_context_req_msg(tpAniSirGlobal pMac, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 15385 | uint32_t sessionId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 15386 | struct qdf_mac_addr peer_macaddr, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 15387 | uint8_t numKeys, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15388 | tAniEdType edType, bool fUnicast, |
| 15389 | tAniKeyDirection aniKeyDirection, |
| 15390 | uint8_t keyId, uint8_t keyLength, |
| 15391 | uint8_t *pKey, uint8_t paeRole, |
| 15392 | uint8_t *pKeyRsc) |
| 15393 | { |
| 15394 | tSirSmeSetContextReq *pMsg; |
Abhishek Singh | 154637a | 2017-06-19 18:02:11 +0530 | [diff] [blame] | 15395 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15396 | uint16_t msgLen; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15397 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15398 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15399 | |
| 15400 | sme_debug("keylength: %d Encry type: %d", keyLength, edType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15401 | do { |
| 15402 | if ((1 != numKeys) && (0 != numKeys)) |
| 15403 | break; |
| 15404 | /* |
| 15405 | * All of these fields appear in every SET_CONTEXT message. |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15406 | * Below we'll add in the size for each key set. Since we only |
| 15407 | * support up to one key, we always allocate memory for 1 key. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15408 | */ |
| 15409 | msgLen = sizeof(struct sSirSmeSetContextReq); |
| 15410 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15411 | pMsg = qdf_mem_malloc(msgLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15412 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15413 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15414 | pMsg->messageType = eWNI_SME_SETCONTEXT_REQ; |
| 15415 | pMsg->length = msgLen; |
| 15416 | pMsg->sessionId = (uint8_t) sessionId; |
| 15417 | pMsg->transactionId = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15418 | qdf_copy_macaddr(&pMsg->peer_macaddr, &peer_macaddr); |
| 15419 | qdf_copy_macaddr(&pMsg->bssid, |
Srinivas Girigowda | d5965c4 | 2015-12-04 13:43:16 -0800 | [diff] [blame] | 15420 | &pSession->connectedProfile.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15421 | |
| 15422 | /** |
| 15423 | * Set the pMsg->keyMaterial.length field |
| 15424 | * (this length is defined as all data that follows the |
| 15425 | * edType field in the tSirKeyMaterial keyMaterial; field). |
| 15426 | * |
| 15427 | * NOTE: This keyMaterial.length contains the length of a |
| 15428 | * MAX size key, though the keyLength can be shorter than this |
| 15429 | * max size. Is LIM interpreting this ok ? |
| 15430 | */ |
| 15431 | pMsg->keyMaterial.length = |
| 15432 | sizeof(pMsg->keyMaterial.numKeys) + |
| 15433 | (numKeys * sizeof(pMsg->keyMaterial.key)); |
| 15434 | pMsg->keyMaterial.edType = edType; |
| 15435 | pMsg->keyMaterial.numKeys = numKeys; |
| 15436 | pMsg->keyMaterial.key[0].keyId = keyId; |
| 15437 | pMsg->keyMaterial.key[0].unicast = fUnicast; |
| 15438 | pMsg->keyMaterial.key[0].keyDirection = aniKeyDirection; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15439 | qdf_mem_copy(pMsg->keyMaterial.key[0].keyRsc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15440 | pKeyRsc, CSR_MAX_RSC_LEN); |
| 15441 | /* 0 is Supplicant */ |
| 15442 | pMsg->keyMaterial.key[0].paeRole = paeRole; |
| 15443 | pMsg->keyMaterial.key[0].keyLength = keyLength; |
Sreelakshmi Konamki | 66ddf3a | 2017-02-28 17:29:43 +0530 | [diff] [blame] | 15444 | if (keyLength && pKey) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15445 | qdf_mem_copy(pMsg->keyMaterial.key[0].key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15446 | pKey, keyLength); |
Abhishek Singh | 154637a | 2017-06-19 18:02:11 +0530 | [diff] [blame] | 15447 | |
| 15448 | msg.type = eWNI_SME_SETCONTEXT_REQ; |
| 15449 | msg.bodyptr = pMsg; |
| 15450 | status = scheduler_post_msg_by_priority(QDF_MODULE_ID_PE, &msg, true); |
| 15451 | if (QDF_IS_STATUS_ERROR(status)) |
| 15452 | qdf_mem_free(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15453 | } while (0); |
| 15454 | return status; |
| 15455 | } |
| 15456 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15457 | QDF_STATUS csr_send_mb_start_bss_req_msg(tpAniSirGlobal pMac, uint32_t |
| 15458 | sessionId, eCsrRoamBssType bssType, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15459 | tCsrRoamStartBssParams *pParam, |
| 15460 | tSirBssDescription *pBssDesc) |
| 15461 | { |
| 15462 | tSirSmeStartBssReq *pMsg; |
| 15463 | uint16_t wTmp; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 15464 | uint32_t value = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15465 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 15466 | |
| 15467 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15468 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15469 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15470 | } |
| 15471 | |
| 15472 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 15473 | pSession->joinFailStatusCode.reasonCode = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15474 | pMsg = qdf_mem_malloc(sizeof(tSirSmeStartBssReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15475 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15476 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15477 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15478 | pMsg->messageType = eWNI_SME_START_BSS_REQ; |
| 15479 | pMsg->sessionId = sessionId; |
| 15480 | pMsg->length = sizeof(tSirSmeStartBssReq); |
| 15481 | pMsg->transactionId = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15482 | qdf_copy_macaddr(&pMsg->bssid, &pParam->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15483 | /* selfMacAddr */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15484 | qdf_copy_macaddr(&pMsg->self_macaddr, &pSession->selfMacAddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15485 | /* beaconInterval */ |
| 15486 | if (pBssDesc && pBssDesc->beaconInterval) |
| 15487 | wTmp = pBssDesc->beaconInterval; |
| 15488 | else if (pParam->beaconInterval) |
| 15489 | wTmp = pParam->beaconInterval; |
| 15490 | else |
| 15491 | wTmp = WNI_CFG_BEACON_INTERVAL_STADEF; |
| 15492 | |
Krunal Soni | cbda855 | 2016-07-14 19:39:02 -0700 | [diff] [blame] | 15493 | csr_validate_mcc_beacon_interval(pMac, pParam->operationChn, |
| 15494 | &wTmp, sessionId, pParam->bssPersona); |
| 15495 | /* Update the beacon Interval */ |
| 15496 | pParam->beaconInterval = wTmp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15497 | pMsg->beaconInterval = wTmp; |
| 15498 | pMsg->dot11mode = |
| 15499 | csr_translate_to_wni_cfg_dot11_mode(pMac, |
| 15500 | pParam->uCfgDot11Mode); |
| 15501 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 15502 | pMsg->cc_switch_mode = pMac->roam.configParam.cc_switch_mode; |
| 15503 | #endif |
| 15504 | pMsg->bssType = csr_translate_bsstype_to_mac_type(bssType); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15505 | qdf_mem_copy(&pMsg->ssId, &pParam->ssId, sizeof(pParam->ssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15506 | pMsg->channelId = pParam->operationChn; |
| 15507 | /* What should we really do for the cbmode. */ |
| 15508 | pMsg->cbMode = (ePhyChanBondState) pParam->cbMode; |
| 15509 | pMsg->vht_channel_width = pParam->ch_params.ch_width; |
| 15510 | pMsg->center_freq_seg0 = pParam->ch_params.center_freq_seg0; |
| 15511 | pMsg->center_freq_seg1 = pParam->ch_params.center_freq_seg1; |
| 15512 | pMsg->sec_ch_offset = pParam->ch_params.sec_ch_offset; |
| 15513 | pMsg->privacy = pParam->privacy; |
| 15514 | pMsg->apUapsdEnable = pParam->ApUapsdEnable; |
| 15515 | pMsg->ssidHidden = pParam->ssidHidden; |
| 15516 | pMsg->fwdWPSPBCProbeReq = (uint8_t) pParam->fwdWPSPBCProbeReq; |
| 15517 | pMsg->protEnabled = (uint8_t) pParam->protEnabled; |
| 15518 | pMsg->obssProtEnabled = (uint8_t) pParam->obssProtEnabled; |
| 15519 | /* set cfg related to protection */ |
| 15520 | pMsg->ht_capab = pParam->ht_protection; |
| 15521 | pMsg->authType = pParam->authType; |
| 15522 | pMsg->dtimPeriod = pParam->dtimPeriod; |
| 15523 | pMsg->wps_state = pParam->wps_state; |
| 15524 | pMsg->isCoalesingInIBSSAllowed = pMac->isCoalesingInIBSSAllowed; |
| 15525 | pMsg->bssPersona = pParam->bssPersona; |
Krunal Soni | a2c0e41 | 2017-05-04 14:12:41 +0530 | [diff] [blame] | 15526 | pMsg->txLdpcIniFeatureEnabled = pMac->roam.configParam.tx_ldpc_enable; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 15527 | |
jiad | 4a7a33c | 2017-08-08 15:32:24 +0800 | [diff] [blame] | 15528 | /* |
| 15529 | * If RX LDPC has been disabled for 2.4GHz channels and enabled |
| 15530 | * for 5Ghz for STA like persona then here is how to handle |
| 15531 | * those cases (by now channel has been decided). |
| 15532 | */ |
| 15533 | if (eSIR_IBSS_MODE == pMsg->bssType || |
| 15534 | !policy_mgr_is_dbs_enable(pMac->psoc)) |
| 15535 | csr_set_ldpc_exception(pMac, pSession, |
| 15536 | pMsg->channelId, |
| 15537 | pMac->roam.configParam.rx_ldpc_enable); |
| 15538 | |
Kiran Kumar Lokere | 26d0548 | 2017-05-17 12:47:49 -0700 | [diff] [blame] | 15539 | qdf_mem_copy(&pMsg->vht_config, |
| 15540 | &pSession->vht_config, |
| 15541 | sizeof(pSession->vht_config)); |
| 15542 | qdf_mem_copy(&pMsg->htConfig, |
| 15543 | &pSession->htConfig, |
| 15544 | sizeof(tSirHTConfig)); |
| 15545 | |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 15546 | if (wlan_cfg_get_int(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, &value) |
| 15547 | != eSIR_SUCCESS) |
| 15548 | QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15549 | "could not get SU beam formee capability"); |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 15550 | pMsg->vht_config.su_beam_formee = |
| 15551 | (uint8_t)value && |
Kiran Kumar Lokere | 5302ab6 | 2015-12-16 16:03:16 -0800 | [diff] [blame] | 15552 | (uint8_t)pMac->roam.configParam.enable_txbf_sap_mode; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 15553 | if (wlan_cfg_get_int(pMac, |
| 15554 | WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, |
| 15555 | &value) != eSIR_SUCCESS) |
| 15556 | QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15557 | ("Failed to get CSN beamformee capability")); |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 15558 | pMsg->vht_config.csnof_beamformer_antSup = (uint8_t)value; |
Kiran Kumar Lokere | 26d0548 | 2017-05-17 12:47:49 -0700 | [diff] [blame] | 15559 | pMsg->vht_config.mu_beam_formee = 0; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 15560 | |
Kiran Kumar Lokere | 26d0548 | 2017-05-17 12:47:49 -0700 | [diff] [blame] | 15561 | sme_debug("ht capability 0x%x VHT capability 0x%x", |
| 15562 | (uint32_t)(*(uint32_t *) &pMsg->htConfig), |
| 15563 | (uint32_t)(*(uint32_t *) &pMsg->vht_config)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15564 | #ifdef WLAN_FEATURE_11W |
| 15565 | pMsg->pmfCapable = pParam->mfpCapable; |
| 15566 | pMsg->pmfRequired = pParam->mfpRequired; |
| 15567 | #endif |
| 15568 | |
| 15569 | if (pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15570 | qdf_mem_free(pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15571 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15572 | } |
| 15573 | pMsg->rsnIE.length = pParam->nRSNIELength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15574 | qdf_mem_copy(pMsg->rsnIE.rsnIEdata, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15575 | pParam->pRSNIE, |
| 15576 | pParam->nRSNIELength); |
| 15577 | pMsg->nwType = (tSirNwType)pParam->sirNwType; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15578 | qdf_mem_copy(&pMsg->operationalRateSet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15579 | &pParam->operationalRateSet, |
| 15580 | sizeof(tSirMacRateSet)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15581 | qdf_mem_copy(&pMsg->extendedRateSet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15582 | &pParam->extendedRateSet, |
| 15583 | sizeof(tSirMacRateSet)); |
jiad | 4a7a33c | 2017-08-08 15:32:24 +0800 | [diff] [blame] | 15584 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 15585 | if (IS_DOT11_MODE_HE(pMsg->dot11mode)) |
| 15586 | csr_start_bss_copy_he_cap(pMsg, pSession); |
| 15587 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15588 | qdf_mem_copy(&pMsg->addIeParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15589 | &pParam->addIeParams, |
| 15590 | sizeof(pParam->addIeParams)); |
| 15591 | pMsg->obssEnabled = pMac->roam.configParam.obssEnabled; |
| 15592 | pMsg->sap_dot11mc = pParam->sap_dot11mc; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 15593 | pMsg->vendor_vht_sap = |
| 15594 | pMac->roam.configParam.vendor_vht_sap; |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 15595 | pMsg->cac_duration_ms = pParam->cac_duration_ms; |
| 15596 | pMsg->dfs_regdomain = pParam->dfs_regdomain; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15597 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15598 | return umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15599 | } |
| 15600 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15601 | QDF_STATUS csr_send_mb_stop_bss_req_msg(tpAniSirGlobal pMac, uint32_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15602 | { |
| 15603 | tSirSmeStopBssReq *pMsg; |
| 15604 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 15605 | |
| 15606 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15607 | sme_err("session %d not found", sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15608 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15609 | } |
| 15610 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15611 | pMsg = qdf_mem_malloc(sizeof(tSirSmeStopBssReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15612 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15613 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15614 | pMsg->messageType = eWNI_SME_STOP_BSS_REQ; |
| 15615 | pMsg->sessionId = sessionId; |
| 15616 | pMsg->length = sizeof(tSirSmeStopBssReq); |
| 15617 | pMsg->transactionId = 0; |
| 15618 | pMsg->reasonCode = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 15619 | qdf_copy_macaddr(&pMsg->bssid, &pSession->connectedProfile.bssid); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15620 | return umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15621 | } |
| 15622 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15623 | QDF_STATUS csr_reassoc(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15624 | tCsrRoamModifyProfileFields *pModProfileFields, |
| 15625 | uint32_t *pRoamId, bool fForce) |
| 15626 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15627 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15628 | uint32_t roamId = 0; |
| 15629 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15630 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15631 | if ((csr_is_conn_state_connected(pMac, sessionId)) && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15632 | (fForce || (qdf_mem_cmp(&pModProfileFields, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15633 | &pSession->connectedProfile. |
| 15634 | modifyProfileFields, |
| 15635 | sizeof(tCsrRoamModifyProfileFields))))) { |
| 15636 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15637 | if (pRoamId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15638 | *pRoamId = roamId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15639 | |
| 15640 | status = |
| 15641 | csr_roam_issue_reassoc(pMac, sessionId, NULL, |
| 15642 | pModProfileFields, |
| 15643 | eCsrSmeIssuedReassocToSameAP, |
| 15644 | roamId, false); |
| 15645 | } |
| 15646 | return status; |
| 15647 | } |
| 15648 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15649 | static QDF_STATUS csr_roam_session_opened(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15650 | uint32_t sessionId) |
| 15651 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15652 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15653 | tCsrRoamInfo roamInfo; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 15654 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15655 | qdf_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15656 | status = csr_roam_call_callback(pMac, sessionId, &roamInfo, 0, |
| 15657 | eCSR_ROAM_SESSION_OPENED, |
| 15658 | eCSR_ROAM_RESULT_NONE); |
Kiran Kumar Lokere | 3beeb95 | 2017-05-02 18:40:24 -0700 | [diff] [blame] | 15659 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15660 | return status; |
| 15661 | } |
| 15662 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15663 | QDF_STATUS csr_process_add_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15664 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15665 | struct add_sta_self_params *rsp; |
| 15666 | struct send_extcap_ie *msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15667 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15668 | |
| 15669 | if (pMsg == NULL) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15670 | sme_err("in %s msg ptr is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15671 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15672 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15673 | rsp = (struct add_sta_self_params *) pMsg; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15674 | sme_debug("Add Sta self rsp status = %d", rsp->status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15675 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15676 | if (QDF_STATUS_SUCCESS == rsp->status && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15677 | (WMI_VDEV_TYPE_STA == rsp->type || |
| 15678 | (WMI_VDEV_TYPE_AP == rsp->type && |
| 15679 | WMI_UNIFIED_VDEV_SUBTYPE_P2P_DEVICE == rsp->sub_type))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15680 | sme_debug("send SET IE msg to PE"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15681 | msg = qdf_mem_malloc(sizeof(*msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15682 | if (NULL == msg) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15683 | sme_err("Memory allocation failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15684 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15685 | } |
| 15686 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15687 | msg->msg_type = eWNI_SME_SET_IE_REQ; |
| 15688 | msg->session_id = rsp->session_id; |
| 15689 | msg->length = sizeof(*msg); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 15690 | status = umac_send_mb_message_to_mac(msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15691 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15692 | sme_err("Failed to send down the set IE req "); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15693 | } |
| 15694 | |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 15695 | csr_roam_session_opened(pMac, rsp->session_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15696 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15697 | } |
| 15698 | |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 15699 | /** |
| 15700 | * csr_get_vdev_type_nss() - gets the nss value based on vdev type |
| 15701 | * @mac_ctx: Pointer to Global MAC structure |
| 15702 | * @dev_mode: current device operating mode. |
| 15703 | * @nss2g: Pointer to the 2G Nss parameter. |
| 15704 | * @nss5g: Pointer to the 5G Nss parameter. |
| 15705 | * |
| 15706 | * Fills the 2G and 5G Nss values based on device mode. |
| 15707 | * |
| 15708 | * Return: None |
| 15709 | */ |
| 15710 | void csr_get_vdev_type_nss(tpAniSirGlobal mac_ctx, |
| 15711 | enum tQDF_ADAPTER_MODE dev_mode, |
| 15712 | uint8_t *nss_2g, uint8_t *nss_5g) |
| 15713 | { |
| 15714 | switch (dev_mode) { |
| 15715 | case QDF_STA_MODE: |
| 15716 | *nss_2g = mac_ctx->vdev_type_nss_2g.sta; |
| 15717 | *nss_5g = mac_ctx->vdev_type_nss_5g.sta; |
| 15718 | break; |
| 15719 | case QDF_SAP_MODE: |
| 15720 | *nss_2g = mac_ctx->vdev_type_nss_2g.sap; |
| 15721 | *nss_5g = mac_ctx->vdev_type_nss_5g.sap; |
| 15722 | break; |
| 15723 | case QDF_P2P_CLIENT_MODE: |
| 15724 | *nss_2g = mac_ctx->vdev_type_nss_2g.p2p_cli; |
| 15725 | *nss_5g = mac_ctx->vdev_type_nss_5g.p2p_cli; |
| 15726 | break; |
| 15727 | case QDF_P2P_GO_MODE: |
| 15728 | *nss_2g = mac_ctx->vdev_type_nss_2g.p2p_go; |
| 15729 | *nss_5g = mac_ctx->vdev_type_nss_5g.p2p_go; |
| 15730 | break; |
| 15731 | case QDF_P2P_DEVICE_MODE: |
| 15732 | *nss_2g = mac_ctx->vdev_type_nss_2g.p2p_dev; |
| 15733 | *nss_5g = mac_ctx->vdev_type_nss_5g.p2p_dev; |
| 15734 | break; |
| 15735 | case QDF_IBSS_MODE: |
| 15736 | *nss_2g = mac_ctx->vdev_type_nss_2g.ibss; |
| 15737 | *nss_5g = mac_ctx->vdev_type_nss_5g.ibss; |
| 15738 | break; |
| 15739 | case QDF_OCB_MODE: |
| 15740 | *nss_2g = mac_ctx->vdev_type_nss_2g.ocb; |
| 15741 | *nss_5g = mac_ctx->vdev_type_nss_5g.ocb; |
| 15742 | break; |
| 15743 | default: |
| 15744 | *nss_2g = 1; |
| 15745 | *nss_5g = 1; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15746 | sme_err("Unknown device mode"); |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 15747 | break; |
| 15748 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15749 | sme_debug("mode - %d: nss_2g - %d, 5g - %d", |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 15750 | dev_mode, *nss_2g, *nss_5g); |
| 15751 | } |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 15752 | |
| 15753 | static |
| 15754 | QDF_STATUS csr_issue_add_sta_for_session_req(tpAniSirGlobal pMac, |
| 15755 | uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15756 | tSirMacAddr sessionMacAddr, |
| 15757 | uint32_t type, uint32_t subType) |
| 15758 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15759 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15760 | struct add_sta_self_params *add_sta_self_req; |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 15761 | uint8_t nss_2g; |
| 15762 | uint8_t nss_5g; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 15763 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15764 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15765 | add_sta_self_req = qdf_mem_malloc(sizeof(struct add_sta_self_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15766 | if (NULL == add_sta_self_req) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15767 | sme_err("Unable to allocate memory for tAddSelfStaParams"); |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15768 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15769 | } |
| 15770 | |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 15771 | csr_get_vdev_type_nss(pMac, pMac->sme.currDeviceMode, |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 15772 | &nss_2g, &nss_5g); |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 15773 | qdf_mem_copy(add_sta_self_req->self_mac_addr, sessionMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15774 | sizeof(tSirMacAddr)); |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 15775 | add_sta_self_req->curr_device_mode = pMac->sme.currDeviceMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15776 | add_sta_self_req->session_id = sessionId; |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 15777 | add_sta_self_req->type = type; |
| 15778 | add_sta_self_req->sub_type = subType; |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 15779 | add_sta_self_req->nss_2g = nss_2g; |
| 15780 | add_sta_self_req->nss_5g = nss_5g; |
Padma, Santhosh Kumar | a711967 | 2016-08-16 16:05:14 +0530 | [diff] [blame] | 15781 | add_sta_self_req->tx_aggregation_size = |
| 15782 | pMac->roam.configParam.tx_aggregation_size; |
| 15783 | add_sta_self_req->rx_aggregation_size = |
| 15784 | pMac->roam.configParam.rx_aggregation_size; |
Selvaraj, Sridhar | 4f684bb | 2017-01-19 15:59:23 +0530 | [diff] [blame] | 15785 | add_sta_self_req->enable_bcast_probe_rsp = |
| 15786 | pMac->roam.configParam.enable_bcast_probe_rsp; |
Selvaraj, Sridhar | 97ce658 | 2017-01-20 17:06:34 +0530 | [diff] [blame] | 15787 | add_sta_self_req->fils_max_chan_guard_time = |
| 15788 | pMac->roam.configParam.fils_max_chan_guard_time; |
Naveen Rawat | 2b6e3c9 | 2017-03-20 13:59:07 -0700 | [diff] [blame] | 15789 | add_sta_self_req->pkt_err_disconn_th = |
| 15790 | pMac->roam.configParam.pkt_err_disconn_th; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15791 | msg.type = WMA_ADD_STA_SELF_REQ; |
| 15792 | msg.reserved = 0; |
| 15793 | msg.bodyptr = add_sta_self_req; |
| 15794 | msg.bodyval = 0; |
| 15795 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15796 | sme_debug( |
| 15797 | "Send WMA_ADD_STA_SELF_REQ for selfMac=" MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15798 | MAC_ADDR_ARRAY(add_sta_self_req->self_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15799 | status = wma_post_ctrl_msg(pMac, &msg); |
| 15800 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15801 | if (status != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15802 | sme_err("wma_post_ctrl_msg failed"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 15803 | qdf_mem_free(add_sta_self_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15804 | add_sta_self_req = NULL; |
| 15805 | } |
| 15806 | return status; |
| 15807 | } |
| 15808 | |
Sandeep Puligilla | ba71da4 | 2016-10-04 17:36:32 -0700 | [diff] [blame] | 15809 | QDF_STATUS csr_roam_open_session(tpAniSirGlobal mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15810 | csr_roam_completeCallback callback, |
| 15811 | void *pContext, |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15812 | uint8_t *pSelfMacAddr, |
| 15813 | uint8_t session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15814 | uint32_t type, uint32_t subType) |
| 15815 | { |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15816 | QDF_STATUS status; |
| 15817 | uint32_t existing_session_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15818 | union { |
| 15819 | uint16_t nCfgValue16; |
| 15820 | tSirMacHTCapabilityInfo htCapInfo; |
| 15821 | } uHTCapabilityInfo; |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15822 | uint32_t nCfgValue; |
Sandeep Puligilla | ba71da4 | 2016-10-04 17:36:32 -0700 | [diff] [blame] | 15823 | tCsrRoamSession *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15824 | |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15825 | /* check to see if the mac address already belongs to a session */ |
| 15826 | status = csr_roam_get_session_id_from_bssid(mac_ctx, |
| 15827 | (struct qdf_mac_addr *)pSelfMacAddr, |
| 15828 | &existing_session_id); |
| 15829 | if (QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15830 | sme_err("Session %d exists with mac address " |
| 15831 | MAC_ADDRESS_STR, |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15832 | existing_session_id, MAC_ADDR_ARRAY(pSelfMacAddr)); |
Sandeep Puligilla | ba71da4 | 2016-10-04 17:36:32 -0700 | [diff] [blame] | 15833 | return QDF_STATUS_E_FAILURE; |
| 15834 | } |
| 15835 | |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15836 | /* attempt to retrieve session for Id */ |
| 15837 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 15838 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15839 | sme_err("Session does not exist for interface %d", |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15840 | session_id); |
| 15841 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15842 | } |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15843 | |
| 15844 | /* check to see if the session is already active */ |
| 15845 | if (session->sessionActive) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15846 | sme_err("Cannot re-open active session with Id %d", |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15847 | session_id); |
| 15848 | return QDF_STATUS_E_FAILURE; |
| 15849 | } |
| 15850 | |
| 15851 | session->sessionActive = true; |
| 15852 | session->sessionId = session_id; |
| 15853 | |
| 15854 | /* Initialize FT related data structures only in STA mode */ |
| 15855 | sme_ft_open(mac_ctx, session->sessionId); |
| 15856 | |
| 15857 | session->callback = callback; |
| 15858 | session->pContext = pContext; |
| 15859 | qdf_mem_copy(&session->selfMacAddr, pSelfMacAddr, |
| 15860 | sizeof(struct qdf_mac_addr)); |
| 15861 | status = qdf_mc_timer_init(&session->hTimerRoaming, |
| 15862 | QDF_TIMER_TYPE_SW, |
| 15863 | csr_roam_roaming_timer_handler, |
| 15864 | &session->roamingTimerInfo); |
| 15865 | if (QDF_IS_STATUS_ERROR(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15866 | sme_err("cannot allocate memory for Roaming timer"); |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15867 | return status; |
| 15868 | } |
| 15869 | |
| 15870 | status = qdf_mc_timer_init(&session->roaming_offload_timer, |
| 15871 | QDF_TIMER_TYPE_SW, |
| 15872 | csr_roam_roaming_offload_timeout_handler, |
| 15873 | &session->roamingTimerInfo); |
| 15874 | if (QDF_IS_STATUS_ERROR(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15875 | sme_err("mem fail for roaming timer"); |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15876 | return status; |
| 15877 | } |
| 15878 | |
| 15879 | /* get the HT capability info */ |
| 15880 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_HT_CAP_INFO, &nCfgValue) != |
| 15881 | eSIR_SUCCESS) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15882 | sme_err("could not get HT capability info"); |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15883 | return QDF_STATUS_SUCCESS; |
| 15884 | } |
| 15885 | |
| 15886 | uHTCapabilityInfo.nCfgValue16 = 0xFFFF & nCfgValue; |
| 15887 | session->htConfig.ht_rx_ldpc = uHTCapabilityInfo.htCapInfo.advCodingCap; |
| 15888 | session->htConfig.ht_tx_stbc = uHTCapabilityInfo.htCapInfo.txSTBC; |
| 15889 | session->htConfig.ht_rx_stbc = uHTCapabilityInfo.htCapInfo.rxSTBC; |
| 15890 | session->htConfig.ht_sgi20 = uHTCapabilityInfo.htCapInfo.shortGI20MHz; |
| 15891 | session->htConfig.ht_sgi40 = uHTCapabilityInfo.htCapInfo.shortGI40MHz; |
| 15892 | |
| 15893 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 15894 | status = qdf_mc_timer_init(&session->hTimerJoinRetry, QDF_TIMER_TYPE_SW, |
| 15895 | csr_roam_join_retry_timer_handler, |
| 15896 | &session->joinRetryTimerInfo); |
| 15897 | if (QDF_IS_STATUS_ERROR(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15898 | sme_err("cannot allocate memory for join retry timer"); |
Dustin Brown | d28772b | 2017-03-17 14:16:07 -0700 | [diff] [blame] | 15899 | return status; |
| 15900 | } |
| 15901 | #endif /* FEATURE_WLAN_BTAMP_UT_RF */ |
| 15902 | |
| 15903 | nCfgValue = 0; |
| 15904 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_MAX_MPDU_LENGTH, &nCfgValue); |
| 15905 | session->vht_config.max_mpdu_len = nCfgValue; |
| 15906 | |
| 15907 | nCfgValue = 0; |
| 15908 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET, |
| 15909 | &nCfgValue); |
| 15910 | session->vht_config.supported_channel_widthset = nCfgValue; |
| 15911 | |
| 15912 | nCfgValue = 0; |
| 15913 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_LDPC_CODING_CAP, &nCfgValue); |
| 15914 | session->vht_config.ldpc_coding = nCfgValue; |
| 15915 | |
| 15916 | nCfgValue = 0; |
| 15917 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_SHORT_GI_80MHZ, &nCfgValue); |
| 15918 | session->vht_config.shortgi80 = nCfgValue; |
| 15919 | |
| 15920 | nCfgValue = 0; |
| 15921 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ, |
| 15922 | &nCfgValue); |
| 15923 | session->vht_config.shortgi160and80plus80 = nCfgValue; |
| 15924 | |
| 15925 | nCfgValue = 0; |
| 15926 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_TXSTBC, &nCfgValue); |
| 15927 | session->vht_config.tx_stbc = nCfgValue; |
| 15928 | |
| 15929 | nCfgValue = 0; |
| 15930 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_RXSTBC, &nCfgValue); |
| 15931 | session->vht_config.rx_stbc = nCfgValue; |
| 15932 | |
| 15933 | nCfgValue = 0; |
| 15934 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_SU_BEAMFORMER_CAP, &nCfgValue); |
| 15935 | session->vht_config.su_beam_former = nCfgValue; |
| 15936 | |
| 15937 | nCfgValue = 0; |
| 15938 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, &nCfgValue); |
| 15939 | session->vht_config.su_beam_formee = nCfgValue; |
| 15940 | |
| 15941 | nCfgValue = 0; |
| 15942 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, |
| 15943 | &nCfgValue); |
| 15944 | session->vht_config.csnof_beamformer_antSup = nCfgValue; |
| 15945 | |
| 15946 | nCfgValue = 0; |
| 15947 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS, |
| 15948 | &nCfgValue); |
| 15949 | session->vht_config.num_soundingdim = nCfgValue; |
| 15950 | |
| 15951 | nCfgValue = 0; |
| 15952 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_MU_BEAMFORMER_CAP, &nCfgValue); |
| 15953 | session->vht_config.mu_beam_former = nCfgValue; |
| 15954 | |
| 15955 | nCfgValue = 0; |
| 15956 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, &nCfgValue); |
| 15957 | session->vht_config.mu_beam_formee = nCfgValue; |
| 15958 | |
| 15959 | nCfgValue = 0; |
| 15960 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_TXOP_PS, &nCfgValue); |
| 15961 | session->vht_config.vht_txops = nCfgValue; |
| 15962 | |
| 15963 | nCfgValue = 0; |
| 15964 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_HTC_VHTC_CAP, &nCfgValue); |
| 15965 | session->vht_config.htc_vhtcap = nCfgValue; |
| 15966 | |
| 15967 | nCfgValue = 0; |
| 15968 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_RX_ANT_PATTERN, &nCfgValue); |
| 15969 | session->vht_config.rx_antpattern = nCfgValue; |
| 15970 | |
| 15971 | nCfgValue = 0; |
| 15972 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_TX_ANT_PATTERN, &nCfgValue); |
| 15973 | session->vht_config.tx_antpattern = nCfgValue; |
| 15974 | |
| 15975 | nCfgValue = 0; |
| 15976 | wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, &nCfgValue); |
| 15977 | session->vht_config.max_ampdu_lenexp = nCfgValue; |
| 15978 | |
| 15979 | csr_update_session_he_cap(mac_ctx, session); |
| 15980 | |
| 15981 | return csr_issue_add_sta_for_session_req(mac_ctx, session_id, |
| 15982 | pSelfMacAddr, type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15983 | } |
| 15984 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15985 | QDF_STATUS csr_process_del_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15986 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 15987 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15988 | struct del_sta_self_params *rsp; |
| 15989 | uint8_t sessionId; |
| 15990 | |
| 15991 | if (pMsg == NULL) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15992 | sme_err("msg ptr is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15993 | return status; |
| 15994 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15995 | rsp = (struct del_sta_self_params *) pMsg; |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 15996 | sessionId = rsp->session_id; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 15997 | sme_debug("Del Sta rsp status = %d", rsp->status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 15998 | /* This session is done. */ |
| 15999 | csr_cleanup_session(pMac, sessionId); |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 16000 | if (rsp->sme_callback) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16001 | status = sme_release_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16002 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16003 | sme_debug("Failed to Release Lock"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16004 | else { |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 16005 | rsp->sme_callback(rsp->sme_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16006 | status = sme_acquire_global_lock(&pMac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16007 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16008 | sme_debug("Failed to get Lock"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16009 | return status; |
| 16010 | } |
| 16011 | } |
| 16012 | } |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 16013 | |
| 16014 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16015 | } |
| 16016 | |
| 16017 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 16018 | static QDF_STATUS |
| 16019 | csr_issue_del_sta_for_session_req(tpAniSirGlobal pMac, uint32_t sessionId, |
| 16020 | tSirMacAddr sessionMacAddr, |
| 16021 | csr_roamSessionCloseCallback callback, |
| 16022 | void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16023 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16024 | struct del_sta_self_params *del_sta_self_req; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 16025 | struct scheduler_msg msg = {0}; |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 16026 | tSirRetStatus status; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16027 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16028 | del_sta_self_req = qdf_mem_malloc(sizeof(struct del_sta_self_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16029 | if (NULL == del_sta_self_req) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16030 | sme_err(" mem alloc failed for tDelStaSelfParams"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16031 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16032 | } |
| 16033 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16034 | qdf_mem_copy(del_sta_self_req->self_mac_addr, |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 16035 | sessionMacAddr, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16036 | |
Krunal Soni | 985b813 | 2017-02-10 18:49:08 -0800 | [diff] [blame] | 16037 | del_sta_self_req->session_id = sessionId; |
| 16038 | del_sta_self_req->sme_callback = callback; |
| 16039 | del_sta_self_req->sme_ctx = pContext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16040 | msg.type = WMA_DEL_STA_SELF_REQ; |
| 16041 | msg.reserved = 0; |
| 16042 | msg.bodyptr = del_sta_self_req; |
| 16043 | msg.bodyval = 0; |
| 16044 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16045 | sme_debug("sending WMA_DEL_STA_SELF_REQ"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16046 | status = wma_post_ctrl_msg(pMac, &msg); |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 16047 | if (status != eSIR_SUCCESS) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16048 | sme_err("wma_post_ctrl_msg failed"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16049 | qdf_mem_free(del_sta_self_req); |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 16050 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16051 | } |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 16052 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16053 | } |
| 16054 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16055 | void csr_cleanup_session(tpAniSirGlobal pMac, uint32_t sessionId) |
| 16056 | { |
| 16057 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 16058 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 16059 | |
| 16060 | csr_roam_stop(pMac, sessionId); |
| 16061 | |
| 16062 | /* Clean up FT related data structures */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16063 | sme_ft_close(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16064 | csr_free_connect_bss_desc(pMac, sessionId); |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 16065 | csr_roam_free_connect_profile(&pSession->connectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16066 | csr_roam_free_connected_info(pMac, &pSession->connectedInfo); |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 16067 | qdf_mc_timer_destroy(&pSession->hTimerRoaming); |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 16068 | qdf_mc_timer_destroy(&pSession->roaming_offload_timer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16069 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 16070 | qdf_mc_timer_destroy(&pSession->hTimerJoinRetry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16071 | #endif |
Krunal Soni | 72dba66 | 2017-02-15 20:13:17 -0800 | [diff] [blame] | 16072 | purge_sme_session_pending_cmd_list(pMac, sessionId); |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 16073 | purge_sme_session_pending_scan_cmd_list(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16074 | csr_init_session(pMac, sessionId); |
| 16075 | } |
| 16076 | } |
| 16077 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16078 | QDF_STATUS csr_roam_close_session(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16079 | bool fSync, |
| 16080 | csr_roamSessionCloseCallback callback, |
| 16081 | void *pContext) |
| 16082 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16083 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Kiran Kumar Lokere | 3beeb95 | 2017-05-02 18:40:24 -0700 | [diff] [blame] | 16084 | tCsrRoamSession *pSession; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16085 | |
Kiran Kumar Lokere | 3beeb95 | 2017-05-02 18:40:24 -0700 | [diff] [blame] | 16086 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 16087 | sme_err("session %d not found", sessionId); |
| 16088 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16089 | } |
Kiran Kumar Lokere | 3beeb95 | 2017-05-02 18:40:24 -0700 | [diff] [blame] | 16090 | |
| 16091 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 16092 | /* Vdev going down stop roaming */ |
| 16093 | pSession->fCancelRoaming = true; |
| 16094 | if (fSync) { |
| 16095 | csr_cleanup_session(pMac, sessionId); |
| 16096 | return status; |
| 16097 | } |
| 16098 | |
| 16099 | purge_sme_session_pending_cmd_list(pMac, sessionId); |
| 16100 | purge_sme_session_active_cmd_list(pMac, sessionId); |
| 16101 | purge_sme_session_pending_scan_cmd_list(pMac, |
| 16102 | sessionId); |
| 16103 | status = csr_issue_del_sta_for_session_req(pMac, |
| 16104 | sessionId, |
| 16105 | pSession->selfMacAddr.bytes, |
| 16106 | callback, pContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16107 | return status; |
| 16108 | } |
| 16109 | |
| 16110 | static void csr_init_session(tpAniSirGlobal pMac, uint32_t sessionId) |
| 16111 | { |
| 16112 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 16113 | |
| 16114 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16115 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16116 | return; |
| 16117 | } |
| 16118 | |
| 16119 | pSession->sessionActive = false; |
| 16120 | pSession->sessionId = CSR_SESSION_ID_INVALID; |
| 16121 | pSession->callback = NULL; |
| 16122 | pSession->pContext = NULL; |
| 16123 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 16124 | csr_free_roam_profile(pMac, sessionId); |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 16125 | csr_roam_free_connect_profile(&pSession->connectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16126 | csr_roam_free_connected_info(pMac, &pSession->connectedInfo); |
| 16127 | csr_free_connect_bss_desc(pMac, sessionId); |
| 16128 | csr_scan_enable(pMac); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16129 | qdf_mem_set(&pSession->selfMacAddr, sizeof(struct qdf_mac_addr), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16130 | if (pSession->pWpaRsnReqIE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16131 | qdf_mem_free(pSession->pWpaRsnReqIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16132 | pSession->pWpaRsnReqIE = NULL; |
| 16133 | } |
| 16134 | pSession->nWpaRsnReqIeLength = 0; |
| 16135 | if (pSession->pWpaRsnRspIE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16136 | qdf_mem_free(pSession->pWpaRsnRspIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16137 | pSession->pWpaRsnRspIE = NULL; |
| 16138 | } |
| 16139 | pSession->nWpaRsnRspIeLength = 0; |
| 16140 | #ifdef FEATURE_WLAN_WAPI |
| 16141 | if (pSession->pWapiReqIE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16142 | qdf_mem_free(pSession->pWapiReqIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16143 | pSession->pWapiReqIE = NULL; |
| 16144 | } |
| 16145 | pSession->nWapiReqIeLength = 0; |
| 16146 | if (pSession->pWapiRspIE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16147 | qdf_mem_free(pSession->pWapiRspIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16148 | pSession->pWapiRspIE = NULL; |
| 16149 | } |
| 16150 | pSession->nWapiRspIeLength = 0; |
| 16151 | #endif /* FEATURE_WLAN_WAPI */ |
| 16152 | if (pSession->pAddIEScan) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16153 | qdf_mem_free(pSession->pAddIEScan); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16154 | pSession->pAddIEScan = NULL; |
| 16155 | } |
| 16156 | pSession->nAddIEScanLength = 0; |
| 16157 | if (pSession->pAddIEAssoc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16158 | qdf_mem_free(pSession->pAddIEAssoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16159 | pSession->pAddIEAssoc = NULL; |
| 16160 | } |
| 16161 | pSession->nAddIEAssocLength = 0; |
| 16162 | } |
| 16163 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16164 | QDF_STATUS csr_roam_get_session_id_from_bssid(tpAniSirGlobal pMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 16165 | struct qdf_mac_addr *bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16166 | uint32_t *pSessionId) |
| 16167 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16168 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16169 | uint32_t i; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16170 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16171 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 16172 | if (CSR_IS_SESSION_VALID(pMac, i)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 16173 | if (qdf_is_macaddr_equal(bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16174 | &pMac->roam.roamSession[i].connectedProfile. |
| 16175 | bssid)) { |
| 16176 | /* Found it */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16177 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16178 | *pSessionId = i; |
| 16179 | break; |
| 16180 | } |
| 16181 | } |
| 16182 | } |
| 16183 | return status; |
| 16184 | } |
| 16185 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16186 | /* This function assumes that we only support one IBSS session. |
| 16187 | * We cannot use BSSID to identify session because for IBSS, |
| 16188 | * the bssid changes. |
| 16189 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16190 | static uint32_t csr_find_ibss_session(tpAniSirGlobal pMac) |
| 16191 | { |
| 16192 | uint32_t i, nRet = CSR_SESSION_ID_INVALID; |
| 16193 | tCsrRoamSession *pSession; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16194 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16195 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 16196 | if (CSR_IS_SESSION_VALID(pMac, i)) { |
| 16197 | pSession = CSR_GET_SESSION(pMac, i); |
| 16198 | if (pSession->pCurRoamProfile |
| 16199 | && |
| 16200 | (csr_is_bss_type_ibss |
| 16201 | (pSession->connectedProfile.BSSType))) { |
| 16202 | /* Found it */ |
| 16203 | nRet = i; |
| 16204 | break; |
| 16205 | } |
| 16206 | } |
| 16207 | } |
| 16208 | return nRet; |
| 16209 | } |
| 16210 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 16211 | static void csr_roam_link_up(tpAniSirGlobal pMac, struct qdf_mac_addr bssid) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16212 | { |
Deepak Dhamdhere | 42b5c11 | 2015-11-07 00:23:22 -0800 | [diff] [blame] | 16213 | uint32_t sessionId = 0; |
| 16214 | |
| 16215 | /* |
| 16216 | * Update the current BSS info in ho control block based on connected |
| 16217 | * profile info from pmac global structure |
| 16218 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16219 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16220 | sme_debug( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16221 | " csr_roam_link_up: WLAN link UP with AP= " MAC_ADDRESS_STR, |
| 16222 | MAC_ADDR_ARRAY(bssid.bytes)); |
Deepak Dhamdhere | 42b5c11 | 2015-11-07 00:23:22 -0800 | [diff] [blame] | 16223 | /* Check for user misconfig of RSSI trigger threshold */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16224 | pMac->roam.configParam.vccRssiThreshold = |
| 16225 | (0 == pMac->roam.configParam.vccRssiThreshold) ? |
Deepak Dhamdhere | 42b5c11 | 2015-11-07 00:23:22 -0800 | [diff] [blame] | 16226 | CSR_VCC_RSSI_THRESHOLD : |
| 16227 | pMac->roam.configParam.vccRssiThreshold; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16228 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Deepak Dhamdhere | 42b5c11 | 2015-11-07 00:23:22 -0800 | [diff] [blame] | 16229 | /* Check for user misconfig of UL MAC Loss trigger threshold */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16230 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 16231 | (0 == pMac->roam.configParam.vccUlMacLossThreshold) ? |
| 16232 | CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam. |
| 16233 | vccUlMacLossThreshold; |
Deepak Dhamdhere | 42b5c11 | 2015-11-07 00:23:22 -0800 | [diff] [blame] | 16234 | /* Indicate the neighbor roal algorithm about the connect indication */ |
| 16235 | csr_roam_get_session_id_from_bssid(pMac, &bssid, |
| 16236 | &sessionId); |
| 16237 | csr_neighbor_roam_indicate_connect(pMac, sessionId, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16238 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16239 | } |
| 16240 | |
| 16241 | static void csr_roam_link_down(tpAniSirGlobal pMac, uint32_t sessionId) |
| 16242 | { |
| 16243 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 16244 | |
| 16245 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16246 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16247 | return; |
| 16248 | } |
| 16249 | /* Only to handle the case for Handover on infra link */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16250 | if (eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16251 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16252 | /* |
| 16253 | * Incase of station mode, immediately stop data transmission whenever |
| 16254 | * link down is detected. |
| 16255 | */ |
| 16256 | if (csr_roam_is_sta_mode(pMac, sessionId) |
| 16257 | && !CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
Deepak Dhamdhere | add334b | 2016-01-09 23:40:33 -0800 | [diff] [blame] | 16258 | && !csr_roam_is11r_assoc(pMac, sessionId)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16259 | sme_debug("Inform Link lost for session %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16260 | sessionId); |
| 16261 | csr_roam_call_callback(pMac, sessionId, NULL, 0, |
| 16262 | eCSR_ROAM_LOSTLINK, |
| 16263 | eCSR_ROAM_RESULT_LOSTLINK); |
| 16264 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16265 | /* deregister the clients requesting stats from PE/TL & also stop the |
| 16266 | * corresponding timers |
| 16267 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16268 | csr_roam_dereg_statistics_req(pMac); |
| 16269 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16270 | /* Indicate the neighbor roal algorithm about the disconnect |
| 16271 | * indication |
| 16272 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16273 | csr_neighbor_roam_indicate_disconnect(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16274 | |
| 16275 | /* Remove this code once SLM_Sessionization is supported */ |
| 16276 | /* BMPS_WORKAROUND_NOT_NEEDED */ |
| 16277 | if (!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
| 16278 | csr_is_infra_ap_started(pMac) && |
| 16279 | pMac->roam.configParam.doBMPSWorkaround) { |
| 16280 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 16281 | } |
| 16282 | |
| 16283 | } |
| 16284 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16285 | QDF_STATUS csr_send_mb_stats_req_msg(tpAniSirGlobal pMac, uint32_t statsMask, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16286 | uint8_t staId, uint8_t sessionId) |
| 16287 | { |
| 16288 | tAniGetPEStatsReq *pMsg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16289 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16290 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16291 | pMsg = qdf_mem_malloc(sizeof(tAniGetPEStatsReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16292 | if (NULL == pMsg) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16293 | sme_err("Failed to allocate mem for stats req "); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16294 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16295 | } |
| 16296 | /* need to initiate a stats request to PE */ |
| 16297 | pMsg->msgType = eWNI_SME_GET_STATISTICS_REQ; |
| 16298 | pMsg->msgLen = (uint16_t) sizeof(tAniGetPEStatsReq); |
| 16299 | pMsg->staId = staId; |
| 16300 | pMsg->statsMask = statsMask; |
| 16301 | pMsg->sessionId = sessionId; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 16302 | status = umac_send_mb_message_to_mac(pMsg); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16303 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16304 | sme_debug("Failed to send down the stats req "); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16305 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16306 | return status; |
| 16307 | } |
| 16308 | |
| 16309 | /** |
| 16310 | * csr_update_stats() - updates correct stats struct in mac_ctx |
| 16311 | * @mac: mac global context |
| 16312 | * @stats_type: stats type |
| 16313 | * @sme_stats_rsp: stats rsp msg packet |
| 16314 | * @stats: input stats data buffer to fill in mac_ctx struct |
| 16315 | * @length: out param - stats length |
| 16316 | * |
| 16317 | * This function fills corresponding stats struct in mac_cts based on stats type |
| 16318 | * passed |
| 16319 | * |
| 16320 | * Return: void |
| 16321 | */ |
| 16322 | static void |
| 16323 | csr_update_stats(tpAniSirGlobal mac, uint8_t stats_type, |
| 16324 | tAniGetPEStatsRsp *sme_stats_rsp, |
| 16325 | uint8_t **stats, uint32_t *length) |
| 16326 | { |
| 16327 | switch (stats_type) { |
| 16328 | case eCsrSummaryStats: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16329 | sme_debug("summary stats"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16330 | qdf_mem_copy((uint8_t *) &mac->roam.summaryStatsInfo, *stats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16331 | sizeof(tCsrSummaryStatsInfo)); |
| 16332 | *stats += sizeof(tCsrSummaryStatsInfo); |
| 16333 | *length -= sizeof(tCsrSummaryStatsInfo); |
| 16334 | break; |
| 16335 | case eCsrGlobalClassAStats: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16336 | sme_debug("ClassA stats"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16337 | qdf_mem_copy((uint8_t *) &mac->roam.classAStatsInfo, *stats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16338 | sizeof(tCsrGlobalClassAStatsInfo)); |
| 16339 | *stats += sizeof(tCsrGlobalClassAStatsInfo); |
| 16340 | *length -= sizeof(tCsrGlobalClassAStatsInfo); |
| 16341 | break; |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 16342 | case csr_per_chain_rssi_stats: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16343 | sme_debug("csrRoamStatsRspProcessor:Per Chain RSSI stats"); |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 16344 | qdf_mem_copy((uint8_t *)&mac->roam.per_chain_rssi_stats, |
| 16345 | *stats, sizeof(struct csr_per_chain_rssi_stats_info)); |
| 16346 | *stats += sizeof(struct csr_per_chain_rssi_stats_info); |
| 16347 | *length -= sizeof(struct csr_per_chain_rssi_stats_info); |
| 16348 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16349 | default: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16350 | sme_warn("unknown stats type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16351 | break; |
| 16352 | } |
| 16353 | } |
| 16354 | |
| 16355 | /** |
| 16356 | * csr_roam_stats_rsp_processor() - processes stats rsp msg |
| 16357 | * @pMac mac global context |
| 16358 | * @pSirMsg: incoming message |
| 16359 | * |
| 16360 | * Return: void |
| 16361 | */ |
| 16362 | void csr_roam_stats_rsp_processor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg) |
| 16363 | { |
| 16364 | tAniGetPEStatsRsp *pSmeStatsRsp; |
| 16365 | tListElem *pEntry = NULL; |
| 16366 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 16367 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 16368 | uint32_t tempMask = 0; |
| 16369 | uint8_t counter = 0; |
| 16370 | uint8_t *pStats = NULL; |
| 16371 | uint32_t length = 0; |
| 16372 | void *p_cds_gctx; |
| 16373 | int8_t rssi = 0, snr = 0; |
| 16374 | uint32_t *pRssi = NULL, *pSnr = NULL; |
| 16375 | uint32_t linkCapacity; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16376 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16377 | pSmeStatsRsp = (tAniGetPEStatsRsp *) pSirMsg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16378 | if (pSmeStatsRsp->rc) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16379 | sme_warn("stats rsp from PE shows failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16380 | goto post_update; |
| 16381 | } |
| 16382 | tempMask = pSmeStatsRsp->statsMask; |
| 16383 | pStats = ((uint8_t *) &pSmeStatsRsp->statsMask) + |
| 16384 | sizeof(pSmeStatsRsp->statsMask); |
| 16385 | /* |
| 16386 | * subtract all statistics from this length, and after processing the |
| 16387 | * entire 'stat' part of the message, if the length is not zero, then |
| 16388 | * rssi is piggy packed in this 'stats' message. |
| 16389 | */ |
| 16390 | length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp); |
| 16391 | /* new stats info from PE, fill up the stats strucutres in PMAC */ |
| 16392 | while (tempMask) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16393 | if (tempMask & 1) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16394 | csr_update_stats(pMac, counter, pSmeStatsRsp, |
| 16395 | &pStats, &length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16396 | tempMask >>= 1; |
| 16397 | counter++; |
| 16398 | } |
| 16399 | p_cds_gctx = cds_get_global_context(); |
| 16400 | if (length != 0) { |
| 16401 | pRssi = (uint32_t *) pStats; |
| 16402 | rssi = (int8_t) *pRssi; |
| 16403 | pStats += sizeof(uint32_t); |
| 16404 | length -= sizeof(uint32_t); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16405 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16406 | /* If riva is not sending rssi, continue to use the hack */ |
| 16407 | rssi = RSSI_HACK_BMPS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16408 | |
| 16409 | if (length != 0) { |
| 16410 | linkCapacity = *(uint32_t *) pStats; |
| 16411 | pStats += sizeof(uint32_t); |
| 16412 | length -= sizeof(uint32_t); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16413 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16414 | linkCapacity = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16415 | |
| 16416 | if (length != 0) { |
| 16417 | pSnr = (uint32_t *) pStats; |
| 16418 | snr = (int8_t) *pSnr; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16419 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16420 | snr = SNR_HACK_BMPS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16421 | |
| 16422 | post_update: |
| 16423 | /* make sure to update the pe stats req list */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16424 | pEntry = csr_roam_find_in_pe_stats_req_list(pMac, |
| 16425 | pSmeStatsRsp->statsMask); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16426 | if (pEntry) { |
| 16427 | pPeStaEntry = GET_BASE_ADDR(pEntry, tCsrPeStatsReqInfo, link); |
| 16428 | pPeStaEntry->rspPending = false; |
| 16429 | |
| 16430 | } |
| 16431 | /* check the one timer cases */ |
| 16432 | pEntry = csr_roam_check_client_req_list(pMac, pSmeStatsRsp->statsMask); |
| 16433 | if (pEntry) { |
| 16434 | pTempStaEntry = |
| 16435 | GET_BASE_ADDR(pEntry, tCsrStatsClientReqInfo, link); |
| 16436 | if (pTempStaEntry->timerExpired) { |
| 16437 | /* send up the stats report */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16438 | csr_roam_report_statistics(pMac, |
| 16439 | pTempStaEntry->statsMask, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16440 | pTempStaEntry->callback, |
| 16441 | pTempStaEntry->staId, |
| 16442 | pTempStaEntry->pContext); |
| 16443 | /* also remove from the client list */ |
| 16444 | csr_roam_remove_stat_list_entry(pMac, pEntry); |
| 16445 | pTempStaEntry = NULL; |
| 16446 | } |
| 16447 | } |
| 16448 | } |
| 16449 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16450 | tListElem *csr_roam_find_in_pe_stats_req_list(tpAniSirGlobal pMac, |
| 16451 | uint32_t statsMask) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16452 | { |
| 16453 | tListElem *pEntry = NULL; |
| 16454 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16455 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16456 | pEntry = csr_ll_peek_head(&pMac->roam.peStatsReqList, LL_ACCESS_LOCK); |
| 16457 | if (!pEntry) { |
| 16458 | /* list empty */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16459 | sme_debug("csr_roam_find_in_pe_stats_req_list: List empty, no request to PE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16460 | return NULL; |
| 16461 | } |
| 16462 | while (pEntry) { |
| 16463 | pTempStaEntry = GET_BASE_ADDR(pEntry, tCsrPeStatsReqInfo, link); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16464 | if (pTempStaEntry->statsMask == statsMask) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16465 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16466 | pEntry = |
| 16467 | csr_ll_next(&pMac->roam.peStatsReqList, pEntry, |
| 16468 | LL_ACCESS_NOLOCK); |
| 16469 | } |
| 16470 | return pEntry; |
| 16471 | } |
| 16472 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 16473 | static |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16474 | tListElem *csr_roam_checkn_update_client_req_list(tpAniSirGlobal pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16475 | tCsrStatsClientReqInfo *pStaEntry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16476 | bool update) |
| 16477 | { |
| 16478 | tListElem *pEntry; |
| 16479 | tCsrStatsClientReqInfo *pTempStaEntry; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16480 | |
| 16481 | pEntry = csr_ll_peek_head(&pMac->roam.statsClientReqList, |
| 16482 | LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16483 | if (!pEntry) { |
| 16484 | /* list empty */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16485 | sme_debug("List empty, no request from upper layer client(s)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16486 | return NULL; |
| 16487 | } |
| 16488 | while (pEntry) { |
| 16489 | pTempStaEntry = |
| 16490 | GET_BASE_ADDR(pEntry, tCsrStatsClientReqInfo, link); |
| 16491 | if ((pTempStaEntry->requesterId == pStaEntry->requesterId) |
| 16492 | && (pTempStaEntry->statsMask == pStaEntry->statsMask)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16493 | if (update) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16494 | pTempStaEntry->callback = pStaEntry->callback; |
| 16495 | pTempStaEntry->pContext = pStaEntry->pContext; |
| 16496 | } |
| 16497 | break; |
| 16498 | } |
| 16499 | pEntry = |
| 16500 | csr_ll_next(&pMac->roam.statsClientReqList, pEntry, |
| 16501 | LL_ACCESS_NOLOCK); |
| 16502 | } |
| 16503 | return pEntry; |
| 16504 | } |
| 16505 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16506 | tListElem *csr_roam_check_client_req_list(tpAniSirGlobal pMac, |
| 16507 | uint32_t statsMask) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16508 | { |
| 16509 | tListElem *pEntry; |
| 16510 | tCsrStatsClientReqInfo *pTempStaEntry; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16511 | |
| 16512 | pEntry = csr_ll_peek_head(&pMac->roam.statsClientReqList, |
| 16513 | LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16514 | if (!pEntry) { |
| 16515 | /* list empty */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16516 | sme_debug("List empty, no request from upper layer client(s)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16517 | return NULL; |
| 16518 | } |
| 16519 | while (pEntry) { |
| 16520 | pTempStaEntry = |
| 16521 | GET_BASE_ADDR(pEntry, tCsrStatsClientReqInfo, link); |
| 16522 | if ((pTempStaEntry-> |
| 16523 | statsMask & ~(1 << eCsrGlobalClassDStats)) == statsMask) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16524 | break; |
| 16525 | } |
| 16526 | pEntry = |
| 16527 | csr_ll_next(&pMac->roam.statsClientReqList, pEntry, |
| 16528 | LL_ACCESS_NOLOCK); |
| 16529 | } |
| 16530 | return pEntry; |
| 16531 | } |
| 16532 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16533 | tCsrStatsClientReqInfo *csr_roam_insert_entry_into_list(tpAniSirGlobal pMac, |
| 16534 | tDblLinkList *pStaList, |
| 16535 | tCsrStatsClientReqInfo * |
| 16536 | pStaEntry) |
| 16537 | { |
| 16538 | tCsrStatsClientReqInfo *pNewStaEntry = NULL; |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 16539 | /* |
| 16540 | * if same entity requested for same set of stats with different |
| 16541 | * callback update it |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16542 | */ |
| 16543 | if (NULL == csr_roam_checkn_update_client_req_list(pMac, pStaEntry, |
| 16544 | true)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16545 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16546 | pNewStaEntry = qdf_mem_malloc(sizeof(tCsrStatsClientReqInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16547 | if (NULL == pNewStaEntry) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16548 | sme_err("couldn't allocate memory for the entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16549 | return NULL; |
| 16550 | } |
| 16551 | |
| 16552 | pNewStaEntry->callback = pStaEntry->callback; |
| 16553 | pNewStaEntry->pContext = pStaEntry->pContext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16554 | pNewStaEntry->requesterId = pStaEntry->requesterId; |
| 16555 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 16556 | pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry; |
| 16557 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 16558 | pNewStaEntry->staId = pStaEntry->staId; |
| 16559 | pNewStaEntry->timerExpired = pStaEntry->timerExpired; |
| 16560 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16561 | csr_ll_insert_tail(pStaList, &pNewStaEntry->link, |
| 16562 | LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16563 | } |
| 16564 | return pNewStaEntry; |
| 16565 | } |
| 16566 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16567 | QDF_STATUS csr_get_rssi(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16568 | tCsrRssiCallback callback, |
| 16569 | uint8_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 16570 | struct qdf_mac_addr bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16571 | int8_t lastRSSI, void *pContext, void *p_cds_context) |
| 16572 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16573 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 16574 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16575 | uint32_t sessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16576 | tAniGetRssiReq *pMsg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16577 | |
| 16578 | status = csr_roam_get_session_id_from_bssid(pMac, &bssId, &sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16579 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16580 | callback(lastRSSI, staId, pContext); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16581 | sme_err("Failed to get SessionId"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16582 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16583 | } |
| 16584 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16585 | pMsg = qdf_mem_malloc(sizeof(tAniGetRssiReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16586 | if (NULL == pMsg) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16587 | sme_err("csr_get_rssi: failed to allocate mem for req "); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16588 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16589 | } |
| 16590 | |
| 16591 | pMsg->msgType = eWNI_SME_GET_RSSI_REQ; |
| 16592 | pMsg->msgLen = (uint16_t) sizeof(tAniGetRssiReq); |
| 16593 | pMsg->sessionId = sessionId; |
| 16594 | pMsg->staId = staId; |
| 16595 | pMsg->rssiCallback = callback; |
| 16596 | pMsg->pDevContext = pContext; |
| 16597 | pMsg->p_cds_context = p_cds_context; |
| 16598 | /* |
| 16599 | * store RSSI at time of calling, so that if RSSI request cannot |
| 16600 | * be sent to firmware, this value can be used to return immediately |
| 16601 | */ |
| 16602 | pMsg->lastRSSI = lastRSSI; |
| 16603 | msg.type = eWNI_SME_GET_RSSI_REQ; |
| 16604 | msg.bodyptr = pMsg; |
| 16605 | msg.reserved = 0; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 16606 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_SME, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 16607 | &msg)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16608 | sme_err("scheduler_post_msg failed to post msg to self"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16609 | qdf_mem_free((void *)pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16610 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16611 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16612 | return status; |
| 16613 | } |
| 16614 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16615 | QDF_STATUS csr_get_snr(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16616 | tCsrSnrCallback callback, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 16617 | uint8_t staId, struct qdf_mac_addr bssId, void *pContext) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16618 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16619 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 16620 | struct scheduler_msg msg = {0}; |
Yuanyuan Liu | 889167d | 2017-05-31 16:56:26 -0700 | [diff] [blame] | 16621 | uint32_t sessionId = CSR_SESSION_ID_INVALID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16622 | tAniGetSnrReq *pMsg; |
| 16623 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16624 | pMsg = (tAniGetSnrReq *) qdf_mem_malloc(sizeof(tAniGetSnrReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16625 | if (NULL == pMsg) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16626 | sme_err("failed to allocate mem for req"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16627 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16628 | } |
| 16629 | |
Tushnim Bhattacharyya | 85bedb9 | 2017-05-17 13:23:14 -0700 | [diff] [blame] | 16630 | status = csr_roam_get_session_id_from_bssid(pMac, &bssId, &sessionId); |
| 16631 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Houston Hoffman | 77bf407 | 2017-07-17 01:01:18 -0700 | [diff] [blame] | 16632 | qdf_mem_free(pMsg); |
Srinivas Girigowda | af0173e | 2017-06-01 11:50:41 -0700 | [diff] [blame] | 16633 | sme_err("Couldn't find session_id for given BSSID"); |
| 16634 | return status; |
Tushnim Bhattacharyya | 85bedb9 | 2017-05-17 13:23:14 -0700 | [diff] [blame] | 16635 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16636 | |
| 16637 | pMsg->msgType = eWNI_SME_GET_SNR_REQ; |
| 16638 | pMsg->msgLen = (uint16_t) sizeof(tAniGetSnrReq); |
| 16639 | pMsg->sessionId = sessionId; |
| 16640 | pMsg->staId = staId; |
| 16641 | pMsg->snrCallback = callback; |
| 16642 | pMsg->pDevContext = pContext; |
| 16643 | msg.type = eWNI_SME_GET_SNR_REQ; |
| 16644 | msg.bodyptr = pMsg; |
| 16645 | msg.reserved = 0; |
| 16646 | |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 16647 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_SME, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 16648 | &msg)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16649 | sme_err("failed to post msg to self"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 16650 | qdf_mem_free((void *)pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16651 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16652 | } |
| 16653 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16654 | return status; |
| 16655 | } |
| 16656 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16657 | /** |
| 16658 | * csr_deregister_client_request() - deregisters a get stats request |
| 16659 | * @mac_ctx: mac global context |
| 16660 | * @sta_entry: stats request entry |
| 16661 | * |
| 16662 | * Return: status of operation |
| 16663 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16664 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16665 | csr_deregister_client_request(tpAniSirGlobal mac_ctx, |
| 16666 | tCsrStatsClientReqInfo *sta_entry) |
| 16667 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16668 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16669 | tListElem *entry = NULL; |
| 16670 | tCsrStatsClientReqInfo *ptr_sta_entry = NULL; |
| 16671 | |
| 16672 | entry = csr_roam_checkn_update_client_req_list(mac_ctx, sta_entry, |
| 16673 | false); |
| 16674 | if (!entry) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16675 | sme_err("callback is empty in the request & couldn't find any existing request in statsClientReqList"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16676 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16677 | } |
| 16678 | /* clean up & return */ |
| 16679 | ptr_sta_entry = GET_BASE_ADDR(entry, tCsrStatsClientReqInfo, link); |
| 16680 | if (NULL != ptr_sta_entry->pPeStaEntry) { |
| 16681 | ptr_sta_entry->pPeStaEntry->numClient--; |
| 16682 | /* check if we need to delete the entry from peStatsReqList */ |
| 16683 | if (!ptr_sta_entry->pPeStaEntry->numClient) |
| 16684 | csr_roam_remove_entry_from_pe_stats_req_list(mac_ctx, |
| 16685 | ptr_sta_entry->pPeStaEntry); |
| 16686 | } |
| 16687 | /* check if we need to stop the tl stats timer too */ |
| 16688 | mac_ctx->roam.tlStatsReqInfo.numClient--; |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 16689 | qdf_mc_timer_stop(&ptr_sta_entry->timer); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 16690 | /* Destroy the qdf timer... */ |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 16691 | status = qdf_mc_timer_destroy(&ptr_sta_entry->timer); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16692 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16693 | sme_err( |
| 16694 | "failed to destroy Client req timer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16695 | |
| 16696 | csr_roam_remove_stat_list_entry(mac_ctx, entry); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16697 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16698 | } |
| 16699 | |
| 16700 | /** |
| 16701 | * csr_insert_stats_request_to_list() - inserts request to existing list |
| 16702 | * @mac_ctx: mac global context |
| 16703 | * @sta_entry: stats request entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16704 | * |
| 16705 | * Return: status of operation |
| 16706 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16707 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16708 | csr_insert_stats_request_to_list(tpAniSirGlobal mac_ctx, |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 16709 | tCsrStatsClientReqInfo *sta_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16710 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16711 | tCsrStatsClientReqInfo *ptr_sta_entry = csr_roam_insert_entry_into_list( |
| 16712 | mac_ctx, &mac_ctx->roam.statsClientReqList, |
| 16713 | sta_entry); |
| 16714 | if (!ptr_sta_entry) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16715 | sme_err("Failed to insert req in statsClientReqList"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16716 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16717 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16718 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16719 | } |
| 16720 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16721 | QDF_STATUS csr_get_statistics(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16722 | eCsrStatsRequesterType requesterId, |
| 16723 | uint32_t statsMask, |
| 16724 | tCsrStatsCallback callback, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16725 | uint8_t staId, |
| 16726 | void *pContext, |
| 16727 | uint8_t sessionId) |
| 16728 | { |
| 16729 | tCsrStatsClientReqInfo staEntry; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16730 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16731 | bool insertInClientList = false; |
| 16732 | uint32_t temp_mask = 0; |
| 16733 | |
| 16734 | if (csr_is_all_session_disconnected(pMac)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16735 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16736 | |
| 16737 | if (csr_neighbor_middle_of_roaming(pMac, sessionId)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16738 | sme_debug("in the middle of roaming states"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16739 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16740 | } |
| 16741 | |
| 16742 | if ((!statsMask) && (!callback)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16743 | sme_err("statsMask & callback empty in the request"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16744 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16745 | } |
| 16746 | /* for the search list method for deregister */ |
| 16747 | staEntry.requesterId = requesterId; |
| 16748 | staEntry.statsMask = statsMask; |
| 16749 | /* requester wants to deregister or just an error */ |
| 16750 | if ((statsMask) && (!callback)) |
| 16751 | return csr_deregister_client_request(pMac, &staEntry); |
| 16752 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16753 | /* add the request in the client req list */ |
| 16754 | staEntry.callback = callback; |
| 16755 | staEntry.pContext = pContext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16756 | staEntry.pPeStaEntry = NULL; |
| 16757 | staEntry.staId = staId; |
| 16758 | staEntry.pMac = pMac; |
| 16759 | staEntry.timerExpired = false; |
| 16760 | staEntry.sessionId = sessionId; |
| 16761 | |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 16762 | temp_mask = statsMask & ~(1 << eCsrGlobalClassDStats); |
| 16763 | if (temp_mask) { |
| 16764 | /* send down a req */ |
| 16765 | status = csr_send_mb_stats_req_msg(pMac, |
| 16766 | temp_mask, staId, sessionId); |
| 16767 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 16768 | sme_err("failed to send down stats req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16769 | /* |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 16770 | * so that when the stats rsp comes back from PE we |
| 16771 | * respond to upper layer right away |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16772 | */ |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 16773 | staEntry.timerExpired = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16774 | insertInClientList = true; |
| 16775 | } |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 16776 | /* if looking for stats from TL only */ |
| 16777 | if (!insertInClientList) { |
| 16778 | /* return the stats */ |
| 16779 | csr_roam_report_statistics(pMac, statsMask, callback, |
| 16780 | staId, pContext); |
| 16781 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16782 | } |
| 16783 | if (insertInClientList) |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 16784 | return csr_insert_stats_request_to_list(pMac, &staEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16785 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16786 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16787 | } |
| 16788 | |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 16789 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 16790 | /** |
| 16791 | * csr_roam_set_key_mgmt_offload() - enable/disable key mgmt offload |
| 16792 | * @mac_ctx: mac context. |
| 16793 | * @session_id: Session Identifier |
| 16794 | * @roam_key_mgmt_offload_enabled: key mgmt enable/disable flag |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 16795 | * @pmkid_modes: PMKID modes of PMKSA caching and OKC |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 16796 | * |
| 16797 | * Return: QDF_STATUS_SUCCESS - CSR updated config successfully. |
| 16798 | * Other status means CSR is failed to update. |
| 16799 | */ |
| 16800 | |
| 16801 | QDF_STATUS csr_roam_set_key_mgmt_offload(tpAniSirGlobal mac_ctx, |
| 16802 | uint32_t session_id, |
| 16803 | bool roam_key_mgmt_offload_enabled, |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 16804 | struct pmkid_mode_bits *pmkid_modes) |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 16805 | { |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 16806 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 16807 | |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 16808 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16809 | sme_err("session %d not found", session_id); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 16810 | return QDF_STATUS_E_FAILURE; |
| 16811 | } |
Deepak Dhamdhere | f2a7d8b | 2016-08-19 16:17:38 -0700 | [diff] [blame] | 16812 | session->RoamKeyMgmtOffloadEnabled = roam_key_mgmt_offload_enabled; |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 16813 | session->pmkid_modes.fw_okc = pmkid_modes->fw_okc; |
| 16814 | session->pmkid_modes.fw_pmksa_cache = pmkid_modes->fw_pmksa_cache; |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 16815 | return QDF_STATUS_SUCCESS; |
| 16816 | } |
| 16817 | |
| 16818 | /** |
| 16819 | * csr_update_roam_scan_offload_request() - updates req msg with roam offload |
| 16820 | * paramters |
| 16821 | * @pMac: mac global context |
| 16822 | * @req_buf: out param, roam offload scan request packet |
| 16823 | * @session: roam session |
| 16824 | * |
| 16825 | * Return: void |
| 16826 | */ |
| 16827 | static void |
| 16828 | csr_update_roam_scan_offload_request(tpAniSirGlobal mac_ctx, |
| 16829 | tSirRoamOffloadScanReq *req_buf, |
| 16830 | tCsrRoamSession *session) |
| 16831 | { |
| 16832 | qdf_mem_copy(req_buf->PSK_PMK, session->psk_pmk, |
| 16833 | sizeof(req_buf->PSK_PMK)); |
| 16834 | req_buf->pmk_len = session->pmk_len; |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 16835 | req_buf->R0KH_ID_Length = session->ftSmeContext.r0kh_id_len; |
| 16836 | qdf_mem_copy(req_buf->R0KH_ID, |
| 16837 | session->ftSmeContext.r0kh_id, |
| 16838 | req_buf->R0KH_ID_Length); |
| 16839 | req_buf->Prefer5GHz = mac_ctx->roam.configParam.nRoamPrefer5GHz; |
| 16840 | req_buf->RoamRssiCatGap = mac_ctx->roam.configParam.bCatRssiOffset; |
| 16841 | req_buf->Select5GHzMargin = mac_ctx->roam.configParam.nSelect5GHzMargin; |
| 16842 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT, |
| 16843 | (uint32_t *) &req_buf->ReassocFailureTimeout) |
| 16844 | != eSIR_SUCCESS) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16845 | sme_err( |
| 16846 | "could not retrieve ReassocFailureTimeout value"); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 16847 | req_buf->ReassocFailureTimeout = |
| 16848 | DEFAULT_REASSOC_FAILURE_TIMEOUT; |
| 16849 | } |
| 16850 | #ifdef FEATURE_WLAN_ESE |
| 16851 | if (csr_is_auth_type_ese(req_buf->ConnectedNetwork.authentication)) { |
| 16852 | qdf_mem_copy(req_buf->KRK, session->eseCckmInfo.krk, |
| 16853 | SIR_KRK_KEY_LEN); |
| 16854 | qdf_mem_copy(req_buf->BTK, session->eseCckmInfo.btk, |
| 16855 | SIR_BTK_KEY_LEN); |
| 16856 | } |
| 16857 | #endif |
Naveen Rawat | cd11831 | 2016-11-22 10:46:21 -0800 | [diff] [blame] | 16858 | req_buf->AcUapsd.acbe_uapsd = SIR_UAPSD_GET(ACBE, session->uapsd_mask); |
| 16859 | req_buf->AcUapsd.acbk_uapsd = SIR_UAPSD_GET(ACBK, session->uapsd_mask); |
| 16860 | req_buf->AcUapsd.acvi_uapsd = SIR_UAPSD_GET(ACVI, session->uapsd_mask); |
| 16861 | req_buf->AcUapsd.acvo_uapsd = SIR_UAPSD_GET(ACVO, session->uapsd_mask); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 16862 | } |
| 16863 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 16864 | |
| 16865 | #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16866 | /** |
| 16867 | * csr_check_band_channel_match() - check if passed band and channel match |
| 16868 | * paramters |
| 16869 | * @band: band to match with channel |
| 16870 | * @channel: channel to match with band |
| 16871 | * |
| 16872 | * Return: bool if match else false |
| 16873 | */ |
| 16874 | static bool |
| 16875 | csr_check_band_channel_match(eCsrBand band, uint8_t channel) |
| 16876 | { |
| 16877 | if (eCSR_BAND_ALL == band) |
| 16878 | return true; |
| 16879 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 16880 | if (eCSR_BAND_24 == band && WLAN_REG_IS_24GHZ_CH(channel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16881 | return true; |
| 16882 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 16883 | if (eCSR_BAND_5G == band && WLAN_REG_IS_5GHZ_CH(channel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16884 | return true; |
| 16885 | |
| 16886 | return false; |
| 16887 | } |
| 16888 | |
| 16889 | /** |
| 16890 | * csr_fetch_ch_lst_from_ini() - fetch channel list from ini and update req msg |
| 16891 | * paramters |
| 16892 | * @mac_ctx: global mac ctx |
| 16893 | * @roam_info: roam info struct |
| 16894 | * @req_buf: out param, roam offload scan request packet |
| 16895 | * |
| 16896 | * Return: result of operation |
| 16897 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16898 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16899 | csr_fetch_ch_lst_from_ini(tpAniSirGlobal mac_ctx, |
| 16900 | tpCsrNeighborRoamControlInfo roam_info, |
| 16901 | tSirRoamOffloadScanReq *req_buf) |
| 16902 | { |
| 16903 | eCsrBand band; |
| 16904 | uint8_t i = 0; |
| 16905 | uint8_t num_channels = 0; |
| 16906 | uint8_t *ch_lst = roam_info->cfgParams.channelInfo.ChannelList; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 16907 | uint16_t unsafe_chan[NUM_CHANNELS]; |
| 16908 | uint16_t unsafe_chan_cnt = 0; |
| 16909 | uint16_t cnt = 0; |
| 16910 | bool is_unsafe_chan; |
| 16911 | qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); |
| 16912 | |
| 16913 | if (!qdf_ctx) { |
| 16914 | cds_err("qdf_ctx is NULL"); |
| 16915 | return QDF_STATUS_E_FAILURE; |
| 16916 | } |
| 16917 | |
| 16918 | pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, |
| 16919 | &unsafe_chan_cnt, |
| 16920 | sizeof(unsafe_chan)); |
| 16921 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16922 | /* |
| 16923 | * The INI channels need to be filtered with respect to the current band |
| 16924 | * that is supported. |
| 16925 | */ |
| 16926 | band = mac_ctx->roam.configParam.bandCapability; |
| 16927 | if ((eCSR_BAND_24 != band) && (eCSR_BAND_5G != band) |
| 16928 | && (eCSR_BAND_ALL != band)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 16929 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16930 | "Invalid band(%d), roam scan offload req aborted", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16931 | band); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16932 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16933 | } |
| 16934 | |
| 16935 | for (i = 0; i < roam_info->cfgParams.channelInfo.numOfChannels; i++) { |
| 16936 | if (!csr_check_band_channel_match(band, *ch_lst)) |
| 16937 | continue; |
| 16938 | /* Allow DFS channels only if the DFS roaming is enabled */ |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 16939 | if ((!mac_ctx->roam.configParam.allowDFSChannelRoam || |
| 16940 | (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == |
| 16941 | CSR_STA_ROAM_POLICY_DFS_DISABLED)) && |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 16942 | (wlan_reg_is_dfs_ch(mac_ctx->pdev, *ch_lst))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16943 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 16944 | ("ignoring dfs channel %d"), *ch_lst); |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 16945 | ch_lst++; |
| 16946 | continue; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16947 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 16948 | |
| 16949 | if (mac_ctx->roam.configParam.sta_roam_policy. |
| 16950 | skip_unsafe_channels && |
| 16951 | unsafe_chan_cnt) { |
| 16952 | is_unsafe_chan = false; |
| 16953 | for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { |
| 16954 | if (unsafe_chan[cnt] == *ch_lst) { |
| 16955 | is_unsafe_chan = true; |
| 16956 | break; |
| 16957 | } |
| 16958 | } |
| 16959 | if (is_unsafe_chan) { |
| 16960 | QDF_TRACE(QDF_MODULE_ID_SME, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 16961 | QDF_TRACE_LEVEL_DEBUG, |
| 16962 | ("ignoring unsafe channel %d"), |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 16963 | *ch_lst); |
| 16964 | ch_lst++; |
| 16965 | continue; |
| 16966 | } |
| 16967 | } |
| 16968 | req_buf->ConnectedNetwork.ChannelCache[num_channels++] = |
| 16969 | *ch_lst; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16970 | ch_lst++; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 16971 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16972 | } |
| 16973 | req_buf->ConnectedNetwork.ChannelCount = num_channels; |
| 16974 | req_buf->ChannelCacheType = CHANNEL_LIST_STATIC; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 16975 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 16976 | } |
| 16977 | |
| 16978 | /** |
| 16979 | * csr_fetch_ch_lst_from_occupied_lst() - fetch channel list from occupied list |
| 16980 | * and update req msg |
| 16981 | * paramters |
| 16982 | * @mac_ctx: global mac ctx |
| 16983 | * @session_id: session id |
| 16984 | * @reason: reason to roam |
| 16985 | * @req_buf: out param, roam offload scan request packet |
| 16986 | * @roam_info: roam info struct |
| 16987 | * |
| 16988 | * Return: void |
| 16989 | */ |
| 16990 | static void |
| 16991 | csr_fetch_ch_lst_from_occupied_lst(tpAniSirGlobal mac_ctx, |
| 16992 | uint8_t session_id, |
| 16993 | uint8_t reason, |
| 16994 | tSirRoamOffloadScanReq *req_buf, |
| 16995 | tpCsrNeighborRoamControlInfo roam_info) |
| 16996 | { |
| 16997 | uint8_t i = 0; |
| 16998 | uint8_t num_channels = 0; |
| 16999 | uint8_t *ch_lst = |
| 17000 | mac_ctx->scan.occupiedChannels[session_id].channelList; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17001 | uint16_t unsafe_chan[NUM_CHANNELS]; |
| 17002 | uint16_t unsafe_chan_cnt = 0; |
| 17003 | uint16_t cnt = 0; |
| 17004 | bool is_unsafe_chan; |
| 17005 | qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); |
| 17006 | |
| 17007 | if (!qdf_ctx) { |
| 17008 | cds_err("qdf_ctx is NULL"); |
| 17009 | return; |
| 17010 | } |
| 17011 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17012 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17013 | "Num of channels before filtering=%d", |
| 17014 | mac_ctx->scan.occupiedChannels[session_id].numChannels); |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17015 | pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, |
| 17016 | &unsafe_chan_cnt, |
| 17017 | sizeof(unsafe_chan)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17018 | for (i = 0; i < mac_ctx->scan.occupiedChannels[session_id].numChannels; |
| 17019 | i++) { |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17020 | if ((!mac_ctx->roam.configParam.allowDFSChannelRoam || |
| 17021 | (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == |
| 17022 | CSR_STA_ROAM_POLICY_DFS_DISABLED)) && |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 17023 | (wlan_reg_is_dfs_ch(mac_ctx->pdev, *ch_lst))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17024 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 17025 | ("ignoring dfs channel %d"), *ch_lst); |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17026 | ch_lst++; |
| 17027 | continue; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17028 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17029 | |
| 17030 | if (mac_ctx->roam.configParam.sta_roam_policy. |
| 17031 | skip_unsafe_channels && |
| 17032 | unsafe_chan_cnt) { |
| 17033 | is_unsafe_chan = false; |
| 17034 | for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { |
| 17035 | if (unsafe_chan[cnt] == *ch_lst) { |
| 17036 | is_unsafe_chan = true; |
| 17037 | break; |
| 17038 | } |
| 17039 | } |
| 17040 | if (is_unsafe_chan) { |
| 17041 | QDF_TRACE(QDF_MODULE_ID_SME, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17042 | QDF_TRACE_LEVEL_DEBUG, |
| 17043 | ("ignoring unsafe channel %d"), |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17044 | *ch_lst); |
| 17045 | ch_lst++; |
| 17046 | continue; |
| 17047 | } |
| 17048 | } |
| 17049 | req_buf->ConnectedNetwork.ChannelCache[num_channels++] = |
| 17050 | *ch_lst; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17051 | if (*ch_lst) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17052 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17053 | "DFSRoam=%d, ChnlState=%d, Chnl=%d, num_ch=%d", |
| 17054 | mac_ctx->roam.configParam.allowDFSChannelRoam, |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 17055 | wlan_reg_get_channel_state(mac_ctx->pdev, |
| 17056 | *ch_lst), |
| 17057 | *ch_lst, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17058 | num_channels); |
| 17059 | ch_lst++; |
| 17060 | } |
| 17061 | req_buf->ConnectedNetwork.ChannelCount = num_channels; |
| 17062 | /* |
| 17063 | * If the profile changes as to what it was earlier, inform the FW |
| 17064 | * through FLUSH as ChannelCacheType in which case, the FW will flush |
| 17065 | * the occupied channels for the earlier profile and try to learn them |
| 17066 | * afresh |
| 17067 | */ |
| 17068 | if (reason == REASON_FLUSH_CHANNEL_LIST) |
| 17069 | req_buf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_FLUSH; |
| 17070 | else { |
| 17071 | if (csr_neighbor_roam_is_new_connected_profile(mac_ctx, |
| 17072 | session_id)) |
| 17073 | req_buf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_INIT; |
| 17074 | else |
| 17075 | req_buf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
| 17076 | } |
| 17077 | } |
| 17078 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17079 | /** |
| 17080 | * csr_fetch_valid_ch_lst() - fetch channel list from valid channel list and |
| 17081 | * update req msg |
| 17082 | * paramters |
| 17083 | * @mac_ctx: global mac ctx |
| 17084 | * @req_buf: out param, roam offload scan request packet |
| 17085 | * |
| 17086 | * Return: void |
| 17087 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17088 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17089 | csr_fetch_valid_ch_lst(tpAniSirGlobal mac_ctx, |
| 17090 | tSirRoamOffloadScanReq *req_buf) |
| 17091 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17092 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17093 | uint32_t host_channels = 0; |
| 17094 | uint8_t *ch_lst = NULL; |
| 17095 | uint8_t i = 0, num_channels = 0; |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17096 | uint16_t unsafe_chan[NUM_CHANNELS]; |
| 17097 | uint16_t unsafe_chan_cnt = 0; |
| 17098 | uint16_t cnt = 0; |
| 17099 | bool is_unsafe_chan; |
| 17100 | qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); |
| 17101 | |
| 17102 | if (!qdf_ctx) { |
| 17103 | cds_err("qdf_ctx is NULL"); |
| 17104 | return QDF_STATUS_E_FAILURE; |
| 17105 | } |
| 17106 | |
| 17107 | pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, |
| 17108 | &unsafe_chan_cnt, |
| 17109 | sizeof(unsafe_chan)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17110 | |
| 17111 | host_channels = sizeof(mac_ctx->roam.validChannelList); |
| 17112 | status = csr_get_cfg_valid_channels(mac_ctx, |
| 17113 | mac_ctx->roam.validChannelList, |
| 17114 | &host_channels); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17115 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17116 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17117 | "Failed to get the valid channel list"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17118 | return status; |
| 17119 | } |
| 17120 | ch_lst = mac_ctx->roam.validChannelList; |
| 17121 | mac_ctx->roam.numValidChannels = host_channels; |
| 17122 | for (i = 0; i < mac_ctx->roam.numValidChannels; i++) { |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17123 | ch_lst++; |
| 17124 | if ((!mac_ctx->roam.configParam.allowDFSChannelRoam || |
| 17125 | (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == |
| 17126 | CSR_STA_ROAM_POLICY_DFS_DISABLED)) && |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 17127 | (wlan_reg_is_dfs_ch(mac_ctx->pdev, *ch_lst))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17128 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 17129 | ("ignoring dfs channel %d"), *ch_lst); |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17130 | ch_lst++; |
| 17131 | continue; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17132 | } |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17133 | |
| 17134 | if (mac_ctx->roam.configParam. |
| 17135 | sta_roam_policy.skip_unsafe_channels && |
| 17136 | unsafe_chan_cnt) { |
| 17137 | is_unsafe_chan = false; |
| 17138 | for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { |
| 17139 | if (unsafe_chan[cnt] == *ch_lst) { |
| 17140 | is_unsafe_chan = true; |
| 17141 | break; |
| 17142 | } |
| 17143 | } |
| 17144 | if (is_unsafe_chan) { |
| 17145 | QDF_TRACE(QDF_MODULE_ID_SME, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17146 | QDF_TRACE_LEVEL_DEBUG, |
| 17147 | ("ignoring unsafe channel %d"), |
Agrawal Ashish | 21ba257 | 2016-09-03 16:40:10 +0530 | [diff] [blame] | 17148 | *ch_lst); |
| 17149 | ch_lst++; |
| 17150 | continue; |
| 17151 | } |
| 17152 | } |
| 17153 | req_buf->ConnectedNetwork.ChannelCache[num_channels++] = |
| 17154 | *ch_lst; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17155 | ch_lst++; |
| 17156 | } |
| 17157 | req_buf->ValidChannelCount = num_channels; |
| 17158 | return status; |
| 17159 | } |
| 17160 | |
| 17161 | /** |
| 17162 | * csr_create_roam_scan_offload_request() - init roam offload scan request |
| 17163 | * |
| 17164 | * paramters |
| 17165 | * @mac_ctx: global mac ctx |
| 17166 | * @command: roam scan offload command input |
| 17167 | * @session_id: session id |
| 17168 | * @reason: reason to roam |
| 17169 | * @session: roam session |
| 17170 | * @roam_info: roam info struct |
| 17171 | * |
| 17172 | * Return: roam offload scan request packet buffer |
| 17173 | */ |
| 17174 | static tSirRoamOffloadScanReq * |
| 17175 | csr_create_roam_scan_offload_request(tpAniSirGlobal mac_ctx, |
| 17176 | uint8_t command, |
| 17177 | uint8_t session_id, |
| 17178 | uint8_t reason, |
| 17179 | tCsrRoamSession *session, |
| 17180 | tpCsrNeighborRoamControlInfo roam_info) |
| 17181 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17182 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17183 | uint8_t i, j, dot11_mode; |
| 17184 | bool ese_neighbor_list_recvd = false; |
| 17185 | uint8_t ch_cache_str[128] = { 0 }; |
| 17186 | tSirRoamOffloadScanReq *req_buf = NULL; |
| 17187 | tpCsrChannelInfo curr_ch_lst_info = |
| 17188 | &roam_info->roamChannelInfo.currentChannelListInfo; |
| 17189 | #ifdef FEATURE_WLAN_ESE |
| 17190 | /* |
| 17191 | * this flag will be true if connection is ESE and no neighbor |
| 17192 | * list received or if the connection is not ESE |
| 17193 | */ |
| 17194 | ese_neighbor_list_recvd = ((roam_info->isESEAssoc) |
| 17195 | && (roam_info->roamChannelInfo.IAPPNeighborListReceived |
| 17196 | == false)) |
| 17197 | || (roam_info->isESEAssoc == false); |
| 17198 | #endif /* FEATURE_WLAN_ESE */ |
| 17199 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 17200 | req_buf = qdf_mem_malloc(sizeof(tSirRoamOffloadScanReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17201 | if (NULL == req_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17202 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17203 | "Mem alloc for roam scan offload req failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17204 | return NULL; |
| 17205 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17206 | req_buf->Command = command; |
| 17207 | /* |
| 17208 | * If command is STOP, then pass down ScanOffloadEnabled as Zero. This |
| 17209 | * will handle the case of host driver reloads, but Riva still up and |
| 17210 | * running |
| 17211 | */ |
| 17212 | if (command == ROAM_SCAN_OFFLOAD_STOP) { |
| 17213 | /* |
| 17214 | * clear the roaming parameters that are per connection. |
| 17215 | * For a new connection, they have to be programmed again. |
| 17216 | */ |
| 17217 | if (csr_neighbor_middle_of_roaming((tHalHandle)mac_ctx, |
| 17218 | session_id)) |
| 17219 | req_buf->middle_of_roaming = 1; |
| 17220 | else |
| 17221 | csr_roam_reset_roam_params(mac_ctx); |
| 17222 | req_buf->RoamScanOffloadEnabled = 0; |
| 17223 | } else { |
| 17224 | req_buf->RoamScanOffloadEnabled = |
| 17225 | mac_ctx->roam.configParam.isRoamOffloadScanEnabled; |
| 17226 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 17227 | qdf_mem_copy(req_buf->ConnectedNetwork.currAPbssid, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 17228 | roam_info->currAPbssid.bytes, sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17229 | req_buf->ConnectedNetwork.ssId.length = |
| 17230 | mac_ctx->roam.roamSession[session_id]. |
| 17231 | connectedProfile.SSID.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 17232 | qdf_mem_copy(req_buf->ConnectedNetwork.ssId.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17233 | mac_ctx->roam.roamSession[session_id]. |
| 17234 | connectedProfile.SSID.ssId, |
| 17235 | req_buf->ConnectedNetwork.ssId.length); |
| 17236 | req_buf->ConnectedNetwork.authentication = |
| 17237 | mac_ctx->roam.roamSession[session_id].connectedProfile.AuthType; |
| 17238 | req_buf->ConnectedNetwork.encryption = |
| 17239 | mac_ctx->roam.roamSession[session_id]. |
| 17240 | connectedProfile.EncryptionType; |
| 17241 | req_buf->ConnectedNetwork.mcencryption = |
| 17242 | mac_ctx->roam.roamSession[session_id]. |
| 17243 | connectedProfile.mcEncryptionType; |
| 17244 | #ifdef WLAN_FEATURE_11W |
| 17245 | req_buf->ConnectedNetwork.mfp_enabled = |
| 17246 | mac_ctx->roam.roamSession[session_id].connectedProfile.MFPEnabled; |
| 17247 | #endif |
| 17248 | req_buf->delay_before_vdev_stop = |
| 17249 | roam_info->cfgParams.delay_before_vdev_stop; |
| 17250 | req_buf->OpportunisticScanThresholdDiff = |
| 17251 | roam_info->cfgParams.nOpportunisticThresholdDiff; |
| 17252 | req_buf->RoamRescanRssiDiff = |
| 17253 | roam_info->cfgParams.nRoamRescanRssiDiff; |
| 17254 | req_buf->RoamRssiDiff = mac_ctx->roam.configParam.RoamRssiDiff; |
| 17255 | req_buf->reason = reason; |
| 17256 | req_buf->NeighborScanTimerPeriod = |
| 17257 | roam_info->cfgParams.neighborScanPeriod; |
Sridhar Selvaraj | 1b2330c | 2017-07-21 15:16:42 +0530 | [diff] [blame] | 17258 | req_buf->neighbor_scan_min_timer_period = |
| 17259 | roam_info->cfgParams.neighbor_scan_min_period; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17260 | req_buf->NeighborRoamScanRefreshPeriod = |
| 17261 | roam_info->cfgParams.neighborResultsRefreshPeriod; |
| 17262 | req_buf->NeighborScanChannelMinTime = |
| 17263 | roam_info->cfgParams.minChannelScanTime; |
| 17264 | req_buf->NeighborScanChannelMaxTime = |
| 17265 | roam_info->cfgParams.maxChannelScanTime; |
| 17266 | req_buf->EmptyRefreshScanPeriod = |
| 17267 | roam_info->cfgParams.emptyScanRefreshPeriod; |
| 17268 | req_buf->RoamBmissFirstBcnt = |
| 17269 | roam_info->cfgParams.nRoamBmissFirstBcnt; |
| 17270 | req_buf->RoamBmissFinalBcnt = |
| 17271 | roam_info->cfgParams.nRoamBmissFinalBcnt; |
| 17272 | req_buf->RoamBeaconRssiWeight = |
| 17273 | roam_info->cfgParams.nRoamBeaconRssiWeight; |
| 17274 | /* MAWC feature */ |
| 17275 | req_buf->MAWCEnabled = mac_ctx->roam.configParam.MAWCEnabled; |
| 17276 | #ifdef FEATURE_WLAN_ESE |
| 17277 | req_buf->IsESEAssoc = |
Srinivas Girigowda | 18dcf3d | 2015-12-16 18:11:48 -0800 | [diff] [blame] | 17278 | csr_roam_is_ese_assoc(mac_ctx, session_id) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17279 | ((req_buf->ConnectedNetwork.authentication == |
| 17280 | eCSR_AUTH_TYPE_OPEN_SYSTEM) || |
| 17281 | (csr_is_auth_type_ese(req_buf-> |
| 17282 | ConnectedNetwork.authentication))); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17283 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 17284 | "IsEseAssoc: %d middle of roaming: %d ese_neighbor_list_recvd: %d cur no of chan: %d", |
Selvaraj, Sridhar | 8fe6c67 | 2017-01-10 11:37:29 +0530 | [diff] [blame] | 17285 | req_buf->IsESEAssoc, |
| 17286 | req_buf->middle_of_roaming, |
| 17287 | ese_neighbor_list_recvd, |
| 17288 | curr_ch_lst_info->numOfChannels); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17289 | #endif |
| 17290 | if (ese_neighbor_list_recvd || curr_ch_lst_info->numOfChannels == 0) { |
| 17291 | /* |
| 17292 | * Retrieve the Channel Cache either from ini or from the |
| 17293 | * occupied channels list. Give Preference to INI Channels |
| 17294 | */ |
| 17295 | if (roam_info->cfgParams.channelInfo.numOfChannels) { |
| 17296 | status = csr_fetch_ch_lst_from_ini(mac_ctx, roam_info, |
| 17297 | req_buf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17298 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Selvaraj, Sridhar | 8fe6c67 | 2017-01-10 11:37:29 +0530 | [diff] [blame] | 17299 | QDF_TRACE(QDF_MODULE_ID_SME, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 17300 | QDF_TRACE_LEVEL_DEBUG, |
| 17301 | "Fetch channel list from ini failed"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 17302 | qdf_mem_free(req_buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17303 | return NULL; |
| 17304 | } |
| 17305 | } else { |
| 17306 | csr_fetch_ch_lst_from_occupied_lst(mac_ctx, session_id, |
| 17307 | reason, req_buf, roam_info); |
| 17308 | } |
| 17309 | } |
| 17310 | #ifdef FEATURE_WLAN_ESE |
| 17311 | else { |
| 17312 | /* |
| 17313 | * If ESE is enabled, and a neighbor Report is received,then |
| 17314 | * Ignore the INI Channels or the Occupied Channel List. |
| 17315 | * Consider the channels in the neighbor list sent by the ESE AP |
| 17316 | */ |
| 17317 | csr_fetch_ch_lst_from_received_list(mac_ctx, roam_info, |
| 17318 | curr_ch_lst_info, req_buf); |
| 17319 | } |
| 17320 | #endif |
Selvaraj, Sridhar | 3810183 | 2017-05-12 14:23:07 +0530 | [diff] [blame] | 17321 | |
| 17322 | if (req_buf->ConnectedNetwork.ChannelCount == 0) { |
| 17323 | /* Maintain the Valid Channels List */ |
| 17324 | status = csr_fetch_valid_ch_lst(mac_ctx, req_buf); |
| 17325 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 17326 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
| 17327 | "Fetch channel list fail"); |
| 17328 | qdf_mem_free(req_buf); |
| 17329 | return NULL; |
| 17330 | } |
| 17331 | } |
| 17332 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17333 | for (i = 0, j = 0; i < req_buf->ConnectedNetwork.ChannelCount; i++) { |
| 17334 | if (j < sizeof(ch_cache_str)) { |
| 17335 | j += snprintf(ch_cache_str + j, |
| 17336 | sizeof(ch_cache_str) - j, " %d", |
| 17337 | req_buf->ConnectedNetwork. |
| 17338 | ChannelCache[i]); |
| 17339 | } else |
| 17340 | break; |
| 17341 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17342 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17343 | FL("ChnlCacheType:%d, No of Chnls:%d,Channels: %s"), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17344 | req_buf->ChannelCacheType, |
| 17345 | req_buf->ConnectedNetwork.ChannelCount, ch_cache_str); |
| 17346 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17347 | req_buf->MDID.mdiePresent = |
| 17348 | mac_ctx->roam.roamSession[session_id]. |
| 17349 | connectedProfile.MDID.mdiePresent; |
| 17350 | req_buf->MDID.mobilityDomain = |
| 17351 | mac_ctx->roam.roamSession[session_id]. |
| 17352 | connectedProfile.MDID.mobilityDomain; |
| 17353 | req_buf->sessionId = session_id; |
| 17354 | req_buf->nProbes = mac_ctx->roam.configParam.nProbes; |
| 17355 | req_buf->HomeAwayTime = mac_ctx->roam.configParam.nRoamScanHomeAwayTime; |
| 17356 | |
| 17357 | /* |
| 17358 | * Home Away Time should be at least equal to (MaxDwell time + (2*RFS)), |
| 17359 | * where RFS is the RF Switching time. It is twice RFS to consider the |
| 17360 | * time to go off channel and return to the home channel. |
| 17361 | */ |
| 17362 | if (req_buf->HomeAwayTime < (req_buf->NeighborScanChannelMaxTime + |
| 17363 | (2 * CSR_ROAM_SCAN_CHANNEL_SWITCH_TIME))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17364 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 17365 | "Invalid config, Home away time(%d) is less than (twice RF switching time + channel max time)(%d). Hence enforcing home away time to disable (0)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17366 | req_buf->HomeAwayTime, |
| 17367 | (req_buf->NeighborScanChannelMaxTime + |
| 17368 | (2 * CSR_ROAM_SCAN_CHANNEL_SWITCH_TIME))); |
| 17369 | req_buf->HomeAwayTime = 0; |
| 17370 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17371 | |
| 17372 | /*Prepare a probe request for 2.4GHz band and one for 5GHz band */ |
| 17373 | dot11_mode = (uint8_t) csr_translate_to_wni_cfg_dot11_mode(mac_ctx, |
| 17374 | csr_find_best_phy_mode(mac_ctx, |
| 17375 | mac_ctx->roam.configParam.phyMode)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17376 | req_buf->allowDFSChannelRoam = |
| 17377 | mac_ctx->roam.configParam.allowDFSChannelRoam; |
Varun Reddy Yeturu | 0518629 | 2015-09-28 17:12:33 -0700 | [diff] [blame] | 17378 | req_buf->early_stop_scan_enable = |
| 17379 | mac_ctx->roam.configParam.early_stop_scan_enable; |
| 17380 | req_buf->early_stop_scan_min_threshold = |
| 17381 | mac_ctx->roam.configParam.early_stop_scan_min_threshold; |
| 17382 | req_buf->early_stop_scan_max_threshold = |
| 17383 | mac_ctx->roam.configParam.early_stop_scan_max_threshold; |
Gupta, Kapil | 96c7f2f | 2016-04-25 19:13:41 +0530 | [diff] [blame] | 17384 | req_buf->roamscan_adaptive_dwell_mode = |
| 17385 | mac_ctx->roam.configParam.roamscan_adaptive_dwell_mode; |
Selvaraj, Sridhar | 57ce4df | 2017-05-29 18:30:49 +0530 | [diff] [blame] | 17386 | req_buf->lca_config_params.disallow_duration = |
| 17387 | mac_ctx->roam.configParam.disallow_duration; |
| 17388 | req_buf->lca_config_params.rssi_channel_penalization = |
| 17389 | mac_ctx->roam.configParam.rssi_channel_penalization; |
| 17390 | req_buf->lca_config_params.num_disallowed_aps = |
| 17391 | mac_ctx->roam.configParam.num_disallowed_aps; |
| 17392 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17393 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Selvaraj, Sridhar | 57ce4df | 2017-05-29 18:30:49 +0530 | [diff] [blame] | 17394 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 17395 | FL("HomeAwayTime=%d EarlyStopFeature Enable=%d, MinThresh=%d, MaxThresh=%d PMK len=%d disallow_dur=%d rssi_chan_pen=%d num_disallowed_aps=%d"), |
| 17396 | req_buf->HomeAwayTime, |
| 17397 | req_buf->early_stop_scan_enable, |
| 17398 | req_buf->early_stop_scan_min_threshold, |
| 17399 | req_buf->early_stop_scan_max_threshold, |
| 17400 | req_buf->pmk_len, |
| 17401 | req_buf->lca_config_params.disallow_duration, |
| 17402 | req_buf->lca_config_params.rssi_channel_penalization, |
| 17403 | req_buf->lca_config_params.num_disallowed_aps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17404 | req_buf->RoamOffloadEnabled = csr_roamIsRoamOffloadEnabled(mac_ctx); |
| 17405 | req_buf->RoamKeyMgmtOffloadEnabled = session->RoamKeyMgmtOffloadEnabled; |
Deepak Dhamdhere | 828f189 | 2017-02-09 11:51:19 -0800 | [diff] [blame] | 17406 | req_buf->pmkid_modes = session->pmkid_modes; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17407 | /* Roam Offload piggybacks upon the Roam Scan offload command. */ |
| 17408 | if (req_buf->RoamOffloadEnabled) |
| 17409 | csr_update_roam_scan_offload_request(mac_ctx, req_buf, session); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 17410 | qdf_mem_copy(&req_buf->roam_params, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17411 | &mac_ctx->roam.configParam.roam_params, |
| 17412 | sizeof(req_buf->roam_params)); |
| 17413 | #endif |
| 17414 | return req_buf; |
| 17415 | } |
| 17416 | /** |
| 17417 | * check_allowed_ssid_list() - Check the WhiteList |
| 17418 | * @req_buffer: Buffer which contains the connected profile SSID. |
| 17419 | * @roam_params: Buffer which contains the whitelist SSID's. |
| 17420 | * |
| 17421 | * Check if the connected profile SSID exists in the whitelist. |
| 17422 | * It is assumed that the framework provides this also in the whitelist. |
| 17423 | * If it exists there is no issue. Otherwise add it to the list. |
| 17424 | * |
| 17425 | * Return: None |
| 17426 | */ |
| 17427 | static void check_allowed_ssid_list(tSirRoamOffloadScanReq *req_buffer, |
| 17428 | struct roam_ext_params *roam_params) |
| 17429 | { |
| 17430 | int i = 0; |
| 17431 | bool match = false; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 17432 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17433 | for (i = 0; i < roam_params->num_ssid_allowed_list; i++) { |
| 17434 | if ((roam_params->ssid_allowed_list[i].length == |
| 17435 | req_buffer->ConnectedNetwork.ssId.length) && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 17436 | (!qdf_mem_cmp(roam_params->ssid_allowed_list[i].ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17437 | req_buffer->ConnectedNetwork.ssId.ssId, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 17438 | roam_params->ssid_allowed_list[i].length))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17439 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17440 | "Whitelist contains connected profile SSID"); |
| 17441 | match = true; |
| 17442 | break; |
| 17443 | } |
| 17444 | } |
| 17445 | if (!match) { |
| 17446 | if (roam_params->num_ssid_allowed_list >= |
| 17447 | MAX_SSID_ALLOWED_LIST) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17448 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17449 | "Whitelist is FULL. Cannot Add another entry"); |
| 17450 | return; |
| 17451 | } |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17452 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17453 | "Adding Connected profile SSID to whitelist"); |
| 17454 | /* i is the next available index to add the entry.*/ |
| 17455 | i = roam_params->num_ssid_allowed_list; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 17456 | qdf_mem_copy(roam_params->ssid_allowed_list[i].ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17457 | req_buffer->ConnectedNetwork.ssId.ssId, |
| 17458 | req_buffer->ConnectedNetwork.ssId.length); |
| 17459 | roam_params->ssid_allowed_list[i].length = |
| 17460 | req_buffer->ConnectedNetwork.ssId.length; |
| 17461 | roam_params->num_ssid_allowed_list++; |
| 17462 | } |
| 17463 | } |
| 17464 | |
Abhishek Singh | 4db8c15 | 2017-07-18 10:40:08 +0530 | [diff] [blame] | 17465 | /** |
| 17466 | * csr_add_rssi_reject_ap_list() - add rssi reject AP list to the |
| 17467 | * roam params |
| 17468 | * @mac_ctx: mac ctx. |
| 17469 | * @roam_params: roam params in which reject AP list needs |
| 17470 | * to be populated. |
| 17471 | * |
| 17472 | * Return: None |
| 17473 | */ |
| 17474 | static void csr_add_rssi_reject_ap_list(tpAniSirGlobal mac_ctx, |
| 17475 | struct roam_ext_params *roam_params) |
| 17476 | { |
| 17477 | int i = 0; |
| 17478 | struct sir_rssi_disallow_lst *cur_node; |
| 17479 | qdf_list_node_t *cur_list = NULL; |
| 17480 | qdf_list_node_t *next_list = NULL; |
| 17481 | struct rssi_disallow_bssid *rssi_rejection_ap; |
| 17482 | qdf_list_t *list = &mac_ctx->roam.rssi_disallow_bssid; |
| 17483 | qdf_time_t cur_time = |
| 17484 | qdf_do_div(qdf_get_monotonic_boottime(), |
| 17485 | QDF_MC_TIMER_TO_MS_UNIT); |
| 17486 | |
| 17487 | roam_params->num_rssi_rejection_ap = qdf_list_size(list); |
| 17488 | |
| 17489 | if (!qdf_list_size(list)) |
| 17490 | return; |
| 17491 | |
| 17492 | if (roam_params->num_rssi_rejection_ap > MAX_RSSI_AVOID_BSSID_LIST) |
| 17493 | roam_params->num_rssi_rejection_ap = MAX_RSSI_AVOID_BSSID_LIST; |
| 17494 | |
| 17495 | qdf_list_peek_front(list, &cur_list); |
| 17496 | while (cur_list) { |
| 17497 | int32_t rem_time; |
| 17498 | |
| 17499 | rssi_rejection_ap = &roam_params->rssi_rejection_ap[i]; |
| 17500 | cur_node = qdf_container_of(cur_list, |
| 17501 | struct sir_rssi_disallow_lst, node); |
| 17502 | rem_time = cur_node->retry_delay - |
| 17503 | (cur_time - cur_node->time_during_rejection); |
| 17504 | |
| 17505 | if (rem_time > 0) { |
| 17506 | qdf_copy_macaddr(&rssi_rejection_ap->bssid, |
| 17507 | &cur_node->bssid); |
| 17508 | rssi_rejection_ap->expected_rssi = |
| 17509 | cur_node->expected_rssi; |
| 17510 | rssi_rejection_ap->remaining_duration = rem_time; |
| 17511 | i++; |
| 17512 | } |
| 17513 | qdf_list_peek_next(list, cur_list, &next_list); |
| 17514 | cur_list = next_list; |
| 17515 | next_list = NULL; |
| 17516 | |
| 17517 | if (i >= MAX_RSSI_AVOID_BSSID_LIST) |
| 17518 | break; |
| 17519 | } |
| 17520 | for (i = 0; i < roam_params->num_rssi_rejection_ap; i++) { |
| 17521 | sme_debug("BSSID %pM expected rssi %d remaining duration %d", |
| 17522 | roam_params->rssi_rejection_ap[i].bssid.bytes, |
| 17523 | roam_params->rssi_rejection_ap[i].expected_rssi, |
| 17524 | roam_params->rssi_rejection_ap[i].remaining_duration); |
| 17525 | } |
| 17526 | } |
| 17527 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17528 | /* |
| 17529 | * Below Table describe whether RSO command can be send down to fimrware or not. |
| 17530 | * Host check it on the basis of previous RSO command sent down to firmware. |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 17531 | * ||=========================================================================|| |
| 17532 | * || New cmd | LAST SENT COMMAND ---> || |
| 17533 | * ||====|====================================================================|| |
| 17534 | * || V | START | STOP | RESTART | UPDATE_CFG| ABORT_SCAN || |
| 17535 | * || ------------------------------------------------------------------------|| |
| 17536 | * || RSO_START | NO | YES | NO | YES | NO || |
| 17537 | * || RSO_STOP | YES | YES | YES | YES | YES || |
| 17538 | * || RSO_RESTART | YES | YES | NO | YES | YES || |
| 17539 | * || RSO_UPDATE_CFG | YES | NO | YES | YES | YES || |
| 17540 | * || RSO_ABORT_SCAN | YES | NO | YES | YES | YES || |
| 17541 | * ||=========================================================================|| |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17542 | **/ |
| 17543 | #define RSO_START_BIT (1<<ROAM_SCAN_OFFLOAD_START) |
| 17544 | #define RSO_STOP_BIT (1<<ROAM_SCAN_OFFLOAD_STOP) |
| 17545 | #define RSO_RESTART_BIT (1<<ROAM_SCAN_OFFLOAD_RESTART) |
| 17546 | #define RSO_UPDATE_CFG_BIT (1<<ROAM_SCAN_OFFLOAD_UPDATE_CFG) |
Varun Reddy Yeturu | d845581 | 2016-01-16 19:05:06 -0800 | [diff] [blame] | 17547 | #define RSO_ABORT_SCAN_BIT (1<<ROAM_SCAN_OFFLOAD_ABORT_SCAN) |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 17548 | #define RSO_START_ALLOW_MASK (RSO_STOP_BIT | RSO_UPDATE_CFG_BIT) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17549 | #define RSO_STOP_ALLOW_MASK (RSO_UPDATE_CFG_BIT | RSO_RESTART_BIT | \ |
Varun Reddy Yeturu | d845581 | 2016-01-16 19:05:06 -0800 | [diff] [blame] | 17550 | RSO_STOP_BIT | RSO_START_BIT | RSO_ABORT_SCAN_BIT) |
| 17551 | #define RSO_RESTART_ALLOW_MASK (RSO_UPDATE_CFG_BIT | RSO_START_BIT | \ |
| 17552 | RSO_ABORT_SCAN_BIT | RSO_RESTART_BIT) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17553 | #define RSO_UPDATE_CFG_ALLOW_MASK (RSO_UPDATE_CFG_BIT | RSO_STOP_BIT | \ |
Varun Reddy Yeturu | d845581 | 2016-01-16 19:05:06 -0800 | [diff] [blame] | 17554 | RSO_START_BIT | RSO_ABORT_SCAN_BIT) |
| 17555 | #define RSO_ABORT_SCAN_ALLOW_MASK (RSO_START_BIT | RSO_RESTART_BIT | \ |
| 17556 | RSO_UPDATE_CFG_BIT | RSO_ABORT_SCAN_BIT) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17557 | |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 17558 | static bool csr_is_RSO_cmd_allowed(tpAniSirGlobal mac_ctx, uint8_t command, |
| 17559 | uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17560 | { |
| 17561 | tpCsrNeighborRoamControlInfo neigh_roam_info = |
| 17562 | &mac_ctx->roam.neighborRoamInfo[session_id]; |
| 17563 | uint8_t desiredMask = 0; |
| 17564 | bool ret_val; |
| 17565 | |
| 17566 | switch (command) { |
| 17567 | case ROAM_SCAN_OFFLOAD_START: |
| 17568 | desiredMask = RSO_START_ALLOW_MASK; |
| 17569 | break; |
| 17570 | case ROAM_SCAN_OFFLOAD_STOP: |
| 17571 | desiredMask = RSO_STOP_ALLOW_MASK; |
| 17572 | break; |
| 17573 | case ROAM_SCAN_OFFLOAD_RESTART: |
| 17574 | desiredMask = RSO_RESTART_ALLOW_MASK; |
| 17575 | break; |
| 17576 | case ROAM_SCAN_OFFLOAD_UPDATE_CFG: |
| 17577 | desiredMask = RSO_UPDATE_CFG_ALLOW_MASK; |
| 17578 | break; |
Varun Reddy Yeturu | d845581 | 2016-01-16 19:05:06 -0800 | [diff] [blame] | 17579 | case ROAM_SCAN_OFFLOAD_ABORT_SCAN: |
| 17580 | desiredMask = RSO_ABORT_SCAN_ALLOW_MASK; |
| 17581 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17582 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17583 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17584 | ("Wrong RSO command %d, not allowed"), command); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17585 | return 0;/*Cmd Not allowed*/ |
| 17586 | } |
| 17587 | ret_val = desiredMask & (1 << neigh_roam_info->last_sent_cmd); |
| 17588 | return ret_val; |
| 17589 | } |
| 17590 | |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 17591 | /* |
| 17592 | * csr_roam_send_rso_cmd() - API to send RSO command to PE |
| 17593 | * @mac_ctx: Pointer to global MAC structure |
| 17594 | * @session_id: Session ID |
| 17595 | * @request_buf: Pointer to tSirRoamOffloadScanReq |
| 17596 | * |
| 17597 | * Return: QDF_STATUS |
| 17598 | */ |
Jeff Johnson | 29e2ca1 | 2016-10-14 12:50:38 -0700 | [diff] [blame] | 17599 | static QDF_STATUS csr_roam_send_rso_cmd(tpAniSirGlobal mac_ctx, |
| 17600 | uint8_t session_id, |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 17601 | tSirRoamOffloadScanReq *request_buf) |
| 17602 | { |
| 17603 | QDF_STATUS status; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 17604 | |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 17605 | request_buf->message_type = eWNI_SME_ROAM_SCAN_OFFLOAD_REQ; |
| 17606 | request_buf->length = sizeof(*request_buf); |
| 17607 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 17608 | status = umac_send_mb_message_to_mac(request_buf); |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 17609 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17610 | sme_err("Send RSO from CSR failed"); |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 17611 | return status; |
| 17612 | } |
| 17613 | return QDF_STATUS_SUCCESS; |
| 17614 | } |
| 17615 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17616 | /** |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17617 | * csr_append_assoc_ies() - Append specific IE to assoc IE's buffer |
| 17618 | * @mac_ctx: Pointer to global mac context |
| 17619 | * @req_buf: Pointer to Roam offload scan request |
| 17620 | * @ie_id: IE ID to be appended |
| 17621 | * @ie_len: IE length to be appended |
| 17622 | * @ie_data: IE data to be appended |
| 17623 | * |
| 17624 | * Return: None |
| 17625 | */ |
| 17626 | static void csr_append_assoc_ies(tpAniSirGlobal mac_ctx, |
| 17627 | tSirRoamOffloadScanReq *req_buf, uint8_t ie_id, |
| 17628 | uint8_t ie_len, uint8_t *ie_data) |
| 17629 | { |
| 17630 | tSirAddie *assoc_ie = &req_buf->assoc_ie; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 17631 | |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17632 | if ((SIR_MAC_MAX_ADD_IE_LENGTH - assoc_ie->length) < ie_len) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 17633 | sme_err("Appending IE id: %d fails", ie_id); |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17634 | return; |
| 17635 | } |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17636 | assoc_ie->addIEdata[assoc_ie->length] = ie_id; |
| 17637 | assoc_ie->addIEdata[assoc_ie->length + 1] = ie_len; |
| 17638 | qdf_mem_copy(&assoc_ie->addIEdata[assoc_ie->length + 2], |
| 17639 | ie_data, ie_len); |
| 17640 | assoc_ie->length += (ie_len + 2); |
| 17641 | } |
| 17642 | |
yeshwanth sriram guntuka | 27e4ffc | 2016-12-01 18:00:17 +0530 | [diff] [blame] | 17643 | #ifdef FEATURE_WLAN_ESE |
| 17644 | /** |
| 17645 | * ese_populate_addtional_ies() - add IEs to reassoc frame |
| 17646 | * @mac_ctx: Pointer to global mac structure |
| 17647 | * @session: pointer to CSR session |
| 17648 | * @req_buf: Pointer to Roam offload scan request |
| 17649 | * |
| 17650 | * This function populates the TSPEC ie and appends the info |
| 17651 | * to assoc buffer. |
| 17652 | * |
| 17653 | * Return: None |
| 17654 | */ |
| 17655 | static void ese_populate_addtional_ies(tpAniSirGlobal mac_ctx, |
| 17656 | tCsrRoamSession *session, |
| 17657 | tSirRoamOffloadScanReq *req_buf) { |
| 17658 | |
| 17659 | uint8_t tspec_ie_hdr[SIR_MAC_OUI_WME_HDR_MIN] |
| 17660 | = { 0x00, 0x50, 0xf2, 0x02, 0x02, 0x01 }; |
| 17661 | uint8_t tspec_ie_buf[DOT11F_IE_WMMTSPEC_MAX_LEN], j; |
| 17662 | ese_wmm_tspec_ie *tspec_ie; |
| 17663 | tESETspecInfo ese_tspec; |
| 17664 | |
| 17665 | tspec_ie = (ese_wmm_tspec_ie *)(tspec_ie_buf + SIR_MAC_OUI_WME_HDR_MIN); |
| 17666 | if (csr_is_wmm_supported(mac_ctx) && |
| 17667 | mac_ctx->roam.configParam.isEseIniFeatureEnabled && |
| 17668 | csr_roam_is_ese_assoc(mac_ctx, session->sessionId)) { |
| 17669 | ese_tspec.numTspecs = sme_qos_ese_retrieve_tspec_info(mac_ctx, |
| 17670 | session->sessionId, |
| 17671 | (tTspecInfo *) &ese_tspec.tspec[0]); |
| 17672 | qdf_mem_copy(tspec_ie_buf, tspec_ie_hdr, |
| 17673 | SIR_MAC_OUI_WME_HDR_MIN); |
| 17674 | for (j = 0; j < ese_tspec.numTspecs; j++) { |
| 17675 | /* Populate the tspec_ie */ |
| 17676 | ese_populate_wmm_tspec(&ese_tspec.tspec[j].tspec, |
| 17677 | tspec_ie); |
| 17678 | csr_append_assoc_ies(mac_ctx, req_buf, |
| 17679 | IEEE80211_ELEMID_VENDOR, |
| 17680 | DOT11F_IE_WMMTSPEC_MAX_LEN, |
| 17681 | tspec_ie_buf); |
| 17682 | } |
| 17683 | } |
| 17684 | |
| 17685 | } |
| 17686 | #else |
| 17687 | static inline void ese_populate_addtional_ies(tpAniSirGlobal mac_ctx, |
| 17688 | tCsrRoamSession *session, tSirRoamOffloadScanReq *req_buf) { |
| 17689 | } |
| 17690 | #endif |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17691 | /** |
| 17692 | * csr_update_driver_assoc_ies() - Append driver built IE's to assoc IE's |
| 17693 | * @mac_ctx: Pointer to global mac structure |
| 17694 | * @session: pointer to CSR session |
| 17695 | * @req_buf: Pointer to Roam offload scan request |
| 17696 | * |
| 17697 | * Return: None |
| 17698 | */ |
| 17699 | static void csr_update_driver_assoc_ies(tpAniSirGlobal mac_ctx, |
| 17700 | tCsrRoamSession *session, |
| 17701 | tSirRoamOffloadScanReq *req_buf) |
| 17702 | { |
| 17703 | bool power_caps_populated = false; |
| 17704 | uint32_t csr_11henable = WNI_CFG_11H_ENABLED_STADEF; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 17705 | |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17706 | uint8_t *rrm_cap_ie_data |
| 17707 | = (uint8_t *) &mac_ctx->rrm.rrmPEContext.rrmEnabledCaps; |
| 17708 | uint8_t power_cap_ie_data[DOT11F_IE_POWERCAPS_MAX_LEN] |
| 17709 | = {MIN_TX_PWR_CAP, MAX_TX_PWR_CAP}; |
Naveen Rawat | 224ae9c | 2016-10-24 15:36:56 -0700 | [diff] [blame] | 17710 | uint8_t max_tx_pwr_cap = 0; |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 17711 | uint8_t supp_chan_ie[DOT11F_IE_SUPPCHANNELS_MAX_LEN], supp_chan_ie_len; |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 17712 | |
| 17713 | #ifdef FEATURE_WLAN_ESE |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 17714 | uint8_t ese_ie[DOT11F_IE_ESEVERSION_MAX_LEN] |
| 17715 | = { 0x0, 0x40, 0x96, 0x3, ESE_VERSION_SUPPORTED}; |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 17716 | #endif |
Selvaraj, Sridhar | ced5706 | 2017-01-30 15:19:07 +0530 | [diff] [blame] | 17717 | uint8_t qcn_ie[DOT11F_IE_QCN_IE_MAX_LEN] |
| 17718 | = {0x8C, 0xFD, 0xF0, 0x1, QCN_IE_VERSION_SUBATTR_ID, |
| 17719 | QCN_IE_VERSION_SUBATTR_DATA_LEN, |
| 17720 | QCN_IE_VERSION_SUPPORTED, |
| 17721 | QCN_IE_SUBVERSION_SUPPORTED}; |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 17722 | |
Naveen Rawat | 224ae9c | 2016-10-24 15:36:56 -0700 | [diff] [blame] | 17723 | if (session->pConnectBssDesc) |
| 17724 | max_tx_pwr_cap = csr_get_cfg_max_tx_power(mac_ctx, |
| 17725 | session->pConnectBssDesc->channelId); |
Selvaraj, Sridhar | 94be8ba | 2017-05-04 17:08:54 +0530 | [diff] [blame] | 17726 | |
| 17727 | if (max_tx_pwr_cap && max_tx_pwr_cap < MAX_TX_PWR_CAP) |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17728 | power_cap_ie_data[1] = max_tx_pwr_cap; |
Selvaraj, Sridhar | 94be8ba | 2017-05-04 17:08:54 +0530 | [diff] [blame] | 17729 | else |
| 17730 | power_cap_ie_data[1] = MAX_TX_PWR_CAP; |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17731 | |
| 17732 | wlan_cfg_get_int(mac_ctx, WNI_CFG_11H_ENABLED, &csr_11henable); |
| 17733 | |
| 17734 | if (csr_11henable && csr_is11h_supported(mac_ctx)) { |
| 17735 | /* Append power cap IE */ |
| 17736 | csr_append_assoc_ies(mac_ctx, req_buf, IEEE80211_ELEMID_PWRCAP, |
| 17737 | DOT11F_IE_POWERCAPS_MAX_LEN, |
| 17738 | power_cap_ie_data); |
| 17739 | power_caps_populated = true; |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 17740 | |
| 17741 | /* Append Supported channels IE */ |
| 17742 | csr_add_supported_5Ghz_channels(mac_ctx, supp_chan_ie, |
| 17743 | &supp_chan_ie_len, true); |
| 17744 | |
| 17745 | csr_append_assoc_ies(mac_ctx, req_buf, |
| 17746 | IEEE80211_ELEMID_SUPPCHAN, |
| 17747 | supp_chan_ie_len, supp_chan_ie); |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17748 | } |
| 17749 | |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 17750 | #ifdef FEATURE_WLAN_ESE |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 17751 | /* Append ESE version IE if isEseIniFeatureEnabled INI is enabled */ |
| 17752 | if (mac_ctx->roam.configParam.isEseIniFeatureEnabled) |
| 17753 | csr_append_assoc_ies(mac_ctx, req_buf, IEEE80211_ELEMID_VENDOR, |
| 17754 | DOT11F_IE_ESEVERSION_MAX_LEN, |
| 17755 | ese_ie); |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 17756 | #endif |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 17757 | |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17758 | if (mac_ctx->rrm.rrmPEContext.rrmEnable) { |
| 17759 | /* Append RRM IE */ |
| 17760 | csr_append_assoc_ies(mac_ctx, req_buf, IEEE80211_ELEMID_RRM, |
| 17761 | DOT11F_IE_RRMENABLEDCAP_MAX_LEN, |
| 17762 | rrm_cap_ie_data); |
| 17763 | if (!power_caps_populated) |
| 17764 | /* Append Power cap IE if not appended already */ |
| 17765 | csr_append_assoc_ies(mac_ctx, req_buf, |
| 17766 | IEEE80211_ELEMID_PWRCAP, |
| 17767 | DOT11F_IE_POWERCAPS_MAX_LEN, |
| 17768 | power_cap_ie_data); |
| 17769 | } |
yeshwanth sriram guntuka | 27e4ffc | 2016-12-01 18:00:17 +0530 | [diff] [blame] | 17770 | ese_populate_addtional_ies(mac_ctx, session, req_buf); |
| 17771 | |
Selvaraj, Sridhar | ced5706 | 2017-01-30 15:19:07 +0530 | [diff] [blame] | 17772 | /* Append QCN IE if g_support_qcn_ie INI is enabled */ |
| 17773 | if (mac_ctx->roam.configParam.qcn_ie_support) |
| 17774 | csr_append_assoc_ies(mac_ctx, req_buf, IEEE80211_ELEMID_VENDOR, |
| 17775 | DOT11F_IE_QCN_IE_MAX_LEN, |
| 17776 | qcn_ie); |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 17777 | } |
| 17778 | |
| 17779 | /** |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 17780 | * csr_create_per_roam_request() - create PER roam offload scan request |
| 17781 | * |
| 17782 | * parameters |
| 17783 | * @mac_ctx: global mac ctx |
| 17784 | * @session_id: session id |
| 17785 | * |
| 17786 | * Return: per roam config request packet buffer |
| 17787 | */ |
| 17788 | static struct wmi_per_roam_config_req * |
| 17789 | csr_create_per_roam_request(tpAniSirGlobal mac_ctx, uint8_t session_id) |
| 17790 | { |
| 17791 | struct wmi_per_roam_config_req *req_buf = NULL; |
| 17792 | |
| 17793 | req_buf = qdf_mem_malloc(sizeof(struct wmi_per_roam_config_req)); |
| 17794 | if (!req_buf) { |
| 17795 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 17796 | "Mem alloc for per roam req failed"); |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 17797 | return NULL; |
| 17798 | } |
| 17799 | req_buf->vdev_id = session_id; |
| 17800 | req_buf->per_config.enable = |
| 17801 | mac_ctx->roam.configParam.per_roam_config.enable; |
| 17802 | req_buf->per_config.tx_high_rate_thresh = |
| 17803 | mac_ctx->roam.configParam.per_roam_config.tx_high_rate_thresh; |
| 17804 | req_buf->per_config.rx_high_rate_thresh = |
| 17805 | mac_ctx->roam.configParam.per_roam_config.rx_high_rate_thresh; |
| 17806 | req_buf->per_config.tx_low_rate_thresh = |
| 17807 | mac_ctx->roam.configParam.per_roam_config.tx_low_rate_thresh; |
| 17808 | req_buf->per_config.rx_low_rate_thresh = |
| 17809 | mac_ctx->roam.configParam.per_roam_config.rx_low_rate_thresh; |
| 17810 | req_buf->per_config.per_rest_time = |
| 17811 | mac_ctx->roam.configParam.per_roam_config.per_rest_time; |
Kapil Gupta | 957827b | 2017-02-13 15:47:04 +0530 | [diff] [blame] | 17812 | req_buf->per_config.tx_per_mon_time = |
| 17813 | mac_ctx->roam.configParam.per_roam_config.tx_per_mon_time; |
| 17814 | req_buf->per_config.rx_per_mon_time = |
| 17815 | mac_ctx->roam.configParam.per_roam_config.rx_per_mon_time; |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 17816 | req_buf->per_config.tx_rate_thresh_percnt = |
| 17817 | mac_ctx->roam.configParam.per_roam_config.tx_rate_thresh_percnt; |
| 17818 | req_buf->per_config.rx_rate_thresh_percnt = |
| 17819 | mac_ctx->roam.configParam.per_roam_config.rx_rate_thresh_percnt; |
Selvaraj, Sridhar | 0641fab | 2017-05-17 16:02:00 +0530 | [diff] [blame] | 17820 | req_buf->per_config.min_candidate_rssi = |
| 17821 | mac_ctx->roam.configParam.per_roam_config.min_candidate_rssi; |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 17822 | |
| 17823 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Selvaraj, Sridhar | 0641fab | 2017-05-17 16:02:00 +0530 | [diff] [blame] | 17824 | "PER based roaming configuaration enable: %d vdev: %d high_rate_thresh: %d low_rate_thresh: %d rate_thresh_percnt: %d per_rest_time: %d monitor_time: %d min cand rssi: %d", |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 17825 | req_buf->per_config.enable, session_id, |
| 17826 | req_buf->per_config.tx_high_rate_thresh, |
| 17827 | req_buf->per_config.tx_low_rate_thresh, |
| 17828 | req_buf->per_config.tx_rate_thresh_percnt, |
Kapil Gupta | 957827b | 2017-02-13 15:47:04 +0530 | [diff] [blame] | 17829 | req_buf->per_config.per_rest_time, |
Selvaraj, Sridhar | 0641fab | 2017-05-17 16:02:00 +0530 | [diff] [blame] | 17830 | req_buf->per_config.tx_per_mon_time, |
| 17831 | req_buf->per_config.min_candidate_rssi); |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 17832 | return req_buf; |
| 17833 | } |
| 17834 | |
| 17835 | /** |
| 17836 | * csr_roam_offload_per_scan() - populates roam offload scan request and sends |
| 17837 | * to WMA |
| 17838 | * |
| 17839 | * parameters |
| 17840 | * @mac_ctx: global mac ctx |
| 17841 | * @session_id: session id |
| 17842 | * |
| 17843 | * Return: result of operation |
| 17844 | */ |
| 17845 | static QDF_STATUS |
| 17846 | csr_roam_offload_per_scan(tpAniSirGlobal mac_ctx, uint8_t session_id) |
| 17847 | { |
| 17848 | tpCsrNeighborRoamControlInfo roam_info = |
| 17849 | &mac_ctx->roam.neighborRoamInfo[session_id]; |
| 17850 | struct wmi_per_roam_config_req *req_buf; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 17851 | struct scheduler_msg msg = {0}; |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 17852 | |
| 17853 | /* |
| 17854 | * No need to update in case of stop command, FW takes care of stopping |
| 17855 | * this internally |
| 17856 | */ |
| 17857 | if (roam_info->last_sent_cmd == ROAM_SCAN_OFFLOAD_STOP) |
| 17858 | return QDF_STATUS_SUCCESS; |
| 17859 | |
| 17860 | if (!mac_ctx->roam.configParam.per_roam_config.enable) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17861 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 17862 | "PER based roaming is disabled in configuration"); |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 17863 | return QDF_STATUS_SUCCESS; |
| 17864 | } |
| 17865 | |
| 17866 | req_buf = csr_create_per_roam_request(mac_ctx, session_id); |
| 17867 | if (!req_buf) { |
| 17868 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17869 | "Failed to create req packet"); |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 17870 | return QDF_STATUS_E_FAILURE; |
| 17871 | } |
| 17872 | msg.type = WMA_SET_PER_ROAM_CONFIG_CMD; |
| 17873 | msg.reserved = 0; |
| 17874 | msg.bodyptr = req_buf; |
| 17875 | if (!QDF_IS_STATUS_SUCCESS(scheduler_post_msg(QDF_MODULE_ID_WMA, |
| 17876 | &msg))) { |
| 17877 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 17878 | "%s: Unable to post WMA_SET_PER_ROAM_CONFIG_CMD to WMA", |
| 17879 | __func__); |
| 17880 | qdf_mem_free(req_buf); |
| 17881 | } |
| 17882 | return QDF_STATUS_SUCCESS; |
| 17883 | } |
| 17884 | |
| 17885 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17886 | * csr_roam_offload_scan() - populates roam offload scan request and sends to |
| 17887 | * WMA |
| 17888 | * |
| 17889 | * paramters |
| 17890 | * @mac_ctx: global mac ctx |
| 17891 | * @session_id: session id |
| 17892 | * @command: roam scan offload command input |
| 17893 | * @reason: reason to roam |
| 17894 | * |
| 17895 | * Return: result of operation |
| 17896 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17897 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17898 | csr_roam_offload_scan(tpAniSirGlobal mac_ctx, uint8_t session_id, |
| 17899 | uint8_t command, uint8_t reason) |
| 17900 | { |
| 17901 | uint8_t *state = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17902 | tSirRoamOffloadScanReq *req_buf; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17903 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17904 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); |
| 17905 | tpCsrNeighborRoamControlInfo roam_info = |
| 17906 | &mac_ctx->roam.neighborRoamInfo[session_id]; |
| 17907 | struct roam_ext_params *roam_params_dst; |
| 17908 | struct roam_ext_params *roam_params_src; |
| 17909 | uint8_t i; |
Varun Reddy Yeturu | 062dc74 | 2015-11-03 17:30:43 -0800 | [diff] [blame] | 17910 | uint8_t op_channel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17911 | |
Selvaraj, Sridhar | 8fe6c67 | 2017-01-10 11:37:29 +0530 | [diff] [blame] | 17912 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 17913 | "RSO Command %d, Session id %d, Reason %d", |
| 17914 | command, session_id, reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17915 | if (NULL == session) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17916 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17917 | "session is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17918 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17919 | } |
Sreelakshmi Konamki | bda5bbf | 2016-09-12 18:38:10 +0530 | [diff] [blame] | 17920 | |
Selvaraj, Sridhar | 5056650 | 2017-05-15 18:26:47 +0530 | [diff] [blame] | 17921 | if ((ROAM_SCAN_OFFLOAD_START == command && |
| 17922 | REASON_CTX_INIT != reason) && |
| 17923 | (session->pCurRoamProfile && |
| 17924 | session->pCurRoamProfile->do_not_roam)) { |
| 17925 | sme_debug("Supplicant disabled driver roaming"); |
| 17926 | return QDF_STATUS_E_FAILURE; |
| 17927 | } |
| 17928 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17929 | if (0 == csr_roam_is_roam_offload_scan_enabled(mac_ctx)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17930 | sme_err("isRoamOffloadScanEnabled not set"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17931 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17932 | } |
| 17933 | if (!csr_is_RSO_cmd_allowed(mac_ctx, command, session_id) && |
| 17934 | reason != REASON_ROAM_SET_BLACKLIST_BSSID) { |
Srinivas Girigowda | 6598eea | 2017-07-06 19:26:19 -0700 | [diff] [blame] | 17935 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17936 | ("RSO out-of-sync command %d lastSentCmd %d"), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17937 | command, roam_info->last_sent_cmd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17938 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17939 | } |
| 17940 | |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 17941 | if ((true == roam_info->b_roam_scan_offload_started) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17942 | && (ROAM_SCAN_OFFLOAD_START == command)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17943 | sme_err("Roam Scan Offload is already started"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17944 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17945 | } |
| 17946 | /* |
| 17947 | * The Dynamic Config Items Update may happen even if the state is in |
| 17948 | * INIT. It is important to ensure that the command is passed down to |
Naveen Rawat | 224ae9c | 2016-10-24 15:36:56 -0700 | [diff] [blame] | 17949 | * the FW only if the Infra Station is in a connected state. A connected |
| 17950 | * station could also be in a PREAUTH or REASSOC states. |
| 17951 | * 1) Block all CMDs that are not STOP in INIT State. For STOP always |
| 17952 | * inform firmware irrespective of state. |
| 17953 | * 2) Block update cfg CMD if its for REASON_ROAM_SET_BLACKLIST_BSSID, |
| 17954 | * because we need to inform firmware of blacklisted AP for PNO in |
| 17955 | * all states. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17956 | */ |
| 17957 | |
| 17958 | if ((roam_info->neighborRoamState == |
| 17959 | eCSR_NEIGHBOR_ROAM_STATE_INIT) && |
| 17960 | (command != ROAM_SCAN_OFFLOAD_STOP) && |
| 17961 | (reason != REASON_ROAM_SET_BLACKLIST_BSSID)) { |
| 17962 | state = mac_trace_get_neighbour_roam_state( |
| 17963 | roam_info->neighborRoamState); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17964 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17965 | FL("Scan Command not sent to FW state=%s and cmd=%d"), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17966 | state, command); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17967 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17968 | } |
| 17969 | |
| 17970 | req_buf = csr_create_roam_scan_offload_request(mac_ctx, command, |
| 17971 | session_id, reason, |
| 17972 | session, roam_info); |
| 17973 | if (!req_buf) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 17974 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 17975 | "Failed to create req packet"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 17976 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17977 | } |
| 17978 | roam_params_dst = &req_buf->roam_params; |
| 17979 | roam_params_src = &mac_ctx->roam.configParam.roam_params; |
| 17980 | if (reason == REASON_ROAM_SET_SSID_ALLOWED) |
| 17981 | check_allowed_ssid_list(req_buf, roam_params_src); |
Abhishek Singh | 4db8c15 | 2017-07-18 10:40:08 +0530 | [diff] [blame] | 17982 | |
| 17983 | /* |
| 17984 | * For CTX INT cmd if rssi disallow bssid list have any member |
| 17985 | * fill it and send it to firmware so that firmware does not |
| 17986 | * try to roam to these BSS untill RSSI OR time condition are |
| 17987 | * matched. |
| 17988 | */ |
| 17989 | if (reason == REASON_CTX_INIT) |
| 17990 | csr_add_rssi_reject_ap_list(mac_ctx, roam_params_src); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 17991 | /* |
| 17992 | * Configure the lookup threshold either from INI or from framework. |
| 17993 | * If both are present, give higher priority to the one from framework. |
| 17994 | */ |
| 17995 | if (roam_params_src->alert_rssi_threshold) |
| 17996 | req_buf->LookupThreshold = |
| 17997 | roam_params_src->alert_rssi_threshold; |
| 17998 | else |
| 17999 | req_buf->LookupThreshold = |
| 18000 | (int8_t)roam_info->cfgParams.neighborLookupThreshold * |
| 18001 | (-1); |
Varun Reddy Yeturu | 168134f | 2017-06-26 13:46:05 -0700 | [diff] [blame] | 18002 | req_buf->rssi_thresh_offset_5g = |
| 18003 | roam_info->cfgParams.rssi_thresh_offset_5g; |
| 18004 | sme_debug("5g offset threshold: %d", req_buf->rssi_thresh_offset_5g); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18005 | qdf_mem_copy(roam_params_dst, roam_params_src, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18006 | sizeof(struct roam_ext_params)); |
| 18007 | /* |
| 18008 | * rssi_diff which is updated via framework is equivalent to the |
| 18009 | * INI RoamRssiDiff parameter and hence should be updated. |
| 18010 | */ |
| 18011 | if (roam_params_src->rssi_diff) |
| 18012 | req_buf->RoamRssiDiff = roam_params_src->rssi_diff; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18013 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18014 | "num_bssid_avoid_list: %d num_ssid_allowed_list: %d num_bssid_favored: %d raise_rssi_thresh_5g: %d drop_rssi_thresh_5g: %d raise_rssi_type_5g: %d raise_factor_5g: %d drop_rssi_type_5g: %d drop_factor_5g: %d max_raise_rssi_5g: %d max_drop_rssi_5g: %d rssi_diff: %d alert_rssi_threshold: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18015 | roam_params_dst->num_bssid_avoid_list, |
| 18016 | roam_params_dst->num_ssid_allowed_list, |
| 18017 | roam_params_dst->num_bssid_favored, |
| 18018 | roam_params_dst->raise_rssi_thresh_5g, |
| 18019 | roam_params_dst->drop_rssi_thresh_5g, |
| 18020 | roam_params_dst->raise_rssi_type_5g, |
| 18021 | roam_params_dst->raise_factor_5g, |
| 18022 | roam_params_dst->drop_rssi_type_5g, |
| 18023 | roam_params_dst->drop_factor_5g, |
| 18024 | roam_params_dst->max_raise_rssi_5g, |
| 18025 | roam_params_dst->max_drop_rssi_5g, |
| 18026 | req_buf->RoamRssiDiff, roam_params_dst->alert_rssi_threshold); |
| 18027 | |
Gupta, Kapil | 7122125 | 2016-06-28 15:35:02 +0530 | [diff] [blame] | 18028 | /* Set initial dense roam status */ |
Kapil Gupta | 0a2477b | 2016-08-23 18:00:34 +0530 | [diff] [blame] | 18029 | if (mac_ctx->scan.roam_candidate_count[session_id] > |
Gupta, Kapil | 7122125 | 2016-06-28 15:35:02 +0530 | [diff] [blame] | 18030 | roam_params_dst->dense_min_aps_cnt) |
| 18031 | roam_params_dst->initial_dense_status = true; |
| 18032 | |
Kapil Gupta | 0a2477b | 2016-08-23 18:00:34 +0530 | [diff] [blame] | 18033 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Selvaraj, Sridhar | d1225e6 | 2017-03-17 12:56:58 +0530 | [diff] [blame] | 18034 | "dense_rssi_thresh_offset: %d, dense_min_aps_cnt:%d, traffic_threshold:%d, " |
| 18035 | "initial_dense_status:%d, candidate count:%d", |
| 18036 | roam_params_dst->dense_rssi_thresh_offset, |
| 18037 | roam_params_dst->dense_min_aps_cnt, |
| 18038 | roam_params_dst->traffic_threshold, |
| 18039 | roam_params_dst->initial_dense_status, |
| 18040 | mac_ctx->scan.roam_candidate_count[session_id]); |
Kapil Gupta | 0a2477b | 2016-08-23 18:00:34 +0530 | [diff] [blame] | 18041 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18042 | for (i = 0; i < roam_params_dst->num_bssid_avoid_list; i++) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18043 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18044 | "Blacklist Bssid:"MAC_ADDRESS_STR")", |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18045 | MAC_ADDR_ARRAY(roam_params_dst->bssid_avoid_list[i]. |
| 18046 | bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18047 | } |
| 18048 | for (i = 0; i < roam_params_dst->num_ssid_allowed_list; i++) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18049 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18050 | "Whitelist: %.*s", |
| 18051 | roam_params_dst->ssid_allowed_list[i].length, |
| 18052 | roam_params_dst->ssid_allowed_list[i].ssId); |
| 18053 | } |
| 18054 | for (i = 0; i < roam_params_dst->num_bssid_favored; i++) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18055 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18056 | "Preferred Bssid:"MAC_ADDRESS_STR") score: %d", |
Srinivas Girigowda | b053239 | 2015-11-24 11:50:16 -0800 | [diff] [blame] | 18057 | MAC_ADDR_ARRAY(roam_params_dst->bssid_favored[i].bytes), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18058 | roam_params_dst->bssid_favored_factor[i]); |
| 18059 | } |
| 18060 | |
Varun Reddy Yeturu | 062dc74 | 2015-11-03 17:30:43 -0800 | [diff] [blame] | 18061 | op_channel = session->connectedProfile.operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18062 | req_buf->hi_rssi_scan_max_count = |
| 18063 | roam_info->cfgParams.hi_rssi_scan_max_count; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18064 | req_buf->hi_rssi_scan_delay = |
| 18065 | roam_info->cfgParams.hi_rssi_scan_delay; |
| 18066 | req_buf->hi_rssi_scan_rssi_ub = |
| 18067 | roam_info->cfgParams.hi_rssi_scan_rssi_ub; |
Varun Reddy Yeturu | 062dc74 | 2015-11-03 17:30:43 -0800 | [diff] [blame] | 18068 | /* |
| 18069 | * If the current operation channel is 5G frequency band, then |
| 18070 | * there is no need to enable the HI_RSSI feature. This feature |
| 18071 | * is useful only if we are connected to a 2.4 GHz AP and we wish |
| 18072 | * to connect to a better 5GHz AP is available. |
| 18073 | */ |
Varun Reddy Yeturu | 7fc616d | 2016-04-25 17:03:56 -0700 | [diff] [blame] | 18074 | if (session->disable_hi_rssi) |
Varun Reddy Yeturu | 062dc74 | 2015-11-03 17:30:43 -0800 | [diff] [blame] | 18075 | req_buf->hi_rssi_scan_rssi_delta = 0; |
Varun Reddy Yeturu | 7fc616d | 2016-04-25 17:03:56 -0700 | [diff] [blame] | 18076 | else |
Varun Reddy Yeturu | 062dc74 | 2015-11-03 17:30:43 -0800 | [diff] [blame] | 18077 | req_buf->hi_rssi_scan_rssi_delta = |
| 18078 | roam_info->cfgParams.hi_rssi_scan_rssi_delta; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18079 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Varun Reddy Yeturu | 062dc74 | 2015-11-03 17:30:43 -0800 | [diff] [blame] | 18080 | "hi_rssi:delta=%d, max_count=%d, delay=%d, ub=%d", |
| 18081 | req_buf->hi_rssi_scan_rssi_delta, |
| 18082 | req_buf->hi_rssi_scan_max_count, |
| 18083 | req_buf->hi_rssi_scan_delay, |
| 18084 | req_buf->hi_rssi_scan_rssi_ub); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18085 | |
Selvaraj, Sridhar | fb6f4cd | 2016-09-06 18:57:52 +0530 | [diff] [blame] | 18086 | if (command != ROAM_SCAN_OFFLOAD_STOP) { |
Naveen Rawat | f311a5a | 2016-11-15 23:38:10 -0800 | [diff] [blame] | 18087 | req_buf->assoc_ie.length = session->nAddIEAssocLength; |
Selvaraj, Sridhar | a7fc763 | 2016-09-04 13:13:38 +0530 | [diff] [blame] | 18088 | qdf_mem_copy(req_buf->assoc_ie.addIEdata, |
| 18089 | session->pAddIEAssoc, |
| 18090 | session->nAddIEAssocLength); |
Selvaraj, Sridhar | 57bb4d0 | 2016-08-31 16:14:15 +0530 | [diff] [blame] | 18091 | csr_update_driver_assoc_ies(mac_ctx, session, req_buf); |
Selvaraj, Sridhar | a7fc763 | 2016-09-04 13:13:38 +0530 | [diff] [blame] | 18092 | } |
| 18093 | |
Selvaraj, Sridhar | d1225e6 | 2017-03-17 12:56:58 +0530 | [diff] [blame] | 18094 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 18095 | "Assoc IE buffer:"); |
| 18096 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 18097 | req_buf->assoc_ie.addIEdata, req_buf->assoc_ie.length); |
| 18098 | |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 18099 | if (!QDF_IS_STATUS_SUCCESS( |
| 18100 | csr_roam_send_rso_cmd(mac_ctx, session_id, req_buf))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18101 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 18102 | "%s: Not able to post message to PE", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18103 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18104 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18105 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18106 | if (ROAM_SCAN_OFFLOAD_START == command) |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 18107 | roam_info->b_roam_scan_offload_started = true; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18108 | else if (ROAM_SCAN_OFFLOAD_STOP == command) |
Varun Reddy Yeturu | 66899fe | 2017-07-11 14:00:12 -0700 | [diff] [blame] | 18109 | roam_info->b_roam_scan_offload_started = false; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18110 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18111 | /* update the last sent cmd */ |
| 18112 | roam_info->last_sent_cmd = command; |
| 18113 | |
Kapil Gupta | 5cda225 | 2016-12-29 18:44:26 +0530 | [diff] [blame] | 18114 | /* Update PER config to FW after sending the command */ |
| 18115 | csr_roam_offload_per_scan(mac_ctx, session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18116 | return status; |
| 18117 | } |
| 18118 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18119 | QDF_STATUS csr_roam_offload_scan_rsp_hdlr(tpAniSirGlobal pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18120 | tpSirRoamOffloadScanRsp |
| 18121 | scanOffloadRsp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18122 | { |
| 18123 | switch (scanOffloadRsp->reason) { |
| 18124 | case 0: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18125 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18126 | "Rsp for Roam Scan Offload with failure status"); |
| 18127 | break; |
| 18128 | case REASON_OS_REQUESTED_ROAMING_NOW: |
| 18129 | csr_neighbor_roam_proceed_with_handoff_req(pMac, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18130 | scanOffloadRsp->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18131 | break; |
| 18132 | |
| 18133 | default: |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18134 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18135 | "Rsp for Roam Scan Offload with reason %d", |
| 18136 | scanOffloadRsp->reason); |
| 18137 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18138 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18139 | } |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 18140 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18141 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18142 | /* pStaEntry is no longer invalid upon the return of this function. */ |
| 18143 | static void csr_roam_remove_stat_list_entry(tpAniSirGlobal pMac, |
| 18144 | tListElem *pEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18145 | { |
| 18146 | if (pEntry) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18147 | if (csr_ll_remove_entry(&pMac->roam.statsClientReqList, |
| 18148 | pEntry, LL_ACCESS_LOCK)) |
| 18149 | qdf_mem_free(GET_BASE_ADDR(pEntry, |
| 18150 | tCsrStatsClientReqInfo, link)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18151 | } |
| 18152 | } |
| 18153 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18154 | static void csr_roam_remove_entry_from_pe_stats_req_list(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18155 | tCsrPeStatsReqInfo *pPeStaEntry) |
| 18156 | { |
| 18157 | tListElem *pEntry; |
| 18158 | tCsrPeStatsReqInfo *pTempStaEntry; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18159 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18160 | pEntry = csr_ll_peek_head(&pMac->roam.peStatsReqList, LL_ACCESS_LOCK); |
| 18161 | if (!pEntry) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18162 | sme_err("List empty, no stats req for PE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18163 | return; |
| 18164 | } |
| 18165 | while (pEntry) { |
| 18166 | pTempStaEntry = GET_BASE_ADDR(pEntry, tCsrPeStatsReqInfo, link); |
| 18167 | if (NULL == pTempStaEntry |
| 18168 | || (pTempStaEntry->statsMask != |
| 18169 | pPeStaEntry->statsMask)) { |
| 18170 | pEntry = csr_ll_next(&pMac->roam.peStatsReqList, pEntry, |
| 18171 | LL_ACCESS_NOLOCK); |
| 18172 | continue; |
| 18173 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18174 | sme_debug("Match found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18175 | if (csr_ll_remove_entry(&pMac->roam.peStatsReqList, pEntry, |
| 18176 | LL_ACCESS_LOCK)) { |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 18177 | qdf_mem_free(pTempStaEntry); |
| 18178 | pTempStaEntry = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18179 | break; |
| 18180 | } |
| 18181 | pEntry = csr_ll_next(&pMac->roam.peStatsReqList, pEntry, |
| 18182 | LL_ACCESS_NOLOCK); |
| 18183 | } /* end of while loop */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18184 | } |
| 18185 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18186 | static void csr_roam_report_statistics(tpAniSirGlobal pMac, uint32_t statsMask, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18187 | tCsrStatsCallback callback, uint8_t staId, |
| 18188 | void *pContext) |
| 18189 | { |
| 18190 | uint8_t stats[500]; |
| 18191 | uint8_t *pStats = NULL; |
| 18192 | uint32_t tempMask = 0; |
| 18193 | uint8_t counter = 0; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18194 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18195 | if (!callback) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18196 | sme_err("Cannot report callback NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18197 | return; |
| 18198 | } |
| 18199 | if (!statsMask) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18200 | sme_err("Cannot report statsMask is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18201 | return; |
| 18202 | } |
| 18203 | pStats = stats; |
| 18204 | tempMask = statsMask; |
| 18205 | while (tempMask) { |
| 18206 | if (tempMask & 1) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18207 | /* new stats info from PE, fill up the stats |
| 18208 | * strucutres in PMAC |
| 18209 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18210 | switch (counter) { |
| 18211 | case eCsrSummaryStats: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18212 | sme_debug("Summary stats"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18213 | qdf_mem_copy(pStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18214 | (uint8_t *) &pMac->roam. |
| 18215 | summaryStatsInfo, |
| 18216 | sizeof(tCsrSummaryStatsInfo)); |
| 18217 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 18218 | break; |
| 18219 | case eCsrGlobalClassAStats: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18220 | sme_debug("ClassA stats"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18221 | qdf_mem_copy(pStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18222 | (uint8_t *) &pMac->roam. |
| 18223 | classAStatsInfo, |
| 18224 | sizeof(tCsrGlobalClassAStatsInfo)); |
| 18225 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
| 18226 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18227 | case eCsrGlobalClassDStats: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18228 | sme_debug("ClassD stats"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18229 | qdf_mem_copy(pStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18230 | (uint8_t *) &pMac->roam. |
| 18231 | classDStatsInfo, |
| 18232 | sizeof(tCsrGlobalClassDStatsInfo)); |
| 18233 | pStats += sizeof(tCsrGlobalClassDStatsInfo); |
| 18234 | break; |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 18235 | case csr_per_chain_rssi_stats: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18236 | sme_debug("Per Chain RSSI stats"); |
Himanshu Agarwal | 37e4241 | 2016-07-21 14:35:09 +0530 | [diff] [blame] | 18237 | qdf_mem_copy(pStats, |
| 18238 | (uint8_t *)&pMac->roam.per_chain_rssi_stats, |
| 18239 | sizeof(struct csr_per_chain_rssi_stats_info)); |
| 18240 | pStats += sizeof( |
| 18241 | struct csr_per_chain_rssi_stats_info); |
| 18242 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18243 | default: |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18244 | sme_err( |
| 18245 | "Unknown stats type and counter %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18246 | counter); |
| 18247 | break; |
| 18248 | } |
| 18249 | } |
| 18250 | tempMask >>= 1; |
| 18251 | counter++; |
| 18252 | } |
| 18253 | callback(stats, pContext); |
| 18254 | } |
| 18255 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18256 | static QDF_STATUS csr_roam_dereg_statistics_req(tpAniSirGlobal pMac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18257 | { |
| 18258 | tListElem *pEntry = NULL; |
| 18259 | tListElem *pPrevEntry = NULL; |
| 18260 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18261 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18262 | |
| 18263 | pEntry = csr_ll_peek_head(&pMac->roam.statsClientReqList, |
| 18264 | LL_ACCESS_LOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18265 | if (!pEntry) { |
| 18266 | /* list empty */ |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18267 | sme_debug("List empty, no request from upper layer client(s)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18268 | return status; |
| 18269 | } |
| 18270 | while (pEntry) { |
| 18271 | if (pPrevEntry) { |
| 18272 | pTempStaEntry = |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18273 | GET_BASE_ADDR(pPrevEntry, |
| 18274 | tCsrStatsClientReqInfo, link); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18275 | /* send up the stats report */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18276 | csr_roam_report_statistics(pMac, |
| 18277 | pTempStaEntry->statsMask, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18278 | pTempStaEntry->callback, |
| 18279 | pTempStaEntry->staId, |
| 18280 | pTempStaEntry->pContext); |
| 18281 | csr_roam_remove_stat_list_entry(pMac, pPrevEntry); |
| 18282 | } |
| 18283 | pTempStaEntry = |
| 18284 | GET_BASE_ADDR(pEntry, tCsrStatsClientReqInfo, link); |
| 18285 | if (pTempStaEntry->pPeStaEntry) { |
| 18286 | /* pPeStaEntry can be NULL */ |
| 18287 | pTempStaEntry->pPeStaEntry->numClient--; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18288 | /* check if we need to delete the entry from |
| 18289 | * peStatsReqList too |
| 18290 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18291 | if (!pTempStaEntry->pPeStaEntry->numClient) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18292 | csr_roam_remove_entry_from_pe_stats_req_list( |
| 18293 | pMac, |
| 18294 | pTempStaEntry-> |
| 18295 | pPeStaEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18296 | } |
| 18297 | } |
| 18298 | /* check if we need to stop the tl stats timer too */ |
| 18299 | pMac->roam.tlStatsReqInfo.numClient--; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18300 | pPrevEntry = pEntry; |
Naveen Rawat | d0ca441 | 2017-06-16 14:19:19 -0700 | [diff] [blame] | 18301 | pEntry = csr_ll_next(&pMac->roam.statsClientReqList, pEntry, |
| 18302 | LL_ACCESS_NOLOCK); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18303 | } |
| 18304 | /* the last one */ |
| 18305 | if (pPrevEntry) { |
| 18306 | pTempStaEntry = |
| 18307 | GET_BASE_ADDR(pPrevEntry, tCsrStatsClientReqInfo, link); |
| 18308 | /* send up the stats report */ |
| 18309 | csr_roam_report_statistics(pMac, pTempStaEntry->statsMask, |
| 18310 | pTempStaEntry->callback, |
| 18311 | pTempStaEntry->staId, |
| 18312 | pTempStaEntry->pContext); |
| 18313 | csr_roam_remove_stat_list_entry(pMac, pPrevEntry); |
| 18314 | } |
| 18315 | return status; |
| 18316 | |
| 18317 | } |
| 18318 | |
| 18319 | tSmeCmd *csr_get_command_buffer(tpAniSirGlobal pMac) |
| 18320 | { |
| 18321 | tSmeCmd *pCmd = sme_get_command_buffer(pMac); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18322 | |
| 18323 | if (pCmd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18324 | pMac->roam.sPendingCommands++; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18325 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18326 | return pCmd; |
| 18327 | } |
| 18328 | |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 18329 | static void csr_free_cmd_memory(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 18330 | { |
| 18331 | if (!pCommand) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 18332 | sme_err("pCommand is NULL"); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 18333 | return; |
| 18334 | } |
| 18335 | switch (pCommand->command) { |
| 18336 | case eSmeCommandScan: |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18337 | csr_scan_call_callback(pMac, pCommand, |
| 18338 | pCommand->u.scanCmd.status); |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 18339 | csr_release_command_scan(pMac, pCommand); |
| 18340 | break; |
| 18341 | case eSmeCommandRoam: |
| 18342 | csr_release_command_roam(pMac, pCommand); |
| 18343 | break; |
| 18344 | case eSmeCommandWmStatusChange: |
| 18345 | csr_release_command_wm_status_change(pMac, pCommand); |
| 18346 | break; |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 18347 | case eSmeCommandNdpInitiatorRequest: |
| 18348 | csr_release_ndp_initiator_req(pMac, pCommand); |
| 18349 | break; |
| 18350 | case eSmeCommandNdpResponderRequest: |
| 18351 | csr_release_ndp_responder_req(pMac, pCommand); |
| 18352 | break; |
| 18353 | case eSmeCommandNdpDataEndInitiatorRequest: |
| 18354 | csr_release_ndp_data_end_req(pMac, pCommand); |
| 18355 | break; |
| 18356 | case eSmeCommandRemainOnChannel: |
| 18357 | csr_release_roc_req_cmd(pMac, pCommand); |
| 18358 | break; |
| 18359 | default: |
| 18360 | break; |
| 18361 | } |
| 18362 | } |
| 18363 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18364 | void csr_release_command_buffer(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18365 | { |
| 18366 | if (pMac->roam.sPendingCommands > 0) { |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 18367 | /* |
| 18368 | * All command allocated through csr_get_command_buffer |
| 18369 | * need to decrement the pending count when releasing |
| 18370 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18371 | pMac->roam.sPendingCommands--; |
Krunal Soni | dea4595 | 2017-02-15 11:58:15 -0800 | [diff] [blame] | 18372 | csr_free_cmd_memory(pMac, pCommand); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18373 | sme_release_command(pMac, pCommand); |
| 18374 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18375 | sme_err("no pending commands"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18376 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18377 | } |
| 18378 | } |
| 18379 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18380 | void csr_release_command(tpAniSirGlobal mac_ctx, tSmeCmd *sme_cmd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18381 | { |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18382 | struct wlan_serialization_queued_cmd_info cmd_info; |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18383 | struct wlan_serialization_command cmd; |
Krunal Soni | c3c8b8b | 2017-06-19 13:52:37 -0700 | [diff] [blame] | 18384 | struct wlan_objmgr_vdev *vdev; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18385 | |
| 18386 | if (!sme_cmd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18387 | sme_err("sme_cmd is NULL"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18388 | return; |
| 18389 | } |
Krunal Soni | c3c8b8b | 2017-06-19 13:52:37 -0700 | [diff] [blame] | 18390 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc, |
| 18391 | sme_cmd->sessionId, WLAN_LEGACY_SME_ID); |
| 18392 | if (!vdev) { |
| 18393 | sme_err("Invalid vdev"); |
| 18394 | return; |
| 18395 | } |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18396 | qdf_mem_zero(&cmd_info, |
| 18397 | sizeof(struct wlan_serialization_queued_cmd_info)); |
| 18398 | if (sme_cmd->command == eSmeCommandScan || |
| 18399 | sme_cmd->command == eSmeCommandRemainOnChannel) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18400 | sme_debug("filled cmd_id[%d]", |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18401 | sme_cmd->u.scanCmd.scanID); |
| 18402 | cmd_info.cmd_id = sme_cmd->u.scanCmd.scanID; |
| 18403 | cmd_info.req_type = WLAN_SER_CANCEL_SINGLE_SCAN; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18404 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18405 | sme_debug("filled cmd_id = 0"); |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18406 | cmd_info.cmd_id = 0; |
| 18407 | cmd_info.req_type = WLAN_SER_CANCEL_NON_SCAN_CMD; |
| 18408 | } |
| 18409 | cmd_info.cmd_type = csr_get_cmd_type(sme_cmd); |
Krunal Soni | c3c8b8b | 2017-06-19 13:52:37 -0700 | [diff] [blame] | 18410 | cmd_info.vdev = vdev; |
| 18411 | qdf_mem_zero(&cmd, sizeof(struct wlan_serialization_command)); |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18412 | cmd.cmd_id = cmd_info.cmd_id; |
| 18413 | cmd.cmd_type = cmd_info.cmd_type; |
| 18414 | cmd.vdev = cmd_info.vdev; |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18415 | if (wlan_serialization_is_cmd_present_in_active_queue( |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18416 | mac_ctx->psoc, &cmd)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18417 | sme_debug("Releasing active cmd_id[%d] cmd_type[%d]", |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18418 | cmd_info.cmd_id, cmd_info.cmd_type); |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18419 | wlan_serialization_remove_cmd(&cmd_info); |
| 18420 | } else if (wlan_serialization_is_cmd_present_in_pending_queue( |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18421 | mac_ctx->psoc, &cmd)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18422 | sme_debug("Releasing pending cmd_id[%d] cmd_type[%d]", |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18423 | cmd_info.cmd_id, cmd_info.cmd_type); |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18424 | wlan_serialization_cancel_request(&cmd_info); |
| 18425 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18426 | sme_debug("can't find cmd_id[%d] cmd_type[%d]", |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18427 | cmd_info.cmd_id, cmd_info.cmd_type); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18428 | } |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18429 | if (cmd_info.vdev) |
| 18430 | wlan_objmgr_vdev_release_ref(cmd_info.vdev, WLAN_LEGACY_SME_ID); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18431 | } |
| 18432 | |
| 18433 | static enum wlan_serialization_cmd_type csr_get_scan_cmd_type(tSmeCmd *sme_cmd) |
| 18434 | { |
| 18435 | enum wlan_serialization_cmd_type cmd_type = WLAN_SER_CMD_MAX; |
| 18436 | |
| 18437 | switch (sme_cmd->u.scanCmd.reason) { |
| 18438 | case eCsrScanOther: |
| 18439 | cmd_type = WLAN_SER_CMD_SCAN_OTHER; |
| 18440 | break; |
| 18441 | case eCsrScanLostLink1: |
| 18442 | cmd_type = WLAN_SER_CMD_SCAN_LOST_LINK1; |
| 18443 | break; |
| 18444 | case eCsrScanLostLink2: |
| 18445 | cmd_type = WLAN_SER_CMD_SCAN_LOST_LINK2; |
| 18446 | break; |
| 18447 | case eCsrScanLostLink3: |
| 18448 | cmd_type = WLAN_SER_CMD_SCAN_LOST_LINK3; |
| 18449 | break; |
| 18450 | case eCsrScan11d1: |
| 18451 | cmd_type = WLAN_SER_CMD_SCAN_11D_TYPE1; |
| 18452 | break; |
| 18453 | case eCsrScan11d2: |
| 18454 | cmd_type = WLAN_SER_CMD_SCAN_11D_TYPE2; |
| 18455 | break; |
| 18456 | case eCsrScan11dDone: |
| 18457 | cmd_type = WLAN_SER_CMD_SCAN_11D_DONE; |
| 18458 | break; |
| 18459 | case eCsrScanUserRequest: |
| 18460 | cmd_type = WLAN_SER_CMD_SCAN_USER_REQ; |
| 18461 | break; |
| 18462 | case eCsrScanForSsid: |
| 18463 | cmd_type = WLAN_SER_CMD_SCAN_FOR_SSID; |
| 18464 | break; |
| 18465 | case eCsrScanIdleScan: |
| 18466 | cmd_type = WLAN_SER_CMD_SCAN_IDLE_SCAN; |
| 18467 | break; |
| 18468 | case eCsrScanProbeBss: |
| 18469 | cmd_type = WLAN_SER_CMD_SCAN_PROBE_BSS; |
| 18470 | break; |
| 18471 | case eCsrScanAbortNormalScan: |
| 18472 | cmd_type = WLAN_SER_CMD_SCAN_ABORT_NORMAL_SCAN; |
| 18473 | break; |
| 18474 | case eCsrScanP2PFindPeer: |
| 18475 | cmd_type = WLAN_SER_CMD_SCAN_P2P_FIND_PEER; |
| 18476 | break; |
| 18477 | case eCsrScanCandidateFound: |
| 18478 | cmd_type = WLAN_SER_CMD_SCAN_CANDIDATE_FOUND; |
| 18479 | break; |
| 18480 | default: |
| 18481 | break; |
| 18482 | } |
| 18483 | |
| 18484 | return cmd_type; |
| 18485 | } |
| 18486 | |
| 18487 | static enum wlan_serialization_cmd_type csr_get_roam_cmd_type(tSmeCmd *sme_cmd) |
| 18488 | { |
| 18489 | enum wlan_serialization_cmd_type cmd_type = WLAN_SER_CMD_MAX; |
| 18490 | switch (sme_cmd->u.roamCmd.roamReason) { |
| 18491 | case eCsrForcedDisassoc: |
| 18492 | cmd_type = WLAN_SER_CMD_FORCE_DISASSOC; |
| 18493 | break; |
| 18494 | case eCsrHddIssued: |
| 18495 | cmd_type = WLAN_SER_CMD_HDD_ISSUED; |
| 18496 | break; |
| 18497 | case eCsrLostLink1: |
| 18498 | cmd_type = WLAN_SER_CMD_LOST_LINK1; |
| 18499 | break; |
| 18500 | case eCsrLostLink2: |
| 18501 | cmd_type = WLAN_SER_CMD_LOST_LINK2; |
| 18502 | break; |
| 18503 | case eCsrLostLink3: |
| 18504 | cmd_type = WLAN_SER_CMD_LOST_LINK3; |
| 18505 | break; |
| 18506 | case eCsrForcedDisassocMICFailure: |
| 18507 | cmd_type = WLAN_SER_CMD_FORCE_DISASSOC_MIC_FAIL; |
| 18508 | break; |
| 18509 | case eCsrHddIssuedReassocToSameAP: |
| 18510 | cmd_type = WLAN_SER_CMD_HDD_ISSUE_REASSOC_SAME_AP; |
| 18511 | break; |
| 18512 | case eCsrSmeIssuedReassocToSameAP: |
| 18513 | cmd_type = WLAN_SER_CMD_SME_ISSUE_REASSOC_SAME_AP; |
| 18514 | break; |
| 18515 | case eCsrSmeIssuedReassocToDiffAP: |
| 18516 | cmd_type = WLAN_SER_CMD_SME_ISSUE_REASSOC_DIFF_AP; |
| 18517 | break; |
| 18518 | case eCsrForcedDeauth: |
| 18519 | cmd_type = WLAN_SER_CMD_FORCE_DEAUTH; |
| 18520 | break; |
| 18521 | case eCsrSmeIssuedDisassocForHandoff: |
| 18522 | cmd_type = |
| 18523 | WLAN_SER_CMD_SME_ISSUE_DISASSOC_FOR_HANDOFF; |
| 18524 | break; |
| 18525 | case eCsrSmeIssuedAssocToSimilarAP: |
| 18526 | cmd_type = |
| 18527 | WLAN_SER_CMD_SME_ISSUE_ASSOC_TO_SIMILAR_AP; |
| 18528 | break; |
| 18529 | case eCsrSmeIssuedIbssJoinFailure: |
| 18530 | cmd_type = WLAN_SER_CMD_SME_ISSUE_IBSS_JOIN_FAIL; |
| 18531 | break; |
| 18532 | case eCsrForcedIbssLeave: |
| 18533 | cmd_type = WLAN_SER_CMD_FORCE_IBSS_LEAVE; |
| 18534 | break; |
| 18535 | case eCsrStopBss: |
| 18536 | cmd_type = WLAN_SER_CMD_STOP_BSS; |
| 18537 | break; |
| 18538 | case eCsrSmeIssuedFTReassoc: |
| 18539 | cmd_type = WLAN_SER_CMD_SME_ISSUE_FT_REASSOC; |
| 18540 | break; |
| 18541 | case eCsrForcedDisassocSta: |
| 18542 | cmd_type = WLAN_SER_CMD_FORCE_DISASSOC_STA; |
| 18543 | break; |
| 18544 | case eCsrForcedDeauthSta: |
| 18545 | cmd_type = WLAN_SER_CMD_FORCE_DEAUTH_STA; |
| 18546 | break; |
| 18547 | case eCsrPerformPreauth: |
| 18548 | cmd_type = WLAN_SER_CMD_PERFORM_PRE_AUTH; |
| 18549 | break; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18550 | default: |
| 18551 | break; |
| 18552 | } |
| 18553 | |
| 18554 | return cmd_type; |
| 18555 | } |
| 18556 | |
| 18557 | enum wlan_serialization_cmd_type csr_get_cmd_type(tSmeCmd *sme_cmd) |
| 18558 | { |
| 18559 | enum wlan_serialization_cmd_type cmd_type = WLAN_SER_CMD_MAX; |
| 18560 | |
| 18561 | switch (sme_cmd->command) { |
| 18562 | case eSmeCommandScan: |
| 18563 | cmd_type = csr_get_scan_cmd_type(sme_cmd); |
| 18564 | break; |
| 18565 | case eSmeCommandRoam: |
| 18566 | cmd_type = csr_get_roam_cmd_type(sme_cmd); |
| 18567 | break; |
| 18568 | case eSmeCommandWmStatusChange: |
| 18569 | cmd_type = WLAN_SER_CMD_WM_STATUS_CHANGE; |
| 18570 | break; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18571 | case eSmeCommandNdpInitiatorRequest: |
| 18572 | cmd_type = WLAN_SER_CMD_NDP_INIT_REQ; |
| 18573 | break; |
| 18574 | case eSmeCommandNdpResponderRequest: |
| 18575 | cmd_type = WLAN_SER_CMD_NDP_RESP_REQ; |
| 18576 | break; |
| 18577 | case eSmeCommandNdpDataEndInitiatorRequest: |
| 18578 | cmd_type = WLAN_SER_CMD_NDP_DATA_END_INIT_REQ; |
| 18579 | break; |
| 18580 | case eSmeCommandRemainOnChannel: |
| 18581 | cmd_type = WLAN_SER_CMD_REMAIN_ON_CHANNEL; |
| 18582 | break; |
| 18583 | case eSmeCommandEnterStandby: |
| 18584 | cmd_type = WLAN_SER_CMD_ENTER_STANDBY; |
| 18585 | break; |
| 18586 | case eSmeCommandAddTs: |
| 18587 | cmd_type = WLAN_SER_CMD_ADDTS; |
| 18588 | break; |
| 18589 | case eSmeCommandDelTs: |
| 18590 | cmd_type = WLAN_SER_CMD_DELTS; |
| 18591 | break; |
| 18592 | case eSmeCommandTdlsSendMgmt: |
| 18593 | cmd_type = WLAN_SER_CMD_TDLS_SEND_MGMT; |
| 18594 | break; |
| 18595 | case eSmeCommandTdlsAddPeer: |
| 18596 | cmd_type = WLAN_SER_CMD_TDLS_ADD_PEER; |
| 18597 | break; |
| 18598 | case eSmeCommandTdlsDelPeer: |
| 18599 | cmd_type = WLAN_SER_CMD_TDLS_DEL_PEER; |
| 18600 | break; |
| 18601 | case eSmeCommandTdlsLinkEstablish: |
| 18602 | cmd_type = WLAN_SER_CMD_TDLS_LINK_EST; |
| 18603 | break; |
| 18604 | case e_sme_command_set_hw_mode: |
| 18605 | cmd_type = WLAN_SER_CMD_SET_HW_MODE; |
| 18606 | break; |
| 18607 | case e_sme_command_nss_update: |
| 18608 | cmd_type = WLAN_SER_CMD_NSS_UPDATE; |
| 18609 | break; |
| 18610 | case e_sme_command_set_dual_mac_config: |
| 18611 | cmd_type = WLAN_SER_CMD_SET_DUAL_MAC_CONFIG; |
| 18612 | break; |
| 18613 | case e_sme_command_set_antenna_mode: |
| 18614 | cmd_type = WLAN_SER_CMD_SET_ANTENNA_MODE; |
| 18615 | break; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18616 | case eSmeCommandEnterBmps: |
| 18617 | cmd_type = WLAN_SER_CMD_ENTER_BMPS; |
| 18618 | break; |
| 18619 | case eSmeCommandExitBmps: |
| 18620 | cmd_type = WLAN_SER_CMD_EXIT_BMPS; |
| 18621 | break; |
| 18622 | case eSmeCommandEnterUapsd: |
| 18623 | cmd_type = WLAN_SER_CMD_ENTER_UAPSD; |
| 18624 | break; |
| 18625 | case eSmeCommandExitUapsd: |
| 18626 | cmd_type = WLAN_SER_CMD_EXIT_UAPSD; |
| 18627 | break; |
| 18628 | case eSmeCommandExitWowl: |
| 18629 | cmd_type = WLAN_SER_CMD_EXIT_WOWL; |
| 18630 | break; |
| 18631 | default: |
| 18632 | break; |
| 18633 | } |
| 18634 | |
| 18635 | return cmd_type; |
| 18636 | } |
| 18637 | |
| 18638 | QDF_STATUS csr_set_serialization_params_to_cmd(tpAniSirGlobal mac_ctx, |
| 18639 | tSmeCmd *sme_cmd, struct wlan_serialization_command *cmd, |
| 18640 | uint8_t high_priority) |
| 18641 | { |
| 18642 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 18643 | |
| 18644 | if (!sme_cmd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18645 | sme_err("Invalid sme_cmd"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18646 | return status; |
| 18647 | } |
| 18648 | if (!cmd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18649 | sme_err("Invalid serialization_cmd"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18650 | return status; |
| 18651 | } |
| 18652 | |
| 18653 | /* |
| 18654 | * no need to fill command id for non-scan as they will be |
| 18655 | * zero always |
| 18656 | */ |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18657 | if (sme_cmd->command == eSmeCommandScan || |
| 18658 | sme_cmd->command == eSmeCommandRemainOnChannel) { |
| 18659 | cmd->cmd_id = sme_cmd->u.scanCmd.scanID; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18660 | sme_debug("cmd_id[%d]", sme_cmd->u.scanCmd.scanID); |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18661 | } else { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18662 | sme_debug("cmd_id = 0"); |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18663 | cmd->cmd_id = 0; |
| 18664 | } |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18665 | cmd->cmd_type = csr_get_cmd_type(sme_cmd); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18666 | sme_debug("filled cmd_type[%d] cmd_id[%d]", |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18667 | cmd->cmd_type, cmd->cmd_id); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18668 | if (cmd->cmd_type == WLAN_SER_CMD_MAX) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 18669 | sme_err("serialization enum not found"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18670 | return status; |
| 18671 | } |
| 18672 | cmd->vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc, |
| 18673 | sme_cmd->sessionId, WLAN_LEGACY_SME_ID); |
| 18674 | cmd->umac_cmd = sme_cmd; |
| 18675 | cmd->cmd_timeout_duration = SME_DEFAULT_CMD_TIMEOUT; |
| 18676 | cmd->cmd_cb = sme_ser_cmd_callback; |
| 18677 | cmd->is_high_priority = high_priority; |
| 18678 | return QDF_STATUS_SUCCESS; |
| 18679 | } |
| 18680 | |
| 18681 | QDF_STATUS csr_queue_sme_command(tpAniSirGlobal mac_ctx, tSmeCmd *sme_cmd, |
| 18682 | bool high_priority) |
| 18683 | { |
| 18684 | struct wlan_serialization_command cmd; |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18685 | QDF_STATUS status; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18686 | |
| 18687 | if (!SME_IS_START(mac_ctx)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18688 | sme_err("Sme in stop state"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 18689 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18690 | return QDF_STATUS_E_PERM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18691 | } |
| 18692 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18693 | if ((eSmeCommandScan == sme_cmd->command) && |
| 18694 | mac_ctx->scan.fDropScanCmd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18695 | sme_debug("drop scan (scan reason %d) command", |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18696 | sme_cmd->u.scanCmd.reason); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18697 | return QDF_STATUS_CSR_WRONG_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18698 | } |
| 18699 | |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18700 | if (CSR_IS_WAIT_FOR_KEY(mac_ctx, sme_cmd->sessionId)) { |
Krunal Soni | d367673 | 2017-05-10 14:12:18 -0700 | [diff] [blame] | 18701 | if (!CSR_IS_DISCONNECT_COMMAND(sme_cmd)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18702 | sme_err("Can't process cmd(%d), waiting for key", |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18703 | sme_cmd->command); |
| 18704 | return QDF_STATUS_CMD_NOT_QUEUED; |
| 18705 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18706 | } |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 18707 | |
yeshwanth sriram guntuka | 7f4cb34 | 2017-04-11 15:39:21 +0530 | [diff] [blame] | 18708 | if ((eSmeCommandScan == sme_cmd->command) || |
| 18709 | (sme_cmd->command == eSmeCommandRemainOnChannel)) { |
| 18710 | if (csr_scan_active_ll_count(mac_ctx) >= |
| 18711 | mac_ctx->scan.max_scan_count) { |
| 18712 | sme_err("Max scan reached"); |
| 18713 | csr_scan_call_callback(mac_ctx, sme_cmd, |
| 18714 | eCSR_SCAN_ABORT); |
| 18715 | return QDF_STATUS_E_FAILURE; |
| 18716 | } |
| 18717 | } |
| 18718 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18719 | qdf_mem_zero(&cmd, sizeof(struct wlan_serialization_command)); |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18720 | status = csr_set_serialization_params_to_cmd(mac_ctx, sme_cmd, |
| 18721 | &cmd, high_priority); |
| 18722 | if (QDF_STATUS_SUCCESS == status) { |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18723 | if (WLAN_SER_CMD_DENIED_UNSPECIFIED == |
| 18724 | wlan_serialization_request(&cmd)) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 18725 | sme_err("failed to enq to req"); |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18726 | status = QDF_STATUS_E_FAILURE; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18727 | } |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18728 | if (cmd.vdev) |
| 18729 | wlan_objmgr_vdev_release_ref(cmd.vdev, |
| 18730 | WLAN_LEGACY_SME_ID); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18731 | } else { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 18732 | sme_err("failed to set ser params"); |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18733 | status = QDF_STATUS_E_FAILURE; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 18734 | } |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 18735 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18736 | } |
| 18737 | |
Naveen Rawat | 8029a40 | 2017-06-01 10:54:19 -0700 | [diff] [blame] | 18738 | QDF_STATUS csr_roam_update_config(tpAniSirGlobal mac_ctx, uint8_t session_id, |
| 18739 | uint16_t capab, uint32_t value) |
| 18740 | { |
| 18741 | struct update_config *msg; |
| 18742 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 18743 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); |
| 18744 | |
| 18745 | sme_debug("update HT config requested"); |
| 18746 | if (NULL == session) { |
| 18747 | sme_err("Session does not exist for session id %d", session_id); |
| 18748 | return QDF_STATUS_E_FAILURE; |
| 18749 | } |
| 18750 | |
| 18751 | msg = qdf_mem_malloc(sizeof(*msg)); |
| 18752 | if (NULL == msg) { |
| 18753 | sme_err("malloc failed"); |
| 18754 | return QDF_STATUS_E_NOMEM; |
| 18755 | } |
| 18756 | |
| 18757 | msg->messageType = eWNI_SME_UPDATE_CONFIG; |
| 18758 | msg->sme_session_id = session_id; |
| 18759 | msg->capab = capab; |
| 18760 | msg->value = value; |
| 18761 | msg->length = sizeof(*msg); |
| 18762 | status = umac_send_mb_message_to_mac(msg); |
| 18763 | |
| 18764 | return status; |
| 18765 | } |
| 18766 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18767 | QDF_STATUS csr_roam_update_apwpsie(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18768 | tSirAPWPSIEs *pAPWPSIES) |
| 18769 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18770 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18771 | tSirUpdateAPWPSIEsReq *pMsg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18772 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18773 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18774 | if (NULL == pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18775 | sme_err("Session does not exist for session id %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18776 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18777 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18778 | } |
| 18779 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18780 | pMsg = qdf_mem_malloc(sizeof(*pMsg)); |
Srinivas Girigowda | 5d48600 | 2015-11-25 12:18:44 -0800 | [diff] [blame] | 18781 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18782 | return QDF_STATUS_E_NOMEM; |
Srinivas Girigowda | 5d48600 | 2015-11-25 12:18:44 -0800 | [diff] [blame] | 18783 | |
| 18784 | pMsg->messageType = eWNI_SME_UPDATE_APWPSIE_REQ; |
| 18785 | pMsg->transactionId = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 18786 | qdf_copy_macaddr(&pMsg->bssid, &pSession->selfMacAddr); |
Srinivas Girigowda | 5d48600 | 2015-11-25 12:18:44 -0800 | [diff] [blame] | 18787 | pMsg->sessionId = sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18788 | qdf_mem_copy(&pMsg->APWPSIEs, pAPWPSIES, sizeof(tSirAPWPSIEs)); |
Srinivas Girigowda | 5d48600 | 2015-11-25 12:18:44 -0800 | [diff] [blame] | 18789 | pMsg->length = sizeof(*pMsg); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 18790 | status = umac_send_mb_message_to_mac(pMsg); |
Srinivas Girigowda | 5d48600 | 2015-11-25 12:18:44 -0800 | [diff] [blame] | 18791 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18792 | return status; |
| 18793 | } |
| 18794 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18795 | QDF_STATUS csr_roam_update_wparsni_es(tpAniSirGlobal pMac, uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18796 | tSirRSNie *pAPSirRSNie) |
| 18797 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18798 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18799 | tSirUpdateAPWPARSNIEsReq *pMsg; |
| 18800 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18801 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18802 | if (NULL == pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18803 | sme_err("Session does not exist for session id %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18804 | sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18805 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18806 | } |
| 18807 | do { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18808 | pMsg = qdf_mem_malloc(sizeof(tSirUpdateAPWPARSNIEsReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18809 | if (NULL == pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18810 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18811 | pMsg->messageType = eWNI_SME_SET_APWPARSNIEs_REQ; |
| 18812 | pMsg->transactionId = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 18813 | qdf_copy_macaddr(&pMsg->bssid, &pSession->selfMacAddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18814 | pMsg->sessionId = sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18815 | qdf_mem_copy(&pMsg->APWPARSNIEs, pAPSirRSNie, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18816 | sizeof(tSirRSNie)); |
| 18817 | pMsg->length = sizeof(struct sSirUpdateAPWPARSNIEsReq); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 18818 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18819 | } while (0); |
| 18820 | return status; |
| 18821 | } |
| 18822 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18823 | /* |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18824 | * pBuf points to the beginning of the message |
| 18825 | * LIM packs disassoc rsp as below, |
| 18826 | * messageType - 2 bytes |
| 18827 | * messageLength - 2 bytes |
| 18828 | * sessionId - 1 byte |
| 18829 | * transactionId - 2 bytes (uint16_t) |
| 18830 | * reasonCode - 4 bytes (sizeof(tSirResultCodes)) |
| 18831 | * peerMacAddr - 6 bytes |
| 18832 | * The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) |
| 18833 | * and not used |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18834 | */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18835 | static void csr_ser_des_unpack_diassoc_rsp(uint8_t *pBuf, tSirSmeDisassocRsp |
| 18836 | *pRsp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18837 | { |
| 18838 | if (pBuf && pRsp) { |
| 18839 | pBuf += 4; /* skip type and length */ |
| 18840 | pRsp->sessionId = *pBuf++; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 18841 | qdf_get_u16(pBuf, (uint16_t *) &pRsp->transactionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18842 | pBuf += 2; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 18843 | qdf_get_u32(pBuf, (uint32_t *) &pRsp->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18844 | pBuf += 4; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18845 | qdf_mem_copy(pRsp->peer_macaddr.bytes, pBuf, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18846 | } |
| 18847 | } |
| 18848 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 18849 | /* Returns whether a session is in QDF_STA_MODE...or not */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18850 | bool csr_roam_is_sta_mode(tpAniSirGlobal pMac, uint32_t sessionId) |
| 18851 | { |
| 18852 | tCsrRoamSession *pSession = NULL; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18853 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18854 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18855 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18856 | if (!pSession) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18857 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18858 | return false; |
| 18859 | } |
| 18860 | if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18861 | sme_err("Inactive session_id: %d", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18862 | return false; |
| 18863 | } |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18864 | if (eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18865 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18866 | /* There is a possibility that the above check may fail,because |
| 18867 | * P2P CLI also uses the same BSSType (eCSR_BSS_TYPE_INFRASTRUCTURE) |
| 18868 | * when it is connected.So,we may sneak through the above check even |
| 18869 | * if we are not a STA mode INFRA station. So, if we sneak through |
| 18870 | * the above condition, we can use the following check if we are |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18871 | * really in STA Mode. |
| 18872 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18873 | |
| 18874 | if (NULL != pSession->pCurRoamProfile) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18875 | if (pSession->pCurRoamProfile->csrPersona == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18876 | return true; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18877 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18878 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18879 | } |
| 18880 | |
| 18881 | return false; |
| 18882 | } |
| 18883 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18884 | QDF_STATUS csr_handoff_request(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18885 | uint8_t sessionId, |
| 18886 | tCsrHandoffRequest *pHandoffInfo) |
| 18887 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18888 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 18889 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18890 | |
| 18891 | tAniHandoffReq *pMsg; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18892 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18893 | pMsg = qdf_mem_malloc(sizeof(tAniHandoffReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18894 | if (NULL == pMsg) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18895 | sme_err("csr_handoff_request: failed to allocate mem for req "); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18896 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18897 | } |
| 18898 | pMsg->msgType = eWNI_SME_HANDOFF_REQ; |
| 18899 | pMsg->msgLen = (uint16_t) sizeof(tAniHandoffReq); |
| 18900 | pMsg->sessionId = sessionId; |
| 18901 | pMsg->channel = pHandoffInfo->channel; |
| 18902 | pMsg->handoff_src = pHandoffInfo->src; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18903 | qdf_mem_copy(pMsg->bssid, pHandoffInfo->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18904 | msg.type = eWNI_SME_HANDOFF_REQ; |
| 18905 | msg.bodyptr = pMsg; |
| 18906 | msg.reserved = 0; |
Rajeev Kumar | 8eaedf6 | 2017-01-21 11:03:13 -0800 | [diff] [blame] | 18907 | if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_SME, |
Krunal Soni | 66c113f | 2016-12-21 16:46:47 -0800 | [diff] [blame] | 18908 | &msg)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 18909 | sme_err("scheduler_post_msg failed to post msg to self"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18910 | qdf_mem_free((void *)pMsg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18911 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18912 | } |
| 18913 | return status; |
| 18914 | } |
| 18915 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 18916 | /** |
| 18917 | * csr_roam_channel_change_req() - Post channel change request to LIM |
| 18918 | * @pMac: mac context |
| 18919 | * @bssid: SAP bssid |
| 18920 | * @ch_params: channel information |
| 18921 | * @profile: CSR profile |
| 18922 | * |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 18923 | * This API is primarily used to post Channel Change Req for SAP |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 18924 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18925 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18926 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18927 | QDF_STATUS csr_roam_channel_change_req(tpAniSirGlobal pMac, |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 18928 | struct qdf_mac_addr bssid, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 18929 | struct ch_params *ch_params, |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 18930 | tCsrRoamProfile *profile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18931 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18932 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18933 | tSirChanChangeRequest *pMsg; |
| 18934 | tCsrRoamStartBssParams param; |
| 18935 | |
Krunal Soni | 8f8507c | 2016-12-20 13:54:34 -0800 | [diff] [blame] | 18936 | /* |
| 18937 | * while changing the channel, use basic rates given by driver |
| 18938 | * and not by hostapd as there is a chance that hostapd might |
| 18939 | * give us rates based on original channel which may not be |
| 18940 | * suitable for new channel |
| 18941 | */ |
Ravi Joshi | b398c85 | 2017-07-18 17:55:21 -0700 | [diff] [blame] | 18942 | qdf_mem_zero(¶m, sizeof(tCsrRoamStartBssParams)); |
| 18943 | |
Krunal Soni | 8f8507c | 2016-12-20 13:54:34 -0800 | [diff] [blame] | 18944 | csr_roam_get_bss_start_parms(pMac, profile, ¶m, true); |
Ravi Joshi | b398c85 | 2017-07-18 17:55:21 -0700 | [diff] [blame] | 18945 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18946 | pMsg = qdf_mem_malloc(sizeof(tSirChanChangeRequest)); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18947 | if (!pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18948 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18949 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18950 | pMsg->messageType = eWNI_SME_CHANNEL_CHANGE_REQ; |
| 18951 | pMsg->messageLen = sizeof(tSirChanChangeRequest); |
| 18952 | pMsg->targetChannel = profile->ChannelInfo.ChannelList[0]; |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 18953 | pMsg->sec_ch_offset = ch_params->sec_ch_offset; |
| 18954 | pMsg->ch_width = profile->ch_params.ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18955 | pMsg->dot11mode = csr_translate_to_wni_cfg_dot11_mode(pMac, |
| 18956 | pMac->roam.configParam.uCfgDot11Mode); |
Gupta, Kapil | 76ed25e | 2016-04-22 15:13:55 +0530 | [diff] [blame] | 18957 | if (IS_24G_CH(pMsg->targetChannel) && |
| 18958 | (false == pMac->roam.configParam.enableVhtFor24GHz) && |
| 18959 | (WNI_CFG_DOT11_MODE_11AC == pMsg->dot11mode || |
| 18960 | WNI_CFG_DOT11_MODE_11AC_ONLY == pMsg->dot11mode)) |
| 18961 | pMsg->dot11mode = WNI_CFG_DOT11_MODE_11N; |
| 18962 | |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 18963 | pMsg->center_freq_seg_0 = ch_params->center_freq_seg0; |
| 18964 | pMsg->center_freq_seg_1 = ch_params->center_freq_seg1; |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 18965 | pMsg->cac_duration_ms = profile->cac_duration_ms; |
| 18966 | pMsg->dfs_regdomain = profile->dfs_regdomain; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18967 | qdf_mem_copy(pMsg->bssid, bssid.bytes, QDF_MAC_ADDR_SIZE); |
| 18968 | qdf_mem_copy(&pMsg->operational_rateset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18969 | ¶m.operationalRateSet, sizeof(pMsg->operational_rateset)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18970 | qdf_mem_copy(&pMsg->extended_rateset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18971 | ¶m.extendedRateSet, sizeof(pMsg->extended_rateset)); |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 18972 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18973 | |
| 18974 | return status; |
| 18975 | } |
| 18976 | |
| 18977 | /* |
| 18978 | * Post Beacon Tx Start request to LIM |
| 18979 | * immediately after SAP CAC WAIT is |
| 18980 | * completed without any RADAR indications. |
| 18981 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18982 | QDF_STATUS csr_roam_start_beacon_req(tpAniSirGlobal pMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 18983 | struct qdf_mac_addr bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18984 | uint8_t dfsCacWaitStatus) |
| 18985 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18986 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18987 | tSirStartBeaconIndication *pMsg; |
| 18988 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18989 | pMsg = qdf_mem_malloc(sizeof(tSirStartBeaconIndication)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18990 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 18991 | if (!pMsg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 18992 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18993 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18994 | pMsg->messageType = eWNI_SME_START_BEACON_REQ; |
| 18995 | pMsg->messageLen = sizeof(tSirStartBeaconIndication); |
| 18996 | pMsg->beaconStartStatus = dfsCacWaitStatus; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 18997 | qdf_mem_copy(pMsg->bssid, bssid.bytes, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 18998 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 18999 | status = umac_send_mb_message_to_mac(pMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19000 | |
| 19001 | return status; |
| 19002 | } |
| 19003 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19004 | /* |
| 19005 | * csr_roam_modify_add_ies - |
| 19006 | * This function sends msg to modify the additional IE buffers in PE |
| 19007 | * |
| 19008 | * @pMac: pMac global structure |
| 19009 | * @pModifyIE: pointer to tSirModifyIE structure |
| 19010 | * @updateType: Type of buffer |
| 19011 | * |
| 19012 | * |
| 19013 | * Return: QDF_STATUS - Success or failure |
| 19014 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19015 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19016 | csr_roam_modify_add_ies(tpAniSirGlobal pMac, |
| 19017 | tSirModifyIE *pModifyIE, eUpdateIEsType updateType) |
| 19018 | { |
| 19019 | tpSirModifyIEsInd pModifyAddIEInd = NULL; |
| 19020 | uint8_t *pLocalBuffer = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19021 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19022 | |
| 19023 | /* following buffer will be freed by consumer (PE) */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19024 | pLocalBuffer = qdf_mem_malloc(pModifyIE->ieBufferlength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19025 | |
| 19026 | if (NULL == pLocalBuffer) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19027 | sme_err("Memory Allocation Failure!!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19028 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19029 | } |
| 19030 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19031 | pModifyAddIEInd = qdf_mem_malloc(sizeof(tSirModifyIEsInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19032 | if (NULL == pModifyAddIEInd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19033 | sme_err("Memory Allocation Failure!!!"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19034 | qdf_mem_free(pLocalBuffer); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19035 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19036 | } |
| 19037 | |
| 19038 | /*copy the IE buffer */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19039 | qdf_mem_copy(pLocalBuffer, pModifyIE->pIEBuffer, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19040 | pModifyIE->ieBufferlength); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19041 | qdf_mem_zero(pModifyAddIEInd, sizeof(tSirModifyIEsInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19042 | |
| 19043 | pModifyAddIEInd->msgType = eWNI_SME_MODIFY_ADDITIONAL_IES; |
| 19044 | pModifyAddIEInd->msgLen = sizeof(tSirModifyIEsInd); |
| 19045 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 19046 | qdf_copy_macaddr(&pModifyAddIEInd->modifyIE.bssid, &pModifyIE->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19047 | |
| 19048 | pModifyAddIEInd->modifyIE.smeSessionId = pModifyIE->smeSessionId; |
| 19049 | pModifyAddIEInd->modifyIE.notify = pModifyIE->notify; |
| 19050 | pModifyAddIEInd->modifyIE.ieID = pModifyIE->ieID; |
| 19051 | pModifyAddIEInd->modifyIE.ieIDLen = pModifyIE->ieIDLen; |
| 19052 | pModifyAddIEInd->modifyIE.pIEBuffer = pLocalBuffer; |
| 19053 | pModifyAddIEInd->modifyIE.ieBufferlength = pModifyIE->ieBufferlength; |
Rajeev Kumar | 8e3e283 | 2015-11-06 16:02:54 -0800 | [diff] [blame] | 19054 | pModifyAddIEInd->modifyIE.oui_length = pModifyIE->oui_length; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19055 | |
| 19056 | pModifyAddIEInd->updateType = updateType; |
| 19057 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 19058 | status = umac_send_mb_message_to_mac(pModifyAddIEInd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19059 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19060 | sme_err("Failed to send eWNI_SME_UPDATE_ADDTIONAL_IES msg status %d", |
| 19061 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19062 | qdf_mem_free(pLocalBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19063 | } |
| 19064 | return status; |
| 19065 | } |
| 19066 | |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19067 | /* |
| 19068 | * csr_roam_update_add_ies - |
| 19069 | * This function sends msg to updates the additional IE buffers in PE |
| 19070 | * |
| 19071 | * @pMac: pMac global structure |
| 19072 | * @sessionId: SME session id |
| 19073 | * @bssid: BSSID |
| 19074 | * @additionIEBuffer: buffer containing addition IE from hostapd |
| 19075 | * @length: length of buffer |
| 19076 | * @updateType: Type of buffer |
| 19077 | * @append: append or replace completely |
| 19078 | * |
| 19079 | * |
| 19080 | * Return: QDF_STATUS - Success or failure |
| 19081 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19082 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19083 | csr_roam_update_add_ies(tpAniSirGlobal pMac, |
| 19084 | tSirUpdateIE *pUpdateIE, eUpdateIEsType updateType) |
| 19085 | { |
| 19086 | tpSirUpdateIEsInd pUpdateAddIEs = NULL; |
| 19087 | uint8_t *pLocalBuffer = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19088 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19089 | |
| 19090 | if (pUpdateIE->ieBufferlength != 0) { |
| 19091 | /* Following buffer will be freed by consumer (PE) */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19092 | pLocalBuffer = qdf_mem_malloc(pUpdateIE->ieBufferlength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19093 | if (NULL == pLocalBuffer) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19094 | sme_err("Memory Allocation Failure!!!"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19095 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19096 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19097 | qdf_mem_copy(pLocalBuffer, pUpdateIE->pAdditionIEBuffer, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19098 | pUpdateIE->ieBufferlength); |
| 19099 | } |
| 19100 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19101 | pUpdateAddIEs = qdf_mem_malloc(sizeof(tSirUpdateIEsInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19102 | if (NULL == pUpdateAddIEs) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19103 | sme_err("Memory Allocation Failure!!!"); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19104 | if (pLocalBuffer != NULL) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19105 | qdf_mem_free(pLocalBuffer); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19106 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19107 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19108 | } |
| 19109 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19110 | pUpdateAddIEs->msgType = eWNI_SME_UPDATE_ADDITIONAL_IES; |
| 19111 | pUpdateAddIEs->msgLen = sizeof(tSirUpdateIEsInd); |
| 19112 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 19113 | qdf_copy_macaddr(&pUpdateAddIEs->updateIE.bssid, &pUpdateIE->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19114 | |
| 19115 | pUpdateAddIEs->updateIE.smeSessionId = pUpdateIE->smeSessionId; |
| 19116 | pUpdateAddIEs->updateIE.append = pUpdateIE->append; |
| 19117 | pUpdateAddIEs->updateIE.notify = pUpdateIE->notify; |
| 19118 | pUpdateAddIEs->updateIE.ieBufferlength = pUpdateIE->ieBufferlength; |
| 19119 | pUpdateAddIEs->updateIE.pAdditionIEBuffer = pLocalBuffer; |
| 19120 | |
| 19121 | pUpdateAddIEs->updateType = updateType; |
| 19122 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 19123 | status = umac_send_mb_message_to_mac(pUpdateAddIEs); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19124 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19125 | sme_err("Failed to send eWNI_SME_UPDATE_ADDTIONAL_IES msg status %d", |
| 19126 | status); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19127 | qdf_mem_free(pLocalBuffer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19128 | } |
| 19129 | return status; |
| 19130 | } |
| 19131 | |
| 19132 | /** |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 19133 | * csr_send_ext_change_channel()- function to post send ECSA |
| 19134 | * action frame to lim. |
| 19135 | * @mac_ctx: pointer to global mac structure |
| 19136 | * @channel: new channel to switch |
| 19137 | * @session_id: senssion it should be sent on. |
| 19138 | * |
| 19139 | * This function is called to post ECSA frame to lim. |
| 19140 | * |
| 19141 | * Return: success if msg posted to LIM else return failure |
| 19142 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19143 | QDF_STATUS csr_send_ext_change_channel(tpAniSirGlobal mac_ctx, uint32_t channel, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 19144 | uint8_t session_id) |
| 19145 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19146 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 19147 | struct sir_sme_ext_cng_chan_req *msg; |
| 19148 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19149 | msg = qdf_mem_malloc(sizeof(*msg)); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 19150 | if (NULL == msg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19151 | return QDF_STATUS_E_NOMEM; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 19152 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 19153 | msg->message_type = eWNI_SME_EXT_CHANGE_CHANNEL; |
| 19154 | msg->length = sizeof(*msg); |
| 19155 | msg->new_channel = channel; |
| 19156 | msg->session_id = session_id; |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 19157 | status = umac_send_mb_message_to_mac(msg); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 19158 | return status; |
| 19159 | } |
| 19160 | |
| 19161 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19162 | * csr_roam_send_chan_sw_ie_request() - Request to transmit CSA IE |
| 19163 | * @mac_ctx: Global MAC context |
| 19164 | * @bssid: BSSID |
| 19165 | * @target_channel: Channel on which to send the IE |
| 19166 | * @csa_ie_reqd: Include/Exclude CSA IE. |
Kiran Kumar Lokere | 999e58c | 2016-01-07 02:18:39 -0800 | [diff] [blame] | 19167 | * @ch_params: operating Channel related information |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19168 | * |
| 19169 | * This function sends request to transmit channel switch announcement |
| 19170 | * IE to lower layers |
| 19171 | * |
| 19172 | * Return: success or failure |
| 19173 | **/ |
Amar Singhal | e4f28ee | 2015-10-21 14:36:56 -0700 | [diff] [blame] | 19174 | QDF_STATUS csr_roam_send_chan_sw_ie_request(tpAniSirGlobal mac_ctx, |
| 19175 | struct qdf_mac_addr bssid, |
| 19176 | uint8_t target_channel, |
| 19177 | uint8_t csa_ie_reqd, |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 19178 | struct ch_params *ch_params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19179 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19180 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19181 | tSirDfsCsaIeRequest *msg; |
| 19182 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19183 | msg = qdf_mem_malloc(sizeof(tSirDfsCsaIeRequest)); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19184 | if (!msg) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19185 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19186 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19187 | msg->msgType = eWNI_SME_DFS_BEACON_CHAN_SW_IE_REQ; |
| 19188 | msg->msgLen = sizeof(tSirDfsCsaIeRequest); |
| 19189 | |
| 19190 | msg->targetChannel = target_channel; |
| 19191 | msg->csaIeRequired = csa_ie_reqd; |
gaolez | e2920bd | 2017-03-21 17:38:42 +0800 | [diff] [blame] | 19192 | msg->ch_switch_beacon_cnt = |
| 19193 | mac_ctx->sap.SapDfsInfo.sap_ch_switch_beacon_cnt; |
gaolez | 76d2a16 | 2017-03-21 19:23:58 +0800 | [diff] [blame^] | 19194 | msg->ch_switch_mode = mac_ctx->sap.SapDfsInfo.sap_ch_switch_mode; |
| 19195 | msg->dfs_ch_switch_disable = |
| 19196 | mac_ctx->sap.SapDfsInfo.disable_dfs_ch_switch; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19197 | qdf_mem_copy(msg->bssid, bssid.bytes, QDF_MAC_ADDR_SIZE); |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 19198 | qdf_mem_copy(&msg->ch_params, ch_params, sizeof(struct ch_params)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19199 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 19200 | status = umac_send_mb_message_to_mac(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19201 | |
| 19202 | return status; |
| 19203 | } |
Varun Reddy Yeturu | bee4f78 | 2015-11-02 10:16:05 -0800 | [diff] [blame] | 19204 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 19205 | /** |
| 19206 | * csr_roaming_report_diag_event() - Diag events for LFR3 |
| 19207 | * @mac_ctx: MAC context |
| 19208 | * @roam_synch_ind_ptr: Roam Synch Indication Pointer |
| 19209 | * @reason: Reason for this event to happen |
| 19210 | * |
| 19211 | * The major events in the host for LFR3 roaming such as |
| 19212 | * roam synch indication, roam synch completion and |
| 19213 | * roam synch handoff fail will be indicated to the |
| 19214 | * diag framework using this API. |
| 19215 | * |
| 19216 | * Return: None |
| 19217 | */ |
| 19218 | void csr_roaming_report_diag_event(tpAniSirGlobal mac_ctx, |
| 19219 | roam_offload_synch_ind *roam_synch_ind_ptr, |
| 19220 | eCsrDiagWlanStatusEventReason reason) |
| 19221 | { |
| 19222 | WLAN_HOST_DIAG_EVENT_DEF(roam_connection, |
| 19223 | host_event_wlan_status_payload_type); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19224 | qdf_mem_set(&roam_connection, |
Varun Reddy Yeturu | bee4f78 | 2015-11-02 10:16:05 -0800 | [diff] [blame] | 19225 | sizeof(host_event_wlan_status_payload_type), 0); |
| 19226 | switch (reason) { |
| 19227 | case eCSR_REASON_ROAM_SYNCH_IND: |
| 19228 | roam_connection.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 19229 | if (roam_synch_ind_ptr) { |
| 19230 | roam_connection.rssi = roam_synch_ind_ptr->rssi; |
| 19231 | roam_connection.channel = |
| 19232 | cds_freq_to_chan(roam_synch_ind_ptr->chan_freq); |
| 19233 | } |
| 19234 | break; |
| 19235 | case eCSR_REASON_ROAM_SYNCH_CNF: |
| 19236 | roam_connection.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 19237 | break; |
| 19238 | case eCSR_REASON_ROAM_HO_FAIL: |
| 19239 | roam_connection.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 19240 | break; |
| 19241 | default: |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19242 | sme_err("LFR3: Unsupported reason %d", reason); |
Varun Reddy Yeturu | bee4f78 | 2015-11-02 10:16:05 -0800 | [diff] [blame] | 19243 | return; |
| 19244 | } |
| 19245 | roam_connection.reason = reason; |
Abhishek Singh | 7a99558 | 2016-04-27 13:53:36 +0530 | [diff] [blame] | 19246 | WLAN_HOST_DIAG_EVENT_REPORT(&roam_connection, EVENT_WLAN_STATUS_V2); |
Varun Reddy Yeturu | bee4f78 | 2015-11-02 10:16:05 -0800 | [diff] [blame] | 19247 | } |
| 19248 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19249 | |
| 19250 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19251 | /* |
| 19252 | * fn csr_process_ho_fail_ind |
| 19253 | * brief This function will process the Hand Off Failure indication |
| 19254 | * received from the firmware. It will trigger a disconnect on |
| 19255 | * the session which the firmware reported a hand off failure |
| 19256 | * param pMac global structure |
| 19257 | * param pMsgBuf - Contains the session ID for which the handler should apply |
| 19258 | */ |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 19259 | void csr_process_ho_fail_ind(tpAniSirGlobal mac_ctx, void *pMsgBuf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19260 | { |
| 19261 | tSirSmeHOFailureInd *pSmeHOFailInd = (tSirSmeHOFailureInd *) pMsgBuf; |
| 19262 | uint32_t sessionId; |
| 19263 | |
| 19264 | if (pSmeHOFailInd) |
| 19265 | sessionId = pSmeHOFailInd->sessionId; |
| 19266 | else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 19267 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19268 | "LFR3: Hand-Off Failure Ind is NULL"); |
| 19269 | return; |
| 19270 | } |
| 19271 | /* Roaming is supported only on Infra STA Mode. */ |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 19272 | if (!csr_roam_is_sta_mode(mac_ctx, sessionId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 19273 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19274 | "LFR3:HO Fail cannot be handled for session %d", |
| 19275 | sessionId); |
| 19276 | return; |
| 19277 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 19278 | mac_ctx->sme.set_connection_info_cb(false); |
| 19279 | csr_roam_roaming_offload_timer_action(mac_ctx, 0, sessionId, |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 19280 | ROAMING_OFFLOAD_TIMER_STOP); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 19281 | csr_roam_call_callback(mac_ctx, sessionId, NULL, 0, |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 19282 | eCSR_ROAM_NAPI_OFF, eCSR_ROAM_RESULT_FAILURE); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 19283 | csr_roam_synch_clean_up(mac_ctx, sessionId); |
| 19284 | csr_roaming_report_diag_event(mac_ctx, NULL, |
Varun Reddy Yeturu | bee4f78 | 2015-11-02 10:16:05 -0800 | [diff] [blame] | 19285 | eCSR_REASON_ROAM_HO_FAIL); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 19286 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19287 | "LFR3:Issue Disconnect on session %d", sessionId); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 19288 | csr_roam_disconnect(mac_ctx, sessionId, |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 19289 | eCSR_DISCONNECT_REASON_ROAM_HO_FAIL); |
Agrawal Ashish | c416da6 | 2017-04-10 15:12:46 +0530 | [diff] [blame] | 19290 | if (mac_ctx->roam.configParam.enable_fatal_event) |
Agrawal Ashish | 87ec5d4 | 2017-06-15 15:22:19 +0530 | [diff] [blame] | 19291 | cds_flush_logs(WLAN_LOG_TYPE_FATAL, |
Agrawal Ashish | c416da6 | 2017-04-10 15:12:46 +0530 | [diff] [blame] | 19292 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 19293 | WLAN_LOG_REASON_ROAM_HO_FAILURE, |
| 19294 | true, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19295 | } |
| 19296 | #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ |
| 19297 | |
| 19298 | /** |
| 19299 | * csr_update_op_class_array() - update op class for each band |
| 19300 | * @mac_ctx: mac global context |
| 19301 | * @op_classes: out param, operating class array to update |
| 19302 | * @channel_info: channel info |
| 19303 | * @ch_name: channel band name to display in debug messages |
| 19304 | * @i: out param, stores number of operating classes |
| 19305 | * |
| 19306 | * Return: void |
| 19307 | */ |
| 19308 | static void |
| 19309 | csr_update_op_class_array(tpAniSirGlobal mac_ctx, |
| 19310 | uint8_t *op_classes, |
| 19311 | tCsrChannel *channel_info, |
| 19312 | char *ch_name, |
| 19313 | uint8_t *i) |
| 19314 | { |
| 19315 | uint8_t j = 0, idx = 0, class = 0; |
| 19316 | bool found = false; |
| 19317 | uint8_t num_channels = channel_info->numChannels; |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 19318 | uint8_t ch_bandwidth; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19319 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19320 | sme_debug("Num of %s channels, %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19321 | ch_name, num_channels); |
| 19322 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 19323 | for (idx = 0; idx < num_channels && |
| 19324 | *i < (REG_MAX_SUPP_OPER_CLASSES - 1); idx++) { |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 19325 | for (ch_bandwidth = BW20; ch_bandwidth < BWALL; |
| 19326 | ch_bandwidth++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 19327 | class = wlan_reg_dmn_get_opclass_from_channel( |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 19328 | mac_ctx->scan.countryCodeCurrent, |
| 19329 | channel_info->channelList[idx], |
| 19330 | ch_bandwidth); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19331 | sme_debug("for chan %d, op class: %d", |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 19332 | channel_info->channelList[idx], class); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19333 | |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 19334 | found = false; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 19335 | for (j = 0; j < REG_MAX_SUPP_OPER_CLASSES - 1; |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 19336 | j++) { |
| 19337 | if (op_classes[j] == class) { |
| 19338 | found = true; |
| 19339 | break; |
| 19340 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19341 | } |
Edhar, Mahesh Kumar | 5cd1e0e | 2015-11-16 14:32:33 +0530 | [diff] [blame] | 19342 | |
| 19343 | if (!found) { |
| 19344 | op_classes[*i] = class; |
| 19345 | *i = *i + 1; |
| 19346 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19347 | } |
| 19348 | } |
| 19349 | } |
| 19350 | |
| 19351 | /** |
| 19352 | * csr_update_op_class_array() - update op class for all bands |
| 19353 | * @hHal: global hal context |
| 19354 | * |
| 19355 | * Return: void |
| 19356 | */ |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19357 | static void csr_init_operating_classes(tHalHandle hHal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19358 | { |
| 19359 | uint8_t i = 0; |
| 19360 | uint8_t j = 0; |
| 19361 | uint8_t swap = 0; |
| 19362 | uint8_t numClasses = 0; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 19363 | uint8_t opClasses[REG_MAX_SUPP_OPER_CLASSES] = {0,}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19364 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 19365 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19366 | sme_debug("Current Country = %c%c", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19367 | pMac->scan.countryCodeCurrent[0], |
| 19368 | pMac->scan.countryCodeCurrent[1]); |
| 19369 | |
| 19370 | csr_update_op_class_array(pMac, opClasses, |
| 19371 | &pMac->scan.base_channels, "20MHz", &i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19372 | numClasses = i; |
| 19373 | |
| 19374 | /* As per spec the operating classes should be in ascending order. |
| 19375 | * Bubble sort is fine since we don't have many classes |
| 19376 | */ |
| 19377 | for (i = 0; i < (numClasses - 1); i++) { |
| 19378 | for (j = 0; j < (numClasses - i - 1); j++) { |
| 19379 | /* For decreasing order use < */ |
| 19380 | if (opClasses[j] > opClasses[j + 1]) { |
| 19381 | swap = opClasses[j]; |
| 19382 | opClasses[j] = opClasses[j + 1]; |
| 19383 | opClasses[j + 1] = swap; |
| 19384 | } |
| 19385 | } |
| 19386 | } |
| 19387 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19388 | sme_debug("Number of unique supported op classes %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19389 | numClasses); |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19390 | for (i = 0; i < numClasses; i++) |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19391 | sme_debug("supported opClasses[%d] = %d", i, opClasses[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19392 | |
| 19393 | /* Set the ordered list of op classes in regdomain |
| 19394 | * for use by other modules |
| 19395 | */ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 19396 | wlan_reg_dmn_set_curr_opclasses(numClasses, &opClasses[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19397 | } |
| 19398 | |
| 19399 | /** |
| 19400 | * csr_find_session_by_type() - This function will find given session type from |
| 19401 | * all sessions. |
| 19402 | * @mac_ctx: pointer to mac context. |
| 19403 | * @type: session type |
| 19404 | * |
| 19405 | * Return: session id for give session type. |
| 19406 | **/ |
| 19407 | static uint32_t |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 19408 | csr_find_session_by_type(tpAniSirGlobal mac_ctx, enum tQDF_ADAPTER_MODE type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19409 | { |
| 19410 | uint32_t i, session_id = CSR_SESSION_ID_INVALID; |
| 19411 | tCsrRoamSession *session_ptr; |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19412 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19413 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 19414 | if (!CSR_IS_SESSION_VALID(mac_ctx, i)) |
| 19415 | continue; |
| 19416 | |
| 19417 | session_ptr = CSR_GET_SESSION(mac_ctx, i); |
| 19418 | if (type == session_ptr->bssParams.bssPersona) { |
| 19419 | session_id = i; |
| 19420 | break; |
| 19421 | } |
| 19422 | } |
| 19423 | return session_id; |
| 19424 | } |
| 19425 | /** |
| 19426 | * csr_is_conn_allow_2g_band() - This function will check if station's conn |
| 19427 | * is allowed in 2.4Ghz band. |
| 19428 | * @mac_ctx: pointer to mac context. |
| 19429 | * @chnl: station's channel. |
| 19430 | * |
| 19431 | * This function will check if station's connection is allowed in 5Ghz band |
| 19432 | * after comparing it with SAP's operating channel. If SAP's operating |
| 19433 | * channel and Station's channel is different than this function will return |
| 19434 | * false else true. |
| 19435 | * |
| 19436 | * Return: true or false. |
| 19437 | **/ |
| 19438 | static bool csr_is_conn_allow_2g_band(tpAniSirGlobal mac_ctx, uint32_t chnl) |
| 19439 | { |
| 19440 | uint32_t sap_session_id; |
| 19441 | tCsrRoamSession *sap_session; |
| 19442 | |
| 19443 | if (0 == chnl) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 19444 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19445 | FL("channel is zero, connection not allowed")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19446 | |
| 19447 | return false; |
| 19448 | } |
| 19449 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 19450 | sap_session_id = csr_find_session_by_type(mac_ctx, QDF_SAP_MODE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19451 | if (CSR_SESSION_ID_INVALID != sap_session_id) { |
| 19452 | sap_session = CSR_GET_SESSION(mac_ctx, sap_session_id); |
| 19453 | if ((0 != sap_session->bssParams.operationChn) && |
| 19454 | (sap_session->bssParams.operationChn != chnl)) { |
| 19455 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 19456 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19457 | "Can't allow STA to connect, chnls not same"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19458 | return false; |
| 19459 | } |
| 19460 | } |
| 19461 | return true; |
| 19462 | } |
| 19463 | |
| 19464 | /** |
| 19465 | * csr_is_conn_allow_5g_band() - This function will check if station's conn |
| 19466 | * is allowed in 5Ghz band. |
| 19467 | * @mac_ctx: pointer to mac context. |
| 19468 | * @chnl: station's channel. |
| 19469 | * |
| 19470 | * This function will check if station's connection is allowed in 5Ghz band |
| 19471 | * after comparing it with P2PGO's operating channel. If P2PGO's operating |
| 19472 | * channel and Station's channel is different than this function will return |
| 19473 | * false else true. |
| 19474 | * |
| 19475 | * Return: true or false. |
| 19476 | **/ |
| 19477 | static bool csr_is_conn_allow_5g_band(tpAniSirGlobal mac_ctx, uint32_t chnl) |
| 19478 | { |
| 19479 | uint32_t p2pgo_session_id; |
| 19480 | tCsrRoamSession *p2pgo_session; |
| 19481 | |
| 19482 | if (0 == chnl) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 19483 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19484 | FL("channel is zero, connection not allowed")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19485 | return false; |
| 19486 | } |
| 19487 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 19488 | p2pgo_session_id = csr_find_session_by_type(mac_ctx, QDF_P2P_GO_MODE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19489 | if (CSR_SESSION_ID_INVALID != p2pgo_session_id) { |
| 19490 | p2pgo_session = CSR_GET_SESSION(mac_ctx, p2pgo_session_id); |
| 19491 | if ((0 != p2pgo_session->bssParams.operationChn) && |
| 19492 | (eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED != |
| 19493 | p2pgo_session->connectState) && |
| 19494 | (p2pgo_session->bssParams.operationChn != |
| 19495 | chnl)) { |
| 19496 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 19497 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Nishank Aggarwal | c32eea0 | 2017-03-28 18:02:01 +0530 | [diff] [blame] | 19498 | "Can't allow STA to connect, chnls not same"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19499 | return false; |
| 19500 | } |
| 19501 | } |
| 19502 | return true; |
| 19503 | } |
| 19504 | |
| 19505 | /** |
| 19506 | * csr_clear_joinreq_param() - This function will clear station's params |
| 19507 | * for stored join request to csr. |
| 19508 | * @hal_handle: pointer to hal context. |
| 19509 | * @session_id: station's session id. |
| 19510 | * |
| 19511 | * This function will clear station's allocated memory for cached join |
| 19512 | * request. |
| 19513 | * |
| 19514 | * Return: true or false based on function's overall success. |
| 19515 | **/ |
| 19516 | bool csr_clear_joinreq_param(tpAniSirGlobal mac_ctx, |
| 19517 | uint32_t session_id) |
| 19518 | { |
| 19519 | tCsrRoamSession *sta_session; |
| 19520 | tScanResultList *bss_list; |
| 19521 | |
| 19522 | if (NULL == mac_ctx) |
| 19523 | return false; |
| 19524 | |
| 19525 | sta_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 19526 | if (NULL == sta_session) |
| 19527 | return false; |
| 19528 | |
| 19529 | /* Release the memory allocated by previous join request */ |
| 19530 | bss_list = |
| 19531 | (tScanResultList *)&sta_session->stored_roam_profile. |
| 19532 | bsslist_handle; |
| 19533 | if (NULL != bss_list) { |
| 19534 | csr_scan_result_purge(mac_ctx, |
| 19535 | sta_session->stored_roam_profile.bsslist_handle); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 19536 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19537 | FL("bss list is released for session %d"), session_id); |
| 19538 | sta_session->stored_roam_profile.bsslist_handle = NULL; |
| 19539 | } |
| 19540 | sta_session->stored_roam_profile.bsslist_handle = NULL; |
| 19541 | csr_release_profile(mac_ctx, &sta_session->stored_roam_profile.profile); |
| 19542 | sta_session->stored_roam_profile.reason = 0; |
| 19543 | sta_session->stored_roam_profile.roam_id = 0; |
| 19544 | sta_session->stored_roam_profile.imediate_flag = false; |
| 19545 | sta_session->stored_roam_profile.clear_flag = false; |
| 19546 | return true; |
| 19547 | } |
| 19548 | |
| 19549 | /** |
| 19550 | * csr_store_joinreq_param() - This function will store station's join |
| 19551 | * request to that station's session. |
| 19552 | * @mac_ctx: pointer to mac context. |
| 19553 | * @profile: pointer to station's roam profile. |
| 19554 | * @scan_cache: pointer to station's scan cache. |
| 19555 | * @roam_id: reference to roam_id variable being passed. |
| 19556 | * @session_id: station's session id. |
| 19557 | * |
| 19558 | * This function will store station's join request to one of the |
| 19559 | * csr structure and add it to station's session. |
| 19560 | * |
| 19561 | * Return: true or false based on function's overall success. |
| 19562 | **/ |
| 19563 | bool csr_store_joinreq_param(tpAniSirGlobal mac_ctx, |
| 19564 | tCsrRoamProfile *profile, |
| 19565 | tScanResultHandle scan_cache, |
| 19566 | uint32_t *roam_id, |
| 19567 | uint32_t session_id) |
| 19568 | { |
| 19569 | tCsrRoamSession *sta_session; |
| 19570 | |
| 19571 | if (NULL == mac_ctx) |
| 19572 | return false; |
| 19573 | |
| 19574 | sta_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 19575 | if (NULL == sta_session) |
| 19576 | return false; |
| 19577 | |
| 19578 | sta_session->stored_roam_profile.session_id = session_id; |
| 19579 | csr_roam_copy_profile(mac_ctx, |
| 19580 | &sta_session->stored_roam_profile.profile, profile); |
| 19581 | /* new bsslist_handle's memory will be relased later */ |
| 19582 | sta_session->stored_roam_profile.bsslist_handle = scan_cache; |
| 19583 | sta_session->stored_roam_profile.reason = eCsrHddIssued; |
| 19584 | sta_session->stored_roam_profile.roam_id = *roam_id; |
| 19585 | sta_session->stored_roam_profile.imediate_flag = false; |
| 19586 | sta_session->stored_roam_profile.clear_flag = false; |
| 19587 | |
| 19588 | return true; |
| 19589 | } |
| 19590 | |
| 19591 | /** |
| 19592 | * csr_issue_stored_joinreq() - This function will issues station's stored |
| 19593 | * the join request. |
| 19594 | * @mac_ctx: pointer to mac context. |
| 19595 | * @roam_id: reference to roam_id variable being passed. |
| 19596 | * @session_id: station's session id. |
| 19597 | * |
| 19598 | * This function will issue station's stored join request, from this point |
| 19599 | * onwards the flow will be just like normal connect request. |
| 19600 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19601 | * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19602 | **/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19603 | QDF_STATUS csr_issue_stored_joinreq(tpAniSirGlobal mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19604 | uint32_t *roam_id, |
| 19605 | uint32_t session_id) |
| 19606 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19607 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19608 | tCsrRoamSession *sta_session; |
| 19609 | uint32_t new_roam_id; |
| 19610 | |
| 19611 | sta_session = CSR_GET_SESSION(mac_ctx, session_id); |
| 19612 | if (NULL == sta_session) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19613 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19614 | new_roam_id = GET_NEXT_ROAM_ID(&mac_ctx->roam); |
| 19615 | *roam_id = new_roam_id; |
| 19616 | status = csr_roam_issue_connect(mac_ctx, |
| 19617 | sta_session->stored_roam_profile.session_id, |
| 19618 | &sta_session->stored_roam_profile.profile, |
| 19619 | sta_session->stored_roam_profile.bsslist_handle, |
| 19620 | sta_session->stored_roam_profile.reason, |
| 19621 | new_roam_id, |
| 19622 | sta_session->stored_roam_profile.imediate_flag, |
| 19623 | sta_session->stored_roam_profile.clear_flag); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19624 | if (QDF_STATUS_SUCCESS != status) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 19625 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19626 | FL |
| 19627 | ("CSR failed issuing connect cmd with status = 0x%08X"), |
| 19628 | status); |
| 19629 | csr_clear_joinreq_param(mac_ctx, session_id); |
| 19630 | } |
| 19631 | return status; |
| 19632 | } |
| 19633 | |
| 19634 | /** |
| 19635 | * csr_process_set_hw_mode() - Set HW mode command to PE |
| 19636 | * @mac: Globacl MAC pointer |
| 19637 | * @command: Command received from SME |
| 19638 | * |
| 19639 | * Posts the set HW mode command to PE. This message passing |
| 19640 | * through PE is required for PE's internal management |
| 19641 | * |
| 19642 | * Return: None |
| 19643 | */ |
| 19644 | void csr_process_set_hw_mode(tpAniSirGlobal mac, tSmeCmd *command) |
| 19645 | { |
| 19646 | uint32_t len; |
yeshwanth sriram guntuka | d4b482a | 2017-03-27 12:51:46 +0530 | [diff] [blame] | 19647 | struct s_sir_set_hw_mode *cmd = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19648 | QDF_STATUS status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 19649 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19650 | struct sir_set_hw_mode_resp *param; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 19651 | enum policy_mgr_hw_mode_change hw_mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19652 | |
| 19653 | /* Setting HW mode is for the entire system. |
| 19654 | * So, no need to check session |
| 19655 | */ |
| 19656 | |
| 19657 | if (!command) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19658 | sme_err("Set HW mode param is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19659 | goto fail; |
| 19660 | } |
| 19661 | |
| 19662 | len = sizeof(*cmd); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19663 | cmd = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19664 | if (!cmd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19665 | sme_err("Memory allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19666 | /* Probably the fail response will also fail during malloc. |
| 19667 | * Still proceeding to send response! |
| 19668 | */ |
| 19669 | goto fail; |
| 19670 | } |
| 19671 | |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 19672 | /* For hidden SSID case, if there is any scan command pending |
| 19673 | * it needs to be cleared before issuing set HW mode |
| 19674 | */ |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 19675 | if (command->u.set_hw_mode_cmd.reason == |
| 19676 | POLICY_MGR_UPDATE_REASON_HIDDEN_STA) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19677 | sme_err("clear any pending scan command"); |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 19678 | status = csr_scan_abort_mac_scan_not_for_connect(mac, |
| 19679 | command->u.set_hw_mode_cmd.session_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19680 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19681 | sme_err("Failed to clear scan cmd"); |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 19682 | goto fail; |
| 19683 | } |
| 19684 | } |
| 19685 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 19686 | if ((POLICY_MGR_UPDATE_REASON_OPPORTUNISTIC == |
| 19687 | command->u.set_hw_mode_cmd.reason) && |
| 19688 | (true == mac->sme.get_connection_info_cb(NULL, NULL))) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19689 | sme_err("Set HW mode refused: conn in progress"); |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 19690 | policy_mgr_restart_opportunistic_timer(mac->psoc, false); |
Nitesh Shah | a3dfea3 | 2017-02-09 19:18:57 +0530 | [diff] [blame] | 19691 | goto fail; |
| 19692 | } |
| 19693 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 19694 | hw_mode = policy_mgr_get_hw_mode_change_from_hw_mode_index( |
| 19695 | mac->psoc, command->u.set_hw_mode_cmd.hw_mode_index); |
Nitesh Shah | a3dfea3 | 2017-02-09 19:18:57 +0530 | [diff] [blame] | 19696 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 19697 | if (POLICY_MGR_HW_MODE_NOT_IN_PROGRESS == hw_mode) { |
Srinivas Girigowda | 2c26335 | 2017-03-17 17:49:53 -0700 | [diff] [blame] | 19698 | sme_err("hw_mode %d, failing", hw_mode); |
Nitesh Shah | a3dfea3 | 2017-02-09 19:18:57 +0530 | [diff] [blame] | 19699 | goto fail; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 19700 | } |
Nitesh Shah | a3dfea3 | 2017-02-09 19:18:57 +0530 | [diff] [blame] | 19701 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 19702 | policy_mgr_set_hw_mode_change_in_progress(mac->psoc, hw_mode); |
Nitesh Shah | a3dfea3 | 2017-02-09 19:18:57 +0530 | [diff] [blame] | 19703 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19704 | cmd->messageType = eWNI_SME_SET_HW_MODE_REQ; |
| 19705 | cmd->length = len; |
| 19706 | cmd->set_hw.hw_mode_index = command->u.set_hw_mode_cmd.hw_mode_index; |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 19707 | cmd->set_hw.reason = command->u.set_hw_mode_cmd.reason; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19708 | /* |
| 19709 | * Below callback and context info are not needed for PE as of now. |
| 19710 | * Storing the passed value in the same s_sir_set_hw_mode format. |
| 19711 | */ |
| 19712 | cmd->set_hw.set_hw_mode_cb = command->u.set_hw_mode_cmd.set_hw_mode_cb; |
| 19713 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19714 | sme_debug( |
| 19715 | "Posting set hw mode req to PE session:%d reason:%d", |
Chandrasekaran, Manishekar | ce2172e | 2016-02-18 16:12:43 +0530 | [diff] [blame] | 19716 | command->u.set_hw_mode_cmd.session_id, |
| 19717 | command->u.set_hw_mode_cmd.reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19718 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 19719 | status = umac_send_mb_message_to_mac(cmd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19720 | if (QDF_STATUS_SUCCESS != status) { |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 19721 | policy_mgr_set_hw_mode_change_in_progress(mac->psoc, |
| 19722 | POLICY_MGR_HW_MODE_NOT_IN_PROGRESS); |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19723 | sme_err("Posting to PE failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19724 | return; |
| 19725 | } |
| 19726 | return; |
| 19727 | fail: |
yeshwanth sriram guntuka | d4b482a | 2017-03-27 12:51:46 +0530 | [diff] [blame] | 19728 | if (cmd) |
| 19729 | qdf_mem_free(cmd); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19730 | param = qdf_mem_malloc(sizeof(*param)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19731 | if (!param) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19732 | sme_err( |
| 19733 | "Malloc fail: Fail to send response to SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19734 | return; |
| 19735 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19736 | sme_err("Sending set HW fail response to SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19737 | param->status = SET_HW_MODE_STATUS_ECANCELED; |
| 19738 | param->cfgd_hw_mode_index = 0; |
| 19739 | param->num_vdev_mac_entries = 0; |
| 19740 | msg.type = eWNI_SME_SET_HW_MODE_RESP; |
| 19741 | msg.bodyptr = param; |
| 19742 | msg.bodyval = 0; |
| 19743 | sys_process_mmh_msg(mac, &msg); |
| 19744 | } |
| 19745 | |
| 19746 | /** |
| 19747 | * csr_process_set_dual_mac_config() - Set HW mode command to PE |
| 19748 | * @mac: Global MAC pointer |
| 19749 | * @command: Command received from SME |
| 19750 | * |
| 19751 | * Posts the set dual mac config command to PE. |
| 19752 | * |
| 19753 | * Return: None |
| 19754 | */ |
| 19755 | void csr_process_set_dual_mac_config(tpAniSirGlobal mac, tSmeCmd *command) |
| 19756 | { |
| 19757 | uint32_t len; |
| 19758 | struct sir_set_dual_mac_cfg *cmd; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19759 | QDF_STATUS status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 19760 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19761 | struct sir_dual_mac_config_resp *param; |
| 19762 | |
| 19763 | /* Setting MAC configuration is for the entire system. |
| 19764 | * So, no need to check session |
| 19765 | */ |
| 19766 | |
| 19767 | if (!command) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19768 | sme_err("Set HW mode param is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19769 | goto fail; |
| 19770 | } |
| 19771 | |
| 19772 | len = sizeof(*cmd); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19773 | cmd = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19774 | if (!cmd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19775 | sme_err("Memory allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19776 | /* Probably the fail response will also fail during malloc. |
| 19777 | * Still proceeding to send response! |
| 19778 | */ |
| 19779 | goto fail; |
| 19780 | } |
| 19781 | |
| 19782 | cmd->message_type = eWNI_SME_SET_DUAL_MAC_CFG_REQ; |
| 19783 | cmd->length = len; |
| 19784 | cmd->set_dual_mac.scan_config = command->u.set_dual_mac_cmd.scan_config; |
| 19785 | cmd->set_dual_mac.fw_mode_config = |
| 19786 | command->u.set_dual_mac_cmd.fw_mode_config; |
| 19787 | /* |
| 19788 | * Below callback and context info are not needed for PE as of now. |
| 19789 | * Storing the passed value in the same sir_set_dual_mac_cfg format. |
| 19790 | */ |
| 19791 | cmd->set_dual_mac.set_dual_mac_cb = |
| 19792 | command->u.set_dual_mac_cmd.set_dual_mac_cb; |
| 19793 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19794 | sme_debug( |
| 19795 | "Posting eWNI_SME_SET_DUAL_MAC_CFG_REQ to PE: %x %x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19796 | cmd->set_dual_mac.scan_config, |
| 19797 | cmd->set_dual_mac.fw_mode_config); |
| 19798 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 19799 | status = umac_send_mb_message_to_mac(cmd); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19800 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19801 | sme_err("Posting to PE failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19802 | return; |
| 19803 | } |
| 19804 | return; |
| 19805 | fail: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19806 | param = qdf_mem_malloc(sizeof(*param)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19807 | if (!param) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19808 | sme_err( |
| 19809 | "Malloc fail: Fail to send response to SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19810 | return; |
| 19811 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19812 | sme_err("Sending set dual mac fail response to SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19813 | param->status = SET_HW_MODE_STATUS_ECANCELED; |
| 19814 | msg.type = eWNI_SME_SET_DUAL_MAC_CFG_RESP; |
| 19815 | msg.bodyptr = param; |
| 19816 | msg.bodyval = 0; |
| 19817 | sys_process_mmh_msg(mac, &msg); |
| 19818 | } |
| 19819 | |
| 19820 | /** |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19821 | * csr_process_set_antenna_mode() - Set antenna mode command to |
| 19822 | * PE |
| 19823 | * @mac: Global MAC pointer |
| 19824 | * @command: Command received from SME |
| 19825 | * |
| 19826 | * Posts the set dual mac config command to PE. |
| 19827 | * |
| 19828 | * Return: None |
| 19829 | */ |
| 19830 | void csr_process_set_antenna_mode(tpAniSirGlobal mac, tSmeCmd *command) |
| 19831 | { |
| 19832 | uint32_t len; |
| 19833 | struct sir_set_antenna_mode *cmd; |
| 19834 | QDF_STATUS status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 19835 | struct scheduler_msg msg = {0}; |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19836 | struct sir_antenna_mode_resp *param; |
| 19837 | |
| 19838 | /* Setting MAC configuration is for the entire system. |
| 19839 | * So, no need to check session |
| 19840 | */ |
| 19841 | |
| 19842 | if (!command) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19843 | sme_err("Set antenna mode param is NULL"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19844 | goto fail; |
| 19845 | } |
| 19846 | |
| 19847 | len = sizeof(*cmd); |
| 19848 | cmd = qdf_mem_malloc(len); |
| 19849 | if (!cmd) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19850 | sme_err("Memory allocation failed"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19851 | goto fail; |
| 19852 | } |
| 19853 | |
| 19854 | cmd->message_type = eWNI_SME_SET_ANTENNA_MODE_REQ; |
| 19855 | cmd->length = len; |
| 19856 | cmd->set_antenna_mode = command->u.set_antenna_mode_cmd; |
| 19857 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19858 | sme_debug( |
| 19859 | "Posting eWNI_SME_SET_ANTENNA_MODE_REQ to PE: %d %d", |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19860 | cmd->set_antenna_mode.num_rx_chains, |
| 19861 | cmd->set_antenna_mode.num_tx_chains); |
| 19862 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 19863 | status = umac_send_mb_message_to_mac(cmd); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19864 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19865 | sme_err("Posting to PE failed"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19866 | /* |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 19867 | * umac_send_mb_message_to_mac would've released the mem |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19868 | * allocated by cmd. |
| 19869 | */ |
| 19870 | goto fail; |
| 19871 | } |
| 19872 | |
| 19873 | return; |
| 19874 | fail: |
| 19875 | param = qdf_mem_malloc(sizeof(*param)); |
| 19876 | if (!param) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19877 | sme_err( |
| 19878 | "Malloc fail: Fail to send response to SME"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19879 | return; |
| 19880 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19881 | sme_err("Sending set dual mac fail response to SME"); |
Archana Ramachandran | a20ef81 | 2015-11-13 16:12:13 -0800 | [diff] [blame] | 19882 | param->status = SET_ANTENNA_MODE_STATUS_ECANCELED; |
| 19883 | msg.type = eWNI_SME_SET_ANTENNA_MODE_RESP; |
| 19884 | msg.bodyptr = param; |
| 19885 | msg.bodyval = 0; |
| 19886 | sys_process_mmh_msg(mac, &msg); |
| 19887 | } |
| 19888 | |
| 19889 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19890 | * csr_process_nss_update_req() - Update nss command to PE |
| 19891 | * @mac: Globacl MAC pointer |
| 19892 | * @command: Command received from SME |
| 19893 | * |
| 19894 | * Posts the nss update command to PE. This message passing |
| 19895 | * through PE is required for PE's internal management |
| 19896 | * |
| 19897 | * Return: None |
| 19898 | */ |
| 19899 | void csr_process_nss_update_req(tpAniSirGlobal mac, tSmeCmd *command) |
| 19900 | { |
| 19901 | uint32_t len; |
| 19902 | struct sir_nss_update_request *msg; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19903 | QDF_STATUS status; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 19904 | struct scheduler_msg msg_return = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19905 | struct sir_beacon_tx_complete_rsp *param; |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 19906 | tCsrRoamSession *session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19907 | |
| 19908 | if (!command) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19909 | sme_err("nss update param is NULL"); |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 19910 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19911 | } |
| 19912 | |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 19913 | if (!CSR_IS_SESSION_VALID(mac, command->sessionId)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19914 | sme_err("Invalid session id %d", |
Naveen Rawat | 7ecf53d | 2016-06-27 15:31:48 -0700 | [diff] [blame] | 19915 | command->sessionId); |
| 19916 | return; |
| 19917 | } |
| 19918 | session = CSR_GET_SESSION(mac, command->sessionId); |
| 19919 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19920 | len = sizeof(*msg); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19921 | msg = qdf_mem_malloc(len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19922 | if (!msg) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19923 | sme_err("Memory allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19924 | /* Probably the fail response is also fail during malloc. |
| 19925 | * Still proceeding to send response! |
| 19926 | */ |
| 19927 | goto fail; |
| 19928 | } |
| 19929 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19930 | msg->msgType = eWNI_SME_NSS_UPDATE_REQ; |
| 19931 | msg->msgLen = sizeof(*msg); |
| 19932 | |
| 19933 | msg->new_nss = command->u.nss_update_cmd.new_nss; |
| 19934 | msg->vdev_id = command->u.nss_update_cmd.session_id; |
| 19935 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19936 | sme_debug("Posting eWNI_SME_NSS_UPDATE_REQ to PE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19937 | |
Rajeev Kumar | d138ac5 | 2017-01-30 18:38:37 -0800 | [diff] [blame] | 19938 | status = umac_send_mb_message_to_mac(msg); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19939 | if (QDF_STATUS_SUCCESS != status) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19940 | sme_err("Posting to PE failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19941 | return; |
| 19942 | } |
| 19943 | return; |
| 19944 | fail: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 19945 | param = qdf_mem_malloc(sizeof(*param)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19946 | if (!param) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19947 | sme_err( |
| 19948 | "Malloc fail: Fail to send response to SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19949 | return; |
| 19950 | } |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19951 | sme_err("Sending nss update fail response to SME"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19952 | param->tx_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19953 | param->session_id = command->u.nss_update_cmd.session_id; |
| 19954 | msg_return.type = eWNI_SME_NSS_UPDATE_RSP; |
| 19955 | msg_return.bodyptr = param; |
| 19956 | msg_return.bodyval = 0; |
| 19957 | sys_process_mmh_msg(mac, &msg_return); |
| 19958 | } |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 19959 | #ifdef FEATURE_WLAN_TDLS |
| 19960 | /** |
| 19961 | * csr_roam_fill_tdls_info() - Fill TDLS information |
| 19962 | * @roam_info: Roaming information buffer |
| 19963 | * @join_rsp: Join response which has TDLS info |
| 19964 | * |
| 19965 | * Return: None |
| 19966 | */ |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 19967 | void csr_roam_fill_tdls_info(tpAniSirGlobal mac_ctx, tCsrRoamInfo *roam_info, |
| 19968 | tpSirSmeJoinRsp join_rsp) |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 19969 | { |
| 19970 | roam_info->tdls_prohibited = join_rsp->tdls_prohibited; |
| 19971 | roam_info->tdls_chan_swit_prohibited = |
| 19972 | join_rsp->tdls_chan_swit_prohibited; |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 19973 | sme_debug( |
| 19974 | "tdls:prohibit: %d, chan_swit_prohibit: %d", |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 19975 | roam_info->tdls_prohibited, |
| 19976 | roam_info->tdls_chan_swit_prohibited); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 19977 | } |
| 19978 | #endif |
| 19979 | |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 19980 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Naveen Rawat | 257386f | 2017-05-17 11:42:18 -0700 | [diff] [blame] | 19981 | static QDF_STATUS csr_process_roam_sync_callback(tpAniSirGlobal mac_ctx, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 19982 | roam_offload_synch_ind *roam_synch_data, |
Naveen Rawat | 257386f | 2017-05-17 11:42:18 -0700 | [diff] [blame] | 19983 | tpSirBssDescription bss_desc, enum sir_roam_op_code reason) |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 19984 | { |
| 19985 | uint8_t session_id = roam_synch_data->roamedVdevId; |
| 19986 | tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); |
| 19987 | tDot11fBeaconIEs *ies_local = NULL; |
| 19988 | struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info; |
| 19989 | tCsrRoamInfo *roam_info; |
| 19990 | tCsrRoamConnectedProfile *conn_profile = NULL; |
| 19991 | sme_QosAssocInfo assoc_info; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 19992 | tpAddBssParams add_bss_params; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 19993 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Kiran Kumar Lokere | ba3b431 | 2016-04-29 16:40:20 -0700 | [diff] [blame] | 19994 | uint16_t len; |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 19995 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 19996 | tSirSmeHTProfile *src_profile = NULL; |
| 19997 | tCsrRoamHTProfile *dst_profile = NULL; |
| 19998 | #endif |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 19999 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20000 | if (!session) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 20001 | sme_err("LFR3: Session not found"); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20002 | return QDF_STATUS_E_FAILURE; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20003 | } |
Padma, Santhosh Kumar | cd35f53 | 2016-12-27 12:07:39 +0530 | [diff] [blame] | 20004 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 20005 | sme_debug("LFR3: reason: %d", reason); |
Varun Reddy Yeturu | f907f91 | 2016-03-21 15:06:22 -0700 | [diff] [blame] | 20006 | switch (reason) { |
| 20007 | case SIR_ROAMING_DEREGISTER_STA: |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 20008 | /* |
| 20009 | * The following is the first thing done in CSR |
| 20010 | * after receiving RSI. Hence stopping the timer here. |
| 20011 | */ |
| 20012 | csr_roam_roaming_offload_timer_action(mac_ctx, |
| 20013 | 0, session_id, ROAMING_OFFLOAD_TIMER_STOP); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20014 | if (!CSR_IS_ROAM_JOINED(mac_ctx, session_id)) { |
| 20015 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 20016 | FL("LFR3: Session not in connected state")); |
| 20017 | return QDF_STATUS_E_FAILURE; |
| 20018 | } |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20019 | csr_roam_call_callback(mac_ctx, session_id, NULL, 0, |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 20020 | eCSR_ROAM_FT_START, eCSR_ROAM_RESULT_SUCCESS); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20021 | return status; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 20022 | case SIR_ROAMING_START: |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 20023 | csr_roam_roaming_offload_timer_action(mac_ctx, |
| 20024 | CSR_ROAMING_OFFLOAD_TIMEOUT_PERIOD, session_id, |
| 20025 | ROAMING_OFFLOAD_TIMER_START); |
Varun Reddy Yeturu | f907f91 | 2016-03-21 15:06:22 -0700 | [diff] [blame] | 20026 | csr_roam_call_callback(mac_ctx, session_id, NULL, 0, |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 20027 | eCSR_ROAM_START, eCSR_ROAM_RESULT_SUCCESS); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20028 | return status; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 20029 | case SIR_ROAMING_ABORT: |
Varun Reddy Yeturu | f86f052 | 2017-03-13 17:10:03 -0700 | [diff] [blame] | 20030 | csr_roam_roaming_offload_timer_action(mac_ctx, |
| 20031 | 0, session_id, ROAMING_OFFLOAD_TIMER_STOP); |
Varun Reddy Yeturu | f907f91 | 2016-03-21 15:06:22 -0700 | [diff] [blame] | 20032 | csr_roam_call_callback(mac_ctx, session_id, NULL, 0, |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 20033 | eCSR_ROAM_ABORT, eCSR_ROAM_RESULT_SUCCESS); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20034 | return status; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 20035 | case SIR_ROAM_SYNCH_NAPI_OFF: |
| 20036 | csr_roam_call_callback(mac_ctx, session_id, NULL, 0, |
Varun Reddy Yeturu | 7b2a657 | 2017-06-15 11:07:28 -0700 | [diff] [blame] | 20037 | eCSR_ROAM_NAPI_OFF, eCSR_ROAM_RESULT_SUCCESS); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20038 | return status; |
Arif Hussain | 43354e6 | 2017-05-24 11:24:25 -0700 | [diff] [blame] | 20039 | case SIR_ROAMING_INVOKE_FAIL: |
| 20040 | csr_roam_call_callback(mac_ctx, session_id, NULL, 0, |
| 20041 | eCSR_ROAM_ASSOCIATION_FAILURE, |
| 20042 | eCSR_ROAM_RESULT_INVOKE_FAILED); |
| 20043 | |
| 20044 | /* Userspace roam request failed, disconnect with current AP */ |
| 20045 | sme_debug("LFR3: roam invoke from user-space fail, dis cur AP"); |
| 20046 | csr_roam_disconnect(mac_ctx, session_id, |
| 20047 | eCSR_DISCONNECT_REASON_DEAUTH); |
| 20048 | return status; |
Varun Reddy Yeturu | f907f91 | 2016-03-21 15:06:22 -0700 | [diff] [blame] | 20049 | case SIR_ROAM_SYNCH_PROPAGATION: |
| 20050 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 20051 | case SIR_ROAM_SYNCH_COMPLETE: |
| 20052 | /* |
| 20053 | * Following operations need to be done once roam sync |
| 20054 | * completion is sent to FW, hence called here: |
| 20055 | * 1) Firmware has already updated DBS policy. Update connection |
| 20056 | * table in the host driver. |
| 20057 | * 2) Force SCC switch if needed |
| 20058 | * 3) Set connection in progress = false |
| 20059 | */ |
| 20060 | /* first update connection info from wma interface */ |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 20061 | policy_mgr_update_connection_info(mac_ctx->psoc, session_id); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 20062 | /* then update remaining parameters from roam sync ctx */ |
Srinivas Girigowda | 6598eea | 2017-07-06 19:26:19 -0700 | [diff] [blame] | 20063 | sme_debug("Update DBS hw mode"); |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 20064 | policy_mgr_hw_mode_transition_cb( |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 20065 | roam_synch_data->hw_mode_trans_ind.old_hw_mode_index, |
| 20066 | roam_synch_data->hw_mode_trans_ind.new_hw_mode_index, |
| 20067 | roam_synch_data->hw_mode_trans_ind.num_vdev_mac_entries, |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 20068 | roam_synch_data->hw_mode_trans_ind.vdev_mac_map, |
| 20069 | mac_ctx->psoc); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 20070 | mac_ctx->sme.set_connection_info_cb(false); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 20071 | session->roam_synch_in_progress = false; |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 20072 | policy_mgr_check_concurrent_intf_and_restart_sap(mac_ctx->psoc); |
Selvaraj, Sridhar | 5056650 | 2017-05-15 18:26:47 +0530 | [diff] [blame] | 20073 | csr_roam_offload_scan(mac_ctx, session_id, |
| 20074 | ROAM_SCAN_OFFLOAD_START, |
| 20075 | REASON_CONNECT); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20076 | return status; |
Varun Reddy Yeturu | f907f91 | 2016-03-21 15:06:22 -0700 | [diff] [blame] | 20077 | default: |
Srinivas Girigowda | 6598eea | 2017-07-06 19:26:19 -0700 | [diff] [blame] | 20078 | sme_debug("LFR3: callback reason %d", reason); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20079 | return QDF_STATUS_E_FAILURE; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20080 | } |
Arif Hussain | 557920f | 2016-09-07 16:03:46 -0700 | [diff] [blame] | 20081 | session->roam_synch_in_progress = true; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20082 | session->roam_synch_data = roam_synch_data; |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20083 | status = csr_get_parsed_bss_description_ies( |
| 20084 | mac_ctx, bss_desc, &ies_local); |
| 20085 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 20086 | sme_err("LFR3: fail to parse IEs"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20087 | session->roam_synch_in_progress = false; |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20088 | return status; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20089 | } |
| 20090 | conn_profile = &session->connectedProfile; |
| 20091 | csr_roam_stop_network(mac_ctx, session_id, |
| 20092 | session->pCurRoamProfile, |
| 20093 | bss_desc, |
| 20094 | ies_local); |
| 20095 | ps_global_info->remain_in_power_active_till_dhcp = false; |
| 20096 | session->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 20097 | roam_info = qdf_mem_malloc(sizeof(tCsrRoamInfo)); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20098 | if (NULL == roam_info) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 20099 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20100 | FL("LFR3: Mem Alloc failed for roam info")); |
| 20101 | session->roam_synch_in_progress = false; |
Yeshwanth Sriram Guntuka | 6f8b875 | 2016-12-08 17:33:10 +0530 | [diff] [blame] | 20102 | qdf_mem_free(ies_local); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20103 | return QDF_STATUS_E_NOMEM; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20104 | } |
| 20105 | csr_scan_save_roam_offload_ap_to_scan_cache(mac_ctx, roam_synch_data, |
| 20106 | bss_desc); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20107 | roam_info->sessionId = session_id; |
| 20108 | csr_roam_call_callback(mac_ctx, roam_synch_data->roamedVdevId, |
| 20109 | roam_info, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, |
| 20110 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 20111 | qdf_mem_copy(&roam_info->bssid.bytes, &bss_desc->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 20112 | sizeof(struct qdf_mac_addr)); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20113 | csr_roam_save_connected_infomation(mac_ctx, session_id, |
| 20114 | session->pCurRoamProfile, |
| 20115 | bss_desc, |
| 20116 | ies_local); |
| 20117 | csr_roam_save_security_rsp_ie(mac_ctx, session_id, |
| 20118 | session->pCurRoamProfile->negotiatedAuthType, |
| 20119 | bss_desc, ies_local); |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 20120 | |
| 20121 | #ifdef FEATURE_WLAN_ESE |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20122 | roam_info->isESEAssoc = conn_profile->isESEAssoc; |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 20123 | #endif |
Prakash Dhavali | f3287ef | 2016-11-28 17:56:33 -0800 | [diff] [blame] | 20124 | |
| 20125 | /* |
| 20126 | * Encryption keys for new connection are obtained as follows: |
| 20127 | * authStatus = CSR_ROAM_AUTH_STATUS_AUTHENTICATED |
| 20128 | * Open - No keys required. |
| 20129 | * Static WEP - Firmware copies keys from old AP to new AP. |
| 20130 | * Fast roaming authentications e.g. PSK, FT, CCKM - firmware |
| 20131 | * supplicant obtains them through 4-way handshake. |
| 20132 | * |
| 20133 | * authStatus = CSR_ROAM_AUTH_STATUS_CONNECTED |
| 20134 | * All other authentications - Host supplicant performs EAPOL |
| 20135 | * with AP after this point and sends new keys to the driver. |
| 20136 | * Driver starts wait_for_key timer for that purpose. |
| 20137 | */ |
Srinivas Girigowda | f326dfe | 2017-08-03 11:28:32 -0700 | [diff] [blame] | 20138 | if (roam_synch_data->authStatus |
| 20139 | == CSR_ROAM_AUTH_STATUS_AUTHENTICATED) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 20140 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 20141 | QDF_TRACE_LEVEL_DEBUG, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20142 | FL("LFR3:Don't start waitforkey timer")); |
| 20143 | csr_roam_substate_change(mac_ctx, |
| 20144 | eCSR_ROAM_SUBSTATE_NONE, session_id); |
| 20145 | } else { |
| 20146 | roam_info->fAuthRequired = true; |
| 20147 | csr_roam_substate_change(mac_ctx, |
| 20148 | eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, |
| 20149 | session_id); |
| 20150 | |
| 20151 | ps_global_info->remain_in_power_active_till_dhcp = true; |
| 20152 | mac_ctx->roam.WaitForKeyTimerInfo.sessionId = session_id; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 20153 | if (!QDF_IS_STATUS_SUCCESS(csr_roam_start_wait_for_key_timer( |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20154 | mac_ctx, CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD)) |
| 20155 | ) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 20156 | sme_err("Failed wait for key timer start"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20157 | csr_roam_substate_change(mac_ctx, |
| 20158 | eCSR_ROAM_SUBSTATE_NONE, |
| 20159 | session_id); |
| 20160 | } |
| 20161 | } |
| 20162 | roam_info->nBeaconLength = 0; |
| 20163 | roam_info->nAssocReqLength = roam_synch_data->reassoc_req_length - |
| 20164 | SIR_MAC_HDR_LEN_3A - SIR_MAC_REASSOC_SSID_OFFSET; |
| 20165 | roam_info->nAssocRspLength = roam_synch_data->reassocRespLength - |
| 20166 | SIR_MAC_HDR_LEN_3A; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 20167 | roam_info->pbFrames = qdf_mem_malloc(roam_info->nBeaconLength + |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20168 | roam_info->nAssocReqLength + roam_info->nAssocRspLength); |
| 20169 | if (NULL == roam_info->pbFrames) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 20170 | sme_err("no memory available"); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20171 | session->roam_synch_in_progress = false; |
| 20172 | if (roam_info) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 20173 | qdf_mem_free(roam_info); |
Yeshwanth Sriram Guntuka | 6f8b875 | 2016-12-08 17:33:10 +0530 | [diff] [blame] | 20174 | qdf_mem_free(ies_local); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20175 | return QDF_STATUS_E_NOMEM; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20176 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 20177 | qdf_mem_copy(roam_info->pbFrames, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20178 | (uint8_t *)roam_synch_data + |
| 20179 | roam_synch_data->reassoc_req_offset + |
| 20180 | SIR_MAC_HDR_LEN_3A + SIR_MAC_REASSOC_SSID_OFFSET, |
| 20181 | roam_info->nAssocReqLength); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 20182 | qdf_mem_copy(roam_info->pbFrames + roam_info->nAssocReqLength, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20183 | (uint8_t *)roam_synch_data + |
| 20184 | roam_synch_data->reassocRespOffset + |
| 20185 | SIR_MAC_HDR_LEN_3A, |
| 20186 | roam_info->nAssocRspLength); |
| 20187 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 20188 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 20189 | QDF_TRACE_LEVEL_DEBUG, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20190 | FL("LFR3:Clear Connected info")); |
| 20191 | csr_roam_free_connected_info(mac_ctx, |
| 20192 | &session->connectedInfo); |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 20193 | len = roam_synch_data->join_rsp->parsedRicRspLen; |
| 20194 | |
| 20195 | #ifdef FEATURE_WLAN_ESE |
| 20196 | len += roam_synch_data->join_rsp->tspecIeLen; |
Kiran Kumar Lokere | ba3b431 | 2016-04-29 16:40:20 -0700 | [diff] [blame] | 20197 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 20198 | FL("LFR3: tspecLen %d"), |
Sreelakshmi Konamki | 0a942d4 | 2017-01-24 14:46:55 +0530 | [diff] [blame] | 20199 | roam_synch_data->join_rsp->tspecIeLen); |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 20200 | #endif |
| 20201 | |
| 20202 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
| 20203 | FL("LFR3: RIC length - %d"), |
| 20204 | roam_synch_data->join_rsp->parsedRicRspLen); |
Kiran Kumar Lokere | ba3b431 | 2016-04-29 16:40:20 -0700 | [diff] [blame] | 20205 | if (len) { |
| 20206 | session->connectedInfo.pbFrames = |
| 20207 | qdf_mem_malloc(len); |
| 20208 | if (session->connectedInfo.pbFrames != NULL) { |
| 20209 | qdf_mem_copy(session->connectedInfo.pbFrames, |
| 20210 | roam_synch_data->join_rsp->frames, len); |
| 20211 | session->connectedInfo.nRICRspLength = |
| 20212 | roam_synch_data->join_rsp->parsedRicRspLen; |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 20213 | |
| 20214 | #ifdef FEATURE_WLAN_ESE |
Sreelakshmi Konamki | 0a942d4 | 2017-01-24 14:46:55 +0530 | [diff] [blame] | 20215 | session->connectedInfo.nTspecIeLength = |
| 20216 | roam_synch_data->join_rsp->tspecIeLen; |
Yu Wang | 0477ee3 | 2017-02-10 20:02:03 +0800 | [diff] [blame] | 20217 | #endif |
Kiran Kumar Lokere | ba3b431 | 2016-04-29 16:40:20 -0700 | [diff] [blame] | 20218 | } |
| 20219 | } |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20220 | conn_profile->vht_channel_width = |
| 20221 | roam_synch_data->join_rsp->vht_channel_width; |
| 20222 | add_bss_params = (tpAddBssParams)roam_synch_data->add_bss_params; |
| 20223 | session->connectedInfo.staId = add_bss_params->staContext.staIdx; |
| 20224 | roam_info->staId = session->connectedInfo.staId; |
| 20225 | roam_info->ucastSig = |
| 20226 | (uint8_t) roam_synch_data->join_rsp->ucastSig; |
| 20227 | roam_info->bcastSig = |
| 20228 | (uint8_t) roam_synch_data->join_rsp->bcastSig; |
| 20229 | roam_info->timingMeasCap = |
| 20230 | roam_synch_data->join_rsp->timingMeasCap; |
| 20231 | roam_info->chan_info.nss = roam_synch_data->join_rsp->nss; |
| 20232 | roam_info->chan_info.rate_flags = |
| 20233 | roam_synch_data->join_rsp->max_rate_flags; |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 20234 | csr_roam_fill_tdls_info(mac_ctx, roam_info, roam_synch_data->join_rsp); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20235 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 20236 | src_profile = &roam_synch_data->join_rsp->HTProfile; |
| 20237 | dst_profile = &conn_profile->HTProfile; |
| 20238 | if (mac_ctx->roam.configParam.cc_switch_mode |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 20239 | != QDF_MCC_TO_SCC_SWITCH_DISABLE) |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20240 | csr_roam_copy_ht_profile(dst_profile, |
| 20241 | src_profile); |
| 20242 | #endif |
| 20243 | assoc_info.pBssDesc = bss_desc; |
| 20244 | roam_info->statusCode = eSIR_SME_SUCCESS; |
| 20245 | roam_info->reasonCode = eSIR_SME_SUCCESS; |
| 20246 | assoc_info.pProfile = session->pCurRoamProfile; |
| 20247 | mac_ctx->roam.roamSession[session_id].connectState = |
| 20248 | eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 20249 | sme_qos_csr_event_ind(mac_ctx, session_id, |
| 20250 | SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL); |
| 20251 | sme_qos_csr_event_ind(mac_ctx, session_id, |
| 20252 | SME_QOS_CSR_REASSOC_REQ, NULL); |
| 20253 | sme_qos_csr_event_ind(mac_ctx, session_id, |
| 20254 | SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 20255 | mac_ctx->roam.roamSession[session_id].connectState = |
| 20256 | eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 20257 | sme_qos_csr_event_ind(mac_ctx, session_id, |
| 20258 | SME_QOS_CSR_REASSOC_COMPLETE, &assoc_info); |
| 20259 | roam_info->pBssDesc = bss_desc; |
| 20260 | conn_profile->acm_mask = sme_qos_get_acm_mask(mac_ctx, |
| 20261 | bss_desc, NULL); |
| 20262 | if (conn_profile->modifyProfileFields.uapsd_mask) { |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 20263 | sme_debug( |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20264 | " uapsd_mask (0x%X) set, request UAPSD now", |
| 20265 | conn_profile->modifyProfileFields.uapsd_mask); |
| 20266 | sme_ps_start_uapsd(mac_ctx, session_id, |
| 20267 | NULL, NULL); |
| 20268 | } |
| 20269 | conn_profile->dot11Mode = session->bssParams.uCfgDot11Mode; |
| 20270 | roam_info->u.pConnectedProfile = conn_profile; |
| 20271 | |
Srinivas Girigowda | 81aef90 | 2017-03-17 09:34:19 -0700 | [diff] [blame] | 20272 | sme_debug( |
| 20273 | "vht ch width %d staId %d nss %d rate_flag %d dot11Mode %d", |
Padma, Santhosh Kumar | cd35f53 | 2016-12-27 12:07:39 +0530 | [diff] [blame] | 20274 | conn_profile->vht_channel_width, |
| 20275 | roam_info->staId, |
| 20276 | roam_info->chan_info.nss, |
| 20277 | roam_info->chan_info.rate_flags, |
| 20278 | conn_profile->dot11Mode); |
| 20279 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20280 | if (!IS_FEATURE_SUPPORTED_BY_FW |
| 20281 | (SLM_SESSIONIZATION) && |
| 20282 | (csr_is_concurrent_session_running(mac_ctx))) { |
| 20283 | mac_ctx->roam.configParam.doBMPSWorkaround = 1; |
| 20284 | } |
| 20285 | roam_info->roamSynchInProgress = true; |
| 20286 | roam_info->synchAuthStatus = roam_synch_data->authStatus; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 20287 | qdf_mem_copy(roam_info->kck, roam_synch_data->kck, SIR_KCK_KEY_LEN); |
| 20288 | qdf_mem_copy(roam_info->kek, roam_synch_data->kek, SIR_KEK_KEY_LEN); |
| 20289 | qdf_mem_copy(roam_info->replay_ctr, roam_synch_data->replay_ctr, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20290 | SIR_REPLAY_CTR_LEN); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 20291 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20292 | FL("LFR3: Copy KCK, KEK and Replay Ctr")); |
| 20293 | roam_info->subnet_change_status = |
| 20294 | CSR_GET_SUBNET_STATUS(roam_synch_data->roamReason); |
| 20295 | csr_roam_call_callback(mac_ctx, session_id, roam_info, 0, |
| 20296 | eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 20297 | csr_reset_pmkid_candidate_list(mac_ctx, session_id); |
| 20298 | #ifdef FEATURE_WLAN_WAPI |
| 20299 | csr_reset_bkid_candidate_list(mac_ctx, session_id); |
| 20300 | #endif |
| 20301 | if (!CSR_IS_WAIT_FOR_KEY(mac_ctx, session_id)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 20302 | QDF_TRACE(QDF_MODULE_ID_SME, |
| 20303 | QDF_TRACE_LEVEL_DEBUG, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20304 | FL |
| 20305 | ("NO CSR_IS_WAIT_FOR_KEY -> csr_roam_link_up")); |
| 20306 | csr_roam_link_up(mac_ctx, conn_profile->bssid); |
| 20307 | } |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 20308 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20309 | session->fRoaming = false; |
| 20310 | session->roam_synch_in_progress = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 20311 | qdf_mem_free(roam_info->pbFrames); |
| 20312 | qdf_mem_free(roam_info); |
Yeshwanth Sriram Guntuka | 6f8b875 | 2016-12-08 17:33:10 +0530 | [diff] [blame] | 20313 | qdf_mem_free(ies_local); |
Naveen Rawat | 257386f | 2017-05-17 11:42:18 -0700 | [diff] [blame] | 20314 | |
| 20315 | return status; |
| 20316 | } |
| 20317 | |
| 20318 | /** |
| 20319 | * csr_roam_synch_callback() - SME level callback for roam synch propagation |
| 20320 | * @mac_ctx: MAC Context |
| 20321 | * @roam_synch_data: Roam synch data buffer pointer |
| 20322 | * @bss_desc: BSS descriptor pointer |
| 20323 | * @reason: Reason for calling the callback |
| 20324 | * |
| 20325 | * This callback is registered with WMA and used after roaming happens in |
| 20326 | * firmware and the call to this routine completes the roam synch |
| 20327 | * propagation at both CSR and HDD levels. The HDD level propagation |
| 20328 | * is achieved through the already defined callback for assoc completion |
| 20329 | * handler. |
| 20330 | * |
| 20331 | * Return: Success or Failure. |
| 20332 | */ |
| 20333 | QDF_STATUS csr_roam_synch_callback(tpAniSirGlobal mac_ctx, |
| 20334 | roam_offload_synch_ind *roam_synch_data, |
| 20335 | tpSirBssDescription bss_desc, enum sir_roam_op_code reason) |
| 20336 | { |
| 20337 | QDF_STATUS status; |
| 20338 | |
| 20339 | status = sme_acquire_global_lock(&mac_ctx->sme); |
| 20340 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 20341 | sme_err("LFR3: Locking failed, bailing out"); |
| 20342 | return status; |
| 20343 | } |
| 20344 | |
| 20345 | status = csr_process_roam_sync_callback(mac_ctx, roam_synch_data, |
| 20346 | bss_desc, reason); |
| 20347 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20348 | sme_release_global_lock(&mac_ctx->sme); |
Varun Reddy Yeturu | 88f123c | 2017-03-14 18:24:32 -0700 | [diff] [blame] | 20349 | |
| 20350 | return status; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 20351 | } |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 20352 | #endif |