Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
gaurank kathpalia | b654f70 | 2020-01-03 15:07:17 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -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. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 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 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | /**======================================================================== |
| 29 | |
| 30 | \file wlan_hdd_assoc.c |
| 31 | \brief WLAN Host Device Driver implementation |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 32 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 33 | ========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 34 | /**========================================================================= |
| 35 | EDIT HISTORY FOR FILE |
| 36 | |
| 37 | |
| 38 | This section contains comments describing changes made to the module. |
| 39 | Notice that changes are listed in reverse chronological order. |
| 40 | |
| 41 | |
| 42 | $Header:$ $DateTime: $ $Author: $ |
| 43 | |
| 44 | |
| 45 | when who what, where, why |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 46 | -------- --- -------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 47 | 05/06/09 Shailender Created module. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 48 | ==========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 49 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 50 | #include "wlan_hdd_includes.h" |
| 51 | #include <aniGlobal.h> |
| 52 | #include "dot11f.h" |
| 53 | #include "wlan_nlink_common.h" |
| 54 | #include "wlan_btc_svc.h" |
| 55 | #include "wlan_hdd_power.h" |
Konamki, Sreelakshmi | b9c4571 | 2015-07-29 11:48:19 +0530 | [diff] [blame] | 56 | #include "wlan_hdd_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | #include <linux/ieee80211.h> |
| 58 | #include <linux/wireless.h> |
| 59 | #include <net/cfg80211.h> |
| 60 | #include "wlan_hdd_cfg80211.h" |
| 61 | #include "csrInsideApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 62 | #include "wlan_hdd_p2p.h" |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 63 | #include <vos_sched.h> |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 64 | #include "wlan_hdd_tdls.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 65 | #include "sme_Api.h" |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 66 | #include "wlan_hdd_hostapd.h" |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 67 | #include "vos_utils.h" |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 68 | #include <wlan_hdd_wext.h> |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 69 | #include "sapInternal.h" |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 70 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 71 | #if defined CFG80211_ROAMED_API_UNIFIED || \ |
| 72 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) |
| 73 | /** |
| 74 | * hdd_send_roamed_ind() - send roamed indication to cfg80211 |
| 75 | * @dev: network device |
| 76 | * @bss: cfg80211 roamed bss pointer |
| 77 | * @req_ie: IEs used in reassociation request |
| 78 | * @req_ie_len: Length of the @req_ie |
| 79 | * @resp_ie: IEs received in successful reassociation response |
| 80 | * @resp_ie_len: Length of @resp_ie |
| 81 | * |
| 82 | * Return: none |
| 83 | */ |
| 84 | static void hdd_send_roamed_ind(struct net_device *dev, |
| 85 | struct cfg80211_bss *bss, const uint8_t *req_ie, |
| 86 | size_t req_ie_len, const uint8_t *resp_ie, |
| 87 | size_t resp_ie_len) |
| 88 | { |
| 89 | struct cfg80211_roam_info info = {0}; |
| 90 | |
| 91 | info.bss = bss; |
| 92 | info.req_ie = req_ie; |
| 93 | info.req_ie_len = req_ie_len; |
| 94 | info.resp_ie = resp_ie; |
| 95 | info.resp_ie_len = resp_ie_len; |
| 96 | |
| 97 | cfg80211_roamed(dev, &info, GFP_KERNEL); |
| 98 | } |
| 99 | #else |
| 100 | /** |
| 101 | * hdd_send_roamed_ind() - send roamed indication to cfg80211 |
| 102 | * @dev: network device |
| 103 | * @bss: cfg80211 roamed bss pointer |
| 104 | * @req_ie: IEs used in reassociation request |
| 105 | * @req_ie_len: Length of the @req_ie |
| 106 | * @resp_ie: IEs received in successful reassociation response |
| 107 | * @resp_ie_len: Length of @resp_ie |
| 108 | * |
| 109 | * Return: none |
| 110 | */ |
| 111 | static inline void hdd_send_roamed_ind(struct net_device *dev, |
| 112 | struct cfg80211_bss *bss, |
| 113 | const uint8_t *req_ie, size_t req_ie_len, |
| 114 | const uint8_t *resp_ie, |
| 115 | size_t resp_ie_len) |
| 116 | { |
| 117 | cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, resp_ie_len, |
| 118 | GFP_KERNEL); |
| 119 | } |
| 120 | #endif |
| 121 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 122 | v_BOOL_t mibIsDot11DesiredBssTypeInfrastructure( hdd_adapter_t *pAdapter ); |
| 123 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 124 | struct ether_addr |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | { |
| 126 | u_char ether_addr_octet[6]; |
| 127 | }; |
| 128 | // These are needed to recognize WPA and RSN suite types |
| 129 | #define HDD_WPA_OUI_SIZE 4 |
| 130 | v_U8_t ccpWpaOui00[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 131 | v_U8_t ccpWpaOui01[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 132 | v_U8_t ccpWpaOui02[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 133 | v_U8_t ccpWpaOui03[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 134 | v_U8_t ccpWpaOui04[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 135 | v_U8_t ccpWpaOui05[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x05 }; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 136 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 137 | v_U8_t ccpWpaOui06[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 138 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 139 | #define HDD_RSN_OUI_SIZE 4 |
| 140 | v_U8_t ccpRSNOui00[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x00 }; // group cipher |
| 141 | v_U8_t ccpRSNOui01[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x01 }; // WEP-40 or RSN |
| 142 | v_U8_t ccpRSNOui02[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x02 }; // TKIP or RSN-PSK |
| 143 | v_U8_t ccpRSNOui03[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x03 }; // Reserved |
| 144 | v_U8_t ccpRSNOui04[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x04 }; // AES-CCMP |
| 145 | v_U8_t ccpRSNOui05[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 }; // WEP-104 |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 146 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 147 | v_U8_t ccpRSNOui06[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 148 | #endif /* FEATURE_WLAN_ESE */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 149 | #ifdef WLAN_FEATURE_11W |
| 150 | v_U8_t ccpRSNOui07[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x06 }; // RSN-PSK-SHA256 |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 151 | /* RSN-8021X-SHA256 */ |
| 152 | v_U8_t ccpRSNOui08[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 }; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 153 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 154 | |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 155 | #ifdef WLAN_FEATURE_SAE |
| 156 | v_U8_t ccp_rsn_oui_80[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x08}; |
| 157 | v_U8_t ccp_rsn_oui_90[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x09}; |
| 158 | #endif |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 159 | /* OWE https://tools.ietf.org/html/rfc8110 */ |
| 160 | uint8_t ccp_rsn_oui_18[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x12}; |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 161 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 162 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 163 | // Offset where the EID-Len-IE, start. |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 164 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2)*/ |
| 165 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 166 | #endif |
| 167 | |
| 168 | #define BEACON_FRAME_IES_OFFSET 12 |
| 169 | |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 170 | /* The time after add bss, in which SAP should start ECSA to move to SCC */ |
| 171 | #define ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL 1500 |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 172 | /* |
| 173 | * Time in ms after disconnect, in which the SAP should move to non DFS channel. |
| 174 | * This will avoid multiple SAP channel switch if disconnet is followed by |
| 175 | * connect. |
| 176 | */ |
| 177 | #define ECSA_DFS_CHAN_CHANGE_DEFER_TIME 200 |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 178 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 179 | #ifdef WLAN_FEATURE_11W |
| 180 | void hdd_indicateUnprotMgmtFrame(hdd_adapter_t *pAdapter, |
| 181 | tANI_U32 nFrameLength, |
| 182 | tANI_U8* pbFrames, |
| 183 | tANI_U8 frameType ); |
| 184 | #endif |
| 185 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 186 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 187 | static void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid, |
| 188 | tANI_U8 state, |
| 189 | tANI_U16 measInterval ); |
| 190 | static void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 191 | static void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo); |
| 192 | static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, const tCsrRoamInfo *pRoamInfo); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 193 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 194 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 195 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 196 | static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, |
| 197 | tCsrRoamInfo *pRoamInfo, |
| 198 | tANI_U32 roamId, |
| 199 | eRoamCmdStatus roamStatus, |
| 200 | eCsrRoamResult roamResult ); |
| 201 | |
Abhinav Kumar | 118efd0 | 2019-08-07 16:41:07 +0530 | [diff] [blame] | 202 | #if defined(WLAN_FEATURE_SAE) && \ |
| 203 | defined(CFG80211_EXTERNAL_AUTH_SUPPORT) |
| 204 | /** |
| 205 | * wlan_hdd_sae_callback() - Sends SAE info to supplicant |
| 206 | * @adapter: pointer adapter context |
| 207 | * @roam_info: pointer to roam info |
| 208 | * |
| 209 | * This API is used to send required SAE info to trigger SAE in supplicant. |
| 210 | * |
| 211 | * Return: None |
| 212 | */ |
| 213 | static void wlan_hdd_sae_callback(hdd_adapter_t *adapter, |
| 214 | tCsrRoamInfo *roam_info) |
| 215 | { |
| 216 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 217 | int flags; |
| 218 | struct sir_sae_info *sae_info = roam_info->sae_info; |
| 219 | struct cfg80211_external_auth_params params = {0}; |
| 220 | |
| 221 | if (wlan_hdd_validate_context(hdd_ctx)) |
| 222 | return; |
| 223 | if (!sae_info) { |
| 224 | hddLog(LOGE, FL("SAE info in NULL")); |
| 225 | return; |
| 226 | } |
| 227 | flags = vos_get_gfp_flags(); |
| 228 | |
| 229 | params.key_mgmt_suite = 0x00; |
| 230 | params.key_mgmt_suite |= 0x0F << 8; |
| 231 | params.key_mgmt_suite |= 0xAC << 16; |
| 232 | params.key_mgmt_suite |= 0x8 << 24; |
| 233 | |
| 234 | params.action = NL80211_EXTERNAL_AUTH_START; |
| 235 | vos_mem_copy(params.bssid, sae_info->peer_mac_addr.bytes, |
| 236 | VOS_MAC_ADDR_SIZE); |
| 237 | vos_mem_copy(params.ssid.ssid, sae_info->ssid.ssId, sae_info->ssid.length); |
| 238 | params.ssid.ssid_len = sae_info->ssid.length; |
| 239 | |
| 240 | cfg80211_external_auth_request(adapter->dev, ¶ms, flags); |
| 241 | hddLog(LOG1, FL("SAE: sent cmd")); |
| 242 | } |
| 243 | #else |
| 244 | static void wlan_hdd_sae_callback(hdd_adapter_t *adapter, |
| 245 | tCsrRoamInfo *roam_info) |
| 246 | { } |
| 247 | #endif |
| 248 | |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 249 | v_VOID_t hdd_connSetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 250 | eConnectionState connState ) |
| 251 | { |
| 252 | // save the new connection state |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 253 | hddLog(LOG1, FL("ConnectionState Changed from oldState:%d to State:%d"), |
| 254 | pHddStaCtx->conn_info.connState,connState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 255 | pHddStaCtx->conn_info.connState = connState; |
| 256 | } |
| 257 | |
| 258 | // returns FALSE if not connected. |
| 259 | // returns TRUE for the two 'connected' states (Infra Associated or IBSS Connected ). |
| 260 | // returns the connection state. Can specify NULL if you dont' want to get the actual state. |
| 261 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 262 | static inline v_BOOL_t hdd_connGetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 263 | eConnectionState *pConnState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 264 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 265 | v_BOOL_t fConnected; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 266 | eConnectionState connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 268 | // get the connection state. |
| 269 | connState = pHddStaCtx->conn_info.connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 270 | // Set the fConnected return variable based on the Connected State. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 271 | if ( eConnectionState_Associated == connState || |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 272 | eConnectionState_IbssConnected == connState || |
| 273 | eConnectionState_IbssDisconnected == connState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 274 | { |
| 275 | fConnected = VOS_TRUE; |
| 276 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 277 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 278 | { |
| 279 | fConnected = VOS_FALSE; |
| 280 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 281 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | if ( pConnState ) |
| 283 | { |
| 284 | *pConnState = connState; |
| 285 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 286 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 287 | return( fConnected ); |
| 288 | } |
| 289 | |
| 290 | v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx ) |
| 291 | { |
| 292 | return( hdd_connGetConnectionState( pHddStaCtx, NULL ) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 293 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 294 | |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 295 | eCsrBand hdd_connGetConnectedBand( hdd_station_ctx_t *pHddStaCtx ) |
| 296 | { |
| 297 | v_U8_t staChannel = 0; |
| 298 | |
| 299 | if ( eConnectionState_Associated == pHddStaCtx->conn_info.connState ) |
| 300 | { |
| 301 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 302 | } |
| 303 | |
| 304 | if ( staChannel > 0 && staChannel < 14 ) |
| 305 | return eCSR_BAND_24; |
| 306 | else if (staChannel >= 36 && staChannel <= 165 ) |
| 307 | return eCSR_BAND_5G; |
| 308 | else /* If station is not connected return as eCSR_BAND_ALL */ |
| 309 | return eCSR_BAND_ALL; |
| 310 | } |
| 311 | |
| 312 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 313 | //TODO - Not used anyhwere. Can be removed. |
| 314 | #if 0 |
| 315 | // |
| 316 | v_BOOL_t hdd_connIsConnectedInfra( hdd_adapter_t *pAdapter ) |
| 317 | { |
| 318 | v_BOOL_t fConnectedInfra = FALSE; |
| 319 | eConnectionState connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 320 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 321 | if ( hdd_connGetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connState ) ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 322 | { |
| 323 | if ( eConnectionState_Associated == connState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 324 | { |
| 325 | fConnectedInfra = TRUE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 326 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 327 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 328 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 329 | return( fConnectedInfra ); |
| 330 | } |
| 331 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 333 | static inline v_BOOL_t hdd_connGetConnectedCipherAlgo( hdd_station_ctx_t *pHddStaCtx, eCsrEncryptionType *pConnectedCipherAlgo ) |
| 334 | { |
| 335 | v_BOOL_t fConnected = VOS_FALSE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 336 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 337 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 338 | |
| 339 | if ( pConnectedCipherAlgo ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 340 | { |
| 341 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 342 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 343 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 344 | return( fConnected ); |
| 345 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 347 | inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eMib_dot11DesiredBssType *pConnectedBssType ) |
| 348 | { |
| 349 | v_BOOL_t fConnected = VOS_FALSE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 350 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 351 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 352 | |
| 353 | if ( pConnectedBssType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 354 | { |
| 355 | *pConnectedBssType = pHddStaCtx->conn_info.connDot11DesiredBssType; |
| 356 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 358 | return( fConnected ); |
| 359 | } |
| 360 | |
| 361 | static inline void hdd_connSaveConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eCsrRoamBssType csrRoamBssType ) |
| 362 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 363 | switch( csrRoamBssType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 364 | { |
| 365 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
| 366 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_infrastructure; |
| 367 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 369 | case eCSR_BSS_TYPE_IBSS: |
| 370 | case eCSR_BSS_TYPE_START_IBSS: |
| 371 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_independent; |
| 372 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 373 | |
| 374 | /** We will never set the BssType to 'any' when attempting a connection |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 375 | so CSR should never send this back to us.*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 376 | case eCSR_BSS_TYPE_ANY: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 377 | default: |
| 378 | VOS_ASSERT( 0 ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 379 | break; |
| 380 | } |
| 381 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 382 | } |
| 383 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 384 | /** |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 385 | * hdd_copy_ht_caps()- Populate kernel HT caps structure object |
| 386 | * @hdd_ht_cap: HT capabilities of kernel type |
| 387 | * @roam_ht_cap: HT capabilities maintained locally within driver |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 388 | * |
| 389 | * Return: None |
| 390 | */ |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 391 | void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap, |
| 392 | tDot11fIEHTCaps *roam_ht_cap) |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 393 | { |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 394 | uint32_t i, temp_ht_cap; |
| 395 | |
| 396 | vos_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 397 | |
| 398 | if (roam_ht_cap->advCodingCap) |
| 399 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 400 | if (roam_ht_cap->supportedChannelWidthSet) |
| 401 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 402 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 403 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 404 | if (temp_ht_cap) |
| 405 | hdd_ht_cap->cap_info |= |
| 406 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 407 | if (roam_ht_cap->greenField) |
| 408 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 409 | if (roam_ht_cap->shortGI20MHz) |
| 410 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 411 | if (roam_ht_cap->shortGI40MHz) |
| 412 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 413 | if (roam_ht_cap->txSTBC) |
| 414 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 415 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 416 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 417 | if (temp_ht_cap) |
| 418 | hdd_ht_cap->cap_info |= |
| 419 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 420 | if (roam_ht_cap->delayedBA) |
| 421 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 422 | if (roam_ht_cap->maximalAMSDUsize) |
| 423 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 424 | if (roam_ht_cap->dsssCckMode40MHz) |
| 425 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 426 | if (roam_ht_cap->psmp) |
| 427 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 428 | if (roam_ht_cap->stbcControlFrame) |
| 429 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 430 | if (roam_ht_cap->lsigTXOPProtection) |
| 431 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 432 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 433 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 434 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 435 | hdd_ht_cap->ampdu_params_info |= |
| 436 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 437 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 438 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 439 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 440 | if (temp_ht_cap) |
| 441 | hdd_ht_cap->ampdu_params_info |= |
| 442 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 443 | |
| 444 | /* 802.11n HT extended capabilities masks */ |
| 445 | if (roam_ht_cap->pco) |
| 446 | hdd_ht_cap->extended_ht_cap_info |= |
| 447 | IEEE80211_HT_EXT_CAP_PCO; |
| 448 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 449 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 450 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 451 | if (temp_ht_cap) |
| 452 | hdd_ht_cap->extended_ht_cap_info |= |
| 453 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 454 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 455 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 456 | if (temp_ht_cap) |
| 457 | hdd_ht_cap->extended_ht_cap_info |= |
| 458 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 459 | |
| 460 | /* tx_bf_cap_info capabilities */ |
| 461 | if (roam_ht_cap->txBF) |
| 462 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 463 | if (roam_ht_cap->rxStaggeredSounding) |
| 464 | hdd_ht_cap->tx_BF_cap_info |= |
| 465 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 466 | if (roam_ht_cap->txStaggeredSounding) |
| 467 | hdd_ht_cap->tx_BF_cap_info |= |
| 468 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 469 | if (roam_ht_cap->rxZLF) |
| 470 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 471 | if (roam_ht_cap->txZLF) |
| 472 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 473 | if (roam_ht_cap->implicitTxBF) |
| 474 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 475 | temp_ht_cap = roam_ht_cap->calibration & |
| 476 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 477 | if (temp_ht_cap) |
| 478 | hdd_ht_cap->tx_BF_cap_info |= |
| 479 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 480 | if (roam_ht_cap->explicitCSITxBF) |
| 481 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 482 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 483 | hdd_ht_cap->tx_BF_cap_info |= |
| 484 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 485 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 486 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 487 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 488 | if (temp_ht_cap) |
| 489 | hdd_ht_cap->tx_BF_cap_info |= |
| 490 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 491 | temp_ht_cap = |
| 492 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 493 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 494 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 495 | if (temp_ht_cap) |
| 496 | hdd_ht_cap->tx_BF_cap_info |= |
| 497 | temp_ht_cap << |
| 498 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 499 | temp_ht_cap = |
| 500 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 501 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 502 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 503 | if (temp_ht_cap) |
| 504 | hdd_ht_cap->tx_BF_cap_info |= |
| 505 | temp_ht_cap << |
| 506 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 507 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 508 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 509 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 510 | if (temp_ht_cap) |
| 511 | hdd_ht_cap->tx_BF_cap_info |= |
| 512 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 513 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 514 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 515 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 516 | if (temp_ht_cap) |
| 517 | hdd_ht_cap->tx_BF_cap_info |= |
| 518 | temp_ht_cap << |
| 519 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 520 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 521 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 522 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 523 | if (temp_ht_cap) |
| 524 | hdd_ht_cap->tx_BF_cap_info |= |
| 525 | temp_ht_cap << |
| 526 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 527 | |
| 528 | /* antenna selection */ |
| 529 | if (roam_ht_cap->antennaSelection) |
| 530 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 531 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 532 | hdd_ht_cap->antenna_selection_info |= |
| 533 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 534 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 535 | hdd_ht_cap->antenna_selection_info |= |
| 536 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 537 | if (roam_ht_cap->explicitCSIFeedback) |
| 538 | hdd_ht_cap->antenna_selection_info |= |
| 539 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 540 | if (roam_ht_cap->antennaIndicesFeedback) |
| 541 | hdd_ht_cap->antenna_selection_info |= |
| 542 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 543 | if (roam_ht_cap->rxAS) |
| 544 | hdd_ht_cap->antenna_selection_info |= |
| 545 | ANTENNA_SEL_INFO_RX_AS; |
| 546 | if (roam_ht_cap->txSoundingPPDUs) |
| 547 | hdd_ht_cap->antenna_selection_info |= |
| 548 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 549 | |
| 550 | /* mcs data rate */ |
| 551 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 552 | hdd_ht_cap->mcs.rx_mask[i] = |
| 553 | roam_ht_cap->supportedMCSSet[i]; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 554 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 555 | hdd_ht_cap->mcs.rx_highest = |
| 556 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 557 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
| 558 | hdd_ht_cap->mcs.tx_params = |
| 559 | roam_ht_cap->supportedMCSSet[12]; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 560 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 561 | } |
| 562 | |
| 563 | |
| 564 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 565 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 566 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 567 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 568 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 569 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 570 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 571 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 572 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 573 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 574 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 575 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 576 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 577 | |
| 578 | /** |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 579 | * hdd_copy_vht_caps()- Populate kernel VHT caps structure object |
| 580 | * @hdd_ht_cap: VHT capabilities of kernel type |
| 581 | * @roam_ht_cap: VHT capabilities maintained locally within driver |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 582 | * |
| 583 | * Return: None |
| 584 | */ |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 585 | void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap, |
| 586 | tDot11fIEVHTCaps *roam_vht_cap) |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 587 | { |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 588 | uint32_t temp_vht_cap; |
| 589 | |
| 590 | vos_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 591 | |
| 592 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 593 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 594 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 595 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 596 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
| 597 | if (temp_vht_cap) |
| 598 | if (roam_vht_cap->supportedChannelWidthSet & |
| 599 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 600 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 601 | hdd_vht_cap->vht_cap_info |= |
| 602 | temp_vht_cap << |
| 603 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 604 | if (roam_vht_cap->supportedChannelWidthSet & |
| 605 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 606 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 607 | hdd_vht_cap->vht_cap_info |= |
| 608 | temp_vht_cap << |
| 609 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
| 610 | if (roam_vht_cap->ldpcCodingCap) |
| 611 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 612 | if (roam_vht_cap->shortGI80MHz) |
| 613 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 614 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 615 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 616 | if (roam_vht_cap->txSTBC) |
| 617 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 618 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 619 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 620 | if (temp_vht_cap) |
| 621 | hdd_vht_cap->vht_cap_info |= |
| 622 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 623 | if (roam_vht_cap->suBeamFormerCap) |
| 624 | hdd_vht_cap->vht_cap_info |= |
| 625 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 626 | if (roam_vht_cap->suBeamformeeCap) |
| 627 | hdd_vht_cap->vht_cap_info |= |
| 628 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 629 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 630 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 631 | if (temp_vht_cap) |
| 632 | hdd_vht_cap->vht_cap_info |= |
| 633 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 634 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 635 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 636 | if (temp_vht_cap) |
| 637 | hdd_vht_cap->vht_cap_info |= |
| 638 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 639 | if (roam_vht_cap->muBeamformerCap) |
| 640 | hdd_vht_cap->vht_cap_info |= |
| 641 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 642 | if (roam_vht_cap->muBeamformeeCap) |
| 643 | hdd_vht_cap->vht_cap_info |= |
| 644 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 645 | if (roam_vht_cap->vhtTXOPPS) |
| 646 | hdd_vht_cap->vht_cap_info |= |
| 647 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 648 | if (roam_vht_cap->htcVHTCap) |
| 649 | hdd_vht_cap->vht_cap_info |= |
| 650 | IEEE80211_VHT_CAP_HTC_VHT; |
| 651 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 652 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 653 | if (temp_vht_cap) |
| 654 | hdd_vht_cap->vht_cap_info |= |
| 655 | temp_vht_cap << |
| 656 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 657 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 658 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 659 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 660 | if (temp_vht_cap) |
| 661 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 662 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 663 | if (roam_vht_cap->rxAntPattern) |
| 664 | hdd_vht_cap->vht_cap_info |= |
| 665 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 666 | if (roam_vht_cap->txAntPattern) |
| 667 | hdd_vht_cap->vht_cap_info |= |
| 668 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 669 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 670 | hdd_vht_cap->supp_mcs.rx_highest = |
| 671 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 672 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 673 | hdd_vht_cap->supp_mcs.tx_highest = |
| 674 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 675 | } |
| 676 | |
| 677 | /* ht param */ |
| 678 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 679 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 680 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 681 | |
| 682 | /* operatinon mode */ |
| 683 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 684 | |
| 685 | /* stbc_param */ |
| 686 | #define HT_STBC_PARAM_MCS 0x007f |
| 687 | |
| 688 | /** |
| 689 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 690 | * hdd station context. |
| 691 | * @hdd_sta_ctx: pointer to hdd station context |
| 692 | * @roam_info: pointer to roam info |
| 693 | * |
| 694 | * Return: None |
| 695 | */ |
| 696 | static void hdd_copy_ht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 697 | tCsrRoamInfo *roam_info) |
| 698 | { |
| 699 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 700 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 701 | &hdd_sta_ctx->conn_info.ht_operation; |
| 702 | uint32_t i, temp_ht_ops; |
| 703 | |
| 704 | vos_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 705 | |
| 706 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 707 | |
| 708 | /* HT_PARAMS */ |
| 709 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 710 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 711 | if (temp_ht_ops) |
| 712 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 713 | else |
| 714 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 715 | if (roam_ht_ops->recommendedTxWidthSet) |
| 716 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 717 | if (roam_ht_ops->rifsMode) |
| 718 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 719 | if (roam_ht_ops->controlledAccessOnly) |
| 720 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 721 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 722 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 723 | if (temp_ht_ops) |
| 724 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 725 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 726 | |
| 727 | /* operation mode */ |
| 728 | temp_ht_ops = roam_ht_ops->opMode & |
| 729 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 730 | switch (temp_ht_ops) { |
| 731 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 732 | hdd_ht_ops->operation_mode |= |
| 733 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 734 | break; |
| 735 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 736 | hdd_ht_ops->operation_mode |= |
| 737 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 738 | break; |
| 739 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 740 | hdd_ht_ops->operation_mode |= |
| 741 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 742 | break; |
| 743 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 744 | default: |
| 745 | hdd_ht_ops->operation_mode |= |
| 746 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 747 | } |
| 748 | if (roam_ht_ops->nonGFDevicesPresent) |
| 749 | hdd_ht_ops->operation_mode |= |
| 750 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 751 | if (roam_ht_ops->transmitBurstLimit) |
| 752 | hdd_ht_ops->operation_mode |= |
| 753 | HT_OP_MODE_TX_BURST_LIMIT; |
| 754 | if (roam_ht_ops->obssNonHTStaPresent) |
| 755 | hdd_ht_ops->operation_mode |= |
| 756 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 757 | |
| 758 | /* stbc_param */ |
| 759 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 760 | HT_STBC_PARAM_MCS; |
| 761 | if (temp_ht_ops) |
| 762 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 763 | if (roam_ht_ops->dualCTSProtection) |
| 764 | hdd_ht_ops->stbc_param |= |
| 765 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 766 | if (roam_ht_ops->secondaryBeacon) |
| 767 | hdd_ht_ops->stbc_param |= |
| 768 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 769 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 770 | hdd_ht_ops->stbc_param |= |
| 771 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 772 | if (roam_ht_ops->pcoActive) |
| 773 | hdd_ht_ops->stbc_param |= |
| 774 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 775 | if (roam_ht_ops->pcoPhase) |
| 776 | hdd_ht_ops->stbc_param |= |
| 777 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 778 | |
| 779 | /* basic MCs set */ |
| 780 | for (i = 0; i < 16; ++i) |
| 781 | hdd_ht_ops->basic_set[i] = |
| 782 | roam_ht_ops->basicMCSSet[i]; |
| 783 | } |
| 784 | |
| 785 | /** |
| 786 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 787 | * hdd station context. |
| 788 | * @hdd_sta_ctx: pointer to hdd station context |
| 789 | * @roam_info: pointer to roam info |
| 790 | * |
| 791 | * Return: None |
| 792 | */ |
| 793 | static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 794 | tCsrRoamInfo *roam_info) |
| 795 | { |
| 796 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 797 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 798 | &hdd_sta_ctx->conn_info.vht_operation; |
| 799 | |
| 800 | vos_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 801 | |
| 802 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
| 803 | hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1; |
| 804 | hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2; |
| 805 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 806 | } |
| 807 | |
| 808 | |
| 809 | /** |
| 810 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 811 | * @adapter: Pointer to adapter |
| 812 | * @roam_info: pointer to roam info |
| 813 | * |
| 814 | * Return: None |
| 815 | */ |
| 816 | static void hdd_save_bss_info(hdd_adapter_t *adapter, |
| 817 | tCsrRoamInfo *roam_info) |
| 818 | { |
| 819 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 820 | |
| 821 | hdd_sta_ctx->conn_info.freq = vos_chan_to_freq( |
| 822 | hdd_sta_ctx->conn_info.operationChannel); |
| 823 | if (roam_info->vht_caps.present) { |
| 824 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 825 | hdd_copy_vht_caps(&hdd_sta_ctx->conn_info.vht_caps, |
| 826 | &roam_info->vht_caps); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 827 | } else { |
| 828 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 829 | } |
| 830 | if (roam_info->ht_caps.present) { |
| 831 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 832 | hdd_copy_ht_caps(&hdd_sta_ctx->conn_info.ht_caps, &roam_info->ht_caps); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 833 | } else { |
| 834 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 835 | } |
| 836 | if (roam_info->reassoc) |
| 837 | hdd_sta_ctx->conn_info.roam_count++; |
| 838 | if (roam_info->hs20vendor_ie.present) { |
| 839 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 840 | vos_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 841 | &roam_info->hs20vendor_ie, |
| 842 | sizeof(roam_info->hs20vendor_ie)); |
| 843 | } else { |
| 844 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 845 | } |
| 846 | if (roam_info->ht_operation.present) { |
| 847 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 848 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 849 | } else { |
| 850 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 851 | } |
| 852 | if (roam_info->vht_operation.present) { |
| 853 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 854 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 855 | } else { |
| 856 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 857 | } |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 858 | /* Cache last connection info */ |
| 859 | vos_mem_copy(&hdd_sta_ctx->cache_conn_info, &hdd_sta_ctx->conn_info, |
| 860 | sizeof(connection_info_t)); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 861 | } |
| 862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 863 | void hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType ) |
| 864 | { |
| 865 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 866 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 867 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 868 | VOS_ASSERT( pRoamInfo ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 869 | |
| 870 | if ( pRoamInfo ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 871 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 872 | // Save the BSSID for the connection... |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 873 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType ) |
| 874 | { |
| 875 | VOS_ASSERT( pRoamInfo->pBssDesc ); |
| 876 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,6 ); |
| 877 | |
| 878 | // Save the Station ID for this station from the 'Roam Info'. |
| 879 | //For IBSS mode, staId is assigned in NEW_PEER_IND |
| 880 | //For reassoc, the staID doesn't change and it may be invalid in this structure |
| 881 | //so no change here. |
| 882 | if( !pRoamInfo->fReassocReq ) |
| 883 | { |
| 884 | pHddStaCtx->conn_info.staId [0]= pRoamInfo->staId; |
| 885 | } |
| 886 | } |
| 887 | else if ( eCSR_BSS_TYPE_IBSS == eBssType ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 888 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 889 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,sizeof(pRoamInfo->bssid) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 890 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 891 | else |
| 892 | { |
| 893 | // can't happen. We need a valid IBSS or Infra setting in the BSSDescription |
| 894 | // or we can't function. |
| 895 | VOS_ASSERT( 0 ); |
| 896 | } |
| 897 | |
| 898 | // notify WMM |
| 899 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 900 | |
| 901 | if( !pRoamInfo->u.pConnectedProfile ) |
| 902 | { |
| 903 | VOS_ASSERT( pRoamInfo->u.pConnectedProfile ); |
| 904 | } |
| 905 | else |
| 906 | { |
| 907 | // Get Multicast Encryption Type |
| 908 | encryptType = pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 909 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 910 | // Get Unicast Encrytion Type |
| 911 | encryptType = pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 912 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 913 | |
| 914 | pHddStaCtx->conn_info.authType = pRoamInfo->u.pConnectedProfile->AuthType; |
| 915 | |
| 916 | pHddStaCtx->conn_info.operationChannel = pRoamInfo->u.pConnectedProfile->operationChannel; |
| 917 | |
| 918 | // Save the ssid for the connection |
| 919 | vos_mem_copy( &pHddStaCtx->conn_info.SSID.SSID, &pRoamInfo->u.pConnectedProfile->SSID, sizeof( tSirMacSSid ) ); |
Gopichand Nakkala | dacbcb5 | 2013-04-18 16:41:54 +0530 | [diff] [blame] | 920 | |
| 921 | // Save dot11mode in which STA associated to AP |
| 922 | pHddStaCtx->conn_info.dot11Mode = pRoamInfo->u.pConnectedProfile->dot11Mode; |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 923 | |
| 924 | pHddStaCtx->conn_info.rate_flags = pRoamInfo->maxRateFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 925 | } |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 926 | hdd_save_bss_info(pAdapter, pRoamInfo); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 927 | } |
| 928 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 929 | // save the connected BssType |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 930 | hdd_connSaveConnectedBssType( pHddStaCtx, eBssType ); |
| 931 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 932 | } |
| 933 | |
| 934 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 935 | /* |
| 936 | * Send the 11R key information to the supplicant. |
| 937 | * Only then can the supplicant generate the PMK-R1. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 938 | * (BTW, the ESE supplicant also needs the Assoc Resp IEs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 939 | * for the same purpose.) |
| 940 | * |
| 941 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA |
| 942 | * this contains the R1KHID, R0KHID and the MDID. |
| 943 | * For FT, this consists of the Reassoc Rsp FTIEs. |
| 944 | * This is the Assoc Response. |
| 945 | */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 946 | static void hdd_SendFTAssocResponse(struct net_device *dev, hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 947 | tCsrRoamInfo *pCsrRoamInfo) |
| 948 | { |
| 949 | union iwreq_data wrqu; |
| 950 | char *buff; |
| 951 | unsigned int len = 0; |
| 952 | u8 *pFTAssocRsp = NULL; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 953 | |
Ashish Kumar Dhanotiya | a1a9aaa | 2020-02-11 17:57:11 +0530 | [diff] [blame] | 954 | if (pCsrRoamInfo->nAssocRspLength < FT_ASSOC_RSP_IES_OFFSET) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 955 | { |
| 956 | hddLog(LOGE, |
Ashish Kumar Dhanotiya | a1a9aaa | 2020-02-11 17:57:11 +0530 | [diff] [blame] | 957 | "%s: Invalid assoc rsp length %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 958 | __func__, (int)pCsrRoamInfo->nAssocRspLength); |
| 959 | return; |
| 960 | } |
| 961 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 962 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 963 | pCsrRoamInfo->nAssocReqLength); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 964 | if (pFTAssocRsp == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 965 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 966 | hddLog(LOGE, "%s: AssocReq or AssocRsp is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 967 | return; |
| 968 | } |
| 969 | |
| 970 | // pFTAssocRsp needs to point to the IEs |
| 971 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 972 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 973 | (unsigned int)pFTAssocRsp[0], |
| 974 | (unsigned int)pFTAssocRsp[1]); |
| 975 | |
Ashish Kumar Dhanotiya | a1a9aaa | 2020-02-11 17:57:11 +0530 | [diff] [blame] | 976 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
| 977 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 978 | if (len > IW_GENERIC_IE_MAX) { |
| 979 | hddLog(LOGE, |
| 980 | "%s: Invalid assoc rsp length %d", |
| 981 | __func__, (int)pCsrRoamInfo->nAssocRspLength); |
| 982 | return; |
| 983 | } |
| 984 | wrqu.data.length = len; |
| 985 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 986 | // We need to send the IEs to the supplicant. |
| 987 | buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 988 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 989 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 990 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 991 | return; |
| 992 | } |
| 993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 994 | memset(buff, 0, IW_GENERIC_IE_MAX); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 995 | memcpy(buff, pFTAssocRsp, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 996 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 997 | |
| 998 | kfree(buff); |
| 999 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1000 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1001 | |
| 1002 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1003 | |
| 1004 | /*--------------------------------------------------- |
| 1005 | * |
| 1006 | * Send the FTIEs, RIC IEs during FT. This is eventually |
| 1007 | * used to send the FT events to the supplicant |
| 1008 | * |
| 1009 | * At the reception of Auth2 we send the RIC followed |
| 1010 | * by the auth response IEs to the supplicant. |
| 1011 | * Once both are received in the supplicant, an FT |
| 1012 | * event is generated to the supplicant. |
| 1013 | * |
| 1014 | *--------------------------------------------------- |
| 1015 | */ |
| 1016 | void hdd_SendFTEvent(hdd_adapter_t *pAdapter) |
| 1017 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1018 | tANI_U16 auth_resp_len = 0; |
| 1019 | tANI_U32 ric_ies_length = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1020 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1021 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 1022 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1023 | struct cfg80211_ft_event_params ftEvent; |
| 1024 | v_U8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 1025 | v_U8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 1026 | struct net_device *dev = pAdapter->dev; |
| 1027 | #else |
| 1028 | char *buff; |
| 1029 | union iwreq_data wrqu; |
| 1030 | tANI_U16 str_len; |
| 1031 | #endif |
| 1032 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 1033 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1034 | vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1035 | vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1036 | |
Kanchanapally, Vidyullatha | 31b8d14 | 2015-01-30 14:25:18 +0530 | [diff] [blame] | 1037 | sme_GetRICIEs(pHddCtx->hHal, (u8 *)ricIe, |
| 1038 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1039 | if (ric_ies_length == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1040 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1041 | hddLog(LOGW, |
| 1042 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 1043 | __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1044 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1045 | |
| 1046 | ftEvent.ric_ies = ricIe; |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1047 | ftEvent.ric_ies_len = ric_ies_length; |
| 1048 | hddLog(LOG1, "%s: RIC IEs is of length %d", __func__, (int)ric_ies_length); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1049 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1050 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1051 | DOT11F_IE_FTINFO_MAX_LEN, &auth_resp_len); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1052 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1053 | if (auth_resp_len == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1054 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1055 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1056 | return; |
| 1057 | } |
| 1058 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1059 | sme_SetFTPreAuthState(pHddCtx->hHal, TRUE); |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 1060 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1061 | ftEvent.target_ap = ftIe; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1062 | |
| 1063 | ftEvent.ies = (u8 *)(ftIe + SIR_MAC_ADDR_LENGTH); |
| 1064 | ftEvent.ies_len = auth_resp_len - SIR_MAC_ADDR_LENGTH; |
| 1065 | |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 1066 | hddLog(LOG1, "%s ftEvent.ies_len %zu", __FUNCTION__, ftEvent.ies_len); |
| 1067 | hddLog(LOG1, "%s ftEvent.ric_ies_len %zu", |
| 1068 | __FUNCTION__, ftEvent.ric_ies_len ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1069 | hddLog(LOG1, "%s ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x ", |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1070 | __FUNCTION__, ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1071 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1072 | ftEvent.target_ap[5]); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1073 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 1074 | (void)cfg80211_ft_event(dev, &ftEvent); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1075 | |
| 1076 | #else |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1077 | // We need to send the IEs to the supplicant |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1078 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1079 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1080 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1081 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1082 | return; |
| 1083 | } |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1084 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1085 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1086 | // Sme needs to send the RIC IEs first |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1087 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1088 | sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]), |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1089 | (IW_CUSTOM_MAX - str_len), &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1090 | if (ric_ies_length == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1091 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1092 | hddLog(LOGW, |
| 1093 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 1094 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1095 | } |
| 1096 | else |
| 1097 | { |
| 1098 | wrqu.data.length = str_len + ric_ies_length; |
| 1099 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1100 | } |
| 1101 | |
| 1102 | // Sme needs to provide the Auth Resp |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1103 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1104 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1105 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len], |
| 1106 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1107 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1108 | if (auth_resp_len == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1109 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1110 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Bhargav Shah | 8b5b2f7 | 2015-07-14 11:53:46 +0530 | [diff] [blame] | 1111 | kfree(buff); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1112 | return; |
| 1113 | } |
| 1114 | |
| 1115 | wrqu.data.length = str_len + auth_resp_len; |
| 1116 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1117 | |
| 1118 | kfree(buff); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1119 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1120 | } |
| 1121 | |
| 1122 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 1123 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1124 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1125 | |
| 1126 | /* |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1127 | * Send the ESE required "new AP Channel info" to the supplicant. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1128 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1129 | * |
| 1130 | * The current (new AP) channel information is passed in. |
| 1131 | */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1132 | static void hdd_SendNewAPChannelInfo(struct net_device *dev, hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1133 | tCsrRoamInfo *pCsrRoamInfo) |
| 1134 | { |
| 1135 | union iwreq_data wrqu; |
| 1136 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1137 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1138 | |
| 1139 | if (descriptor == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1140 | { |
| 1141 | hddLog(LOGE, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 1142 | "%s: pCsrRoamInfo->pBssDesc=%pK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1143 | __func__, descriptor); |
| 1144 | return; |
| 1145 | } |
| 1146 | |
| 1147 | // Send the Channel event, the supplicant needs this to generate the Adjacent AP report. |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1148 | hddLog(LOGW, "%s: Sending up an SIOCGIWFREQ, channelId=%d", __func__, descriptor->channelId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1149 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1150 | wrqu.freq.m = descriptor->channelId; |
| 1151 | wrqu.freq.e = 0; |
| 1152 | wrqu.freq.i = 0; |
| 1153 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1154 | } |
| 1155 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1156 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1157 | |
| 1158 | void hdd_SendUpdateBeaconIEsEvent(hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo) |
| 1159 | { |
| 1160 | union iwreq_data wrqu; |
| 1161 | u8 *pBeaconIes; |
| 1162 | u8 currentLen = 0; |
| 1163 | char *buff; |
| 1164 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1165 | |
| 1166 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1167 | |
| 1168 | if (0 == pCsrRoamInfo->nBeaconLength) |
| 1169 | { |
| 1170 | hddLog(LOGE, "%s: pCsrRoamInfo->nBeaconFrameLength = 0", __func__); |
| 1171 | return; |
| 1172 | } |
| 1173 | pBeaconIes = (u8 *)(pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1174 | if (pBeaconIes == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1175 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1176 | hddLog(LOGE, "%s: Beacon IEs is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1177 | return; |
| 1178 | } |
| 1179 | |
| 1180 | // pBeaconIes needs to point to the IEs |
| 1181 | hddLog(LOG1, "%s: Beacon IEs is now at %02x%02x", __func__, |
| 1182 | (unsigned int)pBeaconIes[0], |
| 1183 | (unsigned int)pBeaconIes[1]); |
| 1184 | hddLog(LOG1, "%s: Beacon IEs length = %d", __func__, pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1185 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1186 | // We need to send the IEs to the supplicant. |
| 1187 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1188 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1189 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1190 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1191 | return; |
| 1192 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1193 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1194 | |
| 1195 | strLen = strlcpy(buff,"BEACONIEs=", IW_CUSTOM_MAX); |
| 1196 | currentLen = strLen + 1; |
| 1197 | |
| 1198 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1199 | do |
| 1200 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1201 | /* If the beacon size exceeds max CUSTOM event size, break it into chunks of CUSTOM event |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1202 | * max size and send it to supplicant. Changes are done in supplicant to handle this */ |
| 1203 | vos_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
| 1204 | currentLen = VOS_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
| 1205 | vos_mem_copy(&buff[strLen + 1], pBeaconIes+currentOffset, currentLen); |
| 1206 | currentOffset += currentLen; |
| 1207 | totalIeLen -= currentLen; |
| 1208 | wrqu.data.length = strLen + 1 + currentLen; |
| 1209 | if (totalIeLen) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1210 | buff[strLen] = 1; // This tells supplicant more chunks are pending |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1211 | else |
| 1212 | buff[strLen] = 0; // For last chunk of beacon IE to supplicant |
| 1213 | |
| 1214 | hddLog(LOG1, "%s: Beacon IEs length to supplicant = %d", __func__, currentLen); |
| 1215 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1216 | } while (totalIeLen > 0); |
| 1217 | |
| 1218 | kfree(buff); |
| 1219 | } |
| 1220 | |
| 1221 | static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRoamInfo) |
| 1222 | { |
| 1223 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1224 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1225 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1226 | union iwreq_data wrqu; |
| 1227 | int we_event; |
| 1228 | char *msg; |
| 1229 | int type = -1; |
| 1230 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1231 | #if defined (WLAN_FEATURE_VOWIFI_11R) |
| 1232 | // Added to find the auth type on the fly at run time |
| 1233 | // rather than with cfg to see if FT is enabled |
| 1234 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 1236 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1237 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1238 | memset(&wrqu, '\0', sizeof(wrqu)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1239 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1240 | we_event = SIOCGIWAP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1241 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1242 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
| 1243 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1244 | /* In case of roaming ; We are not doing disconnect. |
| 1245 | * If disconnect is not being done for roam; We will not |
| 1246 | * decrease count for Active sessions. We should not increase active |
| 1247 | * active session in case of roaming. |
| 1248 | */ |
Padma, Santhosh Kumar | 87ba40f | 2014-11-26 19:40:15 +0530 | [diff] [blame] | 1249 | if((pHddStaCtx->ft_carrier_on == FALSE) && !pCsrRoamInfo->fReassocReq) |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1250 | { |
| 1251 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
| 1252 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1253 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1254 | type = WLAN_STA_ASSOC_DONE_IND; |
| 1255 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 1256 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 1257 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1258 | { |
| 1259 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_1) |
| 1260 | { |
| 1261 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTED_STATE_1; |
| 1262 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 1263 | "Connecting state to Connected State for 8-way " |
| 1264 | "Handshake"); |
| 1265 | } |
| 1266 | else if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_2) |
| 1267 | { |
| 1268 | globalP2PConnectionStatus = P2P_CLIENT_COMPLETED_STATE; |
| 1269 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 1270 | "Connecting state to P2P Client Connection Completed"); |
| 1271 | } |
| 1272 | } |
| 1273 | #endif |
Yeshwanth Sriram Guntuka | 0004c0b | 2017-12-06 14:43:49 +0530 | [diff] [blame] | 1274 | hddLog(VOS_TRACE_LEVEL_ERROR, MAC_ADDRESS_STR " connected to " |
| 1275 | MAC_ADDRESS_STR, |
| 1276 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1277 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1278 | hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo); |
| 1279 | |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1280 | hdd_manage_delack_timer(pHddCtx); |
| 1281 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1282 | /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or |
| 1283 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled |
| 1284 | * and fFTEnable is TRUE */ |
| 1285 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1286 | // Send FT Keys to the supplicant when FT is enabled |
| 1287 | if ((pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN_PSK) || |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1288 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1289 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1290 | || (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1291 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) |
| 1292 | #endif |
| 1293 | ) |
| 1294 | { |
| 1295 | hdd_SendFTAssocResponse(dev, pAdapter, pCsrRoamInfo); |
| 1296 | } |
| 1297 | #endif |
| 1298 | } |
| 1299 | else if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) // IBss Associated |
| 1300 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1301 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 1302 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1303 | type = WLAN_STA_ASSOC_DONE_IND; |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 1304 | |
| 1305 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1306 | "wlan: new IBSS connection to " MAC_ADDRESS_STR, |
| 1307 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1308 | } |
| 1309 | else /* Not Associated */ |
| 1310 | { |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 1311 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1312 | "wlan: disconnected"); |
gaurank kathpalia | 5180158 | 2019-04-05 13:56:55 +0530 | [diff] [blame] | 1313 | if (pHddCtx->btCoexModeSet) { |
| 1314 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1315 | FL("Wlan disconnected, sending DHCP stop indication")); |
| 1316 | pHddCtx->btCoexModeSet = FALSE; |
| 1317 | sme_DHCPStopInd(pHddCtx->hHal, pAdapter->device_mode, |
| 1318 | pAdapter->sessionId); |
| 1319 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1320 | type = WLAN_STA_DISASSOC_DONE_IND; |
| 1321 | memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN); |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1322 | |
| 1323 | hdd_manage_delack_timer(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1324 | } |
Sudhir Sattayappa Kohalli | 90e4c75 | 2013-03-21 14:25:04 -0700 | [diff] [blame] | 1325 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1326 | |
| 1327 | msg = NULL; |
| 1328 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 1329 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 1330 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1331 | { |
| 1332 | wireless_send_event(dev, we_event, &wrqu, msg); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1333 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1334 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1335 | { |
| 1336 | if ( (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1337 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1338 | hdd_SendNewAPChannelInfo(dev, pAdapter, pCsrRoamInfo); |
| 1339 | } |
| 1340 | #endif |
| 1341 | } |
| 1342 | send_btc_nlink_msg(type, 0); |
| 1343 | } |
| 1344 | |
| 1345 | void hdd_connRemoveConnectInfo( hdd_station_ctx_t *pHddStaCtx ) |
| 1346 | { |
| 1347 | // Remove staId, bssId and peerMacAddress |
| 1348 | pHddStaCtx->conn_info.staId [ 0 ] = 0; |
| 1349 | vos_mem_zero( &pHddStaCtx->conn_info.bssId, sizeof( v_MACADDR_t ) ); |
| 1350 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], sizeof( v_MACADDR_t ) ); |
| 1351 | |
| 1352 | // Clear all security settings |
| 1353 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1354 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1355 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1356 | |
| 1357 | vos_mem_zero( &pHddStaCtx->conn_info.Keys, sizeof( tCsrKeys ) ); |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 1358 | vos_mem_zero( &pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1359 | |
| 1360 | // Set not-connected state |
| 1361 | pHddStaCtx->conn_info.connDot11DesiredBssType = eCSR_BSS_TYPE_ANY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1362 | |
| 1363 | vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) ); |
| 1364 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1365 | |
| 1366 | VOS_STATUS hdd_ibss_deinit_tx_rx_sta ( hdd_adapter_t *pAdapter, v_U8_t STAId ) |
| 1367 | { |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1368 | v_U8_t ac; |
| 1369 | /**Track whether OS TX queue has been disabled.*/ |
| 1370 | v_BOOL_t txSuspended[NUM_TX_QUEUES]; |
| 1371 | v_U8_t tlAC; |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1372 | v_U8_t i; |
| 1373 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1374 | hdd_ibss_peer_info_t *pPeerInfo; |
| 1375 | |
| 1376 | if( NULL == pHddStaCtx ) |
| 1377 | { |
| 1378 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1379 | "%s: HDD station context NULL ",__func__); |
| 1380 | return VOS_STATUS_E_FAILURE; |
| 1381 | } |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1382 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1383 | pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1384 | if (FALSE == pPeerInfo->ibssStaInfo[STAId].isUsed) |
| 1385 | { |
| 1386 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1387 | "%s: Deinit station not inited %d", __func__, STAId ); |
| 1388 | return VOS_STATUS_E_FAILURE; |
| 1389 | } |
| 1390 | |
| 1391 | hdd_flush_ibss_tx_queues(pAdapter, STAId); |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1392 | |
| 1393 | for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++) |
| 1394 | { |
| 1395 | tlAC = hdd_QdiscAcToTlAC[ac]; |
| 1396 | txSuspended[ac] = pPeerInfo->ibssStaInfo[STAId].txSuspended[tlAC]; |
| 1397 | } |
| 1398 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1399 | vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t)); |
| 1400 | |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1401 | /* re-init hdd list, since netdev can still open adapter until |
| 1402 | * driver gets unloaded |
| 1403 | */ |
| 1404 | for (i = 0; i < NUM_TX_QUEUES; i ++) |
| 1405 | { |
| 1406 | hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], |
| 1407 | HDD_TX_QUEUE_MAX_LEN); |
| 1408 | } |
| 1409 | |
| 1410 | for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++) |
| 1411 | { |
| 1412 | if (txSuspended[ac]) |
| 1413 | { |
| 1414 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1415 | "%s: TX queue re-enabled", __func__); |
| 1416 | netif_wake_subqueue(pAdapter->dev, ac); |
| 1417 | } |
| 1418 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1419 | return VOS_STATUS_SUCCESS; |
| 1420 | } |
| 1421 | |
| 1422 | static VOS_STATUS hdd_ibss_DeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 1423 | { |
| 1424 | VOS_STATUS vosStatus; |
| 1425 | |
| 1426 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 1427 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1428 | { |
| 1429 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1430 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
| 1431 | "Status= %d [0x%08X]", |
| 1432 | __func__, staId, vosStatus, vosStatus ); |
| 1433 | } |
| 1434 | |
| 1435 | vosStatus = hdd_ibss_deinit_tx_rx_sta ( pAdapter, staId ); |
| 1436 | if( VOS_STATUS_E_FAILURE == vosStatus ) |
| 1437 | { |
| 1438 | VOS_TRACE ( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1439 | "hdd_ibss_deinit_tx_rx_sta() failed for staID %d. " |
| 1440 | "Status = %d [0x%08X]", |
| 1441 | staId, vosStatus, vosStatus ); |
| 1442 | } |
| 1443 | |
| 1444 | return( vosStatus ); |
| 1445 | } |
| 1446 | |
| 1447 | VOS_STATUS hdd_ibss_init_tx_rx_sta( hdd_adapter_t *pAdapter, v_U8_t STAId, v_MACADDR_t *pmacAddrSTA) |
| 1448 | { |
| 1449 | v_U8_t i = 0; |
| 1450 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1451 | hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1452 | |
| 1453 | if (pPeerInfo->ibssStaInfo[STAId].isUsed) |
| 1454 | { |
| 1455 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1456 | "%s: Reinit station %d", __func__, STAId ); |
| 1457 | return VOS_STATUS_E_FAILURE; |
| 1458 | } |
| 1459 | |
| 1460 | vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t)); |
| 1461 | for (i = 0; i < NUM_TX_QUEUES; i ++) |
| 1462 | { |
| 1463 | hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN); |
| 1464 | } |
| 1465 | |
| 1466 | pPeerInfo->ibssStaInfo[STAId].isUsed = VOS_TRUE; |
| 1467 | pPeerInfo->ibssStaInfo[STAId].isDeauthInProgress = VOS_FALSE; |
| 1468 | vos_copy_macaddr( &pPeerInfo->ibssStaInfo[STAId].macAddrSTA, pmacAddrSTA); |
| 1469 | |
| 1470 | return VOS_STATUS_SUCCESS; |
| 1471 | } |
| 1472 | |
| 1473 | static VOS_STATUS hdd_ibss_RegisterSTA( hdd_adapter_t *pAdapter, |
| 1474 | tCsrRoamInfo *pRoamInfo, |
| 1475 | v_U8_t staId, |
| 1476 | v_MACADDR_t *pPeerMacAddress, |
| 1477 | tSirBssDescription *pBssDesc ) |
| 1478 | { |
| 1479 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 1480 | WLAN_STADescType staDesc = {0}; |
| 1481 | eCsrEncryptionType connectedCipherAlgo; |
| 1482 | v_BOOL_t fConnected; |
| 1483 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1484 | hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1485 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1486 | |
| 1487 | if ( pPeerInfo->ibssStaInfo[staId].isUsed ) |
| 1488 | { |
| 1489 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1490 | "clean up old entry for STA %d", staId); |
| 1491 | hdd_ibss_DeregisterSTA( pAdapter, staId ); |
| 1492 | } |
| 1493 | |
| 1494 | staDesc.ucSTAId = staId; |
| 1495 | staDesc.wSTAType = WLAN_STA_IBSS; |
| 1496 | |
| 1497 | // Note that for IBSS, the STA MAC address and BSSID are goign to be different where |
| 1498 | // in infrastructure, they are the same (BSSID is the MAC address of the AP). So, |
| 1499 | // for IBSS we have a second field to pass to TL in the STA descriptor that we don't |
| 1500 | // pass when making an Infrastructure connection. |
| 1501 | vos_mem_copy(staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes)); |
| 1502 | vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId, 6 ); |
| 1503 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 1504 | |
| 1505 | if (hdd_wmm_is_active(pAdapter)) |
| 1506 | { |
| 1507 | staDesc.ucQosEnabled = 1; |
| 1508 | } |
| 1509 | else |
| 1510 | { |
| 1511 | staDesc.ucQosEnabled = 0; |
| 1512 | } |
| 1513 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1514 | "HDD SOFTAP register TL QoS_enabled=%d", |
| 1515 | staDesc.ucQosEnabled ); |
| 1516 | |
| 1517 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 1518 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 1519 | { |
| 1520 | staDesc.ucProtectedFrame = 1; |
| 1521 | } |
| 1522 | else |
| 1523 | { |
| 1524 | staDesc.ucProtectedFrame = 0; |
| 1525 | |
| 1526 | } |
| 1527 | |
| 1528 | hdd_ibss_init_tx_rx_sta(pAdapter, staId, &staDesc.vSTAMACAddress); |
| 1529 | |
| 1530 | // UMA is Not ready yet, Xlation will be done by TL |
| 1531 | staDesc.ucSwFrameTXXlation = 1; |
| 1532 | staDesc.ucSwFrameRXXlation = 1; |
| 1533 | staDesc.ucAddRmvLLC = 1; |
| 1534 | // Initialize signatures and state |
| 1535 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 1536 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 1537 | staDesc.ucInitState = WLANTL_STA_AUTHENTICATED; |
| 1538 | |
| 1539 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
| 1540 | |
| 1541 | // Register the Station with TL. |
| 1542 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 1543 | hdd_rx_packet_cbk, |
| 1544 | hdd_tx_complete_cbk, |
| 1545 | hdd_ibss_tx_fetch_packet_cbk, &staDesc, |
| 1546 | pBssDesc->rssi ); |
| 1547 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1548 | { |
| 1549 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1550 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", |
| 1551 | vosStatus, vosStatus ); |
| 1552 | return vosStatus; |
| 1553 | } |
| 1554 | |
| 1555 | //Timer value should be in milliseconds |
| 1556 | if ( pHddCtx->cfg_ini->dynSplitscan && |
| 1557 | ( VOS_TIMER_STATE_RUNNING != |
| 1558 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))) |
| 1559 | { |
| 1560 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 1561 | pHddCtx->cfg_ini->trafficMntrTmrForSplitScan); |
| 1562 | } |
| 1563 | |
| 1564 | pPeerInfo->ibssStaInfo[staId].ucSTAId = staId; |
| 1565 | pPeerInfo->ibssStaInfo[staId].isQosEnabled = staDesc.ucQosEnabled; |
| 1566 | |
| 1567 | vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId, |
| 1568 | WLANTL_STA_AUTHENTICATED ); |
| 1569 | |
| 1570 | pPeerInfo->ibssStaInfo[staId].tlSTAState = WLANTL_STA_AUTHENTICATED; |
| 1571 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 1572 | |
| 1573 | return( vosStatus ); |
| 1574 | } |
| 1575 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1576 | /* TODO Revist this function. and data path */ |
| 1577 | static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 1578 | { |
| 1579 | VOS_STATUS vosStatus; |
Ravi Joshi | f9520d6 | 2013-10-18 04:11:46 -0700 | [diff] [blame] | 1580 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1581 | hdd_disconnect_tx_rx(pAdapter); |
Ravi Joshi | f9520d6 | 2013-10-18 04:11:46 -0700 | [diff] [blame] | 1582 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1583 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 1584 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1585 | { |
Gopichand Nakkala | d786fa3 | 2013-03-20 23:48:19 +0530 | [diff] [blame] | 1586 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1587 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1588 | "Status= %d [0x%08X]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1589 | __func__, staId, vosStatus, vosStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1590 | } |
| 1591 | return( vosStatus ); |
| 1592 | } |
| 1593 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 1594 | /** |
| 1595 | * hdd_print_bss_info() - print bss info |
| 1596 | * @hdd_sta_ctx: pointer to hdd station context |
| 1597 | * |
| 1598 | * Return: None |
| 1599 | */ |
| 1600 | void hdd_print_bss_info(hdd_station_ctx_t *hdd_sta_ctx) |
| 1601 | { |
| 1602 | uint32_t *cap_info; |
| 1603 | |
| 1604 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"WIFI DATA LOGGER"); |
| 1605 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"channel: %d", |
| 1606 | hdd_sta_ctx->conn_info.freq); |
| 1607 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"dot11mode: %d", |
| 1608 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1609 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"AKM: %d", |
| 1610 | hdd_sta_ctx->conn_info.authType); |
| 1611 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ssid: %.*s", |
| 1612 | hdd_sta_ctx->conn_info.SSID.SSID.length, |
| 1613 | hdd_sta_ctx->conn_info.SSID.SSID.ssId); |
| 1614 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"roam count: %d", |
| 1615 | hdd_sta_ctx->conn_info.roam_count); |
| 1616 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ant_info: %d", |
| 1617 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1618 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate legacy %d", |
| 1619 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1620 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate mcs: %d", |
| 1621 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1622 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1623 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1624 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ht caps: %x", |
| 1625 | *cap_info); |
| 1626 | } |
| 1627 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1628 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1629 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"vht caps: %x", |
| 1630 | *cap_info); |
| 1631 | } |
| 1632 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1633 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"hs20 info: %x", |
| 1634 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1635 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"signal: %d", |
| 1636 | hdd_sta_ctx->conn_info.signal); |
| 1637 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"noise: %d", |
| 1638 | hdd_sta_ctx->conn_info.noise); |
| 1639 | } |
| 1640 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1641 | /** |
| 1642 | * hdd_check_and_move_if_sap_is_on_dfs_chan() - move the sap to non dfs channel |
| 1643 | * @hdd_ctx: pointer to hdd context |
| 1644 | * @sta_adapter: pointer to sta adapater |
| 1645 | * |
| 1646 | * This function is used to check if SAP is operating on DFS channel in stand |
| 1647 | * alone mode and move it to non dfs channel |
| 1648 | * |
| 1649 | * Return: void. |
| 1650 | */ |
| 1651 | static void hdd_check_and_move_if_sap_is_on_dfs_chan(hdd_context_t *hdd_ctx, |
| 1652 | hdd_adapter_t *sta_adapter) |
| 1653 | { |
| 1654 | hdd_adapter_t *sap_adapter; |
| 1655 | ptSapContext sap_ctx; |
| 1656 | v_CONTEXT_t vos_ctx; |
| 1657 | eNVChannelEnabledType chan_state; |
| 1658 | |
| 1659 | if (hdd_is_sta_sap_scc_allowed_on_dfs_chan(hdd_ctx)) { |
| 1660 | sap_adapter = hdd_get_adapter(hdd_ctx, WLAN_HDD_SOFTAP); |
| 1661 | |
| 1662 | if (!sap_adapter) { |
| 1663 | hddLog(LOG1, FL("SAP not exists, nothing to do")); |
| 1664 | return; |
| 1665 | } |
| 1666 | |
| 1667 | vos_ctx = hdd_ctx->pvosContext; |
| 1668 | if (!vos_ctx) { |
| 1669 | hddLog(LOGE, FL("vos_ctx is NULL")); |
| 1670 | return; |
| 1671 | } |
| 1672 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 1673 | if (!sap_ctx) { |
| 1674 | hddLog(LOG1, FL("sap_ctx not exists")); |
| 1675 | return; |
| 1676 | } |
| 1677 | |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1678 | if (sap_ctx->sapsMachine != eSAP_STARTED) { |
| 1679 | hddLog(LOG1, FL("SAP is not in eSAP_STARTED state")); |
| 1680 | return; |
| 1681 | } |
| 1682 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1683 | chan_state = vos_nv_getChannelEnabledState(sap_ctx->channel); |
| 1684 | |
| 1685 | hddLog(LOG1, "SAP is operating on channel (%hu), chan_state %d", |
| 1686 | sap_ctx->channel, chan_state); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1687 | if (vos_nv_getChannelEnabledState(sap_ctx->channel) != |
| 1688 | NV_CHANNEL_DFS) { |
| 1689 | hddLog(LOG1, "SAP is on non DFS channel. nothing to do"); |
| 1690 | return; |
| 1691 | } |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1692 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1693 | hddLog(LOG1, "Schedule workqueue to move the SAP to non DFS channel"); |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1694 | schedule_delayed_work(&hdd_ctx->ecsa_chan_change_work, |
| 1695 | msecs_to_jiffies(ECSA_DFS_CHAN_CHANGE_DEFER_TIME)); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1696 | } |
| 1697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1698 | |
| 1699 | static eHalStatus hdd_DisConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1700 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 1701 | eCsrRoamResult roamResult ) |
| 1702 | { |
| 1703 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1704 | VOS_STATUS vstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1705 | struct net_device *dev = pAdapter->dev; |
| 1706 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1707 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1708 | v_U8_t sta_id; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1709 | v_BOOL_t sendDisconInd = TRUE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1710 | |
| 1711 | // Sanity check |
| 1712 | if(dev == NULL) |
| 1713 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 1714 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1715 | "%s: net_dev is released return", __func__); |
| 1716 | return eHAL_STATUS_FAILURE; |
| 1717 | } |
| 1718 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1719 | // notify apps that we can't pass traffic anymore |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 1720 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1721 | netif_tx_disable(dev); |
| 1722 | netif_carrier_off(dev); |
Mukul Sharma | 09ab4bd | 2014-11-24 18:07:26 +0530 | [diff] [blame] | 1723 | //TxTimeoutCount need to reset in case of disconnect handler |
| 1724 | pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1725 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 1726 | wlan_hdd_check_and_stop_mon(pAdapter, false); |
| 1727 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1728 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1729 | /* If only STA mode is on */ |
| 1730 | if((pHddCtx->concurrency_mode <= 1) && |
| 1731 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <= 1)) |
| 1732 | { |
| 1733 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 1734 | } |
| 1735 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1736 | /* Need to apply spin lock before decreasing active sessions |
| 1737 | * as there can be chance for double decrement if context switch |
| 1738 | * Calls wlan_hdd_disconnect. |
| 1739 | */ |
| 1740 | |
| 1741 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1742 | |
| 1743 | /* HDD has initiated disconnect, do not send disconnect indication |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1744 | * to kernel. Sending disconnected event to kernel for userspace |
| 1745 | * initiated disconnect will be handled by diconnect handler call |
| 1746 | * to cfg80211_disconnected |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1747 | */ |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1748 | if ((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) || |
Abhishek Singh | d2ce680 | 2018-05-08 15:21:06 +0530 | [diff] [blame] | 1749 | (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) || |
| 1750 | (eConnectionState_Connecting == pHddStaCtx->conn_info.connState)) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1751 | { |
| 1752 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1753 | FL(" HDD has initiated a disconnect, no need to send" |
| 1754 | " disconnect indication to kernel")); |
| 1755 | sendDisconInd = FALSE; |
| 1756 | } |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1757 | else if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1758 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1759 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1760 | FL("Set HDD connState to eConnectionState_Disconnecting from %d "), |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1761 | pHddStaCtx->conn_info.connState); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1762 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 1763 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1764 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1765 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 1766 | vos_flush_delayed_work(&pHddCtx->ecsa_chan_change_work); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1767 | hdd_clearRoamProfileIe( pAdapter ); |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 1768 | |
| 1769 | hdd_wmm_init( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1770 | |
| 1771 | // indicate 'disconnect' status to wpa_supplicant... |
| 1772 | hdd_SendAssociationEvent(dev,pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1773 | /* indicate disconnected event to nl80211 */ |
| 1774 | if(roamStatus != eCSR_ROAM_IBSS_LEAVE) |
| 1775 | { |
| 1776 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 1777 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 1778 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1779 | { |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 1780 | if (sendDisconInd) |
| 1781 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1782 | "%s: sent disconnected event to nl80211", |
| 1783 | __func__); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 1784 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 1785 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1786 | { |
| 1787 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTED_STATE_1) |
| 1788 | { |
| 1789 | globalP2PConnectionStatus = P2P_CLIENT_DISCONNECTED_STATE; |
| 1790 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] 8 way Handshake completed " |
| 1791 | "and moved to disconnected state"); |
| 1792 | } |
| 1793 | else if(globalP2PConnectionStatus == P2P_CLIENT_COMPLETED_STATE) |
| 1794 | { |
| 1795 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 1796 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] P2P Client is removed " |
| 1797 | "and moved to inactive state"); |
| 1798 | } |
| 1799 | } |
| 1800 | #endif |
Sushant Kaushik | bad6189 | 2015-07-10 16:43:28 +0530 | [diff] [blame] | 1801 | if ((roamStatus == eCSR_ROAM_LOSTLINK) && |
| 1802 | !pRoamInfo->reasonCode) |
| 1803 | wlan_hdd_get_frame_logs(pAdapter, |
| 1804 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1805 | /*Only send indication to kernel if not initiated by kernel*/ |
| 1806 | if ( sendDisconInd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1807 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1808 | /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */ |
| 1809 | if ( eCSR_ROAM_LOSTLINK == roamStatus ) |
| 1810 | { |
Mahesh A Saptasagar | 9ff4bcc | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 1811 | wlan_hdd_cfg80211_indicate_disconnect(dev, false, |
| 1812 | pRoamInfo->reasonCode); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1813 | } |
| 1814 | else |
| 1815 | { |
Mahesh A Saptasagar | 9ff4bcc | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 1816 | wlan_hdd_cfg80211_indicate_disconnect(dev, false, |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1817 | WLAN_REASON_UNSPECIFIED); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1819 | } |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 1820 | |
| 1821 | if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1822 | { |
| 1823 | hddLog(LOG1, |
| 1824 | FL("P2P client is getting removed and we are tryig to re-enable TDLS")); |
| 1825 | wlan_hdd_tdls_reenable(pHddCtx); |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 1826 | } |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 1827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1828 | //If the Device Mode is Station |
| 1829 | // and the P2P Client is Connected |
| 1830 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1831 | |
| 1832 | // In case of JB, as Change-Iface may or maynot be called for p2p0 |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1833 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Sudhir Sattayappa Kohalli | b1d8c3a | 2013-06-18 14:47:20 -0700 | [diff] [blame] | 1834 | if(VOS_STATUS_SUCCESS == hdd_issta_p2p_clientconnected(pHddCtx)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1835 | { |
| 1836 | //Enable BMPS only of other Session is P2P Client |
| 1837 | hdd_context_t *pHddCtx = NULL; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1838 | v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1839 | |
| 1840 | if (NULL != pVosContext) |
| 1841 | { |
| 1842 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 1843 | |
| 1844 | if(NULL != pHddCtx) |
| 1845 | { |
| 1846 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1847 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 1848 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1849 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1850 | if (pHddCtx->hdd_wlan_suspended) |
| 1851 | { |
| 1852 | hdd_set_pwrparams(pHddCtx); |
| 1853 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1854 | hdd_enable_bmps_imps(pHddCtx); |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1855 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1856 | } |
| 1857 | } |
| 1858 | } |
| 1859 | } |
| 1860 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1861 | |
Madan Mohan Koyyalamudi | 70c52d3 | 2013-08-07 14:42:16 +0530 | [diff] [blame] | 1862 | hdd_wmm_adapter_clear(pAdapter); |
Kapil Gupta | e686748 | 2016-06-26 13:31:37 +0530 | [diff] [blame] | 1863 | /* Clear PER based roam stats */ |
| 1864 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1865 | if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) && |
| 1866 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 1867 | pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled && |
| 1868 | pHddCtx->cfg_ini->isPERRoamRxPathEnabled) |
| 1869 | sme_unset_per_roam_rxconfig(pHddCtx->hHal); |
| 1870 | #endif |
Mukul Sharma | c159c43 | 2014-01-15 15:42:46 +0530 | [diff] [blame] | 1871 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 1872 | sme_FTReset(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
| 1873 | #endif |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1874 | |
| 1875 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) |
| 1876 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1877 | v_U8_t i; |
| 1878 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1879 | sta_id = IBSS_BROADCAST_STAID; |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1880 | vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id ); |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1881 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1882 | { |
| 1883 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1884 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1885 | "Status= %d [0x%x]"), |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1886 | sta_id, status, status ); |
| 1887 | |
| 1888 | status = eHAL_STATUS_FAILURE; |
| 1889 | } |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1890 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1891 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1892 | /*Clear all the peer sta register with TL.*/ |
| 1893 | for (i =0; i < HDD_MAX_NUM_IBSS_STA; i++ ) |
| 1894 | { |
| 1895 | if (0 != pHddStaCtx->conn_info.staId[i]) |
| 1896 | { |
| 1897 | sta_id = pHddStaCtx->conn_info.staId[i]; |
| 1898 | |
| 1899 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1900 | FL("Deregister StaID %d"),sta_id); |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1901 | vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id ); |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1902 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1903 | { |
| 1904 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1905 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1906 | "Status= %d [0x%x]"), |
| 1907 | sta_id, status, status ); |
| 1908 | status = eHAL_STATUS_FAILURE; |
| 1909 | } |
| 1910 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 1911 | vstatus = hdd_sta_id_hash_remove_entry(pAdapter, |
| 1912 | sta_id, &pHddStaCtx->conn_info.peerMacAddress[i]); |
| 1913 | if (vstatus != VOS_STATUS_SUCCESS) { |
| 1914 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1915 | FL("Not able to remove staid hash %d"), |
| 1916 | sta_id); |
| 1917 | status = eHAL_STATUS_FAILURE; |
| 1918 | } else { |
| 1919 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1920 | FL("ibss station removed sta_id %d mac:" |
| 1921 | MAC_ADDRESS_STR), sta_id, |
| 1922 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[i].bytes)); |
| 1923 | } |
| 1924 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1925 | /*set the staid and peer mac as 0, all other reset are |
| 1926 | * done in hdd_connRemoveConnectInfo. |
| 1927 | */ |
| 1928 | pHddStaCtx->conn_info.staId[i]= 0; |
| 1929 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[i], sizeof( v_MACADDR_t ) ); |
| 1930 | |
| 1931 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1932 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1933 | } |
| 1934 | } |
| 1935 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1936 | } |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1937 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1938 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1939 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 1940 | /* clear scan cache for Link Lost */ |
| 1941 | if (pRoamInfo && !pRoamInfo->reasonCode && |
| 1942 | (eCSR_ROAM_LOSTLINK == roamStatus)) { |
Abhishek Singh | e6137b8 | 2019-03-22 20:06:09 +0530 | [diff] [blame] | 1943 | wlan_hdd_cfg80211_unlink_bss(pAdapter, |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 1944 | pHddStaCtx->conn_info.bssId); |
| 1945 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1946 | pHddStaCtx->conn_info.bssId); |
| 1947 | } |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1948 | |
| 1949 | //We should clear all sta register with TL, for now, only one. |
| 1950 | vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id ); |
| 1951 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1952 | { |
| 1953 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1954 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1955 | "Status= %d [0x%x]"), |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1956 | sta_id, status, status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1957 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1958 | status = eHAL_STATUS_FAILURE; |
| 1959 | } |
| 1960 | |
| 1961 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1962 | } |
Srinivas Dasari | deb7ae9 | 2014-12-19 15:26:40 +0530 | [diff] [blame] | 1963 | |
| 1964 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 1965 | if (VOS_STATUS_SUCCESS != |
| 1966 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1967 | pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE_AC)) |
| 1968 | { |
| 1969 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1970 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1971 | } |
| 1972 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1973 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1974 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1975 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1976 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Sravan Kumar Kairam | f9f9512 | 2017-01-18 20:54:05 +0530 | [diff] [blame] | 1977 | pAdapter->dad = false; |
Srinivas Dasari | deb7ae9 | 2014-12-19 15:26:40 +0530 | [diff] [blame] | 1978 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1979 | // Clear saved connection information in HDD |
| 1980 | hdd_connRemoveConnectInfo( pHddStaCtx ); |
Abhishek Singh | d2ce680 | 2018-05-08 15:21:06 +0530 | [diff] [blame] | 1981 | |
| 1982 | /* |
| 1983 | * eConnectionState_Connecting state mean that connection is in progress so |
| 1984 | * no need to set state to eConnectionState_NotConnected |
| 1985 | */ |
| 1986 | if ((eConnectionState_Connecting != pHddStaCtx->conn_info.connState)) { |
| 1987 | hddLog(LOG1, FL("Set HDD connState to eConnectionState_NotConnected")); |
| 1988 | hdd_connSetConnectionState(pHddStaCtx, eConnectionState_NotConnected); |
| 1989 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1990 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 1991 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1992 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 1993 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1994 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 1995 | sizeof (tSirGtkOffloadParams)); |
| 1996 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1997 | } |
| 1998 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1999 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2000 | #ifdef FEATURE_WLAN_TDLS |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 2001 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 2002 | { |
| 2003 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 2004 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2005 | #endif |
| 2006 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2007 | //Unblock anyone waiting for disconnect to complete |
| 2008 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2009 | hdd_print_bss_info(pHddStaCtx); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 2010 | |
| 2011 | hdd_check_and_move_if_sap_is_on_dfs_chan(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2012 | return( status ); |
| 2013 | } |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2014 | |
| 2015 | static void hdd_postTLPacketPendingInd(hdd_adapter_t *pAdapter, |
| 2016 | v_U8_t staId) |
| 2017 | { |
| 2018 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2019 | v_SINT_t i; |
| 2020 | v_SIZE_t size; |
| 2021 | VOS_STATUS status; |
| 2022 | v_BOOL_t granted = VOS_FALSE; |
| 2023 | |
| 2024 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 2025 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) || |
| 2026 | (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE)) |
| 2027 | { |
| 2028 | //Indicate to TL that there is pending data if a queue is non empty |
| 2029 | for (i = WLANTL_AC_HIGH_PRIO; i>=0; --i) |
| 2030 | { |
| 2031 | size = 0; |
| 2032 | hdd_list_size(&pAdapter->wmm_tx_queue[i], &size); |
| 2033 | if (size > 0) |
| 2034 | { |
| 2035 | if (i != WLANTL_AC_HIGH_PRIO) |
| 2036 | { |
| 2037 | if (VOS_FALSE == |
| 2038 | pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessAllowed) |
| 2039 | { |
| 2040 | hdd_wmm_acquire_access(pAdapter, |
| 2041 | (WLANTL_ACEnumType)i, &granted); |
| 2042 | pAdapter->psbChanged |= (1 << i); |
| 2043 | } |
| 2044 | else |
| 2045 | granted = VOS_TRUE; |
| 2046 | } |
| 2047 | |
| 2048 | if (granted || (i == WLANTL_AC_HIGH_PRIO)) |
| 2049 | { |
| 2050 | status = WLANTL_STAPktPending(pHddCtx->pvosContext, |
| 2051 | staId, (WLANTL_ACEnumType)i); |
| 2052 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 2053 | { |
| 2054 | VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2055 | "%s: Failure in indicating pkt to TL for QID=%d", |
| 2056 | __func__, i); |
| 2057 | } |
| 2058 | } |
| 2059 | } |
| 2060 | } |
| 2061 | } |
| 2062 | } |
| 2063 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2064 | static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter, |
| 2065 | tCsrRoamInfo *pRoamInfo, |
| 2066 | v_U8_t staId, |
| 2067 | v_MACADDR_t *pPeerMacAddress, |
| 2068 | tSirBssDescription *pBssDesc ) |
| 2069 | { |
| 2070 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 2071 | WLAN_STADescType staDesc = {0}; |
| 2072 | eCsrEncryptionType connectedCipherAlgo; |
| 2073 | v_BOOL_t fConnected; |
| 2074 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2075 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2076 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2077 | |
| 2078 | if ( NULL == pBssDesc) |
| 2079 | { |
| 2080 | return VOS_STATUS_E_FAILURE; |
| 2081 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2082 | // Get the Station ID from the one saved during the assocation. |
| 2083 | staDesc.ucSTAId = staId; |
| 2084 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2085 | staDesc.wSTAType = WLAN_STA_INFRA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2086 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2087 | // grab the bssid from the connection info in the adapter structure and hand that |
| 2088 | // over to TL when registering. |
| 2089 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId, |
| 2090 | sizeof(pHddStaCtx->conn_info.bssId) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2091 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2092 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 2093 | |
| 2094 | // set the QoS field appropriately |
| 2095 | if (hdd_wmm_is_active(pAdapter)) |
| 2096 | { |
| 2097 | staDesc.ucQosEnabled = 1; |
| 2098 | } |
| 2099 | else |
| 2100 | { |
| 2101 | staDesc.ucQosEnabled = 0; |
| 2102 | } |
| 2103 | |
| 2104 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 2105 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 2106 | { |
| 2107 | staDesc.ucProtectedFrame = 1; |
| 2108 | } |
| 2109 | else |
| 2110 | { |
| 2111 | staDesc.ucProtectedFrame = 0; |
| 2112 | |
| 2113 | } |
| 2114 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2115 | #ifdef FEATURE_WLAN_ESE |
| 2116 | staDesc.ucIsEseSta = pRoamInfo->isESEAssoc; |
| 2117 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2118 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2119 | /* check whether replay check is valid for the station or not */ |
| 2120 | if( (eCSR_ENCRYPT_TYPE_TKIP == connectedCipherAlgo) || (eCSR_ENCRYPT_TYPE_AES == connectedCipherAlgo)) |
| 2121 | { |
| 2122 | /* Encryption mode is either TKIP or AES |
| 2123 | and replay check is valid for only these |
| 2124 | two encryption modes */ |
| 2125 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 2126 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2127 | "HDD register TL ucIsReplayCheckValid %d: Replay check is needed for station", staDesc.ucIsReplayCheckValid); |
| 2128 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2129 | else |
| 2130 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2131 | /* For other encryption modes replay check is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2132 | not needed */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2133 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2134 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2135 | "HDD register TL ucIsReplayCheckValid %d", staDesc.ucIsReplayCheckValid); |
| 2136 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2137 | |
| 2138 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2139 | hddLog(LOG1, "%s: WAPI STA Registered: %d", __func__, pAdapter->wapi_info.fIsWapiSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2140 | if (pAdapter->wapi_info.fIsWapiSta) |
| 2141 | { |
| 2142 | staDesc.ucIsWapiSta = 1; |
| 2143 | } |
| 2144 | else |
| 2145 | { |
| 2146 | staDesc.ucIsWapiSta = 0; |
| 2147 | } |
| 2148 | #endif /* FEATURE_WLAN_WAPI */ |
| 2149 | |
| 2150 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 2151 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
| 2152 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2153 | // UMA is Not ready yet, Xlation will be done by TL |
| 2154 | staDesc.ucSwFrameTXXlation = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2155 | staDesc.ucSwFrameRXXlation = 1; |
| 2156 | staDesc.ucAddRmvLLC = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2157 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "HDD register TL QoS_enabled=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2158 | staDesc.ucQosEnabled ); |
| 2159 | // Initialize signatures and state |
| 2160 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 2161 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 2162 | staDesc.ucInitState = pRoamInfo->fAuthRequired ? |
| 2163 | WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2164 | // Register the Station with TL... |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 2165 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "%s: HDD register TL ucInitState=%d", __func__, staDesc.ucInitState ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2166 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 2167 | hdd_rx_packet_cbk, |
| 2168 | hdd_tx_complete_cbk, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2169 | hdd_tx_fetch_packet_cbk, &staDesc, |
| 2170 | pBssDesc->rssi ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2171 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2172 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2173 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2174 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2175 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2176 | vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2177 | return vosStatus; |
| 2178 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2179 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2180 | if ( cfg_param->dynSplitscan && |
| 2181 | ( VOS_TIMER_STATE_RUNNING != |
| 2182 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))) |
| 2183 | { |
| 2184 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 2185 | cfg_param->trafficMntrTmrForSplitScan); |
| 2186 | } |
| 2187 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2188 | // if (WPA), tell TL to go to 'connected' and after keys come to the driver, |
| 2189 | // then go to 'authenticated'. For all other authentication types |
| 2190 | // (those that donot require upper layer authentication) we can put |
| 2191 | // TL directly into 'authenticated' state. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2192 | if (staDesc.wSTAType != WLAN_STA_IBSS) |
| 2193 | VOS_ASSERT( fConnected ); |
| 2194 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2195 | if ( !pRoamInfo->fAuthRequired ) |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2196 | { |
| 2197 | // Connections that do not need Upper layer auth, transition TL directly |
| 2198 | // to 'Authenticated' state. |
| 2199 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
| 2200 | WLANTL_STA_AUTHENTICATED ); |
| 2201 | |
| 2202 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2203 | |
| 2204 | hdd_postTLPacketPendingInd(pAdapter, staDesc.ucSTAId); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2205 | } |
| 2206 | else |
| 2207 | { |
| 2208 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2209 | "ULA auth StaId= %d. Changing TL state to CONNECTED" |
| 2210 | "at Join time", pHddStaCtx->conn_info.staId[0] ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2211 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 2212 | WLANTL_STA_CONNECTED ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2213 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 2214 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2215 | return( vosStatus ); |
| 2216 | } |
| 2217 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2218 | static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 2219 | tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength) |
| 2220 | { |
| 2221 | unsigned int len = 0; |
| 2222 | u8 *pFTAssocRsp = NULL; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2223 | v_U8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2224 | tANI_U32 rspRsnLength = 0; |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2225 | struct cfg80211_bss* bss; |
| 2226 | tCsrRoamConnectedProfile roam_profile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2227 | struct ieee80211_channel *chan; |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2228 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2229 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2230 | if (!rspRsnIe) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2231 | hddLog(LOGE, "%s: Unable to allocate RSN IE", __func__); |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 2232 | return; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2233 | } |
| 2234 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2235 | if (pCsrRoamInfo == NULL) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2236 | hddLog(LOGE, "%s: Invalid CSR roam info", __func__); |
| 2237 | goto done; |
| 2238 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2239 | |
Ashish Kumar Dhanotiya | 7b48fd9 | 2020-02-11 18:14:46 +0530 | [diff] [blame] | 2240 | if (pCsrRoamInfo->nAssocRspLength < FT_ASSOC_RSP_IES_OFFSET) { |
| 2241 | |
| 2242 | hddLog(LOGE, "%s: Invalid assoc response length %d", |
| 2243 | __func__, pCsrRoamInfo->nAssocRspLength); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2244 | goto done; |
| 2245 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2246 | |
| 2247 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2248 | pCsrRoamInfo->nAssocReqLength); |
| 2249 | if (pFTAssocRsp == NULL) |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2250 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2251 | |
| 2252 | //pFTAssocRsp needs to point to the IEs |
| 2253 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2254 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2255 | (unsigned int)pFTAssocRsp[0], |
| 2256 | (unsigned int)pFTAssocRsp[1]); |
| 2257 | |
| 2258 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
Madan Mohan Koyyalamudi | 1bed23d | 2012-11-13 10:59:48 -0800 | [diff] [blame] | 2259 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Ashish Kumar Dhanotiya | 7b48fd9 | 2020-02-11 18:14:46 +0530 | [diff] [blame] | 2260 | if (len > IW_GENERIC_IE_MAX) { |
| 2261 | hddLog(LOGE, "%s: Invalid assoc response length %d", |
| 2262 | __func__, pCsrRoamInfo->nAssocRspLength); |
| 2263 | goto done; |
| 2264 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2265 | rspRsnLength = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2266 | memcpy(rspRsnIe, pFTAssocRsp, len); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2267 | memset(rspRsnIe + len, 0, IW_GENERIC_IE_MAX - len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2268 | |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2269 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
| 2270 | (int) pCsrRoamInfo->pBssDesc->channelId); |
| 2271 | vos_mem_zero(&roam_profile, sizeof(tCsrRoamConnectedProfile)); |
| 2272 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roam_profile); |
| 2273 | bss = hdd_get_bss_entry(pAdapter->wdev.wiphy, |
| 2274 | chan, pCsrRoamInfo->bssid, |
| 2275 | &roam_profile.SSID.ssId[0], |
| 2276 | roam_profile.SSID.length); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2277 | hdd_send_roamed_ind(dev, bss, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2278 | reqRsnIe, reqRsnLength, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2279 | rspRsnIe, rspRsnLength); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2280 | |
| 2281 | done: |
| 2282 | kfree(rspRsnIe); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2283 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2284 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 2285 | void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter) |
| 2286 | { |
| 2287 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 2288 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2289 | tCsrRoamInfo roamInfo; |
| 2290 | roamInfo.fAuthRequired = FALSE; |
| 2291 | vos_mem_copy(roamInfo.bssid, |
| 2292 | pHddStaCtx->roam_info.bssid, |
| 2293 | WNI_CFG_BSSID_LEN); |
| 2294 | vos_mem_copy(roamInfo.peerMac, |
| 2295 | pHddStaCtx->roam_info.peerMac, |
| 2296 | WNI_CFG_BSSID_LEN); |
| 2297 | |
| 2298 | halStatus = hdd_RoamSetKeyCompleteHandler(pAdapter, |
| 2299 | &roamInfo, |
| 2300 | pHddStaCtx->roam_info.roamId, |
| 2301 | pHddStaCtx->roam_info.roamStatus, |
| 2302 | eCSR_ROAM_RESULT_AUTHENTICATED); |
| 2303 | if (halStatus != eHAL_STATUS_SUCCESS) |
| 2304 | { |
| 2305 | hddLog(LOGE, "%s: Set Key complete failure", __func__); |
| 2306 | } |
| 2307 | pHddStaCtx->roam_info.deferKeyComplete = FALSE; |
| 2308 | } |
| 2309 | |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2310 | /** |
| 2311 | * hdd_schedule_ecsa_chan_change_work() - schedule ecsa chan change work |
| 2312 | * @hal: hal context |
| 2313 | * @sta_session_id: sta session id |
| 2314 | * |
| 2315 | * Return: void. |
| 2316 | */ |
| 2317 | static void |
| 2318 | hdd_schedule_ecsa_chan_change_work(hdd_context_t *hdd_ctx, |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 2319 | uint8_t sta_session_id) |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2320 | { |
| 2321 | v_TIME_t conn_start_time; |
| 2322 | int32_t time_diff; |
| 2323 | |
| 2324 | conn_start_time = sme_get_connect_strt_time(hdd_ctx->hHal, sta_session_id); |
| 2325 | time_diff = vos_timer_get_system_time() - conn_start_time; |
| 2326 | |
| 2327 | if (time_diff < 0) |
| 2328 | time_diff = ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL; |
| 2329 | else if (time_diff > ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL) |
| 2330 | time_diff = 0; |
| 2331 | else |
| 2332 | time_diff = ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL - time_diff; |
| 2333 | |
| 2334 | hddLog(LOG1, FL("schedule ecsa_chan_change_work after %d ms"), time_diff); |
| 2335 | schedule_delayed_work(&hdd_ctx->ecsa_chan_change_work, |
| 2336 | msecs_to_jiffies(time_diff)); |
| 2337 | } |
| 2338 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2339 | static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 2340 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2341 | eCsrRoamResult roamResult ) |
| 2342 | { |
| 2343 | struct net_device *dev = pAdapter->dev; |
| 2344 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2345 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2346 | hdd_adapter_t *pHostapdAdapter = NULL; |
Girish Gowli | 257a7e6 | 2014-08-02 15:50:43 +0530 | [diff] [blame] | 2347 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 2348 | v_U8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2349 | tANI_U32 reqRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2350 | #if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) || defined (WLAN_FEATURE_VOWIFI_11R) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2351 | int ft_carrier_on = FALSE; |
| 2352 | #endif |
| 2353 | int status; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2354 | v_BOOL_t hddDisconInProgress = FALSE; |
| 2355 | |
| 2356 | /* HDD has initiated disconnect, do not send connect result indication |
| 2357 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2358 | */ |
Agarwal Ashish | c089cec | 2015-08-10 13:10:04 +0530 | [diff] [blame] | 2359 | if (((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) || |
| 2360 | (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState)) && |
| 2361 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2362 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2363 | { |
| 2364 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2365 | FL(" Disconnect from HDD in progress ")); |
| 2366 | hddDisconInProgress = TRUE; |
| 2367 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2369 | if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult ) |
| 2370 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2371 | if ( !hddDisconInProgress ) |
| 2372 | { |
| 2373 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2374 | "%s: Set HDD connState to eConnectionState_Associated", |
| 2375 | __func__); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2376 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Associated ); |
| 2377 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2378 | |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 2379 | pAdapter->maxRateFlags = pRoamInfo->maxRateFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2380 | // Save the connection info from CSR... |
| 2381 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE ); |
Kapil Gupta | e686748 | 2016-06-26 13:31:37 +0530 | [diff] [blame] | 2382 | |
| 2383 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 2384 | if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) && |
| 2385 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 2386 | !hddDisconInProgress && |
| 2387 | pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled && |
| 2388 | pHddCtx->cfg_ini->isPERRoamRxPathEnabled) |
| 2389 | sme_set_per_roam_rxconfig(pHddCtx->hHal, |
| 2390 | pHddStaCtx->conn_info.staId[0], |
| 2391 | pHddCtx->cfg_ini->rateDownThreshold, |
| 2392 | pHddCtx->cfg_ini->rateUpThreshold, |
| 2393 | pHddCtx->cfg_ini->PERroamTriggerPercent, |
| 2394 | pHddCtx->cfg_ini->PERroamRxPktsThreshold, |
| 2395 | pHddCtx->cfg_ini->waitPeriodForNextPERScan); |
| 2396 | #endif |
| 2397 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2398 | #ifdef FEATURE_WLAN_WAPI |
| 2399 | if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE || |
| 2400 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK ) |
| 2401 | { |
| 2402 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2403 | } |
| 2404 | else |
| 2405 | { |
| 2406 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2407 | } |
| 2408 | #endif /* FEATURE_WLAN_WAPI */ |
| 2409 | |
| 2410 | // indicate 'connect' status to userspace |
| 2411 | hdd_SendAssociationEvent(dev,pRoamInfo); |
| 2412 | |
| 2413 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2414 | // Initialize the Linkup event completion variable |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2415 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2416 | |
| 2417 | /* |
| 2418 | Sometimes Switching ON the Carrier is taking time to activate the device properly. Before allowing any |
| 2419 | packet to go up to the application, device activation has to be ensured for proper queue mapping by the |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2420 | kernel. we have registered net device notifier for device change notification. With this we will come to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2421 | know that the device is getting activated properly. |
| 2422 | */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2423 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 2424 | if (pHddStaCtx->ft_carrier_on == FALSE && !hddDisconInProgress ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2425 | { |
| 2426 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2427 | // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2428 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 2429 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2430 | // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2431 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 2432 | |
| 2433 | // Switch on the Carrier to activate the device |
| 2434 | netif_carrier_on(dev); |
| 2435 | |
| 2436 | // Wait for the Link to up to ensure all the queues are set properly by the kernel |
| 2437 | status = wait_for_completion_interruptible_timeout(&pAdapter->linkup_event_var, |
| 2438 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2439 | if(!status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2440 | { |
| 2441 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning:ASSOC_LINKUP_TIMEOUT", __func__); |
| 2442 | } |
| 2443 | |
| 2444 | // Disable Linkup Event Servicing - no more service required from the net device notifier call |
| 2445 | pAdapter->isLinkUpSvcNeeded = FALSE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2446 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2447 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2448 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2449 | pHddStaCtx->ft_carrier_on = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2450 | ft_carrier_on = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2451 | } |
| 2452 | #endif |
Sandeep Puligilla | d91dccb | 2014-06-18 11:51:48 +0530 | [diff] [blame] | 2453 | /* Check for STAID */ |
| 2454 | if( (WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId ) |
| 2455 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2456 | else |
| 2457 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Wrong Staid: %d", __func__, pRoamInfo->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2458 | |
| 2459 | //For reassoc, the station is already registered, all we need is to change the state |
| 2460 | //of the STA in TL. |
| 2461 | //If authentication is required (WPA/WPA2/DWEP), change TL to CONNECTED instead of AUTHENTICATED |
Mukul Sharma | 5b2ff50 | 2014-11-06 14:43:50 +0530 | [diff] [blame] | 2462 | //pRoamInfo->fReassocReq will be set only for the reassoc to same ap |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2463 | if( !pRoamInfo->fReassocReq ) |
| 2464 | { |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2465 | struct cfg80211_bss *bss; |
| 2466 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2467 | u8 *pFTAssocRsp = NULL; |
| 2468 | unsigned int assocRsplen = 0; |
| 2469 | u8 *pFTAssocReq = NULL; |
| 2470 | unsigned int assocReqlen = 0; |
| 2471 | struct ieee80211_channel *chan; |
| 2472 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2473 | v_U8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2474 | tANI_U32 rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2475 | |
| 2476 | /* add bss_id to cfg80211 data base */ |
| 2477 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 2478 | if (NULL == bss) |
| 2479 | { |
Abhishek Singh | 7ca68f3 | 2016-06-28 10:23:10 +0530 | [diff] [blame] | 2480 | hddLog(LOGE, |
| 2481 | FL("Not able to create BSS entry")); |
Katya Nigam | 346d4e9 | 2014-09-02 16:16:12 +0530 | [diff] [blame] | 2482 | netif_carrier_off(dev); |
Abhishek Singh | 7ca68f3 | 2016-06-28 10:23:10 +0530 | [diff] [blame] | 2483 | if (!hddDisconInProgress) { |
| 2484 | /* |
| 2485 | * Here driver was not able to update cfg80211 database |
| 2486 | * this can happen if connected channel is not valid, |
| 2487 | * i.e reg domain was changed during connection. |
| 2488 | * Queue disconnect for the session if disconnect is |
| 2489 | * not in progress. |
| 2490 | */ |
| 2491 | hddLog(LOGE, FL("Disconnecting...")); |
| 2492 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2493 | pAdapter->sessionId, |
| 2494 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2495 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2496 | return eHAL_STATUS_FAILURE; |
| 2497 | } |
Abhinav Kumar | 4cde829 | 2019-07-18 14:17:25 +0530 | [diff] [blame] | 2498 | |
| 2499 | //Association Response |
| 2500 | pFTAssocRsp = (u8 *)(pRoamInfo->pbFrames + |
| 2501 | pRoamInfo->nBeaconLength + |
| 2502 | pRoamInfo->nAssocReqLength); |
| 2503 | if (pFTAssocRsp != NULL) |
| 2504 | { |
| 2505 | // pFTAssocRsp needs to point to the IEs |
| 2506 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 2507 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 2508 | (unsigned int)pFTAssocRsp[0], |
| 2509 | (unsigned int)pFTAssocRsp[1]); |
| 2510 | assocRsplen = |
| 2511 | pRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2512 | } |
| 2513 | else |
| 2514 | { |
| 2515 | hddLog(LOGE, "%s:AssocRsp is NULL", __func__); |
| 2516 | assocRsplen = 0; |
| 2517 | } |
| 2518 | |
| 2519 | //Association Request |
| 2520 | pFTAssocReq = (u8 *)(pRoamInfo->pbFrames + |
| 2521 | pRoamInfo->nBeaconLength); |
| 2522 | if (pFTAssocReq != NULL) |
| 2523 | { |
| 2524 | if(!ft_carrier_on) |
| 2525 | { |
| 2526 | // pFTAssocReq needs to point to the IEs |
| 2527 | pFTAssocReq += FT_ASSOC_REQ_IES_OFFSET; |
| 2528 | hddLog(LOG1, "%s: pFTAssocReq is now at %02x%02x", __func__, |
| 2529 | (unsigned int)pFTAssocReq[0], |
| 2530 | (unsigned int)pFTAssocReq[1]); |
| 2531 | assocReqlen = |
| 2532 | pRoamInfo->nAssocReqLength - FT_ASSOC_REQ_IES_OFFSET; |
| 2533 | } |
| 2534 | else |
| 2535 | { |
| 2536 | /* This should contain only the FTIEs */ |
| 2537 | assocReqlen = pRoamInfo->nAssocReqLength; |
| 2538 | } |
| 2539 | } |
| 2540 | else |
| 2541 | { |
| 2542 | hddLog(LOGE, "%s:AssocReq is NULL", __func__); |
| 2543 | assocReqlen = 0; |
| 2544 | } |
| 2545 | |
| 2546 | hddLog(LOG1, "assocReqlen %d assocRsplen %d", assocReqlen, |
| 2547 | assocRsplen); |
| 2548 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2549 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2550 | if(pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN || |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2551 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN_PSK ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2552 | { |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2553 | if(ft_carrier_on) |
| 2554 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2555 | if ( !hddDisconInProgress ) |
| 2556 | { |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2557 | struct cfg80211_bss *roam_bss; |
| 2558 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2559 | hddLog(LOG1, "%s ft_carrier_on is %d, sending roamed " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2560 | "indication", __FUNCTION__, ft_carrier_on); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2561 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2562 | (int)pRoamInfo->pBssDesc->channelId); |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2563 | if (pHddCtx->cfg_ini && |
| 2564 | pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2565 | { |
| 2566 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 2567 | } |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2568 | roam_bss = hdd_get_bss_entry(pAdapter->wdev.wiphy, |
| 2569 | chan, pRoamInfo->bssid, |
| 2570 | pRoamInfo->u.pConnectedProfile->SSID.ssId, |
| 2571 | pRoamInfo->u.pConnectedProfile->SSID.length); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2572 | hdd_send_roamed_ind(dev, roam_bss, |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2573 | pFTAssocReq, assocReqlen, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2574 | pFTAssocRsp, assocRsplen); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2575 | } |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 2576 | if (sme_GetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 2577 | { |
| 2578 | sme_SetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter), FALSE); |
| 2579 | pRoamInfo->fAuthRequired = FALSE; |
| 2580 | |
| 2581 | vos_mem_copy(pHddStaCtx->roam_info.bssid, |
| 2582 | pRoamInfo->bssid, |
| 2583 | HDD_MAC_ADDR_LEN); |
| 2584 | vos_mem_copy(pHddStaCtx->roam_info.peerMac, |
| 2585 | pRoamInfo->peerMac, |
| 2586 | HDD_MAC_ADDR_LEN); |
| 2587 | pHddStaCtx->roam_info.roamId = roamId; |
| 2588 | pHddStaCtx->roam_info.roamStatus = roamStatus; |
| 2589 | pHddStaCtx->roam_info.deferKeyComplete = TRUE; |
| 2590 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2591 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2592 | else if ( !hddDisconInProgress ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2593 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2594 | hddLog(LOG1, "%s ft_carrier_on is %d, sending connect " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2595 | "indication", __FUNCTION__, ft_carrier_on); |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2596 | hdd_connect_result(dev, pRoamInfo->bssid, pRoamInfo, |
| 2597 | pFTAssocReq, assocReqlen, |
| 2598 | pFTAssocRsp, assocRsplen, |
| 2599 | WLAN_STATUS_SUCCESS, |
| 2600 | GFP_KERNEL); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2601 | } |
| 2602 | } |
| 2603 | else |
| 2604 | #endif |
| 2605 | { |
| 2606 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 2607 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2608 | pAdapter->sessionId, |
| 2609 | &reqRsnLength, |
| 2610 | reqRsnIe); |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2611 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2612 | csrRoamGetWpaRsnRspIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2613 | pAdapter->sessionId, |
| 2614 | &rspRsnLength, |
| 2615 | rspRsnIe); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2616 | if ( !hddDisconInProgress ) |
| 2617 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2618 | #if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2619 | if(ft_carrier_on) |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2620 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2621 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2622 | if (pHddCtx->cfg_ini && |
| 2623 | pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2624 | { |
| 2625 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 2626 | } |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2627 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2628 | else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2629 | #endif /* FEATURE_WLAN_ESE */ |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2630 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2631 | { |
| 2632 | hddLog(VOS_TRACE_LEVEL_INFO, |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2633 | "%s: sending connect indication to nl80211:" |
| 2634 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2635 | " result:%d and Status:%d", |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2636 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
| 2637 | roamResult, roamStatus); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2638 | /* inform connect result to nl80211 */ |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2639 | hdd_connect_result(dev, pRoamInfo->bssid, |
| 2640 | pRoamInfo, |
Abhinav Kumar | 4cde829 | 2019-07-18 14:17:25 +0530 | [diff] [blame] | 2641 | pFTAssocReq, assocReqlen, |
| 2642 | pFTAssocRsp, assocRsplen, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2643 | WLAN_STATUS_SUCCESS, |
| 2644 | GFP_KERNEL); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2645 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2646 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2647 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2648 | if ( !hddDisconInProgress ) |
| 2649 | { |
| 2650 | cfg80211_put_bss( |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2651 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2652 | pHddCtx->wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2653 | #endif |
| 2654 | bss); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2655 | // Register the Station with TL after associated... |
| 2656 | vosStatus = hdd_roamRegisterSTA( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2657 | pRoamInfo, |
| 2658 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2659 | NULL, |
| 2660 | pRoamInfo->pBssDesc ); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2661 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2662 | } |
| 2663 | else |
| 2664 | { |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 2665 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 2666 | /* in case of reassociation also need to indicate it to supplicant */ |
| 2667 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2668 | pAdapter->sessionId, |
| 2669 | &reqRsnLength, |
| 2670 | reqRsnIe); |
| 2671 | |
| 2672 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2673 | //Reassoc successfully |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2674 | if( pRoamInfo->fAuthRequired ) |
| 2675 | { |
| 2676 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 2677 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2678 | WLANTL_STA_CONNECTED ); |
| 2679 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 2680 | } |
| 2681 | else |
| 2682 | { |
| 2683 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2684 | "%s: staId: %d Changing TL state to AUTHENTICATED", |
| 2685 | __func__, pHddStaCtx->conn_info.staId[ 0 ] ); |
| 2686 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 2687 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2688 | WLANTL_STA_AUTHENTICATED ); |
| 2689 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2690 | hdd_postTLPacketPendingInd(pAdapter, |
| 2691 | pHddStaCtx->conn_info.staId[0]); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2692 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2693 | } |
| 2694 | |
| 2695 | if ( VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2696 | { |
| 2697 | // perform any WMM-related association processing |
| 2698 | hdd_wmm_assoc(pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2699 | } |
| 2700 | else |
| 2701 | { |
| 2702 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2703 | "Cannot register STA with TL. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2704 | vosStatus, vosStatus ); |
| 2705 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2706 | #ifdef WLAN_FEATURE_11W |
| 2707 | vos_mem_zero( &pAdapter->hdd_stats.hddPmfStats, |
| 2708 | sizeof(pAdapter->hdd_stats.hddPmfStats) ); |
| 2709 | #endif |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2710 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2711 | // Start the Queue |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 2712 | if ( !hddDisconInProgress ) |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2713 | { |
| 2714 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 2715 | netif_tx_wake_all_queues(dev); |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2716 | } |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2717 | if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2718 | { |
| 2719 | vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0); |
| 2720 | } |
Padma, Santhosh Kumar | 38cef18 | 2016-02-18 12:22:51 +0530 | [diff] [blame] | 2721 | #ifdef FEATURE_WLAN_TDLS |
| 2722 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 2723 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2724 | } |
| 2725 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2726 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2727 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 2728 | |
| 2729 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2730 | if (pRoamInfo) |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 2731 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2732 | "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d", |
| 2733 | MAC_ADDR_ARRAY(pRoamInfo->bssid), roamResult, roamStatus); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2734 | else |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 2735 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2736 | "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d", |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2737 | MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 2738 | roamResult, roamStatus); |
Abhishek Singh | 6782c9e | 2017-06-06 13:37:45 +0530 | [diff] [blame] | 2739 | if (!pHddStaCtx->get_mgmt_log_sent) { |
| 2740 | pHddStaCtx->get_mgmt_log_sent = TRUE; |
Abhishek Singh | 611295e | 2015-07-09 11:11:54 +0530 | [diff] [blame] | 2741 | wlan_hdd_get_frame_logs(pAdapter, |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 2742 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Abhishek Singh | 6782c9e | 2017-06-06 13:37:45 +0530 | [diff] [blame] | 2743 | } |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 2744 | |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 2745 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 2746 | (pRoamInfo && |
| 2747 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) || |
| 2748 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) || |
| 2749 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode)))) { |
Abhishek Singh | e6137b8 | 2019-03-22 20:06:09 +0530 | [diff] [blame] | 2750 | wlan_hdd_cfg80211_unlink_bss(pAdapter, |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 2751 | pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId); |
| 2752 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 2753 | pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId); |
| 2754 | } |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2755 | /* Set connection state to eConnectionState_NotConnected only when CSR |
| 2756 | * has completed operation - with a ASSOCIATION_FAILURE status |
| 2757 | */ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2758 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2759 | { |
| 2760 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2761 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 2762 | __func__); |
| 2763 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected); |
| 2764 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2765 | if((pHddCtx->concurrency_mode <= 1) && |
| 2766 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2767 | { |
| 2768 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 2769 | } |
| 2770 | |
| 2771 | //If the Device Mode is Station |
| 2772 | // and the P2P Client is Connected |
| 2773 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2774 | |
| 2775 | // In case of JB, as Change-Iface may or maynot be called for p2p0 |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2776 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2777 | if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 2778 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2779 | (vos_concurrent_open_sessions_running())) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2780 | { |
| 2781 | //Enable BMPS only of other Session is P2P Client |
| 2782 | hdd_context_t *pHddCtx = NULL; |
| 2783 | v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); |
| 2784 | |
| 2785 | if (NULL != pVosContext) |
| 2786 | { |
| 2787 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 2788 | |
| 2789 | if(NULL != pHddCtx) |
| 2790 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2791 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2792 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 2793 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2794 | { |
| 2795 | if (pHddCtx->hdd_wlan_suspended) |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 2796 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2797 | hdd_set_pwrparams(pHddCtx); |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 2798 | } |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2799 | hdd_enable_bmps_imps(pHddCtx); |
| 2800 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2801 | } |
| 2802 | } |
| 2803 | } |
| 2804 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2805 | /* CR465478: Only send up a connection failure result when CSR has |
Varun Reddy Yeturu | da7f0d5 | 2013-12-20 11:16:57 -0800 | [diff] [blame] | 2806 | * completed operation - with a ASSOCIATION_FAILURE status.*/ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2807 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2808 | { |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 2809 | |
| 2810 | if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 2811 | { |
| 2812 | hddLog(LOG1, |
| 2813 | FL("Assoication Failure for P2P client and we are trying to re-enable TDLS")); |
| 2814 | wlan_hdd_tdls_reenable(pHddCtx); |
| 2815 | } |
| 2816 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2817 | if (pRoamInfo) { |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2818 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2819 | "%s: send connect failure to nl80211:" |
| 2820 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2821 | " result:%d and Status:%d reasonCode %d" , |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2822 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2823 | roamResult, roamStatus, pRoamInfo->reasonCode); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2824 | pHddStaCtx->conn_info.assoc_status_code = |
| 2825 | pRoamInfo->statusCode; |
| 2826 | } else { |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2827 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2828 | "%s: connect failed:" |
| 2829 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2830 | " result:%d and Status:%d" , |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2831 | __func__, MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 2832 | roamResult, roamStatus); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2833 | } |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2834 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2835 | /* inform association failure event to nl80211 */ |
| 2836 | if ( eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult ) |
| 2837 | { |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2838 | if (pRoamInfo) |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2839 | hdd_connect_result(dev, pRoamInfo->bssid, NULL, |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2840 | NULL, 0, NULL, 0, |
| 2841 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2842 | GFP_KERNEL); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2843 | else |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2844 | hdd_connect_result(dev, pWextState->req_bssId, NULL, |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2845 | NULL, 0, NULL, 0, |
| 2846 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2847 | GFP_KERNEL); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2848 | } |
| 2849 | else |
| 2850 | { |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2851 | if (pRoamInfo) |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2852 | hdd_connect_result(dev, pRoamInfo->bssid, NULL, |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2853 | NULL, 0, NULL, 0, |
| 2854 | pRoamInfo->reasonCode ? |
| 2855 | pRoamInfo->reasonCode : |
| 2856 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2857 | GFP_KERNEL); |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2858 | else |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2859 | hdd_connect_result(dev, pWextState->req_bssId, NULL, |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2860 | NULL, 0, NULL, 0, |
| 2861 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2862 | GFP_KERNEL); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2863 | } |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2864 | /*Clear the roam profile*/ |
| 2865 | hdd_clearRoamProfileIe( pAdapter ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2866 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2867 | |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 2868 | hdd_wmm_init( pAdapter ); |
Madan Mohan Koyyalamudi | ee255f1 | 2012-09-28 15:41:19 -0700 | [diff] [blame] | 2869 | |
c_hpothu | 24f4098 | 2014-04-18 18:00:36 +0530 | [diff] [blame] | 2870 | if (pRoamInfo) |
| 2871 | { |
| 2872 | WLANTL_AssocFailed(pRoamInfo->staId); |
| 2873 | } |
Mihir Shete | b733727 | 2014-04-11 15:53:08 +0530 | [diff] [blame] | 2874 | |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2875 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2876 | netif_tx_disable(dev); |
| 2877 | netif_carrier_off(dev); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2878 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2879 | } |
| 2880 | |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2881 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2882 | { |
| 2883 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 2884 | if (pHostapdAdapter != NULL) |
| 2885 | { |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2886 | /* Restart SAP if its operating channel is different |
| 2887 | * from AP channel. |
| 2888 | */ |
| 2889 | if (pHostapdAdapter->sessionCtx.ap.operatingChannel != |
| 2890 | (int)pRoamInfo->pBssDesc->channelId) |
| 2891 | { |
| 2892 | hddLog(VOS_TRACE_LEVEL_INFO,"Restart Sap as SAP channel is %d " |
| 2893 | "and STA channel is %d", pHostapdAdapter->sessionCtx.ap.operatingChannel, |
| 2894 | (int)pRoamInfo->pBssDesc->channelId); |
Hanumanth Reddy Pothula | 8d4b8eb | 2018-02-26 16:14:10 +0530 | [diff] [blame] | 2895 | if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->force_scc_with_ecsa) |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2896 | { |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2897 | hdd_schedule_ecsa_chan_change_work(pHddCtx, |
| 2898 | pAdapter->sessionId); |
| 2899 | } |
| 2900 | else |
| 2901 | { |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2902 | hdd_hostapd_stop(pHostapdAdapter->dev); |
Hanumanth Reddy Pothula | 8d4b8eb | 2018-02-26 16:14:10 +0530 | [diff] [blame] | 2903 | if (pHddCtx->cfg_ini && |
| 2904 | pHddCtx->cfg_ini->enable_sap_auth_offload) |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2905 | hdd_force_scc_restart_sap(pHostapdAdapter, |
| 2906 | pHddCtx, (int)pRoamInfo->pBssDesc->channelId); |
| 2907 | } |
Agrawal Ashish | 574b3e6 | 2017-02-09 18:58:34 +0530 | [diff] [blame] | 2908 | |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2909 | } |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2910 | } |
| 2911 | } |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 2912 | else if (roamStatus == eCSR_ROAM_ASSOCIATION_FAILURE) |
| 2913 | { |
| 2914 | hdd_check_and_move_if_sap_is_on_dfs_chan(pHddCtx, pAdapter); |
| 2915 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2916 | return eHAL_STATUS_SUCCESS; |
| 2917 | } |
| 2918 | |
| 2919 | /**============================================================================ |
| 2920 | * |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2921 | @brief hdd_RoamIbssIndicationHandler() - Here we update the status of the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2922 | Ibss when we receive information that we have started/joined an ibss session |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2923 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2924 | ===========================================================================*/ |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2925 | static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter, |
| 2926 | tCsrRoamInfo *pRoamInfo, |
| 2927 | tANI_U32 roamId, |
| 2928 | eRoamCmdStatus roamStatus, |
| 2929 | eCsrRoamResult roamResult ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2930 | { |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2931 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 2932 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 2933 | struct cfg80211_bss *bss; |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 2934 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2935 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2936 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d", |
| 2937 | __func__, pAdapter->dev->name, roamId, roamStatus, roamResult); |
| 2938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2939 | switch( roamResult ) |
| 2940 | { |
| 2941 | // both IBSS Started and IBSS Join should come in here. |
| 2942 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 2943 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2944 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2945 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2946 | if (NULL == pRoamInfo) |
| 2947 | { |
| 2948 | VOS_ASSERT(0); |
| 2949 | return; |
| 2950 | } |
| 2951 | |
| 2952 | /* When IBSS Started comes from CSR, we need to move |
| 2953 | * connection state to IBSS Disconnected (meaning no peers |
| 2954 | * are in the IBSS). |
| 2955 | */ |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2956 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2957 | "%s: Set HDD connState to eConnectionState_IbssDisconnected", |
| 2958 | __func__); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2959 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 2960 | eConnectionState_IbssDisconnected ); |
Abhishek Singh | 1c21c4d | 2014-04-25 16:40:19 +0530 | [diff] [blame] | 2961 | /*notify wmm */ |
| 2962 | hdd_wmm_connect(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2963 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2964 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2965 | if (pRoamInfo->pBssDesc) |
| 2966 | { |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2967 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 2968 | struct ieee80211_channel *chan; |
| 2969 | int chan_no; |
| 2970 | unsigned int freq; |
| 2971 | #endif |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2972 | hdd_ibss_RegisterSTA (pAdapter, pRoamInfo, |
| 2973 | IBSS_BROADCAST_STAID, |
| 2974 | &broadcastMacAddr, pRoamInfo->pBssDesc); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2975 | |
| 2976 | /* we created the IBSS, notify supplicant */ |
| 2977 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: created ibss " |
| 2978 | MAC_ADDRESS_STR, |
| 2979 | __func__, pAdapter->dev->name, |
| 2980 | MAC_ADDR_ARRAY(pRoamInfo->pBssDesc->bssId)); |
| 2981 | |
| 2982 | /* we must first give cfg80211 the BSS information */ |
| 2983 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 2984 | if (NULL == bss) |
| 2985 | { |
| 2986 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2987 | "%s: %s: unable to create IBSS entry", |
| 2988 | __func__, pAdapter->dev->name); |
| 2989 | return; |
| 2990 | } |
Abhishek Singh | 00b7197 | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 2991 | #ifdef WLAN_FEATURE_RMC |
| 2992 | netif_carrier_on(pAdapter->dev); |
| 2993 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
| 2994 | netif_tx_start_all_queues(pAdapter->dev); |
| 2995 | #endif |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2996 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 2997 | chan_no = pRoamInfo->pBssDesc->channelId; |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2998 | |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2999 | if (chan_no <= 14) |
| 3000 | freq = ieee80211_channel_to_frequency(chan_no, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 3001 | HDD_NL80211_BAND_2GHZ); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 3002 | else |
| 3003 | freq = ieee80211_channel_to_frequency(chan_no, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 3004 | HDD_NL80211_BAND_5GHZ); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 3005 | |
| 3006 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 3007 | |
| 3008 | if (chan) |
| 3009 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 3010 | chan, GFP_KERNEL); |
| 3011 | else |
| 3012 | hddLog(LOGE, FL("%s: chanId: %d, can't find channel"), |
| 3013 | pAdapter->dev->name, |
| 3014 | (int)pRoamInfo->pBssDesc->channelId); |
| 3015 | #else |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3016 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 3017 | #endif |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 3018 | cfg80211_put_bss( |
| 3019 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 3020 | pHddCtx->wiphy, |
| 3021 | #endif |
| 3022 | bss); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3023 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3024 | else |
| 3025 | { |
| 3026 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3027 | "%s: NULL Bss Desc",__func__); |
| 3028 | } |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3029 | |
| 3030 | /* Set Broadcast key again in case IBSS_COALESCED as DEL BSS, |
| 3031 | * in IBSS_COALESCED will remove the BC key. |
| 3032 | */ |
| 3033 | if ((eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) && |
| 3034 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY |
| 3035 | == pHddStaCtx->ibss_enc_key.encType |
| 3036 | ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY |
| 3037 | == pHddStaCtx->ibss_enc_key.encType |
| 3038 | ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType |
| 3039 | ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType )) |
| 3040 | { |
| 3041 | u8 grpmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3042 | VOS_STATUS vosStatus; |
| 3043 | |
| 3044 | pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX; |
| 3045 | |
| 3046 | memcpy(&pHddStaCtx->ibss_enc_key.peerMac, |
| 3047 | grpmacaddr, WNI_CFG_BSSID_LEN); |
| 3048 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3049 | FL(" SET GTK in case of COALESCED")); |
| 3050 | vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3051 | pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId ); |
| 3052 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 3053 | { |
| 3054 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3055 | FL("sme_RoamSetKey failed, returned %d"),vosStatus); |
| 3056 | } |
| 3057 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3058 | break; |
| 3059 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3061 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3062 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3063 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unable to create IBSS", |
| 3064 | __func__, pAdapter->dev->name); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3065 | break; |
| 3066 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3068 | default: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3069 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unexpected result %d", |
| 3070 | __func__, pAdapter->dev->name, (int)roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3071 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3072 | } |
| 3073 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3074 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3075 | } |
| 3076 | |
| 3077 | /**============================================================================ |
| 3078 | * |
| 3079 | @brief roamSaveIbssStation() - Save the IBSS peer MAC address in the adapter. |
| 3080 | This information is passed to iwconfig later. The peer that joined |
| 3081 | last is passed as information to iwconfig. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3082 | If we add HDD_MAX_NUM_IBSS_STA or less STA we return success else we |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3083 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3084 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3085 | ===========================================================================*/ |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3086 | static int roamSaveIbssStation(hdd_adapter_t *pAdapter, v_U8_t staId, v_MACADDR_t *peerMacAddress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3087 | { |
| 3088 | int fSuccess = FALSE; |
| 3089 | int idx = 0; |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3090 | VOS_STATUS status; |
| 3091 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3092 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3093 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 3094 | { |
| 3095 | if ( 0 == pHddStaCtx->conn_info.staId[ idx ] ) |
| 3096 | { |
| 3097 | pHddStaCtx->conn_info.staId[ idx ] = staId; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3098 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3099 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ], peerMacAddress ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3100 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3101 | fSuccess = TRUE; |
| 3102 | break; |
| 3103 | } |
| 3104 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3105 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3106 | status = hdd_sta_id_hash_add_entry(pAdapter, staId, peerMacAddress); |
| 3107 | if (status != VOS_STATUS_SUCCESS) { |
| 3108 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3109 | FL("Not able to add staid hash %d"), staId); |
| 3110 | return FALSE; |
| 3111 | } |
| 3112 | |
| 3113 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3114 | FL("New station added sta_id %d mac:" |
| 3115 | MAC_ADDRESS_STR), staId, |
| 3116 | MAC_ADDR_ARRAY(peerMacAddress->bytes)); |
| 3117 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3118 | return( fSuccess ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3119 | } |
| 3120 | /**============================================================================ |
| 3121 | * |
| 3122 | @brief roamRemoveIbssStation() - Remove the IBSS peer MAC address in the adapter. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3123 | If we remove HDD_MAX_NUM_IBSS_STA or less STA we return success else we |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3124 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3125 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3126 | ===========================================================================*/ |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3127 | static int roamRemoveIbssStation( hdd_adapter_t *pAdapter, v_U8_t staId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3128 | { |
| 3129 | int fSuccess = FALSE; |
| 3130 | int idx = 0; |
| 3131 | v_U8_t valid_idx = 0; |
| 3132 | v_U8_t del_idx = 0; |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3133 | v_U8_t empty_slots = 0; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3134 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3135 | VOS_STATUS status; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3136 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3137 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 3138 | { |
| 3139 | if ( staId == pHddStaCtx->conn_info.staId[ idx ] ) |
| 3140 | { |
| 3141 | pHddStaCtx->conn_info.staId[ idx ] = 0; |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3142 | status = hdd_sta_id_hash_remove_entry(pAdapter, |
| 3143 | staId, &pHddStaCtx->conn_info.peerMacAddress[idx]); |
| 3144 | if (status != VOS_STATUS_SUCCESS) { |
| 3145 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3146 | FL("Not able to remove staid hash %d"), staId ); |
| 3147 | fSuccess = FALSE; |
| 3148 | } else { |
| 3149 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3150 | FL("station removed sta_id %d mac:" |
| 3151 | MAC_ADDRESS_STR), staId, |
| 3152 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[idx].bytes)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3153 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3154 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3155 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3156 | fSuccess = TRUE; |
| 3157 | // Note the deleted Index, if its 0 we need special handling |
| 3158 | del_idx = idx; |
| 3159 | empty_slots++; |
| 3160 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3161 | } |
| 3162 | else |
| 3163 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3164 | if (pHddStaCtx->conn_info.staId[idx] != 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3165 | { |
| 3166 | valid_idx = idx; |
| 3167 | } |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3168 | else |
| 3169 | { |
| 3170 | // Found an empty slot |
| 3171 | empty_slots++; |
| 3172 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3173 | } |
| 3174 | } |
| 3175 | |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3176 | if (HDD_MAX_NUM_IBSS_STA == empty_slots) |
| 3177 | { |
| 3178 | // Last peer departed, set the IBSS state appropriately |
| 3179 | pHddStaCtx->conn_info.connState = eConnectionState_IbssDisconnected; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3180 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3181 | "Last IBSS Peer Departed!!!" ); |
| 3182 | } |
| 3183 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3184 | // Find next active staId, to have a valid sta trigger for TL. |
| 3185 | if (fSuccess == TRUE) |
| 3186 | { |
| 3187 | if (del_idx == 0) |
| 3188 | { |
| 3189 | if (pHddStaCtx->conn_info.staId[valid_idx] != 0) |
| 3190 | { |
| 3191 | pHddStaCtx->conn_info.staId[0] = pHddStaCtx->conn_info.staId[valid_idx]; |
| 3192 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], |
| 3193 | &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ]); |
| 3194 | |
| 3195 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
| 3196 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ] ); |
| 3197 | } |
| 3198 | } |
| 3199 | } |
| 3200 | return( fSuccess ); |
| 3201 | } |
| 3202 | |
| 3203 | /**============================================================================ |
| 3204 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3205 | @brief roamIbssConnectHandler() : We update the status of the IBSS to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3206 | connected in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3207 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3208 | ===========================================================================*/ |
| 3209 | static eHalStatus roamIbssConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo ) |
| 3210 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3211 | struct cfg80211_bss *bss; |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 3212 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3213 | "%s: IBSS Connect Indication from SME!!! " |
| 3214 | "Set HDD connState to eConnectionState_IbssConnected", |
| 3215 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3216 | // Set the internal connection state to show 'IBSS Connected' (IBSS with a partner stations)... |
| 3217 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssConnected ); |
| 3218 | |
| 3219 | // Save the connection info from CSR... |
| 3220 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS ); |
| 3221 | |
| 3222 | // Send the bssid address to the wext. |
| 3223 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3224 | /* add bss_id to cfg80211 data base */ |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3225 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3226 | if (NULL == bss) |
| 3227 | { |
| 3228 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3229 | "%s: %s: unable to create IBSS entry", |
| 3230 | __func__, pAdapter->dev->name); |
| 3231 | return eHAL_STATUS_FAILURE; |
| 3232 | } |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 3233 | cfg80211_put_bss( |
| 3234 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 3235 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
| 3236 | #endif |
| 3237 | bss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3238 | |
| 3239 | return( eHAL_STATUS_SUCCESS ); |
| 3240 | } |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 3241 | |
| 3242 | /**============================================================================ |
| 3243 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3244 | @brief hdd_RoamSetKeyCompleteHandler() - Update the security parameters. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3246 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3247 | static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 3248 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3249 | eCsrRoamResult roamResult ) |
| 3250 | { |
| 3251 | eCsrEncryptionType connectedCipherAlgo; |
| 3252 | v_BOOL_t fConnected = FALSE; |
| 3253 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 3254 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3255 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3256 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3257 | WLANTL_STAStateType prevTLState = WLANTL_STA_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3258 | ENTER(); |
Srinivas Girigowda | 5a737f2 | 2013-06-28 15:21:48 -0700 | [diff] [blame] | 3259 | |
| 3260 | if (NULL == pRoamInfo) |
| 3261 | { |
| 3262 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "pRoamInfo is NULL"); |
| 3263 | return eHAL_STATUS_FAILURE; |
| 3264 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3265 | // if ( WPA ), tell TL to go to 'authenticated' after the keys are set. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3266 | // then go to 'authenticated'. For all other authentication types (those that do |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3267 | // not require upper layer authentication) we can put TL directly into 'authenticated' |
| 3268 | // state. |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3269 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3270 | "Set Key completion roamStatus =%d roamResult=%d " MAC_ADDRESS_STR, |
| 3271 | roamStatus, roamResult, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3272 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3273 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 3274 | if( fConnected ) |
| 3275 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3276 | if ( WLAN_HDD_IBSS == pAdapter->device_mode ) |
| 3277 | { |
| 3278 | v_U8_t staId; |
| 3279 | |
| 3280 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 3281 | |
| 3282 | if ( 0 == memcmp( pRoamInfo->peerMac, |
| 3283 | &broadcastMacAddr, VOS_MAC_ADDR_SIZE ) ) |
| 3284 | { |
| 3285 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3286 | IBSS_BROADCAST_STAID); |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3287 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3288 | "WLAN TL STA GTK Installed for STAID=%d", IBSS_BROADCAST_STAID); |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3289 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3290 | } |
| 3291 | else |
| 3292 | { |
| 3293 | vosStatus = hdd_Ibss_GetStaId(pHddStaCtx, |
| 3294 | (v_MACADDR_t*)pRoamInfo->peerMac, |
| 3295 | &staId); |
| 3296 | if ( VOS_STATUS_SUCCESS == vosStatus ) |
| 3297 | { |
| 3298 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3299 | "WLAN TL STA Ptk Installed for STAID=%d", staId); |
| 3300 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3301 | staId); |
| 3302 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3303 | } |
| 3304 | } |
| 3305 | } |
| 3306 | else |
| 3307 | { |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3308 | WLANTL_GetSTAState(pHddCtx->pvosContext, |
| 3309 | pHddStaCtx->conn_info.staId[0], |
| 3310 | &prevTLState); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3311 | // TODO: Considering getting a state machine in HDD later. |
| 3312 | // This routine is invoked twice. 1)set PTK 2)set GTK. |
| 3313 | // The folloing if statement will be TRUE when setting GTK. |
| 3314 | // At this time we don't handle the state in detail. |
| 3315 | // Related CR: 174048 - TL not in authenticated state |
| 3316 | if ( ( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) && |
| 3317 | (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired ) |
| 3318 | { |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3319 | |
| 3320 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set " |
| 3321 | "for StaId=%d. Changing TL state to AUTHENTICATED from" |
| 3322 | " state:%d", pHddStaCtx->conn_info.staId[0], prevTLState); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3323 | |
| 3324 | // Connections that do not need Upper layer authentication, |
| 3325 | // transition TL to 'Authenticated' state after the keys are set. |
| 3326 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 3327 | pHddStaCtx->conn_info.staId[ 0 ], |
| 3328 | WLANTL_STA_AUTHENTICATED ); |
| 3329 | |
| 3330 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3331 | |
| 3332 | if (WLANTL_STA_AUTHENTICATED != prevTLState) |
| 3333 | hdd_postTLPacketPendingInd(pAdapter, |
| 3334 | pHddStaCtx->conn_info.staId[0]); |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 3335 | //Need to call offload because when roaming happen at that time fwr |
| 3336 | //clean offload info as part of the DelBss |
| 3337 | // No need to configure offload if host was not suspended |
| 3338 | spin_lock(&pHddCtx->filter_lock); |
| 3339 | if(pHddCtx->hdd_wlan_suspended) |
| 3340 | { |
| 3341 | spin_unlock(&pHddCtx->filter_lock); |
| 3342 | hdd_ReConfigSuspendDataClearedDuringRoaming(pHddCtx); |
| 3343 | } |
| 3344 | else |
| 3345 | { |
| 3346 | spin_unlock(&pHddCtx->filter_lock); |
| 3347 | } |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 3348 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 3349 | { |
| 3350 | vos_record_roam_event(e_HDD_SET_GTK_RSP, NULL, 0); |
| 3351 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3352 | } |
| 3353 | else |
| 3354 | { |
| 3355 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3356 | pHddStaCtx->conn_info.staId[ 0 ]); |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3357 | |
| 3358 | /* In case of OSEN move TL to 'Authenticated' after PTK is set */ |
| 3359 | if (pWextState->roamProfile.bOSENAssociation == VOS_TRUE) |
| 3360 | { |
| 3361 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "PTK set" |
| 3362 | " for StaId=%d. Due to OSEN, Changing TL state to" |
| 3363 | "AUTHENTICATED from state:%d", |
| 3364 | pHddStaCtx->conn_info.staId[0], prevTLState); |
| 3365 | |
| 3366 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 3367 | pHddStaCtx->conn_info.staId[ 0 ], |
| 3368 | WLANTL_STA_AUTHENTICATED ); |
| 3369 | |
| 3370 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 3371 | |
| 3372 | if (WLANTL_STA_AUTHENTICATED != prevTLState) |
| 3373 | hdd_postTLPacketPendingInd(pAdapter, |
| 3374 | pHddStaCtx->conn_info.staId[0]); |
| 3375 | } |
| 3376 | |
| 3377 | |
| 3378 | |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 3379 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 3380 | { |
| 3381 | vos_record_roam_event(e_HDD_SET_PTK_RSP, (void *)pRoamInfo->peerMac, 6); |
| 3382 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3383 | } |
| 3384 | |
| 3385 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3386 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3387 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3388 | else |
| 3389 | { |
| 3390 | // possible disassoc after issuing set key and waiting set key complete |
| 3391 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3392 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3393 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3394 | EXIT(); |
| 3395 | return( eHAL_STATUS_SUCCESS ); |
| 3396 | } |
| 3397 | /**============================================================================ |
| 3398 | * |
| 3399 | @brief hdd_RoamMicErrorIndicationHandler() - This function indicates the Mic failure to the supplicant. |
| 3400 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3401 | static eHalStatus hdd_RoamMicErrorIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3402 | tANI_U32 roamId, eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3403 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3404 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3405 | |
| 3406 | if( eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3407 | TKIP_COUNTER_MEASURE_STOPED == pHddStaCtx->WextState.mTKIPCounterMeasures ) |
| 3408 | { |
| 3409 | struct iw_michaelmicfailure msg; |
| 3410 | union iwreq_data wreq; |
| 3411 | memset(&msg, '\0', sizeof(msg)); |
| 3412 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3413 | memcpy(msg.src_addr.sa_data, pRoamInfo->u.pMICFailureInfo->taMacAddr, sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr)); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3414 | hddLog(LOG1, "MIC MAC " MAC_ADDRESS_STR, |
| 3415 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3416 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3417 | if(pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) |
| 3418 | msg.flags = IW_MICFAILURE_GROUP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3419 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3420 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3421 | memset(&wreq, 0, sizeof(wreq)); |
| 3422 | wreq.data.length = sizeof(msg); |
| 3423 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, (char *)&msg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3424 | /* inform mic failure to nl80211 */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3425 | cfg80211_michael_mic_failure(pAdapter->dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3426 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3427 | ((pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) ? |
| 3428 | NL80211_KEYTYPE_GROUP : |
| 3429 | NL80211_KEYTYPE_PAIRWISE), |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3430 | pRoamInfo->u.pMICFailureInfo->keyId, |
| 3431 | pRoamInfo->u.pMICFailureInfo->TSC, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3432 | GFP_KERNEL); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3433 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3434 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3435 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3436 | return( eHAL_STATUS_SUCCESS ); |
| 3437 | } |
| 3438 | |
| 3439 | /**============================================================================ |
| 3440 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3441 | @brief roamRoamConnectStatusUpdateHandler() - The Ibss connection status is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3442 | updated regularly here in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3443 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3444 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3445 | static eHalStatus roamRoamConnectStatusUpdateHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 3446 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3447 | eCsrRoamResult roamResult ) |
| 3448 | { |
| 3449 | VOS_STATUS vosStatus; |
| 3450 | |
| 3451 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3452 | switch( roamResult ) |
| 3453 | { |
| 3454 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3455 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3456 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3457 | struct station_info *staInfo; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3458 | |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 3459 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3460 | "IBSS New Peer indication from SME with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3461 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 3462 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3463 | pRoamInfo->staId ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3464 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3465 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3466 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3467 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
| 3468 | WLANTL_UpdateSTABssIdforIBSS(pHddCtx->pvosContext, |
| 3469 | IBSS_BROADCAST_STAID,pHddStaCtx->conn_info.bssId); |
| 3470 | |
| 3471 | // Register the Station with TL for the new peer. |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3472 | vosStatus = hdd_ibss_RegisterSTA( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3473 | pRoamInfo, |
| 3474 | pRoamInfo->staId, |
| 3475 | (v_MACADDR_t *)pRoamInfo->peerMac, |
| 3476 | pRoamInfo->pBssDesc ); |
| 3477 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3478 | { |
| 3479 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3480 | "Cannot register STA with TL for IBSS. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3481 | vosStatus, vosStatus ); |
| 3482 | } |
Abhishek Singh | decf1b6 | 2016-02-09 11:53:58 +0530 | [diff] [blame] | 3483 | if (!roamSaveIbssStation(pAdapter, |
| 3484 | pRoamInfo->staId, |
| 3485 | (v_MACADDR_t *)pRoamInfo->peerMac)) |
| 3486 | { |
| 3487 | hddLog(LOGW, FL("Not Able to add sta in sta hash")); |
| 3488 | break; |
| 3489 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3490 | pHddStaCtx->ibss_sta_generation++; |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3491 | |
| 3492 | staInfo = vos_mem_malloc(sizeof(*staInfo)); |
| 3493 | if (staInfo == NULL) { |
| 3494 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3495 | "memory allocation for station_info failed"); |
| 3496 | return eHAL_STATUS_FAILED_ALLOC; |
| 3497 | } |
| 3498 | |
| 3499 | memset(staInfo, 0, sizeof(*staInfo)); |
| 3500 | staInfo->filled = 0; |
| 3501 | staInfo->generation = pHddStaCtx->ibss_sta_generation; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3502 | |
| 3503 | cfg80211_new_sta(pAdapter->dev, |
| 3504 | (const u8 *)pRoamInfo->peerMac, |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3505 | staInfo, GFP_KERNEL); |
| 3506 | vos_mem_free(staInfo); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3507 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3508 | if ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 3509 | ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 3510 | ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType |
| 3511 | ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType ) |
| 3512 | { |
| 3513 | pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX; |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3514 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3515 | memcpy(&pHddStaCtx->ibss_enc_key.peerMac, |
| 3516 | pRoamInfo->peerMac, WNI_CFG_BSSID_LEN); |
| 3517 | |
| 3518 | VOS_TRACE( VOS_MODULE_ID_HDD, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3519 | VOS_TRACE_LEVEL_INFO_HIGH, "New peer joined set PTK encType=%d", |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3520 | pHddStaCtx->ibss_enc_key.encType); |
| 3521 | |
| 3522 | vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3523 | pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId ); |
| 3524 | |
| 3525 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 3526 | { |
| 3527 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3528 | "%s: sme_RoamSetKey failed, returned %d", |
| 3529 | __func__, vosStatus); |
| 3530 | return VOS_STATUS_E_FAILURE; |
| 3531 | } |
| 3532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3533 | netif_carrier_on(pAdapter->dev); |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 3534 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3535 | netif_tx_start_all_queues(pAdapter->dev); |
| 3536 | break; |
| 3537 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3538 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3539 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3540 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3541 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3542 | roamIbssConnectHandler( pAdapter, pRoamInfo ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3543 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3544 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3545 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3546 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3547 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3548 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3549 | |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3550 | if ( !roamRemoveIbssStation(pAdapter, pRoamInfo->staId ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3551 | { |
| 3552 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 3553 | "IBSS peer departed by cannot find peer in our registration table with TL" ); |
| 3554 | } |
| 3555 | |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 3556 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3557 | "IBSS Peer Departed from SME with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3558 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 3559 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
| 3560 | pRoamInfo->staId ); |
| 3561 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3562 | hdd_ibss_DeregisterSTA( pAdapter, pRoamInfo->staId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3563 | |
| 3564 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3565 | pHddStaCtx->ibss_sta_generation++; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3566 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3567 | cfg80211_del_sta(pAdapter->dev, |
| 3568 | (const u8 *)&pRoamInfo->peerMac, |
| 3569 | GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3570 | break; |
| 3571 | } |
| 3572 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3573 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3574 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 3575 | "Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3576 | // Stop only when we are inactive |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 3577 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3578 | netif_tx_disable(pAdapter->dev); |
| 3579 | netif_carrier_off(pAdapter->dev); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 3580 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3581 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 3582 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3583 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_NotConnected ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3584 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3585 | // Send the bssid address to the wext. |
| 3586 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
| 3587 | // clean up data path |
| 3588 | hdd_disconnect_tx_rx(pAdapter); |
| 3589 | break; |
| 3590 | } |
| 3591 | default: |
| 3592 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3593 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3594 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3595 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3596 | return( eHAL_STATUS_SUCCESS ); |
| 3597 | } |
| 3598 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3599 | #ifdef FEATURE_WLAN_TDLS |
| 3600 | /**============================================================================ |
| 3601 | * |
| 3602 | @brief hdd_roamRegisterTDLSSTA() - Construct the staDesc and register with |
| 3603 | TL the new STA. This is called as part of ADD_STA in the TDLS setup |
| 3604 | Return: VOS_STATUS |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3605 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3606 | ===========================================================================*/ |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 3607 | VOS_STATUS hdd_roamRegisterTDLSSTA(hdd_adapter_t *pAdapter, |
| 3608 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 3609 | const tANI_U8 *peerMac, |
| 3610 | #else |
| 3611 | tANI_U8 *peerMac, |
| 3612 | #endif |
| 3613 | tANI_U16 staId, tANI_U8 ucastSig) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3614 | { |
| 3615 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3616 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3617 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 3618 | WLAN_STADescType staDesc = {0}; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3619 | eCsrEncryptionType connectedCipherAlgo = eCSR_ENCRYPT_TYPE_UNKNOWN; |
| 3620 | v_BOOL_t fConnected = FALSE; |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 3621 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3622 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3623 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3624 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 3625 | if (!fConnected) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3626 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3627 | "%s not connected. ignored", __func__); |
| 3628 | return VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3629 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3630 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3631 | /* |
| 3632 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3633 | * be peer MAC, here we are wokrking on direct Link |
| 3634 | */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3635 | staDesc.ucSTAId = staId ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3636 | |
| 3637 | staDesc.wSTAType = WLAN_STA_TDLS ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3638 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3639 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3640 | sizeof(tSirMacAddr) ); |
| 3641 | |
| 3642 | vos_mem_copy(staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 ); |
| 3643 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 3644 | |
| 3645 | /* set the QoS field appropriately ..*/ |
| 3646 | (hdd_wmm_is_active(pAdapter)) ? (staDesc.ucQosEnabled = 1) |
| 3647 | : (staDesc.ucQosEnabled = 0) ; |
| 3648 | |
| 3649 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "HDD register \ |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3650 | TL QoS_enabled=%d", staDesc.ucQosEnabled ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3651 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3652 | staDesc.ucProtectedFrame = (connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3653 | |
| 3654 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3655 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3656 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3657 | /* |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3658 | * UMA is ready we inform TL to do frame translation. |
| 3659 | */ |
| 3660 | staDesc.ucSwFrameTXXlation = 1; |
| 3661 | staDesc.ucSwFrameRXXlation = 1; |
| 3662 | staDesc.ucAddRmvLLC = 1; |
| 3663 | |
| 3664 | /* Initialize signatures and state */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3665 | staDesc.ucUcastSig = ucastSig ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3666 | |
| 3667 | /* tdls Direct Link do not need bcastSig */ |
| 3668 | staDesc.ucBcastSig = 0 ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3669 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3670 | if(staDesc.ucProtectedFrame) |
| 3671 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 3672 | else |
| 3673 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3674 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3675 | staDesc.ucInitState = WLANTL_STA_CONNECTED ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3676 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3677 | /* Register the Station with TL... */ |
| 3678 | vosStatus = WLANTL_RegisterSTAClient( pVosContext, |
| 3679 | hdd_rx_packet_cbk, |
| 3680 | hdd_tx_complete_cbk, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3681 | hdd_tx_fetch_packet_cbk, &staDesc, 0 ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3682 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3683 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3684 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3685 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3686 | "%s: WLANTL_RegisterSTAClient() failed to register. " |
| 3687 | "Status= %d [0x%08X]", __func__, vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3688 | return vosStatus; |
| 3689 | } |
| 3690 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 3691 | if ( cfg_param->dynSplitscan && |
| 3692 | ( VOS_TIMER_STATE_RUNNING != |
| 3693 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)) ) |
| 3694 | { |
| 3695 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 3696 | cfg_param->trafficMntrTmrForSplitScan); |
| 3697 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3698 | return( vosStatus ); |
| 3699 | } |
| 3700 | |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 3701 | VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 3702 | { |
| 3703 | VOS_STATUS vosStatus; |
| 3704 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 3705 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3706 | { |
| 3707 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 3708 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3709 | "Status= %d [0x%08X]", |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 3710 | __func__, staId, vosStatus, vosStatus ); |
| 3711 | } |
| 3712 | return( vosStatus ); |
| 3713 | } |
| 3714 | |
| 3715 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3716 | /* |
| 3717 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3718 | * TL in case of new TDLS client is added and deregistration at the time |
| 3719 | * TDLS client is deleted. |
| 3720 | */ |
| 3721 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3722 | eHalStatus hdd_RoamTdlsStatusUpdateHandler(hdd_adapter_t *pAdapter, |
| 3723 | tCsrRoamInfo *pRoamInfo, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3724 | tANI_U32 roamId, |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3725 | eRoamCmdStatus roamStatus, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3726 | eCsrRoamResult roamResult) |
| 3727 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3728 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3729 | eHalStatus status = eHAL_STATUS_FAILURE ; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3730 | tANI_U8 staIdx; |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 3731 | |
Kaushik, Sushant | 8489f47 | 2014-01-27 11:41:22 +0530 | [diff] [blame] | 3732 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3733 | ("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR), |
| 3734 | roamResult == eCSR_ROAM_RESULT_ADD_TDLS_PEER ? |
| 3735 | "ADD_TDLS_PEER" : |
| 3736 | roamResult == eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? |
| 3737 | "DEL_TDLS_PEER" : |
| 3738 | roamResult == eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? |
| 3739 | "DEL_TDLS_PEER_IND" : |
| 3740 | roamResult == eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3741 | "DEL_ALL_TDLS_PEER_IND" : |
| 3742 | roamResult == eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? |
| 3743 | "UPDATE_TDLS_PEER" : |
| 3744 | roamResult == eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3745 | "LINK_ESTABLISH_REQ_RSP" : |
| 3746 | roamResult == eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP ? |
| 3747 | "CHANNEL_SWITCH_REQ_RSP" : "UNKNOWN", |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3748 | pRoamInfo->staId, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3749 | switch( roamResult ) |
| 3750 | { |
| 3751 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3752 | { |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3753 | if(eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3754 | { |
Masti, Narayanraddi | 83dbfc2 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 3755 | hddTdlsPeer_t *curr_peer; |
| 3756 | |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3757 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3758 | ("%s: Add Sta is failed. %d"),__func__, pRoamInfo->statusCode); |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 3759 | wlan_hdd_tdls_check_bmps(pAdapter); |
Masti, Narayanraddi | 83dbfc2 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 3760 | |
| 3761 | mutex_lock(&pHddCtx->tdls_lock); |
| 3762 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3763 | pRoamInfo->peerMac, FALSE); |
| 3764 | if (NULL != curr_peer) |
| 3765 | curr_peer->link_status = eTDLS_LINK_TEARING; |
| 3766 | else |
| 3767 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3768 | "%s %d curr_peer is Null", __func__,__LINE__); |
| 3769 | mutex_unlock(&pHddCtx->tdls_lock); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3770 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3771 | else |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3772 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3773 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3774 | /* check if there is available index for this new TDLS STA */ |
| 3775 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
| 3776 | { |
| 3777 | if (0 == pHddCtx->tdlsConnInfo[staIdx].staId ) |
| 3778 | { |
| 3779 | pHddCtx->tdlsConnInfo[staIdx].sessionId = pRoamInfo->sessionId; |
| 3780 | pHddCtx->tdlsConnInfo[staIdx].staId = pRoamInfo->staId; |
| 3781 | |
| 3782 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3783 | ("TDLS: STA IDX at %d is %d " |
| 3784 | "of mac " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3785 | staIdx, pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3786 | MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3787 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3788 | vos_copy_macaddr(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3789 | (v_MACADDR_t *)pRoamInfo->peerMac) ; |
| 3790 | status = eHAL_STATUS_SUCCESS ; |
| 3791 | break ; |
| 3792 | } |
| 3793 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3794 | if (staIdx < HDD_MAX_NUM_TDLS_STA) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3795 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3796 | if (-1 == wlan_hdd_tdls_set_sta_id(pAdapter, pRoamInfo->peerMac, pRoamInfo->staId)) { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3797 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3798 | "wlan_hdd_tdls_set_sta_id() failed"); |
| 3799 | return VOS_FALSE; |
| 3800 | } |
| 3801 | |
| 3802 | (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3803 | /* store the ucast signature , if required for further reference. */ |
| 3804 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3805 | wlan_hdd_tdls_set_signature( pAdapter, pRoamInfo->peerMac, pRoamInfo->ucastSig ); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3806 | /* start TDLS client registration with TL */ |
| 3807 | status = hdd_roamRegisterTDLSSTA( pAdapter, |
| 3808 | pRoamInfo->peerMac, |
| 3809 | pRoamInfo->staId, |
| 3810 | pRoamInfo->ucastSig); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3811 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3812 | } |
| 3813 | else |
| 3814 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3815 | status = eHAL_STATUS_FAILURE; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3816 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3817 | "%s: no available slot in conn_info. staId %d cannot be stored", __func__, pRoamInfo->staId); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3818 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3819 | pAdapter->tdlsAddStaStatus = status; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3820 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3821 | complete(&pAdapter->tdls_add_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3822 | break ; |
| 3823 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3824 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3825 | { |
| 3826 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3827 | { |
| 3828 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3829 | "%s: Add Sta is failed. %d", __func__, pRoamInfo->statusCode); |
| 3830 | } |
| 3831 | /* store the ucast signature which will be used later when |
| 3832 | * registering to TL |
| 3833 | */ |
| 3834 | pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode; |
| 3835 | complete(&pAdapter->tdls_add_station_comp); |
| 3836 | break; |
| 3837 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3838 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3839 | { |
| 3840 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3841 | { |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3842 | hddTdlsPeer_t *curr_peer; |
| 3843 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3844 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3845 | "%s: Link Establish Request failed. %d", __func__, pRoamInfo->statusCode); |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3846 | |
| 3847 | mutex_lock(&pHddCtx->tdls_lock); |
| 3848 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3849 | pRoamInfo->peerMac, FALSE); |
| 3850 | if (curr_peer) |
| 3851 | curr_peer->link_status = eTDLS_LINK_TEARING; |
| 3852 | else |
| 3853 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3854 | "%s %d curr_peer is Null",__func__,__LINE__); |
| 3855 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3856 | } |
| 3857 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3858 | break; |
| 3859 | } |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3860 | case eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP: |
| 3861 | { |
| 3862 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3863 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3864 | "%s: Channel switch request failed. %d", __func__, |
| 3865 | pRoamInfo->statusCode); |
| 3866 | else |
| 3867 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3868 | "%s: Channel switch request Success", __func__); |
| 3869 | break; |
| 3870 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3871 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3872 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3873 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3874 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3875 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3876 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 3877 | pRoamInfo->staId == pHddCtx->tdlsConnInfo[staIdx].staId) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3878 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3879 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3880 | ("HDD: del STA IDX = %x"), pRoamInfo->staId) ; |
| 3881 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3882 | mutex_lock(&pHddCtx->tdls_lock); |
| 3883 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3884 | pRoamInfo->peerMac, FALSE); |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3885 | if (NULL != curr_peer) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3886 | { |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3887 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3888 | " Current status for peer" MAC_ADDRESS_STR "is %d", |
| 3889 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), curr_peer->link_status); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3890 | if (TDLS_IS_CONNECTED(curr_peer) || |
| 3891 | (eTDLS_LINK_CONNECTING == curr_peer->link_status)) |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3892 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3893 | mutex_unlock(&pHddCtx->tdls_lock); |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3894 | hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId ); |
| 3895 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3896 | else |
| 3897 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3898 | |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3899 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3900 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3901 | else |
| 3902 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3903 | |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3904 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3905 | wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3906 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3907 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3908 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 3909 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
| 3910 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3911 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3912 | wlan_hdd_tdls_check_bmps(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3913 | status = eHAL_STATUS_SUCCESS ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3914 | break ; |
| 3915 | } |
| 3916 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3917 | complete(&pAdapter->tdls_del_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3918 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3919 | break ; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3920 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 3921 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3922 | hddTdlsPeer_t *curr_peer; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3923 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3924 | "%s: Sending teardown to supplicant with reason code %u", |
| 3925 | __func__, pRoamInfo->reasonCode); |
| 3926 | |
| 3927 | #ifdef CONFIG_TDLS_IMPLICIT |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3928 | mutex_lock(&pHddCtx->tdls_lock); |
| 3929 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, |
| 3930 | FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3931 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, pRoamInfo->reasonCode); |
Abhishek Singh | 9656892 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 3932 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 3933 | curr_peer->peerMac); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3934 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3935 | #endif |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3936 | status = eHAL_STATUS_SUCCESS ; |
| 3937 | break ; |
| 3938 | } |
| 3939 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 3940 | { |
| 3941 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3942 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3943 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3944 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 3945 | pHddCtx->tdlsConnInfo[staIdx].staId) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3946 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3947 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3948 | ("hdd_tdlsStatusUpdate: staIdx %d " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3949 | pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3950 | MAC_ADDR_ARRAY(pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes)); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3951 | |
| 3952 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3953 | wlan_hdd_tdls_reset_peer(pAdapter, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3954 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3955 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3956 | hdd_roamDeregisterTDLSSTA ( pAdapter, pHddCtx->tdlsConnInfo[staIdx].staId ); |
| 3957 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3958 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3959 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3960 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3961 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 3962 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3963 | |
| 3964 | status = eHAL_STATUS_SUCCESS ; |
| 3965 | } |
| 3966 | } |
Gopichand Nakkala | 40ab275 | 2013-04-04 20:11:36 +0530 | [diff] [blame] | 3967 | wlan_hdd_tdls_check_bmps(pAdapter); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3968 | break ; |
| 3969 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3970 | default: |
| 3971 | { |
| 3972 | break ; |
| 3973 | } |
| 3974 | } |
| 3975 | |
| 3976 | return status ; |
| 3977 | } |
| 3978 | #endif |
| 3979 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 3980 | void iw_full_power_cbfn (void *pContext, eHalStatus status) |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3981 | { |
| 3982 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
| 3983 | hdd_context_t *pHddCtx = NULL; |
| 3984 | int ret; |
| 3985 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3986 | ENTER(); |
| 3987 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3988 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 3989 | { |
| 3990 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 3991 | "%s: Bad param, pAdapter [%pK]", |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3992 | __func__, pAdapter); |
| 3993 | return; |
| 3994 | } |
| 3995 | |
| 3996 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3997 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3998 | if (0 != ret) |
| 3999 | { |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 4000 | return; |
| 4001 | } |
| 4002 | |
| 4003 | if (pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 4004 | { |
| 4005 | sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), NULL, NULL); |
| 4006 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4007 | |
| 4008 | EXIT(); |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 4009 | } |
| 4010 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4011 | eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4012 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
| 4013 | { |
| 4014 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 4015 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 4016 | hdd_wext_state_t *pWextState = NULL; |
| 4017 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4018 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4019 | struct cfg80211_bss *bss_status; |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 4020 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4021 | |
| 4022 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4023 | "CSR Callback: status= %d result= %d roamID=%d", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4024 | roamStatus, roamResult, roamId ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4025 | |
| 4026 | /*Sanity check*/ |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 4027 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4028 | { |
| 4029 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 4030 | "invalid adapter or adapter has invalid magic"); |
| 4031 | return eHAL_STATUS_FAILURE; |
| 4032 | } |
| 4033 | |
| 4034 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4035 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4036 | |
| 4037 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 4038 | { |
| 4039 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4040 | "invalid WEXT state or HDD station context"); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4041 | return eHAL_STATUS_FAILURE; |
| 4042 | } |
| 4043 | |
Konamki, Sreelakshmi | b9c4571 | 2015-07-29 11:48:19 +0530 | [diff] [blame] | 4044 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 4045 | pAdapter->sessionId, roamStatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4046 | switch( roamStatus ) |
| 4047 | { |
| 4048 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 41d95e2 | 2015-08-28 12:51:32 +0530 | [diff] [blame] | 4049 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4050 | complete(&pAdapter->session_open_comp_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4051 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4052 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4053 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
| 4054 | /* We did pre-auth,then we attempted a 11r or ese reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4055 | * reassoc failed due to failure, timeout, reject from ap |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4056 | * in any case tell the OS, our carrier is off and mark |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4057 | * interface down */ |
| 4058 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 4059 | hddLog(LOGE, FL("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d"), |
| 4060 | roamStatus, roamResult, pAdapter->sessionId); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 4061 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4062 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4063 | /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */ |
| 4064 | if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4065 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 4066 | } |
| 4067 | pHddStaCtx->ft_carrier_on = FALSE; |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 4068 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4069 | break; |
| 4070 | |
| 4071 | case eCSR_ROAM_FT_START: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4072 | // When we roam for EsE and 11r, we dont want the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4073 | // OS to be informed that the link is down. So mark |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4074 | // the link ready for ft_start. After this the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4075 | // eCSR_ROAM_SHOULD_ROAM will be received. |
| 4076 | // Where in we will not mark the link down |
| 4077 | // Also we want to stop tx at this point when we will be |
| 4078 | // doing disassoc at this time. This saves 30-60 msec |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4079 | // after reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4080 | { |
| 4081 | struct net_device *dev = pAdapter->dev; |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 4082 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4083 | netif_tx_disable(dev); |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 4084 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4085 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 4086 | { |
| 4087 | vos_record_roam_event(e_HDD_DISABLE_TX_QUEUE, NULL, 0); |
| 4088 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4089 | /* |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4090 | * Deregister this STA with TL, but do not flush the packets |
| 4091 | * for this STA from wmm_tx_queue. Since there is no valid STA |
| 4092 | * for these packets they will not be transmitted. Eventually |
| 4093 | * after the reassociation is successful, these packets will be |
| 4094 | * transmitted after registering STA with TL again. This ensures |
| 4095 | * that driver does not drop packets during roaming. |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 4096 | */ |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4097 | status = WLANTL_ClearSTAClient(pHddCtx->pvosContext, |
| 4098 | pHddStaCtx->conn_info.staId[0]); |
| 4099 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4100 | { |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4101 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4102 | FL("WLANTL_ClearSTAClient failed for staID %d." |
| 4103 | "Status= %d [0x%x]"), pHddStaCtx->conn_info.staId[0], |
| 4104 | status, status); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4105 | halStatus = eHAL_STATUS_FAILURE; |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 4106 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4107 | } |
| 4108 | pHddStaCtx->ft_carrier_on = TRUE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4109 | pHddStaCtx->hdd_ReassocScenario = VOS_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4110 | break; |
| 4111 | #endif |
| 4112 | |
| 4113 | case eCSR_ROAM_SHOULD_ROAM: |
| 4114 | // Dont need to do anything |
| 4115 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4116 | struct net_device *dev = pAdapter->dev; |
| 4117 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4118 | // notify apps that we can't pass traffic anymore |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 4119 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4120 | netif_tx_disable(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4121 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4122 | if (pHddStaCtx->ft_carrier_on == FALSE) |
| 4123 | { |
| 4124 | #endif |
| 4125 | netif_carrier_off(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4126 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4127 | } |
| 4128 | #endif |
| 4129 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4130 | #if !(defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4131 | //We should clear all sta register with TL, for now, only one. |
| 4132 | status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] ); |
| 4133 | if ( !VOS_IS_STATUS_SUCCESS(status ) ) |
| 4134 | { |
| 4135 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4136 | FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"), |
| 4137 | pHddStaCtx->conn_info.staId[0], status, status ); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4138 | halStatus = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4139 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4140 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4141 | } |
| 4142 | break; |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 4143 | case eCSR_ROAM_LOSTLINK_DETECTED: |
| 4144 | { |
| 4145 | if (wlan_hdd_check_and_stop_mon(pAdapter, false)) |
| 4146 | halStatus = eHAL_STATUS_FAILURE; |
| 4147 | } |
| 4148 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4149 | case eCSR_ROAM_LOSTLINK: |
| 4150 | case eCSR_ROAM_DISASSOCIATED: |
| 4151 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4152 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4153 | "****eCSR_ROAM_DISASSOCIATED****"); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 4154 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4155 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4156 | /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */ |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 4157 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4158 | if (pHddCtx->hdd_mcastbcast_filter_set == TRUE) |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4159 | { |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 4160 | hdd_conf_mcastbcast_filter(pHddCtx, FALSE); |
Amar Singhal | f8ba2b8 | 2013-12-02 12:54:38 -0800 | [diff] [blame] | 4161 | |
| 4162 | if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) { |
| 4163 | pHddCtx->configuredMcastBcastFilter = |
| 4164 | pHddCtx->sus_res_mcastbcast_filter; |
| 4165 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_FALSE; |
| 4166 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4167 | |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 4168 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4169 | "offload: disassociation happening, restoring configuredMcastBcastFilter"); |
| 4170 | hddLog(VOS_TRACE_LEVEL_INFO,"McastBcastFilter = %d", |
| 4171 | pHddCtx->configuredMcastBcastFilter); |
| 4172 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4173 | "offload: already called mcastbcast filter"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4174 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 4175 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4176 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4177 | /* Call to clear any MC Addr List filter applied after |
| 4178 | * successful connection. |
| 4179 | */ |
| 4180 | wlan_hdd_set_mc_addr_list(pAdapter, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4181 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4182 | } |
| 4183 | break; |
| 4184 | case eCSR_ROAM_IBSS_LEAVE: |
| 4185 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4186 | "****eCSR_ROAM_IBSS_LEAVE****"); |
| 4187 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4188 | break; |
| 4189 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
| 4190 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4191 | "****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4192 | // To Do - address probable memory leak with WEP encryption upon successful association |
| 4193 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4194 | { |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4195 | //Clear saved connection information in HDD |
| 4196 | hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4197 | } |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4198 | halStatus = hdd_AssociationCompletionHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4199 | |
| 4200 | break; |
| 4201 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4202 | halStatus = hdd_AssociationCompletionHandler( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4203 | pRoamInfo, roamId, roamStatus, roamResult ); |
| 4204 | break; |
| 4205 | case eCSR_ROAM_IBSS_IND: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 4206 | hdd_RoamIbssIndicationHandler( pAdapter, pRoamInfo, roamId, |
| 4207 | roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4208 | break; |
| 4209 | |
| 4210 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
| 4211 | halStatus = roamRoamConnectStatusUpdateHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4212 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4213 | |
| 4214 | case eCSR_ROAM_MIC_ERROR_IND: |
| 4215 | halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4216 | break; |
Sachin Ahuja | 3d47fcd | 2015-08-28 16:02:06 +0530 | [diff] [blame] | 4217 | case eCSR_ROAM_LOST_LINK_PARAMS_IND: |
| 4218 | { |
| 4219 | /* |
| 4220 | * The RSSI will be subtracted from 100 as FW is sending the RSSI by |
| 4221 | * adding the 100 value. |
| 4222 | */ |
| 4223 | pAdapter->rssi_on_disconnect = pRoamInfo->u.pLostLinkParams->rssi - 100; |
| 4224 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4225 | "%s : Rssi on Disconnect : %d", |
| 4226 | __func__, pAdapter->rssi_on_disconnect); |
| 4227 | break; |
| 4228 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4229 | case eCSR_ROAM_SET_KEY_COMPLETE: |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4230 | { |
| 4231 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 4232 | |
| 4233 | if((pHddCtx) && |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4234 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4235 | ((eCSR_ROAM_RESULT_NONE == roamResult)|| |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4236 | (pRoamInfo && pRoamInfo->is11rAssoc))) |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4237 | { |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 4238 | /* Send DTIM period to the FW; only if the wlan is already |
| 4239 | in suspend. This is the case with roaming (reassoc), |
| 4240 | DELETE_BSS_REQ zeroes out Modulated/Dynamic DTIM sent in |
| 4241 | previous suspend_wlan. Sending SET_POWER_PARAMS_REQ |
| 4242 | before the ENTER_BMPS_REQ ensures Listen Interval is |
| 4243 | regained back to LI * Modulated DTIM */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4244 | hdd_set_pwrparams(pHddCtx); |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4245 | |
| 4246 | /* At this point, device should not be in BMPS; |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 4247 | if due to unexpected scenario, if we are in BMPS, |
| 4248 | then trigger Exit and Enter BMPS to take DTIM period |
| 4249 | effective */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4250 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) |
| 4251 | { |
| 4252 | hddLog( LOGE, FL("Not expected: device is already in BMPS mode, Exit & Enter BMPS again!")); |
| 4253 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 4254 | sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4255 | iw_full_power_cbfn, pAdapter, |
| 4256 | eSME_FULL_PWR_NEEDED_BY_HDD); |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4257 | } |
| 4258 | } |
Padma, Santhosh Kumar | a4c3457 | 2015-07-09 20:00:41 +0530 | [diff] [blame] | 4259 | |
| 4260 | if ((pHddCtx) && |
Padma, Santhosh Kumar | 0a623eb | 2015-07-27 11:55:29 +0530 | [diff] [blame] | 4261 | (FULL_POWER == pmcGetPmcState(pHddCtx->hHal)) && |
| 4262 | (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) && |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4263 | ((eCSR_ROAM_RESULT_NONE == roamResult) || |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4264 | (pRoamInfo && pRoamInfo->is11rAssoc))) |
Padma, Santhosh Kumar | a4c3457 | 2015-07-09 20:00:41 +0530 | [diff] [blame] | 4265 | { |
| 4266 | hddLog( LOG1, FL("Device in full power." |
| 4267 | "Stop and start traffic timer for roaming")); |
| 4268 | pmcStopTrafficTimer(pHddCtx->hHal); |
| 4269 | if (pmcStartTrafficTimer(pHddCtx->hHal, |
| 4270 | TRAFFIC_TIMER_ROAMING) != eHAL_STATUS_SUCCESS) |
| 4271 | { |
| 4272 | hddLog(LOGP, FL("Cannot start traffic timer")); |
| 4273 | } |
| 4274 | } |
| 4275 | |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4276 | halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4277 | if ((eCSR_ROAM_RESULT_NONE == roamResult) || |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4278 | (pRoamInfo && pRoamInfo->is11rAssoc)) |
Padma, Santhosh Kumar | 0a623eb | 2015-07-27 11:55:29 +0530 | [diff] [blame] | 4279 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4280 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4281 | break; |
| 4282 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4283 | case eCSR_ROAM_FT_RESPONSE: |
| 4284 | hdd_SendFTEvent(pAdapter); |
| 4285 | break; |
| 4286 | #endif |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4287 | #if defined(FEATURE_WLAN_LFR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4288 | case eCSR_ROAM_PMK_NOTIFY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4289 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4290 | { |
| 4291 | /* Notify the supplicant of a new candidate */ |
| 4292 | halStatus = wlan_hdd_cfg80211_pmksa_candidate_notify(pAdapter, pRoamInfo, 1, false); |
| 4293 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4294 | break; |
| 4295 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4296 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 4297 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4298 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 4299 | /* This event is to notify pre-auth initiation */ |
| 4300 | if (VOS_STATUS_SUCCESS != |
| 4301 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, pRoamInfo)) |
| 4302 | { |
| 4303 | halStatus = eHAL_STATUS_FAILURE; |
| 4304 | } |
| 4305 | break; |
| 4306 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 4307 | /* This event will notify pre-auth completion in case of success */ |
| 4308 | if (VOS_STATUS_SUCCESS != |
| 4309 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4310 | pRoamInfo, 1)) |
| 4311 | { |
| 4312 | halStatus = eHAL_STATUS_FAILURE; |
| 4313 | } |
| 4314 | break; |
| 4315 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 4316 | /* This event will notify pre-auth completion in case of failure. */ |
| 4317 | if (VOS_STATUS_SUCCESS != |
| 4318 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4319 | pRoamInfo, 0)) |
| 4320 | { |
| 4321 | halStatus = eHAL_STATUS_FAILURE; |
| 4322 | } |
| 4323 | break; |
| 4324 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 4325 | /* This event is to notify handover success. |
| 4326 | It will be only invoked on success */ |
| 4327 | if (VOS_STATUS_SUCCESS != |
| 4328 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, pRoamInfo)) |
| 4329 | { |
| 4330 | halStatus = eHAL_STATUS_FAILURE; |
| 4331 | } |
| 4332 | break; |
| 4333 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4334 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 4335 | hdd_remainChanReadyHandler( pAdapter ); |
| 4336 | break; |
| 4337 | case eCSR_ROAM_SEND_ACTION_CNF: |
| 4338 | hdd_sendActionCnf( pAdapter, |
| 4339 | (roamResult == eCSR_ROAM_RESULT_NONE) ? TRUE : FALSE ); |
| 4340 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4341 | #ifdef FEATURE_WLAN_TDLS |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 4342 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 4343 | halStatus = hdd_RoamTdlsStatusUpdateHandler( pAdapter, pRoamInfo, |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 4344 | roamId, roamStatus, roamResult ); |
| 4345 | break ; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 4346 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 4347 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, pRoamInfo->reasonCode); |
| 4348 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4349 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4350 | #ifdef WLAN_FEATURE_11W |
| 4351 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 4352 | hdd_indicateUnprotMgmtFrame(pAdapter, pRoamInfo->nFrameLength, |
| 4353 | pRoamInfo->pbFrames, |
| 4354 | pRoamInfo->frameType); |
| 4355 | break; |
| 4356 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4357 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4358 | case eCSR_ROAM_TSM_IE_IND: |
| 4359 | hdd_indicateTsmIe(pAdapter, pRoamInfo->tsmIe.tsid, |
| 4360 | pRoamInfo->tsmIe.state, pRoamInfo->tsmIe.msmt_interval); |
| 4361 | break; |
| 4362 | |
| 4363 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 4364 | { |
| 4365 | if (eCSR_AUTH_TYPE_CCKM_WPA == pHddStaCtx->conn_info.authType || |
| 4366 | eCSR_AUTH_TYPE_CCKM_RSN == pHddStaCtx->conn_info.authType) |
| 4367 | { |
| 4368 | hdd_indicateCckmPreAuth(pAdapter, pRoamInfo); |
| 4369 | } |
| 4370 | break; |
| 4371 | } |
| 4372 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4373 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4374 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4375 | hdd_indicateEseAdjApRepInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4376 | break; |
| 4377 | } |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4378 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4379 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4380 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4381 | hdd_indicateEseBcnReportInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4382 | break; |
| 4383 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4384 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Girish Gowli | a95daca | 2015-02-04 20:31:31 +0530 | [diff] [blame] | 4385 | case eCSR_ROAM_UPDATE_MAX_RATE_IND: |
| 4386 | { |
| 4387 | pAdapter->maxRateFlags = roamResult; |
| 4388 | break; |
| 4389 | } |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4390 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 4391 | if (pRoamInfo && pRoamInfo->pBssDesc) { |
| 4392 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 4393 | pRoamInfo->pBssDesc); |
| 4394 | if (bss_status) |
| 4395 | cfg80211_put_bss( |
| 4396 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 4397 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 4398 | #endif |
| 4399 | bss_status); |
| 4400 | else |
| 4401 | hddLog(LOG1, FL("UPDATE_SCAN_RESULT returned NULL")); |
| 4402 | } |
Abhinav Kumar | 118efd0 | 2019-08-07 16:41:07 +0530 | [diff] [blame] | 4403 | |
| 4404 | case eCSR_ROAM_SAE_COMPUTE: |
| 4405 | if (pRoamInfo) |
| 4406 | wlan_hdd_sae_callback(pAdapter, pRoamInfo); |
| 4407 | break; |
| 4408 | |
Ganesh Kondabattini | 529397f | 2017-12-27 19:13:52 +0530 | [diff] [blame] | 4409 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
| 4410 | { |
| 4411 | hdd_adapter_t *pHostapdAdapter = NULL; |
| 4412 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4413 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4414 | |
| 4415 | if (!pHddCtx || !pHddStaCtx) { |
| 4416 | hddLog(LOG1, FL("Invalid pHddCtx or pHddStaCtx")); |
| 4417 | break; |
| 4418 | } |
| 4419 | |
| 4420 | hddLog(LOG1, FL("eCSR_ROAM_STA_CHANNEL_SWITCH: new channel %hu"), |
| 4421 | pRoamInfo->chan_info.chan_id); |
| 4422 | |
| 4423 | pHddStaCtx->conn_info.operationChannel = |
| 4424 | pRoamInfo->chan_info.chan_id; |
| 4425 | |
| 4426 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 4427 | if (pHostapdAdapter && |
| 4428 | (test_bit(SOFTAP_BSS_STARTED, |
| 4429 | &pHostapdAdapter->event_flags))) |
| 4430 | { |
| 4431 | /* Restart SAP if its operating channel is different |
| 4432 | * from AP channel. |
| 4433 | */ |
| 4434 | hddLog(VOS_TRACE_LEVEL_INFO,"SAP chan %d, STA chan %d, force_scc_with_ecsa %d", |
| 4435 | pHostapdAdapter->sessionCtx.ap.operatingChannel, |
| 4436 | pRoamInfo->chan_info.chan_id, |
| 4437 | pHddCtx->cfg_ini->force_scc_with_ecsa); |
| 4438 | if ((pHddCtx->cfg_ini->force_scc_with_ecsa ) && |
| 4439 | (pHostapdAdapter->sessionCtx.ap.operatingChannel != |
| 4440 | pRoamInfo->chan_info.chan_id)) |
| 4441 | { |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 4442 | schedule_delayed_work(&pHddCtx->ecsa_chan_change_work, 0); |
Ganesh Kondabattini | 529397f | 2017-12-27 19:13:52 +0530 | [diff] [blame] | 4443 | } |
| 4444 | else |
| 4445 | hddLog(LOG1, FL("SAP restart not required")); |
| 4446 | } else |
| 4447 | hddLog(LOG1, FL("SAP not active, nothing to do")); |
| 4448 | } |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4449 | break; |
Girish Gowli | a95daca | 2015-02-04 20:31:31 +0530 | [diff] [blame] | 4450 | default: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4451 | break; |
| 4452 | } |
| 4453 | return( halStatus ); |
| 4454 | } |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 4455 | |
| 4456 | #ifdef WLAN_FEATURE_SAE |
| 4457 | /** |
| 4458 | * hdd_translate_sae_rsn_to_csr_auth() - Translate SAE RSN to CSR auth type |
| 4459 | * @auth_suite: auth suite |
| 4460 | * @auth_type: pointer to eCsrAuthType |
| 4461 | * |
| 4462 | * Return: None |
| 4463 | */ |
| 4464 | static void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4465 | eCsrAuthType *auth_type) |
| 4466 | { |
| 4467 | if (!memcmp(auth_suite, ccp_rsn_oui_80, 4)) |
| 4468 | *auth_type = eCSR_AUTH_TYPE_SAE; |
| 4469 | } |
| 4470 | #else |
| 4471 | static inline |
| 4472 | void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4473 | eCsrAuthType *auth_type) |
| 4474 | { |
| 4475 | } |
| 4476 | #endif |
| 4477 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4478 | eCsrAuthType hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4479 | { |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 4480 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4481 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4482 | if ( memcmp(auth_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4483 | { |
| 4484 | auth_type = eCSR_AUTH_TYPE_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4485 | } else |
| 4486 | if (memcmp(auth_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4487 | { |
| 4488 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4489 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4490 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4491 | if (memcmp(auth_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4492 | { |
| 4493 | // Check for 11r FT Authentication with PSK |
| 4494 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4495 | } else |
| 4496 | if (memcmp(auth_suite , ccpRSNOui03, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4497 | { |
| 4498 | // Check for 11R FT Authentication with 802.1X |
| 4499 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4500 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4501 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4502 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4503 | if (memcmp(auth_suite , ccpRSNOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4504 | { |
| 4505 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 4506 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4507 | #endif /* FEATURE_WLAN_ESE */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4508 | #ifdef WLAN_FEATURE_11W |
| 4509 | if (memcmp(auth_suite , ccpRSNOui07, 4) == 0) |
| 4510 | { |
| 4511 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 4512 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 4513 | if (memcmp(auth_suite , ccpRSNOui08, 4) == 0) |
| 4514 | { |
| 4515 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 4516 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4517 | #endif |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 4518 | if (!memcmp(auth_suite, ccp_rsn_oui_18, 4)) |
| 4519 | { |
| 4520 | auth_type = eCSR_AUTH_TYPE_OWE; |
| 4521 | } else |
| 4522 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4523 | { |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 4524 | /* If auth suite is of SAE, auth_type will be |
| 4525 | * overwritten in hdd_translate_sae_rsn_to_csr_auth |
| 4526 | */ |
| 4527 | hdd_translate_sae_rsn_to_csr_auth(auth_suite, &auth_type); |
| 4528 | } |
| 4529 | |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 4530 | hddLog(LOG1, FL("auth_type : %d"), auth_type); |
| 4531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4532 | return auth_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4533 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4534 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4535 | eCsrAuthType |
| 4536 | hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4537 | { |
| 4538 | eCsrAuthType auth_type; |
| 4539 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4540 | if ( memcmp(auth_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4541 | { |
| 4542 | auth_type = eCSR_AUTH_TYPE_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4543 | } else |
| 4544 | if (memcmp(auth_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4545 | { |
| 4546 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4547 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4548 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4549 | if (memcmp(auth_suite , ccpWpaOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4550 | { |
| 4551 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4552 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4553 | #endif /* FEATURE_WLAN_ESE */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4554 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4555 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 4556 | } |
| 4557 | hddLog(LOG1, FL("auth_type: %d"), auth_type); |
| 4558 | return auth_type; |
| 4559 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4560 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4561 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4562 | hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4563 | { |
| 4564 | eCsrEncryptionType cipher_type; |
| 4565 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4566 | if ( memcmp(cipher_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4567 | { |
| 4568 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4569 | } |
| 4570 | else if (memcmp(cipher_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4571 | { |
| 4572 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4573 | } |
| 4574 | else if (memcmp(cipher_suite , ccpRSNOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4575 | { |
| 4576 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4577 | } |
| 4578 | else if (memcmp(cipher_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4579 | { |
| 4580 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4581 | } |
| 4582 | else if (memcmp(cipher_suite , ccpRSNOui05, 4) == 0) |
| 4583 | { |
| 4584 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4585 | } |
| 4586 | else |
| 4587 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4588 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4589 | } |
| 4590 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 4591 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4592 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4593 | /* To find if the MAC address is NULL */ |
| 4594 | static tANI_U8 hdd_IsMACAddrNULL (tANI_U8 *macAddr, tANI_U8 length) |
| 4595 | { |
| 4596 | int i; |
| 4597 | for (i = 0; i < length; i++) |
| 4598 | { |
| 4599 | if (0x00 != (macAddr[i])) |
| 4600 | { |
| 4601 | return FALSE; |
| 4602 | } |
| 4603 | } |
| 4604 | return TRUE; |
| 4605 | } /****** end hdd_IsMACAddrNULL() ******/ |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4606 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4607 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4608 | hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4609 | { |
| 4610 | eCsrEncryptionType cipher_type; |
| 4611 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4612 | if ( memcmp(cipher_suite , ccpWpaOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4613 | { |
| 4614 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4615 | } else |
| 4616 | if (memcmp(cipher_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4617 | { |
| 4618 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4619 | } else |
| 4620 | if (memcmp(cipher_suite , ccpWpaOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4621 | { |
| 4622 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4623 | } else |
| 4624 | if (memcmp(cipher_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4625 | { |
| 4626 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4627 | } else |
| 4628 | if (memcmp(cipher_suite , ccpWpaOui05, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4629 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4630 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4631 | } else |
| 4632 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4633 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4634 | } |
| 4635 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 4636 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4637 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4638 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4639 | static tANI_S32 hdd_ProcessGENIE(hdd_adapter_t *pAdapter, |
| 4640 | struct ether_addr *pBssid, |
| 4641 | eCsrEncryptionType *pEncryptType, |
| 4642 | eCsrEncryptionType *mcEncryptType, |
| 4643 | eCsrAuthType *pAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4644 | #ifdef WLAN_FEATURE_11W |
| 4645 | u_int8_t *pMfpRequired, |
| 4646 | u_int8_t *pMfpCapable, |
| 4647 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4648 | u_int16_t gen_ie_len, |
| 4649 | u_int8_t *gen_ie) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4650 | { |
| 4651 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4652 | eHalStatus result; |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4653 | tDot11fIERSN dot11RSNIE = {0}; |
| 4654 | tDot11fIEWPA dot11WPAIE = {0}; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4655 | tANI_U32 i; |
Ashish Kumar Dhanotiya | ffbfd8c | 2017-11-29 14:04:38 +0530 | [diff] [blame] | 4656 | tANI_U32 status; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4657 | tANI_U8 *pRsnIe; |
| 4658 | tANI_U16 RSNIeLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4659 | tPmkidCacheInfo PMKIDCache[4]; // Local transfer memory |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4660 | v_BOOL_t updatePMKCache = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4661 | |
| 4662 | /* Clear struct of tDot11fIERSN and tDot11fIEWPA specifically setting present |
| 4663 | flag to 0 */ |
| 4664 | memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) ); |
| 4665 | memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) ); |
gaurank kathpalia | b654f70 | 2020-01-03 15:07:17 +0530 | [diff] [blame] | 4666 | memset( PMKIDCache, 0 , sizeof(tPmkidCacheInfo) * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4667 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4668 | // Type check |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4669 | if ( gen_ie[0] == DOT11F_EID_RSN) |
| 4670 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4671 | // Validity checks |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4672 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4673 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) ) |
| 4674 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4675 | hddLog(LOGE, "%s: Invalid DOT11F RSN IE length :%d\n", |
| 4676 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4677 | return -EINVAL; |
| 4678 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4679 | // Skip past the EID byte and length byte |
| 4680 | pRsnIe = gen_ie + 2; |
| 4681 | RSNIeLen = gen_ie_len - 2; |
| 4682 | // Unpack the RSN IE |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4683 | status = sme_unpack_rsn_ie(halHandle, |
| 4684 | pRsnIe, |
| 4685 | RSNIeLen, |
| 4686 | &dot11RSNIE); |
Ashish Kumar Dhanotiya | ffbfd8c | 2017-11-29 14:04:38 +0530 | [diff] [blame] | 4687 | if (DOT11F_FAILED(status)) |
| 4688 | { |
| 4689 | hddLog(LOGE, |
| 4690 | FL("Parse failure in hdd_ProcessGENIE (0x%08x)"), |
| 4691 | status); |
| 4692 | return -EINVAL; |
| 4693 | } |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4694 | hddLog(LOG1, FL("%s: gp_cipher_suite_present: %d"), |
| 4695 | __func__, dot11RSNIE.gp_cipher_suite_present); |
| 4696 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4697 | // Copy out the encryption and authentication types |
| 4698 | hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4699 | __func__, dot11RSNIE.pwise_cipher_suite_count ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4700 | hddLog(LOG1, FL("%s: authentication suite count: %d"), |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4701 | __func__, dot11RSNIE.akm_suite_cnt); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4702 | /*Here we have followed the apple base code, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4703 | but probably I suspect we can do something different*/ |
| 4704 | //dot11RSNIE.akm_suite_count |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4705 | // Just translate the FIRST one |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4706 | *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suite[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4707 | //dot11RSNIE.pwise_cipher_suite_count |
| 4708 | *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]); |
| 4709 | //dot11RSNIE.gp_cipher_suite_count |
| 4710 | *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4711 | #ifdef WLAN_FEATURE_11W |
| 4712 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1 ; |
| 4713 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1 ; |
| 4714 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4715 | // Set the PMKSA ID Cache for this interface |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4716 | for (i=0; i<dot11RSNIE.pmkid_count; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4717 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4718 | if ( pBssid == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4719 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4720 | hddLog(LOGE, "%s: pBssid passed is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4721 | break; |
| 4722 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4723 | if ( hdd_IsMACAddrNULL( (u_char *) pBssid->ether_addr_octet , 6)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4724 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4725 | hddLog(LOGE, "%s: Invalid MAC adrr", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4726 | break; |
| 4727 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4728 | updatePMKCache = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4729 | // For right now, I assume setASSOCIATE() has passed in the bssid. |
| 4730 | vos_mem_copy(PMKIDCache[i].BSSID, |
| 4731 | pBssid, ETHER_ADDR_LEN); |
| 4732 | vos_mem_copy(PMKIDCache[i].PMKID, |
| 4733 | dot11RSNIE.pmkid[i], |
| 4734 | CSR_RSN_PMKID_SIZE); |
| 4735 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4736 | |
| 4737 | if (updatePMKCache) |
| 4738 | { |
| 4739 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4740 | hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with cache entry %d."), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4741 | __func__, i ); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4742 | // Finally set the PMKSA ID Cache in CSR |
| 4743 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
| 4744 | PMKIDCache, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 4745 | dot11RSNIE.pmkid_count, |
| 4746 | FALSE); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4747 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4748 | } |
| 4749 | else if (gen_ie[0] == DOT11F_EID_WPA) |
| 4750 | { |
| 4751 | // Validity checks |
| 4752 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) || |
| 4753 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) |
| 4754 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4755 | hddLog(LOGE, "%s: Invalid DOT11F WPA IE length :%d\n", |
| 4756 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4757 | return -EINVAL; |
| 4758 | } |
| 4759 | // Skip past the EID byte and length byte - and four byte WiFi OUI |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4760 | pRsnIe = gen_ie + 2 + 4; |
| 4761 | RSNIeLen = gen_ie_len - (2 + 4); |
| 4762 | // Unpack the WPA IE |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4763 | status = dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4764 | pRsnIe, RSNIeLen, &dot11WPAIE); |
| 4765 | if (!DOT11F_SUCCEEDED(status)) |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4766 | { |
| 4767 | hddLog(LOGE, |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4768 | FL("Invalid RSN IE: parse status %d"), status); |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4769 | return -EINVAL; |
| 4770 | } |
| 4771 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4772 | // Copy out the encryption and authentication types |
| 4773 | hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4774 | __func__, dot11WPAIE.unicast_cipher_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4775 | hddLog(LOG1, FL("%s: WPA authentication suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4776 | __func__, dot11WPAIE.auth_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4777 | //dot11WPAIE.auth_suite_count |
| 4778 | // Just translate the FIRST one |
| 4779 | *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]); |
| 4780 | //dot11WPAIE.unicast_cipher_count |
| 4781 | *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]); |
| 4782 | //dot11WPAIE.unicast_cipher_count |
| 4783 | *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 4784 | } |
| 4785 | else |
| 4786 | { |
| 4787 | hddLog(LOGW, FL("gen_ie[0]: %d"), gen_ie[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4788 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4789 | } |
| 4790 | return 0; |
| 4791 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4792 | |
| 4793 | /** |
| 4794 | * hdd_set_def_rsne_override() - set default encryption type and auth type |
| 4795 | * in profile. |
| 4796 | * @roam_profile: pointer to adapter |
| 4797 | * @auth_type: pointer to auth type |
| 4798 | * |
| 4799 | * Set default value of encryption type and auth type in profile to |
| 4800 | * search the AP using filter, as in force_rsne_override the RSNIE can be |
| 4801 | * currupt and we might not get the proper encryption type and auth type |
| 4802 | * while parsing the RSNIE. |
| 4803 | * |
| 4804 | * Return: void |
| 4805 | */ |
| 4806 | static void hdd_set_def_rsne_override( |
| 4807 | tCsrRoamProfile *roam_profile, eCsrAuthType *auth_type) |
| 4808 | { |
| 4809 | hddLog( LOG1, FL("Set def values in roam profile")); |
| 4810 | roam_profile->MFPCapable = roam_profile->MFPEnabled; |
| 4811 | roam_profile->EncryptionType.numEntries = 2; |
| 4812 | roam_profile->mcEncryptionType.numEntries = 2; |
| 4813 | /* Use the cipher type in the RSN IE */ |
| 4814 | roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; |
| 4815 | roam_profile->EncryptionType.encryptionType[1] = eCSR_ENCRYPT_TYPE_TKIP; |
| 4816 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 4817 | eCSR_ENCRYPT_TYPE_AES; |
| 4818 | roam_profile->mcEncryptionType.encryptionType[1] = |
| 4819 | eCSR_ENCRYPT_TYPE_TKIP; |
| 4820 | *auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
| 4821 | } |
| 4822 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4823 | int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 4824 | { |
| 4825 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4826 | v_U32_t status = 0; |
| 4827 | eCsrEncryptionType RSNEncryptType; |
| 4828 | eCsrEncryptionType mcRSNEncryptType; |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4829 | hdd_context_t *hdd_ctx; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4830 | #ifdef WLAN_FEATURE_11W |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4831 | u_int8_t RSNMfpRequired = 0; |
| 4832 | u_int8_t RSNMfpCapable = 0; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4833 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4834 | struct ether_addr bSsid; // MAC address of assoc peer |
| 4835 | // MAC address of assoc peer |
| 4836 | // But, this routine is only called when we are NOT associated. |
| 4837 | vos_mem_copy(bSsid.ether_addr_octet, |
| 4838 | pWextState->roamProfile.BSSIDs.bssid, |
| 4839 | sizeof(bSsid.ether_addr_octet)); |
| 4840 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) |
| 4841 | { |
| 4842 | //continue |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4843 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4844 | else |
| 4845 | { |
| 4846 | return 0; |
| 4847 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4848 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4849 | // The actual processing may eventually be more extensive than this. |
| 4850 | // Right now, just consume any PMKIDs that are sent in by the app. |
| 4851 | status = hdd_ProcessGENIE(pAdapter, |
| 4852 | &bSsid, // MAC address of assoc peer |
| 4853 | &RSNEncryptType, |
| 4854 | &mcRSNEncryptType, |
| 4855 | RSNAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4856 | #ifdef WLAN_FEATURE_11W |
| 4857 | &RSNMfpRequired, |
| 4858 | &RSNMfpCapable, |
| 4859 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4860 | pWextState->WPARSNIE[1]+2, |
| 4861 | pWextState->WPARSNIE); |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4863 | if (status == 0) |
| 4864 | { |
| 4865 | // Now copy over all the security attributes you have parsed out |
| 4866 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 4867 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4868 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4869 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; // Use the cipher type in the RSN IE |
| 4870 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = mcRSNEncryptType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4871 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 4872 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && |
| 4873 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
| 4874 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) |
| 4875 | { |
| 4876 | /*For wpa none supplicant sends the WPA IE with unicast cipher as |
| 4877 | eCSR_ENCRYPT_TYPE_NONE ,where as the multicast cipher as |
| 4878 | either AES/TKIP based on group cipher configuration |
| 4879 | mentioned in the wpa_supplicant.conf.*/ |
| 4880 | |
| 4881 | /*Set the unicast cipher same as multicast cipher*/ |
| 4882 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 4883 | = mcRSNEncryptType; |
| 4884 | } |
| 4885 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4886 | #ifdef WLAN_FEATURE_11W |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4887 | hddLog( LOG1, FL("RSNMfpRequired = %d, RSNMfpCapable = %d"), |
| 4888 | RSNMfpRequired, RSNMfpCapable); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4889 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 4890 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 4891 | #endif |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4892 | hddLog( LOG1, |
| 4893 | FL("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d"), |
| 4894 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4895 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4896 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4897 | |
| 4898 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4899 | if (hdd_ctx->force_rsne_override && |
| 4900 | (pWextState->WPARSNIE[0] == DOT11F_EID_RSN)) { |
| 4901 | hddLog(LOG1, |
| 4902 | FL("Test mode enabled set def Auth and enc type. RSN IE passed in connect req:")); |
| 4903 | vos_trace_hex_dump(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4904 | pWextState->roamProfile.pRSNReqIE, |
| 4905 | pWextState->roamProfile.nRSNReqIELength); |
| 4906 | |
| 4907 | pWextState->roamProfile.force_rsne_override = true; |
| 4908 | hddLog(LOG1, |
| 4909 | FL("MFPEnabled %d"), pWextState->roamProfile.MFPEnabled); |
| 4910 | /* |
| 4911 | * Reset MFPEnabled if testmode RSNE passed doesnt have MFPR |
| 4912 | * or MFPC bit set |
| 4913 | */ |
| 4914 | if (pWextState->roamProfile.MFPEnabled && |
| 4915 | !(pWextState->roamProfile.MFPRequired || |
| 4916 | pWextState->roamProfile.MFPCapable)) { |
| 4917 | hddLog( LOG1,FL("Reset MFPEnabled")); |
| 4918 | pWextState->roamProfile.MFPEnabled = 0; |
| 4919 | } |
| 4920 | |
| 4921 | /* If parsing failed set the def value for the roam profile */ |
| 4922 | if (status) |
| 4923 | hdd_set_def_rsne_override(&pWextState->roamProfile, |
| 4924 | RSNAuthType); |
| 4925 | } |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4926 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4927 | } |
| 4928 | int hdd_set_csr_auth_type ( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 4929 | { |
| 4930 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4931 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 4932 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4933 | ENTER(); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4934 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4935 | pRoamProfile->AuthType.numEntries = 1; |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 4936 | hddLog( LOG1, |
Abhinav Kumar | 2184e16 | 2019-09-16 15:02:24 +0530 | [diff] [blame] | 4937 | "%s: authType = %d RSNAuthType %d wpa_versions %d key_mgmt : 0x%x", |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 4938 | __func__, pHddStaCtx->conn_info.authType, RSNAuthType, |
Abhinav Kumar | 2184e16 | 2019-09-16 15:02:24 +0530 | [diff] [blame] | 4939 | pWextState->wpaVersion, pWextState->authKeyMgmt); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4940 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4941 | switch( pHddStaCtx->conn_info.authType) |
| 4942 | { |
| 4943 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
Abhinav Kumar | 62801ba | 2018-09-19 12:14:14 +0530 | [diff] [blame] | 4944 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4945 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4946 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 4947 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 4948 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4949 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 4950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4951 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4952 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4953 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4954 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4955 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4956 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 4957 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4958 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4959 | hddLog( LOG1, "%s: set authType to CCKM WPA. AKM also 802.1X.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4960 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
| 4961 | } else |
| 4962 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4963 | hddLog( LOG1, "%s: Last chance to set authType to CCKM WPA.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4964 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4965 | } else |
| 4966 | #endif |
| 4967 | if((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4968 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4969 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA; |
| 4970 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4971 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 4972 | == IW_AUTH_KEY_MGMT_PSK) { |
| 4973 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4974 | } else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4975 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4976 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4977 | } |
| 4978 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4979 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4980 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 4981 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4982 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4983 | hddLog( LOG1, "%s: set authType to CCKM RSN. AKM also 802.1X.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4984 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4985 | } else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4986 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4987 | hddLog( LOG1, "%s: Last chance to set authType to CCKM RSN.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4988 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4989 | } else |
| 4990 | #endif |
| 4991 | |
| 4992 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4993 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 4994 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4995 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4996 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4997 | }else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4998 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4999 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5000 | == IW_AUTH_KEY_MGMT_PSK)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5001 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5002 | } else |
| 5003 | #endif |
| 5004 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5005 | #ifdef WLAN_FEATURE_11W |
| 5006 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 5007 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5008 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 5009 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 5010 | pRoamProfile->AuthType.authType[0] = |
| 5011 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5012 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5013 | #endif |
Abhinav Kumar | a428218 | 2019-09-13 11:25:59 +0530 | [diff] [blame] | 5014 | if ((RSNAuthType == eCSR_AUTH_TYPE_SAE) && |
| 5015 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5016 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5017 | /* SAE case */ |
| 5018 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 5019 | } else |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 5020 | if ((RSNAuthType == eCSR_AUTH_TYPE_OWE) && |
| 5021 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5022 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5023 | /* OWE case */ |
| 5024 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OWE; |
| 5025 | } else |
Abhinav Kumar | 2184e16 | 2019-09-16 15:02:24 +0530 | [diff] [blame] | 5026 | if (RSNAuthType == eCSR_AUTH_TYPE_SAE) { |
| 5027 | /* SAE with open authentication case */ |
| 5028 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 5029 | } else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5030 | if( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5031 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5032 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN; |
| 5033 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5034 | if ( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5035 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5036 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK; |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 5037 | } else |
| 5038 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5039 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5040 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5041 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5042 | break; |
| 5043 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5044 | case eCSR_AUTH_TYPE_SHARED_KEY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5045 | |
| 5046 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5047 | break; |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 5048 | case eCSR_AUTH_TYPE_SAE: |
| 5049 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 5050 | break; |
| 5051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5052 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5053 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5054 | #ifdef FEATURE_WLAN_ESE |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5055 | hddLog( LOG1, "%s: In default, unknown auth type.", __func__); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5056 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5057 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5058 | break; |
| 5059 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5061 | hddLog( LOG1, "%s Set roam Authtype to %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5062 | __func__, pWextState->roamProfile.AuthType.authType[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5063 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5064 | EXIT(); |
| 5065 | return 0; |
| 5066 | } |
| 5067 | |
Sravan Kumar Kairam | 091e5b6 | 2017-01-23 14:14:20 +0530 | [diff] [blame] | 5068 | /** |
| 5069 | * hdd_rx_fwd_eapol() - forward cached eapol frames |
| 5070 | * @vosContext : pointer to vos global context |
| 5071 | * @pVosPacket: pointer to vos packet |
| 5072 | * |
| 5073 | * Return: None |
| 5074 | * |
| 5075 | */ |
| 5076 | void hdd_assoc_registerFwdEapolCB(void *pContext) |
| 5077 | { |
| 5078 | WLANTL_RegisterFwdEapol(pContext, hdd_rx_fwd_eapol); |
| 5079 | } |
| 5080 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5081 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5082 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5083 | \brief __iw_set_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5084 | This function sets the ssid received from wpa_supplicant |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5085 | to the CSR roam profile. |
| 5086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5087 | \param - dev - Pointer to the net device. |
| 5088 | - info - Pointer to the iw_request_info. |
| 5089 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5090 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5091 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5092 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5093 | --------------------------------------------------------------------------*/ |
| 5094 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5095 | int __iw_set_essid(struct net_device *dev, |
| 5096 | struct iw_request_info *info, |
| 5097 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5098 | { |
| 5099 | v_U32_t status = 0; |
| 5100 | hdd_wext_state_t *pWextState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5101 | hdd_adapter_t *pAdapter; |
| 5102 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5103 | v_U32_t roamId; |
| 5104 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5105 | eCsrAuthType RSNAuthType; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5106 | tHalHandle hHal; |
| 5107 | hdd_station_ctx_t *pHddStaCtx; |
| 5108 | int ret = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5109 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5110 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5111 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5112 | if (NULL == pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5113 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5114 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5115 | "%s: Adapter is NULL",__func__); |
| 5116 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5117 | } |
| 5118 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5119 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5120 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5121 | if (0 != ret) |
| 5122 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5123 | return ret; |
| 5124 | } |
| 5125 | |
| 5126 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5127 | if (NULL == hHal) |
| 5128 | { |
| 5129 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5130 | "%s: Hal Context is NULL",__func__); |
| 5131 | return -EINVAL; |
| 5132 | } |
| 5133 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5134 | if (NULL == pHddStaCtx) |
| 5135 | { |
| 5136 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5137 | "%s: STA Context is NULL",__func__); |
| 5138 | return -EINVAL; |
| 5139 | } |
| 5140 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5141 | if (NULL == pWextState) |
| 5142 | { |
| 5143 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5144 | "%s: pWextState is NULL",__func__); |
| 5145 | return -EINVAL; |
| 5146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5147 | if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
| 5148 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__); |
| 5149 | return -EBUSY; |
| 5150 | } |
| 5151 | if( SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length ) |
| 5152 | return -EINVAL; |
| 5153 | pRoamProfile = &pWextState->roamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5154 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5155 | if (wlan_hdd_check_and_stop_mon(pAdapter, true)) |
| 5156 | return -EINVAL; |
| 5157 | |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 5158 | /*Try disconnecting if already in connected state*/ |
| 5159 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5160 | if (0 > status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5161 | { |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 5162 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 5163 | " connection")); |
| 5164 | return -EALREADY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5165 | } |
| 5166 | /** wpa_supplicant 0.8.x, wext driver uses */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5167 | /** when cfg80211 defined, wpa_supplicant wext driver uses |
| 5168 | zero-length, null-string ssid for force disconnection. |
| 5169 | after disconnection (if previously connected) and cleaning ssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5170 | driver MUST return success */ |
| 5171 | if ( 0 == wrqu->essid.length ) { |
| 5172 | return 0; |
| 5173 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5174 | |
| 5175 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5176 | &pWextState->roamProfile.uapsd_mask); |
| 5177 | if (VOS_STATUS_SUCCESS != status) |
| 5178 | { |
| 5179 | pWextState->roamProfile.uapsd_mask = 0; |
| 5180 | } |
| 5181 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5182 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5183 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = wrqu->essid.length; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5184 | |
| 5185 | vos_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5186 | vos_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId), extra, wrqu->essid.length); |
| 5187 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion || |
| 5188 | IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion ) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5189 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5190 | //set gen ie |
| 5191 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 5192 | |
| 5193 | //set auth |
| 5194 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5195 | } |
| 5196 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5197 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5198 | if (pAdapter->wapi_info.nWapiMode) |
| 5199 | { |
| 5200 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 5201 | { |
| 5202 | case WAPI_AUTH_MODE_PSK: |
| 5203 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5204 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, pAdapter->wapi_info.wapiAuthMode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5205 | pRoamProfile->AuthType.numEntries = 1; |
| 5206 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5207 | break; |
| 5208 | } |
| 5209 | case WAPI_AUTH_MODE_CERT: |
| 5210 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5211 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, pAdapter->wapi_info.wapiAuthMode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5212 | pRoamProfile->AuthType.numEntries = 1; |
| 5213 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5214 | break; |
| 5215 | } |
| 5216 | } // End of switch |
| 5217 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5218 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 5219 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5220 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5221 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5222 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5223 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5224 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5225 | } |
| 5226 | } |
| 5227 | #endif /* FEATURE_WLAN_WAPI */ |
| 5228 | /* if previous genIE is not NULL, update AssocIE */ |
| 5229 | if (0 != pWextState->genIE.length) |
| 5230 | { |
| 5231 | memset( &pWextState->assocAddIE, 0, sizeof(pWextState->assocAddIE) ); |
| 5232 | memcpy( pWextState->assocAddIE.addIEdata, pWextState->genIE.addIEdata, |
| 5233 | pWextState->genIE.length); |
| 5234 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5235 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5236 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5237 | |
| 5238 | /* clear previous genIE after use it */ |
| 5239 | memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) ); |
| 5240 | } |
| 5241 | |
| 5242 | /* assumes it is not WPS Association by default, except when pAddIEAssoc has WPS IE */ |
| 5243 | pWextState->roamProfile.bWPSAssociation = FALSE; |
| 5244 | |
| 5245 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5246 | pWextState->roamProfile.nAddIEAssocLength)) |
| 5247 | pWextState->roamProfile.bWPSAssociation = TRUE; |
| 5248 | |
| 5249 | |
| 5250 | // Disable auto BMPS entry by PMC until DHCP is done |
| 5251 | sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), TRUE); |
| 5252 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5253 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5254 | (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5255 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5256 | if ( eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType ) |
| 5257 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5258 | hdd_select_cbmode(pAdapter, |
| 5259 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->AdHocChannel5G); |
| 5260 | } |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 5261 | /* |
| 5262 | * Change conn_state to connecting before sme_RoamConnect(), |
| 5263 | * because sme_RoamConnect() has a direct path to call |
| 5264 | * hdd_smeRoamCallback(), which will change the conn_state |
| 5265 | * If direct path, conn_state will be accordingly changed |
| 5266 | * to NotConnected or Associated by either |
| 5267 | * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() |
| 5268 | * in sme_RoamCallback() |
| 5269 | * if sme_RomConnect is to be queued, |
| 5270 | * Connecting state will remain until it is completed. |
| 5271 | * |
| 5272 | * If connection state is not changed, |
| 5273 | * connection state will remain in eConnectionState_NotConnected state. |
| 5274 | * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true |
| 5275 | * if conn state is eConnectionState_NotConnected. |
| 5276 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 5277 | * informed of connect result indication which is an issue. |
| 5278 | */ |
| 5279 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5280 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
| 5281 | { |
| 5282 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5283 | FL("Set HDD connState to eConnectionState_Connecting")); |
| 5284 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5285 | eConnectionState_Connecting); |
| 5286 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5287 | status = sme_RoamConnect( hHal,pAdapter->sessionId, |
| 5288 | &(pWextState->roamProfile), &roamId); |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 5289 | |
| 5290 | if ((eHAL_STATUS_SUCCESS != status) && |
| 5291 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5292 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5293 | { |
| 5294 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5295 | FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"), |
| 5296 | pAdapter->sessionId, status); |
| 5297 | /* change back to NotAssociated */ |
| 5298 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5299 | eConnectionState_NotConnected); |
| 5300 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5301 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5302 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5303 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5304 | EXIT(); |
| 5305 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5306 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5307 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5308 | int iw_set_essid(struct net_device *dev, |
| 5309 | struct iw_request_info *info, |
| 5310 | union iwreq_data *wrqu, char *extra) |
| 5311 | { |
| 5312 | int ret; |
| 5313 | |
| 5314 | vos_ssr_protect(__func__); |
| 5315 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 5316 | vos_ssr_unprotect(__func__); |
| 5317 | |
| 5318 | return ret; |
| 5319 | } |
| 5320 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5321 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5322 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5323 | \brief __iw_get_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5324 | This function returns the essid to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5325 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5326 | \param - dev - Pointer to the net device. |
| 5327 | - info - Pointer to the iw_request_info. |
| 5328 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5329 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5330 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5331 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5332 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5333 | int __iw_get_essid(struct net_device *dev, |
| 5334 | struct iw_request_info *info, |
| 5335 | struct iw_point *dwrq, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5336 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5337 | hdd_adapter_t *pAdapter; |
| 5338 | hdd_context_t *pHddCtx; |
| 5339 | hdd_wext_state_t *wextBuf; |
| 5340 | hdd_station_ctx_t *pHddStaCtx; |
| 5341 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5343 | ENTER(); |
| 5344 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5345 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5346 | if (NULL == pAdapter) |
| 5347 | { |
| 5348 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5349 | "%s: Adapter is NULL",__func__); |
| 5350 | return -EINVAL; |
| 5351 | } |
| 5352 | |
| 5353 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5354 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5355 | if (0 != ret) |
| 5356 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5357 | return ret; |
| 5358 | } |
| 5359 | |
| 5360 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5361 | if (NULL == pHddStaCtx) |
| 5362 | { |
| 5363 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5364 | "%s: STA Context is NULL",__func__); |
| 5365 | return -EINVAL; |
| 5366 | } |
| 5367 | |
| 5368 | wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5369 | if (NULL == wextBuf) |
| 5370 | { |
| 5371 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5372 | "%s: wextBuf is NULL",__func__); |
| 5373 | return -EINVAL; |
| 5374 | } |
| 5375 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5376 | if((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 5377 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 5378 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected || |
| 5379 | pHddStaCtx->conn_info.connState == eConnectionState_IbssDisconnected) && |
| 5380 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) |
| 5381 | { |
| 5382 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 5383 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, dwrq->length); |
| 5384 | dwrq->flags = 1; |
| 5385 | } else { |
| 5386 | memset(extra, 0, dwrq->length); |
| 5387 | dwrq->length = 0; |
| 5388 | dwrq->flags = 0; |
| 5389 | } |
| 5390 | EXIT(); |
| 5391 | return 0; |
| 5392 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5393 | |
| 5394 | int iw_get_essid(struct net_device *dev, |
| 5395 | struct iw_request_info *info, |
| 5396 | struct iw_point *dwrq, char *extra) |
| 5397 | { |
| 5398 | int ret; |
| 5399 | |
| 5400 | vos_ssr_protect(__func__); |
| 5401 | ret = __iw_get_essid(dev, info, dwrq, extra); |
| 5402 | vos_ssr_unprotect(__func__); |
| 5403 | |
| 5404 | return ret; |
| 5405 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5406 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5407 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5408 | \brief __iw_set_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5409 | This function sets the auth type received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5410 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5411 | \param - dev - Pointer to the net device. |
| 5412 | - info - Pointer to the iw_request_info. |
| 5413 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5414 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5415 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5416 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5417 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5418 | int __iw_set_auth(struct net_device *dev,struct iw_request_info *info, |
| 5419 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5420 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5421 | hdd_adapter_t *pAdapter; |
| 5422 | hdd_context_t *pHddCtx; |
| 5423 | hdd_wext_state_t *pWextState; |
| 5424 | hdd_station_ctx_t *pHddStaCtx; |
| 5425 | tCsrRoamProfile *pRoamProfile; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5426 | eCsrEncryptionType mcEncryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5427 | eCsrEncryptionType ucEncryptionType; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5428 | int ret = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5429 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5430 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5431 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5432 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5433 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5434 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5435 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5436 | "%s: Adapter is NULL",__func__); |
| 5437 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5438 | } |
| 5439 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5440 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5441 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5442 | if (0 != ret) |
| 5443 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5444 | return ret; |
| 5445 | } |
| 5446 | |
| 5447 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5448 | if (NULL == pHddStaCtx) |
| 5449 | { |
| 5450 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5451 | "%s: STA Context is NULL",__func__); |
| 5452 | return -EINVAL; |
| 5453 | } |
| 5454 | |
| 5455 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5456 | if (NULL == pWextState) |
| 5457 | { |
| 5458 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5459 | "%s: pWextState is NULL",__func__); |
| 5460 | return -EINVAL; |
| 5461 | } |
| 5462 | |
| 5463 | pRoamProfile = &pWextState->roamProfile; |
| 5464 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5465 | switch(wrqu->param.flags & IW_AUTH_INDEX) |
| 5466 | { |
| 5467 | case IW_AUTH_WPA_VERSION: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5468 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5469 | pWextState->wpaVersion = wrqu->param.value; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5471 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5472 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5473 | case IW_AUTH_CIPHER_PAIRWISE: |
| 5474 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5475 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5476 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5478 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5479 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5480 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5481 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 5482 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5483 | } |
| 5484 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5485 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5486 | |
| 5487 | if( (IW_AUTH_KEY_MGMT_802_1X |
| 5488 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5489 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) ) |
| 5490 | /*Dynamic WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5491 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5492 | else |
| 5493 | /*Static WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5494 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5495 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5496 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5497 | |
| 5498 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5499 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5500 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5501 | /*Dynamic WEP key*/ |
| 5502 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 5503 | else |
| 5504 | /*Static WEP key*/ |
| 5505 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5506 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5507 | } |
| 5508 | else { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5509 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5510 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5511 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5512 | return -EINVAL; |
| 5513 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5515 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5516 | pRoamProfile->EncryptionType.encryptionType[0] = ucEncryptionType; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5517 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5518 | break; |
| 5519 | case IW_AUTH_CIPHER_GROUP: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5520 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5521 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 5522 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5523 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5524 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5525 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5526 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5527 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5528 | |
| 5529 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5530 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5531 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5533 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5534 | |
| 5535 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5536 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 5537 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5538 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5539 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5540 | |
| 5541 | else |
| 5542 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5543 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5544 | |
| 5545 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) |
| 5546 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5547 | /*Dynamic WEP keys won't work with shared keys*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5548 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5549 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5550 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5551 | { |
| 5552 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 5553 | } |
| 5554 | else |
| 5555 | { |
| 5556 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5557 | } |
| 5558 | } |
| 5559 | else { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5560 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5561 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5562 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5563 | return -EINVAL; |
| 5564 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5565 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5566 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5567 | pRoamProfile->mcEncryptionType.encryptionType[0] = mcEncryptionType; |
| 5568 | } |
| 5569 | break; |
| 5570 | |
| 5571 | case IW_AUTH_80211_AUTH_ALG: |
| 5572 | { |
| 5573 | /*Save the auth algo here and set auth type to SME Roam profile |
| 5574 | in the iw_set_ap_address*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5575 | if( wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5576 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5578 | else if(wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 5579 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5580 | |
| 5581 | else if(wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 5582 | /*Not supported*/ |
| 5583 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5584 | pWextState->roamProfile.AuthType.authType[0] = pHddStaCtx->conn_info.authType; |
| 5585 | } |
| 5586 | break; |
| 5587 | |
| 5588 | case IW_AUTH_KEY_MGMT: |
| 5589 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5590 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5591 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 5592 | /*Check for CCKM AKM type */ |
| 5593 | if ( wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5594 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: CCKM AKM Set %d", |
| 5595 | __func__, wrqu->param.value); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5596 | /* Set the CCKM bit in authKeyMgmt */ |
| 5597 | /* Right now, this breaks all ref to authKeyMgmt because our |
| 5598 | * code doesn't realize it is a "bitfield" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5599 | */ |
| 5600 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 5601 | /*Set the key management to 802.1X*/ |
| 5602 | //pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5603 | pWextState->isESEConnection = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5604 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5605 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5606 | } else if ( wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 5607 | /*Save the key management*/ |
| 5608 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 5609 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 5610 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5611 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 5612 | } else if (!( wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
| 5613 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; //eCSR_AUTH_TYPE_WPA_NONE |
| 5614 | /*Save the key management anyway*/ |
| 5615 | pWextState->authKeyMgmt = wrqu->param.value; |
| 5616 | } else { // It must be IW_AUTH_KEY_MGMT_802_1X |
| 5617 | /*Save the key management*/ |
| 5618 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 5619 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 5620 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5621 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 5622 | } |
| 5623 | #else |
| 5624 | /*Save the key management*/ |
| 5625 | pWextState->authKeyMgmt = wrqu->param.value; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5626 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5627 | } |
| 5628 | break; |
| 5629 | |
| 5630 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 5631 | { |
| 5632 | if(wrqu->param.value) { |
| 5633 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5634 | "Counter Measure started %d", wrqu->param.value); |
| 5635 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED; |
| 5636 | } |
| 5637 | else { |
| 5638 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5639 | "Counter Measure stopped=%d", wrqu->param.value); |
| 5640 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED; |
| 5641 | } |
| 5642 | } |
| 5643 | break; |
| 5644 | case IW_AUTH_DROP_UNENCRYPTED: |
| 5645 | case IW_AUTH_WPA_ENABLED: |
| 5646 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 5647 | case IW_AUTH_ROAMING_CONTROL: |
| 5648 | case IW_AUTH_PRIVACY_INVOKED: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5649 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5650 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5651 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5652 | hddLog(LOGW, "%s called with unsupported auth type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5653 | wrqu->param.flags & IW_AUTH_INDEX); |
| 5654 | break; |
| 5655 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5656 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5657 | EXIT(); |
| 5658 | return 0; |
| 5659 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5660 | |
| 5661 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 5662 | union iwreq_data *wrqu, char *extra) |
| 5663 | { |
| 5664 | int ret; |
| 5665 | |
| 5666 | vos_ssr_protect(__func__); |
| 5667 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 5668 | vos_ssr_unprotect(__func__); |
| 5669 | |
| 5670 | return ret; |
| 5671 | } |
| 5672 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5673 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5674 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5675 | \brief __iw_get_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5676 | This function returns the auth type to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5677 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5678 | \param - dev - Pointer to the net device. |
| 5679 | - info - Pointer to the iw_request_info. |
| 5680 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5681 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5682 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5683 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5684 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5685 | int __iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 5686 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5687 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5688 | hdd_adapter_t* pAdapter; |
| 5689 | hdd_wext_state_t *pWextState; |
| 5690 | tCsrRoamProfile *pRoamProfile; |
| 5691 | hdd_context_t *pHddCtx; |
| 5692 | int ret = 0; |
| 5693 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5694 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5695 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5696 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5697 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5698 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5699 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5700 | "%s: Adapter is NULL",__func__); |
| 5701 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5702 | } |
| 5703 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5704 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5705 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5706 | if (0 != ret) |
| 5707 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5708 | return ret; |
| 5709 | } |
| 5710 | |
| 5711 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5712 | if (NULL == pWextState) |
| 5713 | { |
| 5714 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5715 | "%s: pWextState is NULL",__func__); |
| 5716 | return -EINVAL; |
| 5717 | } |
| 5718 | pRoamProfile = &pWextState->roamProfile; |
| 5719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5720 | switch(pRoamProfile->negotiatedAuthType) |
| 5721 | { |
| 5722 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 5723 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5724 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 5725 | break; |
| 5726 | case eCSR_AUTH_TYPE_WPA: |
| 5727 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5728 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 5729 | break; |
| 5730 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5731 | case eCSR_AUTH_TYPE_FT_RSN: |
| 5732 | #endif |
| 5733 | case eCSR_AUTH_TYPE_RSN: |
| 5734 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5735 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 5736 | break; |
| 5737 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5738 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5739 | break; |
| 5740 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5741 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 5742 | break; |
| 5743 | case eCSR_AUTH_TYPE_UNKNOWN: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5744 | hddLog(LOG1,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5745 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5746 | break; |
| 5747 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 5748 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5749 | break; |
| 5750 | case eCSR_AUTH_TYPE_WPA_PSK: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5751 | hddLog(LOG1,"%s called with WPA PSK auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5752 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5753 | return -EIO; |
| 5754 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5755 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 5756 | #endif |
| 5757 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5758 | #ifdef WLAN_FEATURE_11W |
| 5759 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 5760 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5761 | #endif |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5762 | hddLog(LOG1,"%s called with RSN PSK auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5763 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5764 | return -EIO; |
| 5765 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5766 | hddLog(LOGE,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5767 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5768 | return -EIO; |
| 5769 | } |
| 5770 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) |
| 5771 | { |
| 5772 | switch(pRoamProfile->negotiatedUCEncryptionType) |
| 5773 | { |
| 5774 | case eCSR_ENCRYPT_TYPE_NONE: |
| 5775 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 5776 | break; |
| 5777 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5778 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5779 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 5780 | break; |
| 5781 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5782 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 5783 | break; |
| 5784 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5785 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5786 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 5787 | break; |
| 5788 | case eCSR_ENCRYPT_TYPE_AES: |
| 5789 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 5790 | break; |
| 5791 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5792 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 5793 | __func__, pRoamProfile->negotiatedUCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5794 | return -EIO; |
| 5795 | } |
| 5796 | } |
| 5797 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5798 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5799 | { |
| 5800 | switch(pRoamProfile->negotiatedMCEncryptionType) |
| 5801 | { |
| 5802 | case eCSR_ENCRYPT_TYPE_NONE: |
| 5803 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 5804 | break; |
| 5805 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5806 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5807 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 5808 | break; |
| 5809 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5810 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 5811 | break; |
| 5812 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5813 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5814 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 5815 | break; |
| 5816 | case eCSR_ENCRYPT_TYPE_AES: |
| 5817 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 5818 | break; |
| 5819 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5820 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 5821 | __func__, pRoamProfile->negotiatedMCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5822 | return -EIO; |
| 5823 | } |
| 5824 | } |
| 5825 | |
| 5826 | hddLog(LOG1, "%s called with auth type %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5827 | __func__, pRoamProfile->AuthType.authType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5828 | EXIT(); |
| 5829 | return 0; |
| 5830 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5831 | |
| 5832 | int iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 5833 | union iwreq_data *wrqu,char *extra) |
| 5834 | { |
| 5835 | int ret; |
| 5836 | |
| 5837 | vos_ssr_protect(__func__); |
| 5838 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 5839 | vos_ssr_unprotect(__func__); |
| 5840 | |
| 5841 | return ret; |
| 5842 | } |
| 5843 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5844 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5845 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5846 | \brief __iw_set_ap_address() - |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5847 | This function calls the sme_RoamConnect function to associate |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5848 | to the AP with the specified BSSID received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5849 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5850 | \param - dev - Pointer to the net device. |
| 5851 | - info - Pointer to the iw_request_info. |
| 5852 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5853 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5854 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5856 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5857 | int __iw_set_ap_address(struct net_device *dev, |
| 5858 | struct iw_request_info *info, |
| 5859 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5861 | hdd_station_ctx_t *pHddStaCtx; |
| 5862 | hdd_adapter_t *pAdapter; |
| 5863 | hdd_context_t *pHddCtx; |
| 5864 | v_U8_t *pMacAddress = NULL; |
| 5865 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5867 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5868 | |
| 5869 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5870 | if (NULL == pAdapter) |
| 5871 | { |
| 5872 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5873 | "%s: Adapter is NULL", __func__); |
| 5874 | return -EINVAL; |
| 5875 | } |
| 5876 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5877 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5878 | if (0 != ret) |
| 5879 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5880 | return ret; |
| 5881 | } |
| 5882 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5883 | if (NULL == pHddStaCtx) |
| 5884 | { |
| 5885 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5886 | "%s: pHddStaCtx is NULL", __func__); |
| 5887 | return -EINVAL; |
| 5888 | } |
| 5889 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5890 | pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data; |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 5891 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s "MAC_ADDRESS_STR, |
| 5892 | __func__, MAC_ADDR_ARRAY(pMacAddress)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5893 | vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid )); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5894 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5895 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5896 | return 0; |
| 5897 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5898 | |
| 5899 | int iw_set_ap_address(struct net_device *dev, |
| 5900 | struct iw_request_info *info, |
| 5901 | union iwreq_data *wrqu, char *extra) |
| 5902 | { |
| 5903 | int ret; |
| 5904 | |
| 5905 | vos_ssr_protect(__func__); |
| 5906 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 5907 | vos_ssr_unprotect(__func__); |
| 5908 | |
| 5909 | return ret; |
| 5910 | } |
| 5911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5912 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5913 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5914 | \brief __iw_get_ap_address() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5915 | This function returns the BSSID to the wpa_supplicant |
| 5916 | \param - dev - Pointer to the net device. |
| 5917 | - info - Pointer to the iw_request_info. |
| 5918 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5919 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5920 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5921 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5922 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5923 | int __iw_get_ap_address(struct net_device *dev, |
| 5924 | struct iw_request_info *info, |
| 5925 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5926 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5927 | hdd_station_ctx_t *pHddStaCtx; |
| 5928 | hdd_adapter_t *pAdapter; |
| 5929 | hdd_context_t *pHddCtx; |
| 5930 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5931 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5932 | ENTER(); |
| 5933 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5934 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5935 | if (NULL == pAdapter) |
| 5936 | { |
| 5937 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5938 | "%s: Adapter is NULL", __func__); |
| 5939 | return -EINVAL; |
| 5940 | } |
| 5941 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5942 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5943 | if (0 != ret) |
| 5944 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5945 | return ret; |
| 5946 | } |
| 5947 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5948 | if (NULL == pHddStaCtx) |
| 5949 | { |
| 5950 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5951 | "%s: pHddStaCtx is NULL", __func__); |
| 5952 | return -EINVAL; |
| 5953 | } |
| 5954 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5955 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 5956 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 5957 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5958 | memcpy(wrqu->ap_addr.sa_data,pHddStaCtx->conn_info.bssId,ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5959 | } |
| 5960 | else |
| 5961 | { |
| 5962 | memset(wrqu->ap_addr.sa_data,0,sizeof(wrqu->ap_addr.sa_data)); |
| 5963 | } |
| 5964 | EXIT(); |
| 5965 | return 0; |
| 5966 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5967 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5968 | int iw_get_ap_address(struct net_device *dev, |
| 5969 | struct iw_request_info *info, |
| 5970 | union iwreq_data *wrqu, char *extra) |
| 5971 | { |
| 5972 | int ret; |
| 5973 | |
| 5974 | vos_ssr_protect(__func__); |
| 5975 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 5976 | vos_ssr_unprotect(__func__); |
| 5977 | |
| 5978 | return ret; |
| 5979 | } |
| 5980 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5981 | #ifdef WLAN_FEATURE_11W |
| 5982 | /**--------------------------------------------------------------------------- |
| 5983 | |
| 5984 | \brief hdd_indicateUnprotMgmtFrame - |
| 5985 | This function forwards the unprotected management frame to the supplicant |
| 5986 | \param - pAdapter - Pointer to HDD adapter |
| 5987 | - nFrameLength - Length of the unprotected frame being passed |
| 5988 | - pbFrames - Pointer to the frame buffer |
| 5989 | - frameType - 802.11 frame type |
| 5990 | \return - nothing |
| 5991 | |
| 5992 | --------------------------------------------------------------------------*/ |
| 5993 | void hdd_indicateUnprotMgmtFrame( hdd_adapter_t *pAdapter, |
| 5994 | tANI_U32 nFrameLength, |
| 5995 | tANI_U8* pbFrames, |
| 5996 | tANI_U8 frameType ) |
| 5997 | { |
| 5998 | tANI_U8 type = 0; |
| 5999 | tANI_U8 subType = 0; |
| 6000 | |
| 6001 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d", |
| 6002 | __func__, frameType, nFrameLength); |
| 6003 | |
| 6004 | /* Sanity Checks */ |
| 6005 | if (NULL == pAdapter) |
| 6006 | { |
| 6007 | hddLog( LOGE, FL("pAdapter is NULL")); |
| 6008 | return; |
| 6009 | } |
| 6010 | |
| 6011 | if (NULL == pAdapter->dev) |
| 6012 | { |
| 6013 | hddLog( LOGE, FL("pAdapter->dev is NULL")); |
| 6014 | return; |
| 6015 | } |
| 6016 | |
| 6017 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 6018 | { |
| 6019 | hddLog( LOGE, FL("pAdapter has invalid magic")); |
| 6020 | return; |
| 6021 | } |
| 6022 | |
| 6023 | if( !nFrameLength ) |
| 6024 | { |
| 6025 | hddLog( LOGE, FL("Frame Length is Invalid ZERO")); |
| 6026 | return; |
| 6027 | } |
| 6028 | |
| 6029 | if (NULL == pbFrames) { |
| 6030 | hddLog( LOGE, FL("pbFrames is NULL")); |
| 6031 | return; |
| 6032 | } |
| 6033 | |
| 6034 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 6035 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 6036 | |
| 6037 | /* Get pAdapter from Destination mac address of the frame */ |
| 6038 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) |
| 6039 | { |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6040 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 6041 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength); |
| 6042 | #else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6043 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, nFrameLength); |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6044 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6045 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 6046 | } |
| 6047 | else if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DEAUTH) |
| 6048 | { |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6049 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 6050 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength); |
| 6051 | #else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6052 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, nFrameLength); |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6053 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6054 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 6055 | } |
| 6056 | else |
| 6057 | { |
| 6058 | hddLog( LOGE, FL("Frame type %d and subtype %d are not valid"), type, subType); |
| 6059 | return; |
| 6060 | } |
| 6061 | } |
| 6062 | #endif |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6063 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6064 | #if defined (FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6065 | void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid, |
| 6066 | tANI_U8 state, |
| 6067 | tANI_U16 measInterval ) |
| 6068 | { |
| 6069 | union iwreq_data wrqu; |
| 6070 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6071 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6072 | |
| 6073 | if (NULL == pAdapter) |
| 6074 | return; |
| 6075 | |
| 6076 | // create the event |
| 6077 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6078 | memset(buf, '\0', sizeof(buf)); |
| 6079 | |
| 6080 | hddLog(VOS_TRACE_LEVEL_INFO, "TSM Ind tid(%d) state(%d) MeasInt(%d)", |
| 6081 | tid, state, measInterval); |
| 6082 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6083 | nBytes = snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d",tid,state,measInterval); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6084 | |
| 6085 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6086 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6087 | // send the event |
| 6088 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6089 | } |
| 6090 | |
| 6091 | void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 6092 | { |
| 6093 | union iwreq_data wrqu; |
| 6094 | char buf[IW_CUSTOM_MAX + 1]; |
| 6095 | char *pos = buf; |
| 6096 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6097 | |
| 6098 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6099 | return; |
| 6100 | |
| 6101 | // create the event |
| 6102 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6103 | memset(buf, '\0', sizeof(buf)); |
| 6104 | |
| 6105 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 6106 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXPREAUTHNOTIFY=%02x:%02x:%02x:%02x:%02x:%02x %u:%u", |
| 6107 | pRoamInfo->bssid[0], pRoamInfo->bssid[1], pRoamInfo->bssid[2], |
| 6108 | pRoamInfo->bssid[3], pRoamInfo->bssid[4], pRoamInfo->bssid[5], |
| 6109 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6110 | |
| 6111 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 6112 | pos += nBytes; |
| 6113 | freeBytes -= nBytes; |
| 6114 | |
| 6115 | vos_mem_copy(pos, pRoamInfo->bssid, WNI_CFG_BSSID_LEN); |
| 6116 | pos += WNI_CFG_BSSID_LEN; |
| 6117 | freeBytes -= WNI_CFG_BSSID_LEN; |
| 6118 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6119 | nBytes = snprintf(pos, freeBytes, " %u:%u", pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 6120 | freeBytes -= nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6121 | |
| 6122 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6123 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6124 | |
| 6125 | // send the event |
| 6126 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6127 | } |
| 6128 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6129 | void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6130 | { |
| 6131 | union iwreq_data wrqu; |
| 6132 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6133 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6134 | |
| 6135 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6136 | return; |
| 6137 | |
| 6138 | // create the event |
| 6139 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6140 | memset(buf, '\0', sizeof(buf)); |
| 6141 | |
| 6142 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
| 6143 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6144 | nBytes = snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6145 | |
| 6146 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6147 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6148 | |
| 6149 | // send the event |
| 6150 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6151 | } |
| 6152 | |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 6153 | void hdd_indicateEseBcnReportNoResults(const hdd_adapter_t *pAdapter, |
| 6154 | const tANI_U16 measurementToken, |
| 6155 | const tANI_BOOLEAN flag, |
| 6156 | const tANI_U8 numBss) |
| 6157 | { |
| 6158 | union iwreq_data wrqu; |
| 6159 | char buf[IW_CUSTOM_MAX]; |
| 6160 | char *pos = buf; |
| 6161 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6162 | |
| 6163 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6164 | memset(buf, '\0', sizeof(buf)); |
| 6165 | |
| 6166 | hddLog(VOS_TRACE_LEVEL_INFO, FL("CCXBCNREP=%d %d %d"), measurementToken, flag, |
| 6167 | numBss); |
| 6168 | |
| 6169 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 6170 | flag, numBss); |
| 6171 | |
| 6172 | wrqu.data.pointer = buf; |
| 6173 | wrqu.data.length = nBytes; |
| 6174 | // send the event |
| 6175 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6176 | } |
| 6177 | |
| 6178 | |
| 6179 | static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6180 | const tCsrRoamInfo *pRoamInfo) |
| 6181 | { |
| 6182 | union iwreq_data wrqu; |
| 6183 | char buf[IW_CUSTOM_MAX + 1]; |
| 6184 | char *pos = buf; |
| 6185 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6186 | tANI_U8 i = 0, len = 0; |
| 6187 | tANI_U8 tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 6188 | tANI_U8 lastSent = 0, sendBss = 0; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6189 | int bcnRepFieldSize = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0].bcnReportFields); |
| 6190 | tANI_U8 ieLenByte = 1; |
| 6191 | /* CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes */ |
| 6192 | #define ESEBCNREPHEADER_LEN (18) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6193 | |
| 6194 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6195 | return; |
| 6196 | |
| 6197 | /* Custom event can pass maximum of 256 bytes of data, |
| 6198 | based on the IE len we need to identify how many BSS info can |
| 6199 | be filled in to custom event data */ |
| 6200 | /* |
| 6201 | meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 6202 | bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 6203 | CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 6204 | */ |
| 6205 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6206 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) && (!pRoamInfo->pEseBcnReportRsp->numBss)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6207 | { |
| 6208 | hddLog(VOS_TRACE_LEVEL_INFO, "Measurement Done but no scan results"); |
| 6209 | /* If the measurement is none and no scan results found, |
| 6210 | indicate the supplicant about measurement done */ |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 6211 | hdd_indicateEseBcnReportNoResults(pAdapter, |
| 6212 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 6213 | pRoamInfo->pEseBcnReportRsp->flag, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6214 | pRoamInfo->pEseBcnReportRsp->numBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6215 | } |
| 6216 | else |
| 6217 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6218 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6219 | { |
| 6220 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6221 | memset(buf, '\0', sizeof(buf)); |
| 6222 | tot_bcn_ieLen = 0; |
| 6223 | sendBss = 0; |
| 6224 | pos = buf; |
| 6225 | freeBytes = IW_CUSTOM_MAX; |
| 6226 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6227 | for (i = lastSent; i < pRoamInfo->pEseBcnReportRsp->numBss; i++) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6228 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6229 | len = bcnRepFieldSize + ieLenByte + pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen; |
| 6230 | if ((len + tot_bcn_ieLen) > (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6231 | { |
| 6232 | break; |
| 6233 | } |
| 6234 | tot_bcn_ieLen += len; |
| 6235 | sendBss++; |
| 6236 | hddLog(VOS_TRACE_LEVEL_INFO, "i(%d) sizeof bcnReportFields(%d)" |
| 6237 | "IeLength(%d) Length of Ie(%d) totLen(%d)", |
| 6238 | i, bcnRepFieldSize, 1, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6239 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6240 | tot_bcn_ieLen); |
| 6241 | } |
| 6242 | |
| 6243 | hddLog(VOS_TRACE_LEVEL_INFO, "Sending %d BSS Info", sendBss); |
| 6244 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXBCNREP=%d %d %d %d", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6245 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 6246 | sendBss, tot_bcn_ieLen); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6247 | |
| 6248 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6249 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 6250 | sendBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6251 | pos += nBytes; |
| 6252 | freeBytes -= nBytes; |
| 6253 | |
| 6254 | /* Copy total Beacon report data length */ |
| 6255 | vos_mem_copy(pos, (char*)&tot_bcn_ieLen, sizeof(tot_bcn_ieLen)); |
| 6256 | pos += sizeof(tot_bcn_ieLen); |
| 6257 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 6258 | |
| 6259 | for (i = 0; i < sendBss; i++) |
| 6260 | { |
| 6261 | hddLog(VOS_TRACE_LEVEL_INFO, "ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 6262 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 6263 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6264 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6265 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ChanNum, |
| 6266 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Spare, |
| 6267 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.MeasDuration, |
| 6268 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.PhyType, |
| 6269 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.RecvSigPower, |
| 6270 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ParentTsf, |
| 6271 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[0], |
| 6272 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[1], |
| 6273 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.BcnInterval, |
| 6274 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.CapabilityInfo, |
| 6275 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[0], |
| 6276 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[1], |
| 6277 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[2], |
| 6278 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[3], |
| 6279 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[4], |
| 6280 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[5]); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6281 | |
| 6282 | /* bcn report fields are copied */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6283 | len = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields); |
| 6284 | vos_mem_copy(pos, (char*)&pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6285 | pos += len; |
| 6286 | freeBytes -= len; |
| 6287 | |
| 6288 | /* Add 1 byte of ie len */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6289 | len = pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].ieLen; |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6290 | vos_mem_copy(pos, (char*)&len, sizeof(len)); |
| 6291 | pos += sizeof(len); |
| 6292 | freeBytes -= sizeof(len); |
| 6293 | |
| 6294 | /* copy IE from scan results */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6295 | vos_mem_copy(pos, (char*)pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].pBuf, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6296 | pos += len; |
| 6297 | freeBytes -= len; |
| 6298 | } |
| 6299 | |
| 6300 | wrqu.data.pointer = buf; |
| 6301 | wrqu.data.length = strlen(buf); |
| 6302 | |
| 6303 | // send the event |
| 6304 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6305 | lastSent += sendBss; |
| 6306 | } |
| 6307 | } |
| 6308 | } |
| 6309 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6310 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6311 | |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 6312 | hdd_adapter_t *hdd_get_sta_connection_in_progress(hdd_context_t *hdd_ctx) |
| 6313 | { |
| 6314 | hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; |
| 6315 | hdd_adapter_t *adapter = NULL; |
| 6316 | VOS_STATUS status; |
| 6317 | hdd_station_ctx_t *hdd_sta_ctx; |
| 6318 | |
| 6319 | if (!hdd_ctx) { |
| 6320 | hddLog(LOGE, FL("HDD context is NULL")); |
| 6321 | return NULL; |
| 6322 | } |
| 6323 | |
| 6324 | status = hdd_get_front_adapter(hdd_ctx, &adapter_node); |
| 6325 | while (NULL != adapter_node && VOS_STATUS_SUCCESS == status) { |
| 6326 | adapter = adapter_node->pAdapter; |
| 6327 | if (!adapter) |
| 6328 | goto end; |
| 6329 | |
| 6330 | if ((WLAN_HDD_INFRA_STATION == adapter->device_mode) || |
| 6331 | (WLAN_HDD_P2P_CLIENT == adapter->device_mode) || |
| 6332 | (WLAN_HDD_P2P_DEVICE == adapter->device_mode)) { |
| 6333 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6334 | if (eConnectionState_Connecting == |
| 6335 | hdd_sta_ctx->conn_info.connState) { |
| 6336 | hddLog(LOG1, FL("session_id %d: Connection is in progress"), |
| 6337 | adapter->sessionId); |
| 6338 | return adapter; |
| 6339 | } else if ((eConnectionState_Associated == |
| 6340 | hdd_sta_ctx->conn_info.connState) && |
Vignesh Viswanathan | 0ac8e56 | 2018-06-14 17:24:10 +0530 | [diff] [blame] | 6341 | sme_is_sta_key_exchange_in_progress( |
| 6342 | hdd_ctx->hHal, adapter->sessionId)) { |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 6343 | hddLog(LOG1, FL("session_id %d: Key exchange is in progress"), |
| 6344 | adapter->sessionId); |
| 6345 | return adapter; |
| 6346 | } |
| 6347 | } |
| 6348 | end: |
| 6349 | status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next); |
| 6350 | adapter_node = next; |
| 6351 | } |
| 6352 | return NULL; |
| 6353 | } |
| 6354 | |