Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Abhishek Singh | e6137b8 | 2019-03-22 20:06:09 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2019 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 |
| 159 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 160 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 161 | // Offset where the EID-Len-IE, start. |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 162 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2)*/ |
| 163 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 164 | #endif |
| 165 | |
| 166 | #define BEACON_FRAME_IES_OFFSET 12 |
| 167 | |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 168 | /* The time after add bss, in which SAP should start ECSA to move to SCC */ |
| 169 | #define ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL 1500 |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 170 | /* |
| 171 | * Time in ms after disconnect, in which the SAP should move to non DFS channel. |
| 172 | * This will avoid multiple SAP channel switch if disconnet is followed by |
| 173 | * connect. |
| 174 | */ |
| 175 | #define ECSA_DFS_CHAN_CHANGE_DEFER_TIME 200 |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 176 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 177 | #ifdef WLAN_FEATURE_11W |
| 178 | void hdd_indicateUnprotMgmtFrame(hdd_adapter_t *pAdapter, |
| 179 | tANI_U32 nFrameLength, |
| 180 | tANI_U8* pbFrames, |
| 181 | tANI_U8 frameType ); |
| 182 | #endif |
| 183 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 184 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 185 | static void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid, |
| 186 | tANI_U8 state, |
| 187 | tANI_U16 measInterval ); |
| 188 | static void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 189 | static void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo); |
| 190 | static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, const tCsrRoamInfo *pRoamInfo); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 191 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 192 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 193 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 194 | static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, |
| 195 | tCsrRoamInfo *pRoamInfo, |
| 196 | tANI_U32 roamId, |
| 197 | eRoamCmdStatus roamStatus, |
| 198 | eCsrRoamResult roamResult ); |
| 199 | |
Abhinav Kumar | 118efd0 | 2019-08-07 16:41:07 +0530 | [diff] [blame] | 200 | #if defined(WLAN_FEATURE_SAE) && \ |
| 201 | defined(CFG80211_EXTERNAL_AUTH_SUPPORT) |
| 202 | /** |
| 203 | * wlan_hdd_sae_callback() - Sends SAE info to supplicant |
| 204 | * @adapter: pointer adapter context |
| 205 | * @roam_info: pointer to roam info |
| 206 | * |
| 207 | * This API is used to send required SAE info to trigger SAE in supplicant. |
| 208 | * |
| 209 | * Return: None |
| 210 | */ |
| 211 | static void wlan_hdd_sae_callback(hdd_adapter_t *adapter, |
| 212 | tCsrRoamInfo *roam_info) |
| 213 | { |
| 214 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 215 | int flags; |
| 216 | struct sir_sae_info *sae_info = roam_info->sae_info; |
| 217 | struct cfg80211_external_auth_params params = {0}; |
| 218 | |
| 219 | if (wlan_hdd_validate_context(hdd_ctx)) |
| 220 | return; |
| 221 | if (!sae_info) { |
| 222 | hddLog(LOGE, FL("SAE info in NULL")); |
| 223 | return; |
| 224 | } |
| 225 | flags = vos_get_gfp_flags(); |
| 226 | |
| 227 | params.key_mgmt_suite = 0x00; |
| 228 | params.key_mgmt_suite |= 0x0F << 8; |
| 229 | params.key_mgmt_suite |= 0xAC << 16; |
| 230 | params.key_mgmt_suite |= 0x8 << 24; |
| 231 | |
| 232 | params.action = NL80211_EXTERNAL_AUTH_START; |
| 233 | vos_mem_copy(params.bssid, sae_info->peer_mac_addr.bytes, |
| 234 | VOS_MAC_ADDR_SIZE); |
| 235 | vos_mem_copy(params.ssid.ssid, sae_info->ssid.ssId, sae_info->ssid.length); |
| 236 | params.ssid.ssid_len = sae_info->ssid.length; |
| 237 | |
| 238 | cfg80211_external_auth_request(adapter->dev, ¶ms, flags); |
| 239 | hddLog(LOG1, FL("SAE: sent cmd")); |
| 240 | } |
| 241 | #else |
| 242 | static void wlan_hdd_sae_callback(hdd_adapter_t *adapter, |
| 243 | tCsrRoamInfo *roam_info) |
| 244 | { } |
| 245 | #endif |
| 246 | |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 247 | v_VOID_t hdd_connSetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 248 | eConnectionState connState ) |
| 249 | { |
| 250 | // save the new connection state |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 251 | hddLog(LOG1, FL("ConnectionState Changed from oldState:%d to State:%d"), |
| 252 | pHddStaCtx->conn_info.connState,connState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 253 | pHddStaCtx->conn_info.connState = connState; |
| 254 | } |
| 255 | |
| 256 | // returns FALSE if not connected. |
| 257 | // returns TRUE for the two 'connected' states (Infra Associated or IBSS Connected ). |
| 258 | // returns the connection state. Can specify NULL if you dont' want to get the actual state. |
| 259 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 260 | static inline v_BOOL_t hdd_connGetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 261 | eConnectionState *pConnState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 262 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 263 | v_BOOL_t fConnected; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 264 | eConnectionState connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 266 | // get the connection state. |
| 267 | connState = pHddStaCtx->conn_info.connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 268 | // Set the fConnected return variable based on the Connected State. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 269 | if ( eConnectionState_Associated == connState || |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 270 | eConnectionState_IbssConnected == connState || |
| 271 | eConnectionState_IbssDisconnected == connState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 272 | { |
| 273 | fConnected = VOS_TRUE; |
| 274 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 275 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 276 | { |
| 277 | fConnected = VOS_FALSE; |
| 278 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 280 | if ( pConnState ) |
| 281 | { |
| 282 | *pConnState = connState; |
| 283 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 284 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 285 | return( fConnected ); |
| 286 | } |
| 287 | |
| 288 | v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx ) |
| 289 | { |
| 290 | return( hdd_connGetConnectionState( pHddStaCtx, NULL ) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 292 | |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 293 | eCsrBand hdd_connGetConnectedBand( hdd_station_ctx_t *pHddStaCtx ) |
| 294 | { |
| 295 | v_U8_t staChannel = 0; |
| 296 | |
| 297 | if ( eConnectionState_Associated == pHddStaCtx->conn_info.connState ) |
| 298 | { |
| 299 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 300 | } |
| 301 | |
| 302 | if ( staChannel > 0 && staChannel < 14 ) |
| 303 | return eCSR_BAND_24; |
| 304 | else if (staChannel >= 36 && staChannel <= 165 ) |
| 305 | return eCSR_BAND_5G; |
| 306 | else /* If station is not connected return as eCSR_BAND_ALL */ |
| 307 | return eCSR_BAND_ALL; |
| 308 | } |
| 309 | |
| 310 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 311 | //TODO - Not used anyhwere. Can be removed. |
| 312 | #if 0 |
| 313 | // |
| 314 | v_BOOL_t hdd_connIsConnectedInfra( hdd_adapter_t *pAdapter ) |
| 315 | { |
| 316 | v_BOOL_t fConnectedInfra = FALSE; |
| 317 | eConnectionState connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 318 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 319 | if ( hdd_connGetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connState ) ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 320 | { |
| 321 | if ( eConnectionState_Associated == connState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 322 | { |
| 323 | fConnectedInfra = TRUE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 324 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 325 | } |
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 | return( fConnectedInfra ); |
| 328 | } |
| 329 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 330 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 331 | static inline v_BOOL_t hdd_connGetConnectedCipherAlgo( hdd_station_ctx_t *pHddStaCtx, eCsrEncryptionType *pConnectedCipherAlgo ) |
| 332 | { |
| 333 | v_BOOL_t fConnected = VOS_FALSE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 334 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 335 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 336 | |
| 337 | if ( pConnectedCipherAlgo ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 338 | { |
| 339 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 340 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 341 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 342 | return( fConnected ); |
| 343 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 344 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 345 | inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eMib_dot11DesiredBssType *pConnectedBssType ) |
| 346 | { |
| 347 | v_BOOL_t fConnected = VOS_FALSE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 348 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 349 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 350 | |
| 351 | if ( pConnectedBssType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | { |
| 353 | *pConnectedBssType = pHddStaCtx->conn_info.connDot11DesiredBssType; |
| 354 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 355 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 356 | return( fConnected ); |
| 357 | } |
| 358 | |
| 359 | static inline void hdd_connSaveConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eCsrRoamBssType csrRoamBssType ) |
| 360 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 361 | switch( csrRoamBssType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 362 | { |
| 363 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
| 364 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_infrastructure; |
| 365 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 366 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 367 | case eCSR_BSS_TYPE_IBSS: |
| 368 | case eCSR_BSS_TYPE_START_IBSS: |
| 369 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_independent; |
| 370 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 371 | |
| 372 | /** We will never set the BssType to 'any' when attempting a connection |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 373 | so CSR should never send this back to us.*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 374 | case eCSR_BSS_TYPE_ANY: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 375 | default: |
| 376 | VOS_ASSERT( 0 ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 377 | break; |
| 378 | } |
| 379 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | } |
| 381 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 382 | /** |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 383 | * hdd_copy_ht_caps()- Populate kernel HT caps structure object |
| 384 | * @hdd_ht_cap: HT capabilities of kernel type |
| 385 | * @roam_ht_cap: HT capabilities maintained locally within driver |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 386 | * |
| 387 | * Return: None |
| 388 | */ |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 389 | void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap, |
| 390 | tDot11fIEHTCaps *roam_ht_cap) |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 391 | { |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 392 | uint32_t i, temp_ht_cap; |
| 393 | |
| 394 | vos_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 395 | |
| 396 | if (roam_ht_cap->advCodingCap) |
| 397 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 398 | if (roam_ht_cap->supportedChannelWidthSet) |
| 399 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 400 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 401 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 402 | if (temp_ht_cap) |
| 403 | hdd_ht_cap->cap_info |= |
| 404 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 405 | if (roam_ht_cap->greenField) |
| 406 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 407 | if (roam_ht_cap->shortGI20MHz) |
| 408 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 409 | if (roam_ht_cap->shortGI40MHz) |
| 410 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 411 | if (roam_ht_cap->txSTBC) |
| 412 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 413 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 414 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 415 | if (temp_ht_cap) |
| 416 | hdd_ht_cap->cap_info |= |
| 417 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 418 | if (roam_ht_cap->delayedBA) |
| 419 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 420 | if (roam_ht_cap->maximalAMSDUsize) |
| 421 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 422 | if (roam_ht_cap->dsssCckMode40MHz) |
| 423 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 424 | if (roam_ht_cap->psmp) |
| 425 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 426 | if (roam_ht_cap->stbcControlFrame) |
| 427 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 428 | if (roam_ht_cap->lsigTXOPProtection) |
| 429 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 430 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 431 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 432 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 433 | hdd_ht_cap->ampdu_params_info |= |
| 434 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 435 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 436 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 437 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 438 | if (temp_ht_cap) |
| 439 | hdd_ht_cap->ampdu_params_info |= |
| 440 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 441 | |
| 442 | /* 802.11n HT extended capabilities masks */ |
| 443 | if (roam_ht_cap->pco) |
| 444 | hdd_ht_cap->extended_ht_cap_info |= |
| 445 | IEEE80211_HT_EXT_CAP_PCO; |
| 446 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 447 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 448 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 449 | if (temp_ht_cap) |
| 450 | hdd_ht_cap->extended_ht_cap_info |= |
| 451 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 452 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 453 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 454 | if (temp_ht_cap) |
| 455 | hdd_ht_cap->extended_ht_cap_info |= |
| 456 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 457 | |
| 458 | /* tx_bf_cap_info capabilities */ |
| 459 | if (roam_ht_cap->txBF) |
| 460 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 461 | if (roam_ht_cap->rxStaggeredSounding) |
| 462 | hdd_ht_cap->tx_BF_cap_info |= |
| 463 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 464 | if (roam_ht_cap->txStaggeredSounding) |
| 465 | hdd_ht_cap->tx_BF_cap_info |= |
| 466 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 467 | if (roam_ht_cap->rxZLF) |
| 468 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 469 | if (roam_ht_cap->txZLF) |
| 470 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 471 | if (roam_ht_cap->implicitTxBF) |
| 472 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 473 | temp_ht_cap = roam_ht_cap->calibration & |
| 474 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 475 | if (temp_ht_cap) |
| 476 | hdd_ht_cap->tx_BF_cap_info |= |
| 477 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 478 | if (roam_ht_cap->explicitCSITxBF) |
| 479 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 480 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 481 | hdd_ht_cap->tx_BF_cap_info |= |
| 482 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 483 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 484 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 485 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 486 | if (temp_ht_cap) |
| 487 | hdd_ht_cap->tx_BF_cap_info |= |
| 488 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 489 | temp_ht_cap = |
| 490 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 491 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 492 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 493 | if (temp_ht_cap) |
| 494 | hdd_ht_cap->tx_BF_cap_info |= |
| 495 | temp_ht_cap << |
| 496 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 497 | temp_ht_cap = |
| 498 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 499 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 500 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 501 | if (temp_ht_cap) |
| 502 | hdd_ht_cap->tx_BF_cap_info |= |
| 503 | temp_ht_cap << |
| 504 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 505 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 506 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 507 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 508 | if (temp_ht_cap) |
| 509 | hdd_ht_cap->tx_BF_cap_info |= |
| 510 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 511 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 512 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 513 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 514 | if (temp_ht_cap) |
| 515 | hdd_ht_cap->tx_BF_cap_info |= |
| 516 | temp_ht_cap << |
| 517 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 518 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 519 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 520 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 521 | if (temp_ht_cap) |
| 522 | hdd_ht_cap->tx_BF_cap_info |= |
| 523 | temp_ht_cap << |
| 524 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 525 | |
| 526 | /* antenna selection */ |
| 527 | if (roam_ht_cap->antennaSelection) |
| 528 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 529 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 530 | hdd_ht_cap->antenna_selection_info |= |
| 531 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 532 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 533 | hdd_ht_cap->antenna_selection_info |= |
| 534 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 535 | if (roam_ht_cap->explicitCSIFeedback) |
| 536 | hdd_ht_cap->antenna_selection_info |= |
| 537 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 538 | if (roam_ht_cap->antennaIndicesFeedback) |
| 539 | hdd_ht_cap->antenna_selection_info |= |
| 540 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 541 | if (roam_ht_cap->rxAS) |
| 542 | hdd_ht_cap->antenna_selection_info |= |
| 543 | ANTENNA_SEL_INFO_RX_AS; |
| 544 | if (roam_ht_cap->txSoundingPPDUs) |
| 545 | hdd_ht_cap->antenna_selection_info |= |
| 546 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 547 | |
| 548 | /* mcs data rate */ |
| 549 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 550 | hdd_ht_cap->mcs.rx_mask[i] = |
| 551 | roam_ht_cap->supportedMCSSet[i]; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 552 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 553 | hdd_ht_cap->mcs.rx_highest = |
| 554 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 555 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
| 556 | hdd_ht_cap->mcs.tx_params = |
| 557 | roam_ht_cap->supportedMCSSet[12]; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 558 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 559 | } |
| 560 | |
| 561 | |
| 562 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 563 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 564 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 565 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 566 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 567 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 568 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 569 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 570 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 571 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 572 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 573 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 574 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 575 | |
| 576 | /** |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 577 | * hdd_copy_vht_caps()- Populate kernel VHT caps structure object |
| 578 | * @hdd_ht_cap: VHT capabilities of kernel type |
| 579 | * @roam_ht_cap: VHT capabilities maintained locally within driver |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 580 | * |
| 581 | * Return: None |
| 582 | */ |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 583 | void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap, |
| 584 | tDot11fIEVHTCaps *roam_vht_cap) |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 585 | { |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 586 | uint32_t temp_vht_cap; |
| 587 | |
| 588 | vos_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 589 | |
| 590 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 591 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 592 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 593 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 594 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
| 595 | if (temp_vht_cap) |
| 596 | if (roam_vht_cap->supportedChannelWidthSet & |
| 597 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 598 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 599 | hdd_vht_cap->vht_cap_info |= |
| 600 | temp_vht_cap << |
| 601 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 602 | if (roam_vht_cap->supportedChannelWidthSet & |
| 603 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 604 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 605 | hdd_vht_cap->vht_cap_info |= |
| 606 | temp_vht_cap << |
| 607 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
| 608 | if (roam_vht_cap->ldpcCodingCap) |
| 609 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 610 | if (roam_vht_cap->shortGI80MHz) |
| 611 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 612 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 613 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 614 | if (roam_vht_cap->txSTBC) |
| 615 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 616 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 617 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 618 | if (temp_vht_cap) |
| 619 | hdd_vht_cap->vht_cap_info |= |
| 620 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 621 | if (roam_vht_cap->suBeamFormerCap) |
| 622 | hdd_vht_cap->vht_cap_info |= |
| 623 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 624 | if (roam_vht_cap->suBeamformeeCap) |
| 625 | hdd_vht_cap->vht_cap_info |= |
| 626 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 627 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 628 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 629 | if (temp_vht_cap) |
| 630 | hdd_vht_cap->vht_cap_info |= |
| 631 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 632 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 633 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 634 | if (temp_vht_cap) |
| 635 | hdd_vht_cap->vht_cap_info |= |
| 636 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 637 | if (roam_vht_cap->muBeamformerCap) |
| 638 | hdd_vht_cap->vht_cap_info |= |
| 639 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 640 | if (roam_vht_cap->muBeamformeeCap) |
| 641 | hdd_vht_cap->vht_cap_info |= |
| 642 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 643 | if (roam_vht_cap->vhtTXOPPS) |
| 644 | hdd_vht_cap->vht_cap_info |= |
| 645 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 646 | if (roam_vht_cap->htcVHTCap) |
| 647 | hdd_vht_cap->vht_cap_info |= |
| 648 | IEEE80211_VHT_CAP_HTC_VHT; |
| 649 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 650 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 651 | if (temp_vht_cap) |
| 652 | hdd_vht_cap->vht_cap_info |= |
| 653 | temp_vht_cap << |
| 654 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 655 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 656 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 657 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 658 | if (temp_vht_cap) |
| 659 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 660 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 661 | if (roam_vht_cap->rxAntPattern) |
| 662 | hdd_vht_cap->vht_cap_info |= |
| 663 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 664 | if (roam_vht_cap->txAntPattern) |
| 665 | hdd_vht_cap->vht_cap_info |= |
| 666 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 667 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 668 | hdd_vht_cap->supp_mcs.rx_highest = |
| 669 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 670 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 671 | hdd_vht_cap->supp_mcs.tx_highest = |
| 672 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 673 | } |
| 674 | |
| 675 | /* ht param */ |
| 676 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 677 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 678 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 679 | |
| 680 | /* operatinon mode */ |
| 681 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 682 | |
| 683 | /* stbc_param */ |
| 684 | #define HT_STBC_PARAM_MCS 0x007f |
| 685 | |
| 686 | /** |
| 687 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 688 | * hdd station context. |
| 689 | * @hdd_sta_ctx: pointer to hdd station context |
| 690 | * @roam_info: pointer to roam info |
| 691 | * |
| 692 | * Return: None |
| 693 | */ |
| 694 | static void hdd_copy_ht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 695 | tCsrRoamInfo *roam_info) |
| 696 | { |
| 697 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 698 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 699 | &hdd_sta_ctx->conn_info.ht_operation; |
| 700 | uint32_t i, temp_ht_ops; |
| 701 | |
| 702 | vos_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 703 | |
| 704 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 705 | |
| 706 | /* HT_PARAMS */ |
| 707 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 708 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 709 | if (temp_ht_ops) |
| 710 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 711 | else |
| 712 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 713 | if (roam_ht_ops->recommendedTxWidthSet) |
| 714 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 715 | if (roam_ht_ops->rifsMode) |
| 716 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 717 | if (roam_ht_ops->controlledAccessOnly) |
| 718 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 719 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 720 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 721 | if (temp_ht_ops) |
| 722 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 723 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 724 | |
| 725 | /* operation mode */ |
| 726 | temp_ht_ops = roam_ht_ops->opMode & |
| 727 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 728 | switch (temp_ht_ops) { |
| 729 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 730 | hdd_ht_ops->operation_mode |= |
| 731 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 732 | break; |
| 733 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 734 | hdd_ht_ops->operation_mode |= |
| 735 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 736 | break; |
| 737 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 738 | hdd_ht_ops->operation_mode |= |
| 739 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 740 | break; |
| 741 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 742 | default: |
| 743 | hdd_ht_ops->operation_mode |= |
| 744 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 745 | } |
| 746 | if (roam_ht_ops->nonGFDevicesPresent) |
| 747 | hdd_ht_ops->operation_mode |= |
| 748 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 749 | if (roam_ht_ops->transmitBurstLimit) |
| 750 | hdd_ht_ops->operation_mode |= |
| 751 | HT_OP_MODE_TX_BURST_LIMIT; |
| 752 | if (roam_ht_ops->obssNonHTStaPresent) |
| 753 | hdd_ht_ops->operation_mode |= |
| 754 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 755 | |
| 756 | /* stbc_param */ |
| 757 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 758 | HT_STBC_PARAM_MCS; |
| 759 | if (temp_ht_ops) |
| 760 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 761 | if (roam_ht_ops->dualCTSProtection) |
| 762 | hdd_ht_ops->stbc_param |= |
| 763 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 764 | if (roam_ht_ops->secondaryBeacon) |
| 765 | hdd_ht_ops->stbc_param |= |
| 766 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 767 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 768 | hdd_ht_ops->stbc_param |= |
| 769 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 770 | if (roam_ht_ops->pcoActive) |
| 771 | hdd_ht_ops->stbc_param |= |
| 772 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 773 | if (roam_ht_ops->pcoPhase) |
| 774 | hdd_ht_ops->stbc_param |= |
| 775 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 776 | |
| 777 | /* basic MCs set */ |
| 778 | for (i = 0; i < 16; ++i) |
| 779 | hdd_ht_ops->basic_set[i] = |
| 780 | roam_ht_ops->basicMCSSet[i]; |
| 781 | } |
| 782 | |
| 783 | /** |
| 784 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 785 | * hdd station context. |
| 786 | * @hdd_sta_ctx: pointer to hdd station context |
| 787 | * @roam_info: pointer to roam info |
| 788 | * |
| 789 | * Return: None |
| 790 | */ |
| 791 | static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 792 | tCsrRoamInfo *roam_info) |
| 793 | { |
| 794 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 795 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 796 | &hdd_sta_ctx->conn_info.vht_operation; |
| 797 | |
| 798 | vos_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 799 | |
| 800 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
| 801 | hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1; |
| 802 | hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2; |
| 803 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 804 | } |
| 805 | |
| 806 | |
| 807 | /** |
| 808 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 809 | * @adapter: Pointer to adapter |
| 810 | * @roam_info: pointer to roam info |
| 811 | * |
| 812 | * Return: None |
| 813 | */ |
| 814 | static void hdd_save_bss_info(hdd_adapter_t *adapter, |
| 815 | tCsrRoamInfo *roam_info) |
| 816 | { |
| 817 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 818 | |
| 819 | hdd_sta_ctx->conn_info.freq = vos_chan_to_freq( |
| 820 | hdd_sta_ctx->conn_info.operationChannel); |
| 821 | if (roam_info->vht_caps.present) { |
| 822 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 823 | hdd_copy_vht_caps(&hdd_sta_ctx->conn_info.vht_caps, |
| 824 | &roam_info->vht_caps); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 825 | } else { |
| 826 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 827 | } |
| 828 | if (roam_info->ht_caps.present) { |
| 829 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 830 | 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] | 831 | } else { |
| 832 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 833 | } |
| 834 | if (roam_info->reassoc) |
| 835 | hdd_sta_ctx->conn_info.roam_count++; |
| 836 | if (roam_info->hs20vendor_ie.present) { |
| 837 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 838 | vos_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 839 | &roam_info->hs20vendor_ie, |
| 840 | sizeof(roam_info->hs20vendor_ie)); |
| 841 | } else { |
| 842 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 843 | } |
| 844 | if (roam_info->ht_operation.present) { |
| 845 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 846 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 847 | } else { |
| 848 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 849 | } |
| 850 | if (roam_info->vht_operation.present) { |
| 851 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 852 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 853 | } else { |
| 854 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 855 | } |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 856 | /* Cache last connection info */ |
| 857 | vos_mem_copy(&hdd_sta_ctx->cache_conn_info, &hdd_sta_ctx->conn_info, |
| 858 | sizeof(connection_info_t)); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 859 | } |
| 860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 861 | void hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType ) |
| 862 | { |
| 863 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 864 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 865 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | VOS_ASSERT( pRoamInfo ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 867 | |
| 868 | if ( pRoamInfo ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 869 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 870 | // Save the BSSID for the connection... |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 871 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType ) |
| 872 | { |
| 873 | VOS_ASSERT( pRoamInfo->pBssDesc ); |
| 874 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,6 ); |
| 875 | |
| 876 | // Save the Station ID for this station from the 'Roam Info'. |
| 877 | //For IBSS mode, staId is assigned in NEW_PEER_IND |
| 878 | //For reassoc, the staID doesn't change and it may be invalid in this structure |
| 879 | //so no change here. |
| 880 | if( !pRoamInfo->fReassocReq ) |
| 881 | { |
| 882 | pHddStaCtx->conn_info.staId [0]= pRoamInfo->staId; |
| 883 | } |
| 884 | } |
| 885 | else if ( eCSR_BSS_TYPE_IBSS == eBssType ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 886 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 887 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,sizeof(pRoamInfo->bssid) ); |
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 | else |
| 890 | { |
| 891 | // can't happen. We need a valid IBSS or Infra setting in the BSSDescription |
| 892 | // or we can't function. |
| 893 | VOS_ASSERT( 0 ); |
| 894 | } |
| 895 | |
| 896 | // notify WMM |
| 897 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 898 | |
| 899 | if( !pRoamInfo->u.pConnectedProfile ) |
| 900 | { |
| 901 | VOS_ASSERT( pRoamInfo->u.pConnectedProfile ); |
| 902 | } |
| 903 | else |
| 904 | { |
| 905 | // Get Multicast Encryption Type |
| 906 | encryptType = pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 907 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 908 | // Get Unicast Encrytion Type |
| 909 | encryptType = pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 910 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 911 | |
| 912 | pHddStaCtx->conn_info.authType = pRoamInfo->u.pConnectedProfile->AuthType; |
| 913 | |
| 914 | pHddStaCtx->conn_info.operationChannel = pRoamInfo->u.pConnectedProfile->operationChannel; |
| 915 | |
| 916 | // Save the ssid for the connection |
| 917 | 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] | 918 | |
| 919 | // Save dot11mode in which STA associated to AP |
| 920 | pHddStaCtx->conn_info.dot11Mode = pRoamInfo->u.pConnectedProfile->dot11Mode; |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 921 | |
| 922 | pHddStaCtx->conn_info.rate_flags = pRoamInfo->maxRateFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 923 | } |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 924 | hdd_save_bss_info(pAdapter, pRoamInfo); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 925 | } |
| 926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 927 | // save the connected BssType |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 928 | hdd_connSaveConnectedBssType( pHddStaCtx, eBssType ); |
| 929 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 930 | } |
| 931 | |
| 932 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 933 | /* |
| 934 | * Send the 11R key information to the supplicant. |
| 935 | * Only then can the supplicant generate the PMK-R1. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 936 | * (BTW, the ESE supplicant also needs the Assoc Resp IEs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 937 | * for the same purpose.) |
| 938 | * |
| 939 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA |
| 940 | * this contains the R1KHID, R0KHID and the MDID. |
| 941 | * For FT, this consists of the Reassoc Rsp FTIEs. |
| 942 | * This is the Assoc Response. |
| 943 | */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 944 | static void hdd_SendFTAssocResponse(struct net_device *dev, hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 945 | tCsrRoamInfo *pCsrRoamInfo) |
| 946 | { |
| 947 | union iwreq_data wrqu; |
| 948 | char *buff; |
| 949 | unsigned int len = 0; |
| 950 | u8 *pFTAssocRsp = NULL; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 951 | |
| 952 | if (pCsrRoamInfo->nAssocRspLength == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 953 | { |
| 954 | hddLog(LOGE, |
| 955 | "%s: pCsrRoamInfo->nAssocRspLength=%d", |
| 956 | __func__, (int)pCsrRoamInfo->nAssocRspLength); |
| 957 | return; |
| 958 | } |
| 959 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 960 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 961 | pCsrRoamInfo->nAssocReqLength); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 962 | if (pFTAssocRsp == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 963 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 964 | hddLog(LOGE, "%s: AssocReq or AssocRsp is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 965 | return; |
| 966 | } |
| 967 | |
| 968 | // pFTAssocRsp needs to point to the IEs |
| 969 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 970 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 971 | (unsigned int)pFTAssocRsp[0], |
| 972 | (unsigned int)pFTAssocRsp[1]); |
| 973 | |
| 974 | // We need to send the IEs to the supplicant. |
| 975 | buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 976 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 977 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 978 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 979 | return; |
| 980 | } |
| 981 | |
| 982 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
| 983 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 984 | wrqu.data.length = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 985 | memset(buff, 0, IW_GENERIC_IE_MAX); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 986 | memcpy(buff, pFTAssocRsp, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 987 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 988 | |
| 989 | kfree(buff); |
| 990 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 991 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 992 | |
| 993 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 994 | |
| 995 | /*--------------------------------------------------- |
| 996 | * |
| 997 | * Send the FTIEs, RIC IEs during FT. This is eventually |
| 998 | * used to send the FT events to the supplicant |
| 999 | * |
| 1000 | * At the reception of Auth2 we send the RIC followed |
| 1001 | * by the auth response IEs to the supplicant. |
| 1002 | * Once both are received in the supplicant, an FT |
| 1003 | * event is generated to the supplicant. |
| 1004 | * |
| 1005 | *--------------------------------------------------- |
| 1006 | */ |
| 1007 | void hdd_SendFTEvent(hdd_adapter_t *pAdapter) |
| 1008 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1009 | tANI_U16 auth_resp_len = 0; |
| 1010 | tANI_U32 ric_ies_length = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1011 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1012 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 1013 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1014 | struct cfg80211_ft_event_params ftEvent; |
| 1015 | v_U8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 1016 | v_U8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 1017 | struct net_device *dev = pAdapter->dev; |
| 1018 | #else |
| 1019 | char *buff; |
| 1020 | union iwreq_data wrqu; |
| 1021 | tANI_U16 str_len; |
| 1022 | #endif |
| 1023 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 1024 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1025 | vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1026 | vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1027 | |
Kanchanapally, Vidyullatha | 31b8d14 | 2015-01-30 14:25:18 +0530 | [diff] [blame] | 1028 | sme_GetRICIEs(pHddCtx->hHal, (u8 *)ricIe, |
| 1029 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1030 | if (ric_ies_length == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1031 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1032 | hddLog(LOGW, |
| 1033 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 1034 | __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1035 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1036 | |
| 1037 | ftEvent.ric_ies = ricIe; |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1038 | ftEvent.ric_ies_len = ric_ies_length; |
| 1039 | 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] | 1040 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1041 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1042 | DOT11F_IE_FTINFO_MAX_LEN, &auth_resp_len); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1043 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1044 | if (auth_resp_len == 0) |
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 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1047 | return; |
| 1048 | } |
| 1049 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1050 | sme_SetFTPreAuthState(pHddCtx->hHal, TRUE); |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 1051 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1052 | ftEvent.target_ap = ftIe; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1053 | |
| 1054 | ftEvent.ies = (u8 *)(ftIe + SIR_MAC_ADDR_LENGTH); |
| 1055 | ftEvent.ies_len = auth_resp_len - SIR_MAC_ADDR_LENGTH; |
| 1056 | |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 1057 | hddLog(LOG1, "%s ftEvent.ies_len %zu", __FUNCTION__, ftEvent.ies_len); |
| 1058 | hddLog(LOG1, "%s ftEvent.ric_ies_len %zu", |
| 1059 | __FUNCTION__, ftEvent.ric_ies_len ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1060 | 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] | 1061 | __FUNCTION__, ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1062 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1063 | ftEvent.target_ap[5]); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1064 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 1065 | (void)cfg80211_ft_event(dev, &ftEvent); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1066 | |
| 1067 | #else |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1068 | // We need to send the IEs to the supplicant |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1070 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1072 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1073 | return; |
| 1074 | } |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1075 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1076 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1077 | // Sme needs to send the RIC IEs first |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1078 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1079 | sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]), |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1080 | (IW_CUSTOM_MAX - str_len), &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1081 | if (ric_ies_length == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1082 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1083 | hddLog(LOGW, |
| 1084 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 1085 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1086 | } |
| 1087 | else |
| 1088 | { |
| 1089 | wrqu.data.length = str_len + ric_ies_length; |
| 1090 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1091 | } |
| 1092 | |
| 1093 | // Sme needs to provide the Auth Resp |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1094 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1095 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1096 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len], |
| 1097 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1098 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1099 | if (auth_resp_len == 0) |
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 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Bhargav Shah | 8b5b2f7 | 2015-07-14 11:53:46 +0530 | [diff] [blame] | 1102 | kfree(buff); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1103 | return; |
| 1104 | } |
| 1105 | |
| 1106 | wrqu.data.length = str_len + auth_resp_len; |
| 1107 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1108 | |
| 1109 | kfree(buff); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1110 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1111 | } |
| 1112 | |
| 1113 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 1114 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1115 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1116 | |
| 1117 | /* |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1118 | * Send the ESE required "new AP Channel info" to the supplicant. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1119 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1120 | * |
| 1121 | * The current (new AP) channel information is passed in. |
| 1122 | */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1123 | static void hdd_SendNewAPChannelInfo(struct net_device *dev, hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1124 | tCsrRoamInfo *pCsrRoamInfo) |
| 1125 | { |
| 1126 | union iwreq_data wrqu; |
| 1127 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1128 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1129 | |
| 1130 | if (descriptor == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1131 | { |
| 1132 | hddLog(LOGE, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 1133 | "%s: pCsrRoamInfo->pBssDesc=%pK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1134 | __func__, descriptor); |
| 1135 | return; |
| 1136 | } |
| 1137 | |
| 1138 | // 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] | 1139 | hddLog(LOGW, "%s: Sending up an SIOCGIWFREQ, channelId=%d", __func__, descriptor->channelId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1140 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1141 | wrqu.freq.m = descriptor->channelId; |
| 1142 | wrqu.freq.e = 0; |
| 1143 | wrqu.freq.i = 0; |
| 1144 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1145 | } |
| 1146 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1147 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1148 | |
| 1149 | void hdd_SendUpdateBeaconIEsEvent(hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo) |
| 1150 | { |
| 1151 | union iwreq_data wrqu; |
| 1152 | u8 *pBeaconIes; |
| 1153 | u8 currentLen = 0; |
| 1154 | char *buff; |
| 1155 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1156 | |
| 1157 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1158 | |
| 1159 | if (0 == pCsrRoamInfo->nBeaconLength) |
| 1160 | { |
| 1161 | hddLog(LOGE, "%s: pCsrRoamInfo->nBeaconFrameLength = 0", __func__); |
| 1162 | return; |
| 1163 | } |
| 1164 | pBeaconIes = (u8 *)(pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1165 | if (pBeaconIes == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1166 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1167 | hddLog(LOGE, "%s: Beacon IEs is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1168 | return; |
| 1169 | } |
| 1170 | |
| 1171 | // pBeaconIes needs to point to the IEs |
| 1172 | hddLog(LOG1, "%s: Beacon IEs is now at %02x%02x", __func__, |
| 1173 | (unsigned int)pBeaconIes[0], |
| 1174 | (unsigned int)pBeaconIes[1]); |
| 1175 | 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] | 1176 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1177 | // We need to send the IEs to the supplicant. |
| 1178 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1179 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1180 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1181 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1182 | return; |
| 1183 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1184 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1185 | |
| 1186 | strLen = strlcpy(buff,"BEACONIEs=", IW_CUSTOM_MAX); |
| 1187 | currentLen = strLen + 1; |
| 1188 | |
| 1189 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1190 | do |
| 1191 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1192 | /* 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] | 1193 | * max size and send it to supplicant. Changes are done in supplicant to handle this */ |
| 1194 | vos_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
| 1195 | currentLen = VOS_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
| 1196 | vos_mem_copy(&buff[strLen + 1], pBeaconIes+currentOffset, currentLen); |
| 1197 | currentOffset += currentLen; |
| 1198 | totalIeLen -= currentLen; |
| 1199 | wrqu.data.length = strLen + 1 + currentLen; |
| 1200 | if (totalIeLen) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1201 | buff[strLen] = 1; // This tells supplicant more chunks are pending |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1202 | else |
| 1203 | buff[strLen] = 0; // For last chunk of beacon IE to supplicant |
| 1204 | |
| 1205 | hddLog(LOG1, "%s: Beacon IEs length to supplicant = %d", __func__, currentLen); |
| 1206 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1207 | } while (totalIeLen > 0); |
| 1208 | |
| 1209 | kfree(buff); |
| 1210 | } |
| 1211 | |
| 1212 | static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRoamInfo) |
| 1213 | { |
| 1214 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1215 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1216 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1217 | union iwreq_data wrqu; |
| 1218 | int we_event; |
| 1219 | char *msg; |
| 1220 | int type = -1; |
| 1221 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1222 | #if defined (WLAN_FEATURE_VOWIFI_11R) |
| 1223 | // Added to find the auth type on the fly at run time |
| 1224 | // rather than with cfg to see if FT is enabled |
| 1225 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1226 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 1227 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1228 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1229 | memset(&wrqu, '\0', sizeof(wrqu)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1230 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1231 | we_event = SIOCGIWAP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1232 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1233 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
| 1234 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1235 | /* In case of roaming ; We are not doing disconnect. |
| 1236 | * If disconnect is not being done for roam; We will not |
| 1237 | * decrease count for Active sessions. We should not increase active |
| 1238 | * active session in case of roaming. |
| 1239 | */ |
Padma, Santhosh Kumar | 87ba40f | 2014-11-26 19:40:15 +0530 | [diff] [blame] | 1240 | if((pHddStaCtx->ft_carrier_on == FALSE) && !pCsrRoamInfo->fReassocReq) |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1241 | { |
| 1242 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
| 1243 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1244 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1245 | type = WLAN_STA_ASSOC_DONE_IND; |
| 1246 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 1247 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 1248 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1249 | { |
| 1250 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_1) |
| 1251 | { |
| 1252 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTED_STATE_1; |
| 1253 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 1254 | "Connecting state to Connected State for 8-way " |
| 1255 | "Handshake"); |
| 1256 | } |
| 1257 | else if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_2) |
| 1258 | { |
| 1259 | globalP2PConnectionStatus = P2P_CLIENT_COMPLETED_STATE; |
| 1260 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 1261 | "Connecting state to P2P Client Connection Completed"); |
| 1262 | } |
| 1263 | } |
| 1264 | #endif |
Yeshwanth Sriram Guntuka | 0004c0b | 2017-12-06 14:43:49 +0530 | [diff] [blame] | 1265 | hddLog(VOS_TRACE_LEVEL_ERROR, MAC_ADDRESS_STR " connected to " |
| 1266 | MAC_ADDRESS_STR, |
| 1267 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1268 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1269 | hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo); |
| 1270 | |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1271 | hdd_manage_delack_timer(pHddCtx); |
| 1272 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1273 | /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or |
| 1274 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled |
| 1275 | * and fFTEnable is TRUE */ |
| 1276 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1277 | // Send FT Keys to the supplicant when FT is enabled |
| 1278 | if ((pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN_PSK) || |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1279 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1280 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1281 | || (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1282 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) |
| 1283 | #endif |
| 1284 | ) |
| 1285 | { |
| 1286 | hdd_SendFTAssocResponse(dev, pAdapter, pCsrRoamInfo); |
| 1287 | } |
| 1288 | #endif |
| 1289 | } |
| 1290 | else if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) // IBss Associated |
| 1291 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1292 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 1293 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1294 | type = WLAN_STA_ASSOC_DONE_IND; |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 1295 | |
| 1296 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1297 | "wlan: new IBSS connection to " MAC_ADDRESS_STR, |
| 1298 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1299 | } |
| 1300 | else /* Not Associated */ |
| 1301 | { |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 1302 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1303 | "wlan: disconnected"); |
gaurank kathpalia | 5180158 | 2019-04-05 13:56:55 +0530 | [diff] [blame] | 1304 | if (pHddCtx->btCoexModeSet) { |
| 1305 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1306 | FL("Wlan disconnected, sending DHCP stop indication")); |
| 1307 | pHddCtx->btCoexModeSet = FALSE; |
| 1308 | sme_DHCPStopInd(pHddCtx->hHal, pAdapter->device_mode, |
| 1309 | pAdapter->sessionId); |
| 1310 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1311 | type = WLAN_STA_DISASSOC_DONE_IND; |
| 1312 | memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN); |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1313 | |
| 1314 | hdd_manage_delack_timer(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1315 | } |
Sudhir Sattayappa Kohalli | 90e4c75 | 2013-03-21 14:25:04 -0700 | [diff] [blame] | 1316 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1317 | |
| 1318 | msg = NULL; |
| 1319 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 1320 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 1321 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1322 | { |
| 1323 | wireless_send_event(dev, we_event, &wrqu, msg); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1324 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1325 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1326 | { |
| 1327 | if ( (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1328 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1329 | hdd_SendNewAPChannelInfo(dev, pAdapter, pCsrRoamInfo); |
| 1330 | } |
| 1331 | #endif |
| 1332 | } |
| 1333 | send_btc_nlink_msg(type, 0); |
| 1334 | } |
| 1335 | |
| 1336 | void hdd_connRemoveConnectInfo( hdd_station_ctx_t *pHddStaCtx ) |
| 1337 | { |
| 1338 | // Remove staId, bssId and peerMacAddress |
| 1339 | pHddStaCtx->conn_info.staId [ 0 ] = 0; |
| 1340 | vos_mem_zero( &pHddStaCtx->conn_info.bssId, sizeof( v_MACADDR_t ) ); |
| 1341 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], sizeof( v_MACADDR_t ) ); |
| 1342 | |
| 1343 | // Clear all security settings |
| 1344 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1345 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1346 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1347 | |
| 1348 | vos_mem_zero( &pHddStaCtx->conn_info.Keys, sizeof( tCsrKeys ) ); |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 1349 | vos_mem_zero( &pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1350 | |
| 1351 | // Set not-connected state |
| 1352 | pHddStaCtx->conn_info.connDot11DesiredBssType = eCSR_BSS_TYPE_ANY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1353 | |
| 1354 | vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) ); |
| 1355 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1356 | |
| 1357 | VOS_STATUS hdd_ibss_deinit_tx_rx_sta ( hdd_adapter_t *pAdapter, v_U8_t STAId ) |
| 1358 | { |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1359 | v_U8_t ac; |
| 1360 | /**Track whether OS TX queue has been disabled.*/ |
| 1361 | v_BOOL_t txSuspended[NUM_TX_QUEUES]; |
| 1362 | v_U8_t tlAC; |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1363 | v_U8_t i; |
| 1364 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1365 | hdd_ibss_peer_info_t *pPeerInfo; |
| 1366 | |
| 1367 | if( NULL == pHddStaCtx ) |
| 1368 | { |
| 1369 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1370 | "%s: HDD station context NULL ",__func__); |
| 1371 | return VOS_STATUS_E_FAILURE; |
| 1372 | } |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1373 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1374 | pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1375 | if (FALSE == pPeerInfo->ibssStaInfo[STAId].isUsed) |
| 1376 | { |
| 1377 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1378 | "%s: Deinit station not inited %d", __func__, STAId ); |
| 1379 | return VOS_STATUS_E_FAILURE; |
| 1380 | } |
| 1381 | |
| 1382 | hdd_flush_ibss_tx_queues(pAdapter, STAId); |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1383 | |
| 1384 | for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++) |
| 1385 | { |
| 1386 | tlAC = hdd_QdiscAcToTlAC[ac]; |
| 1387 | txSuspended[ac] = pPeerInfo->ibssStaInfo[STAId].txSuspended[tlAC]; |
| 1388 | } |
| 1389 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1390 | vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t)); |
| 1391 | |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1392 | /* re-init hdd list, since netdev can still open adapter until |
| 1393 | * driver gets unloaded |
| 1394 | */ |
| 1395 | for (i = 0; i < NUM_TX_QUEUES; i ++) |
| 1396 | { |
| 1397 | hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], |
| 1398 | HDD_TX_QUEUE_MAX_LEN); |
| 1399 | } |
| 1400 | |
| 1401 | for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++) |
| 1402 | { |
| 1403 | if (txSuspended[ac]) |
| 1404 | { |
| 1405 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1406 | "%s: TX queue re-enabled", __func__); |
| 1407 | netif_wake_subqueue(pAdapter->dev, ac); |
| 1408 | } |
| 1409 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1410 | return VOS_STATUS_SUCCESS; |
| 1411 | } |
| 1412 | |
| 1413 | static VOS_STATUS hdd_ibss_DeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 1414 | { |
| 1415 | VOS_STATUS vosStatus; |
| 1416 | |
| 1417 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 1418 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1419 | { |
| 1420 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1421 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
| 1422 | "Status= %d [0x%08X]", |
| 1423 | __func__, staId, vosStatus, vosStatus ); |
| 1424 | } |
| 1425 | |
| 1426 | vosStatus = hdd_ibss_deinit_tx_rx_sta ( pAdapter, staId ); |
| 1427 | if( VOS_STATUS_E_FAILURE == vosStatus ) |
| 1428 | { |
| 1429 | VOS_TRACE ( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1430 | "hdd_ibss_deinit_tx_rx_sta() failed for staID %d. " |
| 1431 | "Status = %d [0x%08X]", |
| 1432 | staId, vosStatus, vosStatus ); |
| 1433 | } |
| 1434 | |
| 1435 | return( vosStatus ); |
| 1436 | } |
| 1437 | |
| 1438 | VOS_STATUS hdd_ibss_init_tx_rx_sta( hdd_adapter_t *pAdapter, v_U8_t STAId, v_MACADDR_t *pmacAddrSTA) |
| 1439 | { |
| 1440 | v_U8_t i = 0; |
| 1441 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1442 | hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1443 | |
| 1444 | if (pPeerInfo->ibssStaInfo[STAId].isUsed) |
| 1445 | { |
| 1446 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1447 | "%s: Reinit station %d", __func__, STAId ); |
| 1448 | return VOS_STATUS_E_FAILURE; |
| 1449 | } |
| 1450 | |
| 1451 | vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t)); |
| 1452 | for (i = 0; i < NUM_TX_QUEUES; i ++) |
| 1453 | { |
| 1454 | hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN); |
| 1455 | } |
| 1456 | |
| 1457 | pPeerInfo->ibssStaInfo[STAId].isUsed = VOS_TRUE; |
| 1458 | pPeerInfo->ibssStaInfo[STAId].isDeauthInProgress = VOS_FALSE; |
| 1459 | vos_copy_macaddr( &pPeerInfo->ibssStaInfo[STAId].macAddrSTA, pmacAddrSTA); |
| 1460 | |
| 1461 | return VOS_STATUS_SUCCESS; |
| 1462 | } |
| 1463 | |
| 1464 | static VOS_STATUS hdd_ibss_RegisterSTA( hdd_adapter_t *pAdapter, |
| 1465 | tCsrRoamInfo *pRoamInfo, |
| 1466 | v_U8_t staId, |
| 1467 | v_MACADDR_t *pPeerMacAddress, |
| 1468 | tSirBssDescription *pBssDesc ) |
| 1469 | { |
| 1470 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 1471 | WLAN_STADescType staDesc = {0}; |
| 1472 | eCsrEncryptionType connectedCipherAlgo; |
| 1473 | v_BOOL_t fConnected; |
| 1474 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1475 | hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1476 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1477 | |
| 1478 | if ( pPeerInfo->ibssStaInfo[staId].isUsed ) |
| 1479 | { |
| 1480 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1481 | "clean up old entry for STA %d", staId); |
| 1482 | hdd_ibss_DeregisterSTA( pAdapter, staId ); |
| 1483 | } |
| 1484 | |
| 1485 | staDesc.ucSTAId = staId; |
| 1486 | staDesc.wSTAType = WLAN_STA_IBSS; |
| 1487 | |
| 1488 | // Note that for IBSS, the STA MAC address and BSSID are goign to be different where |
| 1489 | // in infrastructure, they are the same (BSSID is the MAC address of the AP). So, |
| 1490 | // for IBSS we have a second field to pass to TL in the STA descriptor that we don't |
| 1491 | // pass when making an Infrastructure connection. |
| 1492 | vos_mem_copy(staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes)); |
| 1493 | vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId, 6 ); |
| 1494 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 1495 | |
| 1496 | if (hdd_wmm_is_active(pAdapter)) |
| 1497 | { |
| 1498 | staDesc.ucQosEnabled = 1; |
| 1499 | } |
| 1500 | else |
| 1501 | { |
| 1502 | staDesc.ucQosEnabled = 0; |
| 1503 | } |
| 1504 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1505 | "HDD SOFTAP register TL QoS_enabled=%d", |
| 1506 | staDesc.ucQosEnabled ); |
| 1507 | |
| 1508 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 1509 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 1510 | { |
| 1511 | staDesc.ucProtectedFrame = 1; |
| 1512 | } |
| 1513 | else |
| 1514 | { |
| 1515 | staDesc.ucProtectedFrame = 0; |
| 1516 | |
| 1517 | } |
| 1518 | |
| 1519 | hdd_ibss_init_tx_rx_sta(pAdapter, staId, &staDesc.vSTAMACAddress); |
| 1520 | |
| 1521 | // UMA is Not ready yet, Xlation will be done by TL |
| 1522 | staDesc.ucSwFrameTXXlation = 1; |
| 1523 | staDesc.ucSwFrameRXXlation = 1; |
| 1524 | staDesc.ucAddRmvLLC = 1; |
| 1525 | // Initialize signatures and state |
| 1526 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 1527 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 1528 | staDesc.ucInitState = WLANTL_STA_AUTHENTICATED; |
| 1529 | |
| 1530 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
| 1531 | |
| 1532 | // Register the Station with TL. |
| 1533 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 1534 | hdd_rx_packet_cbk, |
| 1535 | hdd_tx_complete_cbk, |
| 1536 | hdd_ibss_tx_fetch_packet_cbk, &staDesc, |
| 1537 | pBssDesc->rssi ); |
| 1538 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1539 | { |
| 1540 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1541 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", |
| 1542 | vosStatus, vosStatus ); |
| 1543 | return vosStatus; |
| 1544 | } |
| 1545 | |
| 1546 | //Timer value should be in milliseconds |
| 1547 | if ( pHddCtx->cfg_ini->dynSplitscan && |
| 1548 | ( VOS_TIMER_STATE_RUNNING != |
| 1549 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))) |
| 1550 | { |
| 1551 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 1552 | pHddCtx->cfg_ini->trafficMntrTmrForSplitScan); |
| 1553 | } |
| 1554 | |
| 1555 | pPeerInfo->ibssStaInfo[staId].ucSTAId = staId; |
| 1556 | pPeerInfo->ibssStaInfo[staId].isQosEnabled = staDesc.ucQosEnabled; |
| 1557 | |
| 1558 | vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId, |
| 1559 | WLANTL_STA_AUTHENTICATED ); |
| 1560 | |
| 1561 | pPeerInfo->ibssStaInfo[staId].tlSTAState = WLANTL_STA_AUTHENTICATED; |
| 1562 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 1563 | |
| 1564 | return( vosStatus ); |
| 1565 | } |
| 1566 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1567 | /* TODO Revist this function. and data path */ |
| 1568 | static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 1569 | { |
| 1570 | VOS_STATUS vosStatus; |
Ravi Joshi | f9520d6 | 2013-10-18 04:11:46 -0700 | [diff] [blame] | 1571 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1572 | hdd_disconnect_tx_rx(pAdapter); |
Ravi Joshi | f9520d6 | 2013-10-18 04:11:46 -0700 | [diff] [blame] | 1573 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1574 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 1575 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1576 | { |
Gopichand Nakkala | d786fa3 | 2013-03-20 23:48:19 +0530 | [diff] [blame] | 1577 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1578 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1579 | "Status= %d [0x%08X]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1580 | __func__, staId, vosStatus, vosStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1581 | } |
| 1582 | return( vosStatus ); |
| 1583 | } |
| 1584 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 1585 | /** |
| 1586 | * hdd_print_bss_info() - print bss info |
| 1587 | * @hdd_sta_ctx: pointer to hdd station context |
| 1588 | * |
| 1589 | * Return: None |
| 1590 | */ |
| 1591 | void hdd_print_bss_info(hdd_station_ctx_t *hdd_sta_ctx) |
| 1592 | { |
| 1593 | uint32_t *cap_info; |
| 1594 | |
| 1595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"WIFI DATA LOGGER"); |
| 1596 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"channel: %d", |
| 1597 | hdd_sta_ctx->conn_info.freq); |
| 1598 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"dot11mode: %d", |
| 1599 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1600 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"AKM: %d", |
| 1601 | hdd_sta_ctx->conn_info.authType); |
| 1602 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ssid: %.*s", |
| 1603 | hdd_sta_ctx->conn_info.SSID.SSID.length, |
| 1604 | hdd_sta_ctx->conn_info.SSID.SSID.ssId); |
| 1605 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"roam count: %d", |
| 1606 | hdd_sta_ctx->conn_info.roam_count); |
| 1607 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ant_info: %d", |
| 1608 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1609 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate legacy %d", |
| 1610 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1611 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate mcs: %d", |
| 1612 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1613 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1614 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1615 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ht caps: %x", |
| 1616 | *cap_info); |
| 1617 | } |
| 1618 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1619 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1620 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"vht caps: %x", |
| 1621 | *cap_info); |
| 1622 | } |
| 1623 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1624 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"hs20 info: %x", |
| 1625 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1626 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"signal: %d", |
| 1627 | hdd_sta_ctx->conn_info.signal); |
| 1628 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"noise: %d", |
| 1629 | hdd_sta_ctx->conn_info.noise); |
| 1630 | } |
| 1631 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1632 | /** |
| 1633 | * hdd_check_and_move_if_sap_is_on_dfs_chan() - move the sap to non dfs channel |
| 1634 | * @hdd_ctx: pointer to hdd context |
| 1635 | * @sta_adapter: pointer to sta adapater |
| 1636 | * |
| 1637 | * This function is used to check if SAP is operating on DFS channel in stand |
| 1638 | * alone mode and move it to non dfs channel |
| 1639 | * |
| 1640 | * Return: void. |
| 1641 | */ |
| 1642 | static void hdd_check_and_move_if_sap_is_on_dfs_chan(hdd_context_t *hdd_ctx, |
| 1643 | hdd_adapter_t *sta_adapter) |
| 1644 | { |
| 1645 | hdd_adapter_t *sap_adapter; |
| 1646 | ptSapContext sap_ctx; |
| 1647 | v_CONTEXT_t vos_ctx; |
| 1648 | eNVChannelEnabledType chan_state; |
| 1649 | |
| 1650 | if (hdd_is_sta_sap_scc_allowed_on_dfs_chan(hdd_ctx)) { |
| 1651 | sap_adapter = hdd_get_adapter(hdd_ctx, WLAN_HDD_SOFTAP); |
| 1652 | |
| 1653 | if (!sap_adapter) { |
| 1654 | hddLog(LOG1, FL("SAP not exists, nothing to do")); |
| 1655 | return; |
| 1656 | } |
| 1657 | |
| 1658 | vos_ctx = hdd_ctx->pvosContext; |
| 1659 | if (!vos_ctx) { |
| 1660 | hddLog(LOGE, FL("vos_ctx is NULL")); |
| 1661 | return; |
| 1662 | } |
| 1663 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 1664 | if (!sap_ctx) { |
| 1665 | hddLog(LOG1, FL("sap_ctx not exists")); |
| 1666 | return; |
| 1667 | } |
| 1668 | |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1669 | if (sap_ctx->sapsMachine != eSAP_STARTED) { |
| 1670 | hddLog(LOG1, FL("SAP is not in eSAP_STARTED state")); |
| 1671 | return; |
| 1672 | } |
| 1673 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1674 | chan_state = vos_nv_getChannelEnabledState(sap_ctx->channel); |
| 1675 | |
| 1676 | hddLog(LOG1, "SAP is operating on channel (%hu), chan_state %d", |
| 1677 | sap_ctx->channel, chan_state); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1678 | if (vos_nv_getChannelEnabledState(sap_ctx->channel) != |
| 1679 | NV_CHANNEL_DFS) { |
| 1680 | hddLog(LOG1, "SAP is on non DFS channel. nothing to do"); |
| 1681 | return; |
| 1682 | } |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1683 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1684 | hddLog(LOG1, "Schedule workqueue to move the SAP to non DFS channel"); |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1685 | schedule_delayed_work(&hdd_ctx->ecsa_chan_change_work, |
| 1686 | msecs_to_jiffies(ECSA_DFS_CHAN_CHANGE_DEFER_TIME)); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1687 | } |
| 1688 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1689 | |
| 1690 | static eHalStatus hdd_DisConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1691 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 1692 | eCsrRoamResult roamResult ) |
| 1693 | { |
| 1694 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1695 | VOS_STATUS vstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1696 | struct net_device *dev = pAdapter->dev; |
| 1697 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1698 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1699 | v_U8_t sta_id; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1700 | v_BOOL_t sendDisconInd = TRUE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1701 | |
| 1702 | // Sanity check |
| 1703 | if(dev == NULL) |
| 1704 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 1705 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1706 | "%s: net_dev is released return", __func__); |
| 1707 | return eHAL_STATUS_FAILURE; |
| 1708 | } |
| 1709 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1710 | // notify apps that we can't pass traffic anymore |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 1711 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1712 | netif_tx_disable(dev); |
| 1713 | netif_carrier_off(dev); |
Mukul Sharma | 09ab4bd | 2014-11-24 18:07:26 +0530 | [diff] [blame] | 1714 | //TxTimeoutCount need to reset in case of disconnect handler |
| 1715 | pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1716 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 1717 | wlan_hdd_check_and_stop_mon(pAdapter, false); |
| 1718 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1719 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1720 | /* If only STA mode is on */ |
| 1721 | if((pHddCtx->concurrency_mode <= 1) && |
| 1722 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <= 1)) |
| 1723 | { |
| 1724 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 1725 | } |
| 1726 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1727 | /* Need to apply spin lock before decreasing active sessions |
| 1728 | * as there can be chance for double decrement if context switch |
| 1729 | * Calls wlan_hdd_disconnect. |
| 1730 | */ |
| 1731 | |
| 1732 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1733 | |
| 1734 | /* HDD has initiated disconnect, do not send disconnect indication |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1735 | * to kernel. Sending disconnected event to kernel for userspace |
| 1736 | * initiated disconnect will be handled by diconnect handler call |
| 1737 | * to cfg80211_disconnected |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1738 | */ |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1739 | if ((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) || |
Abhishek Singh | d2ce680 | 2018-05-08 15:21:06 +0530 | [diff] [blame] | 1740 | (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) || |
| 1741 | (eConnectionState_Connecting == pHddStaCtx->conn_info.connState)) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1742 | { |
| 1743 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1744 | FL(" HDD has initiated a disconnect, no need to send" |
| 1745 | " disconnect indication to kernel")); |
| 1746 | sendDisconInd = FALSE; |
| 1747 | } |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1748 | else if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1749 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1750 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1751 | FL("Set HDD connState to eConnectionState_Disconnecting from %d "), |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1752 | pHddStaCtx->conn_info.connState); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1753 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 1754 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1755 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1756 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 1757 | vos_flush_delayed_work(&pHddCtx->ecsa_chan_change_work); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1758 | hdd_clearRoamProfileIe( pAdapter ); |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 1759 | |
| 1760 | hdd_wmm_init( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1761 | |
| 1762 | // indicate 'disconnect' status to wpa_supplicant... |
| 1763 | hdd_SendAssociationEvent(dev,pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1764 | /* indicate disconnected event to nl80211 */ |
| 1765 | if(roamStatus != eCSR_ROAM_IBSS_LEAVE) |
| 1766 | { |
| 1767 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 1768 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 1769 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1770 | { |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 1771 | if (sendDisconInd) |
| 1772 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1773 | "%s: sent disconnected event to nl80211", |
| 1774 | __func__); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 1775 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 1776 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1777 | { |
| 1778 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTED_STATE_1) |
| 1779 | { |
| 1780 | globalP2PConnectionStatus = P2P_CLIENT_DISCONNECTED_STATE; |
| 1781 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] 8 way Handshake completed " |
| 1782 | "and moved to disconnected state"); |
| 1783 | } |
| 1784 | else if(globalP2PConnectionStatus == P2P_CLIENT_COMPLETED_STATE) |
| 1785 | { |
| 1786 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 1787 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] P2P Client is removed " |
| 1788 | "and moved to inactive state"); |
| 1789 | } |
| 1790 | } |
| 1791 | #endif |
Sushant Kaushik | bad6189 | 2015-07-10 16:43:28 +0530 | [diff] [blame] | 1792 | if ((roamStatus == eCSR_ROAM_LOSTLINK) && |
| 1793 | !pRoamInfo->reasonCode) |
| 1794 | wlan_hdd_get_frame_logs(pAdapter, |
| 1795 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1796 | /*Only send indication to kernel if not initiated by kernel*/ |
| 1797 | if ( sendDisconInd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1798 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1799 | /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */ |
| 1800 | if ( eCSR_ROAM_LOSTLINK == roamStatus ) |
| 1801 | { |
Mahesh A Saptasagar | 9ff4bcc | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 1802 | wlan_hdd_cfg80211_indicate_disconnect(dev, false, |
| 1803 | pRoamInfo->reasonCode); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1804 | } |
| 1805 | else |
| 1806 | { |
Mahesh A Saptasagar | 9ff4bcc | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 1807 | wlan_hdd_cfg80211_indicate_disconnect(dev, false, |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1808 | WLAN_REASON_UNSPECIFIED); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1809 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1810 | } |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 1811 | |
| 1812 | if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1813 | { |
| 1814 | hddLog(LOG1, |
| 1815 | FL("P2P client is getting removed and we are tryig to re-enable TDLS")); |
| 1816 | wlan_hdd_tdls_reenable(pHddCtx); |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 1817 | } |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 1818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1819 | //If the Device Mode is Station |
| 1820 | // and the P2P Client is Connected |
| 1821 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1822 | |
| 1823 | // 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] | 1824 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Sudhir Sattayappa Kohalli | b1d8c3a | 2013-06-18 14:47:20 -0700 | [diff] [blame] | 1825 | if(VOS_STATUS_SUCCESS == hdd_issta_p2p_clientconnected(pHddCtx)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1826 | { |
| 1827 | //Enable BMPS only of other Session is P2P Client |
| 1828 | hdd_context_t *pHddCtx = NULL; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1829 | 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] | 1830 | |
| 1831 | if (NULL != pVosContext) |
| 1832 | { |
| 1833 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 1834 | |
| 1835 | if(NULL != pHddCtx) |
| 1836 | { |
| 1837 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1838 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 1839 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1840 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1841 | if (pHddCtx->hdd_wlan_suspended) |
| 1842 | { |
| 1843 | hdd_set_pwrparams(pHddCtx); |
| 1844 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1845 | hdd_enable_bmps_imps(pHddCtx); |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1846 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1847 | } |
| 1848 | } |
| 1849 | } |
| 1850 | } |
| 1851 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1852 | |
Madan Mohan Koyyalamudi | 70c52d3 | 2013-08-07 14:42:16 +0530 | [diff] [blame] | 1853 | hdd_wmm_adapter_clear(pAdapter); |
Kapil Gupta | e686748 | 2016-06-26 13:31:37 +0530 | [diff] [blame] | 1854 | /* Clear PER based roam stats */ |
| 1855 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1856 | if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) && |
| 1857 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 1858 | pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled && |
| 1859 | pHddCtx->cfg_ini->isPERRoamRxPathEnabled) |
| 1860 | sme_unset_per_roam_rxconfig(pHddCtx->hHal); |
| 1861 | #endif |
Mukul Sharma | c159c43 | 2014-01-15 15:42:46 +0530 | [diff] [blame] | 1862 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 1863 | sme_FTReset(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
| 1864 | #endif |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1865 | |
| 1866 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) |
| 1867 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1868 | v_U8_t i; |
| 1869 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1870 | sta_id = IBSS_BROADCAST_STAID; |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1871 | vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id ); |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1872 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1873 | { |
| 1874 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1875 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1876 | "Status= %d [0x%x]"), |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1877 | sta_id, status, status ); |
| 1878 | |
| 1879 | status = eHAL_STATUS_FAILURE; |
| 1880 | } |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1881 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1882 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1883 | /*Clear all the peer sta register with TL.*/ |
| 1884 | for (i =0; i < HDD_MAX_NUM_IBSS_STA; i++ ) |
| 1885 | { |
| 1886 | if (0 != pHddStaCtx->conn_info.staId[i]) |
| 1887 | { |
| 1888 | sta_id = pHddStaCtx->conn_info.staId[i]; |
| 1889 | |
| 1890 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1891 | FL("Deregister StaID %d"),sta_id); |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1892 | vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id ); |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1893 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1894 | { |
| 1895 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1896 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1897 | "Status= %d [0x%x]"), |
| 1898 | sta_id, status, status ); |
| 1899 | status = eHAL_STATUS_FAILURE; |
| 1900 | } |
| 1901 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 1902 | vstatus = hdd_sta_id_hash_remove_entry(pAdapter, |
| 1903 | sta_id, &pHddStaCtx->conn_info.peerMacAddress[i]); |
| 1904 | if (vstatus != VOS_STATUS_SUCCESS) { |
| 1905 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1906 | FL("Not able to remove staid hash %d"), |
| 1907 | sta_id); |
| 1908 | status = eHAL_STATUS_FAILURE; |
| 1909 | } else { |
| 1910 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1911 | FL("ibss station removed sta_id %d mac:" |
| 1912 | MAC_ADDRESS_STR), sta_id, |
| 1913 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[i].bytes)); |
| 1914 | } |
| 1915 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1916 | /*set the staid and peer mac as 0, all other reset are |
| 1917 | * done in hdd_connRemoveConnectInfo. |
| 1918 | */ |
| 1919 | pHddStaCtx->conn_info.staId[i]= 0; |
| 1920 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[i], sizeof( v_MACADDR_t ) ); |
| 1921 | |
| 1922 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1923 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1924 | } |
| 1925 | } |
| 1926 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1927 | } |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1928 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1929 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1930 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 1931 | /* clear scan cache for Link Lost */ |
| 1932 | if (pRoamInfo && !pRoamInfo->reasonCode && |
| 1933 | (eCSR_ROAM_LOSTLINK == roamStatus)) { |
Abhishek Singh | e6137b8 | 2019-03-22 20:06:09 +0530 | [diff] [blame] | 1934 | wlan_hdd_cfg80211_unlink_bss(pAdapter, |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 1935 | pHddStaCtx->conn_info.bssId); |
| 1936 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1937 | pHddStaCtx->conn_info.bssId); |
| 1938 | } |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1939 | |
| 1940 | //We should clear all sta register with TL, for now, only one. |
| 1941 | vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id ); |
| 1942 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1943 | { |
| 1944 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1945 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1946 | "Status= %d [0x%x]"), |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1947 | sta_id, status, status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1948 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1949 | status = eHAL_STATUS_FAILURE; |
| 1950 | } |
| 1951 | |
| 1952 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1953 | } |
Srinivas Dasari | deb7ae9 | 2014-12-19 15:26:40 +0530 | [diff] [blame] | 1954 | |
| 1955 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 1956 | if (VOS_STATUS_SUCCESS != |
| 1957 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1958 | pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE_AC)) |
| 1959 | { |
| 1960 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1961 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1962 | } |
| 1963 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1964 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1965 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1966 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1967 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Sravan Kumar Kairam | f9f9512 | 2017-01-18 20:54:05 +0530 | [diff] [blame] | 1968 | pAdapter->dad = false; |
Srinivas Dasari | deb7ae9 | 2014-12-19 15:26:40 +0530 | [diff] [blame] | 1969 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1970 | // Clear saved connection information in HDD |
| 1971 | hdd_connRemoveConnectInfo( pHddStaCtx ); |
Abhishek Singh | d2ce680 | 2018-05-08 15:21:06 +0530 | [diff] [blame] | 1972 | |
| 1973 | /* |
| 1974 | * eConnectionState_Connecting state mean that connection is in progress so |
| 1975 | * no need to set state to eConnectionState_NotConnected |
| 1976 | */ |
| 1977 | if ((eConnectionState_Connecting != pHddStaCtx->conn_info.connState)) { |
| 1978 | hddLog(LOG1, FL("Set HDD connState to eConnectionState_NotConnected")); |
| 1979 | hdd_connSetConnectionState(pHddStaCtx, eConnectionState_NotConnected); |
| 1980 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1981 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 1982 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1983 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 1984 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1985 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 1986 | sizeof (tSirGtkOffloadParams)); |
| 1987 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1988 | } |
| 1989 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1990 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1991 | #ifdef FEATURE_WLAN_TDLS |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1992 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1993 | { |
| 1994 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1995 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1996 | #endif |
| 1997 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1998 | //Unblock anyone waiting for disconnect to complete |
| 1999 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2000 | hdd_print_bss_info(pHddStaCtx); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 2001 | |
| 2002 | hdd_check_and_move_if_sap_is_on_dfs_chan(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2003 | return( status ); |
| 2004 | } |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2005 | |
| 2006 | static void hdd_postTLPacketPendingInd(hdd_adapter_t *pAdapter, |
| 2007 | v_U8_t staId) |
| 2008 | { |
| 2009 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2010 | v_SINT_t i; |
| 2011 | v_SIZE_t size; |
| 2012 | VOS_STATUS status; |
| 2013 | v_BOOL_t granted = VOS_FALSE; |
| 2014 | |
| 2015 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 2016 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) || |
| 2017 | (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE)) |
| 2018 | { |
| 2019 | //Indicate to TL that there is pending data if a queue is non empty |
| 2020 | for (i = WLANTL_AC_HIGH_PRIO; i>=0; --i) |
| 2021 | { |
| 2022 | size = 0; |
| 2023 | hdd_list_size(&pAdapter->wmm_tx_queue[i], &size); |
| 2024 | if (size > 0) |
| 2025 | { |
| 2026 | if (i != WLANTL_AC_HIGH_PRIO) |
| 2027 | { |
| 2028 | if (VOS_FALSE == |
| 2029 | pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessAllowed) |
| 2030 | { |
| 2031 | hdd_wmm_acquire_access(pAdapter, |
| 2032 | (WLANTL_ACEnumType)i, &granted); |
| 2033 | pAdapter->psbChanged |= (1 << i); |
| 2034 | } |
| 2035 | else |
| 2036 | granted = VOS_TRUE; |
| 2037 | } |
| 2038 | |
| 2039 | if (granted || (i == WLANTL_AC_HIGH_PRIO)) |
| 2040 | { |
| 2041 | status = WLANTL_STAPktPending(pHddCtx->pvosContext, |
| 2042 | staId, (WLANTL_ACEnumType)i); |
| 2043 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 2044 | { |
| 2045 | VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2046 | "%s: Failure in indicating pkt to TL for QID=%d", |
| 2047 | __func__, i); |
| 2048 | } |
| 2049 | } |
| 2050 | } |
| 2051 | } |
| 2052 | } |
| 2053 | } |
| 2054 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2055 | static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter, |
| 2056 | tCsrRoamInfo *pRoamInfo, |
| 2057 | v_U8_t staId, |
| 2058 | v_MACADDR_t *pPeerMacAddress, |
| 2059 | tSirBssDescription *pBssDesc ) |
| 2060 | { |
| 2061 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 2062 | WLAN_STADescType staDesc = {0}; |
| 2063 | eCsrEncryptionType connectedCipherAlgo; |
| 2064 | v_BOOL_t fConnected; |
| 2065 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2066 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2067 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2068 | |
| 2069 | if ( NULL == pBssDesc) |
| 2070 | { |
| 2071 | return VOS_STATUS_E_FAILURE; |
| 2072 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2073 | // Get the Station ID from the one saved during the assocation. |
| 2074 | staDesc.ucSTAId = staId; |
| 2075 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2076 | staDesc.wSTAType = WLAN_STA_INFRA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2077 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2078 | // grab the bssid from the connection info in the adapter structure and hand that |
| 2079 | // over to TL when registering. |
| 2080 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId, |
| 2081 | sizeof(pHddStaCtx->conn_info.bssId) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2083 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 2084 | |
| 2085 | // set the QoS field appropriately |
| 2086 | if (hdd_wmm_is_active(pAdapter)) |
| 2087 | { |
| 2088 | staDesc.ucQosEnabled = 1; |
| 2089 | } |
| 2090 | else |
| 2091 | { |
| 2092 | staDesc.ucQosEnabled = 0; |
| 2093 | } |
| 2094 | |
| 2095 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 2096 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 2097 | { |
| 2098 | staDesc.ucProtectedFrame = 1; |
| 2099 | } |
| 2100 | else |
| 2101 | { |
| 2102 | staDesc.ucProtectedFrame = 0; |
| 2103 | |
| 2104 | } |
| 2105 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2106 | #ifdef FEATURE_WLAN_ESE |
| 2107 | staDesc.ucIsEseSta = pRoamInfo->isESEAssoc; |
| 2108 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2109 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2110 | /* check whether replay check is valid for the station or not */ |
| 2111 | if( (eCSR_ENCRYPT_TYPE_TKIP == connectedCipherAlgo) || (eCSR_ENCRYPT_TYPE_AES == connectedCipherAlgo)) |
| 2112 | { |
| 2113 | /* Encryption mode is either TKIP or AES |
| 2114 | and replay check is valid for only these |
| 2115 | two encryption modes */ |
| 2116 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 2117 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2118 | "HDD register TL ucIsReplayCheckValid %d: Replay check is needed for station", staDesc.ucIsReplayCheckValid); |
| 2119 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2120 | else |
| 2121 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2122 | /* For other encryption modes replay check is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2123 | not needed */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2124 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2125 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2126 | "HDD register TL ucIsReplayCheckValid %d", staDesc.ucIsReplayCheckValid); |
| 2127 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2128 | |
| 2129 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2130 | hddLog(LOG1, "%s: WAPI STA Registered: %d", __func__, pAdapter->wapi_info.fIsWapiSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2131 | if (pAdapter->wapi_info.fIsWapiSta) |
| 2132 | { |
| 2133 | staDesc.ucIsWapiSta = 1; |
| 2134 | } |
| 2135 | else |
| 2136 | { |
| 2137 | staDesc.ucIsWapiSta = 0; |
| 2138 | } |
| 2139 | #endif /* FEATURE_WLAN_WAPI */ |
| 2140 | |
| 2141 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 2142 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
| 2143 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2144 | // UMA is Not ready yet, Xlation will be done by TL |
| 2145 | staDesc.ucSwFrameTXXlation = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2146 | staDesc.ucSwFrameRXXlation = 1; |
| 2147 | staDesc.ucAddRmvLLC = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2148 | 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] | 2149 | staDesc.ucQosEnabled ); |
| 2150 | // Initialize signatures and state |
| 2151 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 2152 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 2153 | staDesc.ucInitState = pRoamInfo->fAuthRequired ? |
| 2154 | WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2155 | // Register the Station with TL... |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 2156 | 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] | 2157 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 2158 | hdd_rx_packet_cbk, |
| 2159 | hdd_tx_complete_cbk, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2160 | hdd_tx_fetch_packet_cbk, &staDesc, |
| 2161 | pBssDesc->rssi ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2162 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2163 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2164 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2165 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2166 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2167 | vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2168 | return vosStatus; |
| 2169 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2170 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2171 | if ( cfg_param->dynSplitscan && |
| 2172 | ( VOS_TIMER_STATE_RUNNING != |
| 2173 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))) |
| 2174 | { |
| 2175 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 2176 | cfg_param->trafficMntrTmrForSplitScan); |
| 2177 | } |
| 2178 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2179 | // if (WPA), tell TL to go to 'connected' and after keys come to the driver, |
| 2180 | // then go to 'authenticated'. For all other authentication types |
| 2181 | // (those that donot require upper layer authentication) we can put |
| 2182 | // TL directly into 'authenticated' state. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2183 | if (staDesc.wSTAType != WLAN_STA_IBSS) |
| 2184 | VOS_ASSERT( fConnected ); |
| 2185 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2186 | if ( !pRoamInfo->fAuthRequired ) |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2187 | { |
| 2188 | // Connections that do not need Upper layer auth, transition TL directly |
| 2189 | // to 'Authenticated' state. |
| 2190 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
| 2191 | WLANTL_STA_AUTHENTICATED ); |
| 2192 | |
| 2193 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2194 | |
| 2195 | hdd_postTLPacketPendingInd(pAdapter, staDesc.ucSTAId); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2196 | } |
| 2197 | else |
| 2198 | { |
| 2199 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2200 | "ULA auth StaId= %d. Changing TL state to CONNECTED" |
| 2201 | "at Join time", pHddStaCtx->conn_info.staId[0] ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2202 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 2203 | WLANTL_STA_CONNECTED ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2204 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 2205 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2206 | return( vosStatus ); |
| 2207 | } |
| 2208 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 2210 | tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength) |
| 2211 | { |
| 2212 | unsigned int len = 0; |
| 2213 | u8 *pFTAssocRsp = NULL; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2214 | v_U8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2215 | tANI_U32 rspRsnLength = 0; |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2216 | struct cfg80211_bss* bss; |
| 2217 | tCsrRoamConnectedProfile roam_profile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2218 | struct ieee80211_channel *chan; |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2219 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2220 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2221 | if (!rspRsnIe) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2222 | hddLog(LOGE, "%s: Unable to allocate RSN IE", __func__); |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 2223 | return; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2224 | } |
| 2225 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2226 | if (pCsrRoamInfo == NULL) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2227 | hddLog(LOGE, "%s: Invalid CSR roam info", __func__); |
| 2228 | goto done; |
| 2229 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2230 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2231 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2232 | hddLog(LOGE, "%s: Invalid assoc response length", __func__); |
| 2233 | goto done; |
| 2234 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2235 | |
| 2236 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2237 | pCsrRoamInfo->nAssocReqLength); |
| 2238 | if (pFTAssocRsp == NULL) |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2239 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2240 | |
| 2241 | //pFTAssocRsp needs to point to the IEs |
| 2242 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2243 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2244 | (unsigned int)pFTAssocRsp[0], |
| 2245 | (unsigned int)pFTAssocRsp[1]); |
| 2246 | |
| 2247 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
Madan Mohan Koyyalamudi | 1bed23d | 2012-11-13 10:59:48 -0800 | [diff] [blame] | 2248 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2249 | rspRsnLength = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2250 | memcpy(rspRsnIe, pFTAssocRsp, len); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2251 | memset(rspRsnIe + len, 0, IW_GENERIC_IE_MAX - len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2252 | |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2253 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
| 2254 | (int) pCsrRoamInfo->pBssDesc->channelId); |
| 2255 | vos_mem_zero(&roam_profile, sizeof(tCsrRoamConnectedProfile)); |
| 2256 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roam_profile); |
| 2257 | bss = hdd_get_bss_entry(pAdapter->wdev.wiphy, |
| 2258 | chan, pCsrRoamInfo->bssid, |
| 2259 | &roam_profile.SSID.ssId[0], |
| 2260 | roam_profile.SSID.length); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2261 | hdd_send_roamed_ind(dev, bss, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2262 | reqRsnIe, reqRsnLength, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2263 | rspRsnIe, rspRsnLength); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2264 | |
| 2265 | done: |
| 2266 | kfree(rspRsnIe); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2267 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2268 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 2269 | void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter) |
| 2270 | { |
| 2271 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 2272 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2273 | tCsrRoamInfo roamInfo; |
| 2274 | roamInfo.fAuthRequired = FALSE; |
| 2275 | vos_mem_copy(roamInfo.bssid, |
| 2276 | pHddStaCtx->roam_info.bssid, |
| 2277 | WNI_CFG_BSSID_LEN); |
| 2278 | vos_mem_copy(roamInfo.peerMac, |
| 2279 | pHddStaCtx->roam_info.peerMac, |
| 2280 | WNI_CFG_BSSID_LEN); |
| 2281 | |
| 2282 | halStatus = hdd_RoamSetKeyCompleteHandler(pAdapter, |
| 2283 | &roamInfo, |
| 2284 | pHddStaCtx->roam_info.roamId, |
| 2285 | pHddStaCtx->roam_info.roamStatus, |
| 2286 | eCSR_ROAM_RESULT_AUTHENTICATED); |
| 2287 | if (halStatus != eHAL_STATUS_SUCCESS) |
| 2288 | { |
| 2289 | hddLog(LOGE, "%s: Set Key complete failure", __func__); |
| 2290 | } |
| 2291 | pHddStaCtx->roam_info.deferKeyComplete = FALSE; |
| 2292 | } |
| 2293 | |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2294 | /** |
| 2295 | * hdd_schedule_ecsa_chan_change_work() - schedule ecsa chan change work |
| 2296 | * @hal: hal context |
| 2297 | * @sta_session_id: sta session id |
| 2298 | * |
| 2299 | * Return: void. |
| 2300 | */ |
| 2301 | static void |
| 2302 | hdd_schedule_ecsa_chan_change_work(hdd_context_t *hdd_ctx, |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 2303 | uint8_t sta_session_id) |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2304 | { |
| 2305 | v_TIME_t conn_start_time; |
| 2306 | int32_t time_diff; |
| 2307 | |
| 2308 | conn_start_time = sme_get_connect_strt_time(hdd_ctx->hHal, sta_session_id); |
| 2309 | time_diff = vos_timer_get_system_time() - conn_start_time; |
| 2310 | |
| 2311 | if (time_diff < 0) |
| 2312 | time_diff = ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL; |
| 2313 | else if (time_diff > ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL) |
| 2314 | time_diff = 0; |
| 2315 | else |
| 2316 | time_diff = ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL - time_diff; |
| 2317 | |
| 2318 | hddLog(LOG1, FL("schedule ecsa_chan_change_work after %d ms"), time_diff); |
| 2319 | schedule_delayed_work(&hdd_ctx->ecsa_chan_change_work, |
| 2320 | msecs_to_jiffies(time_diff)); |
| 2321 | } |
| 2322 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2323 | static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 2324 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2325 | eCsrRoamResult roamResult ) |
| 2326 | { |
| 2327 | struct net_device *dev = pAdapter->dev; |
| 2328 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2329 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2330 | hdd_adapter_t *pHostapdAdapter = NULL; |
Girish Gowli | 257a7e6 | 2014-08-02 15:50:43 +0530 | [diff] [blame] | 2331 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 2332 | v_U8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2333 | tANI_U32 reqRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2334 | #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] | 2335 | int ft_carrier_on = FALSE; |
| 2336 | #endif |
| 2337 | int status; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2338 | v_BOOL_t hddDisconInProgress = FALSE; |
| 2339 | |
| 2340 | /* HDD has initiated disconnect, do not send connect result indication |
| 2341 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2342 | */ |
Agarwal Ashish | c089cec | 2015-08-10 13:10:04 +0530 | [diff] [blame] | 2343 | if (((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) || |
| 2344 | (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState)) && |
| 2345 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2346 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2347 | { |
| 2348 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2349 | FL(" Disconnect from HDD in progress ")); |
| 2350 | hddDisconInProgress = TRUE; |
| 2351 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2352 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2353 | if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult ) |
| 2354 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2355 | if ( !hddDisconInProgress ) |
| 2356 | { |
| 2357 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2358 | "%s: Set HDD connState to eConnectionState_Associated", |
| 2359 | __func__); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2360 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Associated ); |
| 2361 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2362 | |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 2363 | pAdapter->maxRateFlags = pRoamInfo->maxRateFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2364 | // Save the connection info from CSR... |
| 2365 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE ); |
Kapil Gupta | e686748 | 2016-06-26 13:31:37 +0530 | [diff] [blame] | 2366 | |
| 2367 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 2368 | if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) && |
| 2369 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 2370 | !hddDisconInProgress && |
| 2371 | pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled && |
| 2372 | pHddCtx->cfg_ini->isPERRoamRxPathEnabled) |
| 2373 | sme_set_per_roam_rxconfig(pHddCtx->hHal, |
| 2374 | pHddStaCtx->conn_info.staId[0], |
| 2375 | pHddCtx->cfg_ini->rateDownThreshold, |
| 2376 | pHddCtx->cfg_ini->rateUpThreshold, |
| 2377 | pHddCtx->cfg_ini->PERroamTriggerPercent, |
| 2378 | pHddCtx->cfg_ini->PERroamRxPktsThreshold, |
| 2379 | pHddCtx->cfg_ini->waitPeriodForNextPERScan); |
| 2380 | #endif |
| 2381 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2382 | #ifdef FEATURE_WLAN_WAPI |
| 2383 | if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE || |
| 2384 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK ) |
| 2385 | { |
| 2386 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2387 | } |
| 2388 | else |
| 2389 | { |
| 2390 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2391 | } |
| 2392 | #endif /* FEATURE_WLAN_WAPI */ |
| 2393 | |
| 2394 | // indicate 'connect' status to userspace |
| 2395 | hdd_SendAssociationEvent(dev,pRoamInfo); |
| 2396 | |
| 2397 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2398 | // Initialize the Linkup event completion variable |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2399 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2400 | |
| 2401 | /* |
| 2402 | Sometimes Switching ON the Carrier is taking time to activate the device properly. Before allowing any |
| 2403 | 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] | 2404 | 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] | 2405 | know that the device is getting activated properly. |
| 2406 | */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2407 | #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] | 2408 | if (pHddStaCtx->ft_carrier_on == FALSE && !hddDisconInProgress ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2409 | { |
| 2410 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2411 | // 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] | 2412 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 2413 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2414 | // 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] | 2415 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 2416 | |
| 2417 | // Switch on the Carrier to activate the device |
| 2418 | netif_carrier_on(dev); |
| 2419 | |
| 2420 | // Wait for the Link to up to ensure all the queues are set properly by the kernel |
| 2421 | status = wait_for_completion_interruptible_timeout(&pAdapter->linkup_event_var, |
| 2422 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2423 | if(!status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2424 | { |
| 2425 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning:ASSOC_LINKUP_TIMEOUT", __func__); |
| 2426 | } |
| 2427 | |
| 2428 | // Disable Linkup Event Servicing - no more service required from the net device notifier call |
| 2429 | pAdapter->isLinkUpSvcNeeded = FALSE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2430 | #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] | 2431 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2432 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2433 | pHddStaCtx->ft_carrier_on = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2434 | ft_carrier_on = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2435 | } |
| 2436 | #endif |
Sandeep Puligilla | d91dccb | 2014-06-18 11:51:48 +0530 | [diff] [blame] | 2437 | /* Check for STAID */ |
| 2438 | if( (WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId ) |
| 2439 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2440 | else |
| 2441 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Wrong Staid: %d", __func__, pRoamInfo->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2442 | |
| 2443 | //For reassoc, the station is already registered, all we need is to change the state |
| 2444 | //of the STA in TL. |
| 2445 | //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] | 2446 | //pRoamInfo->fReassocReq will be set only for the reassoc to same ap |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2447 | if( !pRoamInfo->fReassocReq ) |
| 2448 | { |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2449 | struct cfg80211_bss *bss; |
| 2450 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2451 | u8 *pFTAssocRsp = NULL; |
| 2452 | unsigned int assocRsplen = 0; |
| 2453 | u8 *pFTAssocReq = NULL; |
| 2454 | unsigned int assocReqlen = 0; |
| 2455 | struct ieee80211_channel *chan; |
| 2456 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2457 | v_U8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2458 | tANI_U32 rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2459 | |
| 2460 | /* add bss_id to cfg80211 data base */ |
| 2461 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 2462 | if (NULL == bss) |
| 2463 | { |
Abhishek Singh | 7ca68f3 | 2016-06-28 10:23:10 +0530 | [diff] [blame] | 2464 | hddLog(LOGE, |
| 2465 | FL("Not able to create BSS entry")); |
Katya Nigam | 346d4e9 | 2014-09-02 16:16:12 +0530 | [diff] [blame] | 2466 | netif_carrier_off(dev); |
Abhishek Singh | 7ca68f3 | 2016-06-28 10:23:10 +0530 | [diff] [blame] | 2467 | if (!hddDisconInProgress) { |
| 2468 | /* |
| 2469 | * Here driver was not able to update cfg80211 database |
| 2470 | * this can happen if connected channel is not valid, |
| 2471 | * i.e reg domain was changed during connection. |
| 2472 | * Queue disconnect for the session if disconnect is |
| 2473 | * not in progress. |
| 2474 | */ |
| 2475 | hddLog(LOGE, FL("Disconnecting...")); |
| 2476 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2477 | pAdapter->sessionId, |
| 2478 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2479 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2480 | return eHAL_STATUS_FAILURE; |
| 2481 | } |
Abhinav Kumar | 4cde829 | 2019-07-18 14:17:25 +0530 | [diff] [blame] | 2482 | |
| 2483 | //Association Response |
| 2484 | pFTAssocRsp = (u8 *)(pRoamInfo->pbFrames + |
| 2485 | pRoamInfo->nBeaconLength + |
| 2486 | pRoamInfo->nAssocReqLength); |
| 2487 | if (pFTAssocRsp != NULL) |
| 2488 | { |
| 2489 | // pFTAssocRsp needs to point to the IEs |
| 2490 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 2491 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 2492 | (unsigned int)pFTAssocRsp[0], |
| 2493 | (unsigned int)pFTAssocRsp[1]); |
| 2494 | assocRsplen = |
| 2495 | pRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2496 | } |
| 2497 | else |
| 2498 | { |
| 2499 | hddLog(LOGE, "%s:AssocRsp is NULL", __func__); |
| 2500 | assocRsplen = 0; |
| 2501 | } |
| 2502 | |
| 2503 | //Association Request |
| 2504 | pFTAssocReq = (u8 *)(pRoamInfo->pbFrames + |
| 2505 | pRoamInfo->nBeaconLength); |
| 2506 | if (pFTAssocReq != NULL) |
| 2507 | { |
| 2508 | if(!ft_carrier_on) |
| 2509 | { |
| 2510 | // pFTAssocReq needs to point to the IEs |
| 2511 | pFTAssocReq += FT_ASSOC_REQ_IES_OFFSET; |
| 2512 | hddLog(LOG1, "%s: pFTAssocReq is now at %02x%02x", __func__, |
| 2513 | (unsigned int)pFTAssocReq[0], |
| 2514 | (unsigned int)pFTAssocReq[1]); |
| 2515 | assocReqlen = |
| 2516 | pRoamInfo->nAssocReqLength - FT_ASSOC_REQ_IES_OFFSET; |
| 2517 | } |
| 2518 | else |
| 2519 | { |
| 2520 | /* This should contain only the FTIEs */ |
| 2521 | assocReqlen = pRoamInfo->nAssocReqLength; |
| 2522 | } |
| 2523 | } |
| 2524 | else |
| 2525 | { |
| 2526 | hddLog(LOGE, "%s:AssocReq is NULL", __func__); |
| 2527 | assocReqlen = 0; |
| 2528 | } |
| 2529 | |
| 2530 | hddLog(LOG1, "assocReqlen %d assocRsplen %d", assocReqlen, |
| 2531 | assocRsplen); |
| 2532 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2533 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2534 | if(pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN || |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2535 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN_PSK ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2536 | { |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2537 | if(ft_carrier_on) |
| 2538 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2539 | if ( !hddDisconInProgress ) |
| 2540 | { |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2541 | struct cfg80211_bss *roam_bss; |
| 2542 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2543 | hddLog(LOG1, "%s ft_carrier_on is %d, sending roamed " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2544 | "indication", __FUNCTION__, ft_carrier_on); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2545 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2546 | (int)pRoamInfo->pBssDesc->channelId); |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2547 | if (pHddCtx->cfg_ini && |
| 2548 | pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2549 | { |
| 2550 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 2551 | } |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2552 | roam_bss = hdd_get_bss_entry(pAdapter->wdev.wiphy, |
| 2553 | chan, pRoamInfo->bssid, |
| 2554 | pRoamInfo->u.pConnectedProfile->SSID.ssId, |
| 2555 | pRoamInfo->u.pConnectedProfile->SSID.length); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2556 | hdd_send_roamed_ind(dev, roam_bss, |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2557 | pFTAssocReq, assocReqlen, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2558 | pFTAssocRsp, assocRsplen); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2559 | } |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 2560 | if (sme_GetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 2561 | { |
| 2562 | sme_SetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter), FALSE); |
| 2563 | pRoamInfo->fAuthRequired = FALSE; |
| 2564 | |
| 2565 | vos_mem_copy(pHddStaCtx->roam_info.bssid, |
| 2566 | pRoamInfo->bssid, |
| 2567 | HDD_MAC_ADDR_LEN); |
| 2568 | vos_mem_copy(pHddStaCtx->roam_info.peerMac, |
| 2569 | pRoamInfo->peerMac, |
| 2570 | HDD_MAC_ADDR_LEN); |
| 2571 | pHddStaCtx->roam_info.roamId = roamId; |
| 2572 | pHddStaCtx->roam_info.roamStatus = roamStatus; |
| 2573 | pHddStaCtx->roam_info.deferKeyComplete = TRUE; |
| 2574 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2575 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2576 | else if ( !hddDisconInProgress ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2577 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2578 | hddLog(LOG1, "%s ft_carrier_on is %d, sending connect " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2579 | "indication", __FUNCTION__, ft_carrier_on); |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2580 | hdd_connect_result(dev, pRoamInfo->bssid, pRoamInfo, |
| 2581 | pFTAssocReq, assocReqlen, |
| 2582 | pFTAssocRsp, assocRsplen, |
| 2583 | WLAN_STATUS_SUCCESS, |
| 2584 | GFP_KERNEL); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2585 | } |
| 2586 | } |
| 2587 | else |
| 2588 | #endif |
| 2589 | { |
| 2590 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 2591 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2592 | pAdapter->sessionId, |
| 2593 | &reqRsnLength, |
| 2594 | reqRsnIe); |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2595 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2596 | csrRoamGetWpaRsnRspIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2597 | pAdapter->sessionId, |
| 2598 | &rspRsnLength, |
| 2599 | rspRsnIe); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2600 | if ( !hddDisconInProgress ) |
| 2601 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2602 | #if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2603 | if(ft_carrier_on) |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2604 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2605 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2606 | if (pHddCtx->cfg_ini && |
| 2607 | pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2608 | { |
| 2609 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 2610 | } |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2611 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2612 | else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2613 | #endif /* FEATURE_WLAN_ESE */ |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2614 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2615 | { |
| 2616 | hddLog(VOS_TRACE_LEVEL_INFO, |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2617 | "%s: sending connect indication to nl80211:" |
| 2618 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2619 | " result:%d and Status:%d", |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2620 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
| 2621 | roamResult, roamStatus); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2622 | /* inform connect result to nl80211 */ |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2623 | hdd_connect_result(dev, pRoamInfo->bssid, |
| 2624 | pRoamInfo, |
Abhinav Kumar | 4cde829 | 2019-07-18 14:17:25 +0530 | [diff] [blame] | 2625 | pFTAssocReq, assocReqlen, |
| 2626 | pFTAssocRsp, assocRsplen, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2627 | WLAN_STATUS_SUCCESS, |
| 2628 | GFP_KERNEL); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2629 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2630 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2631 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2632 | if ( !hddDisconInProgress ) |
| 2633 | { |
| 2634 | cfg80211_put_bss( |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2635 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2636 | pHddCtx->wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2637 | #endif |
| 2638 | bss); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2639 | // Register the Station with TL after associated... |
| 2640 | vosStatus = hdd_roamRegisterSTA( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2641 | pRoamInfo, |
| 2642 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2643 | NULL, |
| 2644 | pRoamInfo->pBssDesc ); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2645 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2646 | } |
| 2647 | else |
| 2648 | { |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 2649 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 2650 | /* in case of reassociation also need to indicate it to supplicant */ |
| 2651 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2652 | pAdapter->sessionId, |
| 2653 | &reqRsnLength, |
| 2654 | reqRsnIe); |
| 2655 | |
| 2656 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2657 | //Reassoc successfully |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2658 | if( pRoamInfo->fAuthRequired ) |
| 2659 | { |
| 2660 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 2661 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2662 | WLANTL_STA_CONNECTED ); |
| 2663 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 2664 | } |
| 2665 | else |
| 2666 | { |
| 2667 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2668 | "%s: staId: %d Changing TL state to AUTHENTICATED", |
| 2669 | __func__, pHddStaCtx->conn_info.staId[ 0 ] ); |
| 2670 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 2671 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2672 | WLANTL_STA_AUTHENTICATED ); |
| 2673 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2674 | hdd_postTLPacketPendingInd(pAdapter, |
| 2675 | pHddStaCtx->conn_info.staId[0]); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2676 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2677 | } |
| 2678 | |
| 2679 | if ( VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2680 | { |
| 2681 | // perform any WMM-related association processing |
| 2682 | hdd_wmm_assoc(pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2683 | } |
| 2684 | else |
| 2685 | { |
| 2686 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2687 | "Cannot register STA with TL. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2688 | vosStatus, vosStatus ); |
| 2689 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2690 | #ifdef WLAN_FEATURE_11W |
| 2691 | vos_mem_zero( &pAdapter->hdd_stats.hddPmfStats, |
| 2692 | sizeof(pAdapter->hdd_stats.hddPmfStats) ); |
| 2693 | #endif |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2694 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2695 | // Start the Queue |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 2696 | if ( !hddDisconInProgress ) |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2697 | { |
| 2698 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 2699 | netif_tx_wake_all_queues(dev); |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2700 | } |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2701 | if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2702 | { |
| 2703 | vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0); |
| 2704 | } |
Padma, Santhosh Kumar | 38cef18 | 2016-02-18 12:22:51 +0530 | [diff] [blame] | 2705 | #ifdef FEATURE_WLAN_TDLS |
| 2706 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 2707 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2708 | } |
| 2709 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2710 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2711 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 2712 | |
| 2713 | 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] | 2714 | if (pRoamInfo) |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 2715 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2716 | "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d", |
| 2717 | MAC_ADDR_ARRAY(pRoamInfo->bssid), roamResult, roamStatus); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2718 | else |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 2719 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2720 | "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d", |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2721 | MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 2722 | roamResult, roamStatus); |
Abhishek Singh | 6782c9e | 2017-06-06 13:37:45 +0530 | [diff] [blame] | 2723 | if (!pHddStaCtx->get_mgmt_log_sent) { |
| 2724 | pHddStaCtx->get_mgmt_log_sent = TRUE; |
Abhishek Singh | 611295e | 2015-07-09 11:11:54 +0530 | [diff] [blame] | 2725 | wlan_hdd_get_frame_logs(pAdapter, |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 2726 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Abhishek Singh | 6782c9e | 2017-06-06 13:37:45 +0530 | [diff] [blame] | 2727 | } |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 2728 | |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 2729 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 2730 | (pRoamInfo && |
| 2731 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) || |
| 2732 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) || |
| 2733 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode)))) { |
Abhishek Singh | e6137b8 | 2019-03-22 20:06:09 +0530 | [diff] [blame] | 2734 | wlan_hdd_cfg80211_unlink_bss(pAdapter, |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 2735 | pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId); |
| 2736 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 2737 | pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId); |
| 2738 | } |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2739 | /* Set connection state to eConnectionState_NotConnected only when CSR |
| 2740 | * has completed operation - with a ASSOCIATION_FAILURE status |
| 2741 | */ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2742 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2743 | { |
| 2744 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2745 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 2746 | __func__); |
| 2747 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected); |
| 2748 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2749 | if((pHddCtx->concurrency_mode <= 1) && |
| 2750 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2751 | { |
| 2752 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 2753 | } |
| 2754 | |
| 2755 | //If the Device Mode is Station |
| 2756 | // and the P2P Client is Connected |
| 2757 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2758 | |
| 2759 | // 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] | 2760 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2761 | if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 2762 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2763 | (vos_concurrent_open_sessions_running())) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2764 | { |
| 2765 | //Enable BMPS only of other Session is P2P Client |
| 2766 | hdd_context_t *pHddCtx = NULL; |
| 2767 | v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); |
| 2768 | |
| 2769 | if (NULL != pVosContext) |
| 2770 | { |
| 2771 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 2772 | |
| 2773 | if(NULL != pHddCtx) |
| 2774 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2775 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2776 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 2777 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2778 | { |
| 2779 | if (pHddCtx->hdd_wlan_suspended) |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 2780 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2781 | hdd_set_pwrparams(pHddCtx); |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 2782 | } |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2783 | hdd_enable_bmps_imps(pHddCtx); |
| 2784 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2785 | } |
| 2786 | } |
| 2787 | } |
| 2788 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2789 | /* CR465478: Only send up a connection failure result when CSR has |
Varun Reddy Yeturu | da7f0d5 | 2013-12-20 11:16:57 -0800 | [diff] [blame] | 2790 | * completed operation - with a ASSOCIATION_FAILURE status.*/ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2791 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2792 | { |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 2793 | |
| 2794 | if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 2795 | { |
| 2796 | hddLog(LOG1, |
| 2797 | FL("Assoication Failure for P2P client and we are trying to re-enable TDLS")); |
| 2798 | wlan_hdd_tdls_reenable(pHddCtx); |
| 2799 | } |
| 2800 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2801 | if (pRoamInfo) { |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2802 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2803 | "%s: send connect failure to nl80211:" |
| 2804 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2805 | " result:%d and Status:%d reasonCode %d" , |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2806 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2807 | roamResult, roamStatus, pRoamInfo->reasonCode); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2808 | pHddStaCtx->conn_info.assoc_status_code = |
| 2809 | pRoamInfo->statusCode; |
| 2810 | } else { |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2811 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2812 | "%s: connect failed:" |
| 2813 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2814 | " result:%d and Status:%d" , |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2815 | __func__, MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 2816 | roamResult, roamStatus); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2817 | } |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2818 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2819 | /* inform association failure event to nl80211 */ |
| 2820 | if ( eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult ) |
| 2821 | { |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2822 | if (pRoamInfo) |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2823 | hdd_connect_result(dev, pRoamInfo->bssid, NULL, |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2824 | NULL, 0, NULL, 0, |
| 2825 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2826 | GFP_KERNEL); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2827 | else |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2828 | hdd_connect_result(dev, pWextState->req_bssId, NULL, |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2829 | NULL, 0, NULL, 0, |
| 2830 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2831 | GFP_KERNEL); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2832 | } |
| 2833 | else |
| 2834 | { |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2835 | if (pRoamInfo) |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2836 | hdd_connect_result(dev, pRoamInfo->bssid, NULL, |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2837 | NULL, 0, NULL, 0, |
| 2838 | pRoamInfo->reasonCode ? |
| 2839 | pRoamInfo->reasonCode : |
| 2840 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2841 | GFP_KERNEL); |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2842 | else |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2843 | hdd_connect_result(dev, pWextState->req_bssId, NULL, |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2844 | NULL, 0, NULL, 0, |
| 2845 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2846 | GFP_KERNEL); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2847 | } |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2848 | /*Clear the roam profile*/ |
| 2849 | hdd_clearRoamProfileIe( pAdapter ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2850 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2851 | |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 2852 | hdd_wmm_init( pAdapter ); |
Madan Mohan Koyyalamudi | ee255f1 | 2012-09-28 15:41:19 -0700 | [diff] [blame] | 2853 | |
c_hpothu | 24f4098 | 2014-04-18 18:00:36 +0530 | [diff] [blame] | 2854 | if (pRoamInfo) |
| 2855 | { |
| 2856 | WLANTL_AssocFailed(pRoamInfo->staId); |
| 2857 | } |
Mihir Shete | b733727 | 2014-04-11 15:53:08 +0530 | [diff] [blame] | 2858 | |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2859 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2860 | netif_tx_disable(dev); |
| 2861 | netif_carrier_off(dev); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2863 | } |
| 2864 | |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2865 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2866 | { |
| 2867 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 2868 | if (pHostapdAdapter != NULL) |
| 2869 | { |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2870 | /* Restart SAP if its operating channel is different |
| 2871 | * from AP channel. |
| 2872 | */ |
| 2873 | if (pHostapdAdapter->sessionCtx.ap.operatingChannel != |
| 2874 | (int)pRoamInfo->pBssDesc->channelId) |
| 2875 | { |
| 2876 | hddLog(VOS_TRACE_LEVEL_INFO,"Restart Sap as SAP channel is %d " |
| 2877 | "and STA channel is %d", pHostapdAdapter->sessionCtx.ap.operatingChannel, |
| 2878 | (int)pRoamInfo->pBssDesc->channelId); |
Hanumanth Reddy Pothula | 8d4b8eb | 2018-02-26 16:14:10 +0530 | [diff] [blame] | 2879 | if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->force_scc_with_ecsa) |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2880 | { |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2881 | hdd_schedule_ecsa_chan_change_work(pHddCtx, |
| 2882 | pAdapter->sessionId); |
| 2883 | } |
| 2884 | else |
| 2885 | { |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2886 | hdd_hostapd_stop(pHostapdAdapter->dev); |
Hanumanth Reddy Pothula | 8d4b8eb | 2018-02-26 16:14:10 +0530 | [diff] [blame] | 2887 | if (pHddCtx->cfg_ini && |
| 2888 | pHddCtx->cfg_ini->enable_sap_auth_offload) |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2889 | hdd_force_scc_restart_sap(pHostapdAdapter, |
| 2890 | pHddCtx, (int)pRoamInfo->pBssDesc->channelId); |
| 2891 | } |
Agrawal Ashish | 574b3e6 | 2017-02-09 18:58:34 +0530 | [diff] [blame] | 2892 | |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2893 | } |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2894 | } |
| 2895 | } |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 2896 | else if (roamStatus == eCSR_ROAM_ASSOCIATION_FAILURE) |
| 2897 | { |
| 2898 | hdd_check_and_move_if_sap_is_on_dfs_chan(pHddCtx, pAdapter); |
| 2899 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2900 | return eHAL_STATUS_SUCCESS; |
| 2901 | } |
| 2902 | |
| 2903 | /**============================================================================ |
| 2904 | * |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2905 | @brief hdd_RoamIbssIndicationHandler() - Here we update the status of the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2906 | 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] | 2907 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2908 | ===========================================================================*/ |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2909 | static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter, |
| 2910 | tCsrRoamInfo *pRoamInfo, |
| 2911 | tANI_U32 roamId, |
| 2912 | eRoamCmdStatus roamStatus, |
| 2913 | eCsrRoamResult roamResult ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2914 | { |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2915 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 2916 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 2917 | struct cfg80211_bss *bss; |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 2918 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2919 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2920 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d", |
| 2921 | __func__, pAdapter->dev->name, roamId, roamStatus, roamResult); |
| 2922 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2923 | switch( roamResult ) |
| 2924 | { |
| 2925 | // both IBSS Started and IBSS Join should come in here. |
| 2926 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 2927 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2928 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2929 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2930 | if (NULL == pRoamInfo) |
| 2931 | { |
| 2932 | VOS_ASSERT(0); |
| 2933 | return; |
| 2934 | } |
| 2935 | |
| 2936 | /* When IBSS Started comes from CSR, we need to move |
| 2937 | * connection state to IBSS Disconnected (meaning no peers |
| 2938 | * are in the IBSS). |
| 2939 | */ |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2940 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2941 | "%s: Set HDD connState to eConnectionState_IbssDisconnected", |
| 2942 | __func__); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2943 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 2944 | eConnectionState_IbssDisconnected ); |
Abhishek Singh | 1c21c4d | 2014-04-25 16:40:19 +0530 | [diff] [blame] | 2945 | /*notify wmm */ |
| 2946 | hdd_wmm_connect(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2947 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2948 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2949 | if (pRoamInfo->pBssDesc) |
| 2950 | { |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2951 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 2952 | struct ieee80211_channel *chan; |
| 2953 | int chan_no; |
| 2954 | unsigned int freq; |
| 2955 | #endif |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2956 | hdd_ibss_RegisterSTA (pAdapter, pRoamInfo, |
| 2957 | IBSS_BROADCAST_STAID, |
| 2958 | &broadcastMacAddr, pRoamInfo->pBssDesc); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2959 | |
| 2960 | /* we created the IBSS, notify supplicant */ |
| 2961 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: created ibss " |
| 2962 | MAC_ADDRESS_STR, |
| 2963 | __func__, pAdapter->dev->name, |
| 2964 | MAC_ADDR_ARRAY(pRoamInfo->pBssDesc->bssId)); |
| 2965 | |
| 2966 | /* we must first give cfg80211 the BSS information */ |
| 2967 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 2968 | if (NULL == bss) |
| 2969 | { |
| 2970 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2971 | "%s: %s: unable to create IBSS entry", |
| 2972 | __func__, pAdapter->dev->name); |
| 2973 | return; |
| 2974 | } |
Abhishek Singh | 00b7197 | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 2975 | #ifdef WLAN_FEATURE_RMC |
| 2976 | netif_carrier_on(pAdapter->dev); |
| 2977 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
| 2978 | netif_tx_start_all_queues(pAdapter->dev); |
| 2979 | #endif |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2980 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 2981 | chan_no = pRoamInfo->pBssDesc->channelId; |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2982 | |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2983 | if (chan_no <= 14) |
| 2984 | freq = ieee80211_channel_to_frequency(chan_no, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2985 | HDD_NL80211_BAND_2GHZ); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2986 | else |
| 2987 | freq = ieee80211_channel_to_frequency(chan_no, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2988 | HDD_NL80211_BAND_5GHZ); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2989 | |
| 2990 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 2991 | |
| 2992 | if (chan) |
| 2993 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 2994 | chan, GFP_KERNEL); |
| 2995 | else |
| 2996 | hddLog(LOGE, FL("%s: chanId: %d, can't find channel"), |
| 2997 | pAdapter->dev->name, |
| 2998 | (int)pRoamInfo->pBssDesc->channelId); |
| 2999 | #else |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3000 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 3001 | #endif |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 3002 | cfg80211_put_bss( |
| 3003 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 3004 | pHddCtx->wiphy, |
| 3005 | #endif |
| 3006 | bss); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3007 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3008 | else |
| 3009 | { |
| 3010 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3011 | "%s: NULL Bss Desc",__func__); |
| 3012 | } |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3013 | |
| 3014 | /* Set Broadcast key again in case IBSS_COALESCED as DEL BSS, |
| 3015 | * in IBSS_COALESCED will remove the BC key. |
| 3016 | */ |
| 3017 | if ((eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) && |
| 3018 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY |
| 3019 | == pHddStaCtx->ibss_enc_key.encType |
| 3020 | ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY |
| 3021 | == pHddStaCtx->ibss_enc_key.encType |
| 3022 | ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType |
| 3023 | ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType )) |
| 3024 | { |
| 3025 | u8 grpmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3026 | VOS_STATUS vosStatus; |
| 3027 | |
| 3028 | pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX; |
| 3029 | |
| 3030 | memcpy(&pHddStaCtx->ibss_enc_key.peerMac, |
| 3031 | grpmacaddr, WNI_CFG_BSSID_LEN); |
| 3032 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3033 | FL(" SET GTK in case of COALESCED")); |
| 3034 | vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3035 | pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId ); |
| 3036 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 3037 | { |
| 3038 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3039 | FL("sme_RoamSetKey failed, returned %d"),vosStatus); |
| 3040 | } |
| 3041 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3042 | break; |
| 3043 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3045 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3046 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3047 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unable to create IBSS", |
| 3048 | __func__, pAdapter->dev->name); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3049 | break; |
| 3050 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3052 | default: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3053 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unexpected result %d", |
| 3054 | __func__, pAdapter->dev->name, (int)roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3055 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3056 | } |
| 3057 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3058 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3059 | } |
| 3060 | |
| 3061 | /**============================================================================ |
| 3062 | * |
| 3063 | @brief roamSaveIbssStation() - Save the IBSS peer MAC address in the adapter. |
| 3064 | This information is passed to iwconfig later. The peer that joined |
| 3065 | last is passed as information to iwconfig. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3066 | 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] | 3067 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3068 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3069 | ===========================================================================*/ |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3070 | 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] | 3071 | { |
| 3072 | int fSuccess = FALSE; |
| 3073 | int idx = 0; |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3074 | VOS_STATUS status; |
| 3075 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3076 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3077 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 3078 | { |
| 3079 | if ( 0 == pHddStaCtx->conn_info.staId[ idx ] ) |
| 3080 | { |
| 3081 | pHddStaCtx->conn_info.staId[ idx ] = staId; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3083 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ], peerMacAddress ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3084 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3085 | fSuccess = TRUE; |
| 3086 | break; |
| 3087 | } |
| 3088 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3089 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3090 | status = hdd_sta_id_hash_add_entry(pAdapter, staId, peerMacAddress); |
| 3091 | if (status != VOS_STATUS_SUCCESS) { |
| 3092 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3093 | FL("Not able to add staid hash %d"), staId); |
| 3094 | return FALSE; |
| 3095 | } |
| 3096 | |
| 3097 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3098 | FL("New station added sta_id %d mac:" |
| 3099 | MAC_ADDRESS_STR), staId, |
| 3100 | MAC_ADDR_ARRAY(peerMacAddress->bytes)); |
| 3101 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3102 | return( fSuccess ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3103 | } |
| 3104 | /**============================================================================ |
| 3105 | * |
| 3106 | @brief roamRemoveIbssStation() - Remove the IBSS peer MAC address in the adapter. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3107 | 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] | 3108 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3109 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3110 | ===========================================================================*/ |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3111 | static int roamRemoveIbssStation( hdd_adapter_t *pAdapter, v_U8_t staId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3112 | { |
| 3113 | int fSuccess = FALSE; |
| 3114 | int idx = 0; |
| 3115 | v_U8_t valid_idx = 0; |
| 3116 | v_U8_t del_idx = 0; |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3117 | v_U8_t empty_slots = 0; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3118 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3119 | VOS_STATUS status; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3120 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3121 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 3122 | { |
| 3123 | if ( staId == pHddStaCtx->conn_info.staId[ idx ] ) |
| 3124 | { |
| 3125 | pHddStaCtx->conn_info.staId[ idx ] = 0; |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3126 | status = hdd_sta_id_hash_remove_entry(pAdapter, |
| 3127 | staId, &pHddStaCtx->conn_info.peerMacAddress[idx]); |
| 3128 | if (status != VOS_STATUS_SUCCESS) { |
| 3129 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3130 | FL("Not able to remove staid hash %d"), staId ); |
| 3131 | fSuccess = FALSE; |
| 3132 | } else { |
| 3133 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3134 | FL("station removed sta_id %d mac:" |
| 3135 | MAC_ADDRESS_STR), staId, |
| 3136 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[idx].bytes)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3137 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3138 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3139 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3140 | fSuccess = TRUE; |
| 3141 | // Note the deleted Index, if its 0 we need special handling |
| 3142 | del_idx = idx; |
| 3143 | empty_slots++; |
| 3144 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3145 | } |
| 3146 | else |
| 3147 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3148 | if (pHddStaCtx->conn_info.staId[idx] != 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3149 | { |
| 3150 | valid_idx = idx; |
| 3151 | } |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3152 | else |
| 3153 | { |
| 3154 | // Found an empty slot |
| 3155 | empty_slots++; |
| 3156 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3157 | } |
| 3158 | } |
| 3159 | |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3160 | if (HDD_MAX_NUM_IBSS_STA == empty_slots) |
| 3161 | { |
| 3162 | // Last peer departed, set the IBSS state appropriately |
| 3163 | pHddStaCtx->conn_info.connState = eConnectionState_IbssDisconnected; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3164 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3165 | "Last IBSS Peer Departed!!!" ); |
| 3166 | } |
| 3167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3168 | // Find next active staId, to have a valid sta trigger for TL. |
| 3169 | if (fSuccess == TRUE) |
| 3170 | { |
| 3171 | if (del_idx == 0) |
| 3172 | { |
| 3173 | if (pHddStaCtx->conn_info.staId[valid_idx] != 0) |
| 3174 | { |
| 3175 | pHddStaCtx->conn_info.staId[0] = pHddStaCtx->conn_info.staId[valid_idx]; |
| 3176 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], |
| 3177 | &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ]); |
| 3178 | |
| 3179 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
| 3180 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ] ); |
| 3181 | } |
| 3182 | } |
| 3183 | } |
| 3184 | return( fSuccess ); |
| 3185 | } |
| 3186 | |
| 3187 | /**============================================================================ |
| 3188 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3189 | @brief roamIbssConnectHandler() : We update the status of the IBSS to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3190 | connected in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3192 | ===========================================================================*/ |
| 3193 | static eHalStatus roamIbssConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo ) |
| 3194 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3195 | struct cfg80211_bss *bss; |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 3196 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3197 | "%s: IBSS Connect Indication from SME!!! " |
| 3198 | "Set HDD connState to eConnectionState_IbssConnected", |
| 3199 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3200 | // Set the internal connection state to show 'IBSS Connected' (IBSS with a partner stations)... |
| 3201 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssConnected ); |
| 3202 | |
| 3203 | // Save the connection info from CSR... |
| 3204 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS ); |
| 3205 | |
| 3206 | // Send the bssid address to the wext. |
| 3207 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3208 | /* add bss_id to cfg80211 data base */ |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3209 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3210 | if (NULL == bss) |
| 3211 | { |
| 3212 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3213 | "%s: %s: unable to create IBSS entry", |
| 3214 | __func__, pAdapter->dev->name); |
| 3215 | return eHAL_STATUS_FAILURE; |
| 3216 | } |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 3217 | cfg80211_put_bss( |
| 3218 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 3219 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
| 3220 | #endif |
| 3221 | bss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3222 | |
| 3223 | return( eHAL_STATUS_SUCCESS ); |
| 3224 | } |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 3225 | |
| 3226 | /**============================================================================ |
| 3227 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3228 | @brief hdd_RoamSetKeyCompleteHandler() - Update the security parameters. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3229 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3230 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3231 | static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 3232 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3233 | eCsrRoamResult roamResult ) |
| 3234 | { |
| 3235 | eCsrEncryptionType connectedCipherAlgo; |
| 3236 | v_BOOL_t fConnected = FALSE; |
| 3237 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 3238 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3239 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3240 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3241 | WLANTL_STAStateType prevTLState = WLANTL_STA_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3242 | ENTER(); |
Srinivas Girigowda | 5a737f2 | 2013-06-28 15:21:48 -0700 | [diff] [blame] | 3243 | |
| 3244 | if (NULL == pRoamInfo) |
| 3245 | { |
| 3246 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "pRoamInfo is NULL"); |
| 3247 | return eHAL_STATUS_FAILURE; |
| 3248 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3249 | // 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] | 3250 | // then go to 'authenticated'. For all other authentication types (those that do |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3251 | // not require upper layer authentication) we can put TL directly into 'authenticated' |
| 3252 | // state. |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3253 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3254 | "Set Key completion roamStatus =%d roamResult=%d " MAC_ADDRESS_STR, |
| 3255 | roamStatus, roamResult, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3257 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 3258 | if( fConnected ) |
| 3259 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3260 | if ( WLAN_HDD_IBSS == pAdapter->device_mode ) |
| 3261 | { |
| 3262 | v_U8_t staId; |
| 3263 | |
| 3264 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 3265 | |
| 3266 | if ( 0 == memcmp( pRoamInfo->peerMac, |
| 3267 | &broadcastMacAddr, VOS_MAC_ADDR_SIZE ) ) |
| 3268 | { |
| 3269 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3270 | IBSS_BROADCAST_STAID); |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3271 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3272 | "WLAN TL STA GTK Installed for STAID=%d", IBSS_BROADCAST_STAID); |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3273 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3274 | } |
| 3275 | else |
| 3276 | { |
| 3277 | vosStatus = hdd_Ibss_GetStaId(pHddStaCtx, |
| 3278 | (v_MACADDR_t*)pRoamInfo->peerMac, |
| 3279 | &staId); |
| 3280 | if ( VOS_STATUS_SUCCESS == vosStatus ) |
| 3281 | { |
| 3282 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3283 | "WLAN TL STA Ptk Installed for STAID=%d", staId); |
| 3284 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3285 | staId); |
| 3286 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3287 | } |
| 3288 | } |
| 3289 | } |
| 3290 | else |
| 3291 | { |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3292 | WLANTL_GetSTAState(pHddCtx->pvosContext, |
| 3293 | pHddStaCtx->conn_info.staId[0], |
| 3294 | &prevTLState); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3295 | // TODO: Considering getting a state machine in HDD later. |
| 3296 | // This routine is invoked twice. 1)set PTK 2)set GTK. |
| 3297 | // The folloing if statement will be TRUE when setting GTK. |
| 3298 | // At this time we don't handle the state in detail. |
| 3299 | // Related CR: 174048 - TL not in authenticated state |
| 3300 | if ( ( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) && |
| 3301 | (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired ) |
| 3302 | { |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3303 | |
| 3304 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set " |
| 3305 | "for StaId=%d. Changing TL state to AUTHENTICATED from" |
| 3306 | " state:%d", pHddStaCtx->conn_info.staId[0], prevTLState); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3307 | |
| 3308 | // Connections that do not need Upper layer authentication, |
| 3309 | // transition TL to 'Authenticated' state after the keys are set. |
| 3310 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 3311 | pHddStaCtx->conn_info.staId[ 0 ], |
| 3312 | WLANTL_STA_AUTHENTICATED ); |
| 3313 | |
| 3314 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3315 | |
| 3316 | if (WLANTL_STA_AUTHENTICATED != prevTLState) |
| 3317 | hdd_postTLPacketPendingInd(pAdapter, |
| 3318 | pHddStaCtx->conn_info.staId[0]); |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 3319 | //Need to call offload because when roaming happen at that time fwr |
| 3320 | //clean offload info as part of the DelBss |
| 3321 | // No need to configure offload if host was not suspended |
| 3322 | spin_lock(&pHddCtx->filter_lock); |
| 3323 | if(pHddCtx->hdd_wlan_suspended) |
| 3324 | { |
| 3325 | spin_unlock(&pHddCtx->filter_lock); |
| 3326 | hdd_ReConfigSuspendDataClearedDuringRoaming(pHddCtx); |
| 3327 | } |
| 3328 | else |
| 3329 | { |
| 3330 | spin_unlock(&pHddCtx->filter_lock); |
| 3331 | } |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 3332 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 3333 | { |
| 3334 | vos_record_roam_event(e_HDD_SET_GTK_RSP, NULL, 0); |
| 3335 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3336 | } |
| 3337 | else |
| 3338 | { |
| 3339 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3340 | pHddStaCtx->conn_info.staId[ 0 ]); |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3341 | |
| 3342 | /* In case of OSEN move TL to 'Authenticated' after PTK is set */ |
| 3343 | if (pWextState->roamProfile.bOSENAssociation == VOS_TRUE) |
| 3344 | { |
| 3345 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "PTK set" |
| 3346 | " for StaId=%d. Due to OSEN, Changing TL state to" |
| 3347 | "AUTHENTICATED from state:%d", |
| 3348 | pHddStaCtx->conn_info.staId[0], prevTLState); |
| 3349 | |
| 3350 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 3351 | pHddStaCtx->conn_info.staId[ 0 ], |
| 3352 | WLANTL_STA_AUTHENTICATED ); |
| 3353 | |
| 3354 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 3355 | |
| 3356 | if (WLANTL_STA_AUTHENTICATED != prevTLState) |
| 3357 | hdd_postTLPacketPendingInd(pAdapter, |
| 3358 | pHddStaCtx->conn_info.staId[0]); |
| 3359 | } |
| 3360 | |
| 3361 | |
| 3362 | |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 3363 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 3364 | { |
| 3365 | vos_record_roam_event(e_HDD_SET_PTK_RSP, (void *)pRoamInfo->peerMac, 6); |
| 3366 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3367 | } |
| 3368 | |
| 3369 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3370 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3371 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3372 | else |
| 3373 | { |
| 3374 | // possible disassoc after issuing set key and waiting set key complete |
| 3375 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3376 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3377 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3378 | EXIT(); |
| 3379 | return( eHAL_STATUS_SUCCESS ); |
| 3380 | } |
| 3381 | /**============================================================================ |
| 3382 | * |
| 3383 | @brief hdd_RoamMicErrorIndicationHandler() - This function indicates the Mic failure to the supplicant. |
| 3384 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3385 | static eHalStatus hdd_RoamMicErrorIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3386 | tANI_U32 roamId, eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3387 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3388 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3389 | |
| 3390 | if( eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3391 | TKIP_COUNTER_MEASURE_STOPED == pHddStaCtx->WextState.mTKIPCounterMeasures ) |
| 3392 | { |
| 3393 | struct iw_michaelmicfailure msg; |
| 3394 | union iwreq_data wreq; |
| 3395 | memset(&msg, '\0', sizeof(msg)); |
| 3396 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3397 | 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] | 3398 | hddLog(LOG1, "MIC MAC " MAC_ADDRESS_STR, |
| 3399 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3400 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3401 | if(pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) |
| 3402 | msg.flags = IW_MICFAILURE_GROUP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3403 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3404 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3405 | memset(&wreq, 0, sizeof(wreq)); |
| 3406 | wreq.data.length = sizeof(msg); |
| 3407 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, (char *)&msg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3408 | /* inform mic failure to nl80211 */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3409 | cfg80211_michael_mic_failure(pAdapter->dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3410 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3411 | ((pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) ? |
| 3412 | NL80211_KEYTYPE_GROUP : |
| 3413 | NL80211_KEYTYPE_PAIRWISE), |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3414 | pRoamInfo->u.pMICFailureInfo->keyId, |
| 3415 | pRoamInfo->u.pMICFailureInfo->TSC, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3416 | GFP_KERNEL); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3417 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3418 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3419 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3420 | return( eHAL_STATUS_SUCCESS ); |
| 3421 | } |
| 3422 | |
| 3423 | /**============================================================================ |
| 3424 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3425 | @brief roamRoamConnectStatusUpdateHandler() - The Ibss connection status is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3426 | updated regularly here in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3427 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3428 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3429 | static eHalStatus roamRoamConnectStatusUpdateHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 3430 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3431 | eCsrRoamResult roamResult ) |
| 3432 | { |
| 3433 | VOS_STATUS vosStatus; |
| 3434 | |
| 3435 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3436 | switch( roamResult ) |
| 3437 | { |
| 3438 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3439 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3440 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3441 | struct station_info *staInfo; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3442 | |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 3443 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3444 | "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] | 3445 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 3446 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3447 | pRoamInfo->staId ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3448 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3449 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3450 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3451 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
| 3452 | WLANTL_UpdateSTABssIdforIBSS(pHddCtx->pvosContext, |
| 3453 | IBSS_BROADCAST_STAID,pHddStaCtx->conn_info.bssId); |
| 3454 | |
| 3455 | // Register the Station with TL for the new peer. |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3456 | vosStatus = hdd_ibss_RegisterSTA( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3457 | pRoamInfo, |
| 3458 | pRoamInfo->staId, |
| 3459 | (v_MACADDR_t *)pRoamInfo->peerMac, |
| 3460 | pRoamInfo->pBssDesc ); |
| 3461 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3462 | { |
| 3463 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3464 | "Cannot register STA with TL for IBSS. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3465 | vosStatus, vosStatus ); |
| 3466 | } |
Abhishek Singh | decf1b6 | 2016-02-09 11:53:58 +0530 | [diff] [blame] | 3467 | if (!roamSaveIbssStation(pAdapter, |
| 3468 | pRoamInfo->staId, |
| 3469 | (v_MACADDR_t *)pRoamInfo->peerMac)) |
| 3470 | { |
| 3471 | hddLog(LOGW, FL("Not Able to add sta in sta hash")); |
| 3472 | break; |
| 3473 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3474 | pHddStaCtx->ibss_sta_generation++; |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3475 | |
| 3476 | staInfo = vos_mem_malloc(sizeof(*staInfo)); |
| 3477 | if (staInfo == NULL) { |
| 3478 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3479 | "memory allocation for station_info failed"); |
| 3480 | return eHAL_STATUS_FAILED_ALLOC; |
| 3481 | } |
| 3482 | |
| 3483 | memset(staInfo, 0, sizeof(*staInfo)); |
| 3484 | staInfo->filled = 0; |
| 3485 | staInfo->generation = pHddStaCtx->ibss_sta_generation; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3486 | |
| 3487 | cfg80211_new_sta(pAdapter->dev, |
| 3488 | (const u8 *)pRoamInfo->peerMac, |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3489 | staInfo, GFP_KERNEL); |
| 3490 | vos_mem_free(staInfo); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3491 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3492 | if ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 3493 | ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 3494 | ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType |
| 3495 | ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType ) |
| 3496 | { |
| 3497 | pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX; |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3498 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3499 | memcpy(&pHddStaCtx->ibss_enc_key.peerMac, |
| 3500 | pRoamInfo->peerMac, WNI_CFG_BSSID_LEN); |
| 3501 | |
| 3502 | VOS_TRACE( VOS_MODULE_ID_HDD, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3503 | VOS_TRACE_LEVEL_INFO_HIGH, "New peer joined set PTK encType=%d", |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3504 | pHddStaCtx->ibss_enc_key.encType); |
| 3505 | |
| 3506 | vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3507 | pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId ); |
| 3508 | |
| 3509 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 3510 | { |
| 3511 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3512 | "%s: sme_RoamSetKey failed, returned %d", |
| 3513 | __func__, vosStatus); |
| 3514 | return VOS_STATUS_E_FAILURE; |
| 3515 | } |
| 3516 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3517 | netif_carrier_on(pAdapter->dev); |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 3518 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3519 | netif_tx_start_all_queues(pAdapter->dev); |
| 3520 | break; |
| 3521 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3522 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3523 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3524 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3525 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3526 | roamIbssConnectHandler( pAdapter, pRoamInfo ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3527 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3528 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3529 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3530 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3531 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3532 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3533 | |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3534 | if ( !roamRemoveIbssStation(pAdapter, pRoamInfo->staId ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3535 | { |
| 3536 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 3537 | "IBSS peer departed by cannot find peer in our registration table with TL" ); |
| 3538 | } |
| 3539 | |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 3540 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3541 | "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] | 3542 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 3543 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
| 3544 | pRoamInfo->staId ); |
| 3545 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3546 | hdd_ibss_DeregisterSTA( pAdapter, pRoamInfo->staId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3547 | |
| 3548 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3549 | pHddStaCtx->ibss_sta_generation++; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3550 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3551 | cfg80211_del_sta(pAdapter->dev, |
| 3552 | (const u8 *)&pRoamInfo->peerMac, |
| 3553 | GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3554 | break; |
| 3555 | } |
| 3556 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3557 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3558 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 3559 | "Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3560 | // Stop only when we are inactive |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 3561 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3562 | netif_tx_disable(pAdapter->dev); |
| 3563 | netif_carrier_off(pAdapter->dev); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 3564 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3565 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 3566 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3567 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_NotConnected ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3569 | // Send the bssid address to the wext. |
| 3570 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
| 3571 | // clean up data path |
| 3572 | hdd_disconnect_tx_rx(pAdapter); |
| 3573 | break; |
| 3574 | } |
| 3575 | default: |
| 3576 | break; |
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 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3579 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3580 | return( eHAL_STATUS_SUCCESS ); |
| 3581 | } |
| 3582 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3583 | #ifdef FEATURE_WLAN_TDLS |
| 3584 | /**============================================================================ |
| 3585 | * |
| 3586 | @brief hdd_roamRegisterTDLSSTA() - Construct the staDesc and register with |
| 3587 | TL the new STA. This is called as part of ADD_STA in the TDLS setup |
| 3588 | Return: VOS_STATUS |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3589 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3590 | ===========================================================================*/ |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 3591 | VOS_STATUS hdd_roamRegisterTDLSSTA(hdd_adapter_t *pAdapter, |
| 3592 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 3593 | const tANI_U8 *peerMac, |
| 3594 | #else |
| 3595 | tANI_U8 *peerMac, |
| 3596 | #endif |
| 3597 | tANI_U16 staId, tANI_U8 ucastSig) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3598 | { |
| 3599 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3600 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3601 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 3602 | WLAN_STADescType staDesc = {0}; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3603 | eCsrEncryptionType connectedCipherAlgo = eCSR_ENCRYPT_TYPE_UNKNOWN; |
| 3604 | v_BOOL_t fConnected = FALSE; |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 3605 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3606 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3607 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3608 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 3609 | if (!fConnected) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3610 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3611 | "%s not connected. ignored", __func__); |
| 3612 | return VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3613 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3614 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3615 | /* |
| 3616 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3617 | * be peer MAC, here we are wokrking on direct Link |
| 3618 | */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3619 | staDesc.ucSTAId = staId ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3620 | |
| 3621 | staDesc.wSTAType = WLAN_STA_TDLS ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3622 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3623 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3624 | sizeof(tSirMacAddr) ); |
| 3625 | |
| 3626 | vos_mem_copy(staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 ); |
| 3627 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 3628 | |
| 3629 | /* set the QoS field appropriately ..*/ |
| 3630 | (hdd_wmm_is_active(pAdapter)) ? (staDesc.ucQosEnabled = 1) |
| 3631 | : (staDesc.ucQosEnabled = 0) ; |
| 3632 | |
| 3633 | 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] | 3634 | TL QoS_enabled=%d", staDesc.ucQosEnabled ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3635 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3636 | staDesc.ucProtectedFrame = (connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3637 | |
| 3638 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3639 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3640 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3641 | /* |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3642 | * UMA is ready we inform TL to do frame translation. |
| 3643 | */ |
| 3644 | staDesc.ucSwFrameTXXlation = 1; |
| 3645 | staDesc.ucSwFrameRXXlation = 1; |
| 3646 | staDesc.ucAddRmvLLC = 1; |
| 3647 | |
| 3648 | /* Initialize signatures and state */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3649 | staDesc.ucUcastSig = ucastSig ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3650 | |
| 3651 | /* tdls Direct Link do not need bcastSig */ |
| 3652 | staDesc.ucBcastSig = 0 ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3653 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3654 | if(staDesc.ucProtectedFrame) |
| 3655 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 3656 | else |
| 3657 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3658 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3659 | staDesc.ucInitState = WLANTL_STA_CONNECTED ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3660 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3661 | /* Register the Station with TL... */ |
| 3662 | vosStatus = WLANTL_RegisterSTAClient( pVosContext, |
| 3663 | hdd_rx_packet_cbk, |
| 3664 | hdd_tx_complete_cbk, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3665 | hdd_tx_fetch_packet_cbk, &staDesc, 0 ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3666 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3667 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3668 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3669 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3670 | "%s: WLANTL_RegisterSTAClient() failed to register. " |
| 3671 | "Status= %d [0x%08X]", __func__, vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3672 | return vosStatus; |
| 3673 | } |
| 3674 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 3675 | if ( cfg_param->dynSplitscan && |
| 3676 | ( VOS_TIMER_STATE_RUNNING != |
| 3677 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)) ) |
| 3678 | { |
| 3679 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 3680 | cfg_param->trafficMntrTmrForSplitScan); |
| 3681 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3682 | return( vosStatus ); |
| 3683 | } |
| 3684 | |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 3685 | VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 3686 | { |
| 3687 | VOS_STATUS vosStatus; |
| 3688 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 3689 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3690 | { |
| 3691 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 3692 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3693 | "Status= %d [0x%08X]", |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 3694 | __func__, staId, vosStatus, vosStatus ); |
| 3695 | } |
| 3696 | return( vosStatus ); |
| 3697 | } |
| 3698 | |
| 3699 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3700 | /* |
| 3701 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3702 | * TL in case of new TDLS client is added and deregistration at the time |
| 3703 | * TDLS client is deleted. |
| 3704 | */ |
| 3705 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3706 | eHalStatus hdd_RoamTdlsStatusUpdateHandler(hdd_adapter_t *pAdapter, |
| 3707 | tCsrRoamInfo *pRoamInfo, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3708 | tANI_U32 roamId, |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3709 | eRoamCmdStatus roamStatus, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3710 | eCsrRoamResult roamResult) |
| 3711 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3712 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3713 | eHalStatus status = eHAL_STATUS_FAILURE ; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3714 | tANI_U8 staIdx; |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 3715 | |
Kaushik, Sushant | 8489f47 | 2014-01-27 11:41:22 +0530 | [diff] [blame] | 3716 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3717 | ("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR), |
| 3718 | roamResult == eCSR_ROAM_RESULT_ADD_TDLS_PEER ? |
| 3719 | "ADD_TDLS_PEER" : |
| 3720 | roamResult == eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? |
| 3721 | "DEL_TDLS_PEER" : |
| 3722 | roamResult == eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? |
| 3723 | "DEL_TDLS_PEER_IND" : |
| 3724 | roamResult == eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3725 | "DEL_ALL_TDLS_PEER_IND" : |
| 3726 | roamResult == eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? |
| 3727 | "UPDATE_TDLS_PEER" : |
| 3728 | roamResult == eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3729 | "LINK_ESTABLISH_REQ_RSP" : |
| 3730 | roamResult == eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP ? |
| 3731 | "CHANNEL_SWITCH_REQ_RSP" : "UNKNOWN", |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3732 | pRoamInfo->staId, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3733 | switch( roamResult ) |
| 3734 | { |
| 3735 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3736 | { |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3737 | if(eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3738 | { |
Masti, Narayanraddi | 83dbfc2 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 3739 | hddTdlsPeer_t *curr_peer; |
| 3740 | |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3741 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3742 | ("%s: Add Sta is failed. %d"),__func__, pRoamInfo->statusCode); |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 3743 | wlan_hdd_tdls_check_bmps(pAdapter); |
Masti, Narayanraddi | 83dbfc2 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 3744 | |
| 3745 | mutex_lock(&pHddCtx->tdls_lock); |
| 3746 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3747 | pRoamInfo->peerMac, FALSE); |
| 3748 | if (NULL != curr_peer) |
| 3749 | curr_peer->link_status = eTDLS_LINK_TEARING; |
| 3750 | else |
| 3751 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3752 | "%s %d curr_peer is Null", __func__,__LINE__); |
| 3753 | mutex_unlock(&pHddCtx->tdls_lock); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3754 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3755 | else |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3756 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3757 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3758 | /* check if there is available index for this new TDLS STA */ |
| 3759 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
| 3760 | { |
| 3761 | if (0 == pHddCtx->tdlsConnInfo[staIdx].staId ) |
| 3762 | { |
| 3763 | pHddCtx->tdlsConnInfo[staIdx].sessionId = pRoamInfo->sessionId; |
| 3764 | pHddCtx->tdlsConnInfo[staIdx].staId = pRoamInfo->staId; |
| 3765 | |
| 3766 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3767 | ("TDLS: STA IDX at %d is %d " |
| 3768 | "of mac " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3769 | staIdx, pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3770 | MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3771 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3772 | vos_copy_macaddr(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3773 | (v_MACADDR_t *)pRoamInfo->peerMac) ; |
| 3774 | status = eHAL_STATUS_SUCCESS ; |
| 3775 | break ; |
| 3776 | } |
| 3777 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3778 | if (staIdx < HDD_MAX_NUM_TDLS_STA) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3779 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3780 | 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] | 3781 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3782 | "wlan_hdd_tdls_set_sta_id() failed"); |
| 3783 | return VOS_FALSE; |
| 3784 | } |
| 3785 | |
| 3786 | (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3787 | /* store the ucast signature , if required for further reference. */ |
| 3788 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3789 | wlan_hdd_tdls_set_signature( pAdapter, pRoamInfo->peerMac, pRoamInfo->ucastSig ); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3790 | /* start TDLS client registration with TL */ |
| 3791 | status = hdd_roamRegisterTDLSSTA( pAdapter, |
| 3792 | pRoamInfo->peerMac, |
| 3793 | pRoamInfo->staId, |
| 3794 | pRoamInfo->ucastSig); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3795 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3796 | } |
| 3797 | else |
| 3798 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3799 | status = eHAL_STATUS_FAILURE; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3800 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3801 | "%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] | 3802 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3803 | pAdapter->tdlsAddStaStatus = status; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3804 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3805 | complete(&pAdapter->tdls_add_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3806 | break ; |
| 3807 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3808 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3809 | { |
| 3810 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3811 | { |
| 3812 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3813 | "%s: Add Sta is failed. %d", __func__, pRoamInfo->statusCode); |
| 3814 | } |
| 3815 | /* store the ucast signature which will be used later when |
| 3816 | * registering to TL |
| 3817 | */ |
| 3818 | pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode; |
| 3819 | complete(&pAdapter->tdls_add_station_comp); |
| 3820 | break; |
| 3821 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3822 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3823 | { |
| 3824 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3825 | { |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3826 | hddTdlsPeer_t *curr_peer; |
| 3827 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3828 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3829 | "%s: Link Establish Request failed. %d", __func__, pRoamInfo->statusCode); |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3830 | |
| 3831 | mutex_lock(&pHddCtx->tdls_lock); |
| 3832 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3833 | pRoamInfo->peerMac, FALSE); |
| 3834 | if (curr_peer) |
| 3835 | curr_peer->link_status = eTDLS_LINK_TEARING; |
| 3836 | else |
| 3837 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3838 | "%s %d curr_peer is Null",__func__,__LINE__); |
| 3839 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3840 | } |
| 3841 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3842 | break; |
| 3843 | } |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3844 | case eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP: |
| 3845 | { |
| 3846 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3847 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3848 | "%s: Channel switch request failed. %d", __func__, |
| 3849 | pRoamInfo->statusCode); |
| 3850 | else |
| 3851 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3852 | "%s: Channel switch request Success", __func__); |
| 3853 | break; |
| 3854 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3855 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3856 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3857 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3858 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3859 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3860 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 3861 | pRoamInfo->staId == pHddCtx->tdlsConnInfo[staIdx].staId) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3862 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3863 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3864 | ("HDD: del STA IDX = %x"), pRoamInfo->staId) ; |
| 3865 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3866 | mutex_lock(&pHddCtx->tdls_lock); |
| 3867 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3868 | pRoamInfo->peerMac, FALSE); |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3869 | if (NULL != curr_peer) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3870 | { |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3871 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3872 | " Current status for peer" MAC_ADDRESS_STR "is %d", |
| 3873 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), curr_peer->link_status); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3874 | if (TDLS_IS_CONNECTED(curr_peer) || |
| 3875 | (eTDLS_LINK_CONNECTING == curr_peer->link_status)) |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3876 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3877 | mutex_unlock(&pHddCtx->tdls_lock); |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3878 | hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId ); |
| 3879 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3880 | else |
| 3881 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3882 | |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3883 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3884 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3885 | else |
| 3886 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3887 | |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3888 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3889 | wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3890 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3891 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3892 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 3893 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
| 3894 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3895 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3896 | wlan_hdd_tdls_check_bmps(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3897 | status = eHAL_STATUS_SUCCESS ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3898 | break ; |
| 3899 | } |
| 3900 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3901 | complete(&pAdapter->tdls_del_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3902 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3903 | break ; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3904 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 3905 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3906 | hddTdlsPeer_t *curr_peer; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3907 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3908 | "%s: Sending teardown to supplicant with reason code %u", |
| 3909 | __func__, pRoamInfo->reasonCode); |
| 3910 | |
| 3911 | #ifdef CONFIG_TDLS_IMPLICIT |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3912 | mutex_lock(&pHddCtx->tdls_lock); |
| 3913 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, |
| 3914 | FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3915 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, pRoamInfo->reasonCode); |
Abhishek Singh | 9656892 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 3916 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 3917 | curr_peer->peerMac); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3918 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3919 | #endif |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3920 | status = eHAL_STATUS_SUCCESS ; |
| 3921 | break ; |
| 3922 | } |
| 3923 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 3924 | { |
| 3925 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3926 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3927 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3928 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 3929 | pHddCtx->tdlsConnInfo[staIdx].staId) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3930 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3931 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3932 | ("hdd_tdlsStatusUpdate: staIdx %d " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3933 | pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3934 | MAC_ADDR_ARRAY(pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes)); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3935 | |
| 3936 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3937 | wlan_hdd_tdls_reset_peer(pAdapter, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3938 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3939 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3940 | hdd_roamDeregisterTDLSSTA ( pAdapter, pHddCtx->tdlsConnInfo[staIdx].staId ); |
| 3941 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3942 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3943 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3944 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3945 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 3946 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3947 | |
| 3948 | status = eHAL_STATUS_SUCCESS ; |
| 3949 | } |
| 3950 | } |
Gopichand Nakkala | 40ab275 | 2013-04-04 20:11:36 +0530 | [diff] [blame] | 3951 | wlan_hdd_tdls_check_bmps(pAdapter); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3952 | break ; |
| 3953 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3954 | default: |
| 3955 | { |
| 3956 | break ; |
| 3957 | } |
| 3958 | } |
| 3959 | |
| 3960 | return status ; |
| 3961 | } |
| 3962 | #endif |
| 3963 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 3964 | void iw_full_power_cbfn (void *pContext, eHalStatus status) |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3965 | { |
| 3966 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
| 3967 | hdd_context_t *pHddCtx = NULL; |
| 3968 | int ret; |
| 3969 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3970 | ENTER(); |
| 3971 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3972 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 3973 | { |
| 3974 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 3975 | "%s: Bad param, pAdapter [%pK]", |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3976 | __func__, pAdapter); |
| 3977 | return; |
| 3978 | } |
| 3979 | |
| 3980 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3981 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3982 | if (0 != ret) |
| 3983 | { |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3984 | return; |
| 3985 | } |
| 3986 | |
| 3987 | if (pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 3988 | { |
| 3989 | sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), NULL, NULL); |
| 3990 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3991 | |
| 3992 | EXIT(); |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3993 | } |
| 3994 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3995 | eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3996 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
| 3997 | { |
| 3998 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 3999 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 4000 | hdd_wext_state_t *pWextState = NULL; |
| 4001 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4002 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4003 | struct cfg80211_bss *bss_status; |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 4004 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4005 | |
| 4006 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4007 | "CSR Callback: status= %d result= %d roamID=%d", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4008 | roamStatus, roamResult, roamId ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4009 | |
| 4010 | /*Sanity check*/ |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 4011 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4012 | { |
| 4013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 4014 | "invalid adapter or adapter has invalid magic"); |
| 4015 | return eHAL_STATUS_FAILURE; |
| 4016 | } |
| 4017 | |
| 4018 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4019 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4020 | |
| 4021 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 4022 | { |
| 4023 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4024 | "invalid WEXT state or HDD station context"); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4025 | return eHAL_STATUS_FAILURE; |
| 4026 | } |
| 4027 | |
Konamki, Sreelakshmi | b9c4571 | 2015-07-29 11:48:19 +0530 | [diff] [blame] | 4028 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 4029 | pAdapter->sessionId, roamStatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4030 | switch( roamStatus ) |
| 4031 | { |
| 4032 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 41d95e2 | 2015-08-28 12:51:32 +0530 | [diff] [blame] | 4033 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4034 | complete(&pAdapter->session_open_comp_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4035 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4036 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4037 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
| 4038 | /* We did pre-auth,then we attempted a 11r or ese reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4039 | * reassoc failed due to failure, timeout, reject from ap |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4040 | * in any case tell the OS, our carrier is off and mark |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4041 | * interface down */ |
| 4042 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 4043 | hddLog(LOGE, FL("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d"), |
| 4044 | roamStatus, roamResult, pAdapter->sessionId); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 4045 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4046 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4047 | /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */ |
| 4048 | if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4049 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 4050 | } |
| 4051 | pHddStaCtx->ft_carrier_on = FALSE; |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 4052 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4053 | break; |
| 4054 | |
| 4055 | case eCSR_ROAM_FT_START: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4056 | // When we roam for EsE and 11r, we dont want the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4057 | // OS to be informed that the link is down. So mark |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4058 | // the link ready for ft_start. After this the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4059 | // eCSR_ROAM_SHOULD_ROAM will be received. |
| 4060 | // Where in we will not mark the link down |
| 4061 | // Also we want to stop tx at this point when we will be |
| 4062 | // doing disassoc at this time. This saves 30-60 msec |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4063 | // after reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4064 | { |
| 4065 | struct net_device *dev = pAdapter->dev; |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 4066 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4067 | netif_tx_disable(dev); |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 4068 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4069 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 4070 | { |
| 4071 | vos_record_roam_event(e_HDD_DISABLE_TX_QUEUE, NULL, 0); |
| 4072 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4073 | /* |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4074 | * Deregister this STA with TL, but do not flush the packets |
| 4075 | * for this STA from wmm_tx_queue. Since there is no valid STA |
| 4076 | * for these packets they will not be transmitted. Eventually |
| 4077 | * after the reassociation is successful, these packets will be |
| 4078 | * transmitted after registering STA with TL again. This ensures |
| 4079 | * that driver does not drop packets during roaming. |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 4080 | */ |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4081 | status = WLANTL_ClearSTAClient(pHddCtx->pvosContext, |
| 4082 | pHddStaCtx->conn_info.staId[0]); |
| 4083 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4084 | { |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4085 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4086 | FL("WLANTL_ClearSTAClient failed for staID %d." |
| 4087 | "Status= %d [0x%x]"), pHddStaCtx->conn_info.staId[0], |
| 4088 | status, status); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4089 | halStatus = eHAL_STATUS_FAILURE; |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 4090 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4091 | } |
| 4092 | pHddStaCtx->ft_carrier_on = TRUE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4093 | pHddStaCtx->hdd_ReassocScenario = VOS_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4094 | break; |
| 4095 | #endif |
| 4096 | |
| 4097 | case eCSR_ROAM_SHOULD_ROAM: |
| 4098 | // Dont need to do anything |
| 4099 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4100 | struct net_device *dev = pAdapter->dev; |
| 4101 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4102 | // notify apps that we can't pass traffic anymore |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 4103 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4104 | netif_tx_disable(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4105 | #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] | 4106 | if (pHddStaCtx->ft_carrier_on == FALSE) |
| 4107 | { |
| 4108 | #endif |
| 4109 | netif_carrier_off(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4110 | #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] | 4111 | } |
| 4112 | #endif |
| 4113 | |
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 | //We should clear all sta register with TL, for now, only one. |
| 4116 | status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] ); |
| 4117 | if ( !VOS_IS_STATUS_SUCCESS(status ) ) |
| 4118 | { |
| 4119 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4120 | FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"), |
| 4121 | pHddStaCtx->conn_info.staId[0], status, status ); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4122 | halStatus = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4123 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4124 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4125 | } |
| 4126 | break; |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 4127 | case eCSR_ROAM_LOSTLINK_DETECTED: |
| 4128 | { |
| 4129 | if (wlan_hdd_check_and_stop_mon(pAdapter, false)) |
| 4130 | halStatus = eHAL_STATUS_FAILURE; |
| 4131 | } |
| 4132 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4133 | case eCSR_ROAM_LOSTLINK: |
| 4134 | case eCSR_ROAM_DISASSOCIATED: |
| 4135 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4136 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4137 | "****eCSR_ROAM_DISASSOCIATED****"); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 4138 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4139 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4140 | /* 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] | 4141 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4142 | if (pHddCtx->hdd_mcastbcast_filter_set == TRUE) |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4143 | { |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 4144 | hdd_conf_mcastbcast_filter(pHddCtx, FALSE); |
Amar Singhal | f8ba2b8 | 2013-12-02 12:54:38 -0800 | [diff] [blame] | 4145 | |
| 4146 | if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) { |
| 4147 | pHddCtx->configuredMcastBcastFilter = |
| 4148 | pHddCtx->sus_res_mcastbcast_filter; |
| 4149 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_FALSE; |
| 4150 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4151 | |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 4152 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4153 | "offload: disassociation happening, restoring configuredMcastBcastFilter"); |
| 4154 | hddLog(VOS_TRACE_LEVEL_INFO,"McastBcastFilter = %d", |
| 4155 | pHddCtx->configuredMcastBcastFilter); |
| 4156 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4157 | "offload: already called mcastbcast filter"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4158 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 4159 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4160 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4161 | /* Call to clear any MC Addr List filter applied after |
| 4162 | * successful connection. |
| 4163 | */ |
| 4164 | wlan_hdd_set_mc_addr_list(pAdapter, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4165 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4166 | } |
| 4167 | break; |
| 4168 | case eCSR_ROAM_IBSS_LEAVE: |
| 4169 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4170 | "****eCSR_ROAM_IBSS_LEAVE****"); |
| 4171 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4172 | break; |
| 4173 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
| 4174 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4175 | "****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4176 | // To Do - address probable memory leak with WEP encryption upon successful association |
| 4177 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4178 | { |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4179 | //Clear saved connection information in HDD |
| 4180 | hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4181 | } |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4182 | halStatus = hdd_AssociationCompletionHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4183 | |
| 4184 | break; |
| 4185 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4186 | halStatus = hdd_AssociationCompletionHandler( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4187 | pRoamInfo, roamId, roamStatus, roamResult ); |
| 4188 | break; |
| 4189 | case eCSR_ROAM_IBSS_IND: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 4190 | hdd_RoamIbssIndicationHandler( pAdapter, pRoamInfo, roamId, |
| 4191 | roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4192 | break; |
| 4193 | |
| 4194 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
| 4195 | halStatus = roamRoamConnectStatusUpdateHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4196 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4197 | |
| 4198 | case eCSR_ROAM_MIC_ERROR_IND: |
| 4199 | halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4200 | break; |
Sachin Ahuja | 3d47fcd | 2015-08-28 16:02:06 +0530 | [diff] [blame] | 4201 | case eCSR_ROAM_LOST_LINK_PARAMS_IND: |
| 4202 | { |
| 4203 | /* |
| 4204 | * The RSSI will be subtracted from 100 as FW is sending the RSSI by |
| 4205 | * adding the 100 value. |
| 4206 | */ |
| 4207 | pAdapter->rssi_on_disconnect = pRoamInfo->u.pLostLinkParams->rssi - 100; |
| 4208 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4209 | "%s : Rssi on Disconnect : %d", |
| 4210 | __func__, pAdapter->rssi_on_disconnect); |
| 4211 | break; |
| 4212 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4213 | case eCSR_ROAM_SET_KEY_COMPLETE: |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4214 | { |
| 4215 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 4216 | |
| 4217 | if((pHddCtx) && |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4218 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4219 | ((eCSR_ROAM_RESULT_NONE == roamResult)|| |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4220 | (pRoamInfo && pRoamInfo->is11rAssoc))) |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4221 | { |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 4222 | /* Send DTIM period to the FW; only if the wlan is already |
| 4223 | in suspend. This is the case with roaming (reassoc), |
| 4224 | DELETE_BSS_REQ zeroes out Modulated/Dynamic DTIM sent in |
| 4225 | previous suspend_wlan. Sending SET_POWER_PARAMS_REQ |
| 4226 | before the ENTER_BMPS_REQ ensures Listen Interval is |
| 4227 | regained back to LI * Modulated DTIM */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4228 | hdd_set_pwrparams(pHddCtx); |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4229 | |
| 4230 | /* At this point, device should not be in BMPS; |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 4231 | if due to unexpected scenario, if we are in BMPS, |
| 4232 | then trigger Exit and Enter BMPS to take DTIM period |
| 4233 | effective */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4234 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) |
| 4235 | { |
| 4236 | hddLog( LOGE, FL("Not expected: device is already in BMPS mode, Exit & Enter BMPS again!")); |
| 4237 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 4238 | sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4239 | iw_full_power_cbfn, pAdapter, |
| 4240 | eSME_FULL_PWR_NEEDED_BY_HDD); |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4241 | } |
| 4242 | } |
Padma, Santhosh Kumar | a4c3457 | 2015-07-09 20:00:41 +0530 | [diff] [blame] | 4243 | |
| 4244 | if ((pHddCtx) && |
Padma, Santhosh Kumar | 0a623eb | 2015-07-27 11:55:29 +0530 | [diff] [blame] | 4245 | (FULL_POWER == pmcGetPmcState(pHddCtx->hHal)) && |
| 4246 | (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) && |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4247 | ((eCSR_ROAM_RESULT_NONE == roamResult) || |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4248 | (pRoamInfo && pRoamInfo->is11rAssoc))) |
Padma, Santhosh Kumar | a4c3457 | 2015-07-09 20:00:41 +0530 | [diff] [blame] | 4249 | { |
| 4250 | hddLog( LOG1, FL("Device in full power." |
| 4251 | "Stop and start traffic timer for roaming")); |
| 4252 | pmcStopTrafficTimer(pHddCtx->hHal); |
| 4253 | if (pmcStartTrafficTimer(pHddCtx->hHal, |
| 4254 | TRAFFIC_TIMER_ROAMING) != eHAL_STATUS_SUCCESS) |
| 4255 | { |
| 4256 | hddLog(LOGP, FL("Cannot start traffic timer")); |
| 4257 | } |
| 4258 | } |
| 4259 | |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4260 | halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4261 | if ((eCSR_ROAM_RESULT_NONE == roamResult) || |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4262 | (pRoamInfo && pRoamInfo->is11rAssoc)) |
Padma, Santhosh Kumar | 0a623eb | 2015-07-27 11:55:29 +0530 | [diff] [blame] | 4263 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4264 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4265 | break; |
| 4266 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4267 | case eCSR_ROAM_FT_RESPONSE: |
| 4268 | hdd_SendFTEvent(pAdapter); |
| 4269 | break; |
| 4270 | #endif |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4271 | #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] | 4272 | case eCSR_ROAM_PMK_NOTIFY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4273 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4274 | { |
| 4275 | /* Notify the supplicant of a new candidate */ |
| 4276 | halStatus = wlan_hdd_cfg80211_pmksa_candidate_notify(pAdapter, pRoamInfo, 1, false); |
| 4277 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4278 | break; |
| 4279 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4280 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 4281 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4282 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 4283 | /* This event is to notify pre-auth initiation */ |
| 4284 | if (VOS_STATUS_SUCCESS != |
| 4285 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, pRoamInfo)) |
| 4286 | { |
| 4287 | halStatus = eHAL_STATUS_FAILURE; |
| 4288 | } |
| 4289 | break; |
| 4290 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 4291 | /* This event will notify pre-auth completion in case of success */ |
| 4292 | if (VOS_STATUS_SUCCESS != |
| 4293 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4294 | pRoamInfo, 1)) |
| 4295 | { |
| 4296 | halStatus = eHAL_STATUS_FAILURE; |
| 4297 | } |
| 4298 | break; |
| 4299 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 4300 | /* This event will notify pre-auth completion in case of failure. */ |
| 4301 | if (VOS_STATUS_SUCCESS != |
| 4302 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4303 | pRoamInfo, 0)) |
| 4304 | { |
| 4305 | halStatus = eHAL_STATUS_FAILURE; |
| 4306 | } |
| 4307 | break; |
| 4308 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 4309 | /* This event is to notify handover success. |
| 4310 | It will be only invoked on success */ |
| 4311 | if (VOS_STATUS_SUCCESS != |
| 4312 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, pRoamInfo)) |
| 4313 | { |
| 4314 | halStatus = eHAL_STATUS_FAILURE; |
| 4315 | } |
| 4316 | break; |
| 4317 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4318 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 4319 | hdd_remainChanReadyHandler( pAdapter ); |
| 4320 | break; |
| 4321 | case eCSR_ROAM_SEND_ACTION_CNF: |
| 4322 | hdd_sendActionCnf( pAdapter, |
| 4323 | (roamResult == eCSR_ROAM_RESULT_NONE) ? TRUE : FALSE ); |
| 4324 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4325 | #ifdef FEATURE_WLAN_TDLS |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 4326 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 4327 | halStatus = hdd_RoamTdlsStatusUpdateHandler( pAdapter, pRoamInfo, |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 4328 | roamId, roamStatus, roamResult ); |
| 4329 | break ; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 4330 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 4331 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, pRoamInfo->reasonCode); |
| 4332 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4333 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4334 | #ifdef WLAN_FEATURE_11W |
| 4335 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 4336 | hdd_indicateUnprotMgmtFrame(pAdapter, pRoamInfo->nFrameLength, |
| 4337 | pRoamInfo->pbFrames, |
| 4338 | pRoamInfo->frameType); |
| 4339 | break; |
| 4340 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4341 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4342 | case eCSR_ROAM_TSM_IE_IND: |
| 4343 | hdd_indicateTsmIe(pAdapter, pRoamInfo->tsmIe.tsid, |
| 4344 | pRoamInfo->tsmIe.state, pRoamInfo->tsmIe.msmt_interval); |
| 4345 | break; |
| 4346 | |
| 4347 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 4348 | { |
| 4349 | if (eCSR_AUTH_TYPE_CCKM_WPA == pHddStaCtx->conn_info.authType || |
| 4350 | eCSR_AUTH_TYPE_CCKM_RSN == pHddStaCtx->conn_info.authType) |
| 4351 | { |
| 4352 | hdd_indicateCckmPreAuth(pAdapter, pRoamInfo); |
| 4353 | } |
| 4354 | break; |
| 4355 | } |
| 4356 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4357 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4358 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4359 | hdd_indicateEseAdjApRepInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4360 | break; |
| 4361 | } |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4362 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4363 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4364 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4365 | hdd_indicateEseBcnReportInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4366 | break; |
| 4367 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4368 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Girish Gowli | a95daca | 2015-02-04 20:31:31 +0530 | [diff] [blame] | 4369 | case eCSR_ROAM_UPDATE_MAX_RATE_IND: |
| 4370 | { |
| 4371 | pAdapter->maxRateFlags = roamResult; |
| 4372 | break; |
| 4373 | } |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4374 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 4375 | if (pRoamInfo && pRoamInfo->pBssDesc) { |
| 4376 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 4377 | pRoamInfo->pBssDesc); |
| 4378 | if (bss_status) |
| 4379 | cfg80211_put_bss( |
| 4380 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 4381 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 4382 | #endif |
| 4383 | bss_status); |
| 4384 | else |
| 4385 | hddLog(LOG1, FL("UPDATE_SCAN_RESULT returned NULL")); |
| 4386 | } |
Abhinav Kumar | 118efd0 | 2019-08-07 16:41:07 +0530 | [diff] [blame] | 4387 | |
| 4388 | case eCSR_ROAM_SAE_COMPUTE: |
| 4389 | if (pRoamInfo) |
| 4390 | wlan_hdd_sae_callback(pAdapter, pRoamInfo); |
| 4391 | break; |
| 4392 | |
Ganesh Kondabattini | 529397f | 2017-12-27 19:13:52 +0530 | [diff] [blame] | 4393 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
| 4394 | { |
| 4395 | hdd_adapter_t *pHostapdAdapter = NULL; |
| 4396 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4397 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4398 | |
| 4399 | if (!pHddCtx || !pHddStaCtx) { |
| 4400 | hddLog(LOG1, FL("Invalid pHddCtx or pHddStaCtx")); |
| 4401 | break; |
| 4402 | } |
| 4403 | |
| 4404 | hddLog(LOG1, FL("eCSR_ROAM_STA_CHANNEL_SWITCH: new channel %hu"), |
| 4405 | pRoamInfo->chan_info.chan_id); |
| 4406 | |
| 4407 | pHddStaCtx->conn_info.operationChannel = |
| 4408 | pRoamInfo->chan_info.chan_id; |
| 4409 | |
| 4410 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 4411 | if (pHostapdAdapter && |
| 4412 | (test_bit(SOFTAP_BSS_STARTED, |
| 4413 | &pHostapdAdapter->event_flags))) |
| 4414 | { |
| 4415 | /* Restart SAP if its operating channel is different |
| 4416 | * from AP channel. |
| 4417 | */ |
| 4418 | hddLog(VOS_TRACE_LEVEL_INFO,"SAP chan %d, STA chan %d, force_scc_with_ecsa %d", |
| 4419 | pHostapdAdapter->sessionCtx.ap.operatingChannel, |
| 4420 | pRoamInfo->chan_info.chan_id, |
| 4421 | pHddCtx->cfg_ini->force_scc_with_ecsa); |
| 4422 | if ((pHddCtx->cfg_ini->force_scc_with_ecsa ) && |
| 4423 | (pHostapdAdapter->sessionCtx.ap.operatingChannel != |
| 4424 | pRoamInfo->chan_info.chan_id)) |
| 4425 | { |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 4426 | schedule_delayed_work(&pHddCtx->ecsa_chan_change_work, 0); |
Ganesh Kondabattini | 529397f | 2017-12-27 19:13:52 +0530 | [diff] [blame] | 4427 | } |
| 4428 | else |
| 4429 | hddLog(LOG1, FL("SAP restart not required")); |
| 4430 | } else |
| 4431 | hddLog(LOG1, FL("SAP not active, nothing to do")); |
| 4432 | } |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4433 | break; |
Girish Gowli | a95daca | 2015-02-04 20:31:31 +0530 | [diff] [blame] | 4434 | default: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4435 | break; |
| 4436 | } |
| 4437 | return( halStatus ); |
| 4438 | } |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 4439 | |
| 4440 | #ifdef WLAN_FEATURE_SAE |
| 4441 | /** |
| 4442 | * hdd_translate_sae_rsn_to_csr_auth() - Translate SAE RSN to CSR auth type |
| 4443 | * @auth_suite: auth suite |
| 4444 | * @auth_type: pointer to eCsrAuthType |
| 4445 | * |
| 4446 | * Return: None |
| 4447 | */ |
| 4448 | static void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4449 | eCsrAuthType *auth_type) |
| 4450 | { |
| 4451 | if (!memcmp(auth_suite, ccp_rsn_oui_80, 4)) |
| 4452 | *auth_type = eCSR_AUTH_TYPE_SAE; |
| 4453 | } |
| 4454 | #else |
| 4455 | static inline |
| 4456 | void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4457 | eCsrAuthType *auth_type) |
| 4458 | { |
| 4459 | } |
| 4460 | #endif |
| 4461 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4462 | eCsrAuthType hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4463 | { |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 4464 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4465 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4466 | if ( memcmp(auth_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4467 | { |
| 4468 | auth_type = eCSR_AUTH_TYPE_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4469 | } else |
| 4470 | if (memcmp(auth_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4471 | { |
| 4472 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4473 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4474 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4475 | if (memcmp(auth_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4476 | { |
| 4477 | // Check for 11r FT Authentication with PSK |
| 4478 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4479 | } else |
| 4480 | if (memcmp(auth_suite , ccpRSNOui03, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4481 | { |
| 4482 | // Check for 11R FT Authentication with 802.1X |
| 4483 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4484 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4485 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4486 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4487 | if (memcmp(auth_suite , ccpRSNOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4488 | { |
| 4489 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 4490 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4491 | #endif /* FEATURE_WLAN_ESE */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4492 | #ifdef WLAN_FEATURE_11W |
| 4493 | if (memcmp(auth_suite , ccpRSNOui07, 4) == 0) |
| 4494 | { |
| 4495 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 4496 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 4497 | if (memcmp(auth_suite , ccpRSNOui08, 4) == 0) |
| 4498 | { |
| 4499 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 4500 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4501 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4502 | { |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 4503 | /* If auth suite is of SAE, auth_type will be |
| 4504 | * overwritten in hdd_translate_sae_rsn_to_csr_auth |
| 4505 | */ |
| 4506 | hdd_translate_sae_rsn_to_csr_auth(auth_suite, &auth_type); |
| 4507 | } |
| 4508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4509 | return auth_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4510 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4511 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4512 | eCsrAuthType |
| 4513 | hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4514 | { |
| 4515 | eCsrAuthType auth_type; |
| 4516 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4517 | if ( memcmp(auth_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4518 | { |
| 4519 | auth_type = eCSR_AUTH_TYPE_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4520 | } else |
| 4521 | if (memcmp(auth_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4522 | { |
| 4523 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4524 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4525 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4526 | if (memcmp(auth_suite , ccpWpaOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4527 | { |
| 4528 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4529 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4530 | #endif /* FEATURE_WLAN_ESE */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4531 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4532 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 4533 | } |
| 4534 | hddLog(LOG1, FL("auth_type: %d"), auth_type); |
| 4535 | return auth_type; |
| 4536 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4537 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4538 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4539 | hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4540 | { |
| 4541 | eCsrEncryptionType cipher_type; |
| 4542 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4543 | if ( memcmp(cipher_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4544 | { |
| 4545 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4546 | } |
| 4547 | else if (memcmp(cipher_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4548 | { |
| 4549 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4550 | } |
| 4551 | else if (memcmp(cipher_suite , ccpRSNOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4552 | { |
| 4553 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4554 | } |
| 4555 | else if (memcmp(cipher_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4556 | { |
| 4557 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4558 | } |
| 4559 | else if (memcmp(cipher_suite , ccpRSNOui05, 4) == 0) |
| 4560 | { |
| 4561 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4562 | } |
| 4563 | else |
| 4564 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4565 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4566 | } |
| 4567 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 4568 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4569 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4570 | /* To find if the MAC address is NULL */ |
| 4571 | static tANI_U8 hdd_IsMACAddrNULL (tANI_U8 *macAddr, tANI_U8 length) |
| 4572 | { |
| 4573 | int i; |
| 4574 | for (i = 0; i < length; i++) |
| 4575 | { |
| 4576 | if (0x00 != (macAddr[i])) |
| 4577 | { |
| 4578 | return FALSE; |
| 4579 | } |
| 4580 | } |
| 4581 | return TRUE; |
| 4582 | } /****** end hdd_IsMACAddrNULL() ******/ |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4583 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4584 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4585 | hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4586 | { |
| 4587 | eCsrEncryptionType cipher_type; |
| 4588 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4589 | if ( memcmp(cipher_suite , ccpWpaOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4590 | { |
| 4591 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4592 | } else |
| 4593 | if (memcmp(cipher_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4594 | { |
| 4595 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4596 | } else |
| 4597 | if (memcmp(cipher_suite , ccpWpaOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4598 | { |
| 4599 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4600 | } else |
| 4601 | if (memcmp(cipher_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4602 | { |
| 4603 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4604 | } else |
| 4605 | if (memcmp(cipher_suite , ccpWpaOui05, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4606 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4607 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4608 | } else |
| 4609 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4610 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4611 | } |
| 4612 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 4613 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4614 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4615 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4616 | static tANI_S32 hdd_ProcessGENIE(hdd_adapter_t *pAdapter, |
| 4617 | struct ether_addr *pBssid, |
| 4618 | eCsrEncryptionType *pEncryptType, |
| 4619 | eCsrEncryptionType *mcEncryptType, |
| 4620 | eCsrAuthType *pAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4621 | #ifdef WLAN_FEATURE_11W |
| 4622 | u_int8_t *pMfpRequired, |
| 4623 | u_int8_t *pMfpCapable, |
| 4624 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4625 | u_int16_t gen_ie_len, |
| 4626 | u_int8_t *gen_ie) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4627 | { |
| 4628 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4629 | eHalStatus result; |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4630 | tDot11fIERSN dot11RSNIE = {0}; |
| 4631 | tDot11fIEWPA dot11WPAIE = {0}; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4632 | tANI_U32 i; |
Ashish Kumar Dhanotiya | ffbfd8c | 2017-11-29 14:04:38 +0530 | [diff] [blame] | 4633 | tANI_U32 status; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4634 | tANI_U8 *pRsnIe; |
| 4635 | tANI_U16 RSNIeLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4636 | tPmkidCacheInfo PMKIDCache[4]; // Local transfer memory |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4637 | v_BOOL_t updatePMKCache = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4638 | |
| 4639 | /* Clear struct of tDot11fIERSN and tDot11fIEWPA specifically setting present |
| 4640 | flag to 0 */ |
| 4641 | memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) ); |
| 4642 | memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) ); |
| 4643 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4644 | // Type check |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4645 | if ( gen_ie[0] == DOT11F_EID_RSN) |
| 4646 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4647 | // Validity checks |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4648 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4649 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) ) |
| 4650 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4651 | hddLog(LOGE, "%s: Invalid DOT11F RSN IE length :%d\n", |
| 4652 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4653 | return -EINVAL; |
| 4654 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4655 | // Skip past the EID byte and length byte |
| 4656 | pRsnIe = gen_ie + 2; |
| 4657 | RSNIeLen = gen_ie_len - 2; |
| 4658 | // Unpack the RSN IE |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4659 | status = sme_unpack_rsn_ie(halHandle, |
| 4660 | pRsnIe, |
| 4661 | RSNIeLen, |
| 4662 | &dot11RSNIE); |
Ashish Kumar Dhanotiya | ffbfd8c | 2017-11-29 14:04:38 +0530 | [diff] [blame] | 4663 | if (DOT11F_FAILED(status)) |
| 4664 | { |
| 4665 | hddLog(LOGE, |
| 4666 | FL("Parse failure in hdd_ProcessGENIE (0x%08x)"), |
| 4667 | status); |
| 4668 | return -EINVAL; |
| 4669 | } |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4670 | hddLog(LOG1, FL("%s: gp_cipher_suite_present: %d"), |
| 4671 | __func__, dot11RSNIE.gp_cipher_suite_present); |
| 4672 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4673 | // Copy out the encryption and authentication types |
| 4674 | hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4675 | __func__, dot11RSNIE.pwise_cipher_suite_count ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4676 | hddLog(LOG1, FL("%s: authentication suite count: %d"), |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4677 | __func__, dot11RSNIE.akm_suite_cnt); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4678 | /*Here we have followed the apple base code, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4679 | but probably I suspect we can do something different*/ |
| 4680 | //dot11RSNIE.akm_suite_count |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4681 | // Just translate the FIRST one |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4682 | *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suite[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4683 | //dot11RSNIE.pwise_cipher_suite_count |
| 4684 | *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]); |
| 4685 | //dot11RSNIE.gp_cipher_suite_count |
| 4686 | *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4687 | #ifdef WLAN_FEATURE_11W |
| 4688 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1 ; |
| 4689 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1 ; |
| 4690 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4691 | // Set the PMKSA ID Cache for this interface |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4692 | for (i=0; i<dot11RSNIE.pmkid_count; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4693 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4694 | if ( pBssid == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4695 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4696 | hddLog(LOGE, "%s: pBssid passed is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4697 | break; |
| 4698 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4699 | if ( hdd_IsMACAddrNULL( (u_char *) pBssid->ether_addr_octet , 6)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4700 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4701 | hddLog(LOGE, "%s: Invalid MAC adrr", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4702 | break; |
| 4703 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4704 | updatePMKCache = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4705 | // For right now, I assume setASSOCIATE() has passed in the bssid. |
| 4706 | vos_mem_copy(PMKIDCache[i].BSSID, |
| 4707 | pBssid, ETHER_ADDR_LEN); |
| 4708 | vos_mem_copy(PMKIDCache[i].PMKID, |
| 4709 | dot11RSNIE.pmkid[i], |
| 4710 | CSR_RSN_PMKID_SIZE); |
| 4711 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4712 | |
| 4713 | if (updatePMKCache) |
| 4714 | { |
| 4715 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4716 | hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with cache entry %d."), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4717 | __func__, i ); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4718 | // Finally set the PMKSA ID Cache in CSR |
| 4719 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
| 4720 | PMKIDCache, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 4721 | dot11RSNIE.pmkid_count, |
| 4722 | FALSE); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4723 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4724 | } |
| 4725 | else if (gen_ie[0] == DOT11F_EID_WPA) |
| 4726 | { |
| 4727 | // Validity checks |
| 4728 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) || |
| 4729 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) |
| 4730 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4731 | hddLog(LOGE, "%s: Invalid DOT11F WPA IE length :%d\n", |
| 4732 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4733 | return -EINVAL; |
| 4734 | } |
| 4735 | // 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] | 4736 | pRsnIe = gen_ie + 2 + 4; |
| 4737 | RSNIeLen = gen_ie_len - (2 + 4); |
| 4738 | // Unpack the WPA IE |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4739 | status = dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4740 | pRsnIe, RSNIeLen, &dot11WPAIE); |
| 4741 | if (!DOT11F_SUCCEEDED(status)) |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4742 | { |
| 4743 | hddLog(LOGE, |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4744 | FL("Invalid RSN IE: parse status %d"), status); |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4745 | return -EINVAL; |
| 4746 | } |
| 4747 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4748 | // Copy out the encryption and authentication types |
| 4749 | hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4750 | __func__, dot11WPAIE.unicast_cipher_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4751 | hddLog(LOG1, FL("%s: WPA authentication suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4752 | __func__, dot11WPAIE.auth_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4753 | //dot11WPAIE.auth_suite_count |
| 4754 | // Just translate the FIRST one |
| 4755 | *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]); |
| 4756 | //dot11WPAIE.unicast_cipher_count |
| 4757 | *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]); |
| 4758 | //dot11WPAIE.unicast_cipher_count |
| 4759 | *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 4760 | } |
| 4761 | else |
| 4762 | { |
| 4763 | hddLog(LOGW, FL("gen_ie[0]: %d"), gen_ie[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4764 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4765 | } |
| 4766 | return 0; |
| 4767 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4768 | |
| 4769 | /** |
| 4770 | * hdd_set_def_rsne_override() - set default encryption type and auth type |
| 4771 | * in profile. |
| 4772 | * @roam_profile: pointer to adapter |
| 4773 | * @auth_type: pointer to auth type |
| 4774 | * |
| 4775 | * Set default value of encryption type and auth type in profile to |
| 4776 | * search the AP using filter, as in force_rsne_override the RSNIE can be |
| 4777 | * currupt and we might not get the proper encryption type and auth type |
| 4778 | * while parsing the RSNIE. |
| 4779 | * |
| 4780 | * Return: void |
| 4781 | */ |
| 4782 | static void hdd_set_def_rsne_override( |
| 4783 | tCsrRoamProfile *roam_profile, eCsrAuthType *auth_type) |
| 4784 | { |
| 4785 | hddLog( LOG1, FL("Set def values in roam profile")); |
| 4786 | roam_profile->MFPCapable = roam_profile->MFPEnabled; |
| 4787 | roam_profile->EncryptionType.numEntries = 2; |
| 4788 | roam_profile->mcEncryptionType.numEntries = 2; |
| 4789 | /* Use the cipher type in the RSN IE */ |
| 4790 | roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; |
| 4791 | roam_profile->EncryptionType.encryptionType[1] = eCSR_ENCRYPT_TYPE_TKIP; |
| 4792 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 4793 | eCSR_ENCRYPT_TYPE_AES; |
| 4794 | roam_profile->mcEncryptionType.encryptionType[1] = |
| 4795 | eCSR_ENCRYPT_TYPE_TKIP; |
| 4796 | *auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
| 4797 | } |
| 4798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4799 | int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 4800 | { |
| 4801 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4802 | v_U32_t status = 0; |
| 4803 | eCsrEncryptionType RSNEncryptType; |
| 4804 | eCsrEncryptionType mcRSNEncryptType; |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4805 | hdd_context_t *hdd_ctx; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4806 | #ifdef WLAN_FEATURE_11W |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4807 | u_int8_t RSNMfpRequired = 0; |
| 4808 | u_int8_t RSNMfpCapable = 0; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4809 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4810 | struct ether_addr bSsid; // MAC address of assoc peer |
| 4811 | // MAC address of assoc peer |
| 4812 | // But, this routine is only called when we are NOT associated. |
| 4813 | vos_mem_copy(bSsid.ether_addr_octet, |
| 4814 | pWextState->roamProfile.BSSIDs.bssid, |
| 4815 | sizeof(bSsid.ether_addr_octet)); |
| 4816 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) |
| 4817 | { |
| 4818 | //continue |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4819 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4820 | else |
| 4821 | { |
| 4822 | return 0; |
| 4823 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4824 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4825 | // The actual processing may eventually be more extensive than this. |
| 4826 | // Right now, just consume any PMKIDs that are sent in by the app. |
| 4827 | status = hdd_ProcessGENIE(pAdapter, |
| 4828 | &bSsid, // MAC address of assoc peer |
| 4829 | &RSNEncryptType, |
| 4830 | &mcRSNEncryptType, |
| 4831 | RSNAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4832 | #ifdef WLAN_FEATURE_11W |
| 4833 | &RSNMfpRequired, |
| 4834 | &RSNMfpCapable, |
| 4835 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4836 | pWextState->WPARSNIE[1]+2, |
| 4837 | pWextState->WPARSNIE); |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4839 | if (status == 0) |
| 4840 | { |
| 4841 | // Now copy over all the security attributes you have parsed out |
| 4842 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 4843 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4844 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4845 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; // Use the cipher type in the RSN IE |
| 4846 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = mcRSNEncryptType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4847 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 4848 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && |
| 4849 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
| 4850 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) |
| 4851 | { |
| 4852 | /*For wpa none supplicant sends the WPA IE with unicast cipher as |
| 4853 | eCSR_ENCRYPT_TYPE_NONE ,where as the multicast cipher as |
| 4854 | either AES/TKIP based on group cipher configuration |
| 4855 | mentioned in the wpa_supplicant.conf.*/ |
| 4856 | |
| 4857 | /*Set the unicast cipher same as multicast cipher*/ |
| 4858 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 4859 | = mcRSNEncryptType; |
| 4860 | } |
| 4861 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4862 | #ifdef WLAN_FEATURE_11W |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4863 | hddLog( LOG1, FL("RSNMfpRequired = %d, RSNMfpCapable = %d"), |
| 4864 | RSNMfpRequired, RSNMfpCapable); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4865 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 4866 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 4867 | #endif |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4868 | hddLog( LOG1, |
| 4869 | FL("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d"), |
| 4870 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4871 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4872 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4873 | |
| 4874 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4875 | if (hdd_ctx->force_rsne_override && |
| 4876 | (pWextState->WPARSNIE[0] == DOT11F_EID_RSN)) { |
| 4877 | hddLog(LOG1, |
| 4878 | FL("Test mode enabled set def Auth and enc type. RSN IE passed in connect req:")); |
| 4879 | vos_trace_hex_dump(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4880 | pWextState->roamProfile.pRSNReqIE, |
| 4881 | pWextState->roamProfile.nRSNReqIELength); |
| 4882 | |
| 4883 | pWextState->roamProfile.force_rsne_override = true; |
| 4884 | hddLog(LOG1, |
| 4885 | FL("MFPEnabled %d"), pWextState->roamProfile.MFPEnabled); |
| 4886 | /* |
| 4887 | * Reset MFPEnabled if testmode RSNE passed doesnt have MFPR |
| 4888 | * or MFPC bit set |
| 4889 | */ |
| 4890 | if (pWextState->roamProfile.MFPEnabled && |
| 4891 | !(pWextState->roamProfile.MFPRequired || |
| 4892 | pWextState->roamProfile.MFPCapable)) { |
| 4893 | hddLog( LOG1,FL("Reset MFPEnabled")); |
| 4894 | pWextState->roamProfile.MFPEnabled = 0; |
| 4895 | } |
| 4896 | |
| 4897 | /* If parsing failed set the def value for the roam profile */ |
| 4898 | if (status) |
| 4899 | hdd_set_def_rsne_override(&pWextState->roamProfile, |
| 4900 | RSNAuthType); |
| 4901 | } |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4902 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4903 | } |
| 4904 | int hdd_set_csr_auth_type ( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 4905 | { |
| 4906 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4907 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 4908 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4909 | ENTER(); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4910 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4911 | pRoamProfile->AuthType.numEntries = 1; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4912 | hddLog( LOG1, "%s: pHddStaCtx->conn_info.authType = %d", __func__, pHddStaCtx->conn_info.authType); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4913 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4914 | switch( pHddStaCtx->conn_info.authType) |
| 4915 | { |
| 4916 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
Abhinav Kumar | 62801ba | 2018-09-19 12:14:14 +0530 | [diff] [blame] | 4917 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4918 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4919 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 4920 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 4921 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4922 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 4923 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4924 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4925 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4926 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4927 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4928 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4929 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 4930 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4931 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4932 | 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] | 4933 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
| 4934 | } else |
| 4935 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4936 | hddLog( LOG1, "%s: Last chance to set authType to CCKM WPA.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4937 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4938 | } else |
| 4939 | #endif |
| 4940 | if((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4941 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4942 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA; |
| 4943 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4944 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 4945 | == IW_AUTH_KEY_MGMT_PSK) { |
| 4946 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4947 | } else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4948 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4949 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4950 | } |
| 4951 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4952 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4953 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 4954 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4955 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4956 | 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] | 4957 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4958 | } else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4959 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4960 | hddLog( LOG1, "%s: Last chance to set authType to CCKM RSN.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4961 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4962 | } else |
| 4963 | #endif |
| 4964 | |
| 4965 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4966 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 4967 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4968 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4969 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4970 | }else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4971 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4972 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 4973 | == IW_AUTH_KEY_MGMT_PSK)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4974 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4975 | } else |
| 4976 | #endif |
| 4977 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4978 | #ifdef WLAN_FEATURE_11W |
| 4979 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 4980 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 4981 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 4982 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 4983 | pRoamProfile->AuthType.authType[0] = |
| 4984 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 4985 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4986 | #endif |
| 4987 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4988 | if( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4989 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4990 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN; |
| 4991 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4992 | if ( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 4993 | == IW_AUTH_KEY_MGMT_PSK) { |
| 4994 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4995 | } else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4996 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4997 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4998 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4999 | break; |
| 5000 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5001 | case eCSR_AUTH_TYPE_SHARED_KEY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5002 | |
| 5003 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5004 | break; |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame] | 5005 | case eCSR_AUTH_TYPE_SAE: |
| 5006 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 5007 | break; |
| 5008 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5009 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5010 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5011 | #ifdef FEATURE_WLAN_ESE |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5012 | hddLog( LOG1, "%s: In default, unknown auth type.", __func__); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5013 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5014 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5015 | break; |
| 5016 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5017 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5018 | hddLog( LOG1, "%s Set roam Authtype to %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5019 | __func__, pWextState->roamProfile.AuthType.authType[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5020 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5021 | EXIT(); |
| 5022 | return 0; |
| 5023 | } |
| 5024 | |
Sravan Kumar Kairam | 091e5b6 | 2017-01-23 14:14:20 +0530 | [diff] [blame] | 5025 | /** |
| 5026 | * hdd_rx_fwd_eapol() - forward cached eapol frames |
| 5027 | * @vosContext : pointer to vos global context |
| 5028 | * @pVosPacket: pointer to vos packet |
| 5029 | * |
| 5030 | * Return: None |
| 5031 | * |
| 5032 | */ |
| 5033 | void hdd_assoc_registerFwdEapolCB(void *pContext) |
| 5034 | { |
| 5035 | WLANTL_RegisterFwdEapol(pContext, hdd_rx_fwd_eapol); |
| 5036 | } |
| 5037 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5038 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5039 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5040 | \brief __iw_set_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5041 | This function sets the ssid received from wpa_supplicant |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5042 | to the CSR roam profile. |
| 5043 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5044 | \param - dev - Pointer to the net device. |
| 5045 | - info - Pointer to the iw_request_info. |
| 5046 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5047 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5048 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5049 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5050 | --------------------------------------------------------------------------*/ |
| 5051 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5052 | int __iw_set_essid(struct net_device *dev, |
| 5053 | struct iw_request_info *info, |
| 5054 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5055 | { |
| 5056 | v_U32_t status = 0; |
| 5057 | hdd_wext_state_t *pWextState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5058 | hdd_adapter_t *pAdapter; |
| 5059 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5060 | v_U32_t roamId; |
| 5061 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5062 | eCsrAuthType RSNAuthType; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5063 | tHalHandle hHal; |
| 5064 | hdd_station_ctx_t *pHddStaCtx; |
| 5065 | int ret = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5066 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5067 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5068 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5069 | if (NULL == pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5070 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5071 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5072 | "%s: Adapter is NULL",__func__); |
| 5073 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5074 | } |
| 5075 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5076 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5077 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5078 | if (0 != ret) |
| 5079 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5080 | return ret; |
| 5081 | } |
| 5082 | |
| 5083 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5084 | if (NULL == hHal) |
| 5085 | { |
| 5086 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5087 | "%s: Hal Context is NULL",__func__); |
| 5088 | return -EINVAL; |
| 5089 | } |
| 5090 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5091 | if (NULL == pHddStaCtx) |
| 5092 | { |
| 5093 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5094 | "%s: STA Context is NULL",__func__); |
| 5095 | return -EINVAL; |
| 5096 | } |
| 5097 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5098 | if (NULL == pWextState) |
| 5099 | { |
| 5100 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5101 | "%s: pWextState is NULL",__func__); |
| 5102 | return -EINVAL; |
| 5103 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5104 | if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
| 5105 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__); |
| 5106 | return -EBUSY; |
| 5107 | } |
| 5108 | if( SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length ) |
| 5109 | return -EINVAL; |
| 5110 | pRoamProfile = &pWextState->roamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5111 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5112 | if (wlan_hdd_check_and_stop_mon(pAdapter, true)) |
| 5113 | return -EINVAL; |
| 5114 | |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 5115 | /*Try disconnecting if already in connected state*/ |
| 5116 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5117 | if (0 > status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5118 | { |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 5119 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 5120 | " connection")); |
| 5121 | return -EALREADY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5122 | } |
| 5123 | /** wpa_supplicant 0.8.x, wext driver uses */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5124 | /** when cfg80211 defined, wpa_supplicant wext driver uses |
| 5125 | zero-length, null-string ssid for force disconnection. |
| 5126 | after disconnection (if previously connected) and cleaning ssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5127 | driver MUST return success */ |
| 5128 | if ( 0 == wrqu->essid.length ) { |
| 5129 | return 0; |
| 5130 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5131 | |
| 5132 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5133 | &pWextState->roamProfile.uapsd_mask); |
| 5134 | if (VOS_STATUS_SUCCESS != status) |
| 5135 | { |
| 5136 | pWextState->roamProfile.uapsd_mask = 0; |
| 5137 | } |
| 5138 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5139 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5140 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = wrqu->essid.length; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5141 | |
| 5142 | 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] | 5143 | vos_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId), extra, wrqu->essid.length); |
| 5144 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion || |
| 5145 | IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion ) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5146 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5147 | //set gen ie |
| 5148 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 5149 | |
| 5150 | //set auth |
| 5151 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5152 | } |
| 5153 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5154 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5155 | if (pAdapter->wapi_info.nWapiMode) |
| 5156 | { |
| 5157 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 5158 | { |
| 5159 | case WAPI_AUTH_MODE_PSK: |
| 5160 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5161 | 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] | 5162 | pRoamProfile->AuthType.numEntries = 1; |
| 5163 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5164 | break; |
| 5165 | } |
| 5166 | case WAPI_AUTH_MODE_CERT: |
| 5167 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5168 | 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] | 5169 | pRoamProfile->AuthType.numEntries = 1; |
| 5170 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5171 | break; |
| 5172 | } |
| 5173 | } // End of switch |
| 5174 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5175 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 5176 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5177 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5178 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5179 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5180 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5181 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5182 | } |
| 5183 | } |
| 5184 | #endif /* FEATURE_WLAN_WAPI */ |
| 5185 | /* if previous genIE is not NULL, update AssocIE */ |
| 5186 | if (0 != pWextState->genIE.length) |
| 5187 | { |
| 5188 | memset( &pWextState->assocAddIE, 0, sizeof(pWextState->assocAddIE) ); |
| 5189 | memcpy( pWextState->assocAddIE.addIEdata, pWextState->genIE.addIEdata, |
| 5190 | pWextState->genIE.length); |
| 5191 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5192 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5193 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5194 | |
| 5195 | /* clear previous genIE after use it */ |
| 5196 | memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) ); |
| 5197 | } |
| 5198 | |
| 5199 | /* assumes it is not WPS Association by default, except when pAddIEAssoc has WPS IE */ |
| 5200 | pWextState->roamProfile.bWPSAssociation = FALSE; |
| 5201 | |
| 5202 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5203 | pWextState->roamProfile.nAddIEAssocLength)) |
| 5204 | pWextState->roamProfile.bWPSAssociation = TRUE; |
| 5205 | |
| 5206 | |
| 5207 | // Disable auto BMPS entry by PMC until DHCP is done |
| 5208 | sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), TRUE); |
| 5209 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5210 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5211 | (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5212 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5213 | if ( eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType ) |
| 5214 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5215 | hdd_select_cbmode(pAdapter, |
| 5216 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->AdHocChannel5G); |
| 5217 | } |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 5218 | /* |
| 5219 | * Change conn_state to connecting before sme_RoamConnect(), |
| 5220 | * because sme_RoamConnect() has a direct path to call |
| 5221 | * hdd_smeRoamCallback(), which will change the conn_state |
| 5222 | * If direct path, conn_state will be accordingly changed |
| 5223 | * to NotConnected or Associated by either |
| 5224 | * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() |
| 5225 | * in sme_RoamCallback() |
| 5226 | * if sme_RomConnect is to be queued, |
| 5227 | * Connecting state will remain until it is completed. |
| 5228 | * |
| 5229 | * If connection state is not changed, |
| 5230 | * connection state will remain in eConnectionState_NotConnected state. |
| 5231 | * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true |
| 5232 | * if conn state is eConnectionState_NotConnected. |
| 5233 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 5234 | * informed of connect result indication which is an issue. |
| 5235 | */ |
| 5236 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5237 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
| 5238 | { |
| 5239 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5240 | FL("Set HDD connState to eConnectionState_Connecting")); |
| 5241 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5242 | eConnectionState_Connecting); |
| 5243 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5244 | status = sme_RoamConnect( hHal,pAdapter->sessionId, |
| 5245 | &(pWextState->roamProfile), &roamId); |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 5246 | |
| 5247 | if ((eHAL_STATUS_SUCCESS != status) && |
| 5248 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5249 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5250 | { |
| 5251 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5252 | FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"), |
| 5253 | pAdapter->sessionId, status); |
| 5254 | /* change back to NotAssociated */ |
| 5255 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5256 | eConnectionState_NotConnected); |
| 5257 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5258 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5259 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5260 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5261 | EXIT(); |
| 5262 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5263 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5264 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5265 | int iw_set_essid(struct net_device *dev, |
| 5266 | struct iw_request_info *info, |
| 5267 | union iwreq_data *wrqu, char *extra) |
| 5268 | { |
| 5269 | int ret; |
| 5270 | |
| 5271 | vos_ssr_protect(__func__); |
| 5272 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 5273 | vos_ssr_unprotect(__func__); |
| 5274 | |
| 5275 | return ret; |
| 5276 | } |
| 5277 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5278 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5279 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5280 | \brief __iw_get_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5281 | This function returns the essid to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5282 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5283 | \param - dev - Pointer to the net device. |
| 5284 | - info - Pointer to the iw_request_info. |
| 5285 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5286 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5287 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5288 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5289 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5290 | int __iw_get_essid(struct net_device *dev, |
| 5291 | struct iw_request_info *info, |
| 5292 | struct iw_point *dwrq, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5293 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5294 | hdd_adapter_t *pAdapter; |
| 5295 | hdd_context_t *pHddCtx; |
| 5296 | hdd_wext_state_t *wextBuf; |
| 5297 | hdd_station_ctx_t *pHddStaCtx; |
| 5298 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5300 | ENTER(); |
| 5301 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5302 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5303 | if (NULL == pAdapter) |
| 5304 | { |
| 5305 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5306 | "%s: Adapter is NULL",__func__); |
| 5307 | return -EINVAL; |
| 5308 | } |
| 5309 | |
| 5310 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5311 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5312 | if (0 != ret) |
| 5313 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5314 | return ret; |
| 5315 | } |
| 5316 | |
| 5317 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5318 | if (NULL == pHddStaCtx) |
| 5319 | { |
| 5320 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5321 | "%s: STA Context is NULL",__func__); |
| 5322 | return -EINVAL; |
| 5323 | } |
| 5324 | |
| 5325 | wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5326 | if (NULL == wextBuf) |
| 5327 | { |
| 5328 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5329 | "%s: wextBuf is NULL",__func__); |
| 5330 | return -EINVAL; |
| 5331 | } |
| 5332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5333 | if((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 5334 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 5335 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected || |
| 5336 | pHddStaCtx->conn_info.connState == eConnectionState_IbssDisconnected) && |
| 5337 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) |
| 5338 | { |
| 5339 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 5340 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, dwrq->length); |
| 5341 | dwrq->flags = 1; |
| 5342 | } else { |
| 5343 | memset(extra, 0, dwrq->length); |
| 5344 | dwrq->length = 0; |
| 5345 | dwrq->flags = 0; |
| 5346 | } |
| 5347 | EXIT(); |
| 5348 | return 0; |
| 5349 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5350 | |
| 5351 | int iw_get_essid(struct net_device *dev, |
| 5352 | struct iw_request_info *info, |
| 5353 | struct iw_point *dwrq, char *extra) |
| 5354 | { |
| 5355 | int ret; |
| 5356 | |
| 5357 | vos_ssr_protect(__func__); |
| 5358 | ret = __iw_get_essid(dev, info, dwrq, extra); |
| 5359 | vos_ssr_unprotect(__func__); |
| 5360 | |
| 5361 | return ret; |
| 5362 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5363 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5364 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5365 | \brief __iw_set_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5366 | This function sets the auth type received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5367 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5368 | \param - dev - Pointer to the net device. |
| 5369 | - info - Pointer to the iw_request_info. |
| 5370 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5371 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5372 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5374 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5375 | int __iw_set_auth(struct net_device *dev,struct iw_request_info *info, |
| 5376 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5377 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5378 | hdd_adapter_t *pAdapter; |
| 5379 | hdd_context_t *pHddCtx; |
| 5380 | hdd_wext_state_t *pWextState; |
| 5381 | hdd_station_ctx_t *pHddStaCtx; |
| 5382 | tCsrRoamProfile *pRoamProfile; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5383 | eCsrEncryptionType mcEncryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5384 | eCsrEncryptionType ucEncryptionType; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5385 | int ret = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5386 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5387 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5388 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5389 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5390 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5391 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5392 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5393 | "%s: Adapter is NULL",__func__); |
| 5394 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5395 | } |
| 5396 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5397 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5398 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5399 | if (0 != ret) |
| 5400 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5401 | return ret; |
| 5402 | } |
| 5403 | |
| 5404 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5405 | if (NULL == pHddStaCtx) |
| 5406 | { |
| 5407 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5408 | "%s: STA Context is NULL",__func__); |
| 5409 | return -EINVAL; |
| 5410 | } |
| 5411 | |
| 5412 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5413 | if (NULL == pWextState) |
| 5414 | { |
| 5415 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5416 | "%s: pWextState is NULL",__func__); |
| 5417 | return -EINVAL; |
| 5418 | } |
| 5419 | |
| 5420 | pRoamProfile = &pWextState->roamProfile; |
| 5421 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5422 | switch(wrqu->param.flags & IW_AUTH_INDEX) |
| 5423 | { |
| 5424 | case IW_AUTH_WPA_VERSION: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5426 | pWextState->wpaVersion = wrqu->param.value; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5427 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5428 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5429 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5430 | case IW_AUTH_CIPHER_PAIRWISE: |
| 5431 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5432 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5433 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5434 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5435 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5436 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5437 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5438 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 5439 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5440 | } |
| 5441 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5442 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5443 | |
| 5444 | if( (IW_AUTH_KEY_MGMT_802_1X |
| 5445 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5446 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) ) |
| 5447 | /*Dynamic WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5448 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5449 | else |
| 5450 | /*Static WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5451 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5452 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5453 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5454 | |
| 5455 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5456 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5457 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5458 | /*Dynamic WEP key*/ |
| 5459 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 5460 | else |
| 5461 | /*Static WEP key*/ |
| 5462 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
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 | } |
| 5465 | else { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5466 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5467 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5468 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5469 | return -EINVAL; |
| 5470 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5471 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5472 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5473 | pRoamProfile->EncryptionType.encryptionType[0] = ucEncryptionType; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5474 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5475 | break; |
| 5476 | case IW_AUTH_CIPHER_GROUP: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5477 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5478 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 5479 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5480 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5481 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5482 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5483 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5484 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5485 | |
| 5486 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5487 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5488 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5489 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5490 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5491 | |
| 5492 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5493 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 5494 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5495 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5496 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5497 | |
| 5498 | else |
| 5499 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5500 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5501 | |
| 5502 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) |
| 5503 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5504 | /*Dynamic WEP keys won't work with shared keys*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5505 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5506 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5507 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5508 | { |
| 5509 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 5510 | } |
| 5511 | else |
| 5512 | { |
| 5513 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5514 | } |
| 5515 | } |
| 5516 | else { |
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 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5519 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5520 | return -EINVAL; |
| 5521 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5522 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5523 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5524 | pRoamProfile->mcEncryptionType.encryptionType[0] = mcEncryptionType; |
| 5525 | } |
| 5526 | break; |
| 5527 | |
| 5528 | case IW_AUTH_80211_AUTH_ALG: |
| 5529 | { |
| 5530 | /*Save the auth algo here and set auth type to SME Roam profile |
| 5531 | in the iw_set_ap_address*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5532 | if( wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5533 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5534 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5535 | else if(wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 5536 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5537 | |
| 5538 | else if(wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 5539 | /*Not supported*/ |
| 5540 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5541 | pWextState->roamProfile.AuthType.authType[0] = pHddStaCtx->conn_info.authType; |
| 5542 | } |
| 5543 | break; |
| 5544 | |
| 5545 | case IW_AUTH_KEY_MGMT: |
| 5546 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5547 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5548 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 5549 | /*Check for CCKM AKM type */ |
| 5550 | if ( wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5551 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: CCKM AKM Set %d", |
| 5552 | __func__, wrqu->param.value); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5553 | /* Set the CCKM bit in authKeyMgmt */ |
| 5554 | /* Right now, this breaks all ref to authKeyMgmt because our |
| 5555 | * code doesn't realize it is a "bitfield" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5556 | */ |
| 5557 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 5558 | /*Set the key management to 802.1X*/ |
| 5559 | //pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5560 | pWextState->isESEConnection = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5561 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5562 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5563 | } else if ( wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 5564 | /*Save the key management*/ |
| 5565 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 5566 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 5567 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5568 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 5569 | } else if (!( wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
| 5570 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; //eCSR_AUTH_TYPE_WPA_NONE |
| 5571 | /*Save the key management anyway*/ |
| 5572 | pWextState->authKeyMgmt = wrqu->param.value; |
| 5573 | } else { // It must be IW_AUTH_KEY_MGMT_802_1X |
| 5574 | /*Save the key management*/ |
| 5575 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 5576 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 5577 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5578 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 5579 | } |
| 5580 | #else |
| 5581 | /*Save the key management*/ |
| 5582 | pWextState->authKeyMgmt = wrqu->param.value; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5583 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5584 | } |
| 5585 | break; |
| 5586 | |
| 5587 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 5588 | { |
| 5589 | if(wrqu->param.value) { |
| 5590 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5591 | "Counter Measure started %d", wrqu->param.value); |
| 5592 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED; |
| 5593 | } |
| 5594 | else { |
| 5595 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5596 | "Counter Measure stopped=%d", wrqu->param.value); |
| 5597 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED; |
| 5598 | } |
| 5599 | } |
| 5600 | break; |
| 5601 | case IW_AUTH_DROP_UNENCRYPTED: |
| 5602 | case IW_AUTH_WPA_ENABLED: |
| 5603 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 5604 | case IW_AUTH_ROAMING_CONTROL: |
| 5605 | case IW_AUTH_PRIVACY_INVOKED: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5606 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5607 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5608 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5609 | hddLog(LOGW, "%s called with unsupported auth type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5610 | wrqu->param.flags & IW_AUTH_INDEX); |
| 5611 | break; |
| 5612 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5613 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5614 | EXIT(); |
| 5615 | return 0; |
| 5616 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5617 | |
| 5618 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 5619 | union iwreq_data *wrqu, char *extra) |
| 5620 | { |
| 5621 | int ret; |
| 5622 | |
| 5623 | vos_ssr_protect(__func__); |
| 5624 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 5625 | vos_ssr_unprotect(__func__); |
| 5626 | |
| 5627 | return ret; |
| 5628 | } |
| 5629 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5630 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5631 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5632 | \brief __iw_get_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5633 | This function returns the auth type to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5635 | \param - dev - Pointer to the net device. |
| 5636 | - info - Pointer to the iw_request_info. |
| 5637 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5638 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5639 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5640 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5641 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5642 | int __iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 5643 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5644 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5645 | hdd_adapter_t* pAdapter; |
| 5646 | hdd_wext_state_t *pWextState; |
| 5647 | tCsrRoamProfile *pRoamProfile; |
| 5648 | hdd_context_t *pHddCtx; |
| 5649 | int ret = 0; |
| 5650 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5651 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5652 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5653 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5654 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5655 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5656 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5657 | "%s: Adapter is NULL",__func__); |
| 5658 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5659 | } |
| 5660 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5661 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5662 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5663 | if (0 != ret) |
| 5664 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5665 | return ret; |
| 5666 | } |
| 5667 | |
| 5668 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5669 | if (NULL == pWextState) |
| 5670 | { |
| 5671 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5672 | "%s: pWextState is NULL",__func__); |
| 5673 | return -EINVAL; |
| 5674 | } |
| 5675 | pRoamProfile = &pWextState->roamProfile; |
| 5676 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5677 | switch(pRoamProfile->negotiatedAuthType) |
| 5678 | { |
| 5679 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 5680 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5681 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 5682 | break; |
| 5683 | case eCSR_AUTH_TYPE_WPA: |
| 5684 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5685 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 5686 | break; |
| 5687 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5688 | case eCSR_AUTH_TYPE_FT_RSN: |
| 5689 | #endif |
| 5690 | case eCSR_AUTH_TYPE_RSN: |
| 5691 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5692 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 5693 | break; |
| 5694 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5695 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5696 | break; |
| 5697 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5698 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 5699 | break; |
| 5700 | case eCSR_AUTH_TYPE_UNKNOWN: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5701 | hddLog(LOG1,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5702 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5703 | break; |
| 5704 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 5705 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5706 | break; |
| 5707 | case eCSR_AUTH_TYPE_WPA_PSK: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5708 | hddLog(LOG1,"%s called with WPA PSK auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5709 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5710 | return -EIO; |
| 5711 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5712 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 5713 | #endif |
| 5714 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5715 | #ifdef WLAN_FEATURE_11W |
| 5716 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 5717 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5718 | #endif |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5719 | hddLog(LOG1,"%s called with RSN PSK auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5720 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5721 | return -EIO; |
| 5722 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5723 | hddLog(LOGE,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5724 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5725 | return -EIO; |
| 5726 | } |
| 5727 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) |
| 5728 | { |
| 5729 | switch(pRoamProfile->negotiatedUCEncryptionType) |
| 5730 | { |
| 5731 | case eCSR_ENCRYPT_TYPE_NONE: |
| 5732 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 5733 | break; |
| 5734 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5735 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5736 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 5737 | break; |
| 5738 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5739 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 5740 | break; |
| 5741 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5742 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5743 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 5744 | break; |
| 5745 | case eCSR_ENCRYPT_TYPE_AES: |
| 5746 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 5747 | break; |
| 5748 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5749 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 5750 | __func__, pRoamProfile->negotiatedUCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5751 | return -EIO; |
| 5752 | } |
| 5753 | } |
| 5754 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5755 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5756 | { |
| 5757 | switch(pRoamProfile->negotiatedMCEncryptionType) |
| 5758 | { |
| 5759 | case eCSR_ENCRYPT_TYPE_NONE: |
| 5760 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 5761 | break; |
| 5762 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5763 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5764 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 5765 | break; |
| 5766 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5767 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 5768 | break; |
| 5769 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5770 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5771 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 5772 | break; |
| 5773 | case eCSR_ENCRYPT_TYPE_AES: |
| 5774 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 5775 | break; |
| 5776 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5777 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 5778 | __func__, pRoamProfile->negotiatedMCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5779 | return -EIO; |
| 5780 | } |
| 5781 | } |
| 5782 | |
| 5783 | hddLog(LOG1, "%s called with auth type %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5784 | __func__, pRoamProfile->AuthType.authType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5785 | EXIT(); |
| 5786 | return 0; |
| 5787 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5788 | |
| 5789 | int iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 5790 | union iwreq_data *wrqu,char *extra) |
| 5791 | { |
| 5792 | int ret; |
| 5793 | |
| 5794 | vos_ssr_protect(__func__); |
| 5795 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 5796 | vos_ssr_unprotect(__func__); |
| 5797 | |
| 5798 | return ret; |
| 5799 | } |
| 5800 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5801 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5802 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5803 | \brief __iw_set_ap_address() - |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5804 | This function calls the sme_RoamConnect function to associate |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5805 | to the AP with the specified BSSID received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5806 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5807 | \param - dev - Pointer to the net device. |
| 5808 | - info - Pointer to the iw_request_info. |
| 5809 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5810 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5811 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5812 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5813 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5814 | int __iw_set_ap_address(struct net_device *dev, |
| 5815 | struct iw_request_info *info, |
| 5816 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5817 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5818 | hdd_station_ctx_t *pHddStaCtx; |
| 5819 | hdd_adapter_t *pAdapter; |
| 5820 | hdd_context_t *pHddCtx; |
| 5821 | v_U8_t *pMacAddress = NULL; |
| 5822 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5824 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5825 | |
| 5826 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5827 | if (NULL == pAdapter) |
| 5828 | { |
| 5829 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5830 | "%s: Adapter is NULL", __func__); |
| 5831 | return -EINVAL; |
| 5832 | } |
| 5833 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5834 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5835 | if (0 != ret) |
| 5836 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5837 | return ret; |
| 5838 | } |
| 5839 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5840 | if (NULL == pHddStaCtx) |
| 5841 | { |
| 5842 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5843 | "%s: pHddStaCtx is NULL", __func__); |
| 5844 | return -EINVAL; |
| 5845 | } |
| 5846 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5847 | pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data; |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 5848 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s "MAC_ADDRESS_STR, |
| 5849 | __func__, MAC_ADDR_ARRAY(pMacAddress)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5850 | vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid )); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5851 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5852 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5853 | return 0; |
| 5854 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5855 | |
| 5856 | int iw_set_ap_address(struct net_device *dev, |
| 5857 | struct iw_request_info *info, |
| 5858 | union iwreq_data *wrqu, char *extra) |
| 5859 | { |
| 5860 | int ret; |
| 5861 | |
| 5862 | vos_ssr_protect(__func__); |
| 5863 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 5864 | vos_ssr_unprotect(__func__); |
| 5865 | |
| 5866 | return ret; |
| 5867 | } |
| 5868 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5869 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5870 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5871 | \brief __iw_get_ap_address() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5872 | This function returns the BSSID to the wpa_supplicant |
| 5873 | \param - dev - Pointer to the net device. |
| 5874 | - info - Pointer to the iw_request_info. |
| 5875 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5876 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5877 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5878 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5879 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5880 | int __iw_get_ap_address(struct net_device *dev, |
| 5881 | struct iw_request_info *info, |
| 5882 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5883 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5884 | hdd_station_ctx_t *pHddStaCtx; |
| 5885 | hdd_adapter_t *pAdapter; |
| 5886 | hdd_context_t *pHddCtx; |
| 5887 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5888 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5889 | ENTER(); |
| 5890 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5891 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5892 | if (NULL == pAdapter) |
| 5893 | { |
| 5894 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5895 | "%s: Adapter is NULL", __func__); |
| 5896 | return -EINVAL; |
| 5897 | } |
| 5898 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5899 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5900 | if (0 != ret) |
| 5901 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5902 | return ret; |
| 5903 | } |
| 5904 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5905 | if (NULL == pHddStaCtx) |
| 5906 | { |
| 5907 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5908 | "%s: pHddStaCtx is NULL", __func__); |
| 5909 | return -EINVAL; |
| 5910 | } |
| 5911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5912 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 5913 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 5914 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5915 | memcpy(wrqu->ap_addr.sa_data,pHddStaCtx->conn_info.bssId,ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5916 | } |
| 5917 | else |
| 5918 | { |
| 5919 | memset(wrqu->ap_addr.sa_data,0,sizeof(wrqu->ap_addr.sa_data)); |
| 5920 | } |
| 5921 | EXIT(); |
| 5922 | return 0; |
| 5923 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5924 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5925 | int iw_get_ap_address(struct net_device *dev, |
| 5926 | struct iw_request_info *info, |
| 5927 | union iwreq_data *wrqu, char *extra) |
| 5928 | { |
| 5929 | int ret; |
| 5930 | |
| 5931 | vos_ssr_protect(__func__); |
| 5932 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 5933 | vos_ssr_unprotect(__func__); |
| 5934 | |
| 5935 | return ret; |
| 5936 | } |
| 5937 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5938 | #ifdef WLAN_FEATURE_11W |
| 5939 | /**--------------------------------------------------------------------------- |
| 5940 | |
| 5941 | \brief hdd_indicateUnprotMgmtFrame - |
| 5942 | This function forwards the unprotected management frame to the supplicant |
| 5943 | \param - pAdapter - Pointer to HDD adapter |
| 5944 | - nFrameLength - Length of the unprotected frame being passed |
| 5945 | - pbFrames - Pointer to the frame buffer |
| 5946 | - frameType - 802.11 frame type |
| 5947 | \return - nothing |
| 5948 | |
| 5949 | --------------------------------------------------------------------------*/ |
| 5950 | void hdd_indicateUnprotMgmtFrame( hdd_adapter_t *pAdapter, |
| 5951 | tANI_U32 nFrameLength, |
| 5952 | tANI_U8* pbFrames, |
| 5953 | tANI_U8 frameType ) |
| 5954 | { |
| 5955 | tANI_U8 type = 0; |
| 5956 | tANI_U8 subType = 0; |
| 5957 | |
| 5958 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d", |
| 5959 | __func__, frameType, nFrameLength); |
| 5960 | |
| 5961 | /* Sanity Checks */ |
| 5962 | if (NULL == pAdapter) |
| 5963 | { |
| 5964 | hddLog( LOGE, FL("pAdapter is NULL")); |
| 5965 | return; |
| 5966 | } |
| 5967 | |
| 5968 | if (NULL == pAdapter->dev) |
| 5969 | { |
| 5970 | hddLog( LOGE, FL("pAdapter->dev is NULL")); |
| 5971 | return; |
| 5972 | } |
| 5973 | |
| 5974 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 5975 | { |
| 5976 | hddLog( LOGE, FL("pAdapter has invalid magic")); |
| 5977 | return; |
| 5978 | } |
| 5979 | |
| 5980 | if( !nFrameLength ) |
| 5981 | { |
| 5982 | hddLog( LOGE, FL("Frame Length is Invalid ZERO")); |
| 5983 | return; |
| 5984 | } |
| 5985 | |
| 5986 | if (NULL == pbFrames) { |
| 5987 | hddLog( LOGE, FL("pbFrames is NULL")); |
| 5988 | return; |
| 5989 | } |
| 5990 | |
| 5991 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 5992 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 5993 | |
| 5994 | /* Get pAdapter from Destination mac address of the frame */ |
| 5995 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) |
| 5996 | { |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 5997 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 5998 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength); |
| 5999 | #else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6000 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, nFrameLength); |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6001 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6002 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 6003 | } |
| 6004 | else if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DEAUTH) |
| 6005 | { |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6006 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 6007 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength); |
| 6008 | #else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6009 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, nFrameLength); |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 6010 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6011 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 6012 | } |
| 6013 | else |
| 6014 | { |
| 6015 | hddLog( LOGE, FL("Frame type %d and subtype %d are not valid"), type, subType); |
| 6016 | return; |
| 6017 | } |
| 6018 | } |
| 6019 | #endif |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6020 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6021 | #if defined (FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6022 | void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid, |
| 6023 | tANI_U8 state, |
| 6024 | tANI_U16 measInterval ) |
| 6025 | { |
| 6026 | union iwreq_data wrqu; |
| 6027 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6028 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6029 | |
| 6030 | if (NULL == pAdapter) |
| 6031 | return; |
| 6032 | |
| 6033 | // create the event |
| 6034 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6035 | memset(buf, '\0', sizeof(buf)); |
| 6036 | |
| 6037 | hddLog(VOS_TRACE_LEVEL_INFO, "TSM Ind tid(%d) state(%d) MeasInt(%d)", |
| 6038 | tid, state, measInterval); |
| 6039 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6040 | 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] | 6041 | |
| 6042 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6043 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6044 | // send the event |
| 6045 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6046 | } |
| 6047 | |
| 6048 | void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 6049 | { |
| 6050 | union iwreq_data wrqu; |
| 6051 | char buf[IW_CUSTOM_MAX + 1]; |
| 6052 | char *pos = buf; |
| 6053 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6054 | |
| 6055 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6056 | return; |
| 6057 | |
| 6058 | // create the event |
| 6059 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6060 | memset(buf, '\0', sizeof(buf)); |
| 6061 | |
| 6062 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 6063 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXPREAUTHNOTIFY=%02x:%02x:%02x:%02x:%02x:%02x %u:%u", |
| 6064 | pRoamInfo->bssid[0], pRoamInfo->bssid[1], pRoamInfo->bssid[2], |
| 6065 | pRoamInfo->bssid[3], pRoamInfo->bssid[4], pRoamInfo->bssid[5], |
| 6066 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6067 | |
| 6068 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 6069 | pos += nBytes; |
| 6070 | freeBytes -= nBytes; |
| 6071 | |
| 6072 | vos_mem_copy(pos, pRoamInfo->bssid, WNI_CFG_BSSID_LEN); |
| 6073 | pos += WNI_CFG_BSSID_LEN; |
| 6074 | freeBytes -= WNI_CFG_BSSID_LEN; |
| 6075 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6076 | nBytes = snprintf(pos, freeBytes, " %u:%u", pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 6077 | freeBytes -= nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6078 | |
| 6079 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6080 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6081 | |
| 6082 | // send the event |
| 6083 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6084 | } |
| 6085 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6086 | void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6087 | { |
| 6088 | union iwreq_data wrqu; |
| 6089 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6090 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6091 | |
| 6092 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6093 | return; |
| 6094 | |
| 6095 | // create the event |
| 6096 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6097 | memset(buf, '\0', sizeof(buf)); |
| 6098 | |
| 6099 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
| 6100 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6101 | nBytes = snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6102 | |
| 6103 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6104 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6105 | |
| 6106 | // send the event |
| 6107 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6108 | } |
| 6109 | |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 6110 | void hdd_indicateEseBcnReportNoResults(const hdd_adapter_t *pAdapter, |
| 6111 | const tANI_U16 measurementToken, |
| 6112 | const tANI_BOOLEAN flag, |
| 6113 | const tANI_U8 numBss) |
| 6114 | { |
| 6115 | union iwreq_data wrqu; |
| 6116 | char buf[IW_CUSTOM_MAX]; |
| 6117 | char *pos = buf; |
| 6118 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6119 | |
| 6120 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6121 | memset(buf, '\0', sizeof(buf)); |
| 6122 | |
| 6123 | hddLog(VOS_TRACE_LEVEL_INFO, FL("CCXBCNREP=%d %d %d"), measurementToken, flag, |
| 6124 | numBss); |
| 6125 | |
| 6126 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 6127 | flag, numBss); |
| 6128 | |
| 6129 | wrqu.data.pointer = buf; |
| 6130 | wrqu.data.length = nBytes; |
| 6131 | // send the event |
| 6132 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6133 | } |
| 6134 | |
| 6135 | |
| 6136 | static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6137 | const tCsrRoamInfo *pRoamInfo) |
| 6138 | { |
| 6139 | union iwreq_data wrqu; |
| 6140 | char buf[IW_CUSTOM_MAX + 1]; |
| 6141 | char *pos = buf; |
| 6142 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6143 | tANI_U8 i = 0, len = 0; |
| 6144 | tANI_U8 tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 6145 | tANI_U8 lastSent = 0, sendBss = 0; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6146 | int bcnRepFieldSize = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0].bcnReportFields); |
| 6147 | tANI_U8 ieLenByte = 1; |
| 6148 | /* CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes */ |
| 6149 | #define ESEBCNREPHEADER_LEN (18) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6150 | |
| 6151 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6152 | return; |
| 6153 | |
| 6154 | /* Custom event can pass maximum of 256 bytes of data, |
| 6155 | based on the IE len we need to identify how many BSS info can |
| 6156 | be filled in to custom event data */ |
| 6157 | /* |
| 6158 | meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 6159 | bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 6160 | CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 6161 | */ |
| 6162 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6163 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) && (!pRoamInfo->pEseBcnReportRsp->numBss)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6164 | { |
| 6165 | hddLog(VOS_TRACE_LEVEL_INFO, "Measurement Done but no scan results"); |
| 6166 | /* If the measurement is none and no scan results found, |
| 6167 | indicate the supplicant about measurement done */ |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 6168 | hdd_indicateEseBcnReportNoResults(pAdapter, |
| 6169 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 6170 | pRoamInfo->pEseBcnReportRsp->flag, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6171 | pRoamInfo->pEseBcnReportRsp->numBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6172 | } |
| 6173 | else |
| 6174 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6175 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6176 | { |
| 6177 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6178 | memset(buf, '\0', sizeof(buf)); |
| 6179 | tot_bcn_ieLen = 0; |
| 6180 | sendBss = 0; |
| 6181 | pos = buf; |
| 6182 | freeBytes = IW_CUSTOM_MAX; |
| 6183 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6184 | for (i = lastSent; i < pRoamInfo->pEseBcnReportRsp->numBss; i++) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6185 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6186 | len = bcnRepFieldSize + ieLenByte + pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen; |
| 6187 | if ((len + tot_bcn_ieLen) > (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6188 | { |
| 6189 | break; |
| 6190 | } |
| 6191 | tot_bcn_ieLen += len; |
| 6192 | sendBss++; |
| 6193 | hddLog(VOS_TRACE_LEVEL_INFO, "i(%d) sizeof bcnReportFields(%d)" |
| 6194 | "IeLength(%d) Length of Ie(%d) totLen(%d)", |
| 6195 | i, bcnRepFieldSize, 1, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6196 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6197 | tot_bcn_ieLen); |
| 6198 | } |
| 6199 | |
| 6200 | hddLog(VOS_TRACE_LEVEL_INFO, "Sending %d BSS Info", sendBss); |
| 6201 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXBCNREP=%d %d %d %d", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6202 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 6203 | sendBss, tot_bcn_ieLen); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6204 | |
| 6205 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6206 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 6207 | sendBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6208 | pos += nBytes; |
| 6209 | freeBytes -= nBytes; |
| 6210 | |
| 6211 | /* Copy total Beacon report data length */ |
| 6212 | vos_mem_copy(pos, (char*)&tot_bcn_ieLen, sizeof(tot_bcn_ieLen)); |
| 6213 | pos += sizeof(tot_bcn_ieLen); |
| 6214 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 6215 | |
| 6216 | for (i = 0; i < sendBss; i++) |
| 6217 | { |
| 6218 | hddLog(VOS_TRACE_LEVEL_INFO, "ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 6219 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 6220 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6221 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6222 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ChanNum, |
| 6223 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Spare, |
| 6224 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.MeasDuration, |
| 6225 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.PhyType, |
| 6226 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.RecvSigPower, |
| 6227 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ParentTsf, |
| 6228 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[0], |
| 6229 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[1], |
| 6230 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.BcnInterval, |
| 6231 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.CapabilityInfo, |
| 6232 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[0], |
| 6233 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[1], |
| 6234 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[2], |
| 6235 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[3], |
| 6236 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[4], |
| 6237 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[5]); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6238 | |
| 6239 | /* bcn report fields are copied */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6240 | len = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields); |
| 6241 | vos_mem_copy(pos, (char*)&pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6242 | pos += len; |
| 6243 | freeBytes -= len; |
| 6244 | |
| 6245 | /* Add 1 byte of ie len */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6246 | len = pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].ieLen; |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6247 | vos_mem_copy(pos, (char*)&len, sizeof(len)); |
| 6248 | pos += sizeof(len); |
| 6249 | freeBytes -= sizeof(len); |
| 6250 | |
| 6251 | /* copy IE from scan results */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6252 | vos_mem_copy(pos, (char*)pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].pBuf, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6253 | pos += len; |
| 6254 | freeBytes -= len; |
| 6255 | } |
| 6256 | |
| 6257 | wrqu.data.pointer = buf; |
| 6258 | wrqu.data.length = strlen(buf); |
| 6259 | |
| 6260 | // send the event |
| 6261 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6262 | lastSent += sendBss; |
| 6263 | } |
| 6264 | } |
| 6265 | } |
| 6266 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6267 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6268 | |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 6269 | hdd_adapter_t *hdd_get_sta_connection_in_progress(hdd_context_t *hdd_ctx) |
| 6270 | { |
| 6271 | hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; |
| 6272 | hdd_adapter_t *adapter = NULL; |
| 6273 | VOS_STATUS status; |
| 6274 | hdd_station_ctx_t *hdd_sta_ctx; |
| 6275 | |
| 6276 | if (!hdd_ctx) { |
| 6277 | hddLog(LOGE, FL("HDD context is NULL")); |
| 6278 | return NULL; |
| 6279 | } |
| 6280 | |
| 6281 | status = hdd_get_front_adapter(hdd_ctx, &adapter_node); |
| 6282 | while (NULL != adapter_node && VOS_STATUS_SUCCESS == status) { |
| 6283 | adapter = adapter_node->pAdapter; |
| 6284 | if (!adapter) |
| 6285 | goto end; |
| 6286 | |
| 6287 | if ((WLAN_HDD_INFRA_STATION == adapter->device_mode) || |
| 6288 | (WLAN_HDD_P2P_CLIENT == adapter->device_mode) || |
| 6289 | (WLAN_HDD_P2P_DEVICE == adapter->device_mode)) { |
| 6290 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6291 | if (eConnectionState_Connecting == |
| 6292 | hdd_sta_ctx->conn_info.connState) { |
| 6293 | hddLog(LOG1, FL("session_id %d: Connection is in progress"), |
| 6294 | adapter->sessionId); |
| 6295 | return adapter; |
| 6296 | } else if ((eConnectionState_Associated == |
| 6297 | hdd_sta_ctx->conn_info.connState) && |
Vignesh Viswanathan | 0ac8e56 | 2018-06-14 17:24:10 +0530 | [diff] [blame] | 6298 | sme_is_sta_key_exchange_in_progress( |
| 6299 | hdd_ctx->hHal, adapter->sessionId)) { |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 6300 | hddLog(LOG1, FL("session_id %d: Key exchange is in progress"), |
| 6301 | adapter->sessionId); |
| 6302 | return adapter; |
| 6303 | } |
| 6304 | } |
| 6305 | end: |
| 6306 | status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next); |
| 6307 | adapter_node = next; |
| 6308 | } |
| 6309 | return NULL; |
| 6310 | } |
| 6311 | |