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 | |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 200 | v_VOID_t hdd_connSetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 201 | eConnectionState connState ) |
| 202 | { |
| 203 | // save the new connection state |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 204 | hddLog(LOG1, FL("ConnectionState Changed from oldState:%d to State:%d"), |
| 205 | pHddStaCtx->conn_info.connState,connState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 206 | pHddStaCtx->conn_info.connState = connState; |
| 207 | } |
| 208 | |
| 209 | // returns FALSE if not connected. |
| 210 | // returns TRUE for the two 'connected' states (Infra Associated or IBSS Connected ). |
| 211 | // returns the connection state. Can specify NULL if you dont' want to get the actual state. |
| 212 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 213 | static inline v_BOOL_t hdd_connGetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 214 | eConnectionState *pConnState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 215 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 216 | v_BOOL_t fConnected; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 217 | eConnectionState connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 218 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 219 | // get the connection state. |
| 220 | connState = pHddStaCtx->conn_info.connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 221 | // Set the fConnected return variable based on the Connected State. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 222 | if ( eConnectionState_Associated == connState || |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 223 | eConnectionState_IbssConnected == connState || |
| 224 | eConnectionState_IbssDisconnected == connState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 225 | { |
| 226 | fConnected = VOS_TRUE; |
| 227 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 228 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 229 | { |
| 230 | fConnected = VOS_FALSE; |
| 231 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 232 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 233 | if ( pConnState ) |
| 234 | { |
| 235 | *pConnState = connState; |
| 236 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 237 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 238 | return( fConnected ); |
| 239 | } |
| 240 | |
| 241 | v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx ) |
| 242 | { |
| 243 | return( hdd_connGetConnectionState( pHddStaCtx, NULL ) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 244 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 245 | |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 246 | eCsrBand hdd_connGetConnectedBand( hdd_station_ctx_t *pHddStaCtx ) |
| 247 | { |
| 248 | v_U8_t staChannel = 0; |
| 249 | |
| 250 | if ( eConnectionState_Associated == pHddStaCtx->conn_info.connState ) |
| 251 | { |
| 252 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 253 | } |
| 254 | |
| 255 | if ( staChannel > 0 && staChannel < 14 ) |
| 256 | return eCSR_BAND_24; |
| 257 | else if (staChannel >= 36 && staChannel <= 165 ) |
| 258 | return eCSR_BAND_5G; |
| 259 | else /* If station is not connected return as eCSR_BAND_ALL */ |
| 260 | return eCSR_BAND_ALL; |
| 261 | } |
| 262 | |
| 263 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 264 | //TODO - Not used anyhwere. Can be removed. |
| 265 | #if 0 |
| 266 | // |
| 267 | v_BOOL_t hdd_connIsConnectedInfra( hdd_adapter_t *pAdapter ) |
| 268 | { |
| 269 | v_BOOL_t fConnectedInfra = FALSE; |
| 270 | eConnectionState connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 271 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 272 | if ( hdd_connGetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connState ) ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 273 | { |
| 274 | if ( eConnectionState_Associated == connState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 275 | { |
| 276 | fConnectedInfra = TRUE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 | return( fConnectedInfra ); |
| 281 | } |
| 282 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 283 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 284 | static inline v_BOOL_t hdd_connGetConnectedCipherAlgo( hdd_station_ctx_t *pHddStaCtx, eCsrEncryptionType *pConnectedCipherAlgo ) |
| 285 | { |
| 286 | v_BOOL_t fConnected = VOS_FALSE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 287 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 288 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 289 | |
| 290 | if ( pConnectedCipherAlgo ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 291 | { |
| 292 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 293 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 294 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 295 | return( fConnected ); |
| 296 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 297 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 298 | inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eMib_dot11DesiredBssType *pConnectedBssType ) |
| 299 | { |
| 300 | v_BOOL_t fConnected = VOS_FALSE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 301 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 302 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 303 | |
| 304 | if ( pConnectedBssType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 305 | { |
| 306 | *pConnectedBssType = pHddStaCtx->conn_info.connDot11DesiredBssType; |
| 307 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 309 | return( fConnected ); |
| 310 | } |
| 311 | |
| 312 | static inline void hdd_connSaveConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eCsrRoamBssType csrRoamBssType ) |
| 313 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 314 | switch( csrRoamBssType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 315 | { |
| 316 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
| 317 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_infrastructure; |
| 318 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 319 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | case eCSR_BSS_TYPE_IBSS: |
| 321 | case eCSR_BSS_TYPE_START_IBSS: |
| 322 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_independent; |
| 323 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 324 | |
| 325 | /** We will never set the BssType to 'any' when attempting a connection |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 326 | so CSR should never send this back to us.*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 327 | case eCSR_BSS_TYPE_ANY: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 328 | default: |
| 329 | VOS_ASSERT( 0 ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 330 | break; |
| 331 | } |
| 332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 333 | } |
| 334 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 335 | /** |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 336 | * hdd_copy_ht_caps()- Populate kernel HT caps structure object |
| 337 | * @hdd_ht_cap: HT capabilities of kernel type |
| 338 | * @roam_ht_cap: HT capabilities maintained locally within driver |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 339 | * |
| 340 | * Return: None |
| 341 | */ |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 342 | void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap, |
| 343 | tDot11fIEHTCaps *roam_ht_cap) |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 344 | { |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 345 | uint32_t i, temp_ht_cap; |
| 346 | |
| 347 | vos_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 348 | |
| 349 | if (roam_ht_cap->advCodingCap) |
| 350 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 351 | if (roam_ht_cap->supportedChannelWidthSet) |
| 352 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 353 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 354 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 355 | if (temp_ht_cap) |
| 356 | hdd_ht_cap->cap_info |= |
| 357 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 358 | if (roam_ht_cap->greenField) |
| 359 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 360 | if (roam_ht_cap->shortGI20MHz) |
| 361 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 362 | if (roam_ht_cap->shortGI40MHz) |
| 363 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 364 | if (roam_ht_cap->txSTBC) |
| 365 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 366 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 367 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 368 | if (temp_ht_cap) |
| 369 | hdd_ht_cap->cap_info |= |
| 370 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 371 | if (roam_ht_cap->delayedBA) |
| 372 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 373 | if (roam_ht_cap->maximalAMSDUsize) |
| 374 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 375 | if (roam_ht_cap->dsssCckMode40MHz) |
| 376 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 377 | if (roam_ht_cap->psmp) |
| 378 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 379 | if (roam_ht_cap->stbcControlFrame) |
| 380 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 381 | if (roam_ht_cap->lsigTXOPProtection) |
| 382 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 383 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 384 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 385 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 386 | hdd_ht_cap->ampdu_params_info |= |
| 387 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 388 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 389 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 390 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 391 | if (temp_ht_cap) |
| 392 | hdd_ht_cap->ampdu_params_info |= |
| 393 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 394 | |
| 395 | /* 802.11n HT extended capabilities masks */ |
| 396 | if (roam_ht_cap->pco) |
| 397 | hdd_ht_cap->extended_ht_cap_info |= |
| 398 | IEEE80211_HT_EXT_CAP_PCO; |
| 399 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 400 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 401 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 402 | if (temp_ht_cap) |
| 403 | hdd_ht_cap->extended_ht_cap_info |= |
| 404 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 405 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 406 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 407 | if (temp_ht_cap) |
| 408 | hdd_ht_cap->extended_ht_cap_info |= |
| 409 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 410 | |
| 411 | /* tx_bf_cap_info capabilities */ |
| 412 | if (roam_ht_cap->txBF) |
| 413 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 414 | if (roam_ht_cap->rxStaggeredSounding) |
| 415 | hdd_ht_cap->tx_BF_cap_info |= |
| 416 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 417 | if (roam_ht_cap->txStaggeredSounding) |
| 418 | hdd_ht_cap->tx_BF_cap_info |= |
| 419 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 420 | if (roam_ht_cap->rxZLF) |
| 421 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 422 | if (roam_ht_cap->txZLF) |
| 423 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 424 | if (roam_ht_cap->implicitTxBF) |
| 425 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 426 | temp_ht_cap = roam_ht_cap->calibration & |
| 427 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 428 | if (temp_ht_cap) |
| 429 | hdd_ht_cap->tx_BF_cap_info |= |
| 430 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 431 | if (roam_ht_cap->explicitCSITxBF) |
| 432 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 433 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 434 | hdd_ht_cap->tx_BF_cap_info |= |
| 435 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 436 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 437 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 438 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 439 | if (temp_ht_cap) |
| 440 | hdd_ht_cap->tx_BF_cap_info |= |
| 441 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 442 | temp_ht_cap = |
| 443 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 444 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 445 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 446 | if (temp_ht_cap) |
| 447 | hdd_ht_cap->tx_BF_cap_info |= |
| 448 | temp_ht_cap << |
| 449 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 450 | temp_ht_cap = |
| 451 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 452 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 453 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 454 | if (temp_ht_cap) |
| 455 | hdd_ht_cap->tx_BF_cap_info |= |
| 456 | temp_ht_cap << |
| 457 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 458 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 459 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 460 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 461 | if (temp_ht_cap) |
| 462 | hdd_ht_cap->tx_BF_cap_info |= |
| 463 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 464 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 465 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 466 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 467 | if (temp_ht_cap) |
| 468 | hdd_ht_cap->tx_BF_cap_info |= |
| 469 | temp_ht_cap << |
| 470 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 471 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 472 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 473 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 474 | if (temp_ht_cap) |
| 475 | hdd_ht_cap->tx_BF_cap_info |= |
| 476 | temp_ht_cap << |
| 477 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 478 | |
| 479 | /* antenna selection */ |
| 480 | if (roam_ht_cap->antennaSelection) |
| 481 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 482 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 483 | hdd_ht_cap->antenna_selection_info |= |
| 484 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 485 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 486 | hdd_ht_cap->antenna_selection_info |= |
| 487 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 488 | if (roam_ht_cap->explicitCSIFeedback) |
| 489 | hdd_ht_cap->antenna_selection_info |= |
| 490 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 491 | if (roam_ht_cap->antennaIndicesFeedback) |
| 492 | hdd_ht_cap->antenna_selection_info |= |
| 493 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 494 | if (roam_ht_cap->rxAS) |
| 495 | hdd_ht_cap->antenna_selection_info |= |
| 496 | ANTENNA_SEL_INFO_RX_AS; |
| 497 | if (roam_ht_cap->txSoundingPPDUs) |
| 498 | hdd_ht_cap->antenna_selection_info |= |
| 499 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 500 | |
| 501 | /* mcs data rate */ |
| 502 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 503 | hdd_ht_cap->mcs.rx_mask[i] = |
| 504 | roam_ht_cap->supportedMCSSet[i]; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 505 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 506 | hdd_ht_cap->mcs.rx_highest = |
| 507 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 508 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
| 509 | hdd_ht_cap->mcs.tx_params = |
| 510 | roam_ht_cap->supportedMCSSet[12]; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 511 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 512 | } |
| 513 | |
| 514 | |
| 515 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 516 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 517 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 518 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 519 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 520 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 521 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 522 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 523 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 524 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 525 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 526 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 527 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 528 | |
| 529 | /** |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 530 | * hdd_copy_vht_caps()- Populate kernel VHT caps structure object |
| 531 | * @hdd_ht_cap: VHT capabilities of kernel type |
| 532 | * @roam_ht_cap: VHT capabilities maintained locally within driver |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 533 | * |
| 534 | * Return: None |
| 535 | */ |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 536 | void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap, |
| 537 | tDot11fIEVHTCaps *roam_vht_cap) |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 538 | { |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 539 | uint32_t temp_vht_cap; |
| 540 | |
| 541 | vos_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 542 | |
| 543 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 544 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 545 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 546 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 547 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
| 548 | if (temp_vht_cap) |
| 549 | if (roam_vht_cap->supportedChannelWidthSet & |
| 550 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 551 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 552 | hdd_vht_cap->vht_cap_info |= |
| 553 | temp_vht_cap << |
| 554 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 555 | if (roam_vht_cap->supportedChannelWidthSet & |
| 556 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 557 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 558 | hdd_vht_cap->vht_cap_info |= |
| 559 | temp_vht_cap << |
| 560 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
| 561 | if (roam_vht_cap->ldpcCodingCap) |
| 562 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 563 | if (roam_vht_cap->shortGI80MHz) |
| 564 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 565 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 566 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 567 | if (roam_vht_cap->txSTBC) |
| 568 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 569 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 570 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 571 | if (temp_vht_cap) |
| 572 | hdd_vht_cap->vht_cap_info |= |
| 573 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 574 | if (roam_vht_cap->suBeamFormerCap) |
| 575 | hdd_vht_cap->vht_cap_info |= |
| 576 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 577 | if (roam_vht_cap->suBeamformeeCap) |
| 578 | hdd_vht_cap->vht_cap_info |= |
| 579 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 580 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 581 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 582 | if (temp_vht_cap) |
| 583 | hdd_vht_cap->vht_cap_info |= |
| 584 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 585 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 586 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 587 | if (temp_vht_cap) |
| 588 | hdd_vht_cap->vht_cap_info |= |
| 589 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 590 | if (roam_vht_cap->muBeamformerCap) |
| 591 | hdd_vht_cap->vht_cap_info |= |
| 592 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 593 | if (roam_vht_cap->muBeamformeeCap) |
| 594 | hdd_vht_cap->vht_cap_info |= |
| 595 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 596 | if (roam_vht_cap->vhtTXOPPS) |
| 597 | hdd_vht_cap->vht_cap_info |= |
| 598 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 599 | if (roam_vht_cap->htcVHTCap) |
| 600 | hdd_vht_cap->vht_cap_info |= |
| 601 | IEEE80211_VHT_CAP_HTC_VHT; |
| 602 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 603 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 604 | if (temp_vht_cap) |
| 605 | hdd_vht_cap->vht_cap_info |= |
| 606 | temp_vht_cap << |
| 607 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 608 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 609 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 610 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 611 | if (temp_vht_cap) |
| 612 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 613 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 614 | if (roam_vht_cap->rxAntPattern) |
| 615 | hdd_vht_cap->vht_cap_info |= |
| 616 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 617 | if (roam_vht_cap->txAntPattern) |
| 618 | hdd_vht_cap->vht_cap_info |= |
| 619 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 620 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 621 | hdd_vht_cap->supp_mcs.rx_highest = |
| 622 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 623 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 624 | hdd_vht_cap->supp_mcs.tx_highest = |
| 625 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 626 | } |
| 627 | |
| 628 | /* ht param */ |
| 629 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 630 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 631 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 632 | |
| 633 | /* operatinon mode */ |
| 634 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 635 | |
| 636 | /* stbc_param */ |
| 637 | #define HT_STBC_PARAM_MCS 0x007f |
| 638 | |
| 639 | /** |
| 640 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 641 | * hdd station context. |
| 642 | * @hdd_sta_ctx: pointer to hdd station context |
| 643 | * @roam_info: pointer to roam info |
| 644 | * |
| 645 | * Return: None |
| 646 | */ |
| 647 | static void hdd_copy_ht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 648 | tCsrRoamInfo *roam_info) |
| 649 | { |
| 650 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 651 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 652 | &hdd_sta_ctx->conn_info.ht_operation; |
| 653 | uint32_t i, temp_ht_ops; |
| 654 | |
| 655 | vos_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 656 | |
| 657 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 658 | |
| 659 | /* HT_PARAMS */ |
| 660 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 661 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 662 | if (temp_ht_ops) |
| 663 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 664 | else |
| 665 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 666 | if (roam_ht_ops->recommendedTxWidthSet) |
| 667 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 668 | if (roam_ht_ops->rifsMode) |
| 669 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 670 | if (roam_ht_ops->controlledAccessOnly) |
| 671 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 672 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 673 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 674 | if (temp_ht_ops) |
| 675 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 676 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 677 | |
| 678 | /* operation mode */ |
| 679 | temp_ht_ops = roam_ht_ops->opMode & |
| 680 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 681 | switch (temp_ht_ops) { |
| 682 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 683 | hdd_ht_ops->operation_mode |= |
| 684 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 685 | break; |
| 686 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 687 | hdd_ht_ops->operation_mode |= |
| 688 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 689 | break; |
| 690 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 691 | hdd_ht_ops->operation_mode |= |
| 692 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 693 | break; |
| 694 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 695 | default: |
| 696 | hdd_ht_ops->operation_mode |= |
| 697 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 698 | } |
| 699 | if (roam_ht_ops->nonGFDevicesPresent) |
| 700 | hdd_ht_ops->operation_mode |= |
| 701 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 702 | if (roam_ht_ops->transmitBurstLimit) |
| 703 | hdd_ht_ops->operation_mode |= |
| 704 | HT_OP_MODE_TX_BURST_LIMIT; |
| 705 | if (roam_ht_ops->obssNonHTStaPresent) |
| 706 | hdd_ht_ops->operation_mode |= |
| 707 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 708 | |
| 709 | /* stbc_param */ |
| 710 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 711 | HT_STBC_PARAM_MCS; |
| 712 | if (temp_ht_ops) |
| 713 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 714 | if (roam_ht_ops->dualCTSProtection) |
| 715 | hdd_ht_ops->stbc_param |= |
| 716 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 717 | if (roam_ht_ops->secondaryBeacon) |
| 718 | hdd_ht_ops->stbc_param |= |
| 719 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 720 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 721 | hdd_ht_ops->stbc_param |= |
| 722 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 723 | if (roam_ht_ops->pcoActive) |
| 724 | hdd_ht_ops->stbc_param |= |
| 725 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 726 | if (roam_ht_ops->pcoPhase) |
| 727 | hdd_ht_ops->stbc_param |= |
| 728 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 729 | |
| 730 | /* basic MCs set */ |
| 731 | for (i = 0; i < 16; ++i) |
| 732 | hdd_ht_ops->basic_set[i] = |
| 733 | roam_ht_ops->basicMCSSet[i]; |
| 734 | } |
| 735 | |
| 736 | /** |
| 737 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 738 | * hdd station context. |
| 739 | * @hdd_sta_ctx: pointer to hdd station context |
| 740 | * @roam_info: pointer to roam info |
| 741 | * |
| 742 | * Return: None |
| 743 | */ |
| 744 | static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 745 | tCsrRoamInfo *roam_info) |
| 746 | { |
| 747 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 748 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 749 | &hdd_sta_ctx->conn_info.vht_operation; |
| 750 | |
| 751 | vos_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 752 | |
| 753 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
| 754 | hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1; |
| 755 | hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2; |
| 756 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 757 | } |
| 758 | |
| 759 | |
| 760 | /** |
| 761 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 762 | * @adapter: Pointer to adapter |
| 763 | * @roam_info: pointer to roam info |
| 764 | * |
| 765 | * Return: None |
| 766 | */ |
| 767 | static void hdd_save_bss_info(hdd_adapter_t *adapter, |
| 768 | tCsrRoamInfo *roam_info) |
| 769 | { |
| 770 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 771 | |
| 772 | hdd_sta_ctx->conn_info.freq = vos_chan_to_freq( |
| 773 | hdd_sta_ctx->conn_info.operationChannel); |
| 774 | if (roam_info->vht_caps.present) { |
| 775 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 776 | hdd_copy_vht_caps(&hdd_sta_ctx->conn_info.vht_caps, |
| 777 | &roam_info->vht_caps); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 778 | } else { |
| 779 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 780 | } |
| 781 | if (roam_info->ht_caps.present) { |
| 782 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 783 | 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] | 784 | } else { |
| 785 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 786 | } |
| 787 | if (roam_info->reassoc) |
| 788 | hdd_sta_ctx->conn_info.roam_count++; |
| 789 | if (roam_info->hs20vendor_ie.present) { |
| 790 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 791 | vos_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 792 | &roam_info->hs20vendor_ie, |
| 793 | sizeof(roam_info->hs20vendor_ie)); |
| 794 | } else { |
| 795 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 796 | } |
| 797 | if (roam_info->ht_operation.present) { |
| 798 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 799 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 800 | } else { |
| 801 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 802 | } |
| 803 | if (roam_info->vht_operation.present) { |
| 804 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 805 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 806 | } else { |
| 807 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 808 | } |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 809 | /* Cache last connection info */ |
| 810 | vos_mem_copy(&hdd_sta_ctx->cache_conn_info, &hdd_sta_ctx->conn_info, |
| 811 | sizeof(connection_info_t)); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 812 | } |
| 813 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 814 | void hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType ) |
| 815 | { |
| 816 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 817 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 819 | VOS_ASSERT( pRoamInfo ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 820 | |
| 821 | if ( pRoamInfo ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 822 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 823 | // Save the BSSID for the connection... |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 824 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType ) |
| 825 | { |
| 826 | VOS_ASSERT( pRoamInfo->pBssDesc ); |
| 827 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,6 ); |
| 828 | |
| 829 | // Save the Station ID for this station from the 'Roam Info'. |
| 830 | //For IBSS mode, staId is assigned in NEW_PEER_IND |
| 831 | //For reassoc, the staID doesn't change and it may be invalid in this structure |
| 832 | //so no change here. |
| 833 | if( !pRoamInfo->fReassocReq ) |
| 834 | { |
| 835 | pHddStaCtx->conn_info.staId [0]= pRoamInfo->staId; |
| 836 | } |
| 837 | } |
| 838 | else if ( eCSR_BSS_TYPE_IBSS == eBssType ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 839 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 840 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,sizeof(pRoamInfo->bssid) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 841 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 842 | else |
| 843 | { |
| 844 | // can't happen. We need a valid IBSS or Infra setting in the BSSDescription |
| 845 | // or we can't function. |
| 846 | VOS_ASSERT( 0 ); |
| 847 | } |
| 848 | |
| 849 | // notify WMM |
| 850 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 851 | |
| 852 | if( !pRoamInfo->u.pConnectedProfile ) |
| 853 | { |
| 854 | VOS_ASSERT( pRoamInfo->u.pConnectedProfile ); |
| 855 | } |
| 856 | else |
| 857 | { |
| 858 | // Get Multicast Encryption Type |
| 859 | encryptType = pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 860 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 861 | // Get Unicast Encrytion Type |
| 862 | encryptType = pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 863 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 864 | |
| 865 | pHddStaCtx->conn_info.authType = pRoamInfo->u.pConnectedProfile->AuthType; |
| 866 | |
| 867 | pHddStaCtx->conn_info.operationChannel = pRoamInfo->u.pConnectedProfile->operationChannel; |
| 868 | |
| 869 | // Save the ssid for the connection |
| 870 | 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] | 871 | |
| 872 | // Save dot11mode in which STA associated to AP |
| 873 | pHddStaCtx->conn_info.dot11Mode = pRoamInfo->u.pConnectedProfile->dot11Mode; |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 874 | |
| 875 | pHddStaCtx->conn_info.rate_flags = pRoamInfo->maxRateFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 876 | } |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 877 | hdd_save_bss_info(pAdapter, pRoamInfo); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 878 | } |
| 879 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 880 | // save the connected BssType |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 881 | hdd_connSaveConnectedBssType( pHddStaCtx, eBssType ); |
| 882 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 883 | } |
| 884 | |
| 885 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 886 | /* |
| 887 | * Send the 11R key information to the supplicant. |
| 888 | * Only then can the supplicant generate the PMK-R1. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 889 | * (BTW, the ESE supplicant also needs the Assoc Resp IEs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 890 | * for the same purpose.) |
| 891 | * |
| 892 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA |
| 893 | * this contains the R1KHID, R0KHID and the MDID. |
| 894 | * For FT, this consists of the Reassoc Rsp FTIEs. |
| 895 | * This is the Assoc Response. |
| 896 | */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 897 | static void hdd_SendFTAssocResponse(struct net_device *dev, hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 898 | tCsrRoamInfo *pCsrRoamInfo) |
| 899 | { |
| 900 | union iwreq_data wrqu; |
| 901 | char *buff; |
| 902 | unsigned int len = 0; |
| 903 | u8 *pFTAssocRsp = NULL; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 904 | |
| 905 | if (pCsrRoamInfo->nAssocRspLength == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 906 | { |
| 907 | hddLog(LOGE, |
| 908 | "%s: pCsrRoamInfo->nAssocRspLength=%d", |
| 909 | __func__, (int)pCsrRoamInfo->nAssocRspLength); |
| 910 | return; |
| 911 | } |
| 912 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 913 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 914 | pCsrRoamInfo->nAssocReqLength); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 915 | if (pFTAssocRsp == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 916 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 917 | hddLog(LOGE, "%s: AssocReq or AssocRsp is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 918 | return; |
| 919 | } |
| 920 | |
| 921 | // pFTAssocRsp needs to point to the IEs |
| 922 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 923 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 924 | (unsigned int)pFTAssocRsp[0], |
| 925 | (unsigned int)pFTAssocRsp[1]); |
| 926 | |
| 927 | // We need to send the IEs to the supplicant. |
| 928 | buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 929 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 930 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 931 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 932 | return; |
| 933 | } |
| 934 | |
| 935 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
| 936 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 937 | wrqu.data.length = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 938 | memset(buff, 0, IW_GENERIC_IE_MAX); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 939 | memcpy(buff, pFTAssocRsp, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 940 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 941 | |
| 942 | kfree(buff); |
| 943 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 944 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 945 | |
| 946 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 947 | |
| 948 | /*--------------------------------------------------- |
| 949 | * |
| 950 | * Send the FTIEs, RIC IEs during FT. This is eventually |
| 951 | * used to send the FT events to the supplicant |
| 952 | * |
| 953 | * At the reception of Auth2 we send the RIC followed |
| 954 | * by the auth response IEs to the supplicant. |
| 955 | * Once both are received in the supplicant, an FT |
| 956 | * event is generated to the supplicant. |
| 957 | * |
| 958 | *--------------------------------------------------- |
| 959 | */ |
| 960 | void hdd_SendFTEvent(hdd_adapter_t *pAdapter) |
| 961 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 962 | tANI_U16 auth_resp_len = 0; |
| 963 | tANI_U32 ric_ies_length = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 964 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 965 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 966 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 967 | struct cfg80211_ft_event_params ftEvent; |
| 968 | v_U8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 969 | v_U8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 970 | struct net_device *dev = pAdapter->dev; |
| 971 | #else |
| 972 | char *buff; |
| 973 | union iwreq_data wrqu; |
| 974 | tANI_U16 str_len; |
| 975 | #endif |
| 976 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 977 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 978 | vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 979 | vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 980 | |
Kanchanapally, Vidyullatha | 31b8d14 | 2015-01-30 14:25:18 +0530 | [diff] [blame] | 981 | sme_GetRICIEs(pHddCtx->hHal, (u8 *)ricIe, |
| 982 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 983 | if (ric_ies_length == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 984 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 985 | hddLog(LOGW, |
| 986 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 987 | __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 988 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 989 | |
| 990 | ftEvent.ric_ies = ricIe; |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 991 | ftEvent.ric_ies_len = ric_ies_length; |
| 992 | 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] | 993 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 994 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 995 | DOT11F_IE_FTINFO_MAX_LEN, &auth_resp_len); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 996 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 997 | if (auth_resp_len == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 998 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 999 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1000 | return; |
| 1001 | } |
| 1002 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1003 | sme_SetFTPreAuthState(pHddCtx->hHal, TRUE); |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 1004 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1005 | ftEvent.target_ap = ftIe; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1006 | |
| 1007 | ftEvent.ies = (u8 *)(ftIe + SIR_MAC_ADDR_LENGTH); |
| 1008 | ftEvent.ies_len = auth_resp_len - SIR_MAC_ADDR_LENGTH; |
| 1009 | |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 1010 | hddLog(LOG1, "%s ftEvent.ies_len %zu", __FUNCTION__, ftEvent.ies_len); |
| 1011 | hddLog(LOG1, "%s ftEvent.ric_ies_len %zu", |
| 1012 | __FUNCTION__, ftEvent.ric_ies_len ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1013 | 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] | 1014 | __FUNCTION__, ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1015 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1016 | ftEvent.target_ap[5]); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1017 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 1018 | (void)cfg80211_ft_event(dev, &ftEvent); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1019 | |
| 1020 | #else |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1021 | // We need to send the IEs to the supplicant |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1022 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1023 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1024 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1025 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1026 | return; |
| 1027 | } |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1028 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1029 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1030 | // Sme needs to send the RIC IEs first |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1031 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1032 | sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]), |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1033 | (IW_CUSTOM_MAX - str_len), &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1034 | if (ric_ies_length == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1035 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1036 | hddLog(LOGW, |
| 1037 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 1038 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1039 | } |
| 1040 | else |
| 1041 | { |
| 1042 | wrqu.data.length = str_len + ric_ies_length; |
| 1043 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1044 | } |
| 1045 | |
| 1046 | // Sme needs to provide the Auth Resp |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1047 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1048 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1049 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len], |
| 1050 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1051 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1052 | if (auth_resp_len == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1053 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 1054 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Bhargav Shah | 8b5b2f7 | 2015-07-14 11:53:46 +0530 | [diff] [blame] | 1055 | kfree(buff); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1056 | return; |
| 1057 | } |
| 1058 | |
| 1059 | wrqu.data.length = str_len + auth_resp_len; |
| 1060 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1061 | |
| 1062 | kfree(buff); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1063 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1064 | } |
| 1065 | |
| 1066 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 1067 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1068 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | |
| 1070 | /* |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1071 | * Send the ESE required "new AP Channel info" to the supplicant. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1072 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1073 | * |
| 1074 | * The current (new AP) channel information is passed in. |
| 1075 | */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1076 | static void hdd_SendNewAPChannelInfo(struct net_device *dev, hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1077 | tCsrRoamInfo *pCsrRoamInfo) |
| 1078 | { |
| 1079 | union iwreq_data wrqu; |
| 1080 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1081 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1082 | |
| 1083 | if (descriptor == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1084 | { |
| 1085 | hddLog(LOGE, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 1086 | "%s: pCsrRoamInfo->pBssDesc=%pK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1087 | __func__, descriptor); |
| 1088 | return; |
| 1089 | } |
| 1090 | |
| 1091 | // 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] | 1092 | hddLog(LOGW, "%s: Sending up an SIOCGIWFREQ, channelId=%d", __func__, descriptor->channelId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1093 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1094 | wrqu.freq.m = descriptor->channelId; |
| 1095 | wrqu.freq.e = 0; |
| 1096 | wrqu.freq.i = 0; |
| 1097 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1098 | } |
| 1099 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1100 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1101 | |
| 1102 | void hdd_SendUpdateBeaconIEsEvent(hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo) |
| 1103 | { |
| 1104 | union iwreq_data wrqu; |
| 1105 | u8 *pBeaconIes; |
| 1106 | u8 currentLen = 0; |
| 1107 | char *buff; |
| 1108 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1109 | |
| 1110 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1111 | |
| 1112 | if (0 == pCsrRoamInfo->nBeaconLength) |
| 1113 | { |
| 1114 | hddLog(LOGE, "%s: pCsrRoamInfo->nBeaconFrameLength = 0", __func__); |
| 1115 | return; |
| 1116 | } |
| 1117 | pBeaconIes = (u8 *)(pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1118 | if (pBeaconIes == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1119 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1120 | hddLog(LOGE, "%s: Beacon IEs is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1121 | return; |
| 1122 | } |
| 1123 | |
| 1124 | // pBeaconIes needs to point to the IEs |
| 1125 | hddLog(LOG1, "%s: Beacon IEs is now at %02x%02x", __func__, |
| 1126 | (unsigned int)pBeaconIes[0], |
| 1127 | (unsigned int)pBeaconIes[1]); |
| 1128 | 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] | 1129 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1130 | // We need to send the IEs to the supplicant. |
| 1131 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1132 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1133 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1134 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1135 | return; |
| 1136 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1137 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1138 | |
| 1139 | strLen = strlcpy(buff,"BEACONIEs=", IW_CUSTOM_MAX); |
| 1140 | currentLen = strLen + 1; |
| 1141 | |
| 1142 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1143 | do |
| 1144 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1145 | /* 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] | 1146 | * max size and send it to supplicant. Changes are done in supplicant to handle this */ |
| 1147 | vos_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
| 1148 | currentLen = VOS_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
| 1149 | vos_mem_copy(&buff[strLen + 1], pBeaconIes+currentOffset, currentLen); |
| 1150 | currentOffset += currentLen; |
| 1151 | totalIeLen -= currentLen; |
| 1152 | wrqu.data.length = strLen + 1 + currentLen; |
| 1153 | if (totalIeLen) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1154 | buff[strLen] = 1; // This tells supplicant more chunks are pending |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1155 | else |
| 1156 | buff[strLen] = 0; // For last chunk of beacon IE to supplicant |
| 1157 | |
| 1158 | hddLog(LOG1, "%s: Beacon IEs length to supplicant = %d", __func__, currentLen); |
| 1159 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1160 | } while (totalIeLen > 0); |
| 1161 | |
| 1162 | kfree(buff); |
| 1163 | } |
| 1164 | |
| 1165 | static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRoamInfo) |
| 1166 | { |
| 1167 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1168 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1169 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1170 | union iwreq_data wrqu; |
| 1171 | int we_event; |
| 1172 | char *msg; |
| 1173 | int type = -1; |
| 1174 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1175 | #if defined (WLAN_FEATURE_VOWIFI_11R) |
| 1176 | // Added to find the auth type on the fly at run time |
| 1177 | // rather than with cfg to see if FT is enabled |
| 1178 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1179 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 1180 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1181 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1182 | memset(&wrqu, '\0', sizeof(wrqu)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1183 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1184 | we_event = SIOCGIWAP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1185 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1186 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
| 1187 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1188 | /* In case of roaming ; We are not doing disconnect. |
| 1189 | * If disconnect is not being done for roam; We will not |
| 1190 | * decrease count for Active sessions. We should not increase active |
| 1191 | * active session in case of roaming. |
| 1192 | */ |
Padma, Santhosh Kumar | 87ba40f | 2014-11-26 19:40:15 +0530 | [diff] [blame] | 1193 | if((pHddStaCtx->ft_carrier_on == FALSE) && !pCsrRoamInfo->fReassocReq) |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1194 | { |
| 1195 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
| 1196 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1197 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1198 | type = WLAN_STA_ASSOC_DONE_IND; |
| 1199 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 1200 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 1201 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1202 | { |
| 1203 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_1) |
| 1204 | { |
| 1205 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTED_STATE_1; |
| 1206 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 1207 | "Connecting state to Connected State for 8-way " |
| 1208 | "Handshake"); |
| 1209 | } |
| 1210 | else if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_2) |
| 1211 | { |
| 1212 | globalP2PConnectionStatus = P2P_CLIENT_COMPLETED_STATE; |
| 1213 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 1214 | "Connecting state to P2P Client Connection Completed"); |
| 1215 | } |
| 1216 | } |
| 1217 | #endif |
Yeshwanth Sriram Guntuka | 0004c0b | 2017-12-06 14:43:49 +0530 | [diff] [blame] | 1218 | hddLog(VOS_TRACE_LEVEL_ERROR, MAC_ADDRESS_STR " connected to " |
| 1219 | MAC_ADDRESS_STR, |
| 1220 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1221 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1222 | hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo); |
| 1223 | |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1224 | hdd_manage_delack_timer(pHddCtx); |
| 1225 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1226 | /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or |
| 1227 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled |
| 1228 | * and fFTEnable is TRUE */ |
| 1229 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1230 | // Send FT Keys to the supplicant when FT is enabled |
| 1231 | if ((pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN_PSK) || |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1232 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1233 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1234 | || (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1235 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) |
| 1236 | #endif |
| 1237 | ) |
| 1238 | { |
| 1239 | hdd_SendFTAssocResponse(dev, pAdapter, pCsrRoamInfo); |
| 1240 | } |
| 1241 | #endif |
| 1242 | } |
| 1243 | else if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) // IBss Associated |
| 1244 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1245 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 1246 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1247 | type = WLAN_STA_ASSOC_DONE_IND; |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 1248 | |
| 1249 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1250 | "wlan: new IBSS connection to " MAC_ADDRESS_STR, |
| 1251 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1252 | } |
| 1253 | else /* Not Associated */ |
| 1254 | { |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 1255 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1256 | "wlan: disconnected"); |
gaurank kathpalia | 5180158 | 2019-04-05 13:56:55 +0530 | [diff] [blame] | 1257 | if (pHddCtx->btCoexModeSet) { |
| 1258 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1259 | FL("Wlan disconnected, sending DHCP stop indication")); |
| 1260 | pHddCtx->btCoexModeSet = FALSE; |
| 1261 | sme_DHCPStopInd(pHddCtx->hHal, pAdapter->device_mode, |
| 1262 | pAdapter->sessionId); |
| 1263 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1264 | type = WLAN_STA_DISASSOC_DONE_IND; |
| 1265 | memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN); |
Bhargav Shah | d071591 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 1266 | |
| 1267 | hdd_manage_delack_timer(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1268 | } |
Sudhir Sattayappa Kohalli | 90e4c75 | 2013-03-21 14:25:04 -0700 | [diff] [blame] | 1269 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1270 | |
| 1271 | msg = NULL; |
| 1272 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 1273 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 1274 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1275 | { |
| 1276 | wireless_send_event(dev, we_event, &wrqu, msg); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1277 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1278 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1279 | { |
| 1280 | if ( (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1281 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1282 | hdd_SendNewAPChannelInfo(dev, pAdapter, pCsrRoamInfo); |
| 1283 | } |
| 1284 | #endif |
| 1285 | } |
| 1286 | send_btc_nlink_msg(type, 0); |
| 1287 | } |
| 1288 | |
| 1289 | void hdd_connRemoveConnectInfo( hdd_station_ctx_t *pHddStaCtx ) |
| 1290 | { |
| 1291 | // Remove staId, bssId and peerMacAddress |
| 1292 | pHddStaCtx->conn_info.staId [ 0 ] = 0; |
| 1293 | vos_mem_zero( &pHddStaCtx->conn_info.bssId, sizeof( v_MACADDR_t ) ); |
| 1294 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], sizeof( v_MACADDR_t ) ); |
| 1295 | |
| 1296 | // Clear all security settings |
| 1297 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1298 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1299 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1300 | |
| 1301 | vos_mem_zero( &pHddStaCtx->conn_info.Keys, sizeof( tCsrKeys ) ); |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 1302 | vos_mem_zero( &pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1303 | |
| 1304 | // Set not-connected state |
| 1305 | pHddStaCtx->conn_info.connDot11DesiredBssType = eCSR_BSS_TYPE_ANY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1306 | |
| 1307 | vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) ); |
| 1308 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1309 | |
| 1310 | VOS_STATUS hdd_ibss_deinit_tx_rx_sta ( hdd_adapter_t *pAdapter, v_U8_t STAId ) |
| 1311 | { |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1312 | v_U8_t ac; |
| 1313 | /**Track whether OS TX queue has been disabled.*/ |
| 1314 | v_BOOL_t txSuspended[NUM_TX_QUEUES]; |
| 1315 | v_U8_t tlAC; |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1316 | v_U8_t i; |
| 1317 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1318 | hdd_ibss_peer_info_t *pPeerInfo; |
| 1319 | |
| 1320 | if( NULL == pHddStaCtx ) |
| 1321 | { |
| 1322 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1323 | "%s: HDD station context NULL ",__func__); |
| 1324 | return VOS_STATUS_E_FAILURE; |
| 1325 | } |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1326 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1327 | pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1328 | if (FALSE == pPeerInfo->ibssStaInfo[STAId].isUsed) |
| 1329 | { |
| 1330 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1331 | "%s: Deinit station not inited %d", __func__, STAId ); |
| 1332 | return VOS_STATUS_E_FAILURE; |
| 1333 | } |
| 1334 | |
| 1335 | hdd_flush_ibss_tx_queues(pAdapter, STAId); |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1336 | |
| 1337 | for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++) |
| 1338 | { |
| 1339 | tlAC = hdd_QdiscAcToTlAC[ac]; |
| 1340 | txSuspended[ac] = pPeerInfo->ibssStaInfo[STAId].txSuspended[tlAC]; |
| 1341 | } |
| 1342 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1343 | vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t)); |
| 1344 | |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 1345 | /* re-init hdd list, since netdev can still open adapter until |
| 1346 | * driver gets unloaded |
| 1347 | */ |
| 1348 | for (i = 0; i < NUM_TX_QUEUES; i ++) |
| 1349 | { |
| 1350 | hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], |
| 1351 | HDD_TX_QUEUE_MAX_LEN); |
| 1352 | } |
| 1353 | |
| 1354 | for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++) |
| 1355 | { |
| 1356 | if (txSuspended[ac]) |
| 1357 | { |
| 1358 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1359 | "%s: TX queue re-enabled", __func__); |
| 1360 | netif_wake_subqueue(pAdapter->dev, ac); |
| 1361 | } |
| 1362 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1363 | return VOS_STATUS_SUCCESS; |
| 1364 | } |
| 1365 | |
| 1366 | static VOS_STATUS hdd_ibss_DeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 1367 | { |
| 1368 | VOS_STATUS vosStatus; |
| 1369 | |
| 1370 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 1371 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1372 | { |
| 1373 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1374 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
| 1375 | "Status= %d [0x%08X]", |
| 1376 | __func__, staId, vosStatus, vosStatus ); |
| 1377 | } |
| 1378 | |
| 1379 | vosStatus = hdd_ibss_deinit_tx_rx_sta ( pAdapter, staId ); |
| 1380 | if( VOS_STATUS_E_FAILURE == vosStatus ) |
| 1381 | { |
| 1382 | VOS_TRACE ( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1383 | "hdd_ibss_deinit_tx_rx_sta() failed for staID %d. " |
| 1384 | "Status = %d [0x%08X]", |
| 1385 | staId, vosStatus, vosStatus ); |
| 1386 | } |
| 1387 | |
| 1388 | return( vosStatus ); |
| 1389 | } |
| 1390 | |
| 1391 | VOS_STATUS hdd_ibss_init_tx_rx_sta( hdd_adapter_t *pAdapter, v_U8_t STAId, v_MACADDR_t *pmacAddrSTA) |
| 1392 | { |
| 1393 | v_U8_t i = 0; |
| 1394 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1395 | hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1396 | |
| 1397 | if (pPeerInfo->ibssStaInfo[STAId].isUsed) |
| 1398 | { |
| 1399 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR, |
| 1400 | "%s: Reinit station %d", __func__, STAId ); |
| 1401 | return VOS_STATUS_E_FAILURE; |
| 1402 | } |
| 1403 | |
| 1404 | vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t)); |
| 1405 | for (i = 0; i < NUM_TX_QUEUES; i ++) |
| 1406 | { |
| 1407 | hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN); |
| 1408 | } |
| 1409 | |
| 1410 | pPeerInfo->ibssStaInfo[STAId].isUsed = VOS_TRUE; |
| 1411 | pPeerInfo->ibssStaInfo[STAId].isDeauthInProgress = VOS_FALSE; |
| 1412 | vos_copy_macaddr( &pPeerInfo->ibssStaInfo[STAId].macAddrSTA, pmacAddrSTA); |
| 1413 | |
| 1414 | return VOS_STATUS_SUCCESS; |
| 1415 | } |
| 1416 | |
| 1417 | static VOS_STATUS hdd_ibss_RegisterSTA( hdd_adapter_t *pAdapter, |
| 1418 | tCsrRoamInfo *pRoamInfo, |
| 1419 | v_U8_t staId, |
| 1420 | v_MACADDR_t *pPeerMacAddress, |
| 1421 | tSirBssDescription *pBssDesc ) |
| 1422 | { |
| 1423 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 1424 | WLAN_STADescType staDesc = {0}; |
| 1425 | eCsrEncryptionType connectedCipherAlgo; |
| 1426 | v_BOOL_t fConnected; |
| 1427 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1428 | hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 1429 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1430 | |
| 1431 | if ( pPeerInfo->ibssStaInfo[staId].isUsed ) |
| 1432 | { |
| 1433 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1434 | "clean up old entry for STA %d", staId); |
| 1435 | hdd_ibss_DeregisterSTA( pAdapter, staId ); |
| 1436 | } |
| 1437 | |
| 1438 | staDesc.ucSTAId = staId; |
| 1439 | staDesc.wSTAType = WLAN_STA_IBSS; |
| 1440 | |
| 1441 | // Note that for IBSS, the STA MAC address and BSSID are goign to be different where |
| 1442 | // in infrastructure, they are the same (BSSID is the MAC address of the AP). So, |
| 1443 | // for IBSS we have a second field to pass to TL in the STA descriptor that we don't |
| 1444 | // pass when making an Infrastructure connection. |
| 1445 | vos_mem_copy(staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes)); |
| 1446 | vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId, 6 ); |
| 1447 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 1448 | |
| 1449 | if (hdd_wmm_is_active(pAdapter)) |
| 1450 | { |
| 1451 | staDesc.ucQosEnabled = 1; |
| 1452 | } |
| 1453 | else |
| 1454 | { |
| 1455 | staDesc.ucQosEnabled = 0; |
| 1456 | } |
| 1457 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 1458 | "HDD SOFTAP register TL QoS_enabled=%d", |
| 1459 | staDesc.ucQosEnabled ); |
| 1460 | |
| 1461 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 1462 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 1463 | { |
| 1464 | staDesc.ucProtectedFrame = 1; |
| 1465 | } |
| 1466 | else |
| 1467 | { |
| 1468 | staDesc.ucProtectedFrame = 0; |
| 1469 | |
| 1470 | } |
| 1471 | |
| 1472 | hdd_ibss_init_tx_rx_sta(pAdapter, staId, &staDesc.vSTAMACAddress); |
| 1473 | |
| 1474 | // UMA is Not ready yet, Xlation will be done by TL |
| 1475 | staDesc.ucSwFrameTXXlation = 1; |
| 1476 | staDesc.ucSwFrameRXXlation = 1; |
| 1477 | staDesc.ucAddRmvLLC = 1; |
| 1478 | // Initialize signatures and state |
| 1479 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 1480 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 1481 | staDesc.ucInitState = WLANTL_STA_AUTHENTICATED; |
| 1482 | |
| 1483 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
| 1484 | |
| 1485 | // Register the Station with TL. |
| 1486 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 1487 | hdd_rx_packet_cbk, |
| 1488 | hdd_tx_complete_cbk, |
| 1489 | hdd_ibss_tx_fetch_packet_cbk, &staDesc, |
| 1490 | pBssDesc->rssi ); |
| 1491 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1492 | { |
| 1493 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1494 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", |
| 1495 | vosStatus, vosStatus ); |
| 1496 | return vosStatus; |
| 1497 | } |
| 1498 | |
| 1499 | //Timer value should be in milliseconds |
| 1500 | if ( pHddCtx->cfg_ini->dynSplitscan && |
| 1501 | ( VOS_TIMER_STATE_RUNNING != |
| 1502 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))) |
| 1503 | { |
| 1504 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 1505 | pHddCtx->cfg_ini->trafficMntrTmrForSplitScan); |
| 1506 | } |
| 1507 | |
| 1508 | pPeerInfo->ibssStaInfo[staId].ucSTAId = staId; |
| 1509 | pPeerInfo->ibssStaInfo[staId].isQosEnabled = staDesc.ucQosEnabled; |
| 1510 | |
| 1511 | vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId, |
| 1512 | WLANTL_STA_AUTHENTICATED ); |
| 1513 | |
| 1514 | pPeerInfo->ibssStaInfo[staId].tlSTAState = WLANTL_STA_AUTHENTICATED; |
| 1515 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 1516 | |
| 1517 | return( vosStatus ); |
| 1518 | } |
| 1519 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1520 | /* TODO Revist this function. and data path */ |
| 1521 | static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 1522 | { |
| 1523 | VOS_STATUS vosStatus; |
Ravi Joshi | f9520d6 | 2013-10-18 04:11:46 -0700 | [diff] [blame] | 1524 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1525 | hdd_disconnect_tx_rx(pAdapter); |
Ravi Joshi | f9520d6 | 2013-10-18 04:11:46 -0700 | [diff] [blame] | 1526 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1527 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 1528 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1529 | { |
Gopichand Nakkala | d786fa3 | 2013-03-20 23:48:19 +0530 | [diff] [blame] | 1530 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1531 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1532 | "Status= %d [0x%08X]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1533 | __func__, staId, vosStatus, vosStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1534 | } |
| 1535 | return( vosStatus ); |
| 1536 | } |
| 1537 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 1538 | /** |
| 1539 | * hdd_print_bss_info() - print bss info |
| 1540 | * @hdd_sta_ctx: pointer to hdd station context |
| 1541 | * |
| 1542 | * Return: None |
| 1543 | */ |
| 1544 | void hdd_print_bss_info(hdd_station_ctx_t *hdd_sta_ctx) |
| 1545 | { |
| 1546 | uint32_t *cap_info; |
| 1547 | |
| 1548 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"WIFI DATA LOGGER"); |
| 1549 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"channel: %d", |
| 1550 | hdd_sta_ctx->conn_info.freq); |
| 1551 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"dot11mode: %d", |
| 1552 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1553 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"AKM: %d", |
| 1554 | hdd_sta_ctx->conn_info.authType); |
| 1555 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ssid: %.*s", |
| 1556 | hdd_sta_ctx->conn_info.SSID.SSID.length, |
| 1557 | hdd_sta_ctx->conn_info.SSID.SSID.ssId); |
| 1558 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"roam count: %d", |
| 1559 | hdd_sta_ctx->conn_info.roam_count); |
| 1560 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ant_info: %d", |
| 1561 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1562 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate legacy %d", |
| 1563 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1564 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate mcs: %d", |
| 1565 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1566 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1567 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1568 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ht caps: %x", |
| 1569 | *cap_info); |
| 1570 | } |
| 1571 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1572 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1573 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"vht caps: %x", |
| 1574 | *cap_info); |
| 1575 | } |
| 1576 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1577 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"hs20 info: %x", |
| 1578 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1579 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"signal: %d", |
| 1580 | hdd_sta_ctx->conn_info.signal); |
| 1581 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"noise: %d", |
| 1582 | hdd_sta_ctx->conn_info.noise); |
| 1583 | } |
| 1584 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1585 | /** |
| 1586 | * hdd_check_and_move_if_sap_is_on_dfs_chan() - move the sap to non dfs channel |
| 1587 | * @hdd_ctx: pointer to hdd context |
| 1588 | * @sta_adapter: pointer to sta adapater |
| 1589 | * |
| 1590 | * This function is used to check if SAP is operating on DFS channel in stand |
| 1591 | * alone mode and move it to non dfs channel |
| 1592 | * |
| 1593 | * Return: void. |
| 1594 | */ |
| 1595 | static void hdd_check_and_move_if_sap_is_on_dfs_chan(hdd_context_t *hdd_ctx, |
| 1596 | hdd_adapter_t *sta_adapter) |
| 1597 | { |
| 1598 | hdd_adapter_t *sap_adapter; |
| 1599 | ptSapContext sap_ctx; |
| 1600 | v_CONTEXT_t vos_ctx; |
| 1601 | eNVChannelEnabledType chan_state; |
| 1602 | |
| 1603 | if (hdd_is_sta_sap_scc_allowed_on_dfs_chan(hdd_ctx)) { |
| 1604 | sap_adapter = hdd_get_adapter(hdd_ctx, WLAN_HDD_SOFTAP); |
| 1605 | |
| 1606 | if (!sap_adapter) { |
| 1607 | hddLog(LOG1, FL("SAP not exists, nothing to do")); |
| 1608 | return; |
| 1609 | } |
| 1610 | |
| 1611 | vos_ctx = hdd_ctx->pvosContext; |
| 1612 | if (!vos_ctx) { |
| 1613 | hddLog(LOGE, FL("vos_ctx is NULL")); |
| 1614 | return; |
| 1615 | } |
| 1616 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 1617 | if (!sap_ctx) { |
| 1618 | hddLog(LOG1, FL("sap_ctx not exists")); |
| 1619 | return; |
| 1620 | } |
| 1621 | |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1622 | if (sap_ctx->sapsMachine != eSAP_STARTED) { |
| 1623 | hddLog(LOG1, FL("SAP is not in eSAP_STARTED state")); |
| 1624 | return; |
| 1625 | } |
| 1626 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1627 | chan_state = vos_nv_getChannelEnabledState(sap_ctx->channel); |
| 1628 | |
| 1629 | hddLog(LOG1, "SAP is operating on channel (%hu), chan_state %d", |
| 1630 | sap_ctx->channel, chan_state); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1631 | if (vos_nv_getChannelEnabledState(sap_ctx->channel) != |
| 1632 | NV_CHANNEL_DFS) { |
| 1633 | hddLog(LOG1, "SAP is on non DFS channel. nothing to do"); |
| 1634 | return; |
| 1635 | } |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1636 | |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1637 | hddLog(LOG1, "Schedule workqueue to move the SAP to non DFS channel"); |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 1638 | schedule_delayed_work(&hdd_ctx->ecsa_chan_change_work, |
| 1639 | msecs_to_jiffies(ECSA_DFS_CHAN_CHANGE_DEFER_TIME)); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1640 | } |
| 1641 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1642 | |
| 1643 | static eHalStatus hdd_DisConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1644 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 1645 | eCsrRoamResult roamResult ) |
| 1646 | { |
| 1647 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1648 | VOS_STATUS vstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1649 | struct net_device *dev = pAdapter->dev; |
| 1650 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1651 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1652 | v_U8_t sta_id; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1653 | v_BOOL_t sendDisconInd = TRUE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1654 | |
| 1655 | // Sanity check |
| 1656 | if(dev == NULL) |
| 1657 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 1658 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1659 | "%s: net_dev is released return", __func__); |
| 1660 | return eHAL_STATUS_FAILURE; |
| 1661 | } |
| 1662 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1663 | // notify apps that we can't pass traffic anymore |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 1664 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1665 | netif_tx_disable(dev); |
| 1666 | netif_carrier_off(dev); |
Mukul Sharma | 09ab4bd | 2014-11-24 18:07:26 +0530 | [diff] [blame] | 1667 | //TxTimeoutCount need to reset in case of disconnect handler |
| 1668 | pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1669 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 1670 | wlan_hdd_check_and_stop_mon(pAdapter, false); |
| 1671 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1672 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1673 | /* If only STA mode is on */ |
| 1674 | if((pHddCtx->concurrency_mode <= 1) && |
| 1675 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <= 1)) |
| 1676 | { |
| 1677 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 1678 | } |
| 1679 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1680 | /* Need to apply spin lock before decreasing active sessions |
| 1681 | * as there can be chance for double decrement if context switch |
| 1682 | * Calls wlan_hdd_disconnect. |
| 1683 | */ |
| 1684 | |
| 1685 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1686 | |
| 1687 | /* HDD has initiated disconnect, do not send disconnect indication |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1688 | * to kernel. Sending disconnected event to kernel for userspace |
| 1689 | * initiated disconnect will be handled by diconnect handler call |
| 1690 | * to cfg80211_disconnected |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1691 | */ |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1692 | if ((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) || |
Abhishek Singh | d2ce680 | 2018-05-08 15:21:06 +0530 | [diff] [blame] | 1693 | (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) || |
| 1694 | (eConnectionState_Connecting == pHddStaCtx->conn_info.connState)) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1695 | { |
| 1696 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1697 | FL(" HDD has initiated a disconnect, no need to send" |
| 1698 | " disconnect indication to kernel")); |
| 1699 | sendDisconInd = FALSE; |
| 1700 | } |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1701 | else if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1702 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1703 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 1704 | FL("Set HDD connState to eConnectionState_Disconnecting from %d "), |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1705 | pHddStaCtx->conn_info.connState); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 1706 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 1707 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1708 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 1709 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 1710 | vos_flush_delayed_work(&pHddCtx->ecsa_chan_change_work); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1711 | hdd_clearRoamProfileIe( pAdapter ); |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 1712 | |
| 1713 | hdd_wmm_init( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1714 | |
| 1715 | // indicate 'disconnect' status to wpa_supplicant... |
| 1716 | hdd_SendAssociationEvent(dev,pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1717 | /* indicate disconnected event to nl80211 */ |
| 1718 | if(roamStatus != eCSR_ROAM_IBSS_LEAVE) |
| 1719 | { |
| 1720 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 1721 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 1722 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1723 | { |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 1724 | if (sendDisconInd) |
| 1725 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 1726 | "%s: sent disconnected event to nl80211", |
| 1727 | __func__); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 1728 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 1729 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1730 | { |
| 1731 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTED_STATE_1) |
| 1732 | { |
| 1733 | globalP2PConnectionStatus = P2P_CLIENT_DISCONNECTED_STATE; |
| 1734 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] 8 way Handshake completed " |
| 1735 | "and moved to disconnected state"); |
| 1736 | } |
| 1737 | else if(globalP2PConnectionStatus == P2P_CLIENT_COMPLETED_STATE) |
| 1738 | { |
| 1739 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 1740 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] P2P Client is removed " |
| 1741 | "and moved to inactive state"); |
| 1742 | } |
| 1743 | } |
| 1744 | #endif |
Sushant Kaushik | bad6189 | 2015-07-10 16:43:28 +0530 | [diff] [blame] | 1745 | if ((roamStatus == eCSR_ROAM_LOSTLINK) && |
| 1746 | !pRoamInfo->reasonCode) |
| 1747 | wlan_hdd_get_frame_logs(pAdapter, |
| 1748 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1749 | /*Only send indication to kernel if not initiated by kernel*/ |
| 1750 | if ( sendDisconInd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1751 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1752 | /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */ |
| 1753 | if ( eCSR_ROAM_LOSTLINK == roamStatus ) |
| 1754 | { |
Mahesh A Saptasagar | 9ff4bcc | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 1755 | wlan_hdd_cfg80211_indicate_disconnect(dev, false, |
| 1756 | pRoamInfo->reasonCode); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1757 | } |
| 1758 | else |
| 1759 | { |
Mahesh A Saptasagar | 9ff4bcc | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 1760 | wlan_hdd_cfg80211_indicate_disconnect(dev, false, |
Mahesh A Saptasagar | b5a1514 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 1761 | WLAN_REASON_UNSPECIFIED); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1762 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1763 | } |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 1764 | |
| 1765 | if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 1766 | { |
| 1767 | hddLog(LOG1, |
| 1768 | FL("P2P client is getting removed and we are tryig to re-enable TDLS")); |
| 1769 | wlan_hdd_tdls_reenable(pHddCtx); |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 1770 | } |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 1771 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1772 | //If the Device Mode is Station |
| 1773 | // and the P2P Client is Connected |
| 1774 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1775 | |
| 1776 | // 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] | 1777 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Sudhir Sattayappa Kohalli | b1d8c3a | 2013-06-18 14:47:20 -0700 | [diff] [blame] | 1778 | if(VOS_STATUS_SUCCESS == hdd_issta_p2p_clientconnected(pHddCtx)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1779 | { |
| 1780 | //Enable BMPS only of other Session is P2P Client |
| 1781 | hdd_context_t *pHddCtx = NULL; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1782 | 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] | 1783 | |
| 1784 | if (NULL != pVosContext) |
| 1785 | { |
| 1786 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 1787 | |
| 1788 | if(NULL != pHddCtx) |
| 1789 | { |
| 1790 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1791 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 1792 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1793 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1794 | if (pHddCtx->hdd_wlan_suspended) |
| 1795 | { |
| 1796 | hdd_set_pwrparams(pHddCtx); |
| 1797 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1798 | hdd_enable_bmps_imps(pHddCtx); |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1799 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1800 | } |
| 1801 | } |
| 1802 | } |
| 1803 | } |
| 1804 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1805 | |
Madan Mohan Koyyalamudi | 70c52d3 | 2013-08-07 14:42:16 +0530 | [diff] [blame] | 1806 | hdd_wmm_adapter_clear(pAdapter); |
Kapil Gupta | e686748 | 2016-06-26 13:31:37 +0530 | [diff] [blame] | 1807 | /* Clear PER based roam stats */ |
| 1808 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1809 | if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) && |
| 1810 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 1811 | pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled && |
| 1812 | pHddCtx->cfg_ini->isPERRoamRxPathEnabled) |
| 1813 | sme_unset_per_roam_rxconfig(pHddCtx->hHal); |
| 1814 | #endif |
Mukul Sharma | c159c43 | 2014-01-15 15:42:46 +0530 | [diff] [blame] | 1815 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 1816 | sme_FTReset(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
| 1817 | #endif |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1818 | |
| 1819 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) |
| 1820 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1821 | v_U8_t i; |
| 1822 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1823 | sta_id = IBSS_BROADCAST_STAID; |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1824 | vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id ); |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1825 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1826 | { |
| 1827 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1828 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1829 | "Status= %d [0x%x]"), |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1830 | sta_id, status, status ); |
| 1831 | |
| 1832 | status = eHAL_STATUS_FAILURE; |
| 1833 | } |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1834 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1835 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1836 | /*Clear all the peer sta register with TL.*/ |
| 1837 | for (i =0; i < HDD_MAX_NUM_IBSS_STA; i++ ) |
| 1838 | { |
| 1839 | if (0 != pHddStaCtx->conn_info.staId[i]) |
| 1840 | { |
| 1841 | sta_id = pHddStaCtx->conn_info.staId[i]; |
| 1842 | |
| 1843 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1844 | FL("Deregister StaID %d"),sta_id); |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 1845 | vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id ); |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1846 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1847 | { |
| 1848 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1849 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1850 | "Status= %d [0x%x]"), |
| 1851 | sta_id, status, status ); |
| 1852 | status = eHAL_STATUS_FAILURE; |
| 1853 | } |
| 1854 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 1855 | vstatus = hdd_sta_id_hash_remove_entry(pAdapter, |
| 1856 | sta_id, &pHddStaCtx->conn_info.peerMacAddress[i]); |
| 1857 | if (vstatus != VOS_STATUS_SUCCESS) { |
| 1858 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1859 | FL("Not able to remove staid hash %d"), |
| 1860 | sta_id); |
| 1861 | status = eHAL_STATUS_FAILURE; |
| 1862 | } else { |
| 1863 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1864 | FL("ibss station removed sta_id %d mac:" |
| 1865 | MAC_ADDRESS_STR), sta_id, |
| 1866 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[i].bytes)); |
| 1867 | } |
| 1868 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1869 | /*set the staid and peer mac as 0, all other reset are |
| 1870 | * done in hdd_connRemoveConnectInfo. |
| 1871 | */ |
| 1872 | pHddStaCtx->conn_info.staId[i]= 0; |
| 1873 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[i], sizeof( v_MACADDR_t ) ); |
| 1874 | |
| 1875 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1876 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1877 | } |
| 1878 | } |
| 1879 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 1880 | } |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1881 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1882 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1883 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 1884 | /* clear scan cache for Link Lost */ |
| 1885 | if (pRoamInfo && !pRoamInfo->reasonCode && |
| 1886 | (eCSR_ROAM_LOSTLINK == roamStatus)) { |
Abhishek Singh | e6137b8 | 2019-03-22 20:06:09 +0530 | [diff] [blame] | 1887 | wlan_hdd_cfg80211_unlink_bss(pAdapter, |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 1888 | pHddStaCtx->conn_info.bssId); |
| 1889 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1890 | pHddStaCtx->conn_info.bssId); |
| 1891 | } |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1892 | |
| 1893 | //We should clear all sta register with TL, for now, only one. |
| 1894 | vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id ); |
| 1895 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 1896 | { |
| 1897 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1898 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 1899 | "Status= %d [0x%x]"), |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1900 | sta_id, status, status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1901 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 1902 | status = eHAL_STATUS_FAILURE; |
| 1903 | } |
| 1904 | |
| 1905 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1906 | } |
Srinivas Dasari | deb7ae9 | 2014-12-19 15:26:40 +0530 | [diff] [blame] | 1907 | |
| 1908 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 1909 | if (VOS_STATUS_SUCCESS != |
| 1910 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1911 | pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE_AC)) |
| 1912 | { |
| 1913 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1914 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1915 | } |
| 1916 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1917 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1918 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1919 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1920 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Sravan Kumar Kairam | f9f9512 | 2017-01-18 20:54:05 +0530 | [diff] [blame] | 1921 | pAdapter->dad = false; |
Srinivas Dasari | deb7ae9 | 2014-12-19 15:26:40 +0530 | [diff] [blame] | 1922 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1923 | // Clear saved connection information in HDD |
| 1924 | hdd_connRemoveConnectInfo( pHddStaCtx ); |
Abhishek Singh | d2ce680 | 2018-05-08 15:21:06 +0530 | [diff] [blame] | 1925 | |
| 1926 | /* |
| 1927 | * eConnectionState_Connecting state mean that connection is in progress so |
| 1928 | * no need to set state to eConnectionState_NotConnected |
| 1929 | */ |
| 1930 | if ((eConnectionState_Connecting != pHddStaCtx->conn_info.connState)) { |
| 1931 | hddLog(LOG1, FL("Set HDD connState to eConnectionState_NotConnected")); |
| 1932 | hdd_connSetConnectionState(pHddStaCtx, eConnectionState_NotConnected); |
| 1933 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1934 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 1935 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1936 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 1937 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1938 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 1939 | sizeof (tSirGtkOffloadParams)); |
| 1940 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1941 | } |
| 1942 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1943 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1944 | #ifdef FEATURE_WLAN_TDLS |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1945 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1946 | { |
| 1947 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1948 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1949 | #endif |
| 1950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1951 | //Unblock anyone waiting for disconnect to complete |
| 1952 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 1953 | hdd_print_bss_info(pHddStaCtx); |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 1954 | |
| 1955 | hdd_check_and_move_if_sap_is_on_dfs_chan(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | return( status ); |
| 1957 | } |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 1958 | |
| 1959 | static void hdd_postTLPacketPendingInd(hdd_adapter_t *pAdapter, |
| 1960 | v_U8_t staId) |
| 1961 | { |
| 1962 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1963 | v_SINT_t i; |
| 1964 | v_SIZE_t size; |
| 1965 | VOS_STATUS status; |
| 1966 | v_BOOL_t granted = VOS_FALSE; |
| 1967 | |
| 1968 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 1969 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) || |
| 1970 | (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE)) |
| 1971 | { |
| 1972 | //Indicate to TL that there is pending data if a queue is non empty |
| 1973 | for (i = WLANTL_AC_HIGH_PRIO; i>=0; --i) |
| 1974 | { |
| 1975 | size = 0; |
| 1976 | hdd_list_size(&pAdapter->wmm_tx_queue[i], &size); |
| 1977 | if (size > 0) |
| 1978 | { |
| 1979 | if (i != WLANTL_AC_HIGH_PRIO) |
| 1980 | { |
| 1981 | if (VOS_FALSE == |
| 1982 | pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessAllowed) |
| 1983 | { |
| 1984 | hdd_wmm_acquire_access(pAdapter, |
| 1985 | (WLANTL_ACEnumType)i, &granted); |
| 1986 | pAdapter->psbChanged |= (1 << i); |
| 1987 | } |
| 1988 | else |
| 1989 | granted = VOS_TRUE; |
| 1990 | } |
| 1991 | |
| 1992 | if (granted || (i == WLANTL_AC_HIGH_PRIO)) |
| 1993 | { |
| 1994 | status = WLANTL_STAPktPending(pHddCtx->pvosContext, |
| 1995 | staId, (WLANTL_ACEnumType)i); |
| 1996 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 1997 | { |
| 1998 | VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1999 | "%s: Failure in indicating pkt to TL for QID=%d", |
| 2000 | __func__, i); |
| 2001 | } |
| 2002 | } |
| 2003 | } |
| 2004 | } |
| 2005 | } |
| 2006 | } |
| 2007 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2008 | static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter, |
| 2009 | tCsrRoamInfo *pRoamInfo, |
| 2010 | v_U8_t staId, |
| 2011 | v_MACADDR_t *pPeerMacAddress, |
| 2012 | tSirBssDescription *pBssDesc ) |
| 2013 | { |
| 2014 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 2015 | WLAN_STADescType staDesc = {0}; |
| 2016 | eCsrEncryptionType connectedCipherAlgo; |
| 2017 | v_BOOL_t fConnected; |
| 2018 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2019 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2020 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2021 | |
| 2022 | if ( NULL == pBssDesc) |
| 2023 | { |
| 2024 | return VOS_STATUS_E_FAILURE; |
| 2025 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2026 | // Get the Station ID from the one saved during the assocation. |
| 2027 | staDesc.ucSTAId = staId; |
| 2028 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2029 | staDesc.wSTAType = WLAN_STA_INFRA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2030 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2031 | // grab the bssid from the connection info in the adapter structure and hand that |
| 2032 | // over to TL when registering. |
| 2033 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId, |
| 2034 | sizeof(pHddStaCtx->conn_info.bssId) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2035 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2036 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 2037 | |
| 2038 | // set the QoS field appropriately |
| 2039 | if (hdd_wmm_is_active(pAdapter)) |
| 2040 | { |
| 2041 | staDesc.ucQosEnabled = 1; |
| 2042 | } |
| 2043 | else |
| 2044 | { |
| 2045 | staDesc.ucQosEnabled = 0; |
| 2046 | } |
| 2047 | |
| 2048 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 2049 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 2050 | { |
| 2051 | staDesc.ucProtectedFrame = 1; |
| 2052 | } |
| 2053 | else |
| 2054 | { |
| 2055 | staDesc.ucProtectedFrame = 0; |
| 2056 | |
| 2057 | } |
| 2058 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2059 | #ifdef FEATURE_WLAN_ESE |
| 2060 | staDesc.ucIsEseSta = pRoamInfo->isESEAssoc; |
| 2061 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2062 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2063 | /* check whether replay check is valid for the station or not */ |
| 2064 | if( (eCSR_ENCRYPT_TYPE_TKIP == connectedCipherAlgo) || (eCSR_ENCRYPT_TYPE_AES == connectedCipherAlgo)) |
| 2065 | { |
| 2066 | /* Encryption mode is either TKIP or AES |
| 2067 | and replay check is valid for only these |
| 2068 | two encryption modes */ |
| 2069 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 2070 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2071 | "HDD register TL ucIsReplayCheckValid %d: Replay check is needed for station", staDesc.ucIsReplayCheckValid); |
| 2072 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2073 | else |
| 2074 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2075 | /* For other encryption modes replay check is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2076 | not needed */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2077 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2078 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2079 | "HDD register TL ucIsReplayCheckValid %d", staDesc.ucIsReplayCheckValid); |
| 2080 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2081 | |
| 2082 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2083 | hddLog(LOG1, "%s: WAPI STA Registered: %d", __func__, pAdapter->wapi_info.fIsWapiSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2084 | if (pAdapter->wapi_info.fIsWapiSta) |
| 2085 | { |
| 2086 | staDesc.ucIsWapiSta = 1; |
| 2087 | } |
| 2088 | else |
| 2089 | { |
| 2090 | staDesc.ucIsWapiSta = 0; |
| 2091 | } |
| 2092 | #endif /* FEATURE_WLAN_WAPI */ |
| 2093 | |
| 2094 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 2095 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
| 2096 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2097 | // UMA is Not ready yet, Xlation will be done by TL |
| 2098 | staDesc.ucSwFrameTXXlation = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2099 | staDesc.ucSwFrameRXXlation = 1; |
| 2100 | staDesc.ucAddRmvLLC = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2101 | 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] | 2102 | staDesc.ucQosEnabled ); |
| 2103 | // Initialize signatures and state |
| 2104 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 2105 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 2106 | staDesc.ucInitState = pRoamInfo->fAuthRequired ? |
| 2107 | WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2108 | // Register the Station with TL... |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 2109 | 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] | 2110 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 2111 | hdd_rx_packet_cbk, |
| 2112 | hdd_tx_complete_cbk, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2113 | hdd_tx_fetch_packet_cbk, &staDesc, |
| 2114 | pBssDesc->rssi ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2115 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2116 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2117 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2118 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2119 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2120 | vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2121 | return vosStatus; |
| 2122 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2123 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2124 | if ( cfg_param->dynSplitscan && |
| 2125 | ( VOS_TIMER_STATE_RUNNING != |
| 2126 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))) |
| 2127 | { |
| 2128 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 2129 | cfg_param->trafficMntrTmrForSplitScan); |
| 2130 | } |
| 2131 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2132 | // if (WPA), tell TL to go to 'connected' and after keys come to the driver, |
| 2133 | // then go to 'authenticated'. For all other authentication types |
| 2134 | // (those that donot require upper layer authentication) we can put |
| 2135 | // TL directly into 'authenticated' state. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2136 | if (staDesc.wSTAType != WLAN_STA_IBSS) |
| 2137 | VOS_ASSERT( fConnected ); |
| 2138 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2139 | if ( !pRoamInfo->fAuthRequired ) |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2140 | { |
| 2141 | // Connections that do not need Upper layer auth, transition TL directly |
| 2142 | // to 'Authenticated' state. |
| 2143 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
| 2144 | WLANTL_STA_AUTHENTICATED ); |
| 2145 | |
| 2146 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2147 | |
| 2148 | hdd_postTLPacketPendingInd(pAdapter, staDesc.ucSTAId); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2149 | } |
| 2150 | else |
| 2151 | { |
| 2152 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2153 | "ULA auth StaId= %d. Changing TL state to CONNECTED" |
| 2154 | "at Join time", pHddStaCtx->conn_info.staId[0] ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2155 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 2156 | WLANTL_STA_CONNECTED ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2157 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 2158 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2159 | return( vosStatus ); |
| 2160 | } |
| 2161 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2162 | static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 2163 | tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength) |
| 2164 | { |
| 2165 | unsigned int len = 0; |
| 2166 | u8 *pFTAssocRsp = NULL; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2167 | v_U8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2168 | tANI_U32 rspRsnLength = 0; |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2169 | struct cfg80211_bss* bss; |
| 2170 | tCsrRoamConnectedProfile roam_profile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2171 | struct ieee80211_channel *chan; |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2172 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2173 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2174 | if (!rspRsnIe) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2175 | hddLog(LOGE, "%s: Unable to allocate RSN IE", __func__); |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 2176 | return; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2177 | } |
| 2178 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2179 | if (pCsrRoamInfo == NULL) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2180 | hddLog(LOGE, "%s: Invalid CSR roam info", __func__); |
| 2181 | goto done; |
| 2182 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2183 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2184 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2185 | hddLog(LOGE, "%s: Invalid assoc response length", __func__); |
| 2186 | goto done; |
| 2187 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2188 | |
| 2189 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2190 | pCsrRoamInfo->nAssocReqLength); |
| 2191 | if (pFTAssocRsp == NULL) |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2192 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2193 | |
| 2194 | //pFTAssocRsp needs to point to the IEs |
| 2195 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2196 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2197 | (unsigned int)pFTAssocRsp[0], |
| 2198 | (unsigned int)pFTAssocRsp[1]); |
| 2199 | |
| 2200 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
Madan Mohan Koyyalamudi | 1bed23d | 2012-11-13 10:59:48 -0800 | [diff] [blame] | 2201 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2202 | rspRsnLength = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2203 | memcpy(rspRsnIe, pFTAssocRsp, len); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2204 | memset(rspRsnIe + len, 0, IW_GENERIC_IE_MAX - len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2205 | |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2206 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
| 2207 | (int) pCsrRoamInfo->pBssDesc->channelId); |
| 2208 | vos_mem_zero(&roam_profile, sizeof(tCsrRoamConnectedProfile)); |
| 2209 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roam_profile); |
| 2210 | bss = hdd_get_bss_entry(pAdapter->wdev.wiphy, |
| 2211 | chan, pCsrRoamInfo->bssid, |
| 2212 | &roam_profile.SSID.ssId[0], |
| 2213 | roam_profile.SSID.length); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2214 | hdd_send_roamed_ind(dev, bss, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2215 | reqRsnIe, reqRsnLength, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2216 | rspRsnIe, rspRsnLength); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 2217 | |
| 2218 | done: |
| 2219 | kfree(rspRsnIe); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2220 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2221 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 2222 | void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter) |
| 2223 | { |
| 2224 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 2225 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2226 | tCsrRoamInfo roamInfo; |
| 2227 | roamInfo.fAuthRequired = FALSE; |
| 2228 | vos_mem_copy(roamInfo.bssid, |
| 2229 | pHddStaCtx->roam_info.bssid, |
| 2230 | WNI_CFG_BSSID_LEN); |
| 2231 | vos_mem_copy(roamInfo.peerMac, |
| 2232 | pHddStaCtx->roam_info.peerMac, |
| 2233 | WNI_CFG_BSSID_LEN); |
| 2234 | |
| 2235 | halStatus = hdd_RoamSetKeyCompleteHandler(pAdapter, |
| 2236 | &roamInfo, |
| 2237 | pHddStaCtx->roam_info.roamId, |
| 2238 | pHddStaCtx->roam_info.roamStatus, |
| 2239 | eCSR_ROAM_RESULT_AUTHENTICATED); |
| 2240 | if (halStatus != eHAL_STATUS_SUCCESS) |
| 2241 | { |
| 2242 | hddLog(LOGE, "%s: Set Key complete failure", __func__); |
| 2243 | } |
| 2244 | pHddStaCtx->roam_info.deferKeyComplete = FALSE; |
| 2245 | } |
| 2246 | |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2247 | /** |
| 2248 | * hdd_schedule_ecsa_chan_change_work() - schedule ecsa chan change work |
| 2249 | * @hal: hal context |
| 2250 | * @sta_session_id: sta session id |
| 2251 | * |
| 2252 | * Return: void. |
| 2253 | */ |
| 2254 | static void |
| 2255 | hdd_schedule_ecsa_chan_change_work(hdd_context_t *hdd_ctx, |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 2256 | uint8_t sta_session_id) |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2257 | { |
| 2258 | v_TIME_t conn_start_time; |
| 2259 | int32_t time_diff; |
| 2260 | |
| 2261 | conn_start_time = sme_get_connect_strt_time(hdd_ctx->hHal, sta_session_id); |
| 2262 | time_diff = vos_timer_get_system_time() - conn_start_time; |
| 2263 | |
| 2264 | if (time_diff < 0) |
| 2265 | time_diff = ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL; |
| 2266 | else if (time_diff > ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL) |
| 2267 | time_diff = 0; |
| 2268 | else |
| 2269 | time_diff = ECSA_SCC_CHAN_CHANGE_DEFER_INTERVAL - time_diff; |
| 2270 | |
| 2271 | hddLog(LOG1, FL("schedule ecsa_chan_change_work after %d ms"), time_diff); |
| 2272 | schedule_delayed_work(&hdd_ctx->ecsa_chan_change_work, |
| 2273 | msecs_to_jiffies(time_diff)); |
| 2274 | } |
| 2275 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2276 | static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 2277 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2278 | eCsrRoamResult roamResult ) |
| 2279 | { |
| 2280 | struct net_device *dev = pAdapter->dev; |
| 2281 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2282 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2283 | hdd_adapter_t *pHostapdAdapter = NULL; |
Girish Gowli | 257a7e6 | 2014-08-02 15:50:43 +0530 | [diff] [blame] | 2284 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 2285 | v_U8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2286 | tANI_U32 reqRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2287 | #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] | 2288 | int ft_carrier_on = FALSE; |
| 2289 | #endif |
| 2290 | int status; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2291 | v_BOOL_t hddDisconInProgress = FALSE; |
| 2292 | |
| 2293 | /* HDD has initiated disconnect, do not send connect result indication |
| 2294 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2295 | */ |
Agarwal Ashish | c089cec | 2015-08-10 13:10:04 +0530 | [diff] [blame] | 2296 | if (((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) || |
| 2297 | (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState)) && |
| 2298 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2299 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2300 | { |
| 2301 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2302 | FL(" Disconnect from HDD in progress ")); |
| 2303 | hddDisconInProgress = TRUE; |
| 2304 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2306 | if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult ) |
| 2307 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2308 | if ( !hddDisconInProgress ) |
| 2309 | { |
| 2310 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2311 | "%s: Set HDD connState to eConnectionState_Associated", |
| 2312 | __func__); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2313 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Associated ); |
| 2314 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2315 | |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 2316 | pAdapter->maxRateFlags = pRoamInfo->maxRateFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2317 | // Save the connection info from CSR... |
| 2318 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE ); |
Kapil Gupta | e686748 | 2016-06-26 13:31:37 +0530 | [diff] [blame] | 2319 | |
| 2320 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 2321 | if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) && |
| 2322 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
| 2323 | !hddDisconInProgress && |
| 2324 | pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled && |
| 2325 | pHddCtx->cfg_ini->isPERRoamRxPathEnabled) |
| 2326 | sme_set_per_roam_rxconfig(pHddCtx->hHal, |
| 2327 | pHddStaCtx->conn_info.staId[0], |
| 2328 | pHddCtx->cfg_ini->rateDownThreshold, |
| 2329 | pHddCtx->cfg_ini->rateUpThreshold, |
| 2330 | pHddCtx->cfg_ini->PERroamTriggerPercent, |
| 2331 | pHddCtx->cfg_ini->PERroamRxPktsThreshold, |
| 2332 | pHddCtx->cfg_ini->waitPeriodForNextPERScan); |
| 2333 | #endif |
| 2334 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2335 | #ifdef FEATURE_WLAN_WAPI |
| 2336 | if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE || |
| 2337 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK ) |
| 2338 | { |
| 2339 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2340 | } |
| 2341 | else |
| 2342 | { |
| 2343 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2344 | } |
| 2345 | #endif /* FEATURE_WLAN_WAPI */ |
| 2346 | |
| 2347 | // indicate 'connect' status to userspace |
| 2348 | hdd_SendAssociationEvent(dev,pRoamInfo); |
| 2349 | |
| 2350 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2351 | // Initialize the Linkup event completion variable |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2352 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2353 | |
| 2354 | /* |
| 2355 | Sometimes Switching ON the Carrier is taking time to activate the device properly. Before allowing any |
| 2356 | 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] | 2357 | 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] | 2358 | know that the device is getting activated properly. |
| 2359 | */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2360 | #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] | 2361 | if (pHddStaCtx->ft_carrier_on == FALSE && !hddDisconInProgress ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2362 | { |
| 2363 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2364 | // 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] | 2365 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 2366 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2367 | // 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] | 2368 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 2369 | |
| 2370 | // Switch on the Carrier to activate the device |
| 2371 | netif_carrier_on(dev); |
| 2372 | |
| 2373 | // Wait for the Link to up to ensure all the queues are set properly by the kernel |
| 2374 | status = wait_for_completion_interruptible_timeout(&pAdapter->linkup_event_var, |
| 2375 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2376 | if(!status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2377 | { |
| 2378 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning:ASSOC_LINKUP_TIMEOUT", __func__); |
| 2379 | } |
| 2380 | |
| 2381 | // Disable Linkup Event Servicing - no more service required from the net device notifier call |
| 2382 | pAdapter->isLinkUpSvcNeeded = FALSE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2383 | #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] | 2384 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2385 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2386 | pHddStaCtx->ft_carrier_on = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2387 | ft_carrier_on = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2388 | } |
| 2389 | #endif |
Sandeep Puligilla | d91dccb | 2014-06-18 11:51:48 +0530 | [diff] [blame] | 2390 | /* Check for STAID */ |
| 2391 | if( (WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId ) |
| 2392 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2393 | else |
| 2394 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Wrong Staid: %d", __func__, pRoamInfo->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2395 | |
| 2396 | //For reassoc, the station is already registered, all we need is to change the state |
| 2397 | //of the STA in TL. |
| 2398 | //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] | 2399 | //pRoamInfo->fReassocReq will be set only for the reassoc to same ap |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2400 | if( !pRoamInfo->fReassocReq ) |
| 2401 | { |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2402 | struct cfg80211_bss *bss; |
| 2403 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2404 | u8 *pFTAssocRsp = NULL; |
| 2405 | unsigned int assocRsplen = 0; |
| 2406 | u8 *pFTAssocReq = NULL; |
| 2407 | unsigned int assocReqlen = 0; |
| 2408 | struct ieee80211_channel *chan; |
| 2409 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2410 | v_U8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2411 | tANI_U32 rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2412 | |
| 2413 | /* add bss_id to cfg80211 data base */ |
| 2414 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 2415 | if (NULL == bss) |
| 2416 | { |
Abhishek Singh | 7ca68f3 | 2016-06-28 10:23:10 +0530 | [diff] [blame] | 2417 | hddLog(LOGE, |
| 2418 | FL("Not able to create BSS entry")); |
Katya Nigam | 346d4e9 | 2014-09-02 16:16:12 +0530 | [diff] [blame] | 2419 | netif_carrier_off(dev); |
Abhishek Singh | 7ca68f3 | 2016-06-28 10:23:10 +0530 | [diff] [blame] | 2420 | if (!hddDisconInProgress) { |
| 2421 | /* |
| 2422 | * Here driver was not able to update cfg80211 database |
| 2423 | * this can happen if connected channel is not valid, |
| 2424 | * i.e reg domain was changed during connection. |
| 2425 | * Queue disconnect for the session if disconnect is |
| 2426 | * not in progress. |
| 2427 | */ |
| 2428 | hddLog(LOGE, FL("Disconnecting...")); |
| 2429 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2430 | pAdapter->sessionId, |
| 2431 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2432 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2433 | return eHAL_STATUS_FAILURE; |
| 2434 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2435 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2436 | if(pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN || |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2437 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN_PSK ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2438 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2439 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2440 | //Association Response |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2441 | pFTAssocRsp = (u8 *)(pRoamInfo->pbFrames + pRoamInfo->nBeaconLength + |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2442 | pRoamInfo->nAssocReqLength); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2443 | if (pFTAssocRsp != NULL) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2444 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2445 | // pFTAssocRsp needs to point to the IEs |
| 2446 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 2447 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 2448 | (unsigned int)pFTAssocRsp[0], |
| 2449 | (unsigned int)pFTAssocRsp[1]); |
| 2450 | assocRsplen = pRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2451 | } |
| 2452 | else |
| 2453 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2454 | hddLog(LOGE, "%s:AssocRsp is NULL", __func__); |
| 2455 | assocRsplen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2456 | } |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2457 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2458 | //Association Request |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2459 | pFTAssocReq = (u8 *)(pRoamInfo->pbFrames + |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2460 | pRoamInfo->nBeaconLength); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2461 | if (pFTAssocReq != NULL) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2462 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2463 | if(!ft_carrier_on) |
| 2464 | { |
| 2465 | // pFTAssocReq needs to point to the IEs |
| 2466 | pFTAssocReq += FT_ASSOC_REQ_IES_OFFSET; |
| 2467 | hddLog(LOG1, "%s: pFTAssocReq is now at %02x%02x", __func__, |
| 2468 | (unsigned int)pFTAssocReq[0], |
| 2469 | (unsigned int)pFTAssocReq[1]); |
| 2470 | assocReqlen = pRoamInfo->nAssocReqLength - FT_ASSOC_REQ_IES_OFFSET; |
| 2471 | } |
| 2472 | else |
| 2473 | { |
| 2474 | /* This should contain only the FTIEs */ |
| 2475 | assocReqlen = pRoamInfo->nAssocReqLength; |
| 2476 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2477 | } |
| 2478 | else |
| 2479 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2480 | hddLog(LOGE, "%s:AssocReq is NULL", __func__); |
| 2481 | assocReqlen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2482 | } |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2483 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2484 | if(ft_carrier_on) |
| 2485 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2486 | if ( !hddDisconInProgress ) |
| 2487 | { |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2488 | struct cfg80211_bss *roam_bss; |
| 2489 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2490 | hddLog(LOG1, "%s ft_carrier_on is %d, sending roamed " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2491 | "indication", __FUNCTION__, ft_carrier_on); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2492 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2493 | (int)pRoamInfo->pBssDesc->channelId); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2494 | hddLog(LOG1, "assocReqlen %d assocRsplen %d", assocReqlen, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2495 | assocRsplen); |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2496 | if (pHddCtx->cfg_ini && |
| 2497 | pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2498 | { |
| 2499 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 2500 | } |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2501 | roam_bss = hdd_get_bss_entry(pAdapter->wdev.wiphy, |
| 2502 | chan, pRoamInfo->bssid, |
| 2503 | pRoamInfo->u.pConnectedProfile->SSID.ssId, |
| 2504 | pRoamInfo->u.pConnectedProfile->SSID.length); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2505 | hdd_send_roamed_ind(dev, roam_bss, |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 2506 | pFTAssocReq, assocReqlen, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2507 | pFTAssocRsp, assocRsplen); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2508 | } |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 2509 | if (sme_GetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 2510 | { |
| 2511 | sme_SetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter), FALSE); |
| 2512 | pRoamInfo->fAuthRequired = FALSE; |
| 2513 | |
| 2514 | vos_mem_copy(pHddStaCtx->roam_info.bssid, |
| 2515 | pRoamInfo->bssid, |
| 2516 | HDD_MAC_ADDR_LEN); |
| 2517 | vos_mem_copy(pHddStaCtx->roam_info.peerMac, |
| 2518 | pRoamInfo->peerMac, |
| 2519 | HDD_MAC_ADDR_LEN); |
| 2520 | pHddStaCtx->roam_info.roamId = roamId; |
| 2521 | pHddStaCtx->roam_info.roamStatus = roamStatus; |
| 2522 | pHddStaCtx->roam_info.deferKeyComplete = TRUE; |
| 2523 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2524 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2525 | else if ( !hddDisconInProgress ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2526 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2527 | hddLog(LOG1, "%s ft_carrier_on is %d, sending connect " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2528 | "indication", __FUNCTION__, ft_carrier_on); |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2529 | hdd_connect_result(dev, pRoamInfo->bssid, pRoamInfo, |
| 2530 | pFTAssocReq, assocReqlen, |
| 2531 | pFTAssocRsp, assocRsplen, |
| 2532 | WLAN_STATUS_SUCCESS, |
| 2533 | GFP_KERNEL); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2534 | } |
| 2535 | } |
| 2536 | else |
| 2537 | #endif |
| 2538 | { |
| 2539 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 2540 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2541 | pAdapter->sessionId, |
| 2542 | &reqRsnLength, |
| 2543 | reqRsnIe); |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2544 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2545 | csrRoamGetWpaRsnRspIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2546 | pAdapter->sessionId, |
| 2547 | &rspRsnLength, |
| 2548 | rspRsnIe); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2549 | if ( !hddDisconInProgress ) |
| 2550 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2551 | #if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2552 | if(ft_carrier_on) |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2553 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2554 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2555 | if (pHddCtx->cfg_ini && |
| 2556 | pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2557 | { |
| 2558 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 2559 | } |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2560 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2561 | else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2562 | #endif /* FEATURE_WLAN_ESE */ |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 2563 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2564 | { |
| 2565 | hddLog(VOS_TRACE_LEVEL_INFO, |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2566 | "%s: sending connect indication to nl80211:" |
| 2567 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2568 | " result:%d and Status:%d", |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2569 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
| 2570 | roamResult, roamStatus); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2571 | /* inform connect result to nl80211 */ |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2572 | hdd_connect_result(dev, pRoamInfo->bssid, |
| 2573 | pRoamInfo, |
| 2574 | reqRsnIe, reqRsnLength, |
| 2575 | rspRsnIe, rspRsnLength, |
| 2576 | WLAN_STATUS_SUCCESS, |
| 2577 | GFP_KERNEL); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2578 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2579 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2580 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2581 | if ( !hddDisconInProgress ) |
| 2582 | { |
| 2583 | cfg80211_put_bss( |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2584 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2585 | pHddCtx->wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2586 | #endif |
| 2587 | bss); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2588 | // Register the Station with TL after associated... |
| 2589 | vosStatus = hdd_roamRegisterSTA( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2590 | pRoamInfo, |
| 2591 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2592 | NULL, |
| 2593 | pRoamInfo->pBssDesc ); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2594 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2595 | } |
| 2596 | else |
| 2597 | { |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 2598 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 2599 | /* in case of reassociation also need to indicate it to supplicant */ |
| 2600 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2601 | pAdapter->sessionId, |
| 2602 | &reqRsnLength, |
| 2603 | reqRsnIe); |
| 2604 | |
| 2605 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2606 | //Reassoc successfully |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2607 | if( pRoamInfo->fAuthRequired ) |
| 2608 | { |
| 2609 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 2610 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2611 | WLANTL_STA_CONNECTED ); |
| 2612 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 2613 | } |
| 2614 | else |
| 2615 | { |
| 2616 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2617 | "%s: staId: %d Changing TL state to AUTHENTICATED", |
| 2618 | __func__, pHddStaCtx->conn_info.staId[ 0 ] ); |
| 2619 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 2620 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2621 | WLANTL_STA_AUTHENTICATED ); |
| 2622 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2623 | hdd_postTLPacketPendingInd(pAdapter, |
| 2624 | pHddStaCtx->conn_info.staId[0]); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2625 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2626 | } |
| 2627 | |
| 2628 | if ( VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2629 | { |
| 2630 | // perform any WMM-related association processing |
| 2631 | hdd_wmm_assoc(pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2632 | } |
| 2633 | else |
| 2634 | { |
| 2635 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2636 | "Cannot register STA with TL. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2637 | vosStatus, vosStatus ); |
| 2638 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2639 | #ifdef WLAN_FEATURE_11W |
| 2640 | vos_mem_zero( &pAdapter->hdd_stats.hddPmfStats, |
| 2641 | sizeof(pAdapter->hdd_stats.hddPmfStats) ); |
| 2642 | #endif |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2643 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2644 | // Start the Queue |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 2645 | if ( !hddDisconInProgress ) |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2646 | { |
| 2647 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 2648 | netif_tx_wake_all_queues(dev); |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2649 | } |
Anurag Chouhan | 6f6198c | 2016-08-28 12:43:46 +0530 | [diff] [blame] | 2650 | if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->gEnableRoamDelayStats) |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 2651 | { |
| 2652 | vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0); |
| 2653 | } |
Padma, Santhosh Kumar | 38cef18 | 2016-02-18 12:22:51 +0530 | [diff] [blame] | 2654 | #ifdef FEATURE_WLAN_TDLS |
| 2655 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 2656 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2657 | } |
| 2658 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2659 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2660 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 2661 | |
| 2662 | 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] | 2663 | if (pRoamInfo) |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 2664 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2665 | "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d", |
| 2666 | MAC_ADDR_ARRAY(pRoamInfo->bssid), roamResult, roamStatus); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2667 | else |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 2668 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2669 | "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d", |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2670 | MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 2671 | roamResult, roamStatus); |
Abhishek Singh | 6782c9e | 2017-06-06 13:37:45 +0530 | [diff] [blame] | 2672 | if (!pHddStaCtx->get_mgmt_log_sent) { |
| 2673 | pHddStaCtx->get_mgmt_log_sent = TRUE; |
Abhishek Singh | 611295e | 2015-07-09 11:11:54 +0530 | [diff] [blame] | 2674 | wlan_hdd_get_frame_logs(pAdapter, |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 2675 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Abhishek Singh | 6782c9e | 2017-06-06 13:37:45 +0530 | [diff] [blame] | 2676 | } |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 2677 | |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 2678 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 2679 | (pRoamInfo && |
| 2680 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) || |
| 2681 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) || |
| 2682 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode)))) { |
Abhishek Singh | e6137b8 | 2019-03-22 20:06:09 +0530 | [diff] [blame] | 2683 | wlan_hdd_cfg80211_unlink_bss(pAdapter, |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 2684 | pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId); |
| 2685 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 2686 | pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId); |
| 2687 | } |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2688 | /* Set connection state to eConnectionState_NotConnected only when CSR |
| 2689 | * has completed operation - with a ASSOCIATION_FAILURE status |
| 2690 | */ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2691 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2692 | { |
| 2693 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2694 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 2695 | __func__); |
| 2696 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected); |
| 2697 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2698 | if((pHddCtx->concurrency_mode <= 1) && |
| 2699 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2700 | { |
| 2701 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 2702 | } |
| 2703 | |
| 2704 | //If the Device Mode is Station |
| 2705 | // and the P2P Client is Connected |
| 2706 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2707 | |
| 2708 | // 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] | 2709 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2710 | if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 2711 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2712 | (vos_concurrent_open_sessions_running())) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2713 | { |
| 2714 | //Enable BMPS only of other Session is P2P Client |
| 2715 | hdd_context_t *pHddCtx = NULL; |
| 2716 | v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); |
| 2717 | |
| 2718 | if (NULL != pVosContext) |
| 2719 | { |
| 2720 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 2721 | |
| 2722 | if(NULL != pHddCtx) |
| 2723 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2724 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 2725 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 2726 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2727 | { |
| 2728 | if (pHddCtx->hdd_wlan_suspended) |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 2729 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2730 | hdd_set_pwrparams(pHddCtx); |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 2731 | } |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 2732 | hdd_enable_bmps_imps(pHddCtx); |
| 2733 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2734 | } |
| 2735 | } |
| 2736 | } |
| 2737 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2738 | /* CR465478: Only send up a connection failure result when CSR has |
Varun Reddy Yeturu | da7f0d5 | 2013-12-20 11:16:57 -0800 | [diff] [blame] | 2739 | * completed operation - with a ASSOCIATION_FAILURE status.*/ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 2740 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2741 | { |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 2742 | |
| 2743 | if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 2744 | { |
| 2745 | hddLog(LOG1, |
| 2746 | FL("Assoication Failure for P2P client and we are trying to re-enable TDLS")); |
| 2747 | wlan_hdd_tdls_reenable(pHddCtx); |
| 2748 | } |
| 2749 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2750 | if (pRoamInfo) { |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2751 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2752 | "%s: send connect failure to nl80211:" |
| 2753 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2754 | " result:%d and Status:%d reasonCode %d" , |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2755 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2756 | roamResult, roamStatus, pRoamInfo->reasonCode); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2757 | pHddStaCtx->conn_info.assoc_status_code = |
| 2758 | pRoamInfo->statusCode; |
| 2759 | } else { |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2760 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2761 | "%s: connect failed:" |
| 2762 | " for bssid " MAC_ADDRESS_STR |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2763 | " result:%d and Status:%d" , |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2764 | __func__, MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 2765 | roamResult, roamStatus); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 2766 | } |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 2767 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2768 | /* inform association failure event to nl80211 */ |
| 2769 | if ( eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult ) |
| 2770 | { |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2771 | if (pRoamInfo) |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2772 | hdd_connect_result(dev, pRoamInfo->bssid, NULL, |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2773 | NULL, 0, NULL, 0, |
| 2774 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2775 | GFP_KERNEL); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2776 | else |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2777 | hdd_connect_result(dev, pWextState->req_bssId, NULL, |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 2778 | NULL, 0, NULL, 0, |
| 2779 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2780 | GFP_KERNEL); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2781 | } |
| 2782 | else |
| 2783 | { |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2784 | if (pRoamInfo) |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2785 | hdd_connect_result(dev, pRoamInfo->bssid, NULL, |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2786 | NULL, 0, NULL, 0, |
| 2787 | pRoamInfo->reasonCode ? |
| 2788 | pRoamInfo->reasonCode : |
| 2789 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2790 | GFP_KERNEL); |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2791 | else |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2792 | hdd_connect_result(dev, pWextState->req_bssId, NULL, |
Gao Wu | 6ca73b3 | 2016-05-09 14:35:49 +0800 | [diff] [blame] | 2793 | NULL, 0, NULL, 0, |
| 2794 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | bbe0b2a | 2016-12-05 11:57:36 +0530 | [diff] [blame] | 2795 | GFP_KERNEL); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 2796 | } |
Abhishek Singh | c0fccd2 | 2015-10-19 16:44:00 +0530 | [diff] [blame] | 2797 | /*Clear the roam profile*/ |
| 2798 | hdd_clearRoamProfileIe( pAdapter ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2799 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2800 | |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 2801 | hdd_wmm_init( pAdapter ); |
Madan Mohan Koyyalamudi | ee255f1 | 2012-09-28 15:41:19 -0700 | [diff] [blame] | 2802 | |
c_hpothu | 24f4098 | 2014-04-18 18:00:36 +0530 | [diff] [blame] | 2803 | if (pRoamInfo) |
| 2804 | { |
| 2805 | WLANTL_AssocFailed(pRoamInfo->staId); |
| 2806 | } |
Mihir Shete | b733727 | 2014-04-11 15:53:08 +0530 | [diff] [blame] | 2807 | |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 2808 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2809 | netif_tx_disable(dev); |
| 2810 | netif_carrier_off(dev); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2811 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2812 | } |
| 2813 | |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2814 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2815 | { |
| 2816 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 2817 | if (pHostapdAdapter != NULL) |
| 2818 | { |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2819 | /* Restart SAP if its operating channel is different |
| 2820 | * from AP channel. |
| 2821 | */ |
| 2822 | if (pHostapdAdapter->sessionCtx.ap.operatingChannel != |
| 2823 | (int)pRoamInfo->pBssDesc->channelId) |
| 2824 | { |
| 2825 | hddLog(VOS_TRACE_LEVEL_INFO,"Restart Sap as SAP channel is %d " |
| 2826 | "and STA channel is %d", pHostapdAdapter->sessionCtx.ap.operatingChannel, |
| 2827 | (int)pRoamInfo->pBssDesc->channelId); |
Hanumanth Reddy Pothula | 8d4b8eb | 2018-02-26 16:14:10 +0530 | [diff] [blame] | 2828 | if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->force_scc_with_ecsa) |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2829 | { |
Abhishek Singh | 78c691f | 2017-11-30 13:48:44 +0530 | [diff] [blame] | 2830 | hdd_schedule_ecsa_chan_change_work(pHddCtx, |
| 2831 | pAdapter->sessionId); |
| 2832 | } |
| 2833 | else |
| 2834 | { |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2835 | hdd_hostapd_stop(pHostapdAdapter->dev); |
Hanumanth Reddy Pothula | 8d4b8eb | 2018-02-26 16:14:10 +0530 | [diff] [blame] | 2836 | if (pHddCtx->cfg_ini && |
| 2837 | pHddCtx->cfg_ini->enable_sap_auth_offload) |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 2838 | hdd_force_scc_restart_sap(pHostapdAdapter, |
| 2839 | pHddCtx, (int)pRoamInfo->pBssDesc->channelId); |
| 2840 | } |
Agrawal Ashish | 574b3e6 | 2017-02-09 18:58:34 +0530 | [diff] [blame] | 2841 | |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 2842 | } |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 2843 | } |
| 2844 | } |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 2845 | else if (roamStatus == eCSR_ROAM_ASSOCIATION_FAILURE) |
| 2846 | { |
| 2847 | hdd_check_and_move_if_sap_is_on_dfs_chan(pHddCtx, pAdapter); |
| 2848 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2849 | return eHAL_STATUS_SUCCESS; |
| 2850 | } |
| 2851 | |
| 2852 | /**============================================================================ |
| 2853 | * |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2854 | @brief hdd_RoamIbssIndicationHandler() - Here we update the status of the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2855 | 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] | 2856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2857 | ===========================================================================*/ |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2858 | static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter, |
| 2859 | tCsrRoamInfo *pRoamInfo, |
| 2860 | tANI_U32 roamId, |
| 2861 | eRoamCmdStatus roamStatus, |
| 2862 | eCsrRoamResult roamResult ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2863 | { |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2864 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 2865 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 2866 | struct cfg80211_bss *bss; |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 2867 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2868 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2869 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d", |
| 2870 | __func__, pAdapter->dev->name, roamId, roamStatus, roamResult); |
| 2871 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2872 | switch( roamResult ) |
| 2873 | { |
| 2874 | // both IBSS Started and IBSS Join should come in here. |
| 2875 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 2876 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2877 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2878 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2879 | if (NULL == pRoamInfo) |
| 2880 | { |
| 2881 | VOS_ASSERT(0); |
| 2882 | return; |
| 2883 | } |
| 2884 | |
| 2885 | /* When IBSS Started comes from CSR, we need to move |
| 2886 | * connection state to IBSS Disconnected (meaning no peers |
| 2887 | * are in the IBSS). |
| 2888 | */ |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2889 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2890 | "%s: Set HDD connState to eConnectionState_IbssDisconnected", |
| 2891 | __func__); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2892 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 2893 | eConnectionState_IbssDisconnected ); |
Abhishek Singh | 1c21c4d | 2014-04-25 16:40:19 +0530 | [diff] [blame] | 2894 | /*notify wmm */ |
| 2895 | hdd_wmm_connect(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2896 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2897 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2898 | if (pRoamInfo->pBssDesc) |
| 2899 | { |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2900 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 2901 | struct ieee80211_channel *chan; |
| 2902 | int chan_no; |
| 2903 | unsigned int freq; |
| 2904 | #endif |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2905 | hdd_ibss_RegisterSTA (pAdapter, pRoamInfo, |
| 2906 | IBSS_BROADCAST_STAID, |
| 2907 | &broadcastMacAddr, pRoamInfo->pBssDesc); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2908 | |
| 2909 | /* we created the IBSS, notify supplicant */ |
| 2910 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: created ibss " |
| 2911 | MAC_ADDRESS_STR, |
| 2912 | __func__, pAdapter->dev->name, |
| 2913 | MAC_ADDR_ARRAY(pRoamInfo->pBssDesc->bssId)); |
| 2914 | |
| 2915 | /* we must first give cfg80211 the BSS information */ |
| 2916 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 2917 | if (NULL == bss) |
| 2918 | { |
| 2919 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2920 | "%s: %s: unable to create IBSS entry", |
| 2921 | __func__, pAdapter->dev->name); |
| 2922 | return; |
| 2923 | } |
Abhishek Singh | 00b7197 | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 2924 | #ifdef WLAN_FEATURE_RMC |
| 2925 | netif_carrier_on(pAdapter->dev); |
| 2926 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
| 2927 | netif_tx_start_all_queues(pAdapter->dev); |
| 2928 | #endif |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2929 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 2930 | chan_no = pRoamInfo->pBssDesc->channelId; |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2931 | |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2932 | if (chan_no <= 14) |
| 2933 | freq = ieee80211_channel_to_frequency(chan_no, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2934 | HDD_NL80211_BAND_2GHZ); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2935 | else |
| 2936 | freq = ieee80211_channel_to_frequency(chan_no, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2937 | HDD_NL80211_BAND_5GHZ); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2938 | |
| 2939 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 2940 | |
| 2941 | if (chan) |
| 2942 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 2943 | chan, GFP_KERNEL); |
| 2944 | else |
| 2945 | hddLog(LOGE, FL("%s: chanId: %d, can't find channel"), |
| 2946 | pAdapter->dev->name, |
| 2947 | (int)pRoamInfo->pBssDesc->channelId); |
| 2948 | #else |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2949 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL); |
Anand N Sunkad | fec4068 | 2015-07-29 09:51:17 +0530 | [diff] [blame] | 2950 | #endif |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 2951 | cfg80211_put_bss( |
| 2952 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 2953 | pHddCtx->wiphy, |
| 2954 | #endif |
| 2955 | bss); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2956 | } |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 2957 | else |
| 2958 | { |
| 2959 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2960 | "%s: NULL Bss Desc",__func__); |
| 2961 | } |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 2962 | |
| 2963 | /* Set Broadcast key again in case IBSS_COALESCED as DEL BSS, |
| 2964 | * in IBSS_COALESCED will remove the BC key. |
| 2965 | */ |
| 2966 | if ((eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) && |
| 2967 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY |
| 2968 | == pHddStaCtx->ibss_enc_key.encType |
| 2969 | ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY |
| 2970 | == pHddStaCtx->ibss_enc_key.encType |
| 2971 | ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType |
| 2972 | ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType )) |
| 2973 | { |
| 2974 | u8 grpmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 2975 | VOS_STATUS vosStatus; |
| 2976 | |
| 2977 | pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX; |
| 2978 | |
| 2979 | memcpy(&pHddStaCtx->ibss_enc_key.peerMac, |
| 2980 | grpmacaddr, WNI_CFG_BSSID_LEN); |
| 2981 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2982 | FL(" SET GTK in case of COALESCED")); |
| 2983 | vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2984 | pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId ); |
| 2985 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 2986 | { |
| 2987 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2988 | FL("sme_RoamSetKey failed, returned %d"),vosStatus); |
| 2989 | } |
| 2990 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2991 | break; |
| 2992 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2994 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 2995 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2996 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unable to create IBSS", |
| 2997 | __func__, pAdapter->dev->name); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2998 | break; |
| 2999 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3000 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3001 | default: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3002 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unexpected result %d", |
| 3003 | __func__, pAdapter->dev->name, (int)roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3004 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3005 | } |
| 3006 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 3007 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3008 | } |
| 3009 | |
| 3010 | /**============================================================================ |
| 3011 | * |
| 3012 | @brief roamSaveIbssStation() - Save the IBSS peer MAC address in the adapter. |
| 3013 | This information is passed to iwconfig later. The peer that joined |
| 3014 | last is passed as information to iwconfig. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3015 | 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] | 3016 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3017 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3018 | ===========================================================================*/ |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3019 | 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] | 3020 | { |
| 3021 | int fSuccess = FALSE; |
| 3022 | int idx = 0; |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3023 | VOS_STATUS status; |
| 3024 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3025 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3026 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 3027 | { |
| 3028 | if ( 0 == pHddStaCtx->conn_info.staId[ idx ] ) |
| 3029 | { |
| 3030 | pHddStaCtx->conn_info.staId[ idx ] = staId; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3031 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3032 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ], peerMacAddress ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3033 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3034 | fSuccess = TRUE; |
| 3035 | break; |
| 3036 | } |
| 3037 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3038 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3039 | status = hdd_sta_id_hash_add_entry(pAdapter, staId, peerMacAddress); |
| 3040 | if (status != VOS_STATUS_SUCCESS) { |
| 3041 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3042 | FL("Not able to add staid hash %d"), staId); |
| 3043 | return FALSE; |
| 3044 | } |
| 3045 | |
| 3046 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3047 | FL("New station added sta_id %d mac:" |
| 3048 | MAC_ADDRESS_STR), staId, |
| 3049 | MAC_ADDR_ARRAY(peerMacAddress->bytes)); |
| 3050 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3051 | return( fSuccess ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3052 | } |
| 3053 | /**============================================================================ |
| 3054 | * |
| 3055 | @brief roamRemoveIbssStation() - Remove the IBSS peer MAC address in the adapter. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3056 | 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] | 3057 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3058 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3059 | ===========================================================================*/ |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3060 | static int roamRemoveIbssStation( hdd_adapter_t *pAdapter, v_U8_t staId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3061 | { |
| 3062 | int fSuccess = FALSE; |
| 3063 | int idx = 0; |
| 3064 | v_U8_t valid_idx = 0; |
| 3065 | v_U8_t del_idx = 0; |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3066 | v_U8_t empty_slots = 0; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3067 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3068 | VOS_STATUS status; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3069 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3070 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 3071 | { |
| 3072 | if ( staId == pHddStaCtx->conn_info.staId[ idx ] ) |
| 3073 | { |
| 3074 | pHddStaCtx->conn_info.staId[ idx ] = 0; |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3075 | status = hdd_sta_id_hash_remove_entry(pAdapter, |
| 3076 | staId, &pHddStaCtx->conn_info.peerMacAddress[idx]); |
| 3077 | if (status != VOS_STATUS_SUCCESS) { |
| 3078 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3079 | FL("Not able to remove staid hash %d"), staId ); |
| 3080 | fSuccess = FALSE; |
| 3081 | } else { |
| 3082 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3083 | FL("station removed sta_id %d mac:" |
| 3084 | MAC_ADDRESS_STR), staId, |
| 3085 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[idx].bytes)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3086 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3087 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3088 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 3089 | fSuccess = TRUE; |
| 3090 | // Note the deleted Index, if its 0 we need special handling |
| 3091 | del_idx = idx; |
| 3092 | empty_slots++; |
| 3093 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3094 | } |
| 3095 | else |
| 3096 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3097 | if (pHddStaCtx->conn_info.staId[idx] != 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3098 | { |
| 3099 | valid_idx = idx; |
| 3100 | } |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3101 | else |
| 3102 | { |
| 3103 | // Found an empty slot |
| 3104 | empty_slots++; |
| 3105 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3106 | } |
| 3107 | } |
| 3108 | |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3109 | if (HDD_MAX_NUM_IBSS_STA == empty_slots) |
| 3110 | { |
| 3111 | // Last peer departed, set the IBSS state appropriately |
| 3112 | pHddStaCtx->conn_info.connState = eConnectionState_IbssDisconnected; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3113 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 3114 | "Last IBSS Peer Departed!!!" ); |
| 3115 | } |
| 3116 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3117 | // Find next active staId, to have a valid sta trigger for TL. |
| 3118 | if (fSuccess == TRUE) |
| 3119 | { |
| 3120 | if (del_idx == 0) |
| 3121 | { |
| 3122 | if (pHddStaCtx->conn_info.staId[valid_idx] != 0) |
| 3123 | { |
| 3124 | pHddStaCtx->conn_info.staId[0] = pHddStaCtx->conn_info.staId[valid_idx]; |
| 3125 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], |
| 3126 | &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ]); |
| 3127 | |
| 3128 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
| 3129 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ] ); |
| 3130 | } |
| 3131 | } |
| 3132 | } |
| 3133 | return( fSuccess ); |
| 3134 | } |
| 3135 | |
| 3136 | /**============================================================================ |
| 3137 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3138 | @brief roamIbssConnectHandler() : We update the status of the IBSS to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3139 | connected in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3140 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3141 | ===========================================================================*/ |
| 3142 | static eHalStatus roamIbssConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo ) |
| 3143 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3144 | struct cfg80211_bss *bss; |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 3145 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3146 | "%s: IBSS Connect Indication from SME!!! " |
| 3147 | "Set HDD connState to eConnectionState_IbssConnected", |
| 3148 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3149 | // Set the internal connection state to show 'IBSS Connected' (IBSS with a partner stations)... |
| 3150 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssConnected ); |
| 3151 | |
| 3152 | // Save the connection info from CSR... |
| 3153 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS ); |
| 3154 | |
| 3155 | // Send the bssid address to the wext. |
| 3156 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3157 | /* add bss_id to cfg80211 data base */ |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3158 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3159 | if (NULL == bss) |
| 3160 | { |
| 3161 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3162 | "%s: %s: unable to create IBSS entry", |
| 3163 | __func__, pAdapter->dev->name); |
| 3164 | return eHAL_STATUS_FAILURE; |
| 3165 | } |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 3166 | cfg80211_put_bss( |
| 3167 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 3168 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
| 3169 | #endif |
| 3170 | bss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3171 | |
| 3172 | return( eHAL_STATUS_SUCCESS ); |
| 3173 | } |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 3174 | |
| 3175 | /**============================================================================ |
| 3176 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3177 | @brief hdd_RoamSetKeyCompleteHandler() - Update the security parameters. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3179 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3180 | static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 3181 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3182 | eCsrRoamResult roamResult ) |
| 3183 | { |
| 3184 | eCsrEncryptionType connectedCipherAlgo; |
| 3185 | v_BOOL_t fConnected = FALSE; |
| 3186 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 3187 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3188 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3189 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3190 | WLANTL_STAStateType prevTLState = WLANTL_STA_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3191 | ENTER(); |
Srinivas Girigowda | 5a737f2 | 2013-06-28 15:21:48 -0700 | [diff] [blame] | 3192 | |
| 3193 | if (NULL == pRoamInfo) |
| 3194 | { |
| 3195 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "pRoamInfo is NULL"); |
| 3196 | return eHAL_STATUS_FAILURE; |
| 3197 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3198 | // 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] | 3199 | // then go to 'authenticated'. For all other authentication types (those that do |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3200 | // not require upper layer authentication) we can put TL directly into 'authenticated' |
| 3201 | // state. |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3202 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3203 | "Set Key completion roamStatus =%d roamResult=%d " MAC_ADDRESS_STR, |
| 3204 | roamStatus, roamResult, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3205 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3206 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 3207 | if( fConnected ) |
| 3208 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3209 | if ( WLAN_HDD_IBSS == pAdapter->device_mode ) |
| 3210 | { |
| 3211 | v_U8_t staId; |
| 3212 | |
| 3213 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 3214 | |
| 3215 | if ( 0 == memcmp( pRoamInfo->peerMac, |
| 3216 | &broadcastMacAddr, VOS_MAC_ADDR_SIZE ) ) |
| 3217 | { |
| 3218 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3219 | IBSS_BROADCAST_STAID); |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3220 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3221 | "WLAN TL STA GTK Installed for STAID=%d", IBSS_BROADCAST_STAID); |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3222 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3223 | } |
| 3224 | else |
| 3225 | { |
| 3226 | vosStatus = hdd_Ibss_GetStaId(pHddStaCtx, |
| 3227 | (v_MACADDR_t*)pRoamInfo->peerMac, |
| 3228 | &staId); |
| 3229 | if ( VOS_STATUS_SUCCESS == vosStatus ) |
| 3230 | { |
| 3231 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 3232 | "WLAN TL STA Ptk Installed for STAID=%d", staId); |
| 3233 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3234 | staId); |
| 3235 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3236 | } |
| 3237 | } |
| 3238 | } |
| 3239 | else |
| 3240 | { |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3241 | WLANTL_GetSTAState(pHddCtx->pvosContext, |
| 3242 | pHddStaCtx->conn_info.staId[0], |
| 3243 | &prevTLState); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3244 | // TODO: Considering getting a state machine in HDD later. |
| 3245 | // This routine is invoked twice. 1)set PTK 2)set GTK. |
| 3246 | // The folloing if statement will be TRUE when setting GTK. |
| 3247 | // At this time we don't handle the state in detail. |
| 3248 | // Related CR: 174048 - TL not in authenticated state |
| 3249 | if ( ( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) && |
| 3250 | (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired ) |
| 3251 | { |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3252 | |
| 3253 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set " |
| 3254 | "for StaId=%d. Changing TL state to AUTHENTICATED from" |
| 3255 | " state:%d", pHddStaCtx->conn_info.staId[0], prevTLState); |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3256 | |
| 3257 | // Connections that do not need Upper layer authentication, |
| 3258 | // transition TL to 'Authenticated' state after the keys are set. |
| 3259 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 3260 | pHddStaCtx->conn_info.staId[ 0 ], |
| 3261 | WLANTL_STA_AUTHENTICATED ); |
| 3262 | |
| 3263 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 3264 | |
| 3265 | if (WLANTL_STA_AUTHENTICATED != prevTLState) |
| 3266 | hdd_postTLPacketPendingInd(pAdapter, |
| 3267 | pHddStaCtx->conn_info.staId[0]); |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 3268 | //Need to call offload because when roaming happen at that time fwr |
| 3269 | //clean offload info as part of the DelBss |
| 3270 | // No need to configure offload if host was not suspended |
| 3271 | spin_lock(&pHddCtx->filter_lock); |
| 3272 | if(pHddCtx->hdd_wlan_suspended) |
| 3273 | { |
| 3274 | spin_unlock(&pHddCtx->filter_lock); |
| 3275 | hdd_ReConfigSuspendDataClearedDuringRoaming(pHddCtx); |
| 3276 | } |
| 3277 | else |
| 3278 | { |
| 3279 | spin_unlock(&pHddCtx->filter_lock); |
| 3280 | } |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 3281 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 3282 | { |
| 3283 | vos_record_roam_event(e_HDD_SET_GTK_RSP, NULL, 0); |
| 3284 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3285 | } |
| 3286 | else |
| 3287 | { |
| 3288 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 3289 | pHddStaCtx->conn_info.staId[ 0 ]); |
Bhargav Shah | a805ef2 | 2015-07-29 17:31:38 +0530 | [diff] [blame] | 3290 | |
| 3291 | /* In case of OSEN move TL to 'Authenticated' after PTK is set */ |
| 3292 | if (pWextState->roamProfile.bOSENAssociation == VOS_TRUE) |
| 3293 | { |
| 3294 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "PTK set" |
| 3295 | " for StaId=%d. Due to OSEN, Changing TL state to" |
| 3296 | "AUTHENTICATED from state:%d", |
| 3297 | pHddStaCtx->conn_info.staId[0], prevTLState); |
| 3298 | |
| 3299 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 3300 | pHddStaCtx->conn_info.staId[ 0 ], |
| 3301 | WLANTL_STA_AUTHENTICATED ); |
| 3302 | |
| 3303 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 3304 | |
| 3305 | if (WLANTL_STA_AUTHENTICATED != prevTLState) |
| 3306 | hdd_postTLPacketPendingInd(pAdapter, |
| 3307 | pHddStaCtx->conn_info.staId[0]); |
| 3308 | } |
| 3309 | |
| 3310 | |
| 3311 | |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 3312 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 3313 | { |
| 3314 | vos_record_roam_event(e_HDD_SET_PTK_RSP, (void *)pRoamInfo->peerMac, 6); |
| 3315 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3316 | } |
| 3317 | |
| 3318 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3319 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3320 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 3321 | else |
| 3322 | { |
| 3323 | // possible disassoc after issuing set key and waiting set key complete |
| 3324 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3325 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3326 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3327 | EXIT(); |
| 3328 | return( eHAL_STATUS_SUCCESS ); |
| 3329 | } |
| 3330 | /**============================================================================ |
| 3331 | * |
| 3332 | @brief hdd_RoamMicErrorIndicationHandler() - This function indicates the Mic failure to the supplicant. |
| 3333 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3334 | static eHalStatus hdd_RoamMicErrorIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3335 | tANI_U32 roamId, eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3336 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3337 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3338 | |
| 3339 | if( eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3340 | TKIP_COUNTER_MEASURE_STOPED == pHddStaCtx->WextState.mTKIPCounterMeasures ) |
| 3341 | { |
| 3342 | struct iw_michaelmicfailure msg; |
| 3343 | union iwreq_data wreq; |
| 3344 | memset(&msg, '\0', sizeof(msg)); |
| 3345 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3346 | 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] | 3347 | hddLog(LOG1, "MIC MAC " MAC_ADDRESS_STR, |
| 3348 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3349 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3350 | if(pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) |
| 3351 | msg.flags = IW_MICFAILURE_GROUP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3352 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3353 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3354 | memset(&wreq, 0, sizeof(wreq)); |
| 3355 | wreq.data.length = sizeof(msg); |
| 3356 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, (char *)&msg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3357 | /* inform mic failure to nl80211 */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3358 | cfg80211_michael_mic_failure(pAdapter->dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3359 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3360 | ((pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) ? |
| 3361 | NL80211_KEYTYPE_GROUP : |
| 3362 | NL80211_KEYTYPE_PAIRWISE), |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3363 | pRoamInfo->u.pMICFailureInfo->keyId, |
| 3364 | pRoamInfo->u.pMICFailureInfo->TSC, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3365 | GFP_KERNEL); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3366 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3367 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3369 | return( eHAL_STATUS_SUCCESS ); |
| 3370 | } |
| 3371 | |
| 3372 | /**============================================================================ |
| 3373 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3374 | @brief roamRoamConnectStatusUpdateHandler() - The Ibss connection status is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3375 | updated regularly here in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3377 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3378 | static eHalStatus roamRoamConnectStatusUpdateHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 3379 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3380 | eCsrRoamResult roamResult ) |
| 3381 | { |
| 3382 | VOS_STATUS vosStatus; |
| 3383 | |
| 3384 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3385 | switch( roamResult ) |
| 3386 | { |
| 3387 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3388 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3389 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3390 | struct station_info *staInfo; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3391 | |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 3392 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3393 | "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] | 3394 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 3395 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3396 | pRoamInfo->staId ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3397 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3398 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3399 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3400 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
| 3401 | WLANTL_UpdateSTABssIdforIBSS(pHddCtx->pvosContext, |
| 3402 | IBSS_BROADCAST_STAID,pHddStaCtx->conn_info.bssId); |
| 3403 | |
| 3404 | // Register the Station with TL for the new peer. |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3405 | vosStatus = hdd_ibss_RegisterSTA( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3406 | pRoamInfo, |
| 3407 | pRoamInfo->staId, |
| 3408 | (v_MACADDR_t *)pRoamInfo->peerMac, |
| 3409 | pRoamInfo->pBssDesc ); |
| 3410 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3411 | { |
| 3412 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3413 | "Cannot register STA with TL for IBSS. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3414 | vosStatus, vosStatus ); |
| 3415 | } |
Abhishek Singh | decf1b6 | 2016-02-09 11:53:58 +0530 | [diff] [blame] | 3416 | if (!roamSaveIbssStation(pAdapter, |
| 3417 | pRoamInfo->staId, |
| 3418 | (v_MACADDR_t *)pRoamInfo->peerMac)) |
| 3419 | { |
| 3420 | hddLog(LOGW, FL("Not Able to add sta in sta hash")); |
| 3421 | break; |
| 3422 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3423 | pHddStaCtx->ibss_sta_generation++; |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3424 | |
| 3425 | staInfo = vos_mem_malloc(sizeof(*staInfo)); |
| 3426 | if (staInfo == NULL) { |
| 3427 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3428 | "memory allocation for station_info failed"); |
| 3429 | return eHAL_STATUS_FAILED_ALLOC; |
| 3430 | } |
| 3431 | |
| 3432 | memset(staInfo, 0, sizeof(*staInfo)); |
| 3433 | staInfo->filled = 0; |
| 3434 | staInfo->generation = pHddStaCtx->ibss_sta_generation; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3435 | |
| 3436 | cfg80211_new_sta(pAdapter->dev, |
| 3437 | (const u8 *)pRoamInfo->peerMac, |
SaidiReddy Yenuga | be255a6 | 2016-12-07 16:21:07 +0530 | [diff] [blame] | 3438 | staInfo, GFP_KERNEL); |
| 3439 | vos_mem_free(staInfo); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3440 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3441 | if ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 3442 | ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 3443 | ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType |
| 3444 | ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType ) |
| 3445 | { |
| 3446 | pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX; |
Abhishek Singh | b25e844 | 2015-06-23 14:28:05 +0530 | [diff] [blame] | 3447 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3448 | memcpy(&pHddStaCtx->ibss_enc_key.peerMac, |
| 3449 | pRoamInfo->peerMac, WNI_CFG_BSSID_LEN); |
| 3450 | |
| 3451 | VOS_TRACE( VOS_MODULE_ID_HDD, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3452 | VOS_TRACE_LEVEL_INFO_HIGH, "New peer joined set PTK encType=%d", |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3453 | pHddStaCtx->ibss_enc_key.encType); |
| 3454 | |
| 3455 | vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3456 | pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId ); |
| 3457 | |
| 3458 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 3459 | { |
| 3460 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3461 | "%s: sme_RoamSetKey failed, returned %d", |
| 3462 | __func__, vosStatus); |
| 3463 | return VOS_STATUS_E_FAILURE; |
| 3464 | } |
| 3465 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3466 | netif_carrier_on(pAdapter->dev); |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 3467 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3468 | netif_tx_start_all_queues(pAdapter->dev); |
| 3469 | break; |
| 3470 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3471 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3472 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3473 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3474 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3475 | roamIbssConnectHandler( pAdapter, pRoamInfo ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3476 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3477 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3478 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3479 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3480 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3481 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3482 | |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3483 | if ( !roamRemoveIbssStation(pAdapter, pRoamInfo->staId ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3484 | { |
| 3485 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 3486 | "IBSS peer departed by cannot find peer in our registration table with TL" ); |
| 3487 | } |
| 3488 | |
Deepthi Gowri | c7591cc | 2015-12-28 15:43:17 +0530 | [diff] [blame] | 3489 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3490 | "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] | 3491 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 3492 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
| 3493 | pRoamInfo->staId ); |
| 3494 | |
Katya Nigam | 4752877 | 2015-02-11 12:24:49 +0530 | [diff] [blame] | 3495 | hdd_ibss_DeregisterSTA( pAdapter, pRoamInfo->staId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3496 | |
| 3497 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3498 | pHddStaCtx->ibss_sta_generation++; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 3499 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3500 | cfg80211_del_sta(pAdapter->dev, |
| 3501 | (const u8 *)&pRoamInfo->peerMac, |
| 3502 | GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3503 | break; |
| 3504 | } |
| 3505 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3506 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3507 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 3508 | "Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3509 | // Stop only when we are inactive |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 3510 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3511 | netif_tx_disable(pAdapter->dev); |
| 3512 | netif_carrier_off(pAdapter->dev); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 3513 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3514 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 3515 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3516 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_NotConnected ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3517 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3518 | // Send the bssid address to the wext. |
| 3519 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
| 3520 | // clean up data path |
| 3521 | hdd_disconnect_tx_rx(pAdapter); |
| 3522 | break; |
| 3523 | } |
| 3524 | default: |
| 3525 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3526 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3527 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3529 | return( eHAL_STATUS_SUCCESS ); |
| 3530 | } |
| 3531 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3532 | #ifdef FEATURE_WLAN_TDLS |
| 3533 | /**============================================================================ |
| 3534 | * |
| 3535 | @brief hdd_roamRegisterTDLSSTA() - Construct the staDesc and register with |
| 3536 | TL the new STA. This is called as part of ADD_STA in the TDLS setup |
| 3537 | Return: VOS_STATUS |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3538 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3539 | ===========================================================================*/ |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 3540 | VOS_STATUS hdd_roamRegisterTDLSSTA(hdd_adapter_t *pAdapter, |
| 3541 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 3542 | const tANI_U8 *peerMac, |
| 3543 | #else |
| 3544 | tANI_U8 *peerMac, |
| 3545 | #endif |
| 3546 | tANI_U16 staId, tANI_U8 ucastSig) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3547 | { |
| 3548 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3549 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3550 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 3551 | WLAN_STADescType staDesc = {0}; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3552 | eCsrEncryptionType connectedCipherAlgo = eCSR_ENCRYPT_TYPE_UNKNOWN; |
| 3553 | v_BOOL_t fConnected = FALSE; |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 3554 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3555 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3556 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3557 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 3558 | if (!fConnected) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3559 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3560 | "%s not connected. ignored", __func__); |
| 3561 | return VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3562 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3563 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3564 | /* |
| 3565 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3566 | * be peer MAC, here we are wokrking on direct Link |
| 3567 | */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3568 | staDesc.ucSTAId = staId ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3569 | |
| 3570 | staDesc.wSTAType = WLAN_STA_TDLS ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3571 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3572 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3573 | sizeof(tSirMacAddr) ); |
| 3574 | |
| 3575 | vos_mem_copy(staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 ); |
| 3576 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 3577 | |
| 3578 | /* set the QoS field appropriately ..*/ |
| 3579 | (hdd_wmm_is_active(pAdapter)) ? (staDesc.ucQosEnabled = 1) |
| 3580 | : (staDesc.ucQosEnabled = 0) ; |
| 3581 | |
| 3582 | 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] | 3583 | TL QoS_enabled=%d", staDesc.ucQosEnabled ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3584 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3585 | staDesc.ucProtectedFrame = (connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3586 | |
| 3587 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3588 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3589 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3590 | /* |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3591 | * UMA is ready we inform TL to do frame translation. |
| 3592 | */ |
| 3593 | staDesc.ucSwFrameTXXlation = 1; |
| 3594 | staDesc.ucSwFrameRXXlation = 1; |
| 3595 | staDesc.ucAddRmvLLC = 1; |
| 3596 | |
| 3597 | /* Initialize signatures and state */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3598 | staDesc.ucUcastSig = ucastSig ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3599 | |
| 3600 | /* tdls Direct Link do not need bcastSig */ |
| 3601 | staDesc.ucBcastSig = 0 ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3602 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3603 | if(staDesc.ucProtectedFrame) |
| 3604 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 3605 | else |
| 3606 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3607 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3608 | staDesc.ucInitState = WLANTL_STA_CONNECTED ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3609 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3610 | /* Register the Station with TL... */ |
| 3611 | vosStatus = WLANTL_RegisterSTAClient( pVosContext, |
| 3612 | hdd_rx_packet_cbk, |
| 3613 | hdd_tx_complete_cbk, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3614 | hdd_tx_fetch_packet_cbk, &staDesc, 0 ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3615 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3616 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3617 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3618 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3619 | "%s: WLANTL_RegisterSTAClient() failed to register. " |
| 3620 | "Status= %d [0x%08X]", __func__, vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3621 | return vosStatus; |
| 3622 | } |
| 3623 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 3624 | if ( cfg_param->dynSplitscan && |
| 3625 | ( VOS_TIMER_STATE_RUNNING != |
| 3626 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)) ) |
| 3627 | { |
| 3628 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 3629 | cfg_param->trafficMntrTmrForSplitScan); |
| 3630 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3631 | return( vosStatus ); |
| 3632 | } |
| 3633 | |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 3634 | VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 3635 | { |
| 3636 | VOS_STATUS vosStatus; |
| 3637 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 3638 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 3639 | { |
| 3640 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 3641 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3642 | "Status= %d [0x%08X]", |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 3643 | __func__, staId, vosStatus, vosStatus ); |
| 3644 | } |
| 3645 | return( vosStatus ); |
| 3646 | } |
| 3647 | |
| 3648 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3649 | /* |
| 3650 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3651 | * TL in case of new TDLS client is added and deregistration at the time |
| 3652 | * TDLS client is deleted. |
| 3653 | */ |
| 3654 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3655 | eHalStatus hdd_RoamTdlsStatusUpdateHandler(hdd_adapter_t *pAdapter, |
| 3656 | tCsrRoamInfo *pRoamInfo, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3657 | tANI_U32 roamId, |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3658 | eRoamCmdStatus roamStatus, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3659 | eCsrRoamResult roamResult) |
| 3660 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3661 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3662 | eHalStatus status = eHAL_STATUS_FAILURE ; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3663 | tANI_U8 staIdx; |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 3664 | |
Kaushik, Sushant | 8489f47 | 2014-01-27 11:41:22 +0530 | [diff] [blame] | 3665 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3666 | ("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR), |
| 3667 | roamResult == eCSR_ROAM_RESULT_ADD_TDLS_PEER ? |
| 3668 | "ADD_TDLS_PEER" : |
| 3669 | roamResult == eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? |
| 3670 | "DEL_TDLS_PEER" : |
| 3671 | roamResult == eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? |
| 3672 | "DEL_TDLS_PEER_IND" : |
| 3673 | roamResult == eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3674 | "DEL_ALL_TDLS_PEER_IND" : |
| 3675 | roamResult == eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? |
| 3676 | "UPDATE_TDLS_PEER" : |
| 3677 | roamResult == eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3678 | "LINK_ESTABLISH_REQ_RSP" : |
| 3679 | roamResult == eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP ? |
| 3680 | "CHANNEL_SWITCH_REQ_RSP" : "UNKNOWN", |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3681 | pRoamInfo->staId, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3682 | switch( roamResult ) |
| 3683 | { |
| 3684 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3685 | { |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3686 | if(eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3687 | { |
Masti, Narayanraddi | 83dbfc2 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 3688 | hddTdlsPeer_t *curr_peer; |
| 3689 | |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3690 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3691 | ("%s: Add Sta is failed. %d"),__func__, pRoamInfo->statusCode); |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 3692 | wlan_hdd_tdls_check_bmps(pAdapter); |
Masti, Narayanraddi | 83dbfc2 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 3693 | |
| 3694 | mutex_lock(&pHddCtx->tdls_lock); |
| 3695 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3696 | pRoamInfo->peerMac, FALSE); |
| 3697 | if (NULL != curr_peer) |
| 3698 | curr_peer->link_status = eTDLS_LINK_TEARING; |
| 3699 | else |
| 3700 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3701 | "%s %d curr_peer is Null", __func__,__LINE__); |
| 3702 | mutex_unlock(&pHddCtx->tdls_lock); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 3703 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3704 | else |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3705 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3706 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3707 | /* check if there is available index for this new TDLS STA */ |
| 3708 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
| 3709 | { |
| 3710 | if (0 == pHddCtx->tdlsConnInfo[staIdx].staId ) |
| 3711 | { |
| 3712 | pHddCtx->tdlsConnInfo[staIdx].sessionId = pRoamInfo->sessionId; |
| 3713 | pHddCtx->tdlsConnInfo[staIdx].staId = pRoamInfo->staId; |
| 3714 | |
| 3715 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3716 | ("TDLS: STA IDX at %d is %d " |
| 3717 | "of mac " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3718 | staIdx, pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3719 | MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3720 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3721 | vos_copy_macaddr(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3722 | (v_MACADDR_t *)pRoamInfo->peerMac) ; |
| 3723 | status = eHAL_STATUS_SUCCESS ; |
| 3724 | break ; |
| 3725 | } |
| 3726 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3727 | if (staIdx < HDD_MAX_NUM_TDLS_STA) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3728 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3729 | 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] | 3730 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3731 | "wlan_hdd_tdls_set_sta_id() failed"); |
| 3732 | return VOS_FALSE; |
| 3733 | } |
| 3734 | |
| 3735 | (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3736 | /* store the ucast signature , if required for further reference. */ |
| 3737 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3738 | wlan_hdd_tdls_set_signature( pAdapter, pRoamInfo->peerMac, pRoamInfo->ucastSig ); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 3739 | /* start TDLS client registration with TL */ |
| 3740 | status = hdd_roamRegisterTDLSSTA( pAdapter, |
| 3741 | pRoamInfo->peerMac, |
| 3742 | pRoamInfo->staId, |
| 3743 | pRoamInfo->ucastSig); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3744 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3745 | } |
| 3746 | else |
| 3747 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3748 | status = eHAL_STATUS_FAILURE; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3749 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 3750 | "%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] | 3751 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3752 | pAdapter->tdlsAddStaStatus = status; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3753 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 3754 | complete(&pAdapter->tdls_add_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3755 | break ; |
| 3756 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3757 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3758 | { |
| 3759 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3760 | { |
| 3761 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3762 | "%s: Add Sta is failed. %d", __func__, pRoamInfo->statusCode); |
| 3763 | } |
| 3764 | /* store the ucast signature which will be used later when |
| 3765 | * registering to TL |
| 3766 | */ |
| 3767 | pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode; |
| 3768 | complete(&pAdapter->tdls_add_station_comp); |
| 3769 | break; |
| 3770 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3771 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3772 | { |
| 3773 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3774 | { |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3775 | hddTdlsPeer_t *curr_peer; |
| 3776 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3777 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3778 | "%s: Link Establish Request failed. %d", __func__, pRoamInfo->statusCode); |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3779 | |
| 3780 | mutex_lock(&pHddCtx->tdls_lock); |
| 3781 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3782 | pRoamInfo->peerMac, FALSE); |
| 3783 | if (curr_peer) |
| 3784 | curr_peer->link_status = eTDLS_LINK_TEARING; |
| 3785 | else |
| 3786 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3787 | "%s %d curr_peer is Null",__func__,__LINE__); |
| 3788 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3789 | } |
| 3790 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3791 | break; |
| 3792 | } |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3793 | case eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP: |
| 3794 | { |
| 3795 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 3796 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3797 | "%s: Channel switch request failed. %d", __func__, |
| 3798 | pRoamInfo->statusCode); |
| 3799 | else |
| 3800 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3801 | "%s: Channel switch request Success", __func__); |
| 3802 | break; |
| 3803 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3804 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3805 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3806 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3807 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3808 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3809 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 3810 | pRoamInfo->staId == pHddCtx->tdlsConnInfo[staIdx].staId) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3811 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3812 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3813 | ("HDD: del STA IDX = %x"), pRoamInfo->staId) ; |
| 3814 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3815 | mutex_lock(&pHddCtx->tdls_lock); |
| 3816 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, |
| 3817 | pRoamInfo->peerMac, FALSE); |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3818 | if (NULL != curr_peer) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3819 | { |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3820 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 3821 | " Current status for peer" MAC_ADDRESS_STR "is %d", |
| 3822 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), curr_peer->link_status); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3823 | if (TDLS_IS_CONNECTED(curr_peer) || |
| 3824 | (eTDLS_LINK_CONNECTING == curr_peer->link_status)) |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3825 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3826 | mutex_unlock(&pHddCtx->tdls_lock); |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame] | 3827 | hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId ); |
| 3828 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3829 | else |
| 3830 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3831 | |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 3832 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3833 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3834 | else |
| 3835 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3836 | |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3837 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3838 | wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3839 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3840 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3841 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 3842 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
| 3843 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3844 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3845 | wlan_hdd_tdls_check_bmps(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3846 | status = eHAL_STATUS_SUCCESS ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3847 | break ; |
| 3848 | } |
| 3849 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3850 | complete(&pAdapter->tdls_del_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3851 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3852 | break ; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3853 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 3854 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3855 | hddTdlsPeer_t *curr_peer; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3856 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3857 | "%s: Sending teardown to supplicant with reason code %u", |
| 3858 | __func__, pRoamInfo->reasonCode); |
| 3859 | |
| 3860 | #ifdef CONFIG_TDLS_IMPLICIT |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3861 | mutex_lock(&pHddCtx->tdls_lock); |
| 3862 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, |
| 3863 | FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3864 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, pRoamInfo->reasonCode); |
Abhishek Singh | 9656892 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 3865 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 3866 | curr_peer->peerMac); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 3867 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3868 | #endif |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3869 | status = eHAL_STATUS_SUCCESS ; |
| 3870 | break ; |
| 3871 | } |
| 3872 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 3873 | { |
| 3874 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3875 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3876 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3877 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 3878 | pHddCtx->tdlsConnInfo[staIdx].staId) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3879 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3880 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3881 | ("hdd_tdlsStatusUpdate: staIdx %d " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3882 | pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 3883 | MAC_ADDR_ARRAY(pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes)); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3884 | |
| 3885 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3886 | wlan_hdd_tdls_reset_peer(pAdapter, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes); |
Masti, Narayanraddi | 9e4f408 | 2015-10-17 16:05:15 +0530 | [diff] [blame] | 3887 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3888 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3889 | hdd_roamDeregisterTDLSSTA ( pAdapter, pHddCtx->tdlsConnInfo[staIdx].staId ); |
| 3890 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
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 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3893 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 3894 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 3895 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3896 | |
| 3897 | status = eHAL_STATUS_SUCCESS ; |
| 3898 | } |
| 3899 | } |
Gopichand Nakkala | 40ab275 | 2013-04-04 20:11:36 +0530 | [diff] [blame] | 3900 | wlan_hdd_tdls_check_bmps(pAdapter); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 3901 | break ; |
| 3902 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3903 | default: |
| 3904 | { |
| 3905 | break ; |
| 3906 | } |
| 3907 | } |
| 3908 | |
| 3909 | return status ; |
| 3910 | } |
| 3911 | #endif |
| 3912 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 3913 | void iw_full_power_cbfn (void *pContext, eHalStatus status) |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3914 | { |
| 3915 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
| 3916 | hdd_context_t *pHddCtx = NULL; |
| 3917 | int ret; |
| 3918 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3919 | ENTER(); |
| 3920 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3921 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 3922 | { |
| 3923 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 3924 | "%s: Bad param, pAdapter [%pK]", |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3925 | __func__, pAdapter); |
| 3926 | return; |
| 3927 | } |
| 3928 | |
| 3929 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3930 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3931 | if (0 != ret) |
| 3932 | { |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3933 | return; |
| 3934 | } |
| 3935 | |
| 3936 | if (pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 3937 | { |
| 3938 | sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), NULL, NULL); |
| 3939 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3940 | |
| 3941 | EXIT(); |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 3942 | } |
| 3943 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3944 | eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3945 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
| 3946 | { |
| 3947 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 3948 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 3949 | hdd_wext_state_t *pWextState = NULL; |
| 3950 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 3951 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 3952 | struct cfg80211_bss *bss_status; |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 3953 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3954 | |
| 3955 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3956 | "CSR Callback: status= %d result= %d roamID=%d", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3957 | roamStatus, roamResult, roamId ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3958 | |
| 3959 | /*Sanity check*/ |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 3960 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3961 | { |
| 3962 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 3963 | "invalid adapter or adapter has invalid magic"); |
| 3964 | return eHAL_STATUS_FAILURE; |
| 3965 | } |
| 3966 | |
| 3967 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3968 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3969 | |
| 3970 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 3971 | { |
| 3972 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3973 | "invalid WEXT state or HDD station context"); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3974 | return eHAL_STATUS_FAILURE; |
| 3975 | } |
| 3976 | |
Konamki, Sreelakshmi | b9c4571 | 2015-07-29 11:48:19 +0530 | [diff] [blame] | 3977 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 3978 | pAdapter->sessionId, roamStatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3979 | switch( roamStatus ) |
| 3980 | { |
| 3981 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 41d95e2 | 2015-08-28 12:51:32 +0530 | [diff] [blame] | 3982 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 3983 | complete(&pAdapter->session_open_comp_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3984 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3985 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3986 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
| 3987 | /* We did pre-auth,then we attempted a 11r or ese reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3988 | * reassoc failed due to failure, timeout, reject from ap |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3989 | * in any case tell the OS, our carrier is off and mark |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3990 | * interface down */ |
| 3991 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 3992 | hddLog(LOGE, FL("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d"), |
| 3993 | roamStatus, roamResult, pAdapter->sessionId); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 3994 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3995 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 3996 | /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */ |
| 3997 | if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3998 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 3999 | } |
| 4000 | pHddStaCtx->ft_carrier_on = FALSE; |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 4001 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4002 | break; |
| 4003 | |
| 4004 | case eCSR_ROAM_FT_START: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4005 | // When we roam for EsE and 11r, we dont want the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4006 | // OS to be informed that the link is down. So mark |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4007 | // the link ready for ft_start. After this the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4008 | // eCSR_ROAM_SHOULD_ROAM will be received. |
| 4009 | // Where in we will not mark the link down |
| 4010 | // Also we want to stop tx at this point when we will be |
| 4011 | // doing disassoc at this time. This saves 30-60 msec |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4012 | // after reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4013 | { |
| 4014 | struct net_device *dev = pAdapter->dev; |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 4015 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4016 | netif_tx_disable(dev); |
Girish Gowli | bf0e1ab | 2015-01-19 16:05:16 +0530 | [diff] [blame] | 4017 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4018 | if (pHddCtx->cfg_ini->gEnableRoamDelayStats) |
| 4019 | { |
| 4020 | vos_record_roam_event(e_HDD_DISABLE_TX_QUEUE, NULL, 0); |
| 4021 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4022 | /* |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4023 | * Deregister this STA with TL, but do not flush the packets |
| 4024 | * for this STA from wmm_tx_queue. Since there is no valid STA |
| 4025 | * for these packets they will not be transmitted. Eventually |
| 4026 | * after the reassociation is successful, these packets will be |
| 4027 | * transmitted after registering STA with TL again. This ensures |
| 4028 | * that driver does not drop packets during roaming. |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 4029 | */ |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4030 | status = WLANTL_ClearSTAClient(pHddCtx->pvosContext, |
| 4031 | pHddStaCtx->conn_info.staId[0]); |
| 4032 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4033 | { |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 4034 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4035 | FL("WLANTL_ClearSTAClient failed for staID %d." |
| 4036 | "Status= %d [0x%x]"), pHddStaCtx->conn_info.staId[0], |
| 4037 | status, status); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4038 | halStatus = eHAL_STATUS_FAILURE; |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 4039 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4040 | } |
| 4041 | pHddStaCtx->ft_carrier_on = TRUE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4042 | pHddStaCtx->hdd_ReassocScenario = VOS_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4043 | break; |
| 4044 | #endif |
| 4045 | |
| 4046 | case eCSR_ROAM_SHOULD_ROAM: |
| 4047 | // Dont need to do anything |
| 4048 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4049 | struct net_device *dev = pAdapter->dev; |
| 4050 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4051 | // notify apps that we can't pass traffic anymore |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 4052 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4053 | netif_tx_disable(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4054 | #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] | 4055 | if (pHddStaCtx->ft_carrier_on == FALSE) |
| 4056 | { |
| 4057 | #endif |
| 4058 | netif_carrier_off(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4059 | #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] | 4060 | } |
| 4061 | #endif |
| 4062 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4063 | #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] | 4064 | //We should clear all sta register with TL, for now, only one. |
| 4065 | status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] ); |
| 4066 | if ( !VOS_IS_STATUS_SUCCESS(status ) ) |
| 4067 | { |
| 4068 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4069 | FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"), |
| 4070 | pHddStaCtx->conn_info.staId[0], status, status ); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4071 | halStatus = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4072 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 4073 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4074 | } |
| 4075 | break; |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 4076 | case eCSR_ROAM_LOSTLINK_DETECTED: |
| 4077 | { |
| 4078 | if (wlan_hdd_check_and_stop_mon(pAdapter, false)) |
| 4079 | halStatus = eHAL_STATUS_FAILURE; |
| 4080 | } |
| 4081 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4082 | case eCSR_ROAM_LOSTLINK: |
| 4083 | case eCSR_ROAM_DISASSOCIATED: |
| 4084 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4085 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4086 | "****eCSR_ROAM_DISASSOCIATED****"); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 4087 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4088 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4089 | /* 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] | 4090 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4091 | if (pHddCtx->hdd_mcastbcast_filter_set == TRUE) |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4092 | { |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 4093 | hdd_conf_mcastbcast_filter(pHddCtx, FALSE); |
Amar Singhal | f8ba2b8 | 2013-12-02 12:54:38 -0800 | [diff] [blame] | 4094 | |
| 4095 | if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) { |
| 4096 | pHddCtx->configuredMcastBcastFilter = |
| 4097 | pHddCtx->sus_res_mcastbcast_filter; |
| 4098 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_FALSE; |
| 4099 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4100 | |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 4101 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4102 | "offload: disassociation happening, restoring configuredMcastBcastFilter"); |
| 4103 | hddLog(VOS_TRACE_LEVEL_INFO,"McastBcastFilter = %d", |
| 4104 | pHddCtx->configuredMcastBcastFilter); |
| 4105 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4106 | "offload: already called mcastbcast filter"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4107 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 4108 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4109 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 4110 | /* Call to clear any MC Addr List filter applied after |
| 4111 | * successful connection. |
| 4112 | */ |
| 4113 | wlan_hdd_set_mc_addr_list(pAdapter, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4114 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4115 | } |
| 4116 | break; |
| 4117 | case eCSR_ROAM_IBSS_LEAVE: |
| 4118 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4119 | "****eCSR_ROAM_IBSS_LEAVE****"); |
| 4120 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4121 | break; |
| 4122 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
| 4123 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4124 | "****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4125 | // To Do - address probable memory leak with WEP encryption upon successful association |
| 4126 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4127 | { |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4128 | //Clear saved connection information in HDD |
| 4129 | hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4130 | } |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 4131 | halStatus = hdd_AssociationCompletionHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4132 | |
| 4133 | break; |
| 4134 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4135 | halStatus = hdd_AssociationCompletionHandler( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4136 | pRoamInfo, roamId, roamStatus, roamResult ); |
| 4137 | break; |
| 4138 | case eCSR_ROAM_IBSS_IND: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 4139 | hdd_RoamIbssIndicationHandler( pAdapter, pRoamInfo, roamId, |
| 4140 | roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4141 | break; |
| 4142 | |
| 4143 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
| 4144 | halStatus = roamRoamConnectStatusUpdateHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4145 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4146 | |
| 4147 | case eCSR_ROAM_MIC_ERROR_IND: |
| 4148 | halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 4149 | break; |
Sachin Ahuja | 3d47fcd | 2015-08-28 16:02:06 +0530 | [diff] [blame] | 4150 | case eCSR_ROAM_LOST_LINK_PARAMS_IND: |
| 4151 | { |
| 4152 | /* |
| 4153 | * The RSSI will be subtracted from 100 as FW is sending the RSSI by |
| 4154 | * adding the 100 value. |
| 4155 | */ |
| 4156 | pAdapter->rssi_on_disconnect = pRoamInfo->u.pLostLinkParams->rssi - 100; |
| 4157 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4158 | "%s : Rssi on Disconnect : %d", |
| 4159 | __func__, pAdapter->rssi_on_disconnect); |
| 4160 | break; |
| 4161 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4162 | case eCSR_ROAM_SET_KEY_COMPLETE: |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4163 | { |
| 4164 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 4165 | |
| 4166 | if((pHddCtx) && |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4167 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4168 | ((eCSR_ROAM_RESULT_NONE == roamResult)|| |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4169 | (pRoamInfo && pRoamInfo->is11rAssoc))) |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4170 | { |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 4171 | /* Send DTIM period to the FW; only if the wlan is already |
| 4172 | in suspend. This is the case with roaming (reassoc), |
| 4173 | DELETE_BSS_REQ zeroes out Modulated/Dynamic DTIM sent in |
| 4174 | previous suspend_wlan. Sending SET_POWER_PARAMS_REQ |
| 4175 | before the ENTER_BMPS_REQ ensures Listen Interval is |
| 4176 | regained back to LI * Modulated DTIM */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4177 | hdd_set_pwrparams(pHddCtx); |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4178 | |
| 4179 | /* At this point, device should not be in BMPS; |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 4180 | if due to unexpected scenario, if we are in BMPS, |
| 4181 | then trigger Exit and Enter BMPS to take DTIM period |
| 4182 | effective */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4183 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) |
| 4184 | { |
| 4185 | hddLog( LOGE, FL("Not expected: device is already in BMPS mode, Exit & Enter BMPS again!")); |
| 4186 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 4187 | sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4188 | iw_full_power_cbfn, pAdapter, |
| 4189 | eSME_FULL_PWR_NEEDED_BY_HDD); |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4190 | } |
| 4191 | } |
Padma, Santhosh Kumar | a4c3457 | 2015-07-09 20:00:41 +0530 | [diff] [blame] | 4192 | |
| 4193 | if ((pHddCtx) && |
Padma, Santhosh Kumar | 0a623eb | 2015-07-27 11:55:29 +0530 | [diff] [blame] | 4194 | (FULL_POWER == pmcGetPmcState(pHddCtx->hHal)) && |
| 4195 | (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) && |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4196 | ((eCSR_ROAM_RESULT_NONE == roamResult) || |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4197 | (pRoamInfo && pRoamInfo->is11rAssoc))) |
Padma, Santhosh Kumar | a4c3457 | 2015-07-09 20:00:41 +0530 | [diff] [blame] | 4198 | { |
| 4199 | hddLog( LOG1, FL("Device in full power." |
| 4200 | "Stop and start traffic timer for roaming")); |
| 4201 | pmcStopTrafficTimer(pHddCtx->hHal); |
| 4202 | if (pmcStartTrafficTimer(pHddCtx->hHal, |
| 4203 | TRAFFIC_TIMER_ROAMING) != eHAL_STATUS_SUCCESS) |
| 4204 | { |
| 4205 | hddLog(LOGP, FL("Cannot start traffic timer")); |
| 4206 | } |
| 4207 | } |
| 4208 | |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4209 | halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Padma, Santhosh Kumar | c3eca80 | 2016-02-17 19:58:28 +0530 | [diff] [blame] | 4210 | if ((eCSR_ROAM_RESULT_NONE == roamResult) || |
Padma, Santhosh Kumar | bb75a14 | 2016-02-25 18:36:46 +0530 | [diff] [blame] | 4211 | (pRoamInfo && pRoamInfo->is11rAssoc)) |
Padma, Santhosh Kumar | 0a623eb | 2015-07-27 11:55:29 +0530 | [diff] [blame] | 4212 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 4213 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4214 | break; |
| 4215 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4216 | case eCSR_ROAM_FT_RESPONSE: |
| 4217 | hdd_SendFTEvent(pAdapter); |
| 4218 | break; |
| 4219 | #endif |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 4220 | #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] | 4221 | case eCSR_ROAM_PMK_NOTIFY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4222 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4223 | { |
| 4224 | /* Notify the supplicant of a new candidate */ |
| 4225 | halStatus = wlan_hdd_cfg80211_pmksa_candidate_notify(pAdapter, pRoamInfo, 1, false); |
| 4226 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4227 | break; |
| 4228 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4229 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 4230 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4231 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 4232 | /* This event is to notify pre-auth initiation */ |
| 4233 | if (VOS_STATUS_SUCCESS != |
| 4234 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, pRoamInfo)) |
| 4235 | { |
| 4236 | halStatus = eHAL_STATUS_FAILURE; |
| 4237 | } |
| 4238 | break; |
| 4239 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 4240 | /* This event will notify pre-auth completion in case of success */ |
| 4241 | if (VOS_STATUS_SUCCESS != |
| 4242 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4243 | pRoamInfo, 1)) |
| 4244 | { |
| 4245 | halStatus = eHAL_STATUS_FAILURE; |
| 4246 | } |
| 4247 | break; |
| 4248 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 4249 | /* This event will notify pre-auth completion in case of failure. */ |
| 4250 | if (VOS_STATUS_SUCCESS != |
| 4251 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4252 | pRoamInfo, 0)) |
| 4253 | { |
| 4254 | halStatus = eHAL_STATUS_FAILURE; |
| 4255 | } |
| 4256 | break; |
| 4257 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 4258 | /* This event is to notify handover success. |
| 4259 | It will be only invoked on success */ |
| 4260 | if (VOS_STATUS_SUCCESS != |
| 4261 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, pRoamInfo)) |
| 4262 | { |
| 4263 | halStatus = eHAL_STATUS_FAILURE; |
| 4264 | } |
| 4265 | break; |
| 4266 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4267 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 4268 | hdd_remainChanReadyHandler( pAdapter ); |
| 4269 | break; |
| 4270 | case eCSR_ROAM_SEND_ACTION_CNF: |
| 4271 | hdd_sendActionCnf( pAdapter, |
| 4272 | (roamResult == eCSR_ROAM_RESULT_NONE) ? TRUE : FALSE ); |
| 4273 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4274 | #ifdef FEATURE_WLAN_TDLS |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 4275 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 4276 | halStatus = hdd_RoamTdlsStatusUpdateHandler( pAdapter, pRoamInfo, |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 4277 | roamId, roamStatus, roamResult ); |
| 4278 | break ; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 4279 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 4280 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, pRoamInfo->reasonCode); |
| 4281 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 4282 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4283 | #ifdef WLAN_FEATURE_11W |
| 4284 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 4285 | hdd_indicateUnprotMgmtFrame(pAdapter, pRoamInfo->nFrameLength, |
| 4286 | pRoamInfo->pbFrames, |
| 4287 | pRoamInfo->frameType); |
| 4288 | break; |
| 4289 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4290 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4291 | case eCSR_ROAM_TSM_IE_IND: |
| 4292 | hdd_indicateTsmIe(pAdapter, pRoamInfo->tsmIe.tsid, |
| 4293 | pRoamInfo->tsmIe.state, pRoamInfo->tsmIe.msmt_interval); |
| 4294 | break; |
| 4295 | |
| 4296 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 4297 | { |
| 4298 | if (eCSR_AUTH_TYPE_CCKM_WPA == pHddStaCtx->conn_info.authType || |
| 4299 | eCSR_AUTH_TYPE_CCKM_RSN == pHddStaCtx->conn_info.authType) |
| 4300 | { |
| 4301 | hdd_indicateCckmPreAuth(pAdapter, pRoamInfo); |
| 4302 | } |
| 4303 | break; |
| 4304 | } |
| 4305 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4306 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4307 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4308 | hdd_indicateEseAdjApRepInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4309 | break; |
| 4310 | } |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4311 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4312 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4313 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4314 | hdd_indicateEseBcnReportInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4315 | break; |
| 4316 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4317 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Girish Gowli | a95daca | 2015-02-04 20:31:31 +0530 | [diff] [blame] | 4318 | case eCSR_ROAM_UPDATE_MAX_RATE_IND: |
| 4319 | { |
| 4320 | pAdapter->maxRateFlags = roamResult; |
| 4321 | break; |
| 4322 | } |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4323 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 4324 | if (pRoamInfo && pRoamInfo->pBssDesc) { |
| 4325 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 4326 | pRoamInfo->pBssDesc); |
| 4327 | if (bss_status) |
| 4328 | cfg80211_put_bss( |
| 4329 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 4330 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 4331 | #endif |
| 4332 | bss_status); |
| 4333 | else |
| 4334 | hddLog(LOG1, FL("UPDATE_SCAN_RESULT returned NULL")); |
| 4335 | } |
Ganesh Kondabattini | 529397f | 2017-12-27 19:13:52 +0530 | [diff] [blame] | 4336 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
| 4337 | { |
| 4338 | hdd_adapter_t *pHostapdAdapter = NULL; |
| 4339 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4340 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4341 | |
| 4342 | if (!pHddCtx || !pHddStaCtx) { |
| 4343 | hddLog(LOG1, FL("Invalid pHddCtx or pHddStaCtx")); |
| 4344 | break; |
| 4345 | } |
| 4346 | |
| 4347 | hddLog(LOG1, FL("eCSR_ROAM_STA_CHANNEL_SWITCH: new channel %hu"), |
| 4348 | pRoamInfo->chan_info.chan_id); |
| 4349 | |
| 4350 | pHddStaCtx->conn_info.operationChannel = |
| 4351 | pRoamInfo->chan_info.chan_id; |
| 4352 | |
| 4353 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 4354 | if (pHostapdAdapter && |
| 4355 | (test_bit(SOFTAP_BSS_STARTED, |
| 4356 | &pHostapdAdapter->event_flags))) |
| 4357 | { |
| 4358 | /* Restart SAP if its operating channel is different |
| 4359 | * from AP channel. |
| 4360 | */ |
| 4361 | hddLog(VOS_TRACE_LEVEL_INFO,"SAP chan %d, STA chan %d, force_scc_with_ecsa %d", |
| 4362 | pHostapdAdapter->sessionCtx.ap.operatingChannel, |
| 4363 | pRoamInfo->chan_info.chan_id, |
| 4364 | pHddCtx->cfg_ini->force_scc_with_ecsa); |
| 4365 | if ((pHddCtx->cfg_ini->force_scc_with_ecsa ) && |
| 4366 | (pHostapdAdapter->sessionCtx.ap.operatingChannel != |
| 4367 | pRoamInfo->chan_info.chan_id)) |
| 4368 | { |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 4369 | schedule_delayed_work(&pHddCtx->ecsa_chan_change_work, 0); |
Ganesh Kondabattini | 529397f | 2017-12-27 19:13:52 +0530 | [diff] [blame] | 4370 | } |
| 4371 | else |
| 4372 | hddLog(LOG1, FL("SAP restart not required")); |
| 4373 | } else |
| 4374 | hddLog(LOG1, FL("SAP not active, nothing to do")); |
| 4375 | } |
Selvaraj, Sridhar | 59c5039 | 2016-06-09 17:08:05 +0530 | [diff] [blame] | 4376 | break; |
Girish Gowli | a95daca | 2015-02-04 20:31:31 +0530 | [diff] [blame] | 4377 | default: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4378 | break; |
| 4379 | } |
| 4380 | return( halStatus ); |
| 4381 | } |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame^] | 4382 | |
| 4383 | #ifdef WLAN_FEATURE_SAE |
| 4384 | /** |
| 4385 | * hdd_translate_sae_rsn_to_csr_auth() - Translate SAE RSN to CSR auth type |
| 4386 | * @auth_suite: auth suite |
| 4387 | * @auth_type: pointer to eCsrAuthType |
| 4388 | * |
| 4389 | * Return: None |
| 4390 | */ |
| 4391 | static void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4392 | eCsrAuthType *auth_type) |
| 4393 | { |
| 4394 | if (!memcmp(auth_suite, ccp_rsn_oui_80, 4)) |
| 4395 | *auth_type = eCSR_AUTH_TYPE_SAE; |
| 4396 | } |
| 4397 | #else |
| 4398 | static inline |
| 4399 | void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4400 | eCsrAuthType *auth_type) |
| 4401 | { |
| 4402 | } |
| 4403 | #endif |
| 4404 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4405 | eCsrAuthType hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4406 | { |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame^] | 4407 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4408 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4409 | if ( memcmp(auth_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4410 | { |
| 4411 | auth_type = eCSR_AUTH_TYPE_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4412 | } else |
| 4413 | if (memcmp(auth_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4414 | { |
| 4415 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4416 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4417 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4418 | if (memcmp(auth_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4419 | { |
| 4420 | // Check for 11r FT Authentication with PSK |
| 4421 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4422 | } else |
| 4423 | if (memcmp(auth_suite , ccpRSNOui03, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4424 | { |
| 4425 | // Check for 11R FT Authentication with 802.1X |
| 4426 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4427 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4428 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4429 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4430 | if (memcmp(auth_suite , ccpRSNOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4431 | { |
| 4432 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 4433 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4434 | #endif /* FEATURE_WLAN_ESE */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4435 | #ifdef WLAN_FEATURE_11W |
| 4436 | if (memcmp(auth_suite , ccpRSNOui07, 4) == 0) |
| 4437 | { |
| 4438 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 4439 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 4440 | if (memcmp(auth_suite , ccpRSNOui08, 4) == 0) |
| 4441 | { |
| 4442 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 4443 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4444 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4445 | { |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame^] | 4446 | /* If auth suite is of SAE, auth_type will be |
| 4447 | * overwritten in hdd_translate_sae_rsn_to_csr_auth |
| 4448 | */ |
| 4449 | hdd_translate_sae_rsn_to_csr_auth(auth_suite, &auth_type); |
| 4450 | } |
| 4451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4452 | return auth_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4453 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4454 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4455 | eCsrAuthType |
| 4456 | hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4457 | { |
| 4458 | eCsrAuthType auth_type; |
| 4459 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4460 | if ( memcmp(auth_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4461 | { |
| 4462 | auth_type = eCSR_AUTH_TYPE_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4463 | } else |
| 4464 | if (memcmp(auth_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4465 | { |
| 4466 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4467 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4468 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4469 | if (memcmp(auth_suite , ccpWpaOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4470 | { |
| 4471 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4472 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4473 | #endif /* FEATURE_WLAN_ESE */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4474 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4475 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 4476 | } |
| 4477 | hddLog(LOG1, FL("auth_type: %d"), auth_type); |
| 4478 | return auth_type; |
| 4479 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4480 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4481 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4482 | hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4483 | { |
| 4484 | eCsrEncryptionType cipher_type; |
| 4485 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4486 | if ( memcmp(cipher_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4487 | { |
| 4488 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4489 | } |
| 4490 | else if (memcmp(cipher_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4491 | { |
| 4492 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4493 | } |
| 4494 | else if (memcmp(cipher_suite , ccpRSNOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4495 | { |
| 4496 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4497 | } |
| 4498 | else if (memcmp(cipher_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4499 | { |
| 4500 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4501 | } |
| 4502 | else if (memcmp(cipher_suite , ccpRSNOui05, 4) == 0) |
| 4503 | { |
| 4504 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4505 | } |
| 4506 | else |
| 4507 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4508 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4509 | } |
| 4510 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 4511 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4512 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4513 | /* To find if the MAC address is NULL */ |
| 4514 | static tANI_U8 hdd_IsMACAddrNULL (tANI_U8 *macAddr, tANI_U8 length) |
| 4515 | { |
| 4516 | int i; |
| 4517 | for (i = 0; i < length; i++) |
| 4518 | { |
| 4519 | if (0x00 != (macAddr[i])) |
| 4520 | { |
| 4521 | return FALSE; |
| 4522 | } |
| 4523 | } |
| 4524 | return TRUE; |
| 4525 | } /****** end hdd_IsMACAddrNULL() ******/ |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 4526 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4527 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4528 | hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4529 | { |
| 4530 | eCsrEncryptionType cipher_type; |
| 4531 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4532 | if ( memcmp(cipher_suite , ccpWpaOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4533 | { |
| 4534 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4535 | } else |
| 4536 | if (memcmp(cipher_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4537 | { |
| 4538 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4539 | } else |
| 4540 | if (memcmp(cipher_suite , ccpWpaOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4541 | { |
| 4542 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4543 | } else |
| 4544 | if (memcmp(cipher_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4545 | { |
| 4546 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4547 | } else |
| 4548 | if (memcmp(cipher_suite , ccpWpaOui05, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4549 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4550 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4551 | } else |
| 4552 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4553 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4554 | } |
| 4555 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 4556 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4557 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4558 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4559 | static tANI_S32 hdd_ProcessGENIE(hdd_adapter_t *pAdapter, |
| 4560 | struct ether_addr *pBssid, |
| 4561 | eCsrEncryptionType *pEncryptType, |
| 4562 | eCsrEncryptionType *mcEncryptType, |
| 4563 | eCsrAuthType *pAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4564 | #ifdef WLAN_FEATURE_11W |
| 4565 | u_int8_t *pMfpRequired, |
| 4566 | u_int8_t *pMfpCapable, |
| 4567 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4568 | u_int16_t gen_ie_len, |
| 4569 | u_int8_t *gen_ie) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4570 | { |
| 4571 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4572 | eHalStatus result; |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4573 | tDot11fIERSN dot11RSNIE = {0}; |
| 4574 | tDot11fIEWPA dot11WPAIE = {0}; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4575 | tANI_U32 i; |
Ashish Kumar Dhanotiya | ffbfd8c | 2017-11-29 14:04:38 +0530 | [diff] [blame] | 4576 | tANI_U32 status; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4577 | tANI_U8 *pRsnIe; |
| 4578 | tANI_U16 RSNIeLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4579 | tPmkidCacheInfo PMKIDCache[4]; // Local transfer memory |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4580 | v_BOOL_t updatePMKCache = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4581 | |
| 4582 | /* Clear struct of tDot11fIERSN and tDot11fIEWPA specifically setting present |
| 4583 | flag to 0 */ |
| 4584 | memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) ); |
| 4585 | memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) ); |
| 4586 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4587 | // Type check |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4588 | if ( gen_ie[0] == DOT11F_EID_RSN) |
| 4589 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4590 | // Validity checks |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4591 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4592 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) ) |
| 4593 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4594 | hddLog(LOGE, "%s: Invalid DOT11F RSN IE length :%d\n", |
| 4595 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4596 | return -EINVAL; |
| 4597 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4598 | // Skip past the EID byte and length byte |
| 4599 | pRsnIe = gen_ie + 2; |
| 4600 | RSNIeLen = gen_ie_len - 2; |
| 4601 | // Unpack the RSN IE |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4602 | status = sme_unpack_rsn_ie(halHandle, |
| 4603 | pRsnIe, |
| 4604 | RSNIeLen, |
| 4605 | &dot11RSNIE); |
Ashish Kumar Dhanotiya | ffbfd8c | 2017-11-29 14:04:38 +0530 | [diff] [blame] | 4606 | if (DOT11F_FAILED(status)) |
| 4607 | { |
| 4608 | hddLog(LOGE, |
| 4609 | FL("Parse failure in hdd_ProcessGENIE (0x%08x)"), |
| 4610 | status); |
| 4611 | return -EINVAL; |
| 4612 | } |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4613 | hddLog(LOG1, FL("%s: gp_cipher_suite_present: %d"), |
| 4614 | __func__, dot11RSNIE.gp_cipher_suite_present); |
| 4615 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4616 | // Copy out the encryption and authentication types |
| 4617 | hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4618 | __func__, dot11RSNIE.pwise_cipher_suite_count ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4619 | hddLog(LOG1, FL("%s: authentication suite count: %d"), |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4620 | __func__, dot11RSNIE.akm_suite_cnt); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4621 | /*Here we have followed the apple base code, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4622 | but probably I suspect we can do something different*/ |
| 4623 | //dot11RSNIE.akm_suite_count |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4624 | // Just translate the FIRST one |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4625 | *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suite[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4626 | //dot11RSNIE.pwise_cipher_suite_count |
| 4627 | *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]); |
| 4628 | //dot11RSNIE.gp_cipher_suite_count |
| 4629 | *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4630 | #ifdef WLAN_FEATURE_11W |
| 4631 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1 ; |
| 4632 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1 ; |
| 4633 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4634 | // Set the PMKSA ID Cache for this interface |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4635 | for (i=0; i<dot11RSNIE.pmkid_count; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4636 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4637 | if ( pBssid == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4638 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4639 | hddLog(LOGE, "%s: pBssid passed is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4640 | break; |
| 4641 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4642 | if ( hdd_IsMACAddrNULL( (u_char *) pBssid->ether_addr_octet , 6)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4643 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4644 | hddLog(LOGE, "%s: Invalid MAC adrr", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4645 | break; |
| 4646 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4647 | updatePMKCache = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4648 | // For right now, I assume setASSOCIATE() has passed in the bssid. |
| 4649 | vos_mem_copy(PMKIDCache[i].BSSID, |
| 4650 | pBssid, ETHER_ADDR_LEN); |
| 4651 | vos_mem_copy(PMKIDCache[i].PMKID, |
| 4652 | dot11RSNIE.pmkid[i], |
| 4653 | CSR_RSN_PMKID_SIZE); |
| 4654 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4655 | |
| 4656 | if (updatePMKCache) |
| 4657 | { |
| 4658 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 4659 | hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with cache entry %d."), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4660 | __func__, i ); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4661 | // Finally set the PMKSA ID Cache in CSR |
| 4662 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
| 4663 | PMKIDCache, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 4664 | dot11RSNIE.pmkid_count, |
| 4665 | FALSE); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 4666 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4667 | } |
| 4668 | else if (gen_ie[0] == DOT11F_EID_WPA) |
| 4669 | { |
| 4670 | // Validity checks |
| 4671 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) || |
| 4672 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) |
| 4673 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 4674 | hddLog(LOGE, "%s: Invalid DOT11F WPA IE length :%d\n", |
| 4675 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4676 | return -EINVAL; |
| 4677 | } |
| 4678 | // 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] | 4679 | pRsnIe = gen_ie + 2 + 4; |
| 4680 | RSNIeLen = gen_ie_len - (2 + 4); |
| 4681 | // Unpack the WPA IE |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4682 | status = dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4683 | pRsnIe, RSNIeLen, &dot11WPAIE); |
| 4684 | if (!DOT11F_SUCCEEDED(status)) |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4685 | { |
| 4686 | hddLog(LOGE, |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4687 | FL("Invalid RSN IE: parse status %d"), status); |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 4688 | return -EINVAL; |
| 4689 | } |
| 4690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4691 | // Copy out the encryption and authentication types |
| 4692 | hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4693 | __func__, dot11WPAIE.unicast_cipher_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4694 | hddLog(LOG1, FL("%s: WPA authentication suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4695 | __func__, dot11WPAIE.auth_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4696 | //dot11WPAIE.auth_suite_count |
| 4697 | // Just translate the FIRST one |
| 4698 | *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]); |
| 4699 | //dot11WPAIE.unicast_cipher_count |
| 4700 | *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]); |
| 4701 | //dot11WPAIE.unicast_cipher_count |
| 4702 | *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 4703 | } |
| 4704 | else |
| 4705 | { |
| 4706 | hddLog(LOGW, FL("gen_ie[0]: %d"), gen_ie[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4707 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4708 | } |
| 4709 | return 0; |
| 4710 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4711 | |
| 4712 | /** |
| 4713 | * hdd_set_def_rsne_override() - set default encryption type and auth type |
| 4714 | * in profile. |
| 4715 | * @roam_profile: pointer to adapter |
| 4716 | * @auth_type: pointer to auth type |
| 4717 | * |
| 4718 | * Set default value of encryption type and auth type in profile to |
| 4719 | * search the AP using filter, as in force_rsne_override the RSNIE can be |
| 4720 | * currupt and we might not get the proper encryption type and auth type |
| 4721 | * while parsing the RSNIE. |
| 4722 | * |
| 4723 | * Return: void |
| 4724 | */ |
| 4725 | static void hdd_set_def_rsne_override( |
| 4726 | tCsrRoamProfile *roam_profile, eCsrAuthType *auth_type) |
| 4727 | { |
| 4728 | hddLog( LOG1, FL("Set def values in roam profile")); |
| 4729 | roam_profile->MFPCapable = roam_profile->MFPEnabled; |
| 4730 | roam_profile->EncryptionType.numEntries = 2; |
| 4731 | roam_profile->mcEncryptionType.numEntries = 2; |
| 4732 | /* Use the cipher type in the RSN IE */ |
| 4733 | roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; |
| 4734 | roam_profile->EncryptionType.encryptionType[1] = eCSR_ENCRYPT_TYPE_TKIP; |
| 4735 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 4736 | eCSR_ENCRYPT_TYPE_AES; |
| 4737 | roam_profile->mcEncryptionType.encryptionType[1] = |
| 4738 | eCSR_ENCRYPT_TYPE_TKIP; |
| 4739 | *auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
| 4740 | } |
| 4741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4742 | int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 4743 | { |
| 4744 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4745 | v_U32_t status = 0; |
| 4746 | eCsrEncryptionType RSNEncryptType; |
| 4747 | eCsrEncryptionType mcRSNEncryptType; |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4748 | hdd_context_t *hdd_ctx; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4749 | #ifdef WLAN_FEATURE_11W |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4750 | u_int8_t RSNMfpRequired = 0; |
| 4751 | u_int8_t RSNMfpCapable = 0; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4752 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4753 | struct ether_addr bSsid; // MAC address of assoc peer |
| 4754 | // MAC address of assoc peer |
| 4755 | // But, this routine is only called when we are NOT associated. |
| 4756 | vos_mem_copy(bSsid.ether_addr_octet, |
| 4757 | pWextState->roamProfile.BSSIDs.bssid, |
| 4758 | sizeof(bSsid.ether_addr_octet)); |
| 4759 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) |
| 4760 | { |
| 4761 | //continue |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4762 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4763 | else |
| 4764 | { |
| 4765 | return 0; |
| 4766 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4767 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4768 | // The actual processing may eventually be more extensive than this. |
| 4769 | // Right now, just consume any PMKIDs that are sent in by the app. |
| 4770 | status = hdd_ProcessGENIE(pAdapter, |
| 4771 | &bSsid, // MAC address of assoc peer |
| 4772 | &RSNEncryptType, |
| 4773 | &mcRSNEncryptType, |
| 4774 | RSNAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4775 | #ifdef WLAN_FEATURE_11W |
| 4776 | &RSNMfpRequired, |
| 4777 | &RSNMfpCapable, |
| 4778 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4779 | pWextState->WPARSNIE[1]+2, |
| 4780 | pWextState->WPARSNIE); |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4781 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4782 | if (status == 0) |
| 4783 | { |
| 4784 | // Now copy over all the security attributes you have parsed out |
| 4785 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 4786 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4788 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; // Use the cipher type in the RSN IE |
| 4789 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = mcRSNEncryptType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4790 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 4791 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && |
| 4792 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
| 4793 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) |
| 4794 | { |
| 4795 | /*For wpa none supplicant sends the WPA IE with unicast cipher as |
| 4796 | eCSR_ENCRYPT_TYPE_NONE ,where as the multicast cipher as |
| 4797 | either AES/TKIP based on group cipher configuration |
| 4798 | mentioned in the wpa_supplicant.conf.*/ |
| 4799 | |
| 4800 | /*Set the unicast cipher same as multicast cipher*/ |
| 4801 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 4802 | = mcRSNEncryptType; |
| 4803 | } |
| 4804 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4805 | #ifdef WLAN_FEATURE_11W |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4806 | hddLog( LOG1, FL("RSNMfpRequired = %d, RSNMfpCapable = %d"), |
| 4807 | RSNMfpRequired, RSNMfpCapable); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4808 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 4809 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 4810 | #endif |
Abhishek Singh | 4f6406d | 2015-10-07 13:43:52 +0530 | [diff] [blame] | 4811 | hddLog( LOG1, |
| 4812 | FL("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d"), |
| 4813 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4814 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4815 | } |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 4816 | |
| 4817 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 4818 | if (hdd_ctx->force_rsne_override && |
| 4819 | (pWextState->WPARSNIE[0] == DOT11F_EID_RSN)) { |
| 4820 | hddLog(LOG1, |
| 4821 | FL("Test mode enabled set def Auth and enc type. RSN IE passed in connect req:")); |
| 4822 | vos_trace_hex_dump(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4823 | pWextState->roamProfile.pRSNReqIE, |
| 4824 | pWextState->roamProfile.nRSNReqIELength); |
| 4825 | |
| 4826 | pWextState->roamProfile.force_rsne_override = true; |
| 4827 | hddLog(LOG1, |
| 4828 | FL("MFPEnabled %d"), pWextState->roamProfile.MFPEnabled); |
| 4829 | /* |
| 4830 | * Reset MFPEnabled if testmode RSNE passed doesnt have MFPR |
| 4831 | * or MFPC bit set |
| 4832 | */ |
| 4833 | if (pWextState->roamProfile.MFPEnabled && |
| 4834 | !(pWextState->roamProfile.MFPRequired || |
| 4835 | pWextState->roamProfile.MFPCapable)) { |
| 4836 | hddLog( LOG1,FL("Reset MFPEnabled")); |
| 4837 | pWextState->roamProfile.MFPEnabled = 0; |
| 4838 | } |
| 4839 | |
| 4840 | /* If parsing failed set the def value for the roam profile */ |
| 4841 | if (status) |
| 4842 | hdd_set_def_rsne_override(&pWextState->roamProfile, |
| 4843 | RSNAuthType); |
| 4844 | } |
Pragaspathi Thilagaraj | d1b02df | 2018-06-26 17:08:05 +0530 | [diff] [blame] | 4845 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4846 | } |
| 4847 | int hdd_set_csr_auth_type ( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 4848 | { |
| 4849 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4850 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 4851 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4852 | ENTER(); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4853 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4854 | pRoamProfile->AuthType.numEntries = 1; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4855 | 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] | 4856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4857 | switch( pHddStaCtx->conn_info.authType) |
| 4858 | { |
| 4859 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
Abhinav Kumar | 62801ba | 2018-09-19 12:14:14 +0530 | [diff] [blame] | 4860 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4861 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4862 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 4863 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 4864 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4865 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 4866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4867 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4868 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4869 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4870 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4871 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4872 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 4873 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4874 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4875 | 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] | 4876 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
| 4877 | } else |
| 4878 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4879 | hddLog( LOG1, "%s: Last chance to set authType to CCKM WPA.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4880 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4881 | } else |
| 4882 | #endif |
| 4883 | if((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4884 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4885 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA; |
| 4886 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4887 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 4888 | == IW_AUTH_KEY_MGMT_PSK) { |
| 4889 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4890 | } else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4891 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4892 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4893 | } |
| 4894 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4895 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4896 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 4897 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 4898 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4899 | 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] | 4900 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4901 | } else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4902 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4903 | hddLog( LOG1, "%s: Last chance to set authType to CCKM RSN.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4904 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4905 | } else |
| 4906 | #endif |
| 4907 | |
| 4908 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4909 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 4910 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4911 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4912 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4913 | }else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4914 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4915 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 4916 | == IW_AUTH_KEY_MGMT_PSK)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4917 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4918 | } else |
| 4919 | #endif |
| 4920 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4921 | #ifdef WLAN_FEATURE_11W |
| 4922 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 4923 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 4924 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 4925 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 4926 | pRoamProfile->AuthType.authType[0] = |
| 4927 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 4928 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4929 | #endif |
| 4930 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4931 | if( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4932 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4933 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN; |
| 4934 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4935 | if ( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 4936 | == IW_AUTH_KEY_MGMT_PSK) { |
| 4937 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4938 | } else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4939 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4940 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4941 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4942 | break; |
| 4943 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4944 | case eCSR_AUTH_TYPE_SHARED_KEY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4945 | |
| 4946 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4947 | break; |
Abhinav Kumar | 4d44f63 | 2019-08-02 13:55:54 +0530 | [diff] [blame^] | 4948 | case eCSR_AUTH_TYPE_SAE: |
| 4949 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 4950 | break; |
| 4951 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4952 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4953 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4954 | #ifdef FEATURE_WLAN_ESE |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4955 | hddLog( LOG1, "%s: In default, unknown auth type.", __func__); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4956 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4957 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 4958 | break; |
| 4959 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4960 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4961 | hddLog( LOG1, "%s Set roam Authtype to %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4962 | __func__, pWextState->roamProfile.AuthType.authType[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4963 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4964 | EXIT(); |
| 4965 | return 0; |
| 4966 | } |
| 4967 | |
Sravan Kumar Kairam | 091e5b6 | 2017-01-23 14:14:20 +0530 | [diff] [blame] | 4968 | /** |
| 4969 | * hdd_rx_fwd_eapol() - forward cached eapol frames |
| 4970 | * @vosContext : pointer to vos global context |
| 4971 | * @pVosPacket: pointer to vos packet |
| 4972 | * |
| 4973 | * Return: None |
| 4974 | * |
| 4975 | */ |
| 4976 | void hdd_assoc_registerFwdEapolCB(void *pContext) |
| 4977 | { |
| 4978 | WLANTL_RegisterFwdEapol(pContext, hdd_rx_fwd_eapol); |
| 4979 | } |
| 4980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4981 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4982 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4983 | \brief __iw_set_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4984 | This function sets the ssid received from wpa_supplicant |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4985 | to the CSR roam profile. |
| 4986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4987 | \param - dev - Pointer to the net device. |
| 4988 | - info - Pointer to the iw_request_info. |
| 4989 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4990 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4991 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4992 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4993 | --------------------------------------------------------------------------*/ |
| 4994 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4995 | int __iw_set_essid(struct net_device *dev, |
| 4996 | struct iw_request_info *info, |
| 4997 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4998 | { |
| 4999 | v_U32_t status = 0; |
| 5000 | hdd_wext_state_t *pWextState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5001 | hdd_adapter_t *pAdapter; |
| 5002 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5003 | v_U32_t roamId; |
| 5004 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5005 | eCsrAuthType RSNAuthType; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5006 | tHalHandle hHal; |
| 5007 | hdd_station_ctx_t *pHddStaCtx; |
| 5008 | int ret = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5009 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5010 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5011 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5012 | if (NULL == pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5013 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5014 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5015 | "%s: Adapter is NULL",__func__); |
| 5016 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5017 | } |
| 5018 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5019 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5020 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5021 | if (0 != ret) |
| 5022 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5023 | return ret; |
| 5024 | } |
| 5025 | |
| 5026 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5027 | if (NULL == hHal) |
| 5028 | { |
| 5029 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5030 | "%s: Hal Context is NULL",__func__); |
| 5031 | return -EINVAL; |
| 5032 | } |
| 5033 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5034 | if (NULL == pHddStaCtx) |
| 5035 | { |
| 5036 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5037 | "%s: STA Context is NULL",__func__); |
| 5038 | return -EINVAL; |
| 5039 | } |
| 5040 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5041 | if (NULL == pWextState) |
| 5042 | { |
| 5043 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5044 | "%s: pWextState is NULL",__func__); |
| 5045 | return -EINVAL; |
| 5046 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5047 | if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
| 5048 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__); |
| 5049 | return -EBUSY; |
| 5050 | } |
| 5051 | if( SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length ) |
| 5052 | return -EINVAL; |
| 5053 | pRoamProfile = &pWextState->roamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5054 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5055 | if (wlan_hdd_check_and_stop_mon(pAdapter, true)) |
| 5056 | return -EINVAL; |
| 5057 | |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 5058 | /*Try disconnecting if already in connected state*/ |
| 5059 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5060 | if (0 > status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5061 | { |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 5062 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 5063 | " connection")); |
| 5064 | return -EALREADY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5065 | } |
| 5066 | /** wpa_supplicant 0.8.x, wext driver uses */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5067 | /** when cfg80211 defined, wpa_supplicant wext driver uses |
| 5068 | zero-length, null-string ssid for force disconnection. |
| 5069 | after disconnection (if previously connected) and cleaning ssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5070 | driver MUST return success */ |
| 5071 | if ( 0 == wrqu->essid.length ) { |
| 5072 | return 0; |
| 5073 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5074 | |
| 5075 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5076 | &pWextState->roamProfile.uapsd_mask); |
| 5077 | if (VOS_STATUS_SUCCESS != status) |
| 5078 | { |
| 5079 | pWextState->roamProfile.uapsd_mask = 0; |
| 5080 | } |
| 5081 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5083 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = wrqu->essid.length; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5084 | |
| 5085 | 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] | 5086 | vos_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId), extra, wrqu->essid.length); |
| 5087 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion || |
| 5088 | IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion ) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5089 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5090 | //set gen ie |
| 5091 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 5092 | |
| 5093 | //set auth |
| 5094 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5095 | } |
| 5096 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5097 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5098 | if (pAdapter->wapi_info.nWapiMode) |
| 5099 | { |
| 5100 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 5101 | { |
| 5102 | case WAPI_AUTH_MODE_PSK: |
| 5103 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5104 | 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] | 5105 | pRoamProfile->AuthType.numEntries = 1; |
| 5106 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5107 | break; |
| 5108 | } |
| 5109 | case WAPI_AUTH_MODE_CERT: |
| 5110 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5111 | 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] | 5112 | pRoamProfile->AuthType.numEntries = 1; |
| 5113 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5114 | break; |
| 5115 | } |
| 5116 | } // End of switch |
| 5117 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5118 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 5119 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5120 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5121 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5122 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5123 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5124 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 5125 | } |
| 5126 | } |
| 5127 | #endif /* FEATURE_WLAN_WAPI */ |
| 5128 | /* if previous genIE is not NULL, update AssocIE */ |
| 5129 | if (0 != pWextState->genIE.length) |
| 5130 | { |
| 5131 | memset( &pWextState->assocAddIE, 0, sizeof(pWextState->assocAddIE) ); |
| 5132 | memcpy( pWextState->assocAddIE.addIEdata, pWextState->genIE.addIEdata, |
| 5133 | pWextState->genIE.length); |
| 5134 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5135 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 5136 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 5137 | |
| 5138 | /* clear previous genIE after use it */ |
| 5139 | memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) ); |
| 5140 | } |
| 5141 | |
| 5142 | /* assumes it is not WPS Association by default, except when pAddIEAssoc has WPS IE */ |
| 5143 | pWextState->roamProfile.bWPSAssociation = FALSE; |
| 5144 | |
| 5145 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5146 | pWextState->roamProfile.nAddIEAssocLength)) |
| 5147 | pWextState->roamProfile.bWPSAssociation = TRUE; |
| 5148 | |
| 5149 | |
| 5150 | // Disable auto BMPS entry by PMC until DHCP is done |
| 5151 | sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), TRUE); |
| 5152 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5153 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5154 | (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5155 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5156 | if ( eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType ) |
| 5157 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5158 | hdd_select_cbmode(pAdapter, |
| 5159 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->AdHocChannel5G); |
| 5160 | } |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 5161 | /* |
| 5162 | * Change conn_state to connecting before sme_RoamConnect(), |
| 5163 | * because sme_RoamConnect() has a direct path to call |
| 5164 | * hdd_smeRoamCallback(), which will change the conn_state |
| 5165 | * If direct path, conn_state will be accordingly changed |
| 5166 | * to NotConnected or Associated by either |
| 5167 | * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() |
| 5168 | * in sme_RoamCallback() |
| 5169 | * if sme_RomConnect is to be queued, |
| 5170 | * Connecting state will remain until it is completed. |
| 5171 | * |
| 5172 | * If connection state is not changed, |
| 5173 | * connection state will remain in eConnectionState_NotConnected state. |
| 5174 | * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true |
| 5175 | * if conn state is eConnectionState_NotConnected. |
| 5176 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 5177 | * informed of connect result indication which is an issue. |
| 5178 | */ |
| 5179 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5180 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
| 5181 | { |
| 5182 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5183 | FL("Set HDD connState to eConnectionState_Connecting")); |
| 5184 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5185 | eConnectionState_Connecting); |
| 5186 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5187 | status = sme_RoamConnect( hHal,pAdapter->sessionId, |
| 5188 | &(pWextState->roamProfile), &roamId); |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 5189 | |
| 5190 | if ((eHAL_STATUS_SUCCESS != status) && |
| 5191 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 5192 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 5193 | { |
| 5194 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5195 | FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"), |
| 5196 | pAdapter->sessionId, status); |
| 5197 | /* change back to NotAssociated */ |
| 5198 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 5199 | eConnectionState_NotConnected); |
| 5200 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5201 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5202 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5203 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5204 | EXIT(); |
| 5205 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5206 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 5207 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5208 | int iw_set_essid(struct net_device *dev, |
| 5209 | struct iw_request_info *info, |
| 5210 | union iwreq_data *wrqu, char *extra) |
| 5211 | { |
| 5212 | int ret; |
| 5213 | |
| 5214 | vos_ssr_protect(__func__); |
| 5215 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 5216 | vos_ssr_unprotect(__func__); |
| 5217 | |
| 5218 | return ret; |
| 5219 | } |
| 5220 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5221 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5222 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5223 | \brief __iw_get_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5224 | This function returns the essid to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5225 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5226 | \param - dev - Pointer to the net device. |
| 5227 | - info - Pointer to the iw_request_info. |
| 5228 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5229 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5230 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5231 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5232 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5233 | int __iw_get_essid(struct net_device *dev, |
| 5234 | struct iw_request_info *info, |
| 5235 | struct iw_point *dwrq, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5236 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5237 | hdd_adapter_t *pAdapter; |
| 5238 | hdd_context_t *pHddCtx; |
| 5239 | hdd_wext_state_t *wextBuf; |
| 5240 | hdd_station_ctx_t *pHddStaCtx; |
| 5241 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5242 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5243 | ENTER(); |
| 5244 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5245 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5246 | if (NULL == pAdapter) |
| 5247 | { |
| 5248 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5249 | "%s: Adapter is NULL",__func__); |
| 5250 | return -EINVAL; |
| 5251 | } |
| 5252 | |
| 5253 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5254 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5255 | if (0 != ret) |
| 5256 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5257 | return ret; |
| 5258 | } |
| 5259 | |
| 5260 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5261 | if (NULL == pHddStaCtx) |
| 5262 | { |
| 5263 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5264 | "%s: STA Context is NULL",__func__); |
| 5265 | return -EINVAL; |
| 5266 | } |
| 5267 | |
| 5268 | wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5269 | if (NULL == wextBuf) |
| 5270 | { |
| 5271 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5272 | "%s: wextBuf is NULL",__func__); |
| 5273 | return -EINVAL; |
| 5274 | } |
| 5275 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5276 | if((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 5277 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 5278 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected || |
| 5279 | pHddStaCtx->conn_info.connState == eConnectionState_IbssDisconnected) && |
| 5280 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) |
| 5281 | { |
| 5282 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 5283 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, dwrq->length); |
| 5284 | dwrq->flags = 1; |
| 5285 | } else { |
| 5286 | memset(extra, 0, dwrq->length); |
| 5287 | dwrq->length = 0; |
| 5288 | dwrq->flags = 0; |
| 5289 | } |
| 5290 | EXIT(); |
| 5291 | return 0; |
| 5292 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5293 | |
| 5294 | int iw_get_essid(struct net_device *dev, |
| 5295 | struct iw_request_info *info, |
| 5296 | struct iw_point *dwrq, char *extra) |
| 5297 | { |
| 5298 | int ret; |
| 5299 | |
| 5300 | vos_ssr_protect(__func__); |
| 5301 | ret = __iw_get_essid(dev, info, dwrq, extra); |
| 5302 | vos_ssr_unprotect(__func__); |
| 5303 | |
| 5304 | return ret; |
| 5305 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5306 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5307 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5308 | \brief __iw_set_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5309 | This function sets the auth type received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5310 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5311 | \param - dev - Pointer to the net device. |
| 5312 | - info - Pointer to the iw_request_info. |
| 5313 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5314 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5315 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5316 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5317 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5318 | int __iw_set_auth(struct net_device *dev,struct iw_request_info *info, |
| 5319 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5320 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5321 | hdd_adapter_t *pAdapter; |
| 5322 | hdd_context_t *pHddCtx; |
| 5323 | hdd_wext_state_t *pWextState; |
| 5324 | hdd_station_ctx_t *pHddStaCtx; |
| 5325 | tCsrRoamProfile *pRoamProfile; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5326 | eCsrEncryptionType mcEncryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5327 | eCsrEncryptionType ucEncryptionType; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5328 | int ret = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5329 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5330 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5331 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5332 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5333 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5334 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5335 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5336 | "%s: Adapter is NULL",__func__); |
| 5337 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5338 | } |
| 5339 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5340 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5341 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5342 | if (0 != ret) |
| 5343 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5344 | return ret; |
| 5345 | } |
| 5346 | |
| 5347 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5348 | if (NULL == pHddStaCtx) |
| 5349 | { |
| 5350 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5351 | "%s: STA Context is NULL",__func__); |
| 5352 | return -EINVAL; |
| 5353 | } |
| 5354 | |
| 5355 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5356 | if (NULL == pWextState) |
| 5357 | { |
| 5358 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5359 | "%s: pWextState is NULL",__func__); |
| 5360 | return -EINVAL; |
| 5361 | } |
| 5362 | |
| 5363 | pRoamProfile = &pWextState->roamProfile; |
| 5364 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5365 | switch(wrqu->param.flags & IW_AUTH_INDEX) |
| 5366 | { |
| 5367 | case IW_AUTH_WPA_VERSION: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5369 | pWextState->wpaVersion = wrqu->param.value; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5370 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5371 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5372 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5373 | case IW_AUTH_CIPHER_PAIRWISE: |
| 5374 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5375 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5376 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5377 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5378 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5379 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5380 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 5382 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5383 | } |
| 5384 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5385 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5386 | |
| 5387 | if( (IW_AUTH_KEY_MGMT_802_1X |
| 5388 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5389 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) ) |
| 5390 | /*Dynamic WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5391 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5392 | else |
| 5393 | /*Static WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5394 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5396 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5397 | |
| 5398 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5399 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5400 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5401 | /*Dynamic WEP key*/ |
| 5402 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 5403 | else |
| 5404 | /*Static WEP key*/ |
| 5405 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5406 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5407 | } |
| 5408 | else { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5410 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5411 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5412 | return -EINVAL; |
| 5413 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5414 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5415 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5416 | pRoamProfile->EncryptionType.encryptionType[0] = ucEncryptionType; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5417 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5418 | break; |
| 5419 | case IW_AUTH_CIPHER_GROUP: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5420 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5421 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 5422 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5423 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5425 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5426 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5427 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5428 | |
| 5429 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5430 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5431 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5433 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5434 | |
| 5435 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5436 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 5437 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5439 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5440 | |
| 5441 | else |
| 5442 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5443 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5444 | |
| 5445 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) |
| 5446 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5447 | /*Dynamic WEP keys won't work with shared keys*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5448 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 5449 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5450 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 5451 | { |
| 5452 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 5453 | } |
| 5454 | else |
| 5455 | { |
| 5456 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5457 | } |
| 5458 | } |
| 5459 | else { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5460 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5461 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5462 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5463 | return -EINVAL; |
| 5464 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5465 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5466 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5467 | pRoamProfile->mcEncryptionType.encryptionType[0] = mcEncryptionType; |
| 5468 | } |
| 5469 | break; |
| 5470 | |
| 5471 | case IW_AUTH_80211_AUTH_ALG: |
| 5472 | { |
| 5473 | /*Save the auth algo here and set auth type to SME Roam profile |
| 5474 | in the iw_set_ap_address*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5475 | if( wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5476 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5477 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5478 | else if(wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 5479 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5480 | |
| 5481 | else if(wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 5482 | /*Not supported*/ |
| 5483 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5484 | pWextState->roamProfile.AuthType.authType[0] = pHddStaCtx->conn_info.authType; |
| 5485 | } |
| 5486 | break; |
| 5487 | |
| 5488 | case IW_AUTH_KEY_MGMT: |
| 5489 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5490 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5491 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 5492 | /*Check for CCKM AKM type */ |
| 5493 | if ( wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5494 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: CCKM AKM Set %d", |
| 5495 | __func__, wrqu->param.value); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5496 | /* Set the CCKM bit in authKeyMgmt */ |
| 5497 | /* Right now, this breaks all ref to authKeyMgmt because our |
| 5498 | * code doesn't realize it is a "bitfield" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5499 | */ |
| 5500 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 5501 | /*Set the key management to 802.1X*/ |
| 5502 | //pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5503 | pWextState->isESEConnection = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5504 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5505 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5506 | } else if ( wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 5507 | /*Save the key management*/ |
| 5508 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 5509 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 5510 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5511 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 5512 | } else if (!( wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
| 5513 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; //eCSR_AUTH_TYPE_WPA_NONE |
| 5514 | /*Save the key management anyway*/ |
| 5515 | pWextState->authKeyMgmt = wrqu->param.value; |
| 5516 | } else { // It must be IW_AUTH_KEY_MGMT_802_1X |
| 5517 | /*Save the key management*/ |
| 5518 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 5519 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 5520 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 5521 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 5522 | } |
| 5523 | #else |
| 5524 | /*Save the key management*/ |
| 5525 | pWextState->authKeyMgmt = wrqu->param.value; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5526 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5527 | } |
| 5528 | break; |
| 5529 | |
| 5530 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 5531 | { |
| 5532 | if(wrqu->param.value) { |
| 5533 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5534 | "Counter Measure started %d", wrqu->param.value); |
| 5535 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED; |
| 5536 | } |
| 5537 | else { |
| 5538 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5539 | "Counter Measure stopped=%d", wrqu->param.value); |
| 5540 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED; |
| 5541 | } |
| 5542 | } |
| 5543 | break; |
| 5544 | case IW_AUTH_DROP_UNENCRYPTED: |
| 5545 | case IW_AUTH_WPA_ENABLED: |
| 5546 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 5547 | case IW_AUTH_ROAMING_CONTROL: |
| 5548 | case IW_AUTH_PRIVACY_INVOKED: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5549 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5550 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5551 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5552 | hddLog(LOGW, "%s called with unsupported auth type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5553 | wrqu->param.flags & IW_AUTH_INDEX); |
| 5554 | break; |
| 5555 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5557 | EXIT(); |
| 5558 | return 0; |
| 5559 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5560 | |
| 5561 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 5562 | union iwreq_data *wrqu, char *extra) |
| 5563 | { |
| 5564 | int ret; |
| 5565 | |
| 5566 | vos_ssr_protect(__func__); |
| 5567 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 5568 | vos_ssr_unprotect(__func__); |
| 5569 | |
| 5570 | return ret; |
| 5571 | } |
| 5572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5573 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5574 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5575 | \brief __iw_get_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5576 | This function returns the auth type to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5578 | \param - dev - Pointer to the net device. |
| 5579 | - info - Pointer to the iw_request_info. |
| 5580 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5581 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5582 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5583 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5584 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5585 | int __iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 5586 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5587 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5588 | hdd_adapter_t* pAdapter; |
| 5589 | hdd_wext_state_t *pWextState; |
| 5590 | tCsrRoamProfile *pRoamProfile; |
| 5591 | hdd_context_t *pHddCtx; |
| 5592 | int ret = 0; |
| 5593 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5594 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5595 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5596 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5597 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5598 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5599 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5600 | "%s: Adapter is NULL",__func__); |
| 5601 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5602 | } |
| 5603 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5604 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5605 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5606 | if (0 != ret) |
| 5607 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5608 | return ret; |
| 5609 | } |
| 5610 | |
| 5611 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5612 | if (NULL == pWextState) |
| 5613 | { |
| 5614 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5615 | "%s: pWextState is NULL",__func__); |
| 5616 | return -EINVAL; |
| 5617 | } |
| 5618 | pRoamProfile = &pWextState->roamProfile; |
| 5619 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5620 | switch(pRoamProfile->negotiatedAuthType) |
| 5621 | { |
| 5622 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 5623 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5624 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 5625 | break; |
| 5626 | case eCSR_AUTH_TYPE_WPA: |
| 5627 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5628 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 5629 | break; |
| 5630 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5631 | case eCSR_AUTH_TYPE_FT_RSN: |
| 5632 | #endif |
| 5633 | case eCSR_AUTH_TYPE_RSN: |
| 5634 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 5635 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 5636 | break; |
| 5637 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5638 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5639 | break; |
| 5640 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5641 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 5642 | break; |
| 5643 | case eCSR_AUTH_TYPE_UNKNOWN: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5644 | hddLog(LOG1,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5645 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5646 | break; |
| 5647 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 5648 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5649 | break; |
| 5650 | case eCSR_AUTH_TYPE_WPA_PSK: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5651 | hddLog(LOG1,"%s called with WPA PSK auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5652 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5653 | return -EIO; |
| 5654 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5655 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 5656 | #endif |
| 5657 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5658 | #ifdef WLAN_FEATURE_11W |
| 5659 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 5660 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5661 | #endif |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5662 | hddLog(LOG1,"%s called with RSN PSK auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5663 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5664 | return -EIO; |
| 5665 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5666 | hddLog(LOGE,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5667 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 5668 | return -EIO; |
| 5669 | } |
| 5670 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) |
| 5671 | { |
| 5672 | switch(pRoamProfile->negotiatedUCEncryptionType) |
| 5673 | { |
| 5674 | case eCSR_ENCRYPT_TYPE_NONE: |
| 5675 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 5676 | break; |
| 5677 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5678 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5679 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 5680 | break; |
| 5681 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5682 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 5683 | break; |
| 5684 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5685 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5686 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 5687 | break; |
| 5688 | case eCSR_ENCRYPT_TYPE_AES: |
| 5689 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 5690 | break; |
| 5691 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5692 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 5693 | __func__, pRoamProfile->negotiatedUCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5694 | return -EIO; |
| 5695 | } |
| 5696 | } |
| 5697 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5698 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5699 | { |
| 5700 | switch(pRoamProfile->negotiatedMCEncryptionType) |
| 5701 | { |
| 5702 | case eCSR_ENCRYPT_TYPE_NONE: |
| 5703 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 5704 | break; |
| 5705 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5706 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5707 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 5708 | break; |
| 5709 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5710 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 5711 | break; |
| 5712 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5713 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5714 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 5715 | break; |
| 5716 | case eCSR_ENCRYPT_TYPE_AES: |
| 5717 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 5718 | break; |
| 5719 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 5720 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 5721 | __func__, pRoamProfile->negotiatedMCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5722 | return -EIO; |
| 5723 | } |
| 5724 | } |
| 5725 | |
| 5726 | hddLog(LOG1, "%s called with auth type %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5727 | __func__, pRoamProfile->AuthType.authType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5728 | EXIT(); |
| 5729 | return 0; |
| 5730 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5731 | |
| 5732 | int iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 5733 | union iwreq_data *wrqu,char *extra) |
| 5734 | { |
| 5735 | int ret; |
| 5736 | |
| 5737 | vos_ssr_protect(__func__); |
| 5738 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 5739 | vos_ssr_unprotect(__func__); |
| 5740 | |
| 5741 | return ret; |
| 5742 | } |
| 5743 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5744 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5745 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5746 | \brief __iw_set_ap_address() - |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5747 | This function calls the sme_RoamConnect function to associate |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5748 | to the AP with the specified BSSID received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5749 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5750 | \param - dev - Pointer to the net device. |
| 5751 | - info - Pointer to the iw_request_info. |
| 5752 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5753 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5754 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5755 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5756 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5757 | int __iw_set_ap_address(struct net_device *dev, |
| 5758 | struct iw_request_info *info, |
| 5759 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5760 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5761 | hdd_station_ctx_t *pHddStaCtx; |
| 5762 | hdd_adapter_t *pAdapter; |
| 5763 | hdd_context_t *pHddCtx; |
| 5764 | v_U8_t *pMacAddress = NULL; |
| 5765 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5766 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5767 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5768 | |
| 5769 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5770 | if (NULL == pAdapter) |
| 5771 | { |
| 5772 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5773 | "%s: Adapter is NULL", __func__); |
| 5774 | return -EINVAL; |
| 5775 | } |
| 5776 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5777 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5778 | if (0 != ret) |
| 5779 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5780 | return ret; |
| 5781 | } |
| 5782 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5783 | if (NULL == pHddStaCtx) |
| 5784 | { |
| 5785 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5786 | "%s: pHddStaCtx is NULL", __func__); |
| 5787 | return -EINVAL; |
| 5788 | } |
| 5789 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5790 | pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data; |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 5791 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s "MAC_ADDRESS_STR, |
| 5792 | __func__, MAC_ADDR_ARRAY(pMacAddress)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5793 | vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid )); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5794 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5795 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5796 | return 0; |
| 5797 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5798 | |
| 5799 | int iw_set_ap_address(struct net_device *dev, |
| 5800 | struct iw_request_info *info, |
| 5801 | union iwreq_data *wrqu, char *extra) |
| 5802 | { |
| 5803 | int ret; |
| 5804 | |
| 5805 | vos_ssr_protect(__func__); |
| 5806 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 5807 | vos_ssr_unprotect(__func__); |
| 5808 | |
| 5809 | return ret; |
| 5810 | } |
| 5811 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5812 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5813 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5814 | \brief __iw_get_ap_address() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5815 | This function returns the BSSID to the wpa_supplicant |
| 5816 | \param - dev - Pointer to the net device. |
| 5817 | - info - Pointer to the iw_request_info. |
| 5818 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5819 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5820 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 5821 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5822 | --------------------------------------------------------------------------*/ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5823 | int __iw_get_ap_address(struct net_device *dev, |
| 5824 | struct iw_request_info *info, |
| 5825 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5826 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5827 | hdd_station_ctx_t *pHddStaCtx; |
| 5828 | hdd_adapter_t *pAdapter; |
| 5829 | hdd_context_t *pHddCtx; |
| 5830 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5832 | ENTER(); |
| 5833 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5834 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5835 | if (NULL == pAdapter) |
| 5836 | { |
| 5837 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5838 | "%s: Adapter is NULL", __func__); |
| 5839 | return -EINVAL; |
| 5840 | } |
| 5841 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5842 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5843 | if (0 != ret) |
| 5844 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5845 | return ret; |
| 5846 | } |
| 5847 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5848 | if (NULL == pHddStaCtx) |
| 5849 | { |
| 5850 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5851 | "%s: pHddStaCtx is NULL", __func__); |
| 5852 | return -EINVAL; |
| 5853 | } |
| 5854 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5855 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 5856 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 5857 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 5858 | memcpy(wrqu->ap_addr.sa_data,pHddStaCtx->conn_info.bssId,ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5859 | } |
| 5860 | else |
| 5861 | { |
| 5862 | memset(wrqu->ap_addr.sa_data,0,sizeof(wrqu->ap_addr.sa_data)); |
| 5863 | } |
| 5864 | EXIT(); |
| 5865 | return 0; |
| 5866 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 5867 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 5868 | int iw_get_ap_address(struct net_device *dev, |
| 5869 | struct iw_request_info *info, |
| 5870 | union iwreq_data *wrqu, char *extra) |
| 5871 | { |
| 5872 | int ret; |
| 5873 | |
| 5874 | vos_ssr_protect(__func__); |
| 5875 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 5876 | vos_ssr_unprotect(__func__); |
| 5877 | |
| 5878 | return ret; |
| 5879 | } |
| 5880 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5881 | #ifdef WLAN_FEATURE_11W |
| 5882 | /**--------------------------------------------------------------------------- |
| 5883 | |
| 5884 | \brief hdd_indicateUnprotMgmtFrame - |
| 5885 | This function forwards the unprotected management frame to the supplicant |
| 5886 | \param - pAdapter - Pointer to HDD adapter |
| 5887 | - nFrameLength - Length of the unprotected frame being passed |
| 5888 | - pbFrames - Pointer to the frame buffer |
| 5889 | - frameType - 802.11 frame type |
| 5890 | \return - nothing |
| 5891 | |
| 5892 | --------------------------------------------------------------------------*/ |
| 5893 | void hdd_indicateUnprotMgmtFrame( hdd_adapter_t *pAdapter, |
| 5894 | tANI_U32 nFrameLength, |
| 5895 | tANI_U8* pbFrames, |
| 5896 | tANI_U8 frameType ) |
| 5897 | { |
| 5898 | tANI_U8 type = 0; |
| 5899 | tANI_U8 subType = 0; |
| 5900 | |
| 5901 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d", |
| 5902 | __func__, frameType, nFrameLength); |
| 5903 | |
| 5904 | /* Sanity Checks */ |
| 5905 | if (NULL == pAdapter) |
| 5906 | { |
| 5907 | hddLog( LOGE, FL("pAdapter is NULL")); |
| 5908 | return; |
| 5909 | } |
| 5910 | |
| 5911 | if (NULL == pAdapter->dev) |
| 5912 | { |
| 5913 | hddLog( LOGE, FL("pAdapter->dev is NULL")); |
| 5914 | return; |
| 5915 | } |
| 5916 | |
| 5917 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 5918 | { |
| 5919 | hddLog( LOGE, FL("pAdapter has invalid magic")); |
| 5920 | return; |
| 5921 | } |
| 5922 | |
| 5923 | if( !nFrameLength ) |
| 5924 | { |
| 5925 | hddLog( LOGE, FL("Frame Length is Invalid ZERO")); |
| 5926 | return; |
| 5927 | } |
| 5928 | |
| 5929 | if (NULL == pbFrames) { |
| 5930 | hddLog( LOGE, FL("pbFrames is NULL")); |
| 5931 | return; |
| 5932 | } |
| 5933 | |
| 5934 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 5935 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 5936 | |
| 5937 | /* Get pAdapter from Destination mac address of the frame */ |
| 5938 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) |
| 5939 | { |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 5940 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 5941 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength); |
| 5942 | #else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5943 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, nFrameLength); |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 5944 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5945 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 5946 | } |
| 5947 | else if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DEAUTH) |
| 5948 | { |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 5949 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 5950 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength); |
| 5951 | #else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5952 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, nFrameLength); |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 5953 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5954 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 5955 | } |
| 5956 | else |
| 5957 | { |
| 5958 | hddLog( LOGE, FL("Frame type %d and subtype %d are not valid"), type, subType); |
| 5959 | return; |
| 5960 | } |
| 5961 | } |
| 5962 | #endif |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5963 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5964 | #if defined (FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5965 | void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid, |
| 5966 | tANI_U8 state, |
| 5967 | tANI_U16 measInterval ) |
| 5968 | { |
| 5969 | union iwreq_data wrqu; |
| 5970 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 5971 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5972 | |
| 5973 | if (NULL == pAdapter) |
| 5974 | return; |
| 5975 | |
| 5976 | // create the event |
| 5977 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 5978 | memset(buf, '\0', sizeof(buf)); |
| 5979 | |
| 5980 | hddLog(VOS_TRACE_LEVEL_INFO, "TSM Ind tid(%d) state(%d) MeasInt(%d)", |
| 5981 | tid, state, measInterval); |
| 5982 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 5983 | 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] | 5984 | |
| 5985 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 5986 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5987 | // send the event |
| 5988 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 5989 | } |
| 5990 | |
| 5991 | void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 5992 | { |
| 5993 | union iwreq_data wrqu; |
| 5994 | char buf[IW_CUSTOM_MAX + 1]; |
| 5995 | char *pos = buf; |
| 5996 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 5997 | |
| 5998 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 5999 | return; |
| 6000 | |
| 6001 | // create the event |
| 6002 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6003 | memset(buf, '\0', sizeof(buf)); |
| 6004 | |
| 6005 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 6006 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXPREAUTHNOTIFY=%02x:%02x:%02x:%02x:%02x:%02x %u:%u", |
| 6007 | pRoamInfo->bssid[0], pRoamInfo->bssid[1], pRoamInfo->bssid[2], |
| 6008 | pRoamInfo->bssid[3], pRoamInfo->bssid[4], pRoamInfo->bssid[5], |
| 6009 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6010 | |
| 6011 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 6012 | pos += nBytes; |
| 6013 | freeBytes -= nBytes; |
| 6014 | |
| 6015 | vos_mem_copy(pos, pRoamInfo->bssid, WNI_CFG_BSSID_LEN); |
| 6016 | pos += WNI_CFG_BSSID_LEN; |
| 6017 | freeBytes -= WNI_CFG_BSSID_LEN; |
| 6018 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6019 | nBytes = snprintf(pos, freeBytes, " %u:%u", pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 6020 | freeBytes -= nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6021 | |
| 6022 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6023 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6024 | |
| 6025 | // send the event |
| 6026 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6027 | } |
| 6028 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6029 | void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6030 | { |
| 6031 | union iwreq_data wrqu; |
| 6032 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6033 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6034 | |
| 6035 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6036 | return; |
| 6037 | |
| 6038 | // create the event |
| 6039 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6040 | memset(buf, '\0', sizeof(buf)); |
| 6041 | |
| 6042 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
| 6043 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6044 | nBytes = snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6045 | |
| 6046 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 6047 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6048 | |
| 6049 | // send the event |
| 6050 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6051 | } |
| 6052 | |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 6053 | void hdd_indicateEseBcnReportNoResults(const hdd_adapter_t *pAdapter, |
| 6054 | const tANI_U16 measurementToken, |
| 6055 | const tANI_BOOLEAN flag, |
| 6056 | const tANI_U8 numBss) |
| 6057 | { |
| 6058 | union iwreq_data wrqu; |
| 6059 | char buf[IW_CUSTOM_MAX]; |
| 6060 | char *pos = buf; |
| 6061 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6062 | |
| 6063 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6064 | memset(buf, '\0', sizeof(buf)); |
| 6065 | |
| 6066 | hddLog(VOS_TRACE_LEVEL_INFO, FL("CCXBCNREP=%d %d %d"), measurementToken, flag, |
| 6067 | numBss); |
| 6068 | |
| 6069 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 6070 | flag, numBss); |
| 6071 | |
| 6072 | wrqu.data.pointer = buf; |
| 6073 | wrqu.data.length = nBytes; |
| 6074 | // send the event |
| 6075 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6076 | } |
| 6077 | |
| 6078 | |
| 6079 | static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6080 | const tCsrRoamInfo *pRoamInfo) |
| 6081 | { |
| 6082 | union iwreq_data wrqu; |
| 6083 | char buf[IW_CUSTOM_MAX + 1]; |
| 6084 | char *pos = buf; |
| 6085 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 6086 | tANI_U8 i = 0, len = 0; |
| 6087 | tANI_U8 tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 6088 | tANI_U8 lastSent = 0, sendBss = 0; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6089 | int bcnRepFieldSize = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0].bcnReportFields); |
| 6090 | tANI_U8 ieLenByte = 1; |
| 6091 | /* CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes */ |
| 6092 | #define ESEBCNREPHEADER_LEN (18) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6093 | |
| 6094 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 6095 | return; |
| 6096 | |
| 6097 | /* Custom event can pass maximum of 256 bytes of data, |
| 6098 | based on the IE len we need to identify how many BSS info can |
| 6099 | be filled in to custom event data */ |
| 6100 | /* |
| 6101 | meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 6102 | bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 6103 | CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 6104 | */ |
| 6105 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6106 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) && (!pRoamInfo->pEseBcnReportRsp->numBss)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6107 | { |
| 6108 | hddLog(VOS_TRACE_LEVEL_INFO, "Measurement Done but no scan results"); |
| 6109 | /* If the measurement is none and no scan results found, |
| 6110 | indicate the supplicant about measurement done */ |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 6111 | hdd_indicateEseBcnReportNoResults(pAdapter, |
| 6112 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 6113 | pRoamInfo->pEseBcnReportRsp->flag, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6114 | pRoamInfo->pEseBcnReportRsp->numBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6115 | } |
| 6116 | else |
| 6117 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6118 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6119 | { |
| 6120 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 6121 | memset(buf, '\0', sizeof(buf)); |
| 6122 | tot_bcn_ieLen = 0; |
| 6123 | sendBss = 0; |
| 6124 | pos = buf; |
| 6125 | freeBytes = IW_CUSTOM_MAX; |
| 6126 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6127 | for (i = lastSent; i < pRoamInfo->pEseBcnReportRsp->numBss; i++) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6128 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6129 | len = bcnRepFieldSize + ieLenByte + pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen; |
| 6130 | if ((len + tot_bcn_ieLen) > (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6131 | { |
| 6132 | break; |
| 6133 | } |
| 6134 | tot_bcn_ieLen += len; |
| 6135 | sendBss++; |
| 6136 | hddLog(VOS_TRACE_LEVEL_INFO, "i(%d) sizeof bcnReportFields(%d)" |
| 6137 | "IeLength(%d) Length of Ie(%d) totLen(%d)", |
| 6138 | i, bcnRepFieldSize, 1, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6139 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6140 | tot_bcn_ieLen); |
| 6141 | } |
| 6142 | |
| 6143 | hddLog(VOS_TRACE_LEVEL_INFO, "Sending %d BSS Info", sendBss); |
| 6144 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXBCNREP=%d %d %d %d", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6145 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 6146 | sendBss, tot_bcn_ieLen); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6147 | |
| 6148 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6149 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 6150 | sendBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6151 | pos += nBytes; |
| 6152 | freeBytes -= nBytes; |
| 6153 | |
| 6154 | /* Copy total Beacon report data length */ |
| 6155 | vos_mem_copy(pos, (char*)&tot_bcn_ieLen, sizeof(tot_bcn_ieLen)); |
| 6156 | pos += sizeof(tot_bcn_ieLen); |
| 6157 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 6158 | |
| 6159 | for (i = 0; i < sendBss; i++) |
| 6160 | { |
| 6161 | hddLog(VOS_TRACE_LEVEL_INFO, "ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 6162 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 6163 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6164 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6165 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ChanNum, |
| 6166 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Spare, |
| 6167 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.MeasDuration, |
| 6168 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.PhyType, |
| 6169 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.RecvSigPower, |
| 6170 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ParentTsf, |
| 6171 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[0], |
| 6172 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[1], |
| 6173 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.BcnInterval, |
| 6174 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.CapabilityInfo, |
| 6175 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[0], |
| 6176 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[1], |
| 6177 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[2], |
| 6178 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[3], |
| 6179 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[4], |
| 6180 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[5]); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6181 | |
| 6182 | /* bcn report fields are copied */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6183 | len = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields); |
| 6184 | vos_mem_copy(pos, (char*)&pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6185 | pos += len; |
| 6186 | freeBytes -= len; |
| 6187 | |
| 6188 | /* Add 1 byte of ie len */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6189 | len = pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].ieLen; |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6190 | vos_mem_copy(pos, (char*)&len, sizeof(len)); |
| 6191 | pos += sizeof(len); |
| 6192 | freeBytes -= sizeof(len); |
| 6193 | |
| 6194 | /* copy IE from scan results */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6195 | vos_mem_copy(pos, (char*)pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].pBuf, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 6196 | pos += len; |
| 6197 | freeBytes -= len; |
| 6198 | } |
| 6199 | |
| 6200 | wrqu.data.pointer = buf; |
| 6201 | wrqu.data.length = strlen(buf); |
| 6202 | |
| 6203 | // send the event |
| 6204 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 6205 | lastSent += sendBss; |
| 6206 | } |
| 6207 | } |
| 6208 | } |
| 6209 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 6210 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 6211 | |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 6212 | hdd_adapter_t *hdd_get_sta_connection_in_progress(hdd_context_t *hdd_ctx) |
| 6213 | { |
| 6214 | hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; |
| 6215 | hdd_adapter_t *adapter = NULL; |
| 6216 | VOS_STATUS status; |
| 6217 | hdd_station_ctx_t *hdd_sta_ctx; |
| 6218 | |
| 6219 | if (!hdd_ctx) { |
| 6220 | hddLog(LOGE, FL("HDD context is NULL")); |
| 6221 | return NULL; |
| 6222 | } |
| 6223 | |
| 6224 | status = hdd_get_front_adapter(hdd_ctx, &adapter_node); |
| 6225 | while (NULL != adapter_node && VOS_STATUS_SUCCESS == status) { |
| 6226 | adapter = adapter_node->pAdapter; |
| 6227 | if (!adapter) |
| 6228 | goto end; |
| 6229 | |
| 6230 | if ((WLAN_HDD_INFRA_STATION == adapter->device_mode) || |
| 6231 | (WLAN_HDD_P2P_CLIENT == adapter->device_mode) || |
| 6232 | (WLAN_HDD_P2P_DEVICE == adapter->device_mode)) { |
| 6233 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6234 | if (eConnectionState_Connecting == |
| 6235 | hdd_sta_ctx->conn_info.connState) { |
| 6236 | hddLog(LOG1, FL("session_id %d: Connection is in progress"), |
| 6237 | adapter->sessionId); |
| 6238 | return adapter; |
| 6239 | } else if ((eConnectionState_Associated == |
| 6240 | hdd_sta_ctx->conn_info.connState) && |
Vignesh Viswanathan | 0ac8e56 | 2018-06-14 17:24:10 +0530 | [diff] [blame] | 6241 | sme_is_sta_key_exchange_in_progress( |
| 6242 | hdd_ctx->hHal, adapter->sessionId)) { |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 6243 | hddLog(LOG1, FL("session_id %d: Key exchange is in progress"), |
| 6244 | adapter->sessionId); |
| 6245 | return adapter; |
| 6246 | } |
| 6247 | } |
| 6248 | end: |
| 6249 | status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next); |
| 6250 | adapter_node = next; |
| 6251 | } |
| 6252 | return NULL; |
| 6253 | } |
| 6254 | |