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 | |
| 954 | if (pCsrRoamInfo->nAssocRspLength == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 955 | { |
| 956 | hddLog(LOGE, |
| 957 | "%s: pCsrRoamInfo->nAssocRspLength=%d", |
| 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 | |
| 976 | // We need to send the IEs to the supplicant. |
| 977 | buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 978 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 979 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 980 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 981 | return; |
| 982 | } |
| 983 | |
| 984 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
| 985 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 986 | wrqu.data.length = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 987 | memset(buff, 0, IW_GENERIC_IE_MAX); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 988 | memcpy(buff, pFTAssocRsp, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 989 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 990 | |
| 991 | kfree(buff); |
| 992 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 993 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 994 | |
| 995 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 996 | |
| 997 | /*--------------------------------------------------- |
| 998 | * |
| 999 | * Send the FTIEs, RIC IEs during FT. This is eventually |
| 1000 | * used to send the FT events to the supplicant |
| 1001 | * |
| 1002 | * At the reception of Auth2 we send the RIC followed |
| 1003 | * by the auth response IEs to the supplicant. |
| 1004 | * Once both are received in the supplicant, an FT |
| 1005 | * event is generated to the supplicant. |
| 1006 | * |
| 1007 | *--------------------------------------------------- |
| 1008 | */ |
| 1009 | void hdd_SendFTEvent(hdd_adapter_t *pAdapter) |
| 1010 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1011 | tANI_U16 auth_resp_len = 0; |
| 1012 | tANI_U32 ric_ies_length = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1013 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1014 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 1015 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1016 | struct cfg80211_ft_event_params ftEvent; |
| 1017 | v_U8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 1018 | v_U8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 1019 | struct net_device *dev = pAdapter->dev; |
| 1020 | #else |
| 1021 | char *buff; |
| 1022 | union iwreq_data wrqu; |
| 1023 | tANI_U16 str_len; |
| 1024 | #endif |
| 1025 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 1026 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1027 | vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1028 | vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1029 | |
Kanchanapally, Vidyullatha | 31b8d14 | 2015-01-30 14:25:18 +0530 | [diff] [blame] | 1030 | sme_GetRICIEs(pHddCtx->hHal, (u8 *)ricIe, |
| 1031 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1032 | if (ric_ies_length == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1033 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1034 | hddLog(LOGW, |
| 1035 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 1036 | __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1037 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1038 | |
| 1039 | ftEvent.ric_ies = ricIe; |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1040 | ftEvent.ric_ies_len = ric_ies_length; |
| 1041 | 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] | 1042 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1043 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1044 | DOT11F_IE_FTINFO_MAX_LEN, &auth_resp_len); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1045 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1046 | if (auth_resp_len == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1047 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1048 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1049 | return; |
| 1050 | } |
| 1051 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1052 | sme_SetFTPreAuthState(pHddCtx->hHal, TRUE); |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 1053 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1054 | ftEvent.target_ap = ftIe; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1055 | |
| 1056 | ftEvent.ies = (u8 *)(ftIe + SIR_MAC_ADDR_LENGTH); |
| 1057 | ftEvent.ies_len = auth_resp_len - SIR_MAC_ADDR_LENGTH; |
| 1058 | |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 1059 | hddLog(LOG1, "%s ftEvent.ies_len %zu", __FUNCTION__, ftEvent.ies_len); |
| 1060 | hddLog(LOG1, "%s ftEvent.ric_ies_len %zu", |
| 1061 | __FUNCTION__, ftEvent.ric_ies_len ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1062 | 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] | 1063 | __FUNCTION__, ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1064 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1065 | ftEvent.target_ap[5]); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1066 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 1067 | (void)cfg80211_ft_event(dev, &ftEvent); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1068 | |
| 1069 | #else |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1070 | // We need to send the IEs to the supplicant |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1072 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1073 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1074 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1075 | return; |
| 1076 | } |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1077 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1078 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1079 | // Sme needs to send the RIC IEs first |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1080 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1081 | sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]), |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1082 | (IW_CUSTOM_MAX - str_len), &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1083 | if (ric_ies_length == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1084 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1085 | hddLog(LOGW, |
| 1086 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 1087 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1088 | } |
| 1089 | else |
| 1090 | { |
| 1091 | wrqu.data.length = str_len + ric_ies_length; |
| 1092 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1093 | } |
| 1094 | |
| 1095 | // Sme needs to provide the Auth Resp |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1096 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1097 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1098 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len], |
| 1099 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1100 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1101 | if (auth_resp_len == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1102 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1103 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Bhargav Shah | 8b5b2f7 | 2015-07-14 11:53:46 +0530 | [diff] [blame] | 1104 | kfree(buff); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1105 | return; |
| 1106 | } |
| 1107 | |
| 1108 | wrqu.data.length = str_len + auth_resp_len; |
| 1109 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1110 | |
| 1111 | kfree(buff); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1112 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1113 | } |
| 1114 | |
| 1115 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 1116 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1117 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1118 | |
| 1119 | /* |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1120 | * Send the ESE required "new AP Channel info" to the supplicant. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1121 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1122 | * |
| 1123 | * The current (new AP) channel information is passed in. |
| 1124 | */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1125 | static void hdd_SendNewAPChannelInfo(struct net_device *dev, hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1126 | tCsrRoamInfo *pCsrRoamInfo) |
| 1127 | { |
| 1128 | union iwreq_data wrqu; |
| 1129 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1130 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1131 | |
| 1132 | if (descriptor == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1133 | { |
| 1134 | hddLog(LOGE, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 1135 | "%s: pCsrRoamInfo->pBssDesc=%pK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1136 | __func__, descriptor); |
| 1137 | return; |
| 1138 | } |
| 1139 | |
| 1140 | // 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] | 1141 | hddLog(LOGW, "%s: Sending up an SIOCGIWFREQ, channelId=%d", __func__, descriptor->channelId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1142 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1143 | wrqu.freq.m = descriptor->channelId; |
| 1144 | wrqu.freq.e = 0; |
| 1145 | wrqu.freq.i = 0; |
| 1146 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1147 | } |
| 1148 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1149 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1150 | |
| 1151 | void hdd_SendUpdateBeaconIEsEvent(hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo) |
| 1152 | { |
| 1153 | union iwreq_data wrqu; |
| 1154 | u8 *pBeaconIes; |
| 1155 | u8 currentLen = 0; |
| 1156 | char *buff; |
| 1157 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1158 | |
| 1159 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1160 | |
| 1161 | if (0 == pCsrRoamInfo->nBeaconLength) |
| 1162 | { |
| 1163 | hddLog(LOGE, "%s: pCsrRoamInfo->nBeaconFrameLength = 0", __func__); |
| 1164 | return; |
| 1165 | } |
| 1166 | pBeaconIes = (u8 *)(pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1167 | if (pBeaconIes == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1168 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1169 | hddLog(LOGE, "%s: Beacon IEs is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1170 | return; |
| 1171 | } |
| 1172 | |
| 1173 | // pBeaconIes needs to point to the IEs |
| 1174 | hddLog(LOG1, "%s: Beacon IEs is now at %02x%02x", __func__, |
| 1175 | (unsigned int)pBeaconIes[0], |
| 1176 | (unsigned int)pBeaconIes[1]); |
| 1177 | 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] | 1178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1179 | // We need to send the IEs to the supplicant. |
| 1180 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1181 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1182 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1183 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1184 | return; |
| 1185 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1186 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1187 | |
| 1188 | strLen = strlcpy(buff,"BEACONIEs=", IW_CUSTOM_MAX); |
| 1189 | currentLen = strLen + 1; |
| 1190 | |
| 1191 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1192 | do |
| 1193 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1194 | /* 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] | 1195 | * max size and send it to supplicant. Changes are done in supplicant to handle this */ |
| 1196 | vos_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
| 1197 | currentLen = VOS_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
| 1198 | vos_mem_copy(&buff[strLen + 1], pBeaconIes+currentOffset, currentLen); |
| 1199 | currentOffset += currentLen; |
| 1200 | totalIeLen -= currentLen; |
| 1201 | wrqu.data.length = strLen + 1 + currentLen; |
| 1202 | if (totalIeLen) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1203 | buff[strLen] = 1; // This tells supplicant more chunks are pending |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1204 | else |
| 1205 | buff[strLen] = 0; // For last chunk of beacon IE to supplicant |
| 1206 | |
| 1207 | hddLog(LOG1, "%s: Beacon IEs length to supplicant = %d", __func__, currentLen); |
| 1208 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1209 | } while (totalIeLen > 0); |
| 1210 | |
| 1211 | kfree(buff); |
| 1212 | } |
| 1213 | |
| 1214 | static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRoamInfo) |
| 1215 | { |
| 1216 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1217 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1218 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1219 | union iwreq_data wrqu; |
| 1220 | int we_event; |
| 1221 | char *msg; |
| 1222 | int type = -1; |
| 1223 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1224 | #if defined (WLAN_FEATURE_VOWIFI_11R) |
| 1225 | // Added to find the auth type on the fly at run time |
| 1226 | // rather than with cfg to see if FT is enabled |
| 1227 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1228 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 1229 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1231 | memset(&wrqu, '\0', sizeof(wrqu)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1232 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1233 | we_event = SIOCGIWAP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1234 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
| 1236 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1237 | /* In case of roaming ; We are not doing disconnect. |
| 1238 | * If disconnect is not being done for roam; We will not |
| 1239 | * decrease count for Active sessions. We should not increase active |
| 1240 | * active session in case of roaming. |
| 1241 | */ |
Padma, Santhosh Kumar | 87ba40f | 2014-11-26 19:40:15 +0530 | [diff] [blame] | 1242 | if((pHddStaCtx->ft_carrier_on == FALSE) && !pCsrRoamInfo->fReassocReq) |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1243 | { |
| 1244 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
| 1245 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1246 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1247 | type = WLAN_STA_ASSOC_DONE_IND; |
| 1248 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 1249 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 1250 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1251 | { |
| 1252 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_1) |
| 1253 | { |
| 1254 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTED_STATE_1; |
| 1255 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 1256 | "Connecting state to Connected State for 8-way " |
| 1257 | "Handshake"); |
| 1258 | } |
| 1259 | else if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_2) |
| 1260 | { |
| 1261 | globalP2PConnectionStatus = P2P_CLIENT_COMPLETED_STATE; |
| 1262 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 1263 | "Connecting state to P2P Client Connection Completed"); |
| 1264 | } |
| 1265 | } |
| 1266 | #endif |
Yeshwanth Sriram Guntuka | 0004c0b | 2017-12-06 14:43:49 +0530 | [diff] [blame] | 1267 | hddLog(VOS_TRACE_LEVEL_ERROR, MAC_ADDRESS_STR " connected to " |
| 1268 | MAC_ADDRESS_STR, |
| 1269 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1270 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1271 | hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo); |
| 1272 | |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1273 | hdd_manage_delack_timer(pHddCtx); |
| 1274 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1275 | /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or |
| 1276 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled |
| 1277 | * and fFTEnable is TRUE */ |
| 1278 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1279 | // Send FT Keys to the supplicant when FT is enabled |
| 1280 | if ((pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN_PSK) || |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1281 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1282 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1283 | || (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1284 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) |
| 1285 | #endif |
| 1286 | ) |
| 1287 | { |
| 1288 | hdd_SendFTAssocResponse(dev, pAdapter, pCsrRoamInfo); |
| 1289 | } |
| 1290 | #endif |
| 1291 | } |
| 1292 | else if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) // IBss Associated |
| 1293 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1294 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 1295 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1296 | type = WLAN_STA_ASSOC_DONE_IND; |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 1297 | |
| 1298 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1299 | "wlan: new IBSS connection to " MAC_ADDRESS_STR, |
| 1300 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1301 | } |
| 1302 | else /* Not Associated */ |
| 1303 | { |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 1304 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1305 | "wlan: disconnected"); |
gaurank kathpalia | 5180158 | 2019-04-05 13:56:55 +0530 | [diff] [blame] | 1306 | if (pHddCtx->btCoexModeSet) { |
| 1307 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1308 | FL("Wlan disconnected, sending DHCP stop indication")); |
| 1309 | pHddCtx->btCoexModeSet = FALSE; |
| 1310 | sme_DHCPStopInd(pHddCtx->hHal, pAdapter->device_mode, |
| 1311 | pAdapter->sessionId); |
| 1312 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1313 | type = WLAN_STA_DISASSOC_DONE_IND; |
| 1314 | memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN); |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1315 | |
| 1316 | hdd_manage_delack_timer(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1317 | } |
Sudhir Sattayappa Kohalli | 90e4c75 | 2013-03-21 14:25:04 -0700 | [diff] [blame] | 1318 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1319 | |
| 1320 | msg = NULL; |
| 1321 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 1322 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 1323 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1324 | { |
| 1325 | wireless_send_event(dev, we_event, &wrqu, msg); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1326 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1327 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1328 | { |
| 1329 | if ( (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1330 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1331 | hdd_SendNewAPChannelInfo(dev, pAdapter, pCsrRoamInfo); |
| 1332 | } |
| 1333 | #endif |
| 1334 | } |
| 1335 | send_btc_nlink_msg(type, 0); |
| 1336 | } |
| 1337 | |
| 1338 | void hdd_connRemoveConnectInfo( hdd_station_ctx_t *pHddStaCtx ) |
| 1339 | { |
| 1340 | // Remove staId, bssId and peerMacAddress |
| 1341 | pHddStaCtx->conn_info.staId [ 0 ] = 0; |
| 1342 | vos_mem_zero( &pHddStaCtx->conn_info.bssId, sizeof( v_MACADDR_t ) ); |
| 1343 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], sizeof( v_MACADDR_t ) ); |
| 1344 | |
| 1345 | // Clear all security settings |
| 1346 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1347 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1348 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1349 | |
| 1350 | vos_mem_zero( &pHddStaCtx->conn_info.Keys, sizeof( tCsrKeys ) ); |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 1351 | vos_mem_zero( &pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1352 | |
| 1353 | // Set not-connected state |
| 1354 | pHddStaCtx->conn_info.connDot11DesiredBssType = eCSR_BSS_TYPE_ANY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1355 | |
| 1356 | vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) ); |
| 1357 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1358 | |
| 1359 | VOS_STATUS hdd_ibss_deinit_tx_rx_sta ( hdd_adapter_t *pAdapter, v_U8_t STAId ) |
| 1360 | { |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1361 | v_U8_t ac; |
| 1362 | /**Track whether OS TX queue has been disabled.*/ |
| 1363 | v_BOOL_t txSuspended[NUM_TX_QUEUES]; |
| 1364 | v_U8_t tlAC; |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1365 | v_U8_t i; |
| 1366 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1367 | hdd_ibss_peer_info_t *pPeerInfo; |
| 1368 | |
| 1369 | if( NULL == pHddStaCtx ) |
| 1370 | { |
| 1371 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1372 | "%s: HDD station context NULL ",__func__); |
| 1373 | return VOS_STATUS_E_FAILURE; |
| 1374 | } |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1375 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1376 | pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1377 | if (FALSE == pPeerInfo->ibssStaInfo[STAId].isUsed) |
| 1378 | { |
| 1379 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1380 | "%s: Deinit station not inited %d", __func__, STAId ); |
| 1381 | return VOS_STATUS_E_FAILURE; |
| 1382 | } |
| 1383 | |
| 1384 | hdd_flush_ibss_tx_queues(pAdapter, STAId); |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1385 | |
| 1386 | for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++) |
| 1387 | { |
| 1388 | tlAC = hdd_QdiscAcToTlAC[ac]; |
| 1389 | txSuspended[ac] = pPeerInfo->ibssStaInfo[STAId].txSuspended[tlAC]; |
| 1390 | } |
| 1391 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1392 | vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t)); |
| 1393 | |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1394 | /* re-init hdd list, since netdev can still open adapter until |
| 1395 | * driver gets unloaded |
| 1396 | */ |
| 1397 | for (i = 0; i < NUM_TX_QUEUES; i ++) |
| 1398 | { |
| 1399 | hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], |
| 1400 | HDD_TX_QUEUE_MAX_LEN); |
| 1401 | } |
| 1402 | |
| 1403 | for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++) |
| 1404 | { |
| 1405 | if (txSuspended[ac]) |
| 1406 | { |
| 1407 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1408 | "%s: TX queue re-enabled", __func__); |
| 1409 | netif_wake_subqueue(pAdapter->dev, ac); |
| 1410 | } |
| 1411 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1412 | return VOS_STATUS_SUCCESS; |
| 1413 | } |
| 1414 | |
| 1415 | static VOS_STATUS hdd_ibss_DeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 1416 | { |
| 1417 | VOS_STATUS vosStatus; |
| 1418 | |
| 1419 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 1420 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1421 | { |
| 1422 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1423 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
| 1424 | "Status= %d [0x%08X]", |
| 1425 | __func__, staId, vosStatus, vosStatus ); |
| 1426 | } |
| 1427 | |
| 1428 | vosStatus = hdd_ibss_deinit_tx_rx_sta ( pAdapter, staId ); |
| 1429 | if( VOS_STATUS_E_FAILURE == vosStatus ) |
| 1430 | { |
| 1431 | VOS_TRACE ( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1432 | "hdd_ibss_deinit_tx_rx_sta() failed for staID %d. " |
| 1433 | "Status = %d [0x%08X]", |
| 1434 | staId, vosStatus, vosStatus ); |
| 1435 | } |
| 1436 | |
| 1437 | return( vosStatus ); |
| 1438 | } |
| 1439 | |
| 1440 | VOS_STATUS hdd_ibss_init_tx_rx_sta( hdd_adapter_t *pAdapter, v_U8_t STAId, v_MACADDR_t *pmacAddrSTA) |
| 1441 | { |
| 1442 | v_U8_t i = 0; |
| 1443 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1444 | hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1445 | |
| 1446 | if (pPeerInfo->ibssStaInfo[STAId].isUsed) |
| 1447 | { |
| 1448 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1449 | "%s: Reinit station %d", __func__, STAId ); |
| 1450 | return VOS_STATUS_E_FAILURE; |
| 1451 | } |
| 1452 | |
| 1453 | vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t)); |
| 1454 | for (i = 0; i < NUM_TX_QUEUES; i ++) |
| 1455 | { |
| 1456 | hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN); |
| 1457 | } |
| 1458 | |
| 1459 | pPeerInfo->ibssStaInfo[STAId].isUsed = VOS_TRUE; |
| 1460 | pPeerInfo->ibssStaInfo[STAId].isDeauthInProgress = VOS_FALSE; |
| 1461 | vos_copy_macaddr( &pPeerInfo->ibssStaInfo[STAId].macAddrSTA, pmacAddrSTA); |
| 1462 | |
| 1463 | return VOS_STATUS_SUCCESS; |
| 1464 | } |
| 1465 | |
| 1466 | static VOS_STATUS hdd_ibss_RegisterSTA( hdd_adapter_t *pAdapter, |
| 1467 | tCsrRoamInfo *pRoamInfo, |
| 1468 | v_U8_t staId, |
| 1469 | v_MACADDR_t *pPeerMacAddress, |
| 1470 | tSirBssDescription *pBssDesc ) |
| 1471 | { |
| 1472 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 1473 | WLAN_STADescType staDesc = {0}; |
| 1474 | eCsrEncryptionType connectedCipherAlgo; |
| 1475 | v_BOOL_t fConnected; |
| 1476 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1477 | hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1478 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1479 | |
| 1480 | if ( pPeerInfo->ibssStaInfo[staId].isUsed ) |
| 1481 | { |
| 1482 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1483 | "clean up old entry for STA %d", staId); |
| 1484 | hdd_ibss_DeregisterSTA( pAdapter, staId ); |
| 1485 | } |
| 1486 | |
| 1487 | staDesc.ucSTAId = staId; |
| 1488 | staDesc.wSTAType = WLAN_STA_IBSS; |
| 1489 | |
| 1490 | // Note that for IBSS, the STA MAC address and BSSID are goign to be different where |
| 1491 | // in infrastructure, they are the same (BSSID is the MAC address of the AP). So, |
| 1492 | // for IBSS we have a second field to pass to TL in the STA descriptor that we don't |
| 1493 | // pass when making an Infrastructure connection. |
| 1494 | vos_mem_copy(staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes)); |
| 1495 | vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId, 6 ); |
| 1496 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 1497 | |
| 1498 | if (hdd_wmm_is_active(pAdapter)) |
| 1499 | { |
| 1500 | staDesc.ucQosEnabled = 1; |
| 1501 | } |
| 1502 | else |
| 1503 | { |
| 1504 | staDesc.ucQosEnabled = 0; |
| 1505 | } |
| 1506 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1507 | "HDD SOFTAP register TL QoS_enabled=%d", |
| 1508 | staDesc.ucQosEnabled ); |
| 1509 | |
| 1510 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 1511 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 1512 | { |
| 1513 | staDesc.ucProtectedFrame = 1; |
| 1514 | } |
| 1515 | else |
| 1516 | { |
| 1517 | staDesc.ucProtectedFrame = 0; |
| 1518 | |
| 1519 | } |
| 1520 | |
| 1521 | hdd_ibss_init_tx_rx_sta(pAdapter, staId, &staDesc.vSTAMACAddress); |
| 1522 | |
| 1523 | // UMA is Not ready yet, Xlation will be done by TL |
| 1524 | staDesc.ucSwFrameTXXlation = 1; |
| 1525 | staDesc.ucSwFrameRXXlation = 1; |
| 1526 | staDesc.ucAddRmvLLC = 1; |
| 1527 | // Initialize signatures and state |
| 1528 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 1529 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 1530 | staDesc.ucInitState = WLANTL_STA_AUTHENTICATED; |
| 1531 | |
| 1532 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
| 1533 | |
| 1534 | // Register the Station with TL. |
| 1535 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 1536 | hdd_rx_packet_cbk, |
| 1537 | hdd_tx_complete_cbk, |
| 1538 | hdd_ibss_tx_fetch_packet_cbk, &staDesc, |
| 1539 | pBssDesc->rssi ); |
| 1540 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1541 | { |
| 1542 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1543 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", |
| 1544 | vosStatus, vosStatus ); |
| 1545 | return vosStatus; |
| 1546 | } |
| 1547 | |
| 1548 | //Timer value should be in milliseconds |
| 1549 | if ( pHddCtx->cfg_ini->dynSplitscan && |
| 1550 | ( VOS_TIMER_STATE_RUNNING != |
| 1551 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))) |
| 1552 | { |
| 1553 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 1554 | pHddCtx->cfg_ini->trafficMntrTmrForSplitScan); |
| 1555 | } |
| 1556 | |
| 1557 | pPeerInfo->ibssStaInfo[staId].ucSTAId = staId; |
| 1558 | pPeerInfo->ibssStaInfo[staId].isQosEnabled = staDesc.ucQosEnabled; |
| 1559 | |
| 1560 | vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId, |
| 1561 | WLANTL_STA_AUTHENTICATED ); |
| 1562 | |
| 1563 | pPeerInfo->ibssStaInfo[staId].tlSTAState = WLANTL_STA_AUTHENTICATED; |
| 1564 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 1565 | |
| 1566 | return( vosStatus ); |
| 1567 | } |
| 1568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1569 | /* TODO Revist this function. and data path */ |
| 1570 | static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 1571 | { |
| 1572 | VOS_STATUS vosStatus; |
Ravi Joshi | f9520d6 | 2013-10-18 04:11:46 -0700 | [diff] [blame] | 1573 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1574 | hdd_disconnect_tx_rx(pAdapter); |
Ravi Joshi | f9520d6 | 2013-10-18 04:11:46 -0700 | [diff] [blame] | 1575 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1576 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 1577 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1578 | { |
Gopichand Nakkala | d786fa3 | 2013-03-20 23:48:19 +0530 | [diff] [blame] | 1579 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1580 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1581 | "Status= %d [0x%08X]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1582 | __func__, staId, vosStatus, vosStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1583 | } |
| 1584 | return( vosStatus ); |
| 1585 | } |
| 1586 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 1587 | /** |
| 1588 | * hdd_print_bss_info() - print bss info |
| 1589 | * @hdd_sta_ctx: pointer to hdd station context |
| 1590 | * |
| 1591 | * Return: None |
| 1592 | */ |
| 1593 | void hdd_print_bss_info(hdd_station_ctx_t *hdd_sta_ctx) |
| 1594 | { |
| 1595 | uint32_t *cap_info; |
| 1596 | |
| 1597 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"WIFI DATA LOGGER"); |
| 1598 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"channel: %d", |
| 1599 | hdd_sta_ctx->conn_info.freq); |
| 1600 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"dot11mode: %d", |
| 1601 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1602 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"AKM: %d", |
| 1603 | hdd_sta_ctx->conn_info.authType); |
| 1604 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ssid: %.*s", |
| 1605 | hdd_sta_ctx->conn_info.SSID.SSID.length, |
| 1606 | hdd_sta_ctx->conn_info.SSID.SSID.ssId); |
| 1607 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"roam count: %d", |
| 1608 | hdd_sta_ctx->conn_info.roam_count); |
| 1609 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ant_info: %d", |
| 1610 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1611 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate legacy %d", |
| 1612 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1613 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate mcs: %d", |
| 1614 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1615 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1616 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1617 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ht caps: %x", |
| 1618 | *cap_info); |
| 1619 | } |
| 1620 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1621 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1622 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"vht caps: %x", |
| 1623 | *cap_info); |
| 1624 | } |
| 1625 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1626 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"hs20 info: %x", |
| 1627 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1628 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"signal: %d", |
| 1629 | hdd_sta_ctx->conn_info.signal); |
| 1630 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"noise: %d", |
| 1631 | hdd_sta_ctx->conn_info.noise); |
| 1632 | } |
| 1633 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1634 | /** |
| 1635 | * hdd_check_and_move_if_sap_is_on_dfs_chan() - move the sap to non dfs channel |
| 1636 | * @hdd_ctx: pointer to hdd context |
| 1637 | * @sta_adapter: pointer to sta adapater |
| 1638 | * |
| 1639 | * This function is used to check if SAP is operating on DFS channel in stand |
| 1640 | * alone mode and move it to non dfs channel |
| 1641 | * |
| 1642 | * Return: void. |
| 1643 | */ |
| 1644 | static void hdd_check_and_move_if_sap_is_on_dfs_chan(hdd_context_t *hdd_ctx, |
| 1645 | hdd_adapter_t *sta_adapter) |
| 1646 | { |
| 1647 | hdd_adapter_t *sap_adapter; |
| 1648 | ptSapContext sap_ctx; |
| 1649 | v_CONTEXT_t vos_ctx; |
| 1650 | eNVChannelEnabledType chan_state; |
| 1651 | |
| 1652 | if (hdd_is_sta_sap_scc_allowed_on_dfs_chan(hdd_ctx)) { |
| 1653 | sap_adapter = hdd_get_adapter(hdd_ctx, WLAN_HDD_SOFTAP); |
| 1654 | |
| 1655 | if (!sap_adapter) { |
| 1656 | hddLog(LOG1, FL("SAP not exists, nothing to do")); |
| 1657 | return; |
| 1658 | } |
| 1659 | |
| 1660 | vos_ctx = hdd_ctx->pvosContext; |
| 1661 | if (!vos_ctx) { |
| 1662 | hddLog(LOGE, FL("vos_ctx is NULL")); |
| 1663 | return; |
| 1664 | } |
| 1665 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 1666 | if (!sap_ctx) { |
| 1667 | hddLog(LOG1, FL("sap_ctx not exists")); |
| 1668 | return; |
| 1669 | } |
| 1670 | |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1671 | if (sap_ctx->sapsMachine != eSAP_STARTED) { |
| 1672 | hddLog(LOG1, FL("SAP is not in eSAP_STARTED state")); |
| 1673 | return; |
| 1674 | } |
| 1675 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1676 | chan_state = vos_nv_getChannelEnabledState(sap_ctx->channel); |
| 1677 | |
| 1678 | hddLog(LOG1, "SAP is operating on channel (%hu), chan_state %d", |
| 1679 | sap_ctx->channel, chan_state); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1680 | if (vos_nv_getChannelEnabledState(sap_ctx->channel) != |
| 1681 | NV_CHANNEL_DFS) { |
| 1682 | hddLog(LOG1, "SAP is on non DFS channel. nothing to do"); |
| 1683 | return; |
| 1684 | } |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1685 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1686 | hddLog(LOG1, "Schedule workqueue to move the SAP to non DFS channel"); |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1687 | schedule_delayed_work(&hdd_ctx->ecsa_chan_change_work, |
| 1688 | msecs_to_jiffies(ECSA_DFS_CHAN_CHANGE_DEFER_TIME)); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1689 | } |
| 1690 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1691 | |
| 1692 | static eHalStatus hdd_DisConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1693 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 1694 | eCsrRoamResult roamResult ) |
| 1695 | { |
| 1696 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1697 | VOS_STATUS vstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1698 | struct net_device *dev = pAdapter->dev; |
| 1699 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1700 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1701 | v_U8_t sta_id; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1702 | v_BOOL_t sendDisconInd = TRUE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1703 | |
| 1704 | // Sanity check |
| 1705 | if(dev == NULL) |
| 1706 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 1707 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1708 | "%s: net_dev is released return", __func__); |
| 1709 | return eHAL_STATUS_FAILURE; |
| 1710 | } |
| 1711 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1712 | // notify apps that we can't pass traffic anymore |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 1713 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1714 | netif_tx_disable(dev); |
| 1715 | netif_carrier_off(dev); |
Mukul Sharma | 09ab4bd | 2014-11-24 18:07:26 +0530 | [diff] [blame] | 1716 | //TxTimeoutCount need to reset in case of disconnect handler |
| 1717 | pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1718 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 1719 | wlan_hdd_check_and_stop_mon(pAdapter, false); |
| 1720 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1721 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1722 | /* If only STA mode is on */ |
| 1723 | if((pHddCtx->concurrency_mode <= 1) && |
| 1724 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <= 1)) |
| 1725 | { |
| 1726 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 1727 | } |
| 1728 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1729 | /* Need to apply spin lock before decreasing active sessions |
| 1730 | * as there can be chance for double decrement if context switch |
| 1731 | * Calls wlan_hdd_disconnect. |
| 1732 | */ |
| 1733 | |
| 1734 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1735 | |
| 1736 | /* HDD has initiated disconnect, do not send disconnect indication |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1737 | * to kernel. Sending disconnected event to kernel for userspace |
| 1738 | * initiated disconnect will be handled by diconnect handler call |
| 1739 | * to cfg80211_disconnected |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1740 | */ |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1741 | if ((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) || |
Abhishek Singh | d2ce680 | 2018-05-08 15:21:06 +0530 | [diff] [blame] | 1742 | (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) || |
| 1743 | (eConnectionState_Connecting == pHddStaCtx->conn_info.connState)) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1744 | { |
| 1745 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1746 | FL(" HDD has initiated a disconnect, no need to send" |
| 1747 | " disconnect indication to kernel")); |
| 1748 | sendDisconInd = FALSE; |
| 1749 | } |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1750 | else if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1751 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1752 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1753 | FL("Set HDD connState to eConnectionState_Disconnecting from %d "), |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1754 | pHddStaCtx->conn_info.connState); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1755 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 1756 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1757 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1758 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 1759 | vos_flush_delayed_work(&pHddCtx->ecsa_chan_change_work); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1760 | hdd_clearRoamProfileIe( pAdapter ); |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 1761 | |
| 1762 | hdd_wmm_init( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1763 | |
| 1764 | // indicate 'disconnect' status to wpa_supplicant... |
| 1765 | hdd_SendAssociationEvent(dev,pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1766 | /* indicate disconnected event to nl80211 */ |
| 1767 | if(roamStatus != eCSR_ROAM_IBSS_LEAVE) |
| 1768 | { |
| 1769 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 1770 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 1771 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1772 | { |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 1773 | if (sendDisconInd) |
| 1774 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1775 | "%s: sent disconnected event to nl80211", |
| 1776 | __func__); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 1777 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 1778 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1779 | { |
| 1780 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTED_STATE_1) |
| 1781 | { |
| 1782 | globalP2PConnectionStatus = P2P_CLIENT_DISCONNECTED_STATE; |
| 1783 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] 8 way Handshake completed " |
| 1784 | "and moved to disconnected state"); |
| 1785 | } |
| 1786 | else if(globalP2PConnectionStatus == P2P_CLIENT_COMPLETED_STATE) |
| 1787 | { |
| 1788 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 1789 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] P2P Client is removed " |
| 1790 | "and moved to inactive state"); |
| 1791 | } |
| 1792 | } |
| 1793 | #endif |
Sushant Kaushik | bad6189 | 2015-07-10 16:43:28 +0530 | [diff] [blame] | 1794 | if ((roamStatus == eCSR_ROAM_LOSTLINK) && |
| 1795 | !pRoamInfo->reasonCode) |
| 1796 | wlan_hdd_get_frame_logs(pAdapter, |
| 1797 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1798 | /*Only send indication to kernel if not initiated by kernel*/ |
| 1799 | if ( sendDisconInd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1800 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1801 | /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */ |
| 1802 | if ( eCSR_ROAM_LOSTLINK == roamStatus ) |
| 1803 | { |
Mahesh A Saptasagar | 9ff4bcc | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 1804 | wlan_hdd_cfg80211_indicate_disconnect(dev, false, |
| 1805 | pRoamInfo->reasonCode); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1806 | } |
| 1807 | else |
| 1808 | { |
Mahesh A Saptasagar | 9ff4bcc | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 1809 | wlan_hdd_cfg80211_indicate_disconnect(dev, false, |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1810 | WLAN_REASON_UNSPECIFIED); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1811 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1812 | } |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 1813 | |
| 1814 | if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1815 | { |
| 1816 | hddLog(LOG1, |
| 1817 | FL("P2P client is getting removed and we are tryig to re-enable TDLS")); |
| 1818 | wlan_hdd_tdls_reenable(pHddCtx); |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 1819 | } |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 1820 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1821 | //If the Device Mode is Station |
| 1822 | // and the P2P Client is Connected |
| 1823 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1824 | |
| 1825 | // 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] | 1826 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Sudhir Sattayappa Kohalli | b1d8c3a | 2013-06-18 14:47:20 -0700 | [diff] [blame] | 1827 | if(VOS_STATUS_SUCCESS == hdd_issta_p2p_clientconnected(pHddCtx)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1828 | { |
| 1829 | //Enable BMPS only of other Session is P2P Client |
| 1830 | hdd_context_t *pHddCtx = NULL; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1831 | 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] | 1832 | |
| 1833 | if (NULL != pVosContext) |
| 1834 | { |
| 1835 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 1836 | |
| 1837 | if(NULL != pHddCtx) |
| 1838 | { |
| 1839 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1840 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 1841 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1842 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1843 | if (pHddCtx->hdd_wlan_suspended) |
| 1844 | { |
| 1845 | hdd_set_pwrparams(pHddCtx); |
| 1846 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1847 | hdd_enable_bmps_imps(pHddCtx); |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1848 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1849 | } |
| 1850 | } |
| 1851 | } |
| 1852 | } |
| 1853 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1854 | |
Madan Mohan Koyyalamudi | 70c52d3 | 2013-08-07 14:42:16 +0530 | [diff] [blame] | 1855 | hdd_wmm_adapter_clear(pAdapter); |
Kapil Gupta | e686748 | 2016-06-26 13:31:37 +0530 | [diff] [blame] | 1856 | /* Clear PER based roam stats */ |
| 1857 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1858 | if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) && |
| 1859 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 1860 | pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled && |
| 1861 | pHddCtx->cfg_ini->isPERRoamRxPathEnabled) |
| 1862 | sme_unset_per_roam_rxconfig(pHddCtx->hHal); |
| 1863 | #endif |
Mukul Sharma | c159c43 | 2014-01-15 15:42:46 +0530 | [diff] [blame] | 1864 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 1865 | sme_FTReset(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
| 1866 | #endif |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1867 | |
| 1868 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) |
| 1869 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1870 | v_U8_t i; |
| 1871 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1872 | sta_id = IBSS_BROADCAST_STAID; |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1873 | vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id ); |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1874 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1875 | { |
| 1876 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1877 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1878 | "Status= %d [0x%x]"), |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1879 | sta_id, status, status ); |
| 1880 | |
| 1881 | status = eHAL_STATUS_FAILURE; |
| 1882 | } |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1883 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1884 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1885 | /*Clear all the peer sta register with TL.*/ |
| 1886 | for (i =0; i < HDD_MAX_NUM_IBSS_STA; i++ ) |
| 1887 | { |
| 1888 | if (0 != pHddStaCtx->conn_info.staId[i]) |
| 1889 | { |
| 1890 | sta_id = pHddStaCtx->conn_info.staId[i]; |
| 1891 | |
| 1892 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1893 | FL("Deregister StaID %d"),sta_id); |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1894 | vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id ); |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1895 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1896 | { |
| 1897 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1898 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1899 | "Status= %d [0x%x]"), |
| 1900 | sta_id, status, status ); |
| 1901 | status = eHAL_STATUS_FAILURE; |
| 1902 | } |
| 1903 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 1904 | vstatus = hdd_sta_id_hash_remove_entry(pAdapter, |
| 1905 | sta_id, &pHddStaCtx->conn_info.peerMacAddress[i]); |
| 1906 | if (vstatus != VOS_STATUS_SUCCESS) { |
| 1907 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1908 | FL("Not able to remove staid hash %d"), |
| 1909 | sta_id); |
| 1910 | status = eHAL_STATUS_FAILURE; |
| 1911 | } else { |
| 1912 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1913 | FL("ibss station removed sta_id %d mac:" |
| 1914 | MAC_ADDRESS_STR), sta_id, |
| 1915 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[i].bytes)); |
| 1916 | } |
| 1917 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1918 | /*set the staid and peer mac as 0, all other reset are |
| 1919 | * done in hdd_connRemoveConnectInfo. |
| 1920 | */ |
| 1921 | pHddStaCtx->conn_info.staId[i]= 0; |
| 1922 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[i], sizeof( v_MACADDR_t ) ); |
| 1923 | |
| 1924 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1925 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1926 | } |
| 1927 | } |
| 1928 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1929 | } |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1930 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1931 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1932 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 1933 | /* clear scan cache for Link Lost */ |
| 1934 | if (pRoamInfo && !pRoamInfo->reasonCode && |
| 1935 | (eCSR_ROAM_LOSTLINK == roamStatus)) { |
Abhishek Singh | e6137b8 | 2019-03-22 20:06:09 +0530 | [diff] [blame] | 1936 | wlan_hdd_cfg80211_unlink_bss(pAdapter, |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 1937 | pHddStaCtx->conn_info.bssId); |
| 1938 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1939 | pHddStaCtx->conn_info.bssId); |
| 1940 | } |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1941 | |
| 1942 | //We should clear all sta register with TL, for now, only one. |
| 1943 | vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id ); |
| 1944 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1945 | { |
| 1946 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1947 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1948 | "Status= %d [0x%x]"), |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1949 | sta_id, status, status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1950 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1951 | status = eHAL_STATUS_FAILURE; |
| 1952 | } |
| 1953 | |
| 1954 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1955 | } |
Srinivas Dasari | deb7ae9 | 2014-12-19 15:26:40 +0530 | [diff] [blame] | 1956 | |
| 1957 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 1958 | if (VOS_STATUS_SUCCESS != |
| 1959 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1960 | pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE_AC)) |
| 1961 | { |
| 1962 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1963 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1964 | } |
| 1965 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1966 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1967 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1968 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1969 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Sravan Kumar Kairam | f9f9512 | 2017-01-18 20:54:05 +0530 | [diff] [blame] | 1970 | pAdapter->dad = false; |
Srinivas Dasari | deb7ae9 | 2014-12-19 15:26:40 +0530 | [diff] [blame] | 1971 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1972 | // Clear saved connection information in HDD |
| 1973 | hdd_connRemoveConnectInfo( pHddStaCtx ); |
Abhishek Singh | d2ce680 | 2018-05-08 15:21:06 +0530 | [diff] [blame] | 1974 | |
| 1975 | /* |
| 1976 | * eConnectionState_Connecting state mean that connection is in progress so |
| 1977 | * no need to set state to eConnectionState_NotConnected |
| 1978 | */ |
| 1979 | if ((eConnectionState_Connecting != pHddStaCtx->conn_info.connState)) { |
| 1980 | hddLog(LOG1, FL("Set HDD connState to eConnectionState_NotConnected")); |
| 1981 | hdd_connSetConnectionState(pHddStaCtx, eConnectionState_NotConnected); |
| 1982 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1983 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 1984 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1985 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 1986 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1987 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 1988 | sizeof (tSirGtkOffloadParams)); |
| 1989 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1990 | } |
| 1991 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1992 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1993 | #ifdef FEATURE_WLAN_TDLS |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1994 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1995 | { |
| 1996 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1997 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1998 | #endif |
| 1999 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2000 | //Unblock anyone waiting for disconnect to complete |
| 2001 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2002 | hdd_print_bss_info(pHddStaCtx); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 2003 | |
| 2004 | hdd_check_and_move_if_sap_is_on_dfs_chan(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2005 | return( status ); |
| 2006 | } |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2007 | |
| 2008 | static void hdd_postTLPacketPendingInd(hdd_adapter_t *pAdapter, |
| 2009 | v_U8_t staId) |
| 2010 | { |
| 2011 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2012 | v_SINT_t i; |
| 2013 | v_SIZE_t size; |
| 2014 | VOS_STATUS status; |
| 2015 | v_BOOL_t granted = VOS_FALSE; |
| 2016 | |
| 2017 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 2018 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) || |
| 2019 | (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE)) |
| 2020 | { |
| 2021 | //Indicate to TL that there is pending data if a queue is non empty |
| 2022 | for (i = WLANTL_AC_HIGH_PRIO; i>=0; --i) |
| 2023 | { |
| 2024 | size = 0; |
| 2025 | hdd_list_size(&pAdapter->wmm_tx_queue[i], &size); |
| 2026 | if (size > 0) |
| 2027 | { |
| 2028 | if (i != WLANTL_AC_HIGH_PRIO) |
| 2029 | { |
| 2030 | if (VOS_FALSE == |
| 2031 | pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessAllowed) |
| 2032 | { |
| 2033 | hdd_wmm_acquire_access(pAdapter, |
| 2034 | (WLANTL_ACEnumType)i, &granted); |
| 2035 | pAdapter->psbChanged |= (1 << i); |
| 2036 | } |
| 2037 | else |
| 2038 | granted = VOS_TRUE; |
| 2039 | } |
| 2040 | |
| 2041 | if (granted || (i == WLANTL_AC_HIGH_PRIO)) |
| 2042 | { |
| 2043 | status = WLANTL_STAPktPending(pHddCtx->pvosContext, |
| 2044 | staId, (WLANTL_ACEnumType)i); |
| 2045 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 2046 | { |
| 2047 | VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2048 | "%s: Failure in indicating pkt to TL for QID=%d", |
| 2049 | __func__, i); |
| 2050 | } |
| 2051 | } |
| 2052 | } |
| 2053 | } |
| 2054 | } |
| 2055 | } |
| 2056 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2057 | static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter, |
| 2058 | tCsrRoamInfo *pRoamInfo, |
| 2059 | v_U8_t staId, |
| 2060 | v_MACADDR_t *pPeerMacAddress, |
| 2061 | tSirBssDescription *pBssDesc ) |
| 2062 | { |
| 2063 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 2064 | WLAN_STADescType staDesc = {0}; |
| 2065 | eCsrEncryptionType connectedCipherAlgo; |
| 2066 | v_BOOL_t fConnected; |
| 2067 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2068 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2069 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2070 | |
| 2071 | if ( NULL == pBssDesc) |
| 2072 | { |
| 2073 | return VOS_STATUS_E_FAILURE; |
| 2074 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2075 | // Get the Station ID from the one saved during the assocation. |
| 2076 | staDesc.ucSTAId = staId; |
| 2077 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2078 | staDesc.wSTAType = WLAN_STA_INFRA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2079 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2080 | // grab the bssid from the connection info in the adapter structure and hand that |
| 2081 | // over to TL when registering. |
| 2082 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId, |
| 2083 | sizeof(pHddStaCtx->conn_info.bssId) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2084 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2085 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 2086 | |
| 2087 | // set the QoS field appropriately |
| 2088 | if (hdd_wmm_is_active(pAdapter)) |
| 2089 | { |
| 2090 | staDesc.ucQosEnabled = 1; |
| 2091 | } |
| 2092 | else |
| 2093 | { |
| 2094 | staDesc.ucQosEnabled = 0; |
| 2095 | } |
| 2096 | |
| 2097 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 2098 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 2099 | { |
| 2100 | staDesc.ucProtectedFrame = 1; |
| 2101 | } |
| 2102 | else |
| 2103 | { |
| 2104 | staDesc.ucProtectedFrame = 0; |
| 2105 | |
| 2106 | } |
| 2107 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2108 | #ifdef FEATURE_WLAN_ESE |
| 2109 | staDesc.ucIsEseSta = pRoamInfo->isESEAssoc; |
| 2110 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2111 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2112 | /* check whether replay check is valid for the station or not */ |
| 2113 | if( (eCSR_ENCRYPT_TYPE_TKIP == connectedCipherAlgo) || (eCSR_ENCRYPT_TYPE_AES == connectedCipherAlgo)) |
| 2114 | { |
| 2115 | /* Encryption mode is either TKIP or AES |
| 2116 | and replay check is valid for only these |
| 2117 | two encryption modes */ |
| 2118 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 2119 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2120 | "HDD register TL ucIsReplayCheckValid %d: Replay check is needed for station", staDesc.ucIsReplayCheckValid); |
| 2121 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2122 | else |
| 2123 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2124 | /* For other encryption modes replay check is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2125 | not needed */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2126 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2127 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2128 | "HDD register TL ucIsReplayCheckValid %d", staDesc.ucIsReplayCheckValid); |
| 2129 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2130 | |
| 2131 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2132 | hddLog(LOG1, "%s: WAPI STA Registered: %d", __func__, pAdapter->wapi_info.fIsWapiSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2133 | if (pAdapter->wapi_info.fIsWapiSta) |
| 2134 | { |
| 2135 | staDesc.ucIsWapiSta = 1; |
| 2136 | } |
| 2137 | else |
| 2138 | { |
| 2139 | staDesc.ucIsWapiSta = 0; |
| 2140 | } |
| 2141 | #endif /* FEATURE_WLAN_WAPI */ |
| 2142 | |
| 2143 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 2144 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
| 2145 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2146 | // UMA is Not ready yet, Xlation will be done by TL |
| 2147 | staDesc.ucSwFrameTXXlation = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2148 | staDesc.ucSwFrameRXXlation = 1; |
| 2149 | staDesc.ucAddRmvLLC = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2150 | 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] | 2151 | staDesc.ucQosEnabled ); |
| 2152 | // Initialize signatures and state |
| 2153 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 2154 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 2155 | staDesc.ucInitState = pRoamInfo->fAuthRequired ? |
| 2156 | WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2157 | // Register the Station with TL... |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 2158 | 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] | 2159 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 2160 | hdd_rx_packet_cbk, |
| 2161 | hdd_tx_complete_cbk, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2162 | hdd_tx_fetch_packet_cbk, &staDesc, |
| 2163 | pBssDesc->rssi ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2165 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2166 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2167 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2168 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2169 | vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2170 | return vosStatus; |
| 2171 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2172 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2173 | if ( cfg_param->dynSplitscan && |
| 2174 | ( VOS_TIMER_STATE_RUNNING != |
| 2175 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))) |
| 2176 | { |
| 2177 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 2178 | cfg_param->trafficMntrTmrForSplitScan); |
| 2179 | } |
| 2180 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2181 | // if (WPA), tell TL to go to 'connected' and after keys come to the driver, |
| 2182 | // then go to 'authenticated'. For all other authentication types |
| 2183 | // (those that donot require upper layer authentication) we can put |
| 2184 | // TL directly into 'authenticated' state. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2185 | if (staDesc.wSTAType != WLAN_STA_IBSS) |
| 2186 | VOS_ASSERT( fConnected ); |
| 2187 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2188 | if ( !pRoamInfo->fAuthRequired ) |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2189 | { |
| 2190 | // Connections that do not need Upper layer auth, transition TL directly |
| 2191 | // to 'Authenticated' state. |
| 2192 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
| 2193 | WLANTL_STA_AUTHENTICATED ); |
| 2194 | |
| 2195 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2196 | |
| 2197 | hdd_postTLPacketPendingInd(pAdapter, staDesc.ucSTAId); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2198 | } |
| 2199 | else |
| 2200 | { |
| 2201 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2202 | "ULA auth StaId= %d. Changing TL state to CONNECTED" |
| 2203 | "at Join time", pHddStaCtx->conn_info.staId[0] ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2204 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 2205 | WLANTL_STA_CONNECTED ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2206 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 2207 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2208 | return( vosStatus ); |
| 2209 | } |
| 2210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2211 | static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 2212 | tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength) |
| 2213 | { |
| 2214 | unsigned int len = 0; |
| 2215 | u8 *pFTAssocRsp = NULL; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2216 | v_U8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2217 | tANI_U32 rspRsnLength = 0; |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2218 | struct cfg80211_bss* bss; |
| 2219 | tCsrRoamConnectedProfile roam_profile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2220 | struct ieee80211_channel *chan; |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2221 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2222 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2223 | if (!rspRsnIe) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2224 | hddLog(LOGE, "%s: Unable to allocate RSN IE", __func__); |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 2225 | return; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2226 | } |
| 2227 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2228 | if (pCsrRoamInfo == NULL) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2229 | hddLog(LOGE, "%s: Invalid CSR roam info", __func__); |
| 2230 | goto done; |
| 2231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2232 | |
Ashish Kumar Dhanotiya | 7b48fd9 | 2020-02-11 18:14:46 +0530 | [diff] [blame^] | 2233 | if (pCsrRoamInfo->nAssocRspLength < FT_ASSOC_RSP_IES_OFFSET) { |
| 2234 | |
| 2235 | hddLog(LOGE, "%s: Invalid assoc response length %d", |
| 2236 | __func__, pCsrRoamInfo->nAssocRspLength); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2237 | goto done; |
| 2238 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2239 | |
| 2240 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2241 | pCsrRoamInfo->nAssocReqLength); |
| 2242 | if (pFTAssocRsp == NULL) |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2243 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2244 | |
| 2245 | //pFTAssocRsp needs to point to the IEs |
| 2246 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2247 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2248 | (unsigned int)pFTAssocRsp[0], |
| 2249 | (unsigned int)pFTAssocRsp[1]); |
| 2250 | |
| 2251 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
Madan Mohan Koyyalamudi | 1bed23d | 2012-11-13 10:59:48 -0800 | [diff] [blame] | 2252 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Ashish Kumar Dhanotiya | 7b48fd9 | 2020-02-11 18:14:46 +0530 | [diff] [blame^] | 2253 | if (len > IW_GENERIC_IE_MAX) { |
| 2254 | hddLog(LOGE, "%s: Invalid assoc response length %d", |
| 2255 | __func__, pCsrRoamInfo->nAssocRspLength); |
| 2256 | goto done; |
| 2257 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2258 | rspRsnLength = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2259 | memcpy(rspRsnIe, pFTAssocRsp, len); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2260 | memset(rspRsnIe + len, 0, IW_GENERIC_IE_MAX - len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2261 | |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2262 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
| 2263 | (int) pCsrRoamInfo->pBssDesc->channelId); |
| 2264 | vos_mem_zero(&roam_profile, sizeof(tCsrRoamConnectedProfile)); |
| 2265 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roam_profile); |
| 2266 | bss = hdd_get_bss_entry(pAdapter->wdev.wiphy, |
| 2267 | chan, pCsrRoamInfo->bssid, |
| 2268 | &roam_profile.SSID.ssId[0], |
| 2269 | roam_profile.SSID.length); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2270 | hdd_send_roamed_ind(dev, bss, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2271 | reqRsnIe, reqRsnLength, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2272 | rspRsnIe, rspRsnLength); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2273 | |
| 2274 | done: |
| 2275 | kfree(rspRsnIe); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2276 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2277 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 2278 | void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter) |
| 2279 | { |
| 2280 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 2281 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2282 | tCsrRoamInfo roamInfo; |
| 2283 | roamInfo.fAuthRequired = FALSE; |
| 2284 | vos_mem_copy(roamInfo.bssid, |
| 2285 | pHddStaCtx->roam_info.bssid, |
| 2286 | WNI_CFG_BSSID_LEN); |
| 2287 | vos_mem_copy(roamInfo.peerMac, |
| 2288 | pHddStaCtx->roam_info.peerMac, |
| 2289 | WNI_CFG_BSSID_LEN); |
| 2290 | |
| 2291 | halStatus = hdd_RoamSetKeyCompleteHandler(pAdapter, |
| 2292 | &roamInfo, |
| 2293 | pHddStaCtx->roam_info.roamId, |
| 2294 | pHddStaCtx->roam_info.roamStatus, |
| 2295 | eCSR_ROAM_RESULT_AUTHENTICATED); |
| 2296 | if (halStatus != eHAL_STATUS_SUCCESS) |
| 2297 | { |
| 2298 | hddLog(LOGE, "%s: Set Key complete failure", __func__); |
| 2299 | } |
| 2300 | pHddStaCtx->roam_info.deferKeyComplete = FALSE; |
| 2301 | } |
| 2302 | |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2303 | /** |
| 2304 | * hdd_schedule_ecsa_chan_change_work() - schedule ecsa chan change work |
| 2305 | * @hal: hal context |
| 2306 | * @sta_session_id: sta session id |
| 2307 | * |
| 2308 | * Return: void. |
| 2309 | */ |
| 2310 | static void |
| 2311 | hdd_schedule_ecsa_chan_change_work(hdd_context_t *hdd_ctx, |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 2312 | uint8_t sta_session_id) |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2313 | { |
| 2314 | v_TIME_t conn_start_time; |
| 2315 | int32_t time_diff; |
| 2316 | |
| 2317 | conn_start_time = sme_get_connect_strt_time(hdd_ctx->hHal, sta_session_id); |
| 2318 | time_diff = vos_timer_get_system_time() - conn_start_time; |
| 2319 | |
| 2320 | if (time_diff < 0) |
| 2321 | time_diff = ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL; |
| 2322 | else if (time_diff > ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL) |
| 2323 | time_diff = 0; |
| 2324 | else |
| 2325 | time_diff = ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL - time_diff; |
| 2326 | |
| 2327 | hddLog(LOG1, FL("schedule ecsa_chan_change_work after %d ms"), time_diff); |
| 2328 | schedule_delayed_work(&hdd_ctx->ecsa_chan_change_work, |
| 2329 | msecs_to_jiffies(time_diff)); |
| 2330 | } |
| 2331 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2332 | static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 2333 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2334 | eCsrRoamResult roamResult ) |
| 2335 | { |
| 2336 | struct net_device *dev = pAdapter->dev; |
| 2337 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2338 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2339 | hdd_adapter_t *pHostapdAdapter = NULL; |
Girish Gowli | 257a7e6 | 2014-08-02 15:50:43 +0530 | [diff] [blame] | 2340 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 2341 | v_U8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2342 | tANI_U32 reqRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2343 | #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] | 2344 | int ft_carrier_on = FALSE; |
| 2345 | #endif |
| 2346 | int status; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2347 | v_BOOL_t hddDisconInProgress = FALSE; |
| 2348 | |
| 2349 | /* HDD has initiated disconnect, do not send connect result indication |
| 2350 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2351 | */ |
Agarwal Ashish | c089cec | 2015-08-10 13:10:04 +0530 | [diff] [blame] | 2352 | if (((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) || |
| 2353 | (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState)) && |
| 2354 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2355 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2356 | { |
| 2357 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2358 | FL(" Disconnect from HDD in progress ")); |
| 2359 | hddDisconInProgress = TRUE; |
| 2360 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2361 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2362 | if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult ) |
| 2363 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2364 | if ( !hddDisconInProgress ) |
| 2365 | { |
| 2366 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2367 | "%s: Set HDD connState to eConnectionState_Associated", |
| 2368 | __func__); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2369 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Associated ); |
| 2370 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2371 | |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 2372 | pAdapter->maxRateFlags = pRoamInfo->maxRateFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2373 | // Save the connection info from CSR... |
| 2374 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE ); |
Kapil Gupta | e686748 | 2016-06-26 13:31:37 +0530 | [diff] [blame] | 2375 | |
| 2376 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 2377 | if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) && |
| 2378 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 2379 | !hddDisconInProgress && |
| 2380 | pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled && |
| 2381 | pHddCtx->cfg_ini->isPERRoamRxPathEnabled) |
| 2382 | sme_set_per_roam_rxconfig(pHddCtx->hHal, |
| 2383 | pHddStaCtx->conn_info.staId[0], |
| 2384 | pHddCtx->cfg_ini->rateDownThreshold, |
| 2385 | pHddCtx->cfg_ini->rateUpThreshold, |
| 2386 | pHddCtx->cfg_ini->PERroamTriggerPercent, |
| 2387 | pHddCtx->cfg_ini->PERroamRxPktsThreshold, |
| 2388 | pHddCtx->cfg_ini->waitPeriodForNextPERScan); |
| 2389 | #endif |
| 2390 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2391 | #ifdef FEATURE_WLAN_WAPI |
| 2392 | if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE || |
| 2393 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK ) |
| 2394 | { |
| 2395 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2396 | } |
| 2397 | else |
| 2398 | { |
| 2399 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2400 | } |
| 2401 | #endif /* FEATURE_WLAN_WAPI */ |
| 2402 | |
| 2403 | // indicate 'connect' status to userspace |
| 2404 | hdd_SendAssociationEvent(dev,pRoamInfo); |
| 2405 | |
| 2406 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2407 | // Initialize the Linkup event completion variable |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2408 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2409 | |
| 2410 | /* |
| 2411 | Sometimes Switching ON the Carrier is taking time to activate the device properly. Before allowing any |
| 2412 | 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] | 2413 | 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] | 2414 | know that the device is getting activated properly. |
| 2415 | */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2416 | #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] | 2417 | if (pHddStaCtx->ft_carrier_on == FALSE && !hddDisconInProgress ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2418 | { |
| 2419 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2420 | // 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] | 2421 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 2422 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2423 | // 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] | 2424 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 2425 | |
| 2426 | // Switch on the Carrier to activate the device |
| 2427 | netif_carrier_on(dev); |
| 2428 | |
| 2429 | // Wait for the Link to up to ensure all the queues are set properly by the kernel |
| 2430 | status = wait_for_completion_interruptible_timeout(&pAdapter->linkup_event_var, |
| 2431 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2432 | if(!status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2433 | { |
| 2434 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning:ASSOC_LINKUP_TIMEOUT", __func__); |
| 2435 | } |
| 2436 | |
| 2437 | // Disable Linkup Event Servicing - no more service required from the net device notifier call |
| 2438 | pAdapter->isLinkUpSvcNeeded = FALSE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2439 | #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] | 2440 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2441 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2442 | pHddStaCtx->ft_carrier_on = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2443 | ft_carrier_on = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2444 | } |
| 2445 | #endif |
Sandeep Puligilla | d91dccb | 2014-06-18 11:51:48 +0530 | [diff] [blame] | 2446 | /* Check for STAID */ |
| 2447 | if( (WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId ) |
| 2448 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2449 | else |
| 2450 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Wrong Staid: %d", __func__, pRoamInfo->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2451 | |
| 2452 | //For reassoc, the station is already registered, all we need is to change the state |
| 2453 | //of the STA in TL. |
| 2454 | //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] | 2455 | //pRoamInfo->fReassocReq will be set only for the reassoc to same ap |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2456 | if( !pRoamInfo->fReassocReq ) |
| 2457 | { |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2458 | struct cfg80211_bss *bss; |
| 2459 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2460 | u8 *pFTAssocRsp = NULL; |
| 2461 | unsigned int assocRsplen = 0; |
| 2462 | u8 *pFTAssocReq = NULL; |
| 2463 | unsigned int assocReqlen = 0; |
| 2464 | struct ieee80211_channel *chan; |
| 2465 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2466 | v_U8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | tANI_U32 rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2468 | |
| 2469 | /* add bss_id to cfg80211 data base */ |
| 2470 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 2471 | if (NULL == bss) |
| 2472 | { |
Abhishek Singh | 7ca68f3 | 2016-06-28 10:23:10 +0530 | [diff] [blame] | 2473 | hddLog(LOGE, |
| 2474 | FL("Not able to create BSS entry")); |
Katya Nigam | 346d4e9 | 2014-09-02 16:16:12 +0530 | [diff] [blame] | 2475 | netif_carrier_off(dev); |
Abhishek Singh | 7ca68f3 | 2016-06-28 10:23:10 +0530 | [diff] [blame] | 2476 | if (!hddDisconInProgress) { |
| 2477 | /* |
| 2478 | * Here driver was not able to update cfg80211 database |
| 2479 | * this can happen if connected channel is not valid, |
| 2480 | * i.e reg domain was changed during connection. |
| 2481 | * Queue disconnect for the session if disconnect is |
| 2482 | * not in progress. |
| 2483 | */ |
| 2484 | hddLog(LOGE, FL("Disconnecting...")); |
| 2485 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2486 | pAdapter->sessionId, |
| 2487 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2488 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2489 | return eHAL_STATUS_FAILURE; |
| 2490 | } |
Abhinav Kumar | 4cde829 | 2019-07-18 14:17:25 +0530 | [diff] [blame] | 2491 | |
| 2492 | //Association Response |
| 2493 | pFTAssocRsp = (u8 *)(pRoamInfo->pbFrames + |
| 2494 | pRoamInfo->nBeaconLength + |
| 2495 | pRoamInfo->nAssocReqLength); |
| 2496 | if (pFTAssocRsp != NULL) |
| 2497 | { |
| 2498 | // pFTAssocRsp needs to point to the IEs |
| 2499 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 2500 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 2501 | (unsigned int)pFTAssocRsp[0], |
| 2502 | (unsigned int)pFTAssocRsp[1]); |
| 2503 | assocRsplen = |
| 2504 | pRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2505 | } |
| 2506 | else |
| 2507 | { |
| 2508 | hddLog(LOGE, "%s:AssocRsp is NULL", __func__); |
| 2509 | assocRsplen = 0; |
| 2510 | } |
| 2511 | |
| 2512 | //Association Request |
| 2513 | pFTAssocReq = (u8 *)(pRoamInfo->pbFrames + |
| 2514 | pRoamInfo->nBeaconLength); |
| 2515 | if (pFTAssocReq != NULL) |
| 2516 | { |
| 2517 | if(!ft_carrier_on) |
| 2518 | { |
| 2519 | // pFTAssocReq needs to point to the IEs |
| 2520 | pFTAssocReq += FT_ASSOC_REQ_IES_OFFSET; |
| 2521 | hddLog(LOG1, "%s: pFTAssocReq is now at %02x%02x", __func__, |
| 2522 | (unsigned int)pFTAssocReq[0], |
| 2523 | (unsigned int)pFTAssocReq[1]); |
| 2524 | assocReqlen = |
| 2525 | pRoamInfo->nAssocReqLength - FT_ASSOC_REQ_IES_OFFSET; |
| 2526 | } |
| 2527 | else |
| 2528 | { |
| 2529 | /* This should contain only the FTIEs */ |
| 2530 | assocReqlen = pRoamInfo->nAssocReqLength; |
| 2531 | } |
| 2532 | } |
| 2533 | else |
| 2534 | { |
| 2535 | hddLog(LOGE, "%s:AssocReq is NULL", __func__); |
| 2536 | assocReqlen = 0; |
| 2537 | } |
| 2538 | |
| 2539 | hddLog(LOG1, "assocReqlen %d assocRsplen %d", assocReqlen, |
| 2540 | assocRsplen); |
| 2541 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2542 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2543 | if(pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN || |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2544 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN_PSK ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2545 | { |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2546 | if(ft_carrier_on) |
| 2547 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2548 | if ( !hddDisconInProgress ) |
| 2549 | { |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2550 | struct cfg80211_bss *roam_bss; |
| 2551 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2552 | hddLog(LOG1, "%s ft_carrier_on is %d, sending roamed " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2553 | "indication", __FUNCTION__, ft_carrier_on); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2554 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2555 | (int)pRoamInfo->pBssDesc->channelId); |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2556 | if (pHddCtx->cfg_ini && |
| 2557 | pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2558 | { |
| 2559 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 2560 | } |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2561 | roam_bss = hdd_get_bss_entry(pAdapter->wdev.wiphy, |
| 2562 | chan, pRoamInfo->bssid, |
| 2563 | pRoamInfo->u.pConnectedProfile->SSID.ssId, |
| 2564 | pRoamInfo->u.pConnectedProfile->SSID.length); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2565 | hdd_send_roamed_ind(dev, roam_bss, |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2566 | pFTAssocReq, assocReqlen, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2567 | pFTAssocRsp, assocRsplen); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2568 | } |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 2569 | if (sme_GetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 2570 | { |
| 2571 | sme_SetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter), FALSE); |
| 2572 | pRoamInfo->fAuthRequired = FALSE; |
| 2573 | |
| 2574 | vos_mem_copy(pHddStaCtx->roam_info.bssid, |
| 2575 | pRoamInfo->bssid, |
| 2576 | HDD_MAC_ADDR_LEN); |
| 2577 | vos_mem_copy(pHddStaCtx->roam_info.peerMac, |
| 2578 | pRoamInfo->peerMac, |
| 2579 | HDD_MAC_ADDR_LEN); |
| 2580 | pHddStaCtx->roam_info.roamId = roamId; |
| 2581 | pHddStaCtx->roam_info.roamStatus = roamStatus; |
| 2582 | pHddStaCtx->roam_info.deferKeyComplete = TRUE; |
| 2583 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2584 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2585 | else if ( !hddDisconInProgress ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2586 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2587 | hddLog(LOG1, "%s ft_carrier_on is %d, sending connect " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2588 | "indication", __FUNCTION__, ft_carrier_on); |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2589 | hdd_connect_result(dev, pRoamInfo->bssid, pRoamInfo, |
| 2590 | pFTAssocReq, assocReqlen, |
| 2591 | pFTAssocRsp, assocRsplen, |
| 2592 | WLAN_STATUS_SUCCESS, |
| 2593 | GFP_KERNEL); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2594 | } |
| 2595 | } |
| 2596 | else |
| 2597 | #endif |
| 2598 | { |
| 2599 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 2600 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2601 | pAdapter->sessionId, |
| 2602 | &reqRsnLength, |
| 2603 | reqRsnIe); |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2604 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2605 | csrRoamGetWpaRsnRspIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2606 | pAdapter->sessionId, |
| 2607 | &rspRsnLength, |
| 2608 | rspRsnIe); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2609 | if ( !hddDisconInProgress ) |
| 2610 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2611 | #if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2612 | if(ft_carrier_on) |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2613 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2614 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2615 | if (pHddCtx->cfg_ini && |
| 2616 | pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2617 | { |
| 2618 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 2619 | } |
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 | else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2622 | #endif /* FEATURE_WLAN_ESE */ |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2623 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2624 | { |
| 2625 | hddLog(VOS_TRACE_LEVEL_INFO, |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2626 | "%s: sending connect indication to nl80211:" |
| 2627 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2628 | " result:%d and Status:%d", |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2629 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
| 2630 | roamResult, roamStatus); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2631 | /* inform connect result to nl80211 */ |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2632 | hdd_connect_result(dev, pRoamInfo->bssid, |
| 2633 | pRoamInfo, |
Abhinav Kumar | 4cde829 | 2019-07-18 14:17:25 +0530 | [diff] [blame] | 2634 | pFTAssocReq, assocReqlen, |
| 2635 | pFTAssocRsp, assocRsplen, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2636 | WLAN_STATUS_SUCCESS, |
| 2637 | GFP_KERNEL); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2638 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2639 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2640 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2641 | if ( !hddDisconInProgress ) |
| 2642 | { |
| 2643 | cfg80211_put_bss( |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2644 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2645 | pHddCtx->wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2646 | #endif |
| 2647 | bss); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2648 | // Register the Station with TL after associated... |
| 2649 | vosStatus = hdd_roamRegisterSTA( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2650 | pRoamInfo, |
| 2651 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2652 | NULL, |
| 2653 | pRoamInfo->pBssDesc ); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2655 | } |
| 2656 | else |
| 2657 | { |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 2658 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 2659 | /* in case of reassociation also need to indicate it to supplicant */ |
| 2660 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2661 | pAdapter->sessionId, |
| 2662 | &reqRsnLength, |
| 2663 | reqRsnIe); |
| 2664 | |
| 2665 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2666 | //Reassoc successfully |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2667 | if( pRoamInfo->fAuthRequired ) |
| 2668 | { |
| 2669 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 2670 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2671 | WLANTL_STA_CONNECTED ); |
| 2672 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 2673 | } |
| 2674 | else |
| 2675 | { |
| 2676 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2677 | "%s: staId: %d Changing TL state to AUTHENTICATED", |
| 2678 | __func__, pHddStaCtx->conn_info.staId[ 0 ] ); |
| 2679 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 2680 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2681 | WLANTL_STA_AUTHENTICATED ); |
| 2682 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2683 | hdd_postTLPacketPendingInd(pAdapter, |
| 2684 | pHddStaCtx->conn_info.staId[0]); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2685 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2686 | } |
| 2687 | |
| 2688 | if ( VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2689 | { |
| 2690 | // perform any WMM-related association processing |
| 2691 | hdd_wmm_assoc(pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2692 | } |
| 2693 | else |
| 2694 | { |
| 2695 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2696 | "Cannot register STA with TL. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2697 | vosStatus, vosStatus ); |
| 2698 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2699 | #ifdef WLAN_FEATURE_11W |
| 2700 | vos_mem_zero( &pAdapter->hdd_stats.hddPmfStats, |
| 2701 | sizeof(pAdapter->hdd_stats.hddPmfStats) ); |
| 2702 | #endif |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2703 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2704 | // Start the Queue |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 2705 | if ( !hddDisconInProgress ) |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2706 | { |
| 2707 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 2708 | netif_tx_wake_all_queues(dev); |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2709 | } |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2710 | if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2711 | { |
| 2712 | vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0); |
| 2713 | } |
Padma, Santhosh Kumar | 38cef18 | 2016-02-18 12:22:51 +0530 | [diff] [blame] | 2714 | #ifdef FEATURE_WLAN_TDLS |
| 2715 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 2716 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2717 | } |
| 2718 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2719 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2720 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 2721 | |
| 2722 | 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] | 2723 | if (pRoamInfo) |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 2724 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2725 | "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d", |
| 2726 | MAC_ADDR_ARRAY(pRoamInfo->bssid), roamResult, roamStatus); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2727 | else |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 2728 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2729 | "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d", |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2730 | MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 2731 | roamResult, roamStatus); |
Abhishek Singh | 6782c9e | 2017-06-06 13:37:45 +0530 | [diff] [blame] | 2732 | if (!pHddStaCtx->get_mgmt_log_sent) { |
| 2733 | pHddStaCtx->get_mgmt_log_sent = TRUE; |
Abhishek Singh | 611295e | 2015-07-09 11:11:54 +0530 | [diff] [blame] | 2734 | wlan_hdd_get_frame_logs(pAdapter, |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 2735 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Abhishek Singh | 6782c9e | 2017-06-06 13:37:45 +0530 | [diff] [blame] | 2736 | } |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 2737 | |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 2738 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 2739 | (pRoamInfo && |
| 2740 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) || |
| 2741 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) || |
| 2742 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode)))) { |
Abhishek Singh | e6137b8 | 2019-03-22 20:06:09 +0530 | [diff] [blame] | 2743 | wlan_hdd_cfg80211_unlink_bss(pAdapter, |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 2744 | pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId); |
| 2745 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 2746 | pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId); |
| 2747 | } |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2748 | /* Set connection state to eConnectionState_NotConnected only when CSR |
| 2749 | * has completed operation - with a ASSOCIATION_FAILURE status |
| 2750 | */ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2751 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2752 | { |
| 2753 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2754 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 2755 | __func__); |
| 2756 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected); |
| 2757 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2758 | if((pHddCtx->concurrency_mode <= 1) && |
| 2759 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2760 | { |
| 2761 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 2762 | } |
| 2763 | |
| 2764 | //If the Device Mode is Station |
| 2765 | // and the P2P Client is Connected |
| 2766 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2767 | |
| 2768 | // 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] | 2769 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2770 | if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 2771 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2772 | (vos_concurrent_open_sessions_running())) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2773 | { |
| 2774 | //Enable BMPS only of other Session is P2P Client |
| 2775 | hdd_context_t *pHddCtx = NULL; |
| 2776 | v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); |
| 2777 | |
| 2778 | if (NULL != pVosContext) |
| 2779 | { |
| 2780 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 2781 | |
| 2782 | if(NULL != pHddCtx) |
| 2783 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2784 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2785 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 2786 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2787 | { |
| 2788 | if (pHddCtx->hdd_wlan_suspended) |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 2789 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2790 | hdd_set_pwrparams(pHddCtx); |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 2791 | } |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2792 | hdd_enable_bmps_imps(pHddCtx); |
| 2793 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2794 | } |
| 2795 | } |
| 2796 | } |
| 2797 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2798 | /* CR465478: Only send up a connection failure result when CSR has |
Varun Reddy Yeturu | da7f0d5 | 2013-12-20 11:16:57 -0800 | [diff] [blame] | 2799 | * completed operation - with a ASSOCIATION_FAILURE status.*/ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2800 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2801 | { |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 2802 | |
| 2803 | if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 2804 | { |
| 2805 | hddLog(LOG1, |
| 2806 | FL("Assoication Failure for P2P client and we are trying to re-enable TDLS")); |
| 2807 | wlan_hdd_tdls_reenable(pHddCtx); |
| 2808 | } |
| 2809 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2810 | if (pRoamInfo) { |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2811 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2812 | "%s: send connect failure to nl80211:" |
| 2813 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2814 | " result:%d and Status:%d reasonCode %d" , |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2815 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2816 | roamResult, roamStatus, pRoamInfo->reasonCode); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2817 | pHddStaCtx->conn_info.assoc_status_code = |
| 2818 | pRoamInfo->statusCode; |
| 2819 | } else { |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2820 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2821 | "%s: connect failed:" |
| 2822 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2823 | " result:%d and Status:%d" , |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2824 | __func__, MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 2825 | roamResult, roamStatus); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2826 | } |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2827 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2828 | /* inform association failure event to nl80211 */ |
| 2829 | if ( eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult ) |
| 2830 | { |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2831 | if (pRoamInfo) |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2832 | hdd_connect_result(dev, pRoamInfo->bssid, NULL, |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2833 | NULL, 0, NULL, 0, |
| 2834 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2835 | GFP_KERNEL); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2836 | else |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2837 | hdd_connect_result(dev, pWextState->req_bssId, NULL, |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2838 | NULL, 0, NULL, 0, |
| 2839 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2840 | GFP_KERNEL); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2841 | } |
| 2842 | else |
| 2843 | { |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2844 | if (pRoamInfo) |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2845 | hdd_connect_result(dev, pRoamInfo->bssid, NULL, |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2846 | NULL, 0, NULL, 0, |
| 2847 | pRoamInfo->reasonCode ? |
| 2848 | pRoamInfo->reasonCode : |
| 2849 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2850 | GFP_KERNEL); |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2851 | else |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2852 | hdd_connect_result(dev, pWextState->req_bssId, NULL, |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2853 | NULL, 0, NULL, 0, |
| 2854 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2855 | GFP_KERNEL); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2856 | } |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2857 | /*Clear the roam profile*/ |
| 2858 | hdd_clearRoamProfileIe( pAdapter ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2859 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2860 | |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 2861 | hdd_wmm_init( pAdapter ); |
Madan Mohan Koyyalamudi | ee255f1 | 2012-09-28 15:41:19 -0700 | [diff] [blame] | 2862 | |
c_hpothu | 24f4098 | 2014-04-18 18:00:36 +0530 | [diff] [blame] | 2863 | if (pRoamInfo) |
| 2864 | { |
| 2865 | WLANTL_AssocFailed(pRoamInfo->staId); |
| 2866 | } |
Mihir Shete | b733727 | 2014-04-11 15:53:08 +0530 | [diff] [blame] | 2867 | |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2868 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2869 | netif_tx_disable(dev); |
| 2870 | netif_carrier_off(dev); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2871 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2872 | } |
| 2873 | |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2874 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2875 | { |
| 2876 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 2877 | if (pHostapdAdapter != NULL) |
| 2878 | { |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2879 | /* Restart SAP if its operating channel is different |
| 2880 | * from AP channel. |
| 2881 | */ |
| 2882 | if (pHostapdAdapter->sessionCtx.ap.operatingChannel != |
| 2883 | (int)pRoamInfo->pBssDesc->channelId) |
| 2884 | { |
| 2885 | hddLog(VOS_TRACE_LEVEL_INFO,"Restart Sap as SAP channel is %d " |
| 2886 | "and STA channel is %d", pHostapdAdapter->sessionCtx.ap.operatingChannel, |
| 2887 | (int)pRoamInfo->pBssDesc->channelId); |
Hanumanth Reddy Pothula | 8d4b8eb | 2018-02-26 16:14:10 +0530 | [diff] [blame] | 2888 | if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->force_scc_with_ecsa) |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2889 | { |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2890 | hdd_schedule_ecsa_chan_change_work(pHddCtx, |
| 2891 | pAdapter->sessionId); |
| 2892 | } |
| 2893 | else |
| 2894 | { |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2895 | hdd_hostapd_stop(pHostapdAdapter->dev); |
Hanumanth Reddy Pothula | 8d4b8eb | 2018-02-26 16:14:10 +0530 | [diff] [blame] | 2896 | if (pHddCtx->cfg_ini && |
| 2897 | pHddCtx->cfg_ini->enable_sap_auth_offload) |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2898 | hdd_force_scc_restart_sap(pHostapdAdapter, |
| 2899 | pHddCtx, (int)pRoamInfo->pBssDesc->channelId); |
| 2900 | } |
Agrawal Ashish | 574b3e6 | 2017-02-09 18:58:34 +0530 | [diff] [blame] | 2901 | |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2902 | } |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2903 | } |
| 2904 | } |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 2905 | else if (roamStatus == eCSR_ROAM_ASSOCIATION_FAILURE) |
| 2906 | { |
| 2907 | hdd_check_and_move_if_sap_is_on_dfs_chan(pHddCtx, pAdapter); |
| 2908 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2909 | return eHAL_STATUS_SUCCESS; |
| 2910 | } |
| 2911 | |
| 2912 | /**============================================================================ |
| 2913 | * |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2914 | @brief hdd_RoamIbssIndicationHandler() - Here we update the status of the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2915 | 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] | 2916 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2917 | ===========================================================================*/ |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2918 | static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter, |
| 2919 | tCsrRoamInfo *pRoamInfo, |
| 2920 | tANI_U32 roamId, |
| 2921 | eRoamCmdStatus roamStatus, |
| 2922 | eCsrRoamResult roamResult ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2923 | { |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2924 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 2925 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 2926 | struct cfg80211_bss *bss; |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 2927 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2928 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2929 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d", |
| 2930 | __func__, pAdapter->dev->name, roamId, roamStatus, roamResult); |
| 2931 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2932 | switch( roamResult ) |
| 2933 | { |
| 2934 | // both IBSS Started and IBSS Join should come in here. |
| 2935 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 2936 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2937 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2938 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2939 | if (NULL == pRoamInfo) |
| 2940 | { |
| 2941 | VOS_ASSERT(0); |
| 2942 | return; |
| 2943 | } |
| 2944 | |
| 2945 | /* When IBSS Started comes from CSR, we need to move |
| 2946 | * connection state to IBSS Disconnected (meaning no peers |
| 2947 | * are in the IBSS). |
| 2948 | */ |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2949 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2950 | "%s: Set HDD connState to eConnectionState_IbssDisconnected", |
| 2951 | __func__); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2952 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 2953 | eConnectionState_IbssDisconnected ); |
Abhishek Singh | 1c21c4d | 2014-04-25 16:40:19 +0530 | [diff] [blame] | 2954 | /*notify wmm */ |
| 2955 | hdd_wmm_connect(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2956 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2957 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2958 | if (pRoamInfo->pBssDesc) |
| 2959 | { |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2960 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 2961 | struct ieee80211_channel *chan; |
| 2962 | int chan_no; |
| 2963 | unsigned int freq; |
| 2964 | #endif |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2965 | hdd_ibss_RegisterSTA (pAdapter, pRoamInfo, |
| 2966 | IBSS_BROADCAST_STAID, |
| 2967 | &broadcastMacAddr, pRoamInfo->pBssDesc); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2968 | |
| 2969 | /* we created the IBSS, notify supplicant */ |
| 2970 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: created ibss " |
| 2971 | MAC_ADDRESS_STR, |
| 2972 | __func__, pAdapter->dev->name, |
| 2973 | MAC_ADDR_ARRAY(pRoamInfo->pBssDesc->bssId)); |
| 2974 | |
| 2975 | /* we must first give cfg80211 the BSS information */ |
| 2976 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 2977 | if (NULL == bss) |
| 2978 | { |
| 2979 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2980 | "%s: %s: unable to create IBSS entry", |
| 2981 | __func__, pAdapter->dev->name); |
| 2982 | return; |
| 2983 | } |
Abhishek Singh | 00b7197 | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 2984 | #ifdef WLAN_FEATURE_RMC |
| 2985 | netif_carrier_on(pAdapter->dev); |
| 2986 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
| 2987 | netif_tx_start_all_queues(pAdapter->dev); |
| 2988 | #endif |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2989 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 2990 | chan_no = pRoamInfo->pBssDesc->channelId; |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2991 | |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2992 | if (chan_no <= 14) |
| 2993 | freq = ieee80211_channel_to_frequency(chan_no, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2994 | HDD_NL80211_BAND_2GHZ); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2995 | else |
| 2996 | freq = ieee80211_channel_to_frequency(chan_no, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2997 | HDD_NL80211_BAND_5GHZ); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2998 | |
| 2999 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 3000 | |
| 3001 | if (chan) |
| 3002 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 3003 | chan, GFP_KERNEL); |
| 3004 | else |
| 3005 | hddLog(LOGE, FL("%s: chanId: %d, can't find channel"), |
| 3006 | pAdapter->dev->name, |
| 3007 | (int)pRoamInfo->pBssDesc->channelId); |
| 3008 | #else |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3009 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 3010 | #endif |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 3011 | cfg80211_put_bss( |
| 3012 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 3013 | pHddCtx->wiphy, |
| 3014 | #endif |
| 3015 | bss); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3016 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3017 | else |
| 3018 | { |
| 3019 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3020 | "%s: NULL Bss Desc",__func__); |
| 3021 | } |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3022 | |
| 3023 | /* Set Broadcast key again in case IBSS_COALESCED as DEL BSS, |
| 3024 | * in IBSS_COALESCED will remove the BC key. |
| 3025 | */ |
| 3026 | if ((eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) && |
| 3027 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY |
| 3028 | == pHddStaCtx->ibss_enc_key.encType |
| 3029 | ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY |
| 3030 | == pHddStaCtx->ibss_enc_key.encType |
| 3031 | ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType |
| 3032 | ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType )) |
| 3033 | { |
| 3034 | u8 grpmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3035 | VOS_STATUS vosStatus; |
| 3036 | |
| 3037 | pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX; |
| 3038 | |
| 3039 | memcpy(&pHddStaCtx->ibss_enc_key.peerMac, |
| 3040 | grpmacaddr, WNI_CFG_BSSID_LEN); |
| 3041 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3042 | FL(" SET GTK in case of COALESCED")); |
| 3043 | vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3044 | pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId ); |
| 3045 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 3046 | { |
| 3047 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3048 | FL("sme_RoamSetKey failed, returned %d"),vosStatus); |
| 3049 | } |
| 3050 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3051 | break; |
| 3052 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3053 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3054 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3055 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3056 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unable to create IBSS", |
| 3057 | __func__, pAdapter->dev->name); |
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 | default: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3062 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unexpected result %d", |
| 3063 | __func__, pAdapter->dev->name, (int)roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3064 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3065 | } |
| 3066 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3067 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3068 | } |
| 3069 | |
| 3070 | /**============================================================================ |
| 3071 | * |
| 3072 | @brief roamSaveIbssStation() - Save the IBSS peer MAC address in the adapter. |
| 3073 | This information is passed to iwconfig later. The peer that joined |
| 3074 | last is passed as information to iwconfig. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3075 | 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] | 3076 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3077 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3078 | ===========================================================================*/ |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3079 | 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] | 3080 | { |
| 3081 | int fSuccess = FALSE; |
| 3082 | int idx = 0; |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3083 | VOS_STATUS status; |
| 3084 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3085 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3086 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 3087 | { |
| 3088 | if ( 0 == pHddStaCtx->conn_info.staId[ idx ] ) |
| 3089 | { |
| 3090 | pHddStaCtx->conn_info.staId[ idx ] = staId; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3091 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3092 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ], peerMacAddress ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3093 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3094 | fSuccess = TRUE; |
| 3095 | break; |
| 3096 | } |
| 3097 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3098 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3099 | status = hdd_sta_id_hash_add_entry(pAdapter, staId, peerMacAddress); |
| 3100 | if (status != VOS_STATUS_SUCCESS) { |
| 3101 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3102 | FL("Not able to add staid hash %d"), staId); |
| 3103 | return FALSE; |
| 3104 | } |
| 3105 | |
| 3106 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3107 | FL("New station added sta_id %d mac:" |
| 3108 | MAC_ADDRESS_STR), staId, |
| 3109 | MAC_ADDR_ARRAY(peerMacAddress->bytes)); |
| 3110 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3111 | return( fSuccess ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3112 | } |
| 3113 | /**============================================================================ |
| 3114 | * |
| 3115 | @brief roamRemoveIbssStation() - Remove the IBSS peer MAC address in the adapter. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3116 | 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] | 3117 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3118 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3119 | ===========================================================================*/ |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3120 | static int roamRemoveIbssStation( hdd_adapter_t *pAdapter, v_U8_t staId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3121 | { |
| 3122 | int fSuccess = FALSE; |
| 3123 | int idx = 0; |
| 3124 | v_U8_t valid_idx = 0; |
| 3125 | v_U8_t del_idx = 0; |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3126 | v_U8_t empty_slots = 0; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3127 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3128 | VOS_STATUS status; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3129 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3130 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 3131 | { |
| 3132 | if ( staId == pHddStaCtx->conn_info.staId[ idx ] ) |
| 3133 | { |
| 3134 | pHddStaCtx->conn_info.staId[ idx ] = 0; |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3135 | status = hdd_sta_id_hash_remove_entry(pAdapter, |
| 3136 | staId, &pHddStaCtx->conn_info.peerMacAddress[idx]); |
| 3137 | if (status != VOS_STATUS_SUCCESS) { |
| 3138 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3139 | FL("Not able to remove staid hash %d"), staId ); |
| 3140 | fSuccess = FALSE; |
| 3141 | } else { |
| 3142 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3143 | FL("station removed sta_id %d mac:" |
| 3144 | MAC_ADDRESS_STR), staId, |
| 3145 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[idx].bytes)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3146 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3147 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3148 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3149 | fSuccess = TRUE; |
| 3150 | // Note the deleted Index, if its 0 we need special handling |
| 3151 | del_idx = idx; |
| 3152 | empty_slots++; |
| 3153 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3154 | } |
| 3155 | else |
| 3156 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3157 | if (pHddStaCtx->conn_info.staId[idx] != 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3158 | { |
| 3159 | valid_idx = idx; |
| 3160 | } |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3161 | else |
| 3162 | { |
| 3163 | // Found an empty slot |
| 3164 | empty_slots++; |
| 3165 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3166 | } |
| 3167 | } |
| 3168 | |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3169 | if (HDD_MAX_NUM_IBSS_STA == empty_slots) |
| 3170 | { |
| 3171 | // Last peer departed, set the IBSS state appropriately |
| 3172 | pHddStaCtx->conn_info.connState = eConnectionState_IbssDisconnected; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3173 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3174 | "Last IBSS Peer Departed!!!" ); |
| 3175 | } |
| 3176 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3177 | // Find next active staId, to have a valid sta trigger for TL. |
| 3178 | if (fSuccess == TRUE) |
| 3179 | { |
| 3180 | if (del_idx == 0) |
| 3181 | { |
| 3182 | if (pHddStaCtx->conn_info.staId[valid_idx] != 0) |
| 3183 | { |
| 3184 | pHddStaCtx->conn_info.staId[0] = pHddStaCtx->conn_info.staId[valid_idx]; |
| 3185 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], |
| 3186 | &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ]); |
| 3187 | |
| 3188 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
| 3189 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ] ); |
| 3190 | } |
| 3191 | } |
| 3192 | } |
| 3193 | return( fSuccess ); |
| 3194 | } |
| 3195 | |
| 3196 | /**============================================================================ |
| 3197 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3198 | @brief roamIbssConnectHandler() : We update the status of the IBSS to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3199 | connected in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3200 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3201 | ===========================================================================*/ |
| 3202 | static eHalStatus roamIbssConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo ) |
| 3203 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3204 | struct cfg80211_bss *bss; |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 3205 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3206 | "%s: IBSS Connect Indication from SME!!! " |
| 3207 | "Set HDD connState to eConnectionState_IbssConnected", |
| 3208 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3209 | // Set the internal connection state to show 'IBSS Connected' (IBSS with a partner stations)... |
| 3210 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssConnected ); |
| 3211 | |
| 3212 | // Save the connection info from CSR... |
| 3213 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS ); |
| 3214 | |
| 3215 | // Send the bssid address to the wext. |
| 3216 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3217 | /* add bss_id to cfg80211 data base */ |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3218 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3219 | if (NULL == bss) |
| 3220 | { |
| 3221 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3222 | "%s: %s: unable to create IBSS entry", |
| 3223 | __func__, pAdapter->dev->name); |
| 3224 | return eHAL_STATUS_FAILURE; |
| 3225 | } |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 3226 | cfg80211_put_bss( |
| 3227 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 3228 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
| 3229 | #endif |
| 3230 | bss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3231 | |
| 3232 | return( eHAL_STATUS_SUCCESS ); |
| 3233 | } |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 3234 | |
| 3235 | /**============================================================================ |
| 3236 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3237 | @brief hdd_RoamSetKeyCompleteHandler() - Update the security parameters. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3238 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3239 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3240 | static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 3241 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3242 | eCsrRoamResult roamResult ) |
| 3243 | { |
| 3244 | eCsrEncryptionType connectedCipherAlgo; |
| 3245 | v_BOOL_t fConnected = FALSE; |
| 3246 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 3247 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3248 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3249 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3250 | WLANTL_STAStateType prevTLState = WLANTL_STA_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3251 | ENTER(); |
Srinivas Girigowda | 5a737f2 | 2013-06-28 15:21:48 -0700 | [diff] [blame] | 3252 | |
| 3253 | if (NULL == pRoamInfo) |
| 3254 | { |
| 3255 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "pRoamInfo is NULL"); |
| 3256 | return eHAL_STATUS_FAILURE; |
| 3257 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3258 | // 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] | 3259 | // then go to 'authenticated'. For all other authentication types (those that do |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3260 | // not require upper layer authentication) we can put TL directly into 'authenticated' |
| 3261 | // state. |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3262 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3263 | "Set Key completion roamStatus =%d roamResult=%d " MAC_ADDRESS_STR, |
| 3264 | roamStatus, roamResult, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3266 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 3267 | if( fConnected ) |
| 3268 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3269 | if ( WLAN_HDD_IBSS == pAdapter->device_mode ) |
| 3270 | { |
| 3271 | v_U8_t staId; |
| 3272 | |
| 3273 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 3274 | |
| 3275 | if ( 0 == memcmp( pRoamInfo->peerMac, |
| 3276 | &broadcastMacAddr, VOS_MAC_ADDR_SIZE ) ) |
| 3277 | { |
| 3278 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3279 | IBSS_BROADCAST_STAID); |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3280 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3281 | "WLAN TL STA GTK Installed for STAID=%d", IBSS_BROADCAST_STAID); |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3282 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3283 | } |
| 3284 | else |
| 3285 | { |
| 3286 | vosStatus = hdd_Ibss_GetStaId(pHddStaCtx, |
| 3287 | (v_MACADDR_t*)pRoamInfo->peerMac, |
| 3288 | &staId); |
| 3289 | if ( VOS_STATUS_SUCCESS == vosStatus ) |
| 3290 | { |
| 3291 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3292 | "WLAN TL STA Ptk Installed for STAID=%d", staId); |
| 3293 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3294 | staId); |
| 3295 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3296 | } |
| 3297 | } |
| 3298 | } |
| 3299 | else |
| 3300 | { |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3301 | WLANTL_GetSTAState(pHddCtx->pvosContext, |
| 3302 | pHddStaCtx->conn_info.staId[0], |
| 3303 | &prevTLState); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3304 | // TODO: Considering getting a state machine in HDD later. |
| 3305 | // This routine is invoked twice. 1)set PTK 2)set GTK. |
| 3306 | // The folloing if statement will be TRUE when setting GTK. |
| 3307 | // At this time we don't handle the state in detail. |
| 3308 | // Related CR: 174048 - TL not in authenticated state |
| 3309 | if ( ( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) && |
| 3310 | (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired ) |
| 3311 | { |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3312 | |
| 3313 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set " |
| 3314 | "for StaId=%d. Changing TL state to AUTHENTICATED from" |
| 3315 | " state:%d", pHddStaCtx->conn_info.staId[0], prevTLState); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3316 | |
| 3317 | // Connections that do not need Upper layer authentication, |
| 3318 | // transition TL to 'Authenticated' state after the keys are set. |
| 3319 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 3320 | pHddStaCtx->conn_info.staId[ 0 ], |
| 3321 | WLANTL_STA_AUTHENTICATED ); |
| 3322 | |
| 3323 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3324 | |
| 3325 | if (WLANTL_STA_AUTHENTICATED != prevTLState) |
| 3326 | hdd_postTLPacketPendingInd(pAdapter, |
| 3327 | pHddStaCtx->conn_info.staId[0]); |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 3328 | //Need to call offload because when roaming happen at that time fwr |
| 3329 | //clean offload info as part of the DelBss |
| 3330 | // No need to configure offload if host was not suspended |
| 3331 | spin_lock(&pHddCtx->filter_lock); |
| 3332 | if(pHddCtx->hdd_wlan_suspended) |
| 3333 | { |
| 3334 | spin_unlock(&pHddCtx->filter_lock); |
| 3335 | hdd_ReConfigSuspendDataClearedDuringRoaming(pHddCtx); |
| 3336 | } |
| 3337 | else |
| 3338 | { |
| 3339 | spin_unlock(&pHddCtx->filter_lock); |
| 3340 | } |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 3341 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 3342 | { |
| 3343 | vos_record_roam_event(e_HDD_SET_GTK_RSP, NULL, 0); |
| 3344 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3345 | } |
| 3346 | else |
| 3347 | { |
| 3348 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3349 | pHddStaCtx->conn_info.staId[ 0 ]); |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3350 | |
| 3351 | /* In case of OSEN move TL to 'Authenticated' after PTK is set */ |
| 3352 | if (pWextState->roamProfile.bOSENAssociation == VOS_TRUE) |
| 3353 | { |
| 3354 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "PTK set" |
| 3355 | " for StaId=%d. Due to OSEN, Changing TL state to" |
| 3356 | "AUTHENTICATED from state:%d", |
| 3357 | pHddStaCtx->conn_info.staId[0], prevTLState); |
| 3358 | |
| 3359 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 3360 | pHddStaCtx->conn_info.staId[ 0 ], |
| 3361 | WLANTL_STA_AUTHENTICATED ); |
| 3362 | |
| 3363 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 3364 | |
| 3365 | if (WLANTL_STA_AUTHENTICATED != prevTLState) |
| 3366 | hdd_postTLPacketPendingInd(pAdapter, |
| 3367 | pHddStaCtx->conn_info.staId[0]); |
| 3368 | } |
| 3369 | |
| 3370 | |
| 3371 | |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 3372 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 3373 | { |
| 3374 | vos_record_roam_event(e_HDD_SET_PTK_RSP, (void *)pRoamInfo->peerMac, 6); |
| 3375 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3376 | } |
| 3377 | |
| 3378 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3379 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3380 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3381 | else |
| 3382 | { |
| 3383 | // possible disassoc after issuing set key and waiting set key complete |
| 3384 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3385 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3386 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3387 | EXIT(); |
| 3388 | return( eHAL_STATUS_SUCCESS ); |
| 3389 | } |
| 3390 | /**============================================================================ |
| 3391 | * |
| 3392 | @brief hdd_RoamMicErrorIndicationHandler() - This function indicates the Mic failure to the supplicant. |
| 3393 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3394 | static eHalStatus hdd_RoamMicErrorIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3395 | tANI_U32 roamId, eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3396 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3397 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3398 | |
| 3399 | if( eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3400 | TKIP_COUNTER_MEASURE_STOPED == pHddStaCtx->WextState.mTKIPCounterMeasures ) |
| 3401 | { |
| 3402 | struct iw_michaelmicfailure msg; |
| 3403 | union iwreq_data wreq; |
| 3404 | memset(&msg, '\0', sizeof(msg)); |
| 3405 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3406 | 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] | 3407 | hddLog(LOG1, "MIC MAC " MAC_ADDRESS_STR, |
| 3408 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3410 | if(pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) |
| 3411 | msg.flags = IW_MICFAILURE_GROUP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3412 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3413 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3414 | memset(&wreq, 0, sizeof(wreq)); |
| 3415 | wreq.data.length = sizeof(msg); |
| 3416 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, (char *)&msg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3417 | /* inform mic failure to nl80211 */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3418 | cfg80211_michael_mic_failure(pAdapter->dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3419 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3420 | ((pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) ? |
| 3421 | NL80211_KEYTYPE_GROUP : |
| 3422 | NL80211_KEYTYPE_PAIRWISE), |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3423 | pRoamInfo->u.pMICFailureInfo->keyId, |
| 3424 | pRoamInfo->u.pMICFailureInfo->TSC, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3425 | GFP_KERNEL); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3426 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3427 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3428 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3429 | return( eHAL_STATUS_SUCCESS ); |
| 3430 | } |
| 3431 | |
| 3432 | /**============================================================================ |
| 3433 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3434 | @brief roamRoamConnectStatusUpdateHandler() - The Ibss connection status is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3435 | updated regularly here in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3436 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3437 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3438 | static eHalStatus roamRoamConnectStatusUpdateHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 3439 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3440 | eCsrRoamResult roamResult ) |
| 3441 | { |
| 3442 | VOS_STATUS vosStatus; |
| 3443 | |
| 3444 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3445 | switch( roamResult ) |
| 3446 | { |
| 3447 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3448 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3449 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3450 | struct station_info *staInfo; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3451 | |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 3452 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3453 | "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] | 3454 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 3455 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3456 | pRoamInfo->staId ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3457 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3458 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3459 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3460 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
| 3461 | WLANTL_UpdateSTABssIdforIBSS(pHddCtx->pvosContext, |
| 3462 | IBSS_BROADCAST_STAID,pHddStaCtx->conn_info.bssId); |
| 3463 | |
| 3464 | // Register the Station with TL for the new peer. |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3465 | vosStatus = hdd_ibss_RegisterSTA( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3466 | pRoamInfo, |
| 3467 | pRoamInfo->staId, |
| 3468 | (v_MACADDR_t *)pRoamInfo->peerMac, |
| 3469 | pRoamInfo->pBssDesc ); |
| 3470 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3471 | { |
| 3472 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3473 | "Cannot register STA with TL for IBSS. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3474 | vosStatus, vosStatus ); |
| 3475 | } |
Abhishek Singh | decf1b6 | 2016-02-09 11:53:58 +0530 | [diff] [blame] | 3476 | if (!roamSaveIbssStation(pAdapter, |
| 3477 | pRoamInfo->staId, |
| 3478 | (v_MACADDR_t *)pRoamInfo->peerMac)) |
| 3479 | { |
| 3480 | hddLog(LOGW, FL("Not Able to add sta in sta hash")); |
| 3481 | break; |
| 3482 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3483 | pHddStaCtx->ibss_sta_generation++; |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3484 | |
| 3485 | staInfo = vos_mem_malloc(sizeof(*staInfo)); |
| 3486 | if (staInfo == NULL) { |
| 3487 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3488 | "memory allocation for station_info failed"); |
| 3489 | return eHAL_STATUS_FAILED_ALLOC; |
| 3490 | } |
| 3491 | |
| 3492 | memset(staInfo, 0, sizeof(*staInfo)); |
| 3493 | staInfo->filled = 0; |
| 3494 | staInfo->generation = pHddStaCtx->ibss_sta_generation; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3495 | |
| 3496 | cfg80211_new_sta(pAdapter->dev, |
| 3497 | (const u8 *)pRoamInfo->peerMac, |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3498 | staInfo, GFP_KERNEL); |
| 3499 | vos_mem_free(staInfo); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3500 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3501 | if ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 3502 | ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 3503 | ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType |
| 3504 | ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType ) |
| 3505 | { |
| 3506 | pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX; |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3507 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3508 | memcpy(&pHddStaCtx->ibss_enc_key.peerMac, |
| 3509 | pRoamInfo->peerMac, WNI_CFG_BSSID_LEN); |
| 3510 | |
| 3511 | VOS_TRACE( VOS_MODULE_ID_HDD, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3512 | VOS_TRACE_LEVEL_INFO_HIGH, "New peer joined set PTK encType=%d", |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3513 | pHddStaCtx->ibss_enc_key.encType); |
| 3514 | |
| 3515 | vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3516 | pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId ); |
| 3517 | |
| 3518 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 3519 | { |
| 3520 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3521 | "%s: sme_RoamSetKey failed, returned %d", |
| 3522 | __func__, vosStatus); |
| 3523 | return VOS_STATUS_E_FAILURE; |
| 3524 | } |
| 3525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3526 | netif_carrier_on(pAdapter->dev); |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 3527 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3528 | netif_tx_start_all_queues(pAdapter->dev); |
| 3529 | break; |
| 3530 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3532 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3533 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3534 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3535 | roamIbssConnectHandler( pAdapter, pRoamInfo ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3536 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3537 | break; |
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_PEER_DEPARTED: |
| 3540 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3541 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3542 | |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3543 | if ( !roamRemoveIbssStation(pAdapter, pRoamInfo->staId ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3544 | { |
| 3545 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 3546 | "IBSS peer departed by cannot find peer in our registration table with TL" ); |
| 3547 | } |
| 3548 | |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 3549 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3550 | "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] | 3551 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 3552 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
| 3553 | pRoamInfo->staId ); |
| 3554 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3555 | hdd_ibss_DeregisterSTA( pAdapter, pRoamInfo->staId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3556 | |
| 3557 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3558 | pHddStaCtx->ibss_sta_generation++; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3559 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3560 | cfg80211_del_sta(pAdapter->dev, |
| 3561 | (const u8 *)&pRoamInfo->peerMac, |
| 3562 | GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3563 | break; |
| 3564 | } |
| 3565 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3566 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3567 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 3568 | "Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3569 | // Stop only when we are inactive |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 3570 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3571 | netif_tx_disable(pAdapter->dev); |
| 3572 | netif_carrier_off(pAdapter->dev); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 3573 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3574 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 3575 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3576 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_NotConnected ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3578 | // Send the bssid address to the wext. |
| 3579 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
| 3580 | // clean up data path |
| 3581 | hdd_disconnect_tx_rx(pAdapter); |
| 3582 | break; |
| 3583 | } |
| 3584 | default: |
| 3585 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3586 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3587 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3588 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3589 | return( eHAL_STATUS_SUCCESS ); |
| 3590 | } |
| 3591 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3592 | #ifdef FEATURE_WLAN_TDLS |
| 3593 | /**============================================================================ |
| 3594 | * |
| 3595 | @brief hdd_roamRegisterTDLSSTA() - Construct the staDesc and register with |
| 3596 | TL the new STA. This is called as part of ADD_STA in the TDLS setup |
| 3597 | Return: VOS_STATUS |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3598 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3599 | ===========================================================================*/ |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 3600 | VOS_STATUS hdd_roamRegisterTDLSSTA(hdd_adapter_t *pAdapter, |
| 3601 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 3602 | const tANI_U8 *peerMac, |
| 3603 | #else |
| 3604 | tANI_U8 *peerMac, |
| 3605 | #endif |
| 3606 | tANI_U16 staId, tANI_U8 ucastSig) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3607 | { |
| 3608 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3609 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3610 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 3611 | WLAN_STADescType staDesc = {0}; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3612 | eCsrEncryptionType connectedCipherAlgo = eCSR_ENCRYPT_TYPE_UNKNOWN; |
| 3613 | v_BOOL_t fConnected = FALSE; |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 3614 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3615 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3616 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3617 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 3618 | if (!fConnected) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3619 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3620 | "%s not connected. ignored", __func__); |
| 3621 | return VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3622 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3623 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3624 | /* |
| 3625 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3626 | * be peer MAC, here we are wokrking on direct Link |
| 3627 | */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3628 | staDesc.ucSTAId = staId ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3629 | |
| 3630 | staDesc.wSTAType = WLAN_STA_TDLS ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3631 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3632 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3633 | sizeof(tSirMacAddr) ); |
| 3634 | |
| 3635 | vos_mem_copy(staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 ); |
| 3636 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 3637 | |
| 3638 | /* set the QoS field appropriately ..*/ |
| 3639 | (hdd_wmm_is_active(pAdapter)) ? (staDesc.ucQosEnabled = 1) |
| 3640 | : (staDesc.ucQosEnabled = 0) ; |
| 3641 | |
| 3642 | 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] | 3643 | TL QoS_enabled=%d", staDesc.ucQosEnabled ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3644 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3645 | staDesc.ucProtectedFrame = (connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3646 | |
| 3647 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3648 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3649 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3650 | /* |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3651 | * UMA is ready we inform TL to do frame translation. |
| 3652 | */ |
| 3653 | staDesc.ucSwFrameTXXlation = 1; |
| 3654 | staDesc.ucSwFrameRXXlation = 1; |
| 3655 | staDesc.ucAddRmvLLC = 1; |
| 3656 | |
| 3657 | /* Initialize signatures and state */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3658 | staDesc.ucUcastSig = ucastSig ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3659 | |
| 3660 | /* tdls Direct Link do not need bcastSig */ |
| 3661 | staDesc.ucBcastSig = 0 ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3662 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3663 | if(staDesc.ucProtectedFrame) |
| 3664 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 3665 | else |
| 3666 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3667 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3668 | staDesc.ucInitState = WLANTL_STA_CONNECTED ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3669 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3670 | /* Register the Station with TL... */ |
| 3671 | vosStatus = WLANTL_RegisterSTAClient( pVosContext, |
| 3672 | hdd_rx_packet_cbk, |
| 3673 | hdd_tx_complete_cbk, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3674 | hdd_tx_fetch_packet_cbk, &staDesc, 0 ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3675 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3676 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3677 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3678 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3679 | "%s: WLANTL_RegisterSTAClient() failed to register. " |
| 3680 | "Status= %d [0x%08X]", __func__, vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3681 | return vosStatus; |
| 3682 | } |
| 3683 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 3684 | if ( cfg_param->dynSplitscan && |
| 3685 | ( VOS_TIMER_STATE_RUNNING != |
| 3686 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)) ) |
| 3687 | { |
| 3688 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 3689 | cfg_param->trafficMntrTmrForSplitScan); |
| 3690 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3691 | return( vosStatus ); |
| 3692 | } |
| 3693 | |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 3694 | VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 3695 | { |
| 3696 | VOS_STATUS vosStatus; |
| 3697 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 3698 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3699 | { |
| 3700 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 3701 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3702 | "Status= %d [0x%08X]", |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 3703 | __func__, staId, vosStatus, vosStatus ); |
| 3704 | } |
| 3705 | return( vosStatus ); |
| 3706 | } |
| 3707 | |
| 3708 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3709 | /* |
| 3710 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3711 | * TL in case of new TDLS client is added and deregistration at the time |
| 3712 | * TDLS client is deleted. |
| 3713 | */ |
| 3714 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3715 | eHalStatus hdd_RoamTdlsStatusUpdateHandler(hdd_adapter_t *pAdapter, |
| 3716 | tCsrRoamInfo *pRoamInfo, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3717 | tANI_U32 roamId, |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3718 | eRoamCmdStatus roamStatus, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3719 | eCsrRoamResult roamResult) |
| 3720 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3721 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3722 | eHalStatus status = eHAL_STATUS_FAILURE ; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3723 | tANI_U8 staIdx; |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 3724 | |
Kaushik, Sushant | 8489f47 | 2014-01-27 11:41:22 +0530 | [diff] [blame] | 3725 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3726 | ("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR), |
| 3727 | roamResult == eCSR_ROAM_RESULT_ADD_TDLS_PEER ? |
| 3728 | "ADD_TDLS_PEER" : |
| 3729 | roamResult == eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? |
| 3730 | "DEL_TDLS_PEER" : |
| 3731 | roamResult == eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? |
| 3732 | "DEL_TDLS_PEER_IND" : |
| 3733 | roamResult == eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3734 | "DEL_ALL_TDLS_PEER_IND" : |
| 3735 | roamResult == eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? |
| 3736 | "UPDATE_TDLS_PEER" : |
| 3737 | roamResult == eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3738 | "LINK_ESTABLISH_REQ_RSP" : |
| 3739 | roamResult == eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP ? |
| 3740 | "CHANNEL_SWITCH_REQ_RSP" : "UNKNOWN", |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3741 | pRoamInfo->staId, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3742 | switch( roamResult ) |
| 3743 | { |
| 3744 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3745 | { |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3746 | if(eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3747 | { |
Masti, Narayanraddi | 83dbfc2 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 3748 | hddTdlsPeer_t *curr_peer; |
| 3749 | |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3750 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3751 | ("%s: Add Sta is failed. %d"),__func__, pRoamInfo->statusCode); |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 3752 | wlan_hdd_tdls_check_bmps(pAdapter); |
Masti, Narayanraddi | 83dbfc2 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 3753 | |
| 3754 | mutex_lock(&pHddCtx->tdls_lock); |
| 3755 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3756 | pRoamInfo->peerMac, FALSE); |
| 3757 | if (NULL != curr_peer) |
| 3758 | curr_peer->link_status = eTDLS_LINK_TEARING; |
| 3759 | else |
| 3760 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3761 | "%s %d curr_peer is Null", __func__,__LINE__); |
| 3762 | mutex_unlock(&pHddCtx->tdls_lock); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3763 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3764 | else |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3765 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3766 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3767 | /* check if there is available index for this new TDLS STA */ |
| 3768 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
| 3769 | { |
| 3770 | if (0 == pHddCtx->tdlsConnInfo[staIdx].staId ) |
| 3771 | { |
| 3772 | pHddCtx->tdlsConnInfo[staIdx].sessionId = pRoamInfo->sessionId; |
| 3773 | pHddCtx->tdlsConnInfo[staIdx].staId = pRoamInfo->staId; |
| 3774 | |
| 3775 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3776 | ("TDLS: STA IDX at %d is %d " |
| 3777 | "of mac " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3778 | staIdx, pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3779 | MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3780 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3781 | vos_copy_macaddr(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3782 | (v_MACADDR_t *)pRoamInfo->peerMac) ; |
| 3783 | status = eHAL_STATUS_SUCCESS ; |
| 3784 | break ; |
| 3785 | } |
| 3786 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3787 | if (staIdx < HDD_MAX_NUM_TDLS_STA) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3788 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3789 | 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] | 3790 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3791 | "wlan_hdd_tdls_set_sta_id() failed"); |
| 3792 | return VOS_FALSE; |
| 3793 | } |
| 3794 | |
| 3795 | (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3796 | /* store the ucast signature , if required for further reference. */ |
| 3797 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3798 | wlan_hdd_tdls_set_signature( pAdapter, pRoamInfo->peerMac, pRoamInfo->ucastSig ); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3799 | /* start TDLS client registration with TL */ |
| 3800 | status = hdd_roamRegisterTDLSSTA( pAdapter, |
| 3801 | pRoamInfo->peerMac, |
| 3802 | pRoamInfo->staId, |
| 3803 | pRoamInfo->ucastSig); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3804 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3805 | } |
| 3806 | else |
| 3807 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3808 | status = eHAL_STATUS_FAILURE; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3809 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3810 | "%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] | 3811 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3812 | pAdapter->tdlsAddStaStatus = status; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3813 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3814 | complete(&pAdapter->tdls_add_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3815 | break ; |
| 3816 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3817 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3818 | { |
| 3819 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3820 | { |
| 3821 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3822 | "%s: Add Sta is failed. %d", __func__, pRoamInfo->statusCode); |
| 3823 | } |
| 3824 | /* store the ucast signature which will be used later when |
| 3825 | * registering to TL |
| 3826 | */ |
| 3827 | pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode; |
| 3828 | complete(&pAdapter->tdls_add_station_comp); |
| 3829 | break; |
| 3830 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3831 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3832 | { |
| 3833 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3834 | { |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3835 | hddTdlsPeer_t *curr_peer; |
| 3836 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3837 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3838 | "%s: Link Establish Request failed. %d", __func__, pRoamInfo->statusCode); |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3839 | |
| 3840 | mutex_lock(&pHddCtx->tdls_lock); |
| 3841 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3842 | pRoamInfo->peerMac, FALSE); |
| 3843 | if (curr_peer) |
| 3844 | curr_peer->link_status = eTDLS_LINK_TEARING; |
| 3845 | else |
| 3846 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3847 | "%s %d curr_peer is Null",__func__,__LINE__); |
| 3848 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3849 | } |
| 3850 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3851 | break; |
| 3852 | } |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3853 | case eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP: |
| 3854 | { |
| 3855 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3856 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3857 | "%s: Channel switch request failed. %d", __func__, |
| 3858 | pRoamInfo->statusCode); |
| 3859 | else |
| 3860 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3861 | "%s: Channel switch request Success", __func__); |
| 3862 | break; |
| 3863 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3864 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3865 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3866 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3867 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3868 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3869 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 3870 | pRoamInfo->staId == pHddCtx->tdlsConnInfo[staIdx].staId) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3871 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3872 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3873 | ("HDD: del STA IDX = %x"), pRoamInfo->staId) ; |
| 3874 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3875 | mutex_lock(&pHddCtx->tdls_lock); |
| 3876 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3877 | pRoamInfo->peerMac, FALSE); |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3878 | if (NULL != curr_peer) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3879 | { |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3880 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3881 | " Current status for peer" MAC_ADDRESS_STR "is %d", |
| 3882 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), curr_peer->link_status); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3883 | if (TDLS_IS_CONNECTED(curr_peer) || |
| 3884 | (eTDLS_LINK_CONNECTING == curr_peer->link_status)) |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3885 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3886 | mutex_unlock(&pHddCtx->tdls_lock); |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3887 | hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId ); |
| 3888 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3889 | else |
| 3890 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3891 | |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3892 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3893 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3894 | else |
| 3895 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3896 | |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3897 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3898 | wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3899 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3900 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3901 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 3902 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
| 3903 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3904 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3905 | wlan_hdd_tdls_check_bmps(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3906 | status = eHAL_STATUS_SUCCESS ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3907 | break ; |
| 3908 | } |
| 3909 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3910 | complete(&pAdapter->tdls_del_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3911 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3912 | break ; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3913 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 3914 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3915 | hddTdlsPeer_t *curr_peer; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3916 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3917 | "%s: Sending teardown to supplicant with reason code %u", |
| 3918 | __func__, pRoamInfo->reasonCode); |
| 3919 | |
| 3920 | #ifdef CONFIG_TDLS_IMPLICIT |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3921 | mutex_lock(&pHddCtx->tdls_lock); |
| 3922 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, |
| 3923 | FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3924 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, pRoamInfo->reasonCode); |
Abhishek Singh | 9656892 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 3925 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 3926 | curr_peer->peerMac); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3927 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3928 | #endif |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3929 | status = eHAL_STATUS_SUCCESS ; |
| 3930 | break ; |
| 3931 | } |
| 3932 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 3933 | { |
| 3934 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3935 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3936 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3937 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 3938 | pHddCtx->tdlsConnInfo[staIdx].staId) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3939 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3940 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3941 | ("hdd_tdlsStatusUpdate: staIdx %d " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3942 | pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3943 | MAC_ADDR_ARRAY(pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes)); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3944 | |
| 3945 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3946 | wlan_hdd_tdls_reset_peer(pAdapter, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3947 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3948 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3949 | hdd_roamDeregisterTDLSSTA ( pAdapter, pHddCtx->tdlsConnInfo[staIdx].staId ); |
| 3950 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3951 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3952 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3953 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3954 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 3955 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3956 | |
| 3957 | status = eHAL_STATUS_SUCCESS ; |
| 3958 | } |
| 3959 | } |
Gopichand Nakkala | 40ab275 | 2013-04-04 20:11:36 +0530 | [diff] [blame] | 3960 | wlan_hdd_tdls_check_bmps(pAdapter); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3961 | break ; |
| 3962 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3963 | default: |
| 3964 | { |
| 3965 | break ; |
| 3966 | } |
| 3967 | } |
| 3968 | |
| 3969 | return status ; |
| 3970 | } |
| 3971 | #endif |
| 3972 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 3973 | void iw_full_power_cbfn (void *pContext, eHalStatus status) |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3974 | { |
| 3975 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
| 3976 | hdd_context_t *pHddCtx = NULL; |
| 3977 | int ret; |
| 3978 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3979 | ENTER(); |
| 3980 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3981 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 3982 | { |
| 3983 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 3984 | "%s: Bad param, pAdapter [%pK]", |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3985 | __func__, pAdapter); |
| 3986 | return; |
| 3987 | } |
| 3988 | |
| 3989 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3990 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3991 | if (0 != ret) |
| 3992 | { |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3993 | return; |
| 3994 | } |
| 3995 | |
| 3996 | if (pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 3997 | { |
| 3998 | sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), NULL, NULL); |
| 3999 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4000 | |
| 4001 | EXIT(); |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 4002 | } |
| 4003 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4004 | eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4005 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
| 4006 | { |
| 4007 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 4008 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 4009 | hdd_wext_state_t *pWextState = NULL; |
| 4010 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4011 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4012 | struct cfg80211_bss *bss_status; |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 4013 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4014 | |
| 4015 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4016 | "CSR Callback: status= %d result= %d roamID=%d", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4017 | roamStatus, roamResult, roamId ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4018 | |
| 4019 | /*Sanity check*/ |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 4020 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4021 | { |
| 4022 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 4023 | "invalid adapter or adapter has invalid magic"); |
| 4024 | return eHAL_STATUS_FAILURE; |
| 4025 | } |
| 4026 | |
| 4027 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4028 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4029 | |
| 4030 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 4031 | { |
| 4032 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4033 | "invalid WEXT state or HDD station context"); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4034 | return eHAL_STATUS_FAILURE; |
| 4035 | } |
| 4036 | |
Konamki, Sreelakshmi | b9c4571 | 2015-07-29 11:48:19 +0530 | [diff] [blame] | 4037 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 4038 | pAdapter->sessionId, roamStatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4039 | switch( roamStatus ) |
| 4040 | { |
| 4041 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 41d95e2 | 2015-08-28 12:51:32 +0530 | [diff] [blame] | 4042 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4043 | complete(&pAdapter->session_open_comp_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4044 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4045 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4046 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
| 4047 | /* We did pre-auth,then we attempted a 11r or ese reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4048 | * reassoc failed due to failure, timeout, reject from ap |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4049 | * in any case tell the OS, our carrier is off and mark |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4050 | * interface down */ |
| 4051 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 4052 | hddLog(LOGE, FL("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d"), |
| 4053 | roamStatus, roamResult, pAdapter->sessionId); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 4054 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4055 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4056 | /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */ |
| 4057 | if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4058 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 4059 | } |
| 4060 | pHddStaCtx->ft_carrier_on = FALSE; |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 4061 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4062 | break; |
| 4063 | |
| 4064 | case eCSR_ROAM_FT_START: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4065 | // When we roam for EsE and 11r, we dont want the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4066 | // OS to be informed that the link is down. So mark |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4067 | // the link ready for ft_start. After this the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4068 | // eCSR_ROAM_SHOULD_ROAM will be received. |
| 4069 | // Where in we will not mark the link down |
| 4070 | // Also we want to stop tx at this point when we will be |
| 4071 | // doing disassoc at this time. This saves 30-60 msec |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4072 | // after reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4073 | { |
| 4074 | struct net_device *dev = pAdapter->dev; |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 4075 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4076 | netif_tx_disable(dev); |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 4077 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4078 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 4079 | { |
| 4080 | vos_record_roam_event(e_HDD_DISABLE_TX_QUEUE, NULL, 0); |
| 4081 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4082 | /* |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4083 | * Deregister this STA with TL, but do not flush the packets |
| 4084 | * for this STA from wmm_tx_queue. Since there is no valid STA |
| 4085 | * for these packets they will not be transmitted. Eventually |
| 4086 | * after the reassociation is successful, these packets will be |
| 4087 | * transmitted after registering STA with TL again. This ensures |
| 4088 | * that driver does not drop packets during roaming. |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 4089 | */ |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4090 | status = WLANTL_ClearSTAClient(pHddCtx->pvosContext, |
| 4091 | pHddStaCtx->conn_info.staId[0]); |
| 4092 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4093 | { |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4094 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4095 | FL("WLANTL_ClearSTAClient failed for staID %d." |
| 4096 | "Status= %d [0x%x]"), pHddStaCtx->conn_info.staId[0], |
| 4097 | status, status); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4098 | halStatus = eHAL_STATUS_FAILURE; |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 4099 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4100 | } |
| 4101 | pHddStaCtx->ft_carrier_on = TRUE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4102 | pHddStaCtx->hdd_ReassocScenario = VOS_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4103 | break; |
| 4104 | #endif |
| 4105 | |
| 4106 | case eCSR_ROAM_SHOULD_ROAM: |
| 4107 | // Dont need to do anything |
| 4108 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4109 | struct net_device *dev = pAdapter->dev; |
| 4110 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4111 | // notify apps that we can't pass traffic anymore |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 4112 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4113 | netif_tx_disable(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4114 | #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] | 4115 | if (pHddStaCtx->ft_carrier_on == FALSE) |
| 4116 | { |
| 4117 | #endif |
| 4118 | netif_carrier_off(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4119 | #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] | 4120 | } |
| 4121 | #endif |
| 4122 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4123 | #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] | 4124 | //We should clear all sta register with TL, for now, only one. |
| 4125 | status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] ); |
| 4126 | if ( !VOS_IS_STATUS_SUCCESS(status ) ) |
| 4127 | { |
| 4128 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4129 | FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"), |
| 4130 | pHddStaCtx->conn_info.staId[0], status, status ); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4131 | halStatus = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4132 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4133 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4134 | } |
| 4135 | break; |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 4136 | case eCSR_ROAM_LOSTLINK_DETECTED: |
| 4137 | { |
| 4138 | if (wlan_hdd_check_and_stop_mon(pAdapter, false)) |
| 4139 | halStatus = eHAL_STATUS_FAILURE; |
| 4140 | } |
| 4141 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4142 | case eCSR_ROAM_LOSTLINK: |
| 4143 | case eCSR_ROAM_DISASSOCIATED: |
| 4144 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4145 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4146 | "****eCSR_ROAM_DISASSOCIATED****"); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 4147 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4148 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4149 | /* 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] | 4150 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4151 | if (pHddCtx->hdd_mcastbcast_filter_set == TRUE) |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4152 | { |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 4153 | hdd_conf_mcastbcast_filter(pHddCtx, FALSE); |
Amar Singhal | f8ba2b8 | 2013-12-02 12:54:38 -0800 | [diff] [blame] | 4154 | |
| 4155 | if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) { |
| 4156 | pHddCtx->configuredMcastBcastFilter = |
| 4157 | pHddCtx->sus_res_mcastbcast_filter; |
| 4158 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_FALSE; |
| 4159 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4160 | |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 4161 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4162 | "offload: disassociation happening, restoring configuredMcastBcastFilter"); |
| 4163 | hddLog(VOS_TRACE_LEVEL_INFO,"McastBcastFilter = %d", |
| 4164 | pHddCtx->configuredMcastBcastFilter); |
| 4165 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4166 | "offload: already called mcastbcast filter"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4167 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 4168 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4169 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4170 | /* Call to clear any MC Addr List filter applied after |
| 4171 | * successful connection. |
| 4172 | */ |
| 4173 | wlan_hdd_set_mc_addr_list(pAdapter, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4174 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4175 | } |
| 4176 | break; |
| 4177 | case eCSR_ROAM_IBSS_LEAVE: |
| 4178 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4179 | "****eCSR_ROAM_IBSS_LEAVE****"); |
| 4180 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4181 | break; |
| 4182 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
| 4183 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4184 | "****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4185 | // To Do - address probable memory leak with WEP encryption upon successful association |
| 4186 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4187 | { |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4188 | //Clear saved connection information in HDD |
| 4189 | hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4190 | } |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4191 | halStatus = hdd_AssociationCompletionHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4192 | |
| 4193 | break; |
| 4194 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4195 | halStatus = hdd_AssociationCompletionHandler( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4196 | pRoamInfo, roamId, roamStatus, roamResult ); |
| 4197 | break; |
| 4198 | case eCSR_ROAM_IBSS_IND: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 4199 | hdd_RoamIbssIndicationHandler( pAdapter, pRoamInfo, roamId, |
| 4200 | roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4201 | break; |
| 4202 | |
| 4203 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
| 4204 | halStatus = roamRoamConnectStatusUpdateHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4205 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4206 | |
| 4207 | case eCSR_ROAM_MIC_ERROR_IND: |
| 4208 | halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4209 | break; |
Sachin Ahuja | 3d47fcd | 2015-08-28 16:02:06 +0530 | [diff] [blame] | 4210 | case eCSR_ROAM_LOST_LINK_PARAMS_IND: |
| 4211 | { |
| 4212 | /* |
| 4213 | * The RSSI will be subtracted from 100 as FW is sending the RSSI by |
| 4214 | * adding the 100 value. |
| 4215 | */ |
| 4216 | pAdapter->rssi_on_disconnect = pRoamInfo->u.pLostLinkParams->rssi - 100; |
| 4217 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4218 | "%s : Rssi on Disconnect : %d", |
| 4219 | __func__, pAdapter->rssi_on_disconnect); |
| 4220 | break; |
| 4221 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4222 | case eCSR_ROAM_SET_KEY_COMPLETE: |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4223 | { |
| 4224 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 4225 | |
| 4226 | if((pHddCtx) && |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4227 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4228 | ((eCSR_ROAM_RESULT_NONE == roamResult)|| |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4229 | (pRoamInfo && pRoamInfo->is11rAssoc))) |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4230 | { |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 4231 | /* Send DTIM period to the FW; only if the wlan is already |
| 4232 | in suspend. This is the case with roaming (reassoc), |
| 4233 | DELETE_BSS_REQ zeroes out Modulated/Dynamic DTIM sent in |
| 4234 | previous suspend_wlan. Sending SET_POWER_PARAMS_REQ |
| 4235 | before the ENTER_BMPS_REQ ensures Listen Interval is |
| 4236 | regained back to LI * Modulated DTIM */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4237 | hdd_set_pwrparams(pHddCtx); |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4238 | |
| 4239 | /* At this point, device should not be in BMPS; |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 4240 | if due to unexpected scenario, if we are in BMPS, |
| 4241 | then trigger Exit and Enter BMPS to take DTIM period |
| 4242 | effective */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4243 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) |
| 4244 | { |
| 4245 | hddLog( LOGE, FL("Not expected: device is already in BMPS mode, Exit & Enter BMPS again!")); |
| 4246 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 4247 | sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4248 | iw_full_power_cbfn, pAdapter, |
| 4249 | eSME_FULL_PWR_NEEDED_BY_HDD); |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4250 | } |
| 4251 | } |
Padma, Santhosh Kumar | a4c3457 | 2015-07-09 20:00:41 +0530 | [diff] [blame] | 4252 | |
| 4253 | if ((pHddCtx) && |
Padma, Santhosh Kumar | 0a623eb | 2015-07-27 11:55:29 +0530 | [diff] [blame] | 4254 | (FULL_POWER == pmcGetPmcState(pHddCtx->hHal)) && |
| 4255 | (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) && |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4256 | ((eCSR_ROAM_RESULT_NONE == roamResult) || |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4257 | (pRoamInfo && pRoamInfo->is11rAssoc))) |
Padma, Santhosh Kumar | a4c3457 | 2015-07-09 20:00:41 +0530 | [diff] [blame] | 4258 | { |
| 4259 | hddLog( LOG1, FL("Device in full power." |
| 4260 | "Stop and start traffic timer for roaming")); |
| 4261 | pmcStopTrafficTimer(pHddCtx->hHal); |
| 4262 | if (pmcStartTrafficTimer(pHddCtx->hHal, |
| 4263 | TRAFFIC_TIMER_ROAMING) != eHAL_STATUS_SUCCESS) |
| 4264 | { |
| 4265 | hddLog(LOGP, FL("Cannot start traffic timer")); |
| 4266 | } |
| 4267 | } |
| 4268 | |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4269 | halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4270 | if ((eCSR_ROAM_RESULT_NONE == roamResult) || |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4271 | (pRoamInfo && pRoamInfo->is11rAssoc)) |
Padma, Santhosh Kumar | 0a623eb | 2015-07-27 11:55:29 +0530 | [diff] [blame] | 4272 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4273 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4274 | break; |
| 4275 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4276 | case eCSR_ROAM_FT_RESPONSE: |
| 4277 | hdd_SendFTEvent(pAdapter); |
| 4278 | break; |
| 4279 | #endif |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4280 | #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] | 4281 | case eCSR_ROAM_PMK_NOTIFY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4282 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4283 | { |
| 4284 | /* Notify the supplicant of a new candidate */ |
| 4285 | halStatus = wlan_hdd_cfg80211_pmksa_candidate_notify(pAdapter, pRoamInfo, 1, false); |
| 4286 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4287 | break; |
| 4288 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4289 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 4290 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4291 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 4292 | /* This event is to notify pre-auth initiation */ |
| 4293 | if (VOS_STATUS_SUCCESS != |
| 4294 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, pRoamInfo)) |
| 4295 | { |
| 4296 | halStatus = eHAL_STATUS_FAILURE; |
| 4297 | } |
| 4298 | break; |
| 4299 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 4300 | /* This event will notify pre-auth completion in case of success */ |
| 4301 | if (VOS_STATUS_SUCCESS != |
| 4302 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4303 | pRoamInfo, 1)) |
| 4304 | { |
| 4305 | halStatus = eHAL_STATUS_FAILURE; |
| 4306 | } |
| 4307 | break; |
| 4308 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 4309 | /* This event will notify pre-auth completion in case of failure. */ |
| 4310 | if (VOS_STATUS_SUCCESS != |
| 4311 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4312 | pRoamInfo, 0)) |
| 4313 | { |
| 4314 | halStatus = eHAL_STATUS_FAILURE; |
| 4315 | } |
| 4316 | break; |
| 4317 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 4318 | /* This event is to notify handover success. |
| 4319 | It will be only invoked on success */ |
| 4320 | if (VOS_STATUS_SUCCESS != |
| 4321 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, pRoamInfo)) |
| 4322 | { |
| 4323 | halStatus = eHAL_STATUS_FAILURE; |
| 4324 | } |
| 4325 | break; |
| 4326 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4327 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 4328 | hdd_remainChanReadyHandler( pAdapter ); |
| 4329 | break; |
| 4330 | case eCSR_ROAM_SEND_ACTION_CNF: |
| 4331 | hdd_sendActionCnf( pAdapter, |
| 4332 | (roamResult == eCSR_ROAM_RESULT_NONE) ? TRUE : FALSE ); |
| 4333 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4334 | #ifdef FEATURE_WLAN_TDLS |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 4335 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 4336 | halStatus = hdd_RoamTdlsStatusUpdateHandler( pAdapter, pRoamInfo, |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 4337 | roamId, roamStatus, roamResult ); |
| 4338 | break ; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 4339 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 4340 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, pRoamInfo->reasonCode); |
| 4341 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4342 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4343 | #ifdef WLAN_FEATURE_11W |
| 4344 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 4345 | hdd_indicateUnprotMgmtFrame(pAdapter, pRoamInfo->nFrameLength, |
| 4346 | pRoamInfo->pbFrames, |
| 4347 | pRoamInfo->frameType); |
| 4348 | break; |
| 4349 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4350 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4351 | case eCSR_ROAM_TSM_IE_IND: |
| 4352 | hdd_indicateTsmIe(pAdapter, pRoamInfo->tsmIe.tsid, |
| 4353 | pRoamInfo->tsmIe.state, pRoamInfo->tsmIe.msmt_interval); |
| 4354 | break; |
| 4355 | |
| 4356 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 4357 | { |
| 4358 | if (eCSR_AUTH_TYPE_CCKM_WPA == pHddStaCtx->conn_info.authType || |
| 4359 | eCSR_AUTH_TYPE_CCKM_RSN == pHddStaCtx->conn_info.authType) |
| 4360 | { |
| 4361 | hdd_indicateCckmPreAuth(pAdapter, pRoamInfo); |
| 4362 | } |
| 4363 | break; |
| 4364 | } |
| 4365 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4366 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4367 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4368 | hdd_indicateEseAdjApRepInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4369 | break; |
| 4370 | } |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4371 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4372 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4373 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4374 | hdd_indicateEseBcnReportInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4375 | break; |
| 4376 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4377 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Girish Gowli | a95daca | 2015-02-04 20:31:31 +0530 | [diff] [blame] | 4378 | case eCSR_ROAM_UPDATE_MAX_RATE_IND: |
| 4379 | { |
| 4380 | pAdapter->maxRateFlags = roamResult; |
| 4381 | break; |
| 4382 | } |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4383 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 4384 | if (pRoamInfo && pRoamInfo->pBssDesc) { |
| 4385 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 4386 | pRoamInfo->pBssDesc); |
| 4387 | if (bss_status) |
| 4388 | cfg80211_put_bss( |
| 4389 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 4390 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 4391 | #endif |
| 4392 | bss_status); |
| 4393 | else |
| 4394 | hddLog(LOG1, FL("UPDATE_SCAN_RESULT returned NULL")); |
| 4395 | } |
Abhinav Kumar | 118efd0 | 2019-08-07 16:41:07 +0530 | [diff] [blame] | 4396 | |
| 4397 | case eCSR_ROAM_SAE_COMPUTE: |
| 4398 | if (pRoamInfo) |
| 4399 | wlan_hdd_sae_callback(pAdapter, pRoamInfo); |
| 4400 | break; |
| 4401 | |
Ganesh Kondabattini | 529397f | 2017-12-27 19:13:52 +0530 | [diff] [blame] | 4402 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
| 4403 | { |
| 4404 | hdd_adapter_t *pHostapdAdapter = NULL; |
| 4405 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4406 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4407 | |
| 4408 | if (!pHddCtx || !pHddStaCtx) { |
| 4409 | hddLog(LOG1, FL("Invalid pHddCtx or pHddStaCtx")); |
| 4410 | break; |
| 4411 | } |
| 4412 | |
| 4413 | hddLog(LOG1, FL("eCSR_ROAM_STA_CHANNEL_SWITCH: new channel %hu"), |
| 4414 | pRoamInfo->chan_info.chan_id); |
| 4415 | |
| 4416 | pHddStaCtx->conn_info.operationChannel = |
| 4417 | pRoamInfo->chan_info.chan_id; |
| 4418 | |
| 4419 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 4420 | if (pHostapdAdapter && |
| 4421 | (test_bit(SOFTAP_BSS_STARTED, |
| 4422 | &pHostapdAdapter->event_flags))) |
| 4423 | { |
| 4424 | /* Restart SAP if its operating channel is different |
| 4425 | * from AP channel. |
| 4426 | */ |
| 4427 | hddLog(VOS_TRACE_LEVEL_INFO,"SAP chan %d, STA chan %d, force_scc_with_ecsa %d", |
| 4428 | pHostapdAdapter->sessionCtx.ap.operatingChannel, |
| 4429 | pRoamInfo->chan_info.chan_id, |
| 4430 | pHddCtx->cfg_ini->force_scc_with_ecsa); |
| 4431 | if ((pHddCtx->cfg_ini->force_scc_with_ecsa ) && |
| 4432 | (pHostapdAdapter->sessionCtx.ap.operatingChannel != |
| 4433 | pRoamInfo->chan_info.chan_id)) |
| 4434 | { |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 4435 | schedule_delayed_work(&pHddCtx->ecsa_chan_change_work, 0); |
Ganesh Kondabattini | 529397f | 2017-12-27 19:13:52 +0530 | [diff] [blame] | 4436 | } |
| 4437 | else |
| 4438 | hddLog(LOG1, FL("SAP restart not required")); |
| 4439 | } else |
| 4440 | hddLog(LOG1, FL("SAP not active, nothing to do")); |
| 4441 | } |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4442 | break; |
Girish Gowli | a95daca | 2015-02-04 20:31:31 +0530 | [diff] [blame] | 4443 | default: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4444 | break; |
| 4445 | } |
| 4446 | return( halStatus ); |
| 4447 | } |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 4448 | |
| 4449 | #ifdef WLAN_FEATURE_SAE |
| 4450 | /** |
| 4451 | * hdd_translate_sae_rsn_to_csr_auth() - Translate SAE RSN to CSR auth type |
| 4452 | * @auth_suite: auth suite |
| 4453 | * @auth_type: pointer to eCsrAuthType |
| 4454 | * |
| 4455 | * Return: None |
| 4456 | */ |
| 4457 | static void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4458 | eCsrAuthType *auth_type) |
| 4459 | { |
| 4460 | if (!memcmp(auth_suite, ccp_rsn_oui_80, 4)) |
| 4461 | *auth_type = eCSR_AUTH_TYPE_SAE; |
| 4462 | } |
| 4463 | #else |
| 4464 | static inline |
| 4465 | void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4466 | eCsrAuthType *auth_type) |
| 4467 | { |
| 4468 | } |
| 4469 | #endif |
| 4470 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4471 | eCsrAuthType hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4472 | { |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 4473 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4474 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4475 | if ( memcmp(auth_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4476 | { |
| 4477 | auth_type = eCSR_AUTH_TYPE_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4478 | } else |
| 4479 | if (memcmp(auth_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | { |
| 4481 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4482 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4483 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4484 | if (memcmp(auth_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4485 | { |
| 4486 | // Check for 11r FT Authentication with PSK |
| 4487 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4488 | } else |
| 4489 | if (memcmp(auth_suite , ccpRSNOui03, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4490 | { |
| 4491 | // Check for 11R FT Authentication with 802.1X |
| 4492 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4493 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4494 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4495 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4496 | if (memcmp(auth_suite , ccpRSNOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4497 | { |
| 4498 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 4499 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4500 | #endif /* FEATURE_WLAN_ESE */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4501 | #ifdef WLAN_FEATURE_11W |
| 4502 | if (memcmp(auth_suite , ccpRSNOui07, 4) == 0) |
| 4503 | { |
| 4504 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 4505 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 4506 | if (memcmp(auth_suite , ccpRSNOui08, 4) == 0) |
| 4507 | { |
| 4508 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 4509 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4510 | #endif |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 4511 | if (!memcmp(auth_suite, ccp_rsn_oui_18, 4)) |
| 4512 | { |
| 4513 | auth_type = eCSR_AUTH_TYPE_OWE; |
| 4514 | } else |
| 4515 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4516 | { |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 4517 | /* If auth suite is of SAE, auth_type will be |
| 4518 | * overwritten in hdd_translate_sae_rsn_to_csr_auth |
| 4519 | */ |
| 4520 | hdd_translate_sae_rsn_to_csr_auth(auth_suite, &auth_type); |
| 4521 | } |
| 4522 | |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 4523 | hddLog(LOG1, FL("auth_type : %d"), auth_type); |
| 4524 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4525 | return auth_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4526 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4527 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4528 | eCsrAuthType |
| 4529 | hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4530 | { |
| 4531 | eCsrAuthType auth_type; |
| 4532 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4533 | if ( memcmp(auth_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4534 | { |
| 4535 | auth_type = eCSR_AUTH_TYPE_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4536 | } else |
| 4537 | if (memcmp(auth_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4538 | { |
| 4539 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4540 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4541 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4542 | if (memcmp(auth_suite , ccpWpaOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4543 | { |
| 4544 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4545 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4546 | #endif /* FEATURE_WLAN_ESE */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4547 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4548 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 4549 | } |
| 4550 | hddLog(LOG1, FL("auth_type: %d"), auth_type); |
| 4551 | return auth_type; |
| 4552 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4553 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4554 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4555 | hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4556 | { |
| 4557 | eCsrEncryptionType cipher_type; |
| 4558 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4559 | if ( memcmp(cipher_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4560 | { |
| 4561 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4562 | } |
| 4563 | else if (memcmp(cipher_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4564 | { |
| 4565 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4566 | } |
| 4567 | else if (memcmp(cipher_suite , ccpRSNOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4568 | { |
| 4569 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4570 | } |
| 4571 | else if (memcmp(cipher_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4572 | { |
| 4573 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4574 | } |
| 4575 | else if (memcmp(cipher_suite , ccpRSNOui05, 4) == 0) |
| 4576 | { |
| 4577 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4578 | } |
| 4579 | else |
| 4580 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4581 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4582 | } |
| 4583 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 4584 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4585 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4586 | /* To find if the MAC address is NULL */ |
| 4587 | static tANI_U8 hdd_IsMACAddrNULL (tANI_U8 *macAddr, tANI_U8 length) |
| 4588 | { |
| 4589 | int i; |
| 4590 | for (i = 0; i < length; i++) |
| 4591 | { |
| 4592 | if (0x00 != (macAddr[i])) |
| 4593 | { |
| 4594 | return FALSE; |
| 4595 | } |
| 4596 | } |
| 4597 | return TRUE; |
| 4598 | } /****** end hdd_IsMACAddrNULL() ******/ |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4599 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4600 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4601 | hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4602 | { |
| 4603 | eCsrEncryptionType cipher_type; |
| 4604 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4605 | if ( memcmp(cipher_suite , ccpWpaOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4606 | { |
| 4607 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4608 | } else |
| 4609 | if (memcmp(cipher_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4610 | { |
| 4611 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4612 | } else |
| 4613 | if (memcmp(cipher_suite , ccpWpaOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4614 | { |
| 4615 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4616 | } else |
| 4617 | if (memcmp(cipher_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4618 | { |
| 4619 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4620 | } else |
| 4621 | if (memcmp(cipher_suite , ccpWpaOui05, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4622 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4623 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4624 | } else |
| 4625 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4626 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4627 | } |
| 4628 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 4629 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4630 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4631 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4632 | static tANI_S32 hdd_ProcessGENIE(hdd_adapter_t *pAdapter, |
| 4633 | struct ether_addr *pBssid, |
| 4634 | eCsrEncryptionType *pEncryptType, |
| 4635 | eCsrEncryptionType *mcEncryptType, |
| 4636 | eCsrAuthType *pAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4637 | #ifdef WLAN_FEATURE_11W |
| 4638 | u_int8_t *pMfpRequired, |
| 4639 | u_int8_t *pMfpCapable, |
| 4640 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4641 | u_int16_t gen_ie_len, |
| 4642 | u_int8_t *gen_ie) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4643 | { |
| 4644 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4645 | eHalStatus result; |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4646 | tDot11fIERSN dot11RSNIE = {0}; |
| 4647 | tDot11fIEWPA dot11WPAIE = {0}; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4648 | tANI_U32 i; |
Ashish Kumar Dhanotiya | ffbfd8c | 2017-11-29 14:04:38 +0530 | [diff] [blame] | 4649 | tANI_U32 status; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4650 | tANI_U8 *pRsnIe; |
| 4651 | tANI_U16 RSNIeLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4652 | tPmkidCacheInfo PMKIDCache[4]; // Local transfer memory |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4653 | v_BOOL_t updatePMKCache = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4654 | |
| 4655 | /* Clear struct of tDot11fIERSN and tDot11fIEWPA specifically setting present |
| 4656 | flag to 0 */ |
| 4657 | memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) ); |
| 4658 | memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) ); |
gaurank kathpalia | b654f70 | 2020-01-03 15:07:17 +0530 | [diff] [blame] | 4659 | memset( PMKIDCache, 0 , sizeof(tPmkidCacheInfo) * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4660 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4661 | // Type check |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4662 | if ( gen_ie[0] == DOT11F_EID_RSN) |
| 4663 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4664 | // Validity checks |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4665 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4666 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) ) |
| 4667 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4668 | hddLog(LOGE, "%s: Invalid DOT11F RSN IE length :%d\n", |
| 4669 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4670 | return -EINVAL; |
| 4671 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4672 | // Skip past the EID byte and length byte |
| 4673 | pRsnIe = gen_ie + 2; |
| 4674 | RSNIeLen = gen_ie_len - 2; |
| 4675 | // Unpack the RSN IE |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4676 | status = sme_unpack_rsn_ie(halHandle, |
| 4677 | pRsnIe, |
| 4678 | RSNIeLen, |
| 4679 | &dot11RSNIE); |
Ashish Kumar Dhanotiya | ffbfd8c | 2017-11-29 14:04:38 +0530 | [diff] [blame] | 4680 | if (DOT11F_FAILED(status)) |
| 4681 | { |
| 4682 | hddLog(LOGE, |
| 4683 | FL("Parse failure in hdd_ProcessGENIE (0x%08x)"), |
| 4684 | status); |
| 4685 | return -EINVAL; |
| 4686 | } |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4687 | hddLog(LOG1, FL("%s: gp_cipher_suite_present: %d"), |
| 4688 | __func__, dot11RSNIE.gp_cipher_suite_present); |
| 4689 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4690 | // Copy out the encryption and authentication types |
| 4691 | hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4692 | __func__, dot11RSNIE.pwise_cipher_suite_count ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4693 | hddLog(LOG1, FL("%s: authentication suite count: %d"), |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4694 | __func__, dot11RSNIE.akm_suite_cnt); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4695 | /*Here we have followed the apple base code, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4696 | but probably I suspect we can do something different*/ |
| 4697 | //dot11RSNIE.akm_suite_count |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4698 | // Just translate the FIRST one |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4699 | *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suite[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4700 | //dot11RSNIE.pwise_cipher_suite_count |
| 4701 | *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]); |
| 4702 | //dot11RSNIE.gp_cipher_suite_count |
| 4703 | *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4704 | #ifdef WLAN_FEATURE_11W |
| 4705 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1 ; |
| 4706 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1 ; |
| 4707 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4708 | // Set the PMKSA ID Cache for this interface |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4709 | for (i=0; i<dot11RSNIE.pmkid_count; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4710 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4711 | if ( pBssid == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4712 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4713 | hddLog(LOGE, "%s: pBssid passed is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4714 | break; |
| 4715 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4716 | if ( hdd_IsMACAddrNULL( (u_char *) pBssid->ether_addr_octet , 6)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4717 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4718 | hddLog(LOGE, "%s: Invalid MAC adrr", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4719 | break; |
| 4720 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4721 | updatePMKCache = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4722 | // For right now, I assume setASSOCIATE() has passed in the bssid. |
| 4723 | vos_mem_copy(PMKIDCache[i].BSSID, |
| 4724 | pBssid, ETHER_ADDR_LEN); |
| 4725 | vos_mem_copy(PMKIDCache[i].PMKID, |
| 4726 | dot11RSNIE.pmkid[i], |
| 4727 | CSR_RSN_PMKID_SIZE); |
| 4728 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4729 | |
| 4730 | if (updatePMKCache) |
| 4731 | { |
| 4732 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4733 | hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with cache entry %d."), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4734 | __func__, i ); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4735 | // Finally set the PMKSA ID Cache in CSR |
| 4736 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
| 4737 | PMKIDCache, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 4738 | dot11RSNIE.pmkid_count, |
| 4739 | FALSE); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4740 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4741 | } |
| 4742 | else if (gen_ie[0] == DOT11F_EID_WPA) |
| 4743 | { |
| 4744 | // Validity checks |
| 4745 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) || |
| 4746 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) |
| 4747 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4748 | hddLog(LOGE, "%s: Invalid DOT11F WPA IE length :%d\n", |
| 4749 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4750 | return -EINVAL; |
| 4751 | } |
| 4752 | // 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] | 4753 | pRsnIe = gen_ie + 2 + 4; |
| 4754 | RSNIeLen = gen_ie_len - (2 + 4); |
| 4755 | // Unpack the WPA IE |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4756 | status = dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4757 | pRsnIe, RSNIeLen, &dot11WPAIE); |
| 4758 | if (!DOT11F_SUCCEEDED(status)) |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4759 | { |
| 4760 | hddLog(LOGE, |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4761 | FL("Invalid RSN IE: parse status %d"), status); |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4762 | return -EINVAL; |
| 4763 | } |
| 4764 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4765 | // Copy out the encryption and authentication types |
| 4766 | hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4767 | __func__, dot11WPAIE.unicast_cipher_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4768 | hddLog(LOG1, FL("%s: WPA authentication suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4769 | __func__, dot11WPAIE.auth_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4770 | //dot11WPAIE.auth_suite_count |
| 4771 | // Just translate the FIRST one |
| 4772 | *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]); |
| 4773 | //dot11WPAIE.unicast_cipher_count |
| 4774 | *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]); |
| 4775 | //dot11WPAIE.unicast_cipher_count |
| 4776 | *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 4777 | } |
| 4778 | else |
| 4779 | { |
| 4780 | hddLog(LOGW, FL("gen_ie[0]: %d"), gen_ie[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4781 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4782 | } |
| 4783 | return 0; |
| 4784 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4785 | |
| 4786 | /** |
| 4787 | * hdd_set_def_rsne_override() - set default encryption type and auth type |
| 4788 | * in profile. |
| 4789 | * @roam_profile: pointer to adapter |
| 4790 | * @auth_type: pointer to auth type |
| 4791 | * |
| 4792 | * Set default value of encryption type and auth type in profile to |
| 4793 | * search the AP using filter, as in force_rsne_override the RSNIE can be |
| 4794 | * currupt and we might not get the proper encryption type and auth type |
| 4795 | * while parsing the RSNIE. |
| 4796 | * |
| 4797 | * Return: void |
| 4798 | */ |
| 4799 | static void hdd_set_def_rsne_override( |
| 4800 | tCsrRoamProfile *roam_profile, eCsrAuthType *auth_type) |
| 4801 | { |
| 4802 | hddLog( LOG1, FL("Set def values in roam profile")); |
| 4803 | roam_profile->MFPCapable = roam_profile->MFPEnabled; |
| 4804 | roam_profile->EncryptionType.numEntries = 2; |
| 4805 | roam_profile->mcEncryptionType.numEntries = 2; |
| 4806 | /* Use the cipher type in the RSN IE */ |
| 4807 | roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; |
| 4808 | roam_profile->EncryptionType.encryptionType[1] = eCSR_ENCRYPT_TYPE_TKIP; |
| 4809 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 4810 | eCSR_ENCRYPT_TYPE_AES; |
| 4811 | roam_profile->mcEncryptionType.encryptionType[1] = |
| 4812 | eCSR_ENCRYPT_TYPE_TKIP; |
| 4813 | *auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
| 4814 | } |
| 4815 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4816 | int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 4817 | { |
| 4818 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4819 | v_U32_t status = 0; |
| 4820 | eCsrEncryptionType RSNEncryptType; |
| 4821 | eCsrEncryptionType mcRSNEncryptType; |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4822 | hdd_context_t *hdd_ctx; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4823 | #ifdef WLAN_FEATURE_11W |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4824 | u_int8_t RSNMfpRequired = 0; |
| 4825 | u_int8_t RSNMfpCapable = 0; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4826 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4827 | struct ether_addr bSsid; // MAC address of assoc peer |
| 4828 | // MAC address of assoc peer |
| 4829 | // But, this routine is only called when we are NOT associated. |
| 4830 | vos_mem_copy(bSsid.ether_addr_octet, |
| 4831 | pWextState->roamProfile.BSSIDs.bssid, |
| 4832 | sizeof(bSsid.ether_addr_octet)); |
| 4833 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) |
| 4834 | { |
| 4835 | //continue |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4836 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4837 | else |
| 4838 | { |
| 4839 | return 0; |
| 4840 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4841 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4842 | // The actual processing may eventually be more extensive than this. |
| 4843 | // Right now, just consume any PMKIDs that are sent in by the app. |
| 4844 | status = hdd_ProcessGENIE(pAdapter, |
| 4845 | &bSsid, // MAC address of assoc peer |
| 4846 | &RSNEncryptType, |
| 4847 | &mcRSNEncryptType, |
| 4848 | RSNAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4849 | #ifdef WLAN_FEATURE_11W |
| 4850 | &RSNMfpRequired, |
| 4851 | &RSNMfpCapable, |
| 4852 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4853 | pWextState->WPARSNIE[1]+2, |
| 4854 | pWextState->WPARSNIE); |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4856 | if (status == 0) |
| 4857 | { |
| 4858 | // Now copy over all the security attributes you have parsed out |
| 4859 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 4860 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4861 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4862 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; // Use the cipher type in the RSN IE |
| 4863 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = mcRSNEncryptType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4864 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 4865 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && |
| 4866 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
| 4867 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) |
| 4868 | { |
| 4869 | /*For wpa none supplicant sends the WPA IE with unicast cipher as |
| 4870 | eCSR_ENCRYPT_TYPE_NONE ,where as the multicast cipher as |
| 4871 | either AES/TKIP based on group cipher configuration |
| 4872 | mentioned in the wpa_supplicant.conf.*/ |
| 4873 | |
| 4874 | /*Set the unicast cipher same as multicast cipher*/ |
| 4875 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 4876 | = mcRSNEncryptType; |
| 4877 | } |
| 4878 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4879 | #ifdef WLAN_FEATURE_11W |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4880 | hddLog( LOG1, FL("RSNMfpRequired = %d, RSNMfpCapable = %d"), |
| 4881 | RSNMfpRequired, RSNMfpCapable); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4882 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 4883 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 4884 | #endif |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4885 | hddLog( LOG1, |
| 4886 | FL("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d"), |
| 4887 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4888 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4889 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4890 | |
| 4891 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4892 | if (hdd_ctx->force_rsne_override && |
| 4893 | (pWextState->WPARSNIE[0] == DOT11F_EID_RSN)) { |
| 4894 | hddLog(LOG1, |
| 4895 | FL("Test mode enabled set def Auth and enc type. RSN IE passed in connect req:")); |
| 4896 | vos_trace_hex_dump(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4897 | pWextState->roamProfile.pRSNReqIE, |
| 4898 | pWextState->roamProfile.nRSNReqIELength); |
| 4899 | |
| 4900 | pWextState->roamProfile.force_rsne_override = true; |
| 4901 | hddLog(LOG1, |
| 4902 | FL("MFPEnabled %d"), pWextState->roamProfile.MFPEnabled); |
| 4903 | /* |
| 4904 | * Reset MFPEnabled if testmode RSNE passed doesnt have MFPR |
| 4905 | * or MFPC bit set |
| 4906 | */ |
| 4907 | if (pWextState->roamProfile.MFPEnabled && |
| 4908 | !(pWextState->roamProfile.MFPRequired || |
| 4909 | pWextState->roamProfile.MFPCapable)) { |
| 4910 | hddLog( LOG1,FL("Reset MFPEnabled")); |
| 4911 | pWextState->roamProfile.MFPEnabled = 0; |
| 4912 | } |
| 4913 | |
| 4914 | /* If parsing failed set the def value for the roam profile */ |
| 4915 | if (status) |
| 4916 | hdd_set_def_rsne_override(&pWextState->roamProfile, |
| 4917 | RSNAuthType); |
| 4918 | } |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4919 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4920 | } |
| 4921 | int hdd_set_csr_auth_type ( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 4922 | { |
| 4923 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4924 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 4925 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4926 | ENTER(); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4927 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4928 | pRoamProfile->AuthType.numEntries = 1; |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 4929 | hddLog( LOG1, |
Abhinav Kumar | 2184e16 | 2019-09-16 15:02:24 +0530 | [diff] [blame] | 4930 | "%s: authType = %d RSNAuthType %d wpa_versions %d key_mgmt : 0x%x", |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 4931 | __func__, pHddStaCtx->conn_info.authType, RSNAuthType, |
Abhinav Kumar | 2184e16 | 2019-09-16 15:02:24 +0530 | [diff] [blame] | 4932 | pWextState->wpaVersion, pWextState->authKeyMgmt); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4933 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4934 | switch( pHddStaCtx->conn_info.authType) |
| 4935 | { |
| 4936 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
Abhinav Kumar | 62801ba | 2018-09-19 12:14:14 +0530 | [diff] [blame] | 4937 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4938 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4939 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 4940 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 4941 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4942 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 4943 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4944 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4945 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4946 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4947 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4948 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4949 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 4950 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4951 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4952 | 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] | 4953 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
| 4954 | } else |
| 4955 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4956 | hddLog( LOG1, "%s: Last chance to set authType to CCKM WPA.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4957 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4958 | } else |
| 4959 | #endif |
| 4960 | if((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4961 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4962 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA; |
| 4963 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4964 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 4965 | == IW_AUTH_KEY_MGMT_PSK) { |
| 4966 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4967 | } else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4968 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4969 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4970 | } |
| 4971 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4972 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4973 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 4974 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4975 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4976 | 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] | 4977 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4978 | } else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4979 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4980 | hddLog( LOG1, "%s: Last chance to set authType to CCKM RSN.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4981 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4982 | } else |
| 4983 | #endif |
| 4984 | |
| 4985 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4986 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 4987 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4988 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4989 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4990 | }else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4991 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4992 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 4993 | == IW_AUTH_KEY_MGMT_PSK)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4994 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4995 | } else |
| 4996 | #endif |
| 4997 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4998 | #ifdef WLAN_FEATURE_11W |
| 4999 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 5000 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5001 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 5002 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 5003 | pRoamProfile->AuthType.authType[0] = |
| 5004 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5005 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5006 | #endif |
Abhinav Kumar | a428218 | 2019-09-13 11:25:59 +0530 | [diff] [blame] | 5007 | if ((RSNAuthType == eCSR_AUTH_TYPE_SAE) && |
| 5008 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5009 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5010 | /* SAE case */ |
| 5011 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 5012 | } else |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 5013 | if ((RSNAuthType == eCSR_AUTH_TYPE_OWE) && |
| 5014 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5015 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5016 | /* OWE case */ |
| 5017 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OWE; |
| 5018 | } else |
Abhinav Kumar | 2184e16 | 2019-09-16 15:02:24 +0530 | [diff] [blame] | 5019 | if (RSNAuthType == eCSR_AUTH_TYPE_SAE) { |
| 5020 | /* SAE with open authentication case */ |
| 5021 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 5022 | } else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5023 | if( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5024 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5025 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN; |
| 5026 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5027 | if ( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5028 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5029 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK; |
Abhinav Kumar | 487e49e | 2019-07-22 14:46:18 +0530 | [diff] [blame] | 5030 | } else |
| 5031 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5032 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5033 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5034 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5035 | break; |
| 5036 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5037 | case eCSR_AUTH_TYPE_SHARED_KEY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5038 | |
| 5039 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5040 | break; |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 5041 | case eCSR_AUTH_TYPE_SAE: |
| 5042 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 5043 | break; |
| 5044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5045 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5046 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5047 | #ifdef FEATURE_WLAN_ESE |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5048 | hddLog( LOG1, "%s: In default, unknown auth type.", __func__); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5049 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5050 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5051 | break; |
| 5052 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5053 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5054 | hddLog( LOG1, "%s Set roam Authtype to %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5055 | __func__, pWextState->roamProfile.AuthType.authType[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5056 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5057 | EXIT(); |
| 5058 | return 0; |
| 5059 | } |
| 5060 | |
Sravan Kumar Kairam | 091e5b6 | 2017-01-23 14:14:20 +0530 | [diff] [blame] | 5061 | /** |
| 5062 | * hdd_rx_fwd_eapol() - forward cached eapol frames |
| 5063 | * @vosContext : pointer to vos global context |
| 5064 | * @pVosPacket: pointer to vos packet |
| 5065 | * |
| 5066 | * Return: None |
| 5067 | * |
| 5068 | */ |
| 5069 | void hdd_assoc_registerFwdEapolCB(void *pContext) |
| 5070 | { |
| 5071 | WLANTL_RegisterFwdEapol(pContext, hdd_rx_fwd_eapol); |
| 5072 | } |
| 5073 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5074 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5075 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5076 | \brief __iw_set_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5077 | This function sets the ssid received from wpa_supplicant |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5078 | to the CSR roam profile. |
| 5079 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5080 | \param - dev - Pointer to the net device. |
| 5081 | - info - Pointer to the iw_request_info. |
| 5082 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5083 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5084 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5085 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5086 | --------------------------------------------------------------------------*/ |
| 5087 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5088 | int __iw_set_essid(struct net_device *dev, |
| 5089 | struct iw_request_info *info, |
| 5090 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5091 | { |
| 5092 | v_U32_t status = 0; |
| 5093 | hdd_wext_state_t *pWextState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5094 | hdd_adapter_t *pAdapter; |
| 5095 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5096 | v_U32_t roamId; |
| 5097 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5098 | eCsrAuthType RSNAuthType; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5099 | tHalHandle hHal; |
| 5100 | hdd_station_ctx_t *pHddStaCtx; |
| 5101 | int ret = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5102 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5103 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5104 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5105 | if (NULL == pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5106 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5107 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5108 | "%s: Adapter is NULL",__func__); |
| 5109 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5110 | } |
| 5111 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5112 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5113 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5114 | if (0 != ret) |
| 5115 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5116 | return ret; |
| 5117 | } |
| 5118 | |
| 5119 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5120 | if (NULL == hHal) |
| 5121 | { |
| 5122 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5123 | "%s: Hal Context is NULL",__func__); |
| 5124 | return -EINVAL; |
| 5125 | } |
| 5126 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5127 | if (NULL == pHddStaCtx) |
| 5128 | { |
| 5129 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5130 | "%s: STA Context is NULL",__func__); |
| 5131 | return -EINVAL; |
| 5132 | } |
| 5133 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5134 | if (NULL == pWextState) |
| 5135 | { |
| 5136 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5137 | "%s: pWextState is NULL",__func__); |
| 5138 | return -EINVAL; |
| 5139 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5140 | if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
| 5141 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__); |
| 5142 | return -EBUSY; |
| 5143 | } |
| 5144 | if( SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length ) |
| 5145 | return -EINVAL; |
| 5146 | pRoamProfile = &pWextState->roamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5147 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5148 | if (wlan_hdd_check_and_stop_mon(pAdapter, true)) |
| 5149 | return -EINVAL; |
| 5150 | |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 5151 | /*Try disconnecting if already in connected state*/ |
| 5152 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5153 | if (0 > status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5154 | { |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 5155 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 5156 | " connection")); |
| 5157 | return -EALREADY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5158 | } |
| 5159 | /** wpa_supplicant 0.8.x, wext driver uses */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5160 | /** when cfg80211 defined, wpa_supplicant wext driver uses |
| 5161 | zero-length, null-string ssid for force disconnection. |
| 5162 | after disconnection (if previously connected) and cleaning ssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5163 | driver MUST return success */ |
| 5164 | if ( 0 == wrqu->essid.length ) { |
| 5165 | return 0; |
| 5166 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5167 | |
| 5168 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5169 | &pWextState->roamProfile.uapsd_mask); |
| 5170 | if (VOS_STATUS_SUCCESS != status) |
| 5171 | { |
| 5172 | pWextState->roamProfile.uapsd_mask = 0; |
| 5173 | } |
| 5174 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5175 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5176 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = wrqu->essid.length; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5177 | |
| 5178 | 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] | 5179 | vos_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId), extra, wrqu->essid.length); |
| 5180 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion || |
| 5181 | IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion ) { |
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 | //set gen ie |
| 5184 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 5185 | |
| 5186 | //set auth |
| 5187 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5188 | } |
| 5189 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5190 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5191 | if (pAdapter->wapi_info.nWapiMode) |
| 5192 | { |
| 5193 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 5194 | { |
| 5195 | case WAPI_AUTH_MODE_PSK: |
| 5196 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5197 | 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] | 5198 | pRoamProfile->AuthType.numEntries = 1; |
| 5199 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5200 | break; |
| 5201 | } |
| 5202 | case WAPI_AUTH_MODE_CERT: |
| 5203 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5204 | 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] | 5205 | pRoamProfile->AuthType.numEntries = 1; |
| 5206 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5207 | break; |
| 5208 | } |
| 5209 | } // End of switch |
| 5210 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5211 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 5212 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5213 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5214 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5215 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5216 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5217 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5218 | } |
| 5219 | } |
| 5220 | #endif /* FEATURE_WLAN_WAPI */ |
| 5221 | /* if previous genIE is not NULL, update AssocIE */ |
| 5222 | if (0 != pWextState->genIE.length) |
| 5223 | { |
| 5224 | memset( &pWextState->assocAddIE, 0, sizeof(pWextState->assocAddIE) ); |
| 5225 | memcpy( pWextState->assocAddIE.addIEdata, pWextState->genIE.addIEdata, |
| 5226 | pWextState->genIE.length); |
| 5227 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5228 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5229 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5230 | |
| 5231 | /* clear previous genIE after use it */ |
| 5232 | memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) ); |
| 5233 | } |
| 5234 | |
| 5235 | /* assumes it is not WPS Association by default, except when pAddIEAssoc has WPS IE */ |
| 5236 | pWextState->roamProfile.bWPSAssociation = FALSE; |
| 5237 | |
| 5238 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5239 | pWextState->roamProfile.nAddIEAssocLength)) |
| 5240 | pWextState->roamProfile.bWPSAssociation = TRUE; |
| 5241 | |
| 5242 | |
| 5243 | // Disable auto BMPS entry by PMC until DHCP is done |
| 5244 | sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), TRUE); |
| 5245 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5246 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5247 | (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5248 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5249 | if ( eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType ) |
| 5250 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5251 | hdd_select_cbmode(pAdapter, |
| 5252 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->AdHocChannel5G); |
| 5253 | } |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 5254 | /* |
| 5255 | * Change conn_state to connecting before sme_RoamConnect(), |
| 5256 | * because sme_RoamConnect() has a direct path to call |
| 5257 | * hdd_smeRoamCallback(), which will change the conn_state |
| 5258 | * If direct path, conn_state will be accordingly changed |
| 5259 | * to NotConnected or Associated by either |
| 5260 | * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() |
| 5261 | * in sme_RoamCallback() |
| 5262 | * if sme_RomConnect is to be queued, |
| 5263 | * Connecting state will remain until it is completed. |
| 5264 | * |
| 5265 | * If connection state is not changed, |
| 5266 | * connection state will remain in eConnectionState_NotConnected state. |
| 5267 | * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true |
| 5268 | * if conn state is eConnectionState_NotConnected. |
| 5269 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 5270 | * informed of connect result indication which is an issue. |
| 5271 | */ |
| 5272 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5273 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
| 5274 | { |
| 5275 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5276 | FL("Set HDD connState to eConnectionState_Connecting")); |
| 5277 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5278 | eConnectionState_Connecting); |
| 5279 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5280 | status = sme_RoamConnect( hHal,pAdapter->sessionId, |
| 5281 | &(pWextState->roamProfile), &roamId); |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 5282 | |
| 5283 | if ((eHAL_STATUS_SUCCESS != status) && |
| 5284 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5285 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5286 | { |
| 5287 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5288 | FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"), |
| 5289 | pAdapter->sessionId, status); |
| 5290 | /* change back to NotAssociated */ |
| 5291 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5292 | eConnectionState_NotConnected); |
| 5293 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5294 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5295 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5296 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5297 | EXIT(); |
| 5298 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5299 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5300 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5301 | int iw_set_essid(struct net_device *dev, |
| 5302 | struct iw_request_info *info, |
| 5303 | union iwreq_data *wrqu, char *extra) |
| 5304 | { |
| 5305 | int ret; |
| 5306 | |
| 5307 | vos_ssr_protect(__func__); |
| 5308 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 5309 | vos_ssr_unprotect(__func__); |
| 5310 | |
| 5311 | return ret; |
| 5312 | } |
| 5313 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5314 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5315 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5316 | \brief __iw_get_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5317 | This function returns the essid to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5318 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5319 | \param - dev - Pointer to the net device. |
| 5320 | - info - Pointer to the iw_request_info. |
| 5321 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5322 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5323 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5325 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5326 | int __iw_get_essid(struct net_device *dev, |
| 5327 | struct iw_request_info *info, |
| 5328 | struct iw_point *dwrq, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5329 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5330 | hdd_adapter_t *pAdapter; |
| 5331 | hdd_context_t *pHddCtx; |
| 5332 | hdd_wext_state_t *wextBuf; |
| 5333 | hdd_station_ctx_t *pHddStaCtx; |
| 5334 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5335 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5336 | ENTER(); |
| 5337 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5338 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5339 | if (NULL == pAdapter) |
| 5340 | { |
| 5341 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5342 | "%s: Adapter is NULL",__func__); |
| 5343 | return -EINVAL; |
| 5344 | } |
| 5345 | |
| 5346 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5347 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5348 | if (0 != ret) |
| 5349 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5350 | return ret; |
| 5351 | } |
| 5352 | |
| 5353 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5354 | if (NULL == pHddStaCtx) |
| 5355 | { |
| 5356 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5357 | "%s: STA Context is NULL",__func__); |
| 5358 | return -EINVAL; |
| 5359 | } |
| 5360 | |
| 5361 | wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5362 | if (NULL == wextBuf) |
| 5363 | { |
| 5364 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5365 | "%s: wextBuf is NULL",__func__); |
| 5366 | return -EINVAL; |
| 5367 | } |
| 5368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5369 | if((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 5370 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 5371 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected || |
| 5372 | pHddStaCtx->conn_info.connState == eConnectionState_IbssDisconnected) && |
| 5373 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) |
| 5374 | { |
| 5375 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 5376 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, dwrq->length); |
| 5377 | dwrq->flags = 1; |
| 5378 | } else { |
| 5379 | memset(extra, 0, dwrq->length); |
| 5380 | dwrq->length = 0; |
| 5381 | dwrq->flags = 0; |
| 5382 | } |
| 5383 | EXIT(); |
| 5384 | return 0; |
| 5385 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5386 | |
| 5387 | int iw_get_essid(struct net_device *dev, |
| 5388 | struct iw_request_info *info, |
| 5389 | struct iw_point *dwrq, char *extra) |
| 5390 | { |
| 5391 | int ret; |
| 5392 | |
| 5393 | vos_ssr_protect(__func__); |
| 5394 | ret = __iw_get_essid(dev, info, dwrq, extra); |
| 5395 | vos_ssr_unprotect(__func__); |
| 5396 | |
| 5397 | return ret; |
| 5398 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5399 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5400 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5401 | \brief __iw_set_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5402 | This function sets the auth type received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5403 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5404 | \param - dev - Pointer to the net device. |
| 5405 | - info - Pointer to the iw_request_info. |
| 5406 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5407 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5408 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5410 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5411 | int __iw_set_auth(struct net_device *dev,struct iw_request_info *info, |
| 5412 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5413 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5414 | hdd_adapter_t *pAdapter; |
| 5415 | hdd_context_t *pHddCtx; |
| 5416 | hdd_wext_state_t *pWextState; |
| 5417 | hdd_station_ctx_t *pHddStaCtx; |
| 5418 | tCsrRoamProfile *pRoamProfile; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5419 | eCsrEncryptionType mcEncryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5420 | eCsrEncryptionType ucEncryptionType; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5421 | int ret = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5422 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5423 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5424 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5425 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5426 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5427 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5428 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5429 | "%s: Adapter is NULL",__func__); |
| 5430 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5431 | } |
| 5432 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5433 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5434 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5435 | if (0 != ret) |
| 5436 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5437 | return ret; |
| 5438 | } |
| 5439 | |
| 5440 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5441 | if (NULL == pHddStaCtx) |
| 5442 | { |
| 5443 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5444 | "%s: STA Context is NULL",__func__); |
| 5445 | return -EINVAL; |
| 5446 | } |
| 5447 | |
| 5448 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5449 | if (NULL == pWextState) |
| 5450 | { |
| 5451 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5452 | "%s: pWextState is NULL",__func__); |
| 5453 | return -EINVAL; |
| 5454 | } |
| 5455 | |
| 5456 | pRoamProfile = &pWextState->roamProfile; |
| 5457 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5458 | switch(wrqu->param.flags & IW_AUTH_INDEX) |
| 5459 | { |
| 5460 | case IW_AUTH_WPA_VERSION: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5461 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5462 | pWextState->wpaVersion = wrqu->param.value; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5463 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5464 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5465 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5466 | case IW_AUTH_CIPHER_PAIRWISE: |
| 5467 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5468 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5469 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
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 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5472 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5473 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5474 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 5475 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5476 | } |
| 5477 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5478 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5479 | |
| 5480 | if( (IW_AUTH_KEY_MGMT_802_1X |
| 5481 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5482 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) ) |
| 5483 | /*Dynamic WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5484 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5485 | else |
| 5486 | /*Static WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5487 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5488 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5489 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5490 | |
| 5491 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5492 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5493 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5494 | /*Dynamic WEP key*/ |
| 5495 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 5496 | else |
| 5497 | /*Static WEP key*/ |
| 5498 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5499 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5500 | } |
| 5501 | else { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5502 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5503 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5504 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5505 | return -EINVAL; |
| 5506 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5508 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5509 | pRoamProfile->EncryptionType.encryptionType[0] = ucEncryptionType; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5510 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5511 | break; |
| 5512 | case IW_AUTH_CIPHER_GROUP: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5513 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5514 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 5515 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5516 | } |
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 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5519 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5520 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5521 | |
| 5522 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5523 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5524 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5525 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5526 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5527 | |
| 5528 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5529 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 5530 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5532 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5533 | |
| 5534 | else |
| 5535 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5536 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5537 | |
| 5538 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) |
| 5539 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5540 | /*Dynamic WEP keys won't work with shared keys*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5541 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5542 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5543 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5544 | { |
| 5545 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 5546 | } |
| 5547 | else |
| 5548 | { |
| 5549 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5550 | } |
| 5551 | } |
| 5552 | else { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5554 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5555 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5556 | return -EINVAL; |
| 5557 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5558 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5559 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5560 | pRoamProfile->mcEncryptionType.encryptionType[0] = mcEncryptionType; |
| 5561 | } |
| 5562 | break; |
| 5563 | |
| 5564 | case IW_AUTH_80211_AUTH_ALG: |
| 5565 | { |
| 5566 | /*Save the auth algo here and set auth type to SME Roam profile |
| 5567 | in the iw_set_ap_address*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5568 | if( wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5569 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5570 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5571 | else if(wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 5572 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5573 | |
| 5574 | else if(wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 5575 | /*Not supported*/ |
| 5576 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5577 | pWextState->roamProfile.AuthType.authType[0] = pHddStaCtx->conn_info.authType; |
| 5578 | } |
| 5579 | break; |
| 5580 | |
| 5581 | case IW_AUTH_KEY_MGMT: |
| 5582 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5583 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5584 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 5585 | /*Check for CCKM AKM type */ |
| 5586 | if ( wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5587 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: CCKM AKM Set %d", |
| 5588 | __func__, wrqu->param.value); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5589 | /* Set the CCKM bit in authKeyMgmt */ |
| 5590 | /* Right now, this breaks all ref to authKeyMgmt because our |
| 5591 | * code doesn't realize it is a "bitfield" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5592 | */ |
| 5593 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 5594 | /*Set the key management to 802.1X*/ |
| 5595 | //pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5596 | pWextState->isESEConnection = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5597 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5598 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5599 | } else if ( wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 5600 | /*Save the key management*/ |
| 5601 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 5602 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 5603 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5604 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 5605 | } else if (!( wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
| 5606 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; //eCSR_AUTH_TYPE_WPA_NONE |
| 5607 | /*Save the key management anyway*/ |
| 5608 | pWextState->authKeyMgmt = wrqu->param.value; |
| 5609 | } else { // It must be IW_AUTH_KEY_MGMT_802_1X |
| 5610 | /*Save the key management*/ |
| 5611 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 5612 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 5613 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5614 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 5615 | } |
| 5616 | #else |
| 5617 | /*Save the key management*/ |
| 5618 | pWextState->authKeyMgmt = wrqu->param.value; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5619 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5620 | } |
| 5621 | break; |
| 5622 | |
| 5623 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 5624 | { |
| 5625 | if(wrqu->param.value) { |
| 5626 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5627 | "Counter Measure started %d", wrqu->param.value); |
| 5628 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED; |
| 5629 | } |
| 5630 | else { |
| 5631 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5632 | "Counter Measure stopped=%d", wrqu->param.value); |
| 5633 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED; |
| 5634 | } |
| 5635 | } |
| 5636 | break; |
| 5637 | case IW_AUTH_DROP_UNENCRYPTED: |
| 5638 | case IW_AUTH_WPA_ENABLED: |
| 5639 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 5640 | case IW_AUTH_ROAMING_CONTROL: |
| 5641 | case IW_AUTH_PRIVACY_INVOKED: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5643 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5644 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5645 | hddLog(LOGW, "%s called with unsupported auth type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5646 | wrqu->param.flags & IW_AUTH_INDEX); |
| 5647 | break; |
| 5648 | } |
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 | EXIT(); |
| 5651 | return 0; |
| 5652 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5653 | |
| 5654 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 5655 | union iwreq_data *wrqu, char *extra) |
| 5656 | { |
| 5657 | int ret; |
| 5658 | |
| 5659 | vos_ssr_protect(__func__); |
| 5660 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 5661 | vos_ssr_unprotect(__func__); |
| 5662 | |
| 5663 | return ret; |
| 5664 | } |
| 5665 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5666 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5667 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5668 | \brief __iw_get_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5669 | This function returns the auth type to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5670 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5671 | \param - dev - Pointer to the net device. |
| 5672 | - info - Pointer to the iw_request_info. |
| 5673 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5674 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5675 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5676 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5677 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5678 | int __iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 5679 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5680 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5681 | hdd_adapter_t* pAdapter; |
| 5682 | hdd_wext_state_t *pWextState; |
| 5683 | tCsrRoamProfile *pRoamProfile; |
| 5684 | hdd_context_t *pHddCtx; |
| 5685 | int ret = 0; |
| 5686 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5687 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5688 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5689 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5690 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5691 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5692 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5693 | "%s: Adapter is NULL",__func__); |
| 5694 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5695 | } |
| 5696 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5697 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5698 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5699 | if (0 != ret) |
| 5700 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5701 | return ret; |
| 5702 | } |
| 5703 | |
| 5704 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5705 | if (NULL == pWextState) |
| 5706 | { |
| 5707 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5708 | "%s: pWextState is NULL",__func__); |
| 5709 | return -EINVAL; |
| 5710 | } |
| 5711 | pRoamProfile = &pWextState->roamProfile; |
| 5712 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5713 | switch(pRoamProfile->negotiatedAuthType) |
| 5714 | { |
| 5715 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 5716 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5717 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 5718 | break; |
| 5719 | case eCSR_AUTH_TYPE_WPA: |
| 5720 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5721 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 5722 | break; |
| 5723 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5724 | case eCSR_AUTH_TYPE_FT_RSN: |
| 5725 | #endif |
| 5726 | case eCSR_AUTH_TYPE_RSN: |
| 5727 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5728 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 5729 | break; |
| 5730 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5731 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5732 | break; |
| 5733 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5734 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 5735 | break; |
| 5736 | case eCSR_AUTH_TYPE_UNKNOWN: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5737 | hddLog(LOG1,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5738 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5739 | break; |
| 5740 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 5741 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5742 | break; |
| 5743 | case eCSR_AUTH_TYPE_WPA_PSK: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5744 | hddLog(LOG1,"%s called with WPA PSK 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 | return -EIO; |
| 5747 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5748 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 5749 | #endif |
| 5750 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5751 | #ifdef WLAN_FEATURE_11W |
| 5752 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 5753 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5754 | #endif |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5755 | hddLog(LOG1,"%s called with RSN PSK auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5756 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5757 | return -EIO; |
| 5758 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5759 | hddLog(LOGE,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5760 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5761 | return -EIO; |
| 5762 | } |
| 5763 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) |
| 5764 | { |
| 5765 | switch(pRoamProfile->negotiatedUCEncryptionType) |
| 5766 | { |
| 5767 | case eCSR_ENCRYPT_TYPE_NONE: |
| 5768 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 5769 | break; |
| 5770 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5771 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5772 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 5773 | break; |
| 5774 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5775 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 5776 | break; |
| 5777 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5778 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5779 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 5780 | break; |
| 5781 | case eCSR_ENCRYPT_TYPE_AES: |
| 5782 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 5783 | break; |
| 5784 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5785 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 5786 | __func__, pRoamProfile->negotiatedUCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5787 | return -EIO; |
| 5788 | } |
| 5789 | } |
| 5790 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5791 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5792 | { |
| 5793 | switch(pRoamProfile->negotiatedMCEncryptionType) |
| 5794 | { |
| 5795 | case eCSR_ENCRYPT_TYPE_NONE: |
| 5796 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 5797 | break; |
| 5798 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5799 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5800 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 5801 | break; |
| 5802 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5803 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 5804 | break; |
| 5805 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5806 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5807 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 5808 | break; |
| 5809 | case eCSR_ENCRYPT_TYPE_AES: |
| 5810 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 5811 | break; |
| 5812 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5813 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 5814 | __func__, pRoamProfile->negotiatedMCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5815 | return -EIO; |
| 5816 | } |
| 5817 | } |
| 5818 | |
| 5819 | hddLog(LOG1, "%s called with auth type %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5820 | __func__, pRoamProfile->AuthType.authType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5821 | EXIT(); |
| 5822 | return 0; |
| 5823 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5824 | |
| 5825 | int iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 5826 | union iwreq_data *wrqu,char *extra) |
| 5827 | { |
| 5828 | int ret; |
| 5829 | |
| 5830 | vos_ssr_protect(__func__); |
| 5831 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 5832 | vos_ssr_unprotect(__func__); |
| 5833 | |
| 5834 | return ret; |
| 5835 | } |
| 5836 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5837 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5838 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5839 | \brief __iw_set_ap_address() - |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5840 | This function calls the sme_RoamConnect function to associate |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5841 | to the AP with the specified BSSID received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5842 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5843 | \param - dev - Pointer to the net device. |
| 5844 | - info - Pointer to the iw_request_info. |
| 5845 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5846 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5847 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5848 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5849 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5850 | int __iw_set_ap_address(struct net_device *dev, |
| 5851 | struct iw_request_info *info, |
| 5852 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5853 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5854 | hdd_station_ctx_t *pHddStaCtx; |
| 5855 | hdd_adapter_t *pAdapter; |
| 5856 | hdd_context_t *pHddCtx; |
| 5857 | v_U8_t *pMacAddress = NULL; |
| 5858 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5861 | |
| 5862 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5863 | if (NULL == pAdapter) |
| 5864 | { |
| 5865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5866 | "%s: Adapter is NULL", __func__); |
| 5867 | return -EINVAL; |
| 5868 | } |
| 5869 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5870 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5871 | if (0 != ret) |
| 5872 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5873 | return ret; |
| 5874 | } |
| 5875 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5876 | if (NULL == pHddStaCtx) |
| 5877 | { |
| 5878 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5879 | "%s: pHddStaCtx is NULL", __func__); |
| 5880 | return -EINVAL; |
| 5881 | } |
| 5882 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5883 | pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data; |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 5884 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s "MAC_ADDRESS_STR, |
| 5885 | __func__, MAC_ADDR_ARRAY(pMacAddress)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5886 | vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid )); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5887 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5888 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5889 | return 0; |
| 5890 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5891 | |
| 5892 | int iw_set_ap_address(struct net_device *dev, |
| 5893 | struct iw_request_info *info, |
| 5894 | union iwreq_data *wrqu, char *extra) |
| 5895 | { |
| 5896 | int ret; |
| 5897 | |
| 5898 | vos_ssr_protect(__func__); |
| 5899 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 5900 | vos_ssr_unprotect(__func__); |
| 5901 | |
| 5902 | return ret; |
| 5903 | } |
| 5904 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5905 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5906 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5907 | \brief __iw_get_ap_address() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5908 | This function returns the BSSID to the wpa_supplicant |
| 5909 | \param - dev - Pointer to the net device. |
| 5910 | - info - Pointer to the iw_request_info. |
| 5911 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5912 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5913 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5914 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5915 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5916 | int __iw_get_ap_address(struct net_device *dev, |
| 5917 | struct iw_request_info *info, |
| 5918 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5919 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5920 | hdd_station_ctx_t *pHddStaCtx; |
| 5921 | hdd_adapter_t *pAdapter; |
| 5922 | hdd_context_t *pHddCtx; |
| 5923 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5924 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5925 | ENTER(); |
| 5926 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5927 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5928 | if (NULL == pAdapter) |
| 5929 | { |
| 5930 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5931 | "%s: Adapter is NULL", __func__); |
| 5932 | return -EINVAL; |
| 5933 | } |
| 5934 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5935 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5936 | if (0 != ret) |
| 5937 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5938 | return ret; |
| 5939 | } |
| 5940 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5941 | if (NULL == pHddStaCtx) |
| 5942 | { |
| 5943 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5944 | "%s: pHddStaCtx is NULL", __func__); |
| 5945 | return -EINVAL; |
| 5946 | } |
| 5947 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5948 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 5949 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 5950 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5951 | memcpy(wrqu->ap_addr.sa_data,pHddStaCtx->conn_info.bssId,ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5952 | } |
| 5953 | else |
| 5954 | { |
| 5955 | memset(wrqu->ap_addr.sa_data,0,sizeof(wrqu->ap_addr.sa_data)); |
| 5956 | } |
| 5957 | EXIT(); |
| 5958 | return 0; |
| 5959 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5960 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5961 | int iw_get_ap_address(struct net_device *dev, |
| 5962 | struct iw_request_info *info, |
| 5963 | union iwreq_data *wrqu, char *extra) |
| 5964 | { |
| 5965 | int ret; |
| 5966 | |
| 5967 | vos_ssr_protect(__func__); |
| 5968 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 5969 | vos_ssr_unprotect(__func__); |
| 5970 | |
| 5971 | return ret; |
| 5972 | } |
| 5973 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5974 | #ifdef WLAN_FEATURE_11W |
| 5975 | /**--------------------------------------------------------------------------- |
| 5976 | |
| 5977 | \brief hdd_indicateUnprotMgmtFrame - |
| 5978 | This function forwards the unprotected management frame to the supplicant |
| 5979 | \param - pAdapter - Pointer to HDD adapter |
| 5980 | - nFrameLength - Length of the unprotected frame being passed |
| 5981 | - pbFrames - Pointer to the frame buffer |
| 5982 | - frameType - 802.11 frame type |
| 5983 | \return - nothing |
| 5984 | |
| 5985 | --------------------------------------------------------------------------*/ |
| 5986 | void hdd_indicateUnprotMgmtFrame( hdd_adapter_t *pAdapter, |
| 5987 | tANI_U32 nFrameLength, |
| 5988 | tANI_U8* pbFrames, |
| 5989 | tANI_U8 frameType ) |
| 5990 | { |
| 5991 | tANI_U8 type = 0; |
| 5992 | tANI_U8 subType = 0; |
| 5993 | |
| 5994 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d", |
| 5995 | __func__, frameType, nFrameLength); |
| 5996 | |
| 5997 | /* Sanity Checks */ |
| 5998 | if (NULL == pAdapter) |
| 5999 | { |
| 6000 | hddLog( LOGE, FL("pAdapter is NULL")); |
| 6001 | return; |
| 6002 | } |
| 6003 | |
| 6004 | if (NULL == pAdapter->dev) |
| 6005 | { |
| 6006 | hddLog( LOGE, FL("pAdapter->dev is NULL")); |
| 6007 | return; |
| 6008 | } |
| 6009 | |
| 6010 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 6011 | { |
| 6012 | hddLog( LOGE, FL("pAdapter has invalid magic")); |
| 6013 | return; |
| 6014 | } |
| 6015 | |
| 6016 | if( !nFrameLength ) |
| 6017 | { |
| 6018 | hddLog( LOGE, FL("Frame Length is Invalid ZERO")); |
| 6019 | return; |
| 6020 | } |
| 6021 | |
| 6022 | if (NULL == pbFrames) { |
| 6023 | hddLog( LOGE, FL("pbFrames is NULL")); |
| 6024 | return; |
| 6025 | } |
| 6026 | |
| 6027 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 6028 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 6029 | |
| 6030 | /* Get pAdapter from Destination mac address of the frame */ |
| 6031 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) |
| 6032 | { |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6033 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 6034 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength); |
| 6035 | #else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6036 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, nFrameLength); |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6037 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6038 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 6039 | } |
| 6040 | else if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DEAUTH) |
| 6041 | { |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6042 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 6043 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength); |
| 6044 | #else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6045 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, nFrameLength); |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6046 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6047 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 6048 | } |
| 6049 | else |
| 6050 | { |
| 6051 | hddLog( LOGE, FL("Frame type %d and subtype %d are not valid"), type, subType); |
| 6052 | return; |
| 6053 | } |
| 6054 | } |
| 6055 | #endif |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6056 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6057 | #if defined (FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6058 | void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid, |
| 6059 | tANI_U8 state, |
| 6060 | tANI_U16 measInterval ) |
| 6061 | { |
| 6062 | union iwreq_data wrqu; |
| 6063 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6064 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6065 | |
| 6066 | if (NULL == pAdapter) |
| 6067 | return; |
| 6068 | |
| 6069 | // create the event |
| 6070 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6071 | memset(buf, '\0', sizeof(buf)); |
| 6072 | |
| 6073 | hddLog(VOS_TRACE_LEVEL_INFO, "TSM Ind tid(%d) state(%d) MeasInt(%d)", |
| 6074 | tid, state, measInterval); |
| 6075 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6076 | 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] | 6077 | |
| 6078 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6079 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6080 | // send the event |
| 6081 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6082 | } |
| 6083 | |
| 6084 | void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 6085 | { |
| 6086 | union iwreq_data wrqu; |
| 6087 | char buf[IW_CUSTOM_MAX + 1]; |
| 6088 | char *pos = buf; |
| 6089 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6090 | |
| 6091 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6092 | return; |
| 6093 | |
| 6094 | // create the event |
| 6095 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6096 | memset(buf, '\0', sizeof(buf)); |
| 6097 | |
| 6098 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 6099 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXPREAUTHNOTIFY=%02x:%02x:%02x:%02x:%02x:%02x %u:%u", |
| 6100 | pRoamInfo->bssid[0], pRoamInfo->bssid[1], pRoamInfo->bssid[2], |
| 6101 | pRoamInfo->bssid[3], pRoamInfo->bssid[4], pRoamInfo->bssid[5], |
| 6102 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6103 | |
| 6104 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 6105 | pos += nBytes; |
| 6106 | freeBytes -= nBytes; |
| 6107 | |
| 6108 | vos_mem_copy(pos, pRoamInfo->bssid, WNI_CFG_BSSID_LEN); |
| 6109 | pos += WNI_CFG_BSSID_LEN; |
| 6110 | freeBytes -= WNI_CFG_BSSID_LEN; |
| 6111 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6112 | nBytes = snprintf(pos, freeBytes, " %u:%u", pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 6113 | freeBytes -= nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6114 | |
| 6115 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6116 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6117 | |
| 6118 | // send the event |
| 6119 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6120 | } |
| 6121 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6122 | void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6123 | { |
| 6124 | union iwreq_data wrqu; |
| 6125 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6126 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6127 | |
| 6128 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6129 | return; |
| 6130 | |
| 6131 | // create the event |
| 6132 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6133 | memset(buf, '\0', sizeof(buf)); |
| 6134 | |
| 6135 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
| 6136 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6137 | nBytes = snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6138 | |
| 6139 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6140 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6141 | |
| 6142 | // send the event |
| 6143 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6144 | } |
| 6145 | |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 6146 | void hdd_indicateEseBcnReportNoResults(const hdd_adapter_t *pAdapter, |
| 6147 | const tANI_U16 measurementToken, |
| 6148 | const tANI_BOOLEAN flag, |
| 6149 | const tANI_U8 numBss) |
| 6150 | { |
| 6151 | union iwreq_data wrqu; |
| 6152 | char buf[IW_CUSTOM_MAX]; |
| 6153 | char *pos = buf; |
| 6154 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6155 | |
| 6156 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6157 | memset(buf, '\0', sizeof(buf)); |
| 6158 | |
| 6159 | hddLog(VOS_TRACE_LEVEL_INFO, FL("CCXBCNREP=%d %d %d"), measurementToken, flag, |
| 6160 | numBss); |
| 6161 | |
| 6162 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 6163 | flag, numBss); |
| 6164 | |
| 6165 | wrqu.data.pointer = buf; |
| 6166 | wrqu.data.length = nBytes; |
| 6167 | // send the event |
| 6168 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6169 | } |
| 6170 | |
| 6171 | |
| 6172 | static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6173 | const tCsrRoamInfo *pRoamInfo) |
| 6174 | { |
| 6175 | union iwreq_data wrqu; |
| 6176 | char buf[IW_CUSTOM_MAX + 1]; |
| 6177 | char *pos = buf; |
| 6178 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6179 | tANI_U8 i = 0, len = 0; |
| 6180 | tANI_U8 tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 6181 | tANI_U8 lastSent = 0, sendBss = 0; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6182 | int bcnRepFieldSize = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0].bcnReportFields); |
| 6183 | tANI_U8 ieLenByte = 1; |
| 6184 | /* CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes */ |
| 6185 | #define ESEBCNREPHEADER_LEN (18) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6186 | |
| 6187 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6188 | return; |
| 6189 | |
| 6190 | /* Custom event can pass maximum of 256 bytes of data, |
| 6191 | based on the IE len we need to identify how many BSS info can |
| 6192 | be filled in to custom event data */ |
| 6193 | /* |
| 6194 | meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 6195 | bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 6196 | CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 6197 | */ |
| 6198 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6199 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) && (!pRoamInfo->pEseBcnReportRsp->numBss)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6200 | { |
| 6201 | hddLog(VOS_TRACE_LEVEL_INFO, "Measurement Done but no scan results"); |
| 6202 | /* If the measurement is none and no scan results found, |
| 6203 | indicate the supplicant about measurement done */ |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 6204 | hdd_indicateEseBcnReportNoResults(pAdapter, |
| 6205 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 6206 | pRoamInfo->pEseBcnReportRsp->flag, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6207 | pRoamInfo->pEseBcnReportRsp->numBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6208 | } |
| 6209 | else |
| 6210 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6211 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6212 | { |
| 6213 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6214 | memset(buf, '\0', sizeof(buf)); |
| 6215 | tot_bcn_ieLen = 0; |
| 6216 | sendBss = 0; |
| 6217 | pos = buf; |
| 6218 | freeBytes = IW_CUSTOM_MAX; |
| 6219 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6220 | for (i = lastSent; i < pRoamInfo->pEseBcnReportRsp->numBss; i++) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6221 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6222 | len = bcnRepFieldSize + ieLenByte + pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen; |
| 6223 | if ((len + tot_bcn_ieLen) > (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6224 | { |
| 6225 | break; |
| 6226 | } |
| 6227 | tot_bcn_ieLen += len; |
| 6228 | sendBss++; |
| 6229 | hddLog(VOS_TRACE_LEVEL_INFO, "i(%d) sizeof bcnReportFields(%d)" |
| 6230 | "IeLength(%d) Length of Ie(%d) totLen(%d)", |
| 6231 | i, bcnRepFieldSize, 1, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6232 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6233 | tot_bcn_ieLen); |
| 6234 | } |
| 6235 | |
| 6236 | hddLog(VOS_TRACE_LEVEL_INFO, "Sending %d BSS Info", sendBss); |
| 6237 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXBCNREP=%d %d %d %d", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6238 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 6239 | sendBss, tot_bcn_ieLen); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6240 | |
| 6241 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6242 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 6243 | sendBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6244 | pos += nBytes; |
| 6245 | freeBytes -= nBytes; |
| 6246 | |
| 6247 | /* Copy total Beacon report data length */ |
| 6248 | vos_mem_copy(pos, (char*)&tot_bcn_ieLen, sizeof(tot_bcn_ieLen)); |
| 6249 | pos += sizeof(tot_bcn_ieLen); |
| 6250 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 6251 | |
| 6252 | for (i = 0; i < sendBss; i++) |
| 6253 | { |
| 6254 | hddLog(VOS_TRACE_LEVEL_INFO, "ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 6255 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 6256 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6257 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6258 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ChanNum, |
| 6259 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Spare, |
| 6260 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.MeasDuration, |
| 6261 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.PhyType, |
| 6262 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.RecvSigPower, |
| 6263 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ParentTsf, |
| 6264 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[0], |
| 6265 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[1], |
| 6266 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.BcnInterval, |
| 6267 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.CapabilityInfo, |
| 6268 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[0], |
| 6269 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[1], |
| 6270 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[2], |
| 6271 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[3], |
| 6272 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[4], |
| 6273 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[5]); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6274 | |
| 6275 | /* bcn report fields are copied */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6276 | len = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields); |
| 6277 | vos_mem_copy(pos, (char*)&pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6278 | pos += len; |
| 6279 | freeBytes -= len; |
| 6280 | |
| 6281 | /* Add 1 byte of ie len */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6282 | len = pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].ieLen; |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6283 | vos_mem_copy(pos, (char*)&len, sizeof(len)); |
| 6284 | pos += sizeof(len); |
| 6285 | freeBytes -= sizeof(len); |
| 6286 | |
| 6287 | /* copy IE from scan results */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6288 | vos_mem_copy(pos, (char*)pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].pBuf, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6289 | pos += len; |
| 6290 | freeBytes -= len; |
| 6291 | } |
| 6292 | |
| 6293 | wrqu.data.pointer = buf; |
| 6294 | wrqu.data.length = strlen(buf); |
| 6295 | |
| 6296 | // send the event |
| 6297 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6298 | lastSent += sendBss; |
| 6299 | } |
| 6300 | } |
| 6301 | } |
| 6302 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6303 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6304 | |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 6305 | hdd_adapter_t *hdd_get_sta_connection_in_progress(hdd_context_t *hdd_ctx) |
| 6306 | { |
| 6307 | hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; |
| 6308 | hdd_adapter_t *adapter = NULL; |
| 6309 | VOS_STATUS status; |
| 6310 | hdd_station_ctx_t *hdd_sta_ctx; |
| 6311 | |
| 6312 | if (!hdd_ctx) { |
| 6313 | hddLog(LOGE, FL("HDD context is NULL")); |
| 6314 | return NULL; |
| 6315 | } |
| 6316 | |
| 6317 | status = hdd_get_front_adapter(hdd_ctx, &adapter_node); |
| 6318 | while (NULL != adapter_node && VOS_STATUS_SUCCESS == status) { |
| 6319 | adapter = adapter_node->pAdapter; |
| 6320 | if (!adapter) |
| 6321 | goto end; |
| 6322 | |
| 6323 | if ((WLAN_HDD_INFRA_STATION == adapter->device_mode) || |
| 6324 | (WLAN_HDD_P2P_CLIENT == adapter->device_mode) || |
| 6325 | (WLAN_HDD_P2P_DEVICE == adapter->device_mode)) { |
| 6326 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6327 | if (eConnectionState_Connecting == |
| 6328 | hdd_sta_ctx->conn_info.connState) { |
| 6329 | hddLog(LOG1, FL("session_id %d: Connection is in progress"), |
| 6330 | adapter->sessionId); |
| 6331 | return adapter; |
| 6332 | } else if ((eConnectionState_Associated == |
| 6333 | hdd_sta_ctx->conn_info.connState) && |
Vignesh Viswanathan | 0ac8e56 | 2018-06-14 17:24:10 +0530 | [diff] [blame] | 6334 | sme_is_sta_key_exchange_in_progress( |
| 6335 | hdd_ctx->hHal, adapter->sessionId)) { |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 6336 | hddLog(LOG1, FL("session_id %d: Key exchange is in progress"), |
| 6337 | adapter->sessionId); |
| 6338 | return adapter; |
| 6339 | } |
| 6340 | } |
| 6341 | end: |
| 6342 | status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next); |
| 6343 | adapter_node = next; |
| 6344 | } |
| 6345 | return NULL; |
| 6346 | } |
| 6347 | |