Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved. |
| 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" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 56 | #include <linux/ieee80211.h> |
| 57 | #include <linux/wireless.h> |
| 58 | #include <net/cfg80211.h> |
| 59 | #include "wlan_hdd_cfg80211.h" |
| 60 | #include "csrInsideApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 61 | #include "wlan_hdd_p2p.h" |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 62 | #ifdef FEATURE_WLAN_TDLS |
| 63 | #include "wlan_hdd_tdls.h" |
| 64 | #endif |
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 | #ifdef DEBUG_ROAM_DELAY |
| 68 | #include "vos_utils.h" |
| 69 | #endif |
| 70 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 71 | v_BOOL_t mibIsDot11DesiredBssTypeInfrastructure( hdd_adapter_t *pAdapter ); |
| 72 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 73 | struct ether_addr |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 74 | { |
| 75 | u_char ether_addr_octet[6]; |
| 76 | }; |
| 77 | // These are needed to recognize WPA and RSN suite types |
| 78 | #define HDD_WPA_OUI_SIZE 4 |
| 79 | v_U8_t ccpWpaOui00[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 80 | v_U8_t ccpWpaOui01[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 81 | v_U8_t ccpWpaOui02[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 82 | v_U8_t ccpWpaOui03[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 83 | v_U8_t ccpWpaOui04[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 84 | 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] | 85 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 86 | 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] | 87 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 88 | #define HDD_RSN_OUI_SIZE 4 |
| 89 | v_U8_t ccpRSNOui00[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x00 }; // group cipher |
| 90 | v_U8_t ccpRSNOui01[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x01 }; // WEP-40 or RSN |
| 91 | v_U8_t ccpRSNOui02[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x02 }; // TKIP or RSN-PSK |
| 92 | v_U8_t ccpRSNOui03[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x03 }; // Reserved |
| 93 | v_U8_t ccpRSNOui04[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x04 }; // AES-CCMP |
| 94 | 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] | 95 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 96 | 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] | 97 | #endif /* FEATURE_WLAN_ESE */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 98 | #ifdef WLAN_FEATURE_11W |
| 99 | 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] | 100 | /* RSN-8021X-SHA256 */ |
| 101 | v_U8_t ccpRSNOui08[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 }; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 102 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 103 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 104 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | // Offset where the EID-Len-IE, start. |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 106 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2)*/ |
| 107 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | #endif |
| 109 | |
| 110 | #define BEACON_FRAME_IES_OFFSET 12 |
| 111 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 112 | #ifdef WLAN_FEATURE_11W |
| 113 | void hdd_indicateUnprotMgmtFrame(hdd_adapter_t *pAdapter, |
| 114 | tANI_U32 nFrameLength, |
| 115 | tANI_U8* pbFrames, |
| 116 | tANI_U8 frameType ); |
| 117 | #endif |
| 118 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 119 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 120 | static void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid, |
| 121 | tANI_U8 state, |
| 122 | tANI_U16 measInterval ); |
| 123 | static void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 124 | static void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo); |
| 125 | static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, const tCsrRoamInfo *pRoamInfo); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 126 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 127 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 128 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 129 | static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, |
| 130 | tCsrRoamInfo *pRoamInfo, |
| 131 | tANI_U32 roamId, |
| 132 | eRoamCmdStatus roamStatus, |
| 133 | eCsrRoamResult roamResult ); |
| 134 | |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 135 | v_VOID_t hdd_connSetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 136 | eConnectionState connState ) |
| 137 | { |
| 138 | // save the new connection state |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 139 | hddLog(LOG1, FL("ConnectionState Changed from oldState:%d to State:%d"), |
| 140 | pHddStaCtx->conn_info.connState,connState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 141 | pHddStaCtx->conn_info.connState = connState; |
| 142 | } |
| 143 | |
| 144 | // returns FALSE if not connected. |
| 145 | // returns TRUE for the two 'connected' states (Infra Associated or IBSS Connected ). |
| 146 | // returns the connection state. Can specify NULL if you dont' want to get the actual state. |
| 147 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 148 | static inline v_BOOL_t hdd_connGetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 149 | eConnectionState *pConnState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 150 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 151 | v_BOOL_t fConnected; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 152 | eConnectionState connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 153 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 154 | // get the connection state. |
| 155 | connState = pHddStaCtx->conn_info.connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 156 | // Set the fConnected return variable based on the Connected State. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 157 | if ( eConnectionState_Associated == connState || |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 158 | eConnectionState_IbssConnected == connState || |
| 159 | eConnectionState_IbssDisconnected == connState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 160 | { |
| 161 | fConnected = VOS_TRUE; |
| 162 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 163 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 164 | { |
| 165 | fConnected = VOS_FALSE; |
| 166 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 168 | if ( pConnState ) |
| 169 | { |
| 170 | *pConnState = connState; |
| 171 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 172 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 173 | return( fConnected ); |
| 174 | } |
| 175 | |
| 176 | v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx ) |
| 177 | { |
| 178 | return( hdd_connGetConnectionState( pHddStaCtx, NULL ) ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 179 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 180 | |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 181 | eCsrBand hdd_connGetConnectedBand( hdd_station_ctx_t *pHddStaCtx ) |
| 182 | { |
| 183 | v_U8_t staChannel = 0; |
| 184 | |
| 185 | if ( eConnectionState_Associated == pHddStaCtx->conn_info.connState ) |
| 186 | { |
| 187 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 188 | } |
| 189 | |
| 190 | if ( staChannel > 0 && staChannel < 14 ) |
| 191 | return eCSR_BAND_24; |
| 192 | else if (staChannel >= 36 && staChannel <= 165 ) |
| 193 | return eCSR_BAND_5G; |
| 194 | else /* If station is not connected return as eCSR_BAND_ALL */ |
| 195 | return eCSR_BAND_ALL; |
| 196 | } |
| 197 | |
| 198 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 199 | //TODO - Not used anyhwere. Can be removed. |
| 200 | #if 0 |
| 201 | // |
| 202 | v_BOOL_t hdd_connIsConnectedInfra( hdd_adapter_t *pAdapter ) |
| 203 | { |
| 204 | v_BOOL_t fConnectedInfra = FALSE; |
| 205 | eConnectionState connState; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 206 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 207 | if ( hdd_connGetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connState ) ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 208 | { |
| 209 | if ( eConnectionState_Associated == connState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 210 | { |
| 211 | fConnectedInfra = TRUE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 212 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 213 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 214 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 215 | return( fConnectedInfra ); |
| 216 | } |
| 217 | #endif |
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 | static inline v_BOOL_t hdd_connGetConnectedCipherAlgo( hdd_station_ctx_t *pHddStaCtx, eCsrEncryptionType *pConnectedCipherAlgo ) |
| 220 | { |
| 221 | v_BOOL_t fConnected = VOS_FALSE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 222 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 223 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 224 | |
| 225 | if ( pConnectedCipherAlgo ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 226 | { |
| 227 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 228 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 229 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 230 | return( fConnected ); |
| 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 | inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eMib_dot11DesiredBssType *pConnectedBssType ) |
| 234 | { |
| 235 | v_BOOL_t fConnected = VOS_FALSE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 236 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 237 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 238 | |
| 239 | if ( pConnectedBssType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 240 | { |
| 241 | *pConnectedBssType = pHddStaCtx->conn_info.connDot11DesiredBssType; |
| 242 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 243 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 244 | return( fConnected ); |
| 245 | } |
| 246 | |
| 247 | static inline void hdd_connSaveConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eCsrRoamBssType csrRoamBssType ) |
| 248 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 249 | switch( csrRoamBssType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 250 | { |
| 251 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
| 252 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_infrastructure; |
| 253 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 254 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 255 | case eCSR_BSS_TYPE_IBSS: |
| 256 | case eCSR_BSS_TYPE_START_IBSS: |
| 257 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_independent; |
| 258 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 259 | |
| 260 | /** We will never set the BssType to 'any' when attempting a connection |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | so CSR should never send this back to us.*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 262 | case eCSR_BSS_TYPE_ANY: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 263 | default: |
| 264 | VOS_ASSERT( 0 ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 265 | break; |
| 266 | } |
| 267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | void hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType ) |
| 271 | { |
| 272 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 273 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 274 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 275 | VOS_ASSERT( pRoamInfo ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 276 | |
| 277 | if ( pRoamInfo ) |
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 | // Save the BSSID for the connection... |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 280 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType ) |
| 281 | { |
| 282 | VOS_ASSERT( pRoamInfo->pBssDesc ); |
| 283 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,6 ); |
| 284 | |
| 285 | // Save the Station ID for this station from the 'Roam Info'. |
| 286 | //For IBSS mode, staId is assigned in NEW_PEER_IND |
| 287 | //For reassoc, the staID doesn't change and it may be invalid in this structure |
| 288 | //so no change here. |
| 289 | if( !pRoamInfo->fReassocReq ) |
| 290 | { |
| 291 | pHddStaCtx->conn_info.staId [0]= pRoamInfo->staId; |
| 292 | } |
| 293 | } |
| 294 | else if ( eCSR_BSS_TYPE_IBSS == eBssType ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 295 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 296 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,sizeof(pRoamInfo->bssid) ); |
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 | else |
| 299 | { |
| 300 | // can't happen. We need a valid IBSS or Infra setting in the BSSDescription |
| 301 | // or we can't function. |
| 302 | VOS_ASSERT( 0 ); |
| 303 | } |
| 304 | |
| 305 | // notify WMM |
| 306 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 307 | |
| 308 | if( !pRoamInfo->u.pConnectedProfile ) |
| 309 | { |
| 310 | VOS_ASSERT( pRoamInfo->u.pConnectedProfile ); |
| 311 | } |
| 312 | else |
| 313 | { |
| 314 | // Get Multicast Encryption Type |
| 315 | encryptType = pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 316 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 317 | // Get Unicast Encrytion Type |
| 318 | encryptType = pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 319 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 320 | |
| 321 | pHddStaCtx->conn_info.authType = pRoamInfo->u.pConnectedProfile->AuthType; |
| 322 | |
| 323 | pHddStaCtx->conn_info.operationChannel = pRoamInfo->u.pConnectedProfile->operationChannel; |
| 324 | |
| 325 | // Save the ssid for the connection |
| 326 | 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] | 327 | |
| 328 | // Save dot11mode in which STA associated to AP |
| 329 | pHddStaCtx->conn_info.dot11Mode = pRoamInfo->u.pConnectedProfile->dot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 330 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 331 | } |
| 332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 333 | // save the connected BssType |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 334 | hdd_connSaveConnectedBssType( pHddStaCtx, eBssType ); |
| 335 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 336 | } |
| 337 | |
| 338 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 339 | /* |
| 340 | * Send the 11R key information to the supplicant. |
| 341 | * Only then can the supplicant generate the PMK-R1. |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 342 | * (BTW, the ESE supplicant also needs the Assoc Resp IEs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 343 | * for the same purpose.) |
| 344 | * |
| 345 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA |
| 346 | * this contains the R1KHID, R0KHID and the MDID. |
| 347 | * For FT, this consists of the Reassoc Rsp FTIEs. |
| 348 | * This is the Assoc Response. |
| 349 | */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 350 | static void hdd_SendFTAssocResponse(struct net_device *dev, hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 351 | tCsrRoamInfo *pCsrRoamInfo) |
| 352 | { |
| 353 | union iwreq_data wrqu; |
| 354 | char *buff; |
| 355 | unsigned int len = 0; |
| 356 | u8 *pFTAssocRsp = NULL; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 357 | |
| 358 | if (pCsrRoamInfo->nAssocRspLength == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | { |
| 360 | hddLog(LOGE, |
| 361 | "%s: pCsrRoamInfo->nAssocRspLength=%d", |
| 362 | __func__, (int)pCsrRoamInfo->nAssocRspLength); |
| 363 | return; |
| 364 | } |
| 365 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 366 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 367 | pCsrRoamInfo->nAssocReqLength); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 368 | if (pFTAssocRsp == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 369 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 370 | hddLog(LOGE, "%s: AssocReq or AssocRsp is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 371 | return; |
| 372 | } |
| 373 | |
| 374 | // pFTAssocRsp needs to point to the IEs |
| 375 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 376 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 377 | (unsigned int)pFTAssocRsp[0], |
| 378 | (unsigned int)pFTAssocRsp[1]); |
| 379 | |
| 380 | // We need to send the IEs to the supplicant. |
| 381 | buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 382 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 383 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 384 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 385 | return; |
| 386 | } |
| 387 | |
| 388 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
| 389 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 390 | wrqu.data.length = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 391 | memset(buff, 0, IW_GENERIC_IE_MAX); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 392 | memcpy(buff, pFTAssocRsp, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 393 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 394 | |
| 395 | kfree(buff); |
| 396 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 397 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 398 | |
| 399 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 400 | |
| 401 | /*--------------------------------------------------- |
| 402 | * |
| 403 | * Send the FTIEs, RIC IEs during FT. This is eventually |
| 404 | * used to send the FT events to the supplicant |
| 405 | * |
| 406 | * At the reception of Auth2 we send the RIC followed |
| 407 | * by the auth response IEs to the supplicant. |
| 408 | * Once both are received in the supplicant, an FT |
| 409 | * event is generated to the supplicant. |
| 410 | * |
| 411 | *--------------------------------------------------- |
| 412 | */ |
| 413 | void hdd_SendFTEvent(hdd_adapter_t *pAdapter) |
| 414 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 415 | tANI_U16 auth_resp_len = 0; |
| 416 | tANI_U32 ric_ies_length = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 417 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 418 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 419 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 420 | struct cfg80211_ft_event_params ftEvent; |
| 421 | v_U8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 422 | v_U8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 423 | struct net_device *dev = pAdapter->dev; |
| 424 | #else |
| 425 | char *buff; |
| 426 | union iwreq_data wrqu; |
| 427 | tANI_U16 str_len; |
| 428 | #endif |
| 429 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 430 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 431 | vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 432 | vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 433 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 434 | sme_GetRICIEs( pHddCtx->hHal, (u8 *)ricIe, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 435 | DOT11F_IE_FTINFO_MAX_LEN, &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 436 | if (ric_ies_length == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 437 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 438 | hddLog(LOGW, |
| 439 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 440 | __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 441 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 442 | |
| 443 | ftEvent.ric_ies = ricIe; |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 444 | ftEvent.ric_ies_len = ric_ies_length; |
| 445 | 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] | 446 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 447 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 448 | DOT11F_IE_FTINFO_MAX_LEN, &auth_resp_len); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 449 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 450 | if (auth_resp_len == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 451 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 452 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 453 | return; |
| 454 | } |
| 455 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 456 | sme_SetFTPreAuthState(pHddCtx->hHal, TRUE); |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 457 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 458 | ftEvent.target_ap = ftIe; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 459 | |
| 460 | ftEvent.ies = (u8 *)(ftIe + SIR_MAC_ADDR_LENGTH); |
| 461 | ftEvent.ies_len = auth_resp_len - SIR_MAC_ADDR_LENGTH; |
| 462 | |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 463 | hddLog(LOG1, "%s ftEvent.ies_len %zu", __FUNCTION__, ftEvent.ies_len); |
| 464 | hddLog(LOG1, "%s ftEvent.ric_ies_len %zu", |
| 465 | __FUNCTION__, ftEvent.ric_ies_len ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 466 | 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] | 467 | __FUNCTION__, ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 468 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 469 | ftEvent.target_ap[5]); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 470 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 471 | (void)cfg80211_ft_event(dev, &ftEvent); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 472 | |
| 473 | #else |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 474 | // We need to send the IEs to the supplicant |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 475 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 476 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 478 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 479 | return; |
| 480 | } |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 481 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 482 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 483 | // Sme needs to send the RIC IEs first |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 484 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 485 | sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]), |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 486 | (IW_CUSTOM_MAX - str_len), &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 487 | if (ric_ies_length == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 488 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 489 | hddLog(LOGW, |
| 490 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 491 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 492 | } |
| 493 | else |
| 494 | { |
| 495 | wrqu.data.length = str_len + ric_ies_length; |
| 496 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 497 | } |
| 498 | |
| 499 | // Sme needs to provide the Auth Resp |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 500 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 502 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len], |
| 503 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 504 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 505 | if (auth_resp_len == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 506 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 507 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | return; |
| 509 | } |
| 510 | |
| 511 | wrqu.data.length = str_len + auth_resp_len; |
| 512 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 513 | |
| 514 | kfree(buff); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 515 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 516 | } |
| 517 | |
| 518 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 519 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 520 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 521 | |
| 522 | /* |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 523 | * Send the ESE required "new AP Channel info" to the supplicant. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 524 | * (This keeps the supplicant "up to date" on the current channel.) |
| 525 | * |
| 526 | * The current (new AP) channel information is passed in. |
| 527 | */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 528 | static void hdd_SendNewAPChannelInfo(struct net_device *dev, hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 529 | tCsrRoamInfo *pCsrRoamInfo) |
| 530 | { |
| 531 | union iwreq_data wrqu; |
| 532 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 533 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 534 | |
| 535 | if (descriptor == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 536 | { |
| 537 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 538 | "%s: pCsrRoamInfo->pBssDesc=%p", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 539 | __func__, descriptor); |
| 540 | return; |
| 541 | } |
| 542 | |
| 543 | // 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] | 544 | hddLog(LOGW, "%s: Sending up an SIOCGIWFREQ, channelId=%d", __func__, descriptor->channelId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 545 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 546 | wrqu.freq.m = descriptor->channelId; |
| 547 | wrqu.freq.e = 0; |
| 548 | wrqu.freq.i = 0; |
| 549 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 550 | } |
| 551 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 552 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 553 | |
| 554 | void hdd_SendUpdateBeaconIEsEvent(hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo) |
| 555 | { |
| 556 | union iwreq_data wrqu; |
| 557 | u8 *pBeaconIes; |
| 558 | u8 currentLen = 0; |
| 559 | char *buff; |
| 560 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 561 | |
| 562 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 563 | |
| 564 | if (0 == pCsrRoamInfo->nBeaconLength) |
| 565 | { |
| 566 | hddLog(LOGE, "%s: pCsrRoamInfo->nBeaconFrameLength = 0", __func__); |
| 567 | return; |
| 568 | } |
| 569 | pBeaconIes = (u8 *)(pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 570 | if (pBeaconIes == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 571 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 572 | hddLog(LOGE, "%s: Beacon IEs is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 573 | return; |
| 574 | } |
| 575 | |
| 576 | // pBeaconIes needs to point to the IEs |
| 577 | hddLog(LOG1, "%s: Beacon IEs is now at %02x%02x", __func__, |
| 578 | (unsigned int)pBeaconIes[0], |
| 579 | (unsigned int)pBeaconIes[1]); |
| 580 | 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] | 581 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 582 | // We need to send the IEs to the supplicant. |
| 583 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 584 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 585 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 586 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 587 | return; |
| 588 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 589 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 590 | |
| 591 | strLen = strlcpy(buff,"BEACONIEs=", IW_CUSTOM_MAX); |
| 592 | currentLen = strLen + 1; |
| 593 | |
| 594 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 595 | do |
| 596 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 597 | /* 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] | 598 | * max size and send it to supplicant. Changes are done in supplicant to handle this */ |
| 599 | vos_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
| 600 | currentLen = VOS_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
| 601 | vos_mem_copy(&buff[strLen + 1], pBeaconIes+currentOffset, currentLen); |
| 602 | currentOffset += currentLen; |
| 603 | totalIeLen -= currentLen; |
| 604 | wrqu.data.length = strLen + 1 + currentLen; |
| 605 | if (totalIeLen) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 606 | buff[strLen] = 1; // This tells supplicant more chunks are pending |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 607 | else |
| 608 | buff[strLen] = 0; // For last chunk of beacon IE to supplicant |
| 609 | |
| 610 | hddLog(LOG1, "%s: Beacon IEs length to supplicant = %d", __func__, currentLen); |
| 611 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 612 | } while (totalIeLen > 0); |
| 613 | |
| 614 | kfree(buff); |
| 615 | } |
| 616 | |
| 617 | static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRoamInfo) |
| 618 | { |
| 619 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 620 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 621 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 622 | union iwreq_data wrqu; |
| 623 | int we_event; |
| 624 | char *msg; |
| 625 | int type = -1; |
| 626 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 627 | #if defined (WLAN_FEATURE_VOWIFI_11R) |
| 628 | // Added to find the auth type on the fly at run time |
| 629 | // rather than with cfg to see if FT is enabled |
| 630 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 631 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 632 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 633 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 634 | memset(&wrqu, '\0', sizeof(wrqu)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 635 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 636 | we_event = SIOCGIWAP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 637 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 638 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
| 639 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 640 | /* In case of roaming ; We are not doing disconnect. |
| 641 | * If disconnect is not being done for roam; We will not |
| 642 | * decrease count for Active sessions. We should not increase active |
| 643 | * active session in case of roaming. |
| 644 | */ |
Padma, Santhosh Kumar | 87ba40f | 2014-11-26 19:40:15 +0530 | [diff] [blame] | 645 | if((pHddStaCtx->ft_carrier_on == FALSE) && !pCsrRoamInfo->fReassocReq) |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 646 | { |
| 647 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
| 648 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 649 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 650 | type = WLAN_STA_ASSOC_DONE_IND; |
| 651 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 652 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 653 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 654 | { |
| 655 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_1) |
| 656 | { |
| 657 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTED_STATE_1; |
| 658 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 659 | "Connecting state to Connected State for 8-way " |
| 660 | "Handshake"); |
| 661 | } |
| 662 | else if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_2) |
| 663 | { |
| 664 | globalP2PConnectionStatus = P2P_CLIENT_COMPLETED_STATE; |
| 665 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 666 | "Connecting state to P2P Client Connection Completed"); |
| 667 | } |
| 668 | } |
| 669 | #endif |
Arif Hussain | 77d044f | 2014-01-03 19:56:04 -0800 | [diff] [blame] | 670 | pr_info("wlan: " MAC_ADDRESS_STR " connected to " MAC_ADDRESS_STR "\n", |
| 671 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
Kiet Lam | 3494745 | 2014-01-21 23:23:40 -0800 | [diff] [blame] | 672 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 673 | hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo); |
| 674 | |
| 675 | /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or |
| 676 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled |
| 677 | * and fFTEnable is TRUE */ |
| 678 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 679 | // Send FT Keys to the supplicant when FT is enabled |
| 680 | if ((pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN_PSK) || |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 681 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 682 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 683 | || (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 684 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) |
| 685 | #endif |
| 686 | ) |
| 687 | { |
| 688 | hdd_SendFTAssocResponse(dev, pAdapter, pCsrRoamInfo); |
| 689 | } |
| 690 | #endif |
| 691 | } |
| 692 | else if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) // IBss Associated |
| 693 | { |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 694 | wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 695 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 696 | type = WLAN_STA_ASSOC_DONE_IND; |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 697 | pr_info("wlan: new IBSS connection to " MAC_ADDRESS_STR"\n", |
| 698 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 699 | } |
| 700 | else /* Not Associated */ |
| 701 | { |
| 702 | pr_info("wlan: disconnected\n"); |
| 703 | type = WLAN_STA_DISASSOC_DONE_IND; |
| 704 | memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN); |
| 705 | } |
Sudhir Sattayappa Kohalli | 90e4c75 | 2013-03-21 14:25:04 -0700 | [diff] [blame] | 706 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 707 | |
| 708 | msg = NULL; |
| 709 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 710 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 711 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 712 | { |
| 713 | wireless_send_event(dev, we_event, &wrqu, msg); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 714 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 715 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 716 | { |
| 717 | if ( (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 718 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 719 | hdd_SendNewAPChannelInfo(dev, pAdapter, pCsrRoamInfo); |
| 720 | } |
| 721 | #endif |
| 722 | } |
| 723 | send_btc_nlink_msg(type, 0); |
| 724 | } |
| 725 | |
| 726 | void hdd_connRemoveConnectInfo( hdd_station_ctx_t *pHddStaCtx ) |
| 727 | { |
| 728 | // Remove staId, bssId and peerMacAddress |
| 729 | pHddStaCtx->conn_info.staId [ 0 ] = 0; |
| 730 | vos_mem_zero( &pHddStaCtx->conn_info.bssId, sizeof( v_MACADDR_t ) ); |
| 731 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], sizeof( v_MACADDR_t ) ); |
| 732 | |
| 733 | // Clear all security settings |
| 734 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 735 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 736 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 737 | |
| 738 | vos_mem_zero( &pHddStaCtx->conn_info.Keys, sizeof( tCsrKeys ) ); |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 739 | vos_mem_zero( &pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 740 | |
| 741 | // Set not-connected state |
| 742 | pHddStaCtx->conn_info.connDot11DesiredBssType = eCSR_BSS_TYPE_ANY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 743 | |
| 744 | vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) ); |
| 745 | } |
| 746 | /* TODO Revist this function. and data path */ |
| 747 | static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 748 | { |
| 749 | VOS_STATUS vosStatus; |
Ravi Joshi | f9520d6 | 2013-10-18 04:11:46 -0700 | [diff] [blame] | 750 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 751 | |
| 752 | if (WLAN_HDD_IBSS != pAdapter->device_mode) |
| 753 | { |
| 754 | hdd_disconnect_tx_rx(pAdapter); |
| 755 | } |
| 756 | else |
| 757 | { |
| 758 | // Need to cleanup all queues only if the last peer leaves |
| 759 | if (eConnectionState_IbssDisconnected == pHddStaCtx->conn_info.connState) |
| 760 | { |
| 761 | netif_tx_disable(pAdapter->dev); |
| 762 | netif_carrier_off(pAdapter->dev); |
| 763 | hdd_disconnect_tx_rx(pAdapter); |
| 764 | } |
| 765 | else |
| 766 | { |
| 767 | // There is atleast one more peer, do not cleanup all queues |
| 768 | hdd_flush_ibss_tx_queues(pAdapter, staId); |
| 769 | } |
| 770 | } |
| 771 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 772 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 773 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 774 | { |
Gopichand Nakkala | d786fa3 | 2013-03-20 23:48:19 +0530 | [diff] [blame] | 775 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 776 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 777 | "Status= %d [0x%08X]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 778 | __func__, staId, vosStatus, vosStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 779 | } |
| 780 | return( vosStatus ); |
| 781 | } |
| 782 | |
| 783 | |
| 784 | static eHalStatus hdd_DisConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 785 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 786 | eCsrRoamResult roamResult ) |
| 787 | { |
| 788 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 789 | VOS_STATUS vstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 790 | struct net_device *dev = pAdapter->dev; |
| 791 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 792 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 793 | v_U8_t sta_id; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 794 | v_BOOL_t sendDisconInd = TRUE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 795 | |
| 796 | // Sanity check |
| 797 | if(dev == NULL) |
| 798 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 799 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 800 | "%s: net_dev is released return", __func__); |
| 801 | return eHAL_STATUS_FAILURE; |
| 802 | } |
| 803 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 804 | // notify apps that we can't pass traffic anymore |
| 805 | netif_tx_disable(dev); |
| 806 | netif_carrier_off(dev); |
Mukul Sharma | 09ab4bd | 2014-11-24 18:07:26 +0530 | [diff] [blame] | 807 | //TxTimeoutCount need to reset in case of disconnect handler |
| 808 | pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 809 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 810 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 811 | /* HDD has initiated disconnect, do not send disconnect indication |
| 812 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 813 | */ |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 814 | /* If only STA mode is on */ |
| 815 | if((pHddCtx->concurrency_mode <= 1) && |
| 816 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <= 1)) |
| 817 | { |
| 818 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 819 | } |
| 820 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 821 | /* Need to apply spin lock before decreasing active sessions |
| 822 | * as there can be chance for double decrement if context switch |
| 823 | * Calls wlan_hdd_disconnect. |
| 824 | */ |
| 825 | |
| 826 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 827 | if ( eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState ) |
| 828 | { |
| 829 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 830 | FL(" HDD has initiated a disconnect, no need to send" |
| 831 | " disconnect indication to kernel")); |
| 832 | sendDisconInd = FALSE; |
| 833 | } |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 834 | else if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 835 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 836 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 837 | FL(" Set HDD connState to eConnectionState_Disconnecting from %d "), |
| 838 | pHddStaCtx->conn_info.connState); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 839 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 840 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 841 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 842 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
| 843 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 844 | hdd_clearRoamProfileIe( pAdapter ); |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 845 | |
| 846 | hdd_wmm_init( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 847 | |
| 848 | // indicate 'disconnect' status to wpa_supplicant... |
| 849 | hdd_SendAssociationEvent(dev,pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 850 | /* indicate disconnected event to nl80211 */ |
| 851 | if(roamStatus != eCSR_ROAM_IBSS_LEAVE) |
| 852 | { |
| 853 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 854 | driver so not sending the status of the connection to supplicant*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 855 | if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 856 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 857 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 858 | "%s: sent disconnected event to nl80211", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 859 | __func__); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 860 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 861 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 862 | { |
| 863 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTED_STATE_1) |
| 864 | { |
| 865 | globalP2PConnectionStatus = P2P_CLIENT_DISCONNECTED_STATE; |
| 866 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] 8 way Handshake completed " |
| 867 | "and moved to disconnected state"); |
| 868 | } |
| 869 | else if(globalP2PConnectionStatus == P2P_CLIENT_COMPLETED_STATE) |
| 870 | { |
| 871 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 872 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] P2P Client is removed " |
| 873 | "and moved to inactive state"); |
| 874 | } |
| 875 | } |
| 876 | #endif |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 877 | /*Only send indication to kernel if not initiated by kernel*/ |
| 878 | if ( sendDisconInd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 879 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 880 | /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */ |
| 881 | if ( eCSR_ROAM_LOSTLINK == roamStatus ) |
| 882 | { |
| 883 | cfg80211_disconnected(dev, pRoamInfo->reasonCode, NULL, 0, GFP_KERNEL); |
| 884 | } |
| 885 | else |
| 886 | { |
| 887 | cfg80211_disconnected(dev, WLAN_REASON_UNSPECIFIED, NULL, 0, GFP_KERNEL); |
| 888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 889 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 890 | //If the Device Mode is Station |
| 891 | // and the P2P Client is Connected |
| 892 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 893 | |
| 894 | // 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] | 895 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Sudhir Sattayappa Kohalli | b1d8c3a | 2013-06-18 14:47:20 -0700 | [diff] [blame] | 896 | if(VOS_STATUS_SUCCESS == hdd_issta_p2p_clientconnected(pHddCtx)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 897 | { |
| 898 | //Enable BMPS only of other Session is P2P Client |
| 899 | hdd_context_t *pHddCtx = NULL; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 900 | 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] | 901 | |
| 902 | if (NULL != pVosContext) |
| 903 | { |
| 904 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 905 | |
| 906 | if(NULL != pHddCtx) |
| 907 | { |
| 908 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 909 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 910 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 911 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 912 | if (pHddCtx->hdd_wlan_suspended) |
| 913 | { |
| 914 | hdd_set_pwrparams(pHddCtx); |
| 915 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 916 | hdd_enable_bmps_imps(pHddCtx); |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 917 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 918 | } |
| 919 | } |
| 920 | } |
| 921 | } |
| 922 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 923 | |
Madan Mohan Koyyalamudi | 70c52d3 | 2013-08-07 14:42:16 +0530 | [diff] [blame] | 924 | hdd_wmm_adapter_clear(pAdapter); |
Mukul Sharma | c159c43 | 2014-01-15 15:42:46 +0530 | [diff] [blame] | 925 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 926 | sme_FTReset(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
| 927 | #endif |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 928 | |
| 929 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) |
| 930 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 931 | v_U8_t i; |
| 932 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 933 | sta_id = IBSS_BROADCAST_STAID; |
| 934 | vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id ); |
| 935 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 936 | { |
| 937 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 938 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 939 | "Status= %d [0x%x]"), |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 940 | sta_id, status, status ); |
| 941 | |
| 942 | status = eHAL_STATUS_FAILURE; |
| 943 | } |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 944 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 945 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 946 | /*Clear all the peer sta register with TL.*/ |
| 947 | for (i =0; i < HDD_MAX_NUM_IBSS_STA; i++ ) |
| 948 | { |
| 949 | if (0 != pHddStaCtx->conn_info.staId[i]) |
| 950 | { |
| 951 | sta_id = pHddStaCtx->conn_info.staId[i]; |
| 952 | |
| 953 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 954 | FL("Deregister StaID %d"),sta_id); |
| 955 | vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id ); |
| 956 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 957 | { |
| 958 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 959 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 960 | "Status= %d [0x%x]"), |
| 961 | sta_id, status, status ); |
| 962 | status = eHAL_STATUS_FAILURE; |
| 963 | } |
| 964 | |
| 965 | /*set the staid and peer mac as 0, all other reset are |
| 966 | * done in hdd_connRemoveConnectInfo. |
| 967 | */ |
| 968 | pHddStaCtx->conn_info.staId[i]= 0; |
| 969 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[i], sizeof( v_MACADDR_t ) ); |
| 970 | |
| 971 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 972 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 973 | } |
| 974 | } |
| 975 | |
Katya Nigam | 63ce177 | 2014-09-26 15:53:49 +0530 | [diff] [blame] | 976 | } |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 977 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 978 | { |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 979 | sta_id = pHddStaCtx->conn_info.staId[0]; |
| 980 | |
| 981 | //We should clear all sta register with TL, for now, only one. |
| 982 | vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id ); |
| 983 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
| 984 | { |
| 985 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 986 | FL("hdd_roamDeregisterSTA() failed to for staID %d. " |
| 987 | "Status= %d [0x%x]"), |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 988 | sta_id, status, status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 989 | |
Abhishek Singh | 06e67ba | 2014-12-08 17:16:33 +0530 | [diff] [blame] | 990 | status = eHAL_STATUS_FAILURE; |
| 991 | } |
| 992 | |
| 993 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 994 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 995 | // Clear saved connection information in HDD |
| 996 | hdd_connRemoveConnectInfo( pHddStaCtx ); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 997 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 998 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 999 | __func__); |
| 1000 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected ); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1001 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 1002 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1003 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 1004 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1005 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 1006 | sizeof (tSirGtkOffloadParams)); |
| 1007 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1008 | } |
| 1009 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1010 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1011 | #ifdef FEATURE_WLAN_TDLS |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 1012 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1013 | { |
| 1014 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1015 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1016 | #endif |
| 1017 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1018 | //Unblock anyone waiting for disconnect to complete |
| 1019 | complete(&pAdapter->disconnect_comp_var); |
| 1020 | return( status ); |
| 1021 | } |
| 1022 | static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter, |
| 1023 | tCsrRoamInfo *pRoamInfo, |
| 1024 | v_U8_t staId, |
| 1025 | v_MACADDR_t *pPeerMacAddress, |
| 1026 | tSirBssDescription *pBssDesc ) |
| 1027 | { |
| 1028 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 1029 | WLAN_STADescType staDesc = {0}; |
| 1030 | eCsrEncryptionType connectedCipherAlgo; |
| 1031 | v_BOOL_t fConnected; |
| 1032 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1033 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 1034 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1035 | |
| 1036 | if ( NULL == pBssDesc) |
| 1037 | { |
| 1038 | return VOS_STATUS_E_FAILURE; |
| 1039 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1040 | // Get the Station ID from the one saved during the assocation. |
| 1041 | staDesc.ucSTAId = staId; |
| 1042 | |
| 1043 | if ( pHddStaCtx->conn_info.connDot11DesiredBssType == eMib_dot11DesiredBssType_infrastructure) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1044 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1045 | staDesc.wSTAType = WLAN_STA_INFRA; |
| 1046 | |
| 1047 | // grab the bssid from the connection info in the adapter structure and hand that |
| 1048 | // over to TL when registering. |
| 1049 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId,sizeof(pHddStaCtx->conn_info.bssId) ); |
| 1050 | } |
| 1051 | else |
| 1052 | { |
| 1053 | // for an IBSS 'connect', setup the Station Descriptor for TL. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1054 | staDesc.wSTAType = WLAN_STA_IBSS; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1055 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1056 | // Note that for IBSS, the STA MAC address and BSSID are goign to be different where |
| 1057 | // in infrastructure, they are the same (BSSID is the MAC address of the AP). So, |
| 1058 | // for IBSS we have a second field to pass to TL in the STA descriptor that we don't |
| 1059 | // pass when making an Infrastructure connection. |
| 1060 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes) ); |
| 1061 | vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 ); |
| 1062 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1063 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1064 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 1065 | |
| 1066 | // set the QoS field appropriately |
| 1067 | if (hdd_wmm_is_active(pAdapter)) |
| 1068 | { |
| 1069 | staDesc.ucQosEnabled = 1; |
| 1070 | } |
| 1071 | else |
| 1072 | { |
| 1073 | staDesc.ucQosEnabled = 0; |
| 1074 | } |
| 1075 | |
| 1076 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 1077 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 1078 | { |
| 1079 | staDesc.ucProtectedFrame = 1; |
| 1080 | } |
| 1081 | else |
| 1082 | { |
| 1083 | staDesc.ucProtectedFrame = 0; |
| 1084 | |
| 1085 | } |
| 1086 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1087 | #ifdef FEATURE_WLAN_ESE |
| 1088 | staDesc.ucIsEseSta = pRoamInfo->isESEAssoc; |
| 1089 | #endif //FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1090 | |
| 1091 | #ifdef VOLANS_ENABLE_SW_REPLAY_CHECK |
| 1092 | /* check whether replay check is valid for the station or not */ |
| 1093 | if( (eCSR_ENCRYPT_TYPE_TKIP == connectedCipherAlgo) || (eCSR_ENCRYPT_TYPE_AES == connectedCipherAlgo)) |
| 1094 | { |
| 1095 | /* Encryption mode is either TKIP or AES |
| 1096 | and replay check is valid for only these |
| 1097 | two encryption modes */ |
| 1098 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 1099 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1100 | "HDD register TL ucIsReplayCheckValid %d: Replay check is needed for station", staDesc.ucIsReplayCheckValid); |
| 1101 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1102 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1103 | else |
| 1104 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1105 | /* For other encryption modes replay check is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1106 | not needed */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1107 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1108 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1109 | "HDD register TL ucIsReplayCheckValid %d", staDesc.ucIsReplayCheckValid); |
| 1110 | } |
| 1111 | #endif |
| 1112 | |
| 1113 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1114 | hddLog(LOG1, "%s: WAPI STA Registered: %d", __func__, pAdapter->wapi_info.fIsWapiSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1115 | if (pAdapter->wapi_info.fIsWapiSta) |
| 1116 | { |
| 1117 | staDesc.ucIsWapiSta = 1; |
| 1118 | } |
| 1119 | else |
| 1120 | { |
| 1121 | staDesc.ucIsWapiSta = 0; |
| 1122 | } |
| 1123 | #endif /* FEATURE_WLAN_WAPI */ |
| 1124 | |
| 1125 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 1126 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
| 1127 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1128 | // UMA is Not ready yet, Xlation will be done by TL |
| 1129 | staDesc.ucSwFrameTXXlation = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1130 | staDesc.ucSwFrameRXXlation = 1; |
| 1131 | staDesc.ucAddRmvLLC = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1132 | 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] | 1133 | staDesc.ucQosEnabled ); |
| 1134 | // Initialize signatures and state |
| 1135 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 1136 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 1137 | staDesc.ucInitState = pRoamInfo->fAuthRequired ? |
| 1138 | WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1139 | // Register the Station with TL... |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 1140 | 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] | 1141 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 1142 | hdd_rx_packet_cbk, |
| 1143 | hdd_tx_complete_cbk, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1144 | hdd_tx_fetch_packet_cbk, &staDesc, |
| 1145 | pBssDesc->rssi ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1146 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1147 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1148 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1149 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1150 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1151 | vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1152 | return vosStatus; |
| 1153 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1154 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 1155 | if ( cfg_param->dynSplitscan && |
| 1156 | ( VOS_TIMER_STATE_RUNNING != |
| 1157 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr))) |
| 1158 | { |
| 1159 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 1160 | cfg_param->trafficMntrTmrForSplitScan); |
| 1161 | } |
| 1162 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 1163 | // if (WPA), tell TL to go to 'connected' and after keys come to the driver, |
| 1164 | // then go to 'authenticated'. For all other authentication types |
| 1165 | // (those that donot require upper layer authentication) we can put |
| 1166 | // TL directly into 'authenticated' state. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1167 | if (staDesc.wSTAType != WLAN_STA_IBSS) |
| 1168 | VOS_ASSERT( fConnected ); |
| 1169 | |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 1170 | if ( !pRoamInfo->fAuthRequired ) |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 1171 | { |
| 1172 | // Connections that do not need Upper layer auth, transition TL directly |
| 1173 | // to 'Authenticated' state. |
| 1174 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
| 1175 | WLANTL_STA_AUTHENTICATED ); |
| 1176 | |
| 1177 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 1178 | } |
| 1179 | else |
| 1180 | { |
| 1181 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 1182 | "ULA auth StaId= %d. Changing TL state to CONNECTED" |
| 1183 | "at Join time", pHddStaCtx->conn_info.staId[0] ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 1184 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 1185 | WLANTL_STA_CONNECTED ); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 1186 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 1187 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1188 | return( vosStatus ); |
| 1189 | } |
| 1190 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1191 | static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 1192 | tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength) |
| 1193 | { |
| 1194 | unsigned int len = 0; |
| 1195 | u8 *pFTAssocRsp = NULL; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1196 | v_U8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1197 | tANI_U32 rspRsnLength = 0; |
| 1198 | struct ieee80211_channel *chan; |
| 1199 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1200 | if (!rspRsnIe) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1201 | hddLog(LOGE, "%s: Unable to allocate RSN IE", __func__); |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 1202 | return; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1203 | } |
| 1204 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1205 | if (pCsrRoamInfo == NULL) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1206 | hddLog(LOGE, "%s: Invalid CSR roam info", __func__); |
| 1207 | goto done; |
| 1208 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1209 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1210 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1211 | hddLog(LOGE, "%s: Invalid assoc response length", __func__); |
| 1212 | goto done; |
| 1213 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1214 | |
| 1215 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 1216 | pCsrRoamInfo->nAssocReqLength); |
| 1217 | if (pFTAssocRsp == NULL) |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1218 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1219 | |
| 1220 | //pFTAssocRsp needs to point to the IEs |
| 1221 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1222 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1223 | (unsigned int)pFTAssocRsp[0], |
| 1224 | (unsigned int)pFTAssocRsp[1]); |
| 1225 | |
| 1226 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
Madan Mohan Koyyalamudi | 1bed23d | 2012-11-13 10:59:48 -0800 | [diff] [blame] | 1227 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1228 | rspRsnLength = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1229 | memcpy(rspRsnIe, pFTAssocRsp, len); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1230 | memset(rspRsnIe + len, 0, IW_GENERIC_IE_MAX - len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1231 | |
| 1232 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, (int) pCsrRoamInfo->pBssDesc->channelId); |
| 1233 | cfg80211_roamed(dev,chan,pCsrRoamInfo->bssid, |
| 1234 | reqRsnIe, reqRsnLength, |
| 1235 | rspRsnIe, rspRsnLength,GFP_KERNEL); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1236 | |
| 1237 | done: |
| 1238 | kfree(rspRsnIe); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1239 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1240 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1241 | void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter) |
| 1242 | { |
| 1243 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 1244 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1245 | tCsrRoamInfo roamInfo; |
| 1246 | roamInfo.fAuthRequired = FALSE; |
| 1247 | vos_mem_copy(roamInfo.bssid, |
| 1248 | pHddStaCtx->roam_info.bssid, |
| 1249 | WNI_CFG_BSSID_LEN); |
| 1250 | vos_mem_copy(roamInfo.peerMac, |
| 1251 | pHddStaCtx->roam_info.peerMac, |
| 1252 | WNI_CFG_BSSID_LEN); |
| 1253 | |
| 1254 | halStatus = hdd_RoamSetKeyCompleteHandler(pAdapter, |
| 1255 | &roamInfo, |
| 1256 | pHddStaCtx->roam_info.roamId, |
| 1257 | pHddStaCtx->roam_info.roamStatus, |
| 1258 | eCSR_ROAM_RESULT_AUTHENTICATED); |
| 1259 | if (halStatus != eHAL_STATUS_SUCCESS) |
| 1260 | { |
| 1261 | hddLog(LOGE, "%s: Set Key complete failure", __func__); |
| 1262 | } |
| 1263 | pHddStaCtx->roam_info.deferKeyComplete = FALSE; |
| 1264 | } |
| 1265 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1266 | static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1267 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1268 | eCsrRoamResult roamResult ) |
| 1269 | { |
| 1270 | struct net_device *dev = pAdapter->dev; |
| 1271 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1272 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 1273 | hdd_adapter_t *pHostapdAdapter = NULL; |
Girish Gowli | 257a7e6 | 2014-08-02 15:50:43 +0530 | [diff] [blame] | 1274 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 1275 | v_U8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 1276 | tANI_U32 reqRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1277 | #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] | 1278 | int ft_carrier_on = FALSE; |
| 1279 | #endif |
| 1280 | int status; |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1281 | v_BOOL_t hddDisconInProgress = FALSE; |
| 1282 | |
| 1283 | /* HDD has initiated disconnect, do not send connect result indication |
| 1284 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 1285 | */ |
| 1286 | if(( eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) && |
| 1287 | (( eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 1288 | ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus)) ) |
| 1289 | { |
| 1290 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1291 | FL(" Disconnect from HDD in progress ")); |
| 1292 | hddDisconInProgress = TRUE; |
| 1293 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1294 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1295 | if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult ) |
| 1296 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1297 | if ( !hddDisconInProgress ) |
| 1298 | { |
| 1299 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 1300 | "%s: Set HDD connState to eConnectionState_Associated", |
| 1301 | __func__); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1302 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Associated ); |
| 1303 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1304 | |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 1305 | pAdapter->maxRateFlags = pRoamInfo->maxRateFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1306 | // Save the connection info from CSR... |
| 1307 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE ); |
| 1308 | #ifdef FEATURE_WLAN_WAPI |
| 1309 | if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE || |
| 1310 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK ) |
| 1311 | { |
| 1312 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 1313 | } |
| 1314 | else |
| 1315 | { |
| 1316 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 1317 | } |
| 1318 | #endif /* FEATURE_WLAN_WAPI */ |
| 1319 | |
| 1320 | // indicate 'connect' status to userspace |
| 1321 | hdd_SendAssociationEvent(dev,pRoamInfo); |
| 1322 | |
| 1323 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1324 | // Initialize the Linkup event completion variable |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1325 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 1326 | |
| 1327 | /* |
| 1328 | Sometimes Switching ON the Carrier is taking time to activate the device properly. Before allowing any |
| 1329 | 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] | 1330 | 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] | 1331 | know that the device is getting activated properly. |
| 1332 | */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1333 | #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] | 1334 | if (pHddStaCtx->ft_carrier_on == FALSE && !hddDisconInProgress ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1335 | { |
| 1336 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1337 | // 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] | 1338 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 1339 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1340 | // 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] | 1341 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 1342 | |
| 1343 | // Switch on the Carrier to activate the device |
| 1344 | netif_carrier_on(dev); |
| 1345 | |
| 1346 | // Wait for the Link to up to ensure all the queues are set properly by the kernel |
| 1347 | status = wait_for_completion_interruptible_timeout(&pAdapter->linkup_event_var, |
| 1348 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1349 | if(!status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1350 | { |
| 1351 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning:ASSOC_LINKUP_TIMEOUT", __func__); |
| 1352 | } |
| 1353 | |
| 1354 | // Disable Linkup Event Servicing - no more service required from the net device notifier call |
| 1355 | pAdapter->isLinkUpSvcNeeded = FALSE; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1356 | #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] | 1357 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1358 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1359 | pHddStaCtx->ft_carrier_on = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1360 | ft_carrier_on = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1361 | } |
| 1362 | #endif |
Sandeep Puligilla | d91dccb | 2014-06-18 11:51:48 +0530 | [diff] [blame] | 1363 | /* Check for STAID */ |
| 1364 | if( (WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId ) |
| 1365 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 1366 | else |
| 1367 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Wrong Staid: %d", __func__, pRoamInfo->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1368 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1369 | #ifdef FEATURE_WLAN_TDLS |
| 1370 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 1371 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1372 | //For reassoc, the station is already registered, all we need is to change the state |
| 1373 | //of the STA in TL. |
| 1374 | //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] | 1375 | //pRoamInfo->fReassocReq will be set only for the reassoc to same ap |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1376 | if( !pRoamInfo->fReassocReq ) |
| 1377 | { |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1378 | struct cfg80211_bss *bss; |
| 1379 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1380 | u8 *pFTAssocRsp = NULL; |
| 1381 | unsigned int assocRsplen = 0; |
| 1382 | u8 *pFTAssocReq = NULL; |
| 1383 | unsigned int assocReqlen = 0; |
| 1384 | struct ieee80211_channel *chan; |
| 1385 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1386 | v_U8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1387 | tANI_U32 rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1388 | |
| 1389 | /* add bss_id to cfg80211 data base */ |
| 1390 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 1391 | if (NULL == bss) |
| 1392 | { |
| 1393 | pr_err("wlan: Not able to create BSS entry\n"); |
Katya Nigam | 346d4e9 | 2014-09-02 16:16:12 +0530 | [diff] [blame] | 1394 | netif_carrier_off(dev); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1395 | return eHAL_STATUS_FAILURE; |
| 1396 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1397 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1398 | if(pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN || |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1399 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN_PSK ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1400 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1401 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1402 | //Association Response |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1403 | pFTAssocRsp = (u8 *)(pRoamInfo->pbFrames + pRoamInfo->nBeaconLength + |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1404 | pRoamInfo->nAssocReqLength); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1405 | if (pFTAssocRsp != NULL) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1406 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1407 | // pFTAssocRsp needs to point to the IEs |
| 1408 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 1409 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 1410 | (unsigned int)pFTAssocRsp[0], |
| 1411 | (unsigned int)pFTAssocRsp[1]); |
| 1412 | assocRsplen = pRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1413 | } |
| 1414 | else |
| 1415 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1416 | hddLog(LOGE, "%s:AssocRsp is NULL", __func__); |
| 1417 | assocRsplen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1418 | } |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1419 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1420 | //Association Request |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1421 | pFTAssocReq = (u8 *)(pRoamInfo->pbFrames + |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1422 | pRoamInfo->nBeaconLength); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1423 | if (pFTAssocReq != NULL) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1424 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1425 | if(!ft_carrier_on) |
| 1426 | { |
| 1427 | // pFTAssocReq needs to point to the IEs |
| 1428 | pFTAssocReq += FT_ASSOC_REQ_IES_OFFSET; |
| 1429 | hddLog(LOG1, "%s: pFTAssocReq is now at %02x%02x", __func__, |
| 1430 | (unsigned int)pFTAssocReq[0], |
| 1431 | (unsigned int)pFTAssocReq[1]); |
| 1432 | assocReqlen = pRoamInfo->nAssocReqLength - FT_ASSOC_REQ_IES_OFFSET; |
| 1433 | } |
| 1434 | else |
| 1435 | { |
| 1436 | /* This should contain only the FTIEs */ |
| 1437 | assocReqlen = pRoamInfo->nAssocReqLength; |
| 1438 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1439 | } |
| 1440 | else |
| 1441 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1442 | hddLog(LOGE, "%s:AssocReq is NULL", __func__); |
| 1443 | assocReqlen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1444 | } |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1445 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1446 | if(ft_carrier_on) |
| 1447 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1448 | if ( !hddDisconInProgress ) |
| 1449 | { |
| 1450 | hddLog(LOG1, "%s ft_carrier_on is %d, sending roamed " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1451 | "indication", __FUNCTION__, ft_carrier_on); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1452 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1453 | (int)pRoamInfo->pBssDesc->channelId); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1454 | hddLog(LOG1, "assocReqlen %d assocRsplen %d", assocReqlen, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1455 | assocRsplen); |
Girish Gowli | df0ed73 | 2014-08-11 12:39:39 +0530 | [diff] [blame] | 1456 | #ifdef DEBUG_ROAM_DELAY |
| 1457 | //HACK we are using the buff len as Auth Type |
| 1458 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 1459 | #endif |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1460 | cfg80211_roamed(dev,chan, pRoamInfo->bssid, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1461 | pFTAssocReq, assocReqlen, pFTAssocRsp, assocRsplen, |
| 1462 | GFP_KERNEL); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1463 | } |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 1464 | if (sme_GetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 1465 | { |
| 1466 | sme_SetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter), FALSE); |
| 1467 | pRoamInfo->fAuthRequired = FALSE; |
| 1468 | |
| 1469 | vos_mem_copy(pHddStaCtx->roam_info.bssid, |
| 1470 | pRoamInfo->bssid, |
| 1471 | HDD_MAC_ADDR_LEN); |
| 1472 | vos_mem_copy(pHddStaCtx->roam_info.peerMac, |
| 1473 | pRoamInfo->peerMac, |
| 1474 | HDD_MAC_ADDR_LEN); |
| 1475 | pHddStaCtx->roam_info.roamId = roamId; |
| 1476 | pHddStaCtx->roam_info.roamStatus = roamStatus; |
| 1477 | pHddStaCtx->roam_info.deferKeyComplete = TRUE; |
| 1478 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1479 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1480 | else if ( !hddDisconInProgress ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1481 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1482 | hddLog(LOG1, "%s ft_carrier_on is %d, sending connect " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1483 | "indication", __FUNCTION__, ft_carrier_on); |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1484 | cfg80211_connect_result(dev, pRoamInfo->bssid, |
| 1485 | pFTAssocReq, assocReqlen, |
| 1486 | pFTAssocRsp, assocRsplen, |
| 1487 | WLAN_STATUS_SUCCESS, |
| 1488 | GFP_KERNEL); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1489 | } |
| 1490 | } |
| 1491 | else |
| 1492 | #endif |
| 1493 | { |
| 1494 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 1495 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1496 | pAdapter->sessionId, |
| 1497 | &reqRsnLength, |
| 1498 | reqRsnIe); |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1499 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1500 | csrRoamGetWpaRsnRspIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1501 | pAdapter->sessionId, |
| 1502 | &rspRsnLength, |
| 1503 | rspRsnIe); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1504 | if ( !hddDisconInProgress ) |
| 1505 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1506 | #if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1507 | if(ft_carrier_on) |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 1508 | { |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1509 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 1510 | #ifdef DEBUG_ROAM_DELAY |
| 1511 | //HACK we are using the buff len as Auth Type |
| 1512 | vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); |
| 1513 | #endif |
| 1514 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1515 | else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1516 | #endif /* FEATURE_WLAN_ESE */ |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1517 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1518 | { |
| 1519 | hddLog(VOS_TRACE_LEVEL_INFO, |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 1520 | "%s: sending connect indication to nl80211:" |
| 1521 | " for bssid " MAC_ADDRESS_STR |
| 1522 | " reason:%d and Status:%d\n", |
| 1523 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
| 1524 | roamResult, roamStatus); |
| 1525 | |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1526 | /* inform connect result to nl80211 */ |
| 1527 | cfg80211_connect_result(dev, pRoamInfo->bssid, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1528 | reqRsnIe, reqRsnLength, |
| 1529 | rspRsnIe, rspRsnLength, |
| 1530 | WLAN_STATUS_SUCCESS, |
| 1531 | GFP_KERNEL); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1532 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1534 | } |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1535 | if ( !hddDisconInProgress ) |
| 1536 | { |
| 1537 | cfg80211_put_bss( |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 1538 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1539 | pHddCtx->wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 1540 | #endif |
| 1541 | bss); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1542 | // Register the Station with TL after associated... |
| 1543 | vosStatus = hdd_roamRegisterSTA( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1544 | pRoamInfo, |
| 1545 | pHddStaCtx->conn_info.staId[ 0 ], |
| 1546 | NULL, |
| 1547 | pRoamInfo->pBssDesc ); |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1548 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1549 | } |
| 1550 | else |
| 1551 | { |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 1552 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 1553 | /* in case of reassociation also need to indicate it to supplicant */ |
| 1554 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1555 | pAdapter->sessionId, |
| 1556 | &reqRsnLength, |
| 1557 | reqRsnIe); |
| 1558 | |
| 1559 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1560 | //Reassoc successfully |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 1561 | if( pRoamInfo->fAuthRequired ) |
| 1562 | { |
| 1563 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 1564 | pHddStaCtx->conn_info.staId[ 0 ], |
| 1565 | WLANTL_STA_CONNECTED ); |
| 1566 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 1567 | } |
| 1568 | else |
| 1569 | { |
| 1570 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1571 | "%s: staId: %d Changing TL state to AUTHENTICATED", |
| 1572 | __func__, pHddStaCtx->conn_info.staId[ 0 ] ); |
| 1573 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 1574 | pHddStaCtx->conn_info.staId[ 0 ], |
| 1575 | WLANTL_STA_AUTHENTICATED ); |
| 1576 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 1577 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1578 | } |
| 1579 | |
| 1580 | if ( VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1581 | { |
| 1582 | // perform any WMM-related association processing |
| 1583 | hdd_wmm_assoc(pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 1584 | } |
| 1585 | else |
| 1586 | { |
| 1587 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1588 | "Cannot register STA with TL. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1589 | vosStatus, vosStatus ); |
| 1590 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1591 | #ifdef WLAN_FEATURE_11W |
| 1592 | vos_mem_zero( &pAdapter->hdd_stats.hddPmfStats, |
| 1593 | sizeof(pAdapter->hdd_stats.hddPmfStats) ); |
| 1594 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1595 | // Start the Queue |
Katya Nigam | b130d57 | 2014-11-24 16:38:16 +0530 | [diff] [blame] | 1596 | if ( !hddDisconInProgress ) |
| 1597 | netif_tx_wake_all_queues(dev); |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 1598 | #ifdef DEBUG_ROAM_DELAY |
| 1599 | vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0); |
| 1600 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1601 | } |
| 1602 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1603 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1604 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 1605 | |
| 1606 | 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] | 1607 | if (pRoamInfo) |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1608 | pr_info("wlan: connection failed with " MAC_ADDRESS_STR |
| 1609 | " reason:%d and Status:%d\n", |
| 1610 | MAC_ADDR_ARRAY(pRoamInfo->bssid), |
| 1611 | roamResult, roamStatus); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 1612 | else |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1613 | pr_info("wlan: connection failed with " MAC_ADDRESS_STR |
| 1614 | " reason:%d and Status:%d\n", |
| 1615 | MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 1616 | roamResult, roamStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1617 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 1618 | /* Set connection state to eConnectionState_NotConnected only when CSR |
| 1619 | * has completed operation - with a ASSOCIATION_FAILURE status |
| 1620 | */ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1621 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 1622 | { |
| 1623 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1624 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 1625 | __func__); |
| 1626 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected); |
| 1627 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1628 | if((pHddCtx->concurrency_mode <= 1) && |
| 1629 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1630 | { |
| 1631 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 1632 | } |
| 1633 | |
| 1634 | //If the Device Mode is Station |
| 1635 | // and the P2P Client is Connected |
| 1636 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1637 | |
| 1638 | // 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] | 1639 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1640 | if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1641 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1642 | (vos_concurrent_open_sessions_running())) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1643 | { |
| 1644 | //Enable BMPS only of other Session is P2P Client |
| 1645 | hdd_context_t *pHddCtx = NULL; |
| 1646 | v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); |
| 1647 | |
| 1648 | if (NULL != pVosContext) |
| 1649 | { |
| 1650 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 1651 | |
| 1652 | if(NULL != pHddCtx) |
| 1653 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1654 | //Only P2P Client is there Enable Bmps back |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 1655 | if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) && |
| 1656 | (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE])) |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1657 | { |
| 1658 | if (pHddCtx->hdd_wlan_suspended) |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 1659 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1660 | hdd_set_pwrparams(pHddCtx); |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 1661 | } |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1662 | hdd_enable_bmps_imps(pHddCtx); |
| 1663 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1664 | } |
| 1665 | } |
| 1666 | } |
| 1667 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 1668 | /* CR465478: Only send up a connection failure result when CSR has |
Varun Reddy Yeturu | da7f0d5 | 2013-12-20 11:16:57 -0800 | [diff] [blame] | 1669 | * completed operation - with a ASSOCIATION_FAILURE status.*/ |
Abhishek Singh | a6cfaa4 | 2014-06-23 13:11:07 +0530 | [diff] [blame] | 1670 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1671 | { |
Deepthi Gowri | 6649f6a | 2014-02-18 17:31:23 +0530 | [diff] [blame] | 1672 | if (pRoamInfo) |
| 1673 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1674 | "%s: send connect failure to nl80211:" |
| 1675 | " for bssid " MAC_ADDRESS_STR |
| 1676 | " reason:%d and Status:%d\n" , |
| 1677 | __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid), |
| 1678 | roamResult, roamStatus); |
| 1679 | else |
| 1680 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1681 | "%s: connect failed:" |
| 1682 | " for bssid " MAC_ADDRESS_STR |
| 1683 | " reason:%d and Status:%d\n" , |
| 1684 | __func__, MAC_ADDR_ARRAY(pWextState->req_bssId), |
| 1685 | roamResult, roamStatus); |
| 1686 | |
c_hpothu | daa90e2 | 2014-06-24 17:23:43 +0530 | [diff] [blame] | 1687 | /*Clear the roam profile*/ |
| 1688 | hdd_clearRoamProfileIe( pAdapter ); |
| 1689 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 1690 | /* inform association failure event to nl80211 */ |
| 1691 | if ( eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult ) |
| 1692 | { |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 1693 | if (pRoamInfo) |
| 1694 | cfg80211_connect_result ( dev, pRoamInfo->bssid, |
| 1695 | NULL, 0, NULL, 0, |
| 1696 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
| 1697 | GFP_KERNEL ); |
| 1698 | else |
| 1699 | cfg80211_connect_result ( dev, pWextState->req_bssId, |
| 1700 | NULL, 0, NULL, 0, |
| 1701 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
| 1702 | GFP_KERNEL ); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 1703 | } |
| 1704 | else |
| 1705 | { |
Sushant Kaushik | 21f2823 | 2014-12-18 11:42:46 +0530 | [diff] [blame] | 1706 | if (pRoamInfo){ |
| 1707 | eCsrAuthType authType = |
| 1708 | pWextState->roamProfile.AuthType.authType[0]; |
| 1709 | v_BOOL_t isWep = (authType == eCSR_AUTH_TYPE_OPEN_SYSTEM) || |
| 1710 | (authType == eCSR_AUTH_TYPE_SHARED_KEY); |
| 1711 | |
| 1712 | /* In case of OPEN-WEP or SHARED-WEP authentication, |
| 1713 | * send exact protocol reason code. This enables user |
| 1714 | * applications to reconnect the station with correct |
| 1715 | * configuration. |
| 1716 | */ |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 1717 | cfg80211_connect_result ( dev, pRoamInfo->bssid, |
| 1718 | NULL, 0, NULL, 0, |
Sushant Kaushik | 21f2823 | 2014-12-18 11:42:46 +0530 | [diff] [blame] | 1719 | isWep ? pRoamInfo->reasonCode : |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 1720 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
| 1721 | GFP_KERNEL ); |
Sushant Kaushik | 21f2823 | 2014-12-18 11:42:46 +0530 | [diff] [blame] | 1722 | } else |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 1723 | cfg80211_connect_result ( dev, pWextState->req_bssId, |
| 1724 | NULL, 0, NULL, 0, |
| 1725 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
| 1726 | GFP_KERNEL ); |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 1727 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1728 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1729 | |
Kumar Anand | 82c009f | 2014-05-29 00:29:42 -0700 | [diff] [blame] | 1730 | hdd_wmm_init( pAdapter ); |
Madan Mohan Koyyalamudi | ee255f1 | 2012-09-28 15:41:19 -0700 | [diff] [blame] | 1731 | |
c_hpothu | 24f4098 | 2014-04-18 18:00:36 +0530 | [diff] [blame] | 1732 | if (pRoamInfo) |
| 1733 | { |
| 1734 | WLANTL_AssocFailed(pRoamInfo->staId); |
| 1735 | } |
Mihir Shete | b733727 | 2014-04-11 15:53:08 +0530 | [diff] [blame] | 1736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1737 | netif_tx_disable(dev); |
| 1738 | netif_carrier_off(dev); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1739 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1740 | } |
| 1741 | |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 1742 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 1743 | { |
| 1744 | pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP); |
| 1745 | if (pHostapdAdapter != NULL) |
| 1746 | { |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 1747 | /* Restart SAP if its operating channel is different |
| 1748 | * from AP channel. |
| 1749 | */ |
| 1750 | if (pHostapdAdapter->sessionCtx.ap.operatingChannel != |
| 1751 | (int)pRoamInfo->pBssDesc->channelId) |
| 1752 | { |
| 1753 | hddLog(VOS_TRACE_LEVEL_INFO,"Restart Sap as SAP channel is %d " |
| 1754 | "and STA channel is %d", pHostapdAdapter->sessionCtx.ap.operatingChannel, |
| 1755 | (int)pRoamInfo->pBssDesc->channelId); |
Deepthi Gowri | c9c777d | 2014-12-10 16:17:11 +0530 | [diff] [blame] | 1756 | hdd_hostapd_stop(pHostapdAdapter->dev); |
Sushant Kaushik | bf584e9 | 2014-08-06 17:59:20 +0530 | [diff] [blame] | 1757 | } |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 1758 | } |
| 1759 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1760 | return eHAL_STATUS_SUCCESS; |
| 1761 | } |
| 1762 | |
| 1763 | /**============================================================================ |
| 1764 | * |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1765 | @brief hdd_RoamIbssIndicationHandler() - Here we update the status of the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1766 | 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] | 1767 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1768 | ===========================================================================*/ |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1769 | static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter, |
| 1770 | tCsrRoamInfo *pRoamInfo, |
| 1771 | tANI_U32 roamId, |
| 1772 | eRoamCmdStatus roamStatus, |
| 1773 | eCsrRoamResult roamResult ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1774 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1775 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d", |
| 1776 | __func__, pAdapter->dev->name, roamId, roamStatus, roamResult); |
| 1777 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1778 | switch( roamResult ) |
| 1779 | { |
| 1780 | // both IBSS Started and IBSS Join should come in here. |
| 1781 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 1782 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 1783 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1784 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1785 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 1786 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1787 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1788 | if (NULL == pRoamInfo) |
| 1789 | { |
| 1790 | VOS_ASSERT(0); |
| 1791 | return; |
| 1792 | } |
| 1793 | |
| 1794 | /* When IBSS Started comes from CSR, we need to move |
| 1795 | * connection state to IBSS Disconnected (meaning no peers |
| 1796 | * are in the IBSS). |
| 1797 | */ |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 1798 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1799 | "%s: Set HDD connState to eConnectionState_IbssDisconnected", |
| 1800 | __func__); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1801 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 1802 | eConnectionState_IbssDisconnected ); |
Abhishek Singh | 1c21c4d | 2014-04-25 16:40:19 +0530 | [diff] [blame] | 1803 | /*notify wmm */ |
| 1804 | hdd_wmm_connect(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1805 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
| 1806 | hdd_roamRegisterSTA (pAdapter, pRoamInfo, |
| 1807 | IBSS_BROADCAST_STAID, |
| 1808 | &broadcastMacAddr, pRoamInfo->pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1809 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1810 | if (pRoamInfo->pBssDesc) |
| 1811 | { |
| 1812 | struct cfg80211_bss *bss; |
| 1813 | |
| 1814 | /* we created the IBSS, notify supplicant */ |
| 1815 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: created ibss " |
| 1816 | MAC_ADDRESS_STR, |
| 1817 | __func__, pAdapter->dev->name, |
| 1818 | MAC_ADDR_ARRAY(pRoamInfo->pBssDesc->bssId)); |
| 1819 | |
| 1820 | /* we must first give cfg80211 the BSS information */ |
| 1821 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 1822 | if (NULL == bss) |
| 1823 | { |
| 1824 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1825 | "%s: %s: unable to create IBSS entry", |
| 1826 | __func__, pAdapter->dev->name); |
| 1827 | return; |
| 1828 | } |
| 1829 | |
| 1830 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL); |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 1831 | cfg80211_put_bss( |
| 1832 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 1833 | pHddCtx->wiphy, |
| 1834 | #endif |
| 1835 | bss); |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1836 | } |
| 1837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1838 | break; |
| 1839 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1840 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1841 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 1842 | { |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1843 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unable to create IBSS", |
| 1844 | __func__, pAdapter->dev->name); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1845 | break; |
| 1846 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1847 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1848 | default: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1849 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unexpected result %d", |
| 1850 | __func__, pAdapter->dev->name, (int)roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1851 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1852 | } |
| 1853 | |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 1854 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1855 | } |
| 1856 | |
| 1857 | /**============================================================================ |
| 1858 | * |
| 1859 | @brief roamSaveIbssStation() - Save the IBSS peer MAC address in the adapter. |
| 1860 | This information is passed to iwconfig later. The peer that joined |
| 1861 | last is passed as information to iwconfig. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1862 | 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] | 1863 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1864 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1865 | ===========================================================================*/ |
| 1866 | static int roamSaveIbssStation( hdd_station_ctx_t *pHddStaCtx, v_U8_t staId, v_MACADDR_t *peerMacAddress ) |
| 1867 | { |
| 1868 | int fSuccess = FALSE; |
| 1869 | int idx = 0; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1870 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1871 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 1872 | { |
| 1873 | if ( 0 == pHddStaCtx->conn_info.staId[ idx ] ) |
| 1874 | { |
| 1875 | pHddStaCtx->conn_info.staId[ idx ] = staId; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1876 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1877 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ], peerMacAddress ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1878 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1879 | fSuccess = TRUE; |
| 1880 | break; |
| 1881 | } |
| 1882 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1883 | |
| 1884 | return( fSuccess ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1885 | } |
| 1886 | /**============================================================================ |
| 1887 | * |
| 1888 | @brief roamRemoveIbssStation() - Remove the IBSS peer MAC address in the adapter. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1889 | 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] | 1890 | return FALSE. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1891 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1892 | ===========================================================================*/ |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 1893 | static int roamRemoveIbssStation( hdd_adapter_t *pAdapter, v_U8_t staId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1894 | { |
| 1895 | int fSuccess = FALSE; |
| 1896 | int idx = 0; |
| 1897 | v_U8_t valid_idx = 0; |
| 1898 | v_U8_t del_idx = 0; |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 1899 | v_U8_t empty_slots = 0; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 1900 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1901 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1902 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 1903 | { |
| 1904 | if ( staId == pHddStaCtx->conn_info.staId[ idx ] ) |
| 1905 | { |
| 1906 | pHddStaCtx->conn_info.staId[ idx ] = 0; |
| 1907 | |
| 1908 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] ); |
| 1909 | |
| 1910 | fSuccess = TRUE; |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 1911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1912 | // Note the deleted Index, if its 0 we need special handling |
| 1913 | del_idx = idx; |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 1914 | |
| 1915 | empty_slots++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1916 | } |
| 1917 | else |
| 1918 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1919 | if (pHddStaCtx->conn_info.staId[idx] != 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1920 | { |
| 1921 | valid_idx = idx; |
| 1922 | } |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 1923 | else |
| 1924 | { |
| 1925 | // Found an empty slot |
| 1926 | empty_slots++; |
| 1927 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1928 | } |
| 1929 | } |
| 1930 | |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 1931 | if (HDD_MAX_NUM_IBSS_STA == empty_slots) |
| 1932 | { |
| 1933 | // Last peer departed, set the IBSS state appropriately |
| 1934 | pHddStaCtx->conn_info.connState = eConnectionState_IbssDisconnected; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 1935 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Ravi Joshi | 8a93435 | 2013-09-25 16:46:58 -0700 | [diff] [blame] | 1936 | "Last IBSS Peer Departed!!!" ); |
| 1937 | } |
| 1938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1939 | // Find next active staId, to have a valid sta trigger for TL. |
| 1940 | if (fSuccess == TRUE) |
| 1941 | { |
| 1942 | if (del_idx == 0) |
| 1943 | { |
| 1944 | if (pHddStaCtx->conn_info.staId[valid_idx] != 0) |
| 1945 | { |
| 1946 | pHddStaCtx->conn_info.staId[0] = pHddStaCtx->conn_info.staId[valid_idx]; |
| 1947 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], |
| 1948 | &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ]); |
| 1949 | |
| 1950 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
| 1951 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ] ); |
| 1952 | } |
| 1953 | } |
| 1954 | } |
| 1955 | return( fSuccess ); |
| 1956 | } |
| 1957 | |
| 1958 | /**============================================================================ |
| 1959 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1960 | @brief roamIbssConnectHandler() : We update the status of the IBSS to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1961 | connected in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1962 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1963 | ===========================================================================*/ |
| 1964 | static eHalStatus roamIbssConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo ) |
| 1965 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 1966 | struct cfg80211_bss *bss; |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 1967 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1968 | "%s: IBSS Connect Indication from SME!!! " |
| 1969 | "Set HDD connState to eConnectionState_IbssConnected", |
| 1970 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1971 | // Set the internal connection state to show 'IBSS Connected' (IBSS with a partner stations)... |
| 1972 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssConnected ); |
| 1973 | |
| 1974 | // Save the connection info from CSR... |
| 1975 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS ); |
| 1976 | |
| 1977 | // Send the bssid address to the wext. |
| 1978 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1979 | /* add bss_id to cfg80211 data base */ |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 1980 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 1981 | if (NULL == bss) |
| 1982 | { |
| 1983 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1984 | "%s: %s: unable to create IBSS entry", |
| 1985 | __func__, pAdapter->dev->name); |
| 1986 | return eHAL_STATUS_FAILURE; |
| 1987 | } |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 1988 | cfg80211_put_bss( |
| 1989 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 1990 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
| 1991 | #endif |
| 1992 | bss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1993 | |
| 1994 | return( eHAL_STATUS_SUCCESS ); |
| 1995 | } |
| 1996 | /**============================================================================ |
| 1997 | * |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 1998 | @brief hdd_ReConfigSuspendDataClearedDuringRoaming() - Reconfigure the |
| 1999 | suspend related data which was cleared during roaming in FWR. |
| 2000 | |
| 2001 | ===========================================================================*/ |
| 2002 | static void hdd_ReConfigSuspendDataClearedDuringRoaming(hdd_context_t *pHddCtx) |
| 2003 | { |
| 2004 | VOS_STATUS vstatus = VOS_STATUS_E_FAILURE; |
| 2005 | hdd_adapter_t *pAdapter; |
| 2006 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 2007 | ENTER(); |
| 2008 | |
| 2009 | spin_lock(&pHddCtx->filter_lock); |
| 2010 | if (VOS_FALSE == pHddCtx->sus_res_mcastbcast_filter_valid) |
| 2011 | { |
| 2012 | pHddCtx->sus_res_mcastbcast_filter = |
| 2013 | pHddCtx->configuredMcastBcastFilter; |
| 2014 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_TRUE; |
| 2015 | hddLog(VOS_TRACE_LEVEL_INFO, FL("offload: callback to associated")); |
| 2016 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2017 | FL("saving configuredMcastBcastFilter = %d"), |
| 2018 | pHddCtx->configuredMcastBcastFilter); |
| 2019 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2020 | FL("offload: calling hdd_conf_mcastbcast_filter")); |
| 2021 | } |
| 2022 | spin_unlock(&pHddCtx->filter_lock); |
| 2023 | |
| 2024 | hdd_conf_mcastbcast_filter(pHddCtx, TRUE); |
| 2025 | if(pHddCtx->hdd_mcastbcast_filter_set != TRUE) |
| 2026 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Not able to set mcast/bcast filter ")); |
| 2027 | |
| 2028 | vstatus = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 2029 | //No need to configure GTK Offload from here because it might possible |
| 2030 | //cfg80211_set_rekey_data might not yet came, anyway GTK offload will |
| 2031 | //be handled as part of cfg80211_set_rekey_data processing. |
| 2032 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == vstatus ) |
| 2033 | { |
| 2034 | pAdapter = pAdapterNode->pAdapter; |
| 2035 | if( pAdapter && |
| 2036 | (( pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 2037 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT))) |
| 2038 | { |
| 2039 | if (pHddCtx->cfg_ini->fhostArpOffload) |
| 2040 | { |
| 2041 | //Configure ARPOFFLOAD |
| 2042 | vstatus = hdd_conf_arp_offload(pAdapter, TRUE); |
| 2043 | if (!VOS_IS_STATUS_SUCCESS(vstatus)) |
| 2044 | { |
| 2045 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2046 | FL("Failed to disable ARPOffload Feature %d"), vstatus); |
| 2047 | } |
| 2048 | } |
| 2049 | #ifdef WLAN_NS_OFFLOAD |
| 2050 | //Configure NSOFFLOAD |
| 2051 | if (pHddCtx->cfg_ini->fhostNSOffload) |
| 2052 | { |
| 2053 | hdd_conf_ns_offload(pAdapter, TRUE); |
| 2054 | } |
| 2055 | #endif |
Mukul Sharma | 25e70c3 | 2014-05-22 12:50:24 +0530 | [diff] [blame] | 2056 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 2057 | /* During suspend, configure MC Addr list filter to the firmware |
| 2058 | * function takes care of checking necessary conditions before |
| 2059 | * configuring. |
| 2060 | */ |
| 2061 | wlan_hdd_set_mc_addr_list(pAdapter, TRUE); |
| 2062 | #endif |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 2063 | } |
| 2064 | vstatus = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 2065 | pAdapterNode = pNext; |
| 2066 | } |
| 2067 | EXIT(); |
| 2068 | } |
| 2069 | |
| 2070 | /**============================================================================ |
| 2071 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2072 | @brief hdd_RoamSetKeyCompleteHandler() - Update the security parameters. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2073 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2074 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2075 | static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 2076 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2077 | eCsrRoamResult roamResult ) |
| 2078 | { |
| 2079 | eCsrEncryptionType connectedCipherAlgo; |
| 2080 | v_BOOL_t fConnected = FALSE; |
| 2081 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 2082 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2083 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2084 | ENTER(); |
Srinivas Girigowda | 5a737f2 | 2013-06-28 15:21:48 -0700 | [diff] [blame] | 2085 | |
| 2086 | if (NULL == pRoamInfo) |
| 2087 | { |
| 2088 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "pRoamInfo is NULL"); |
| 2089 | return eHAL_STATUS_FAILURE; |
| 2090 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2091 | // 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] | 2092 | // then go to 'authenticated'. For all other authentication types (those that do |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2093 | // not require upper layer authentication) we can put TL directly into 'authenticated' |
| 2094 | // state. |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 2095 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2096 | "Set Key completion roamStatus =%d roamResult=%d " MAC_ADDRESS_STR, |
| 2097 | roamStatus, roamResult, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2098 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2099 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 2100 | if( fConnected ) |
| 2101 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 2102 | if ( WLAN_HDD_IBSS == pAdapter->device_mode ) |
| 2103 | { |
| 2104 | v_U8_t staId; |
| 2105 | |
| 2106 | v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER; |
| 2107 | |
| 2108 | if ( 0 == memcmp( pRoamInfo->peerMac, |
| 2109 | &broadcastMacAddr, VOS_MAC_ADDR_SIZE ) ) |
| 2110 | { |
| 2111 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 2112 | IBSS_BROADCAST_STAID); |
| 2113 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2114 | } |
| 2115 | else |
| 2116 | { |
| 2117 | vosStatus = hdd_Ibss_GetStaId(pHddStaCtx, |
| 2118 | (v_MACADDR_t*)pRoamInfo->peerMac, |
| 2119 | &staId); |
| 2120 | if ( VOS_STATUS_SUCCESS == vosStatus ) |
| 2121 | { |
| 2122 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2123 | "WLAN TL STA Ptk Installed for STAID=%d", staId); |
| 2124 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 2125 | staId); |
| 2126 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2127 | } |
| 2128 | } |
| 2129 | } |
| 2130 | else |
| 2131 | { |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2132 | // TODO: Considering getting a state machine in HDD later. |
| 2133 | // This routine is invoked twice. 1)set PTK 2)set GTK. |
| 2134 | // The folloing if statement will be TRUE when setting GTK. |
| 2135 | // At this time we don't handle the state in detail. |
| 2136 | // Related CR: 174048 - TL not in authenticated state |
| 2137 | if ( ( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) && |
| 2138 | (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired ) |
| 2139 | { |
| 2140 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set " |
| 2141 | "for StaId= %d. Changing TL state to AUTHENTICATED", |
| 2142 | pHddStaCtx->conn_info.staId[ 0 ] ); |
| 2143 | |
| 2144 | // Connections that do not need Upper layer authentication, |
| 2145 | // transition TL to 'Authenticated' state after the keys are set. |
| 2146 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 2147 | pHddStaCtx->conn_info.staId[ 0 ], |
| 2148 | WLANTL_STA_AUTHENTICATED ); |
| 2149 | |
| 2150 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
Mukul Sharma | d2589a5 | 2014-04-23 21:06:25 +0530 | [diff] [blame] | 2151 | //Need to call offload because when roaming happen at that time fwr |
| 2152 | //clean offload info as part of the DelBss |
| 2153 | // No need to configure offload if host was not suspended |
| 2154 | spin_lock(&pHddCtx->filter_lock); |
| 2155 | if(pHddCtx->hdd_wlan_suspended) |
| 2156 | { |
| 2157 | spin_unlock(&pHddCtx->filter_lock); |
| 2158 | hdd_ReConfigSuspendDataClearedDuringRoaming(pHddCtx); |
| 2159 | } |
| 2160 | else |
| 2161 | { |
| 2162 | spin_unlock(&pHddCtx->filter_lock); |
| 2163 | } |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2164 | #ifdef DEBUG_ROAM_DELAY |
| 2165 | vos_record_roam_event(e_HDD_SET_GTK_RSP, NULL, 0); |
| 2166 | #endif |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2167 | } |
| 2168 | else |
| 2169 | { |
| 2170 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 2171 | pHddStaCtx->conn_info.staId[ 0 ]); |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2172 | #ifdef DEBUG_ROAM_DELAY |
| 2173 | vos_record_roam_event(e_HDD_SET_PTK_RSP, (void *)pRoamInfo->peerMac, 6); |
| 2174 | #endif |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2175 | } |
| 2176 | |
| 2177 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 2178 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2179 | } |
Gopichand Nakkala | ecdebab | 2013-06-04 18:44:34 +0530 | [diff] [blame] | 2180 | else |
| 2181 | { |
| 2182 | // possible disassoc after issuing set key and waiting set key complete |
| 2183 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2184 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2185 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2186 | EXIT(); |
| 2187 | return( eHAL_STATUS_SUCCESS ); |
| 2188 | } |
| 2189 | /**============================================================================ |
| 2190 | * |
| 2191 | @brief hdd_RoamMicErrorIndicationHandler() - This function indicates the Mic failure to the supplicant. |
| 2192 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2193 | static eHalStatus hdd_RoamMicErrorIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2194 | tANI_U32 roamId, eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2195 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2196 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2197 | |
| 2198 | if( eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 2199 | TKIP_COUNTER_MEASURE_STOPED == pHddStaCtx->WextState.mTKIPCounterMeasures ) |
| 2200 | { |
| 2201 | struct iw_michaelmicfailure msg; |
| 2202 | union iwreq_data wreq; |
| 2203 | memset(&msg, '\0', sizeof(msg)); |
| 2204 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 2205 | 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] | 2206 | hddLog(LOG1, "MIC MAC " MAC_ADDRESS_STR, |
| 2207 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2208 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | if(pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) |
| 2210 | msg.flags = IW_MICFAILURE_GROUP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2211 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2212 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 2213 | memset(&wreq, 0, sizeof(wreq)); |
| 2214 | wreq.data.length = sizeof(msg); |
| 2215 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, (char *)&msg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2216 | /* inform mic failure to nl80211 */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2217 | cfg80211_michael_mic_failure(pAdapter->dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2218 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 2219 | ((pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) ? |
| 2220 | NL80211_KEYTYPE_GROUP : |
| 2221 | NL80211_KEYTYPE_PAIRWISE), |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2222 | pRoamInfo->u.pMICFailureInfo->keyId, |
| 2223 | pRoamInfo->u.pMICFailureInfo->TSC, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2224 | GFP_KERNEL); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2225 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2226 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2227 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2228 | return( eHAL_STATUS_SUCCESS ); |
| 2229 | } |
| 2230 | |
| 2231 | /**============================================================================ |
| 2232 | * |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2233 | @brief roamRoamConnectStatusUpdateHandler() - The Ibss connection status is |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2234 | updated regularly here in this function. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2235 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2236 | ===========================================================================*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2237 | static eHalStatus roamRoamConnectStatusUpdateHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 2238 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2239 | eCsrRoamResult roamResult ) |
| 2240 | { |
| 2241 | VOS_STATUS vosStatus; |
| 2242 | |
| 2243 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2244 | switch( roamResult ) |
| 2245 | { |
| 2246 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 2247 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2248 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2249 | struct station_info staInfo; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2250 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2251 | pr_info ( "IBSS New Peer indication from SME " |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2252 | "with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d", |
| 2253 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 2254 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2255 | pRoamInfo->staId ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2257 | if ( !roamSaveIbssStation( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pRoamInfo->staId, (v_MACADDR_t *)pRoamInfo->peerMac ) ) |
| 2258 | { |
| 2259 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2260 | "New IBSS peer but we already have the max we can handle. Can't register this one" ); |
| 2261 | break; |
| 2262 | } |
| 2263 | |
| 2264 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2265 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2266 | pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter; |
| 2267 | WLANTL_UpdateSTABssIdforIBSS(pHddCtx->pvosContext, |
| 2268 | IBSS_BROADCAST_STAID,pHddStaCtx->conn_info.bssId); |
| 2269 | |
| 2270 | // Register the Station with TL for the new peer. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2271 | vosStatus = hdd_roamRegisterSTA( pAdapter, |
| 2272 | pRoamInfo, |
| 2273 | pRoamInfo->staId, |
| 2274 | (v_MACADDR_t *)pRoamInfo->peerMac, |
| 2275 | pRoamInfo->pBssDesc ); |
| 2276 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2277 | { |
| 2278 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2279 | "Cannot register STA with TL for IBSS. Failed with vosStatus = %d [%08X]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2280 | vosStatus, vosStatus ); |
| 2281 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2282 | pHddStaCtx->ibss_sta_generation++; |
| 2283 | memset(&staInfo, 0, sizeof(staInfo)); |
| 2284 | staInfo.filled = 0; |
| 2285 | staInfo.generation = pHddStaCtx->ibss_sta_generation; |
| 2286 | |
| 2287 | cfg80211_new_sta(pAdapter->dev, |
| 2288 | (const u8 *)pRoamInfo->peerMac, |
| 2289 | &staInfo, GFP_KERNEL); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2290 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 2291 | if ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 2292 | ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddStaCtx->ibss_enc_key.encType |
| 2293 | ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType |
| 2294 | ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType ) |
| 2295 | { |
| 2296 | pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX; |
| 2297 | memcpy(&pHddStaCtx->ibss_enc_key.peerMac, |
| 2298 | pRoamInfo->peerMac, WNI_CFG_BSSID_LEN); |
| 2299 | |
| 2300 | VOS_TRACE( VOS_MODULE_ID_HDD, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2301 | VOS_TRACE_LEVEL_INFO_HIGH, "New peer joined set PTK encType=%d", |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 2302 | pHddStaCtx->ibss_enc_key.encType); |
| 2303 | |
| 2304 | vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2305 | pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId ); |
| 2306 | |
| 2307 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 2308 | { |
| 2309 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2310 | "%s: sme_RoamSetKey failed, returned %d", |
| 2311 | __func__, vosStatus); |
| 2312 | return VOS_STATUS_E_FAILURE; |
| 2313 | } |
| 2314 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2315 | netif_carrier_on(pAdapter->dev); |
| 2316 | netif_tx_start_all_queues(pAdapter->dev); |
| 2317 | break; |
| 2318 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2319 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2320 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 2321 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2322 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2323 | roamIbssConnectHandler( pAdapter, pRoamInfo ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2325 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2326 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2327 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 2328 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2329 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2330 | |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 2331 | if ( !roamRemoveIbssStation(pAdapter, pRoamInfo->staId ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2332 | { |
| 2333 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2334 | "IBSS peer departed by cannot find peer in our registration table with TL" ); |
| 2335 | } |
| 2336 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2337 | pr_info ( "IBSS Peer Departed from SME " |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2338 | "with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d", |
| 2339 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), |
| 2340 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId), |
| 2341 | pRoamInfo->staId ); |
| 2342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2343 | hdd_roamDeregisterSTA( pAdapter, pRoamInfo->staId ); |
| 2344 | |
| 2345 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2346 | pHddStaCtx->ibss_sta_generation++; |
Ravi Joshi | cc57ed4 | 2013-10-12 16:31:25 -0700 | [diff] [blame] | 2347 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 2348 | cfg80211_del_sta(pAdapter->dev, |
| 2349 | (const u8 *)&pRoamInfo->peerMac, |
| 2350 | GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2351 | break; |
| 2352 | } |
| 2353 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 2354 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2355 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 2356 | "Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2357 | // Stop only when we are inactive |
| 2358 | netif_tx_disable(pAdapter->dev); |
| 2359 | netif_carrier_off(pAdapter->dev); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 2360 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2361 | "%s: Set HDD connState to eConnectionState_NotConnected", |
| 2362 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2363 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_NotConnected ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2364 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2365 | // Send the bssid address to the wext. |
| 2366 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
| 2367 | // clean up data path |
| 2368 | hdd_disconnect_tx_rx(pAdapter); |
| 2369 | break; |
| 2370 | } |
| 2371 | default: |
| 2372 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2374 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2375 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2376 | return( eHAL_STATUS_SUCCESS ); |
| 2377 | } |
| 2378 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2379 | #ifdef FEATURE_WLAN_TDLS |
| 2380 | /**============================================================================ |
| 2381 | * |
| 2382 | @brief hdd_roamRegisterTDLSSTA() - Construct the staDesc and register with |
| 2383 | TL the new STA. This is called as part of ADD_STA in the TDLS setup |
| 2384 | Return: VOS_STATUS |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2385 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2386 | ===========================================================================*/ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2387 | VOS_STATUS hdd_roamRegisterTDLSSTA( hdd_adapter_t *pAdapter, |
| 2388 | tANI_U8 *peerMac, tANI_U16 staId, tANI_U8 ucastSig) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2389 | { |
| 2390 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2391 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2392 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 2393 | WLAN_STADescType staDesc = {0}; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2394 | eCsrEncryptionType connectedCipherAlgo = eCSR_ENCRYPT_TYPE_UNKNOWN; |
| 2395 | v_BOOL_t fConnected = FALSE; |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2396 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2397 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2398 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2399 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 2400 | if (!fConnected) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2401 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2402 | "%s not connected. ignored", __func__); |
| 2403 | return VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2404 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2405 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2406 | /* |
| 2407 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 2408 | * be peer MAC, here we are wokrking on direct Link |
| 2409 | */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2410 | staDesc.ucSTAId = staId ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2411 | |
| 2412 | staDesc.wSTAType = WLAN_STA_TDLS ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2413 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2414 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2415 | sizeof(tSirMacAddr) ); |
| 2416 | |
| 2417 | vos_mem_copy(staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 ); |
| 2418 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 2419 | |
| 2420 | /* set the QoS field appropriately ..*/ |
| 2421 | (hdd_wmm_is_active(pAdapter)) ? (staDesc.ucQosEnabled = 1) |
| 2422 | : (staDesc.ucQosEnabled = 0) ; |
| 2423 | |
| 2424 | 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] | 2425 | TL QoS_enabled=%d", staDesc.ucQosEnabled ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2426 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2427 | staDesc.ucProtectedFrame = (connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2428 | |
| 2429 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2430 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2431 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2432 | /* |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2433 | * UMA is ready we inform TL to do frame translation. |
| 2434 | */ |
| 2435 | staDesc.ucSwFrameTXXlation = 1; |
| 2436 | staDesc.ucSwFrameRXXlation = 1; |
| 2437 | staDesc.ucAddRmvLLC = 1; |
| 2438 | |
| 2439 | /* Initialize signatures and state */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2440 | staDesc.ucUcastSig = ucastSig ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2441 | |
| 2442 | /* tdls Direct Link do not need bcastSig */ |
| 2443 | staDesc.ucBcastSig = 0 ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2444 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2445 | #ifdef VOLANS_ENABLE_SW_REPLAY_CHECK |
| 2446 | if(staDesc.ucProtectedFrame) |
| 2447 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 2448 | else |
| 2449 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
| 2450 | #endif |
| 2451 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 2452 | staDesc.ucInitState = WLANTL_STA_CONNECTED ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2453 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2454 | /* Register the Station with TL... */ |
| 2455 | vosStatus = WLANTL_RegisterSTAClient( pVosContext, |
| 2456 | hdd_rx_packet_cbk, |
| 2457 | hdd_tx_complete_cbk, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2458 | hdd_tx_fetch_packet_cbk, &staDesc, 0 ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2459 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2460 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2461 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2462 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2463 | "%s: WLANTL_RegisterSTAClient() failed to register. " |
| 2464 | "Status= %d [0x%08X]", __func__, vosStatus, vosStatus ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2465 | return vosStatus; |
| 2466 | } |
| 2467 | |
Sudhir Sattayappa Kohalli | 3762069 | 2013-08-05 14:02:26 -0700 | [diff] [blame] | 2468 | if ( cfg_param->dynSplitscan && |
| 2469 | ( VOS_TIMER_STATE_RUNNING != |
| 2470 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)) ) |
| 2471 | { |
| 2472 | vos_timer_start(&pHddCtx->tx_rx_trafficTmr, |
| 2473 | cfg_param->trafficMntrTmrForSplitScan); |
| 2474 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2475 | return( vosStatus ); |
| 2476 | } |
| 2477 | |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 2478 | static VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 2479 | { |
| 2480 | VOS_STATUS vosStatus; |
| 2481 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 2482 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2483 | { |
| 2484 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2485 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2486 | "Status= %d [0x%08X]", |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 2487 | __func__, staId, vosStatus, vosStatus ); |
| 2488 | } |
| 2489 | return( vosStatus ); |
| 2490 | } |
| 2491 | |
| 2492 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2493 | /* |
| 2494 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 2495 | * TL in case of new TDLS client is added and deregistration at the time |
| 2496 | * TDLS client is deleted. |
| 2497 | */ |
| 2498 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2499 | eHalStatus hdd_RoamTdlsStatusUpdateHandler(hdd_adapter_t *pAdapter, |
| 2500 | tCsrRoamInfo *pRoamInfo, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2501 | tANI_U32 roamId, |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2502 | eRoamCmdStatus roamStatus, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2503 | eCsrRoamResult roamResult) |
| 2504 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2505 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2506 | eHalStatus status = eHAL_STATUS_FAILURE ; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2507 | tANI_U8 staIdx; |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 2508 | |
| 2509 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
Kaushik, Sushant | 8489f47 | 2014-01-27 11:41:22 +0530 | [diff] [blame] | 2510 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2511 | ("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR), |
| 2512 | roamResult == eCSR_ROAM_RESULT_ADD_TDLS_PEER ? |
| 2513 | "ADD_TDLS_PEER" : |
| 2514 | roamResult == eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? |
| 2515 | "DEL_TDLS_PEER" : |
| 2516 | roamResult == eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? |
| 2517 | "DEL_TDLS_PEER_IND" : |
| 2518 | roamResult == eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 2519 | "DEL_ALL_TDLS_PEER_IND" : |
| 2520 | roamResult == eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? |
| 2521 | "UPDATE_TDLS_PEER" : |
| 2522 | roamResult == eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
| 2523 | "LINK_ESTABLISH_REQ_RSP" : "UNKNOWN", |
| 2524 | pRoamInfo->staId, MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 2525 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2526 | switch( roamResult ) |
| 2527 | { |
| 2528 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 2529 | { |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2530 | if(eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 2531 | { |
| 2532 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2533 | ("%s: Add Sta is failed. %d"),__func__, pRoamInfo->statusCode); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2534 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2535 | else |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2536 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2537 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2538 | /* check if there is available index for this new TDLS STA */ |
| 2539 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
| 2540 | { |
| 2541 | if (0 == pHddCtx->tdlsConnInfo[staIdx].staId ) |
| 2542 | { |
| 2543 | pHddCtx->tdlsConnInfo[staIdx].sessionId = pRoamInfo->sessionId; |
| 2544 | pHddCtx->tdlsConnInfo[staIdx].staId = pRoamInfo->staId; |
| 2545 | |
| 2546 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2547 | ("TDLS: STA IDX at %d is %d " |
| 2548 | "of mac " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2549 | staIdx, pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2550 | MAC_ADDR_ARRAY(pRoamInfo->peerMac)); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2551 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2552 | vos_copy_macaddr(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2553 | (v_MACADDR_t *)pRoamInfo->peerMac) ; |
| 2554 | status = eHAL_STATUS_SUCCESS ; |
| 2555 | break ; |
| 2556 | } |
| 2557 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2558 | if (staIdx < HDD_MAX_NUM_TDLS_STA) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2559 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2560 | 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] | 2561 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2562 | "wlan_hdd_tdls_set_sta_id() failed"); |
| 2563 | return VOS_FALSE; |
| 2564 | } |
| 2565 | |
| 2566 | (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 2567 | /* store the ucast signature , if required for further reference. */ |
| 2568 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2569 | wlan_hdd_tdls_set_signature( pAdapter, pRoamInfo->peerMac, pRoamInfo->ucastSig ); |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 2570 | /* start TDLS client registration with TL */ |
| 2571 | status = hdd_roamRegisterTDLSSTA( pAdapter, |
| 2572 | pRoamInfo->peerMac, |
| 2573 | pRoamInfo->staId, |
| 2574 | pRoamInfo->ucastSig); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2575 | } |
| 2576 | else |
| 2577 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2578 | status = eHAL_STATUS_FAILURE; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2579 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 2580 | "%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] | 2581 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2582 | pAdapter->tdlsAddStaStatus = status; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2583 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 2584 | complete(&pAdapter->tdls_add_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2585 | break ; |
| 2586 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2587 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 2588 | { |
| 2589 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 2590 | { |
| 2591 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2592 | "%s: Add Sta is failed. %d", __func__, pRoamInfo->statusCode); |
| 2593 | } |
| 2594 | /* store the ucast signature which will be used later when |
| 2595 | * registering to TL |
| 2596 | */ |
| 2597 | pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode; |
| 2598 | complete(&pAdapter->tdls_add_station_comp); |
| 2599 | break; |
| 2600 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 2601 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 2602 | { |
| 2603 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 2604 | { |
| 2605 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2606 | "%s: Link Establish Request failed. %d", __func__, pRoamInfo->statusCode); |
| 2607 | } |
| 2608 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 2609 | break; |
| 2610 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2611 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2612 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2613 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2614 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2615 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2616 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 2617 | pRoamInfo->staId == pHddCtx->tdlsConnInfo[staIdx].staId) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2618 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2619 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2620 | ("HDD: del STA IDX = %x"), pRoamInfo->staId) ; |
| 2621 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2622 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, TRUE); |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame^] | 2623 | if (NULL != curr_peer) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2624 | { |
Agarwal Ashish | 9cd8638 | 2014-12-18 18:24:36 +0530 | [diff] [blame^] | 2625 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2626 | " Current status for peer" MAC_ADDRESS_STR "is %d", |
| 2627 | MAC_ADDR_ARRAY(pRoamInfo->peerMac), curr_peer->link_status); |
| 2628 | if (TDLS_IS_CONNECTED(curr_peer)) |
| 2629 | { |
| 2630 | hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId ); |
| 2631 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
| 2632 | } |
| 2633 | else if (eTDLS_LINK_CONNECTING == curr_peer->link_status) |
| 2634 | { |
| 2635 | hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId ); |
| 2636 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2637 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2638 | wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2639 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2640 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 2641 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
| 2642 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2643 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2644 | wlan_hdd_tdls_check_bmps(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2645 | status = eHAL_STATUS_SUCCESS ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2646 | break ; |
| 2647 | } |
| 2648 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2649 | complete(&pAdapter->tdls_del_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2650 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2651 | break ; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 2652 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 2653 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2654 | hddTdlsPeer_t *curr_peer; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 2655 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2656 | "%s: Sending teardown to supplicant with reason code %u", |
| 2657 | __func__, pRoamInfo->reasonCode); |
| 2658 | |
| 2659 | #ifdef CONFIG_TDLS_IMPLICIT |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2660 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2661 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, pRoamInfo->reasonCode); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 2662 | #endif |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2663 | status = eHAL_STATUS_SUCCESS ; |
| 2664 | break ; |
| 2665 | } |
| 2666 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 2667 | { |
| 2668 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2669 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2670 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2671 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 2672 | pHddCtx->tdlsConnInfo[staIdx].staId) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2673 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2674 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2675 | ("hdd_tdlsStatusUpdate: staIdx %d " MAC_ADDRESS_STR), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2676 | pHddCtx->tdlsConnInfo[staIdx].staId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2677 | MAC_ADDR_ARRAY(pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes)); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2678 | wlan_hdd_tdls_reset_peer(pAdapter, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes); |
| 2679 | hdd_roamDeregisterTDLSSTA ( pAdapter, pHddCtx->tdlsConnInfo[staIdx].staId ); |
| 2680 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2681 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2682 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2683 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2684 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 2685 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2686 | |
| 2687 | status = eHAL_STATUS_SUCCESS ; |
| 2688 | } |
| 2689 | } |
Gopichand Nakkala | 40ab275 | 2013-04-04 20:11:36 +0530 | [diff] [blame] | 2690 | wlan_hdd_tdls_check_bmps(pAdapter); |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 2691 | break ; |
| 2692 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2693 | default: |
| 2694 | { |
| 2695 | break ; |
| 2696 | } |
| 2697 | } |
| 2698 | |
| 2699 | return status ; |
| 2700 | } |
| 2701 | #endif |
| 2702 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 2703 | static void iw_full_power_cbfn (void *pContext, eHalStatus status) |
| 2704 | { |
| 2705 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
| 2706 | hdd_context_t *pHddCtx = NULL; |
| 2707 | int ret; |
| 2708 | |
| 2709 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 2710 | { |
| 2711 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2712 | "%s: Bad param, pAdapter [%p]", |
| 2713 | __func__, pAdapter); |
| 2714 | return; |
| 2715 | } |
| 2716 | |
| 2717 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2718 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2719 | if (0 != ret) |
| 2720 | { |
| 2721 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2722 | "%s: HDD context is not valid (%d)", __func__, ret); |
| 2723 | return; |
| 2724 | } |
| 2725 | |
| 2726 | if (pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 2727 | { |
| 2728 | sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), NULL, NULL); |
| 2729 | } |
| 2730 | } |
| 2731 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2732 | eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2733 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
| 2734 | { |
| 2735 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 2736 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 2737 | hdd_wext_state_t *pWextState = NULL; |
| 2738 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2739 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 2740 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2741 | |
| 2742 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2743 | "CSR Callback: status= %d result= %d roamID=%d", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2744 | roamStatus, roamResult, roamId ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2745 | |
| 2746 | /*Sanity check*/ |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 2747 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2748 | { |
| 2749 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 2750 | "invalid adapter or adapter has invalid magic"); |
| 2751 | return eHAL_STATUS_FAILURE; |
| 2752 | } |
| 2753 | |
| 2754 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2755 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2756 | |
| 2757 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 2758 | { |
| 2759 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2760 | "invalid WEXT state or HDD station context"); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2761 | return eHAL_STATUS_FAILURE; |
| 2762 | } |
| 2763 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2764 | switch( roamStatus ) |
| 2765 | { |
| 2766 | case eCSR_ROAM_SESSION_OPENED: |
| 2767 | if(pAdapter != NULL) |
| 2768 | { |
| 2769 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 2770 | complete(&pAdapter->session_open_comp_var); |
| 2771 | } |
| 2772 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2773 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2774 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
| 2775 | /* We did pre-auth,then we attempted a 11r or ese reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2776 | * reassoc failed due to failure, timeout, reject from ap |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2777 | * in any case tell the OS, our carrier is off and mark |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2778 | * interface down */ |
| 2779 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 2780 | hddLog(LOGE, FL("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d"), |
| 2781 | roamStatus, roamResult, pAdapter->sessionId); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 2782 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2783 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2784 | /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */ |
| 2785 | if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2786 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 2787 | } |
| 2788 | pHddStaCtx->ft_carrier_on = FALSE; |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 2789 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2790 | break; |
| 2791 | |
| 2792 | case eCSR_ROAM_FT_START: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2793 | // When we roam for EsE and 11r, we dont want the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2794 | // OS to be informed that the link is down. So mark |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2795 | // the link ready for ft_start. After this the |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2796 | // eCSR_ROAM_SHOULD_ROAM will be received. |
| 2797 | // Where in we will not mark the link down |
| 2798 | // Also we want to stop tx at this point when we will be |
| 2799 | // doing disassoc at this time. This saves 30-60 msec |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2800 | // after reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2801 | { |
| 2802 | struct net_device *dev = pAdapter->dev; |
| 2803 | netif_tx_disable(dev); |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 2804 | #ifdef DEBUG_ROAM_DELAY |
| 2805 | vos_record_roam_event(e_HDD_DISABLE_TX_QUEUE, NULL, 0); |
| 2806 | #endif |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2807 | /* |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 2808 | * Deregister for this STA with TL with the objective to flush |
| 2809 | * all the packets for this STA from wmm_tx_queue. If not done here, |
| 2810 | * we would run into a race condition (CR390567) wherein TX |
| 2811 | * thread would schedule packets from wmm_tx_queue AFTER peer STA has |
| 2812 | * been deleted. And, these packets get assigned with a STA idx of |
| 2813 | * self-sta (since the peer STA has been deleted) and get transmitted |
| 2814 | * on the new channel before the reassoc request. Since there will be |
| 2815 | * no ACK on the new channel, each packet gets retransmitted which |
| 2816 | * takes several seconds before the transmission of reassoc request. |
| 2817 | * This leads to reassoc-timeout and roam failure. |
| 2818 | */ |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2819 | status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] ); |
| 2820 | if ( !VOS_IS_STATUS_SUCCESS(status ) ) |
| 2821 | { |
| 2822 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2823 | FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"), |
| 2824 | pHddStaCtx->conn_info.staId[0], status, status ); |
| 2825 | halStatus = eHAL_STATUS_FAILURE; |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 2826 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2827 | } |
| 2828 | pHddStaCtx->ft_carrier_on = TRUE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 2829 | pHddStaCtx->hdd_ReassocScenario = VOS_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2830 | break; |
| 2831 | #endif |
| 2832 | |
| 2833 | case eCSR_ROAM_SHOULD_ROAM: |
| 2834 | // Dont need to do anything |
| 2835 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2836 | struct net_device *dev = pAdapter->dev; |
| 2837 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2838 | // notify apps that we can't pass traffic anymore |
| 2839 | netif_tx_disable(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2840 | #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] | 2841 | if (pHddStaCtx->ft_carrier_on == FALSE) |
| 2842 | { |
| 2843 | #endif |
| 2844 | netif_carrier_off(dev); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2845 | #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] | 2846 | } |
| 2847 | #endif |
| 2848 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2849 | #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] | 2850 | //We should clear all sta register with TL, for now, only one. |
| 2851 | status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] ); |
| 2852 | if ( !VOS_IS_STATUS_SUCCESS(status ) ) |
| 2853 | { |
| 2854 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2855 | FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"), |
| 2856 | pHddStaCtx->conn_info.staId[0], status, status ); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2857 | halStatus = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2858 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2859 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2860 | } |
| 2861 | break; |
| 2862 | case eCSR_ROAM_LOSTLINK: |
| 2863 | case eCSR_ROAM_DISASSOCIATED: |
| 2864 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2866 | "****eCSR_ROAM_DISASSOCIATED****"); |
c_hpothu | ef45bc3 | 2014-09-11 10:10:18 +0530 | [diff] [blame] | 2867 | sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2868 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2869 | /* 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] | 2870 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2871 | if (pHddCtx->hdd_mcastbcast_filter_set == TRUE) |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 2872 | { |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 2873 | hdd_conf_mcastbcast_filter(pHddCtx, FALSE); |
Amar Singhal | f8ba2b8 | 2013-12-02 12:54:38 -0800 | [diff] [blame] | 2874 | |
| 2875 | if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) { |
| 2876 | pHddCtx->configuredMcastBcastFilter = |
| 2877 | pHddCtx->sus_res_mcastbcast_filter; |
| 2878 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_FALSE; |
| 2879 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 2880 | |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 2881 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2882 | "offload: disassociation happening, restoring configuredMcastBcastFilter"); |
| 2883 | hddLog(VOS_TRACE_LEVEL_INFO,"McastBcastFilter = %d", |
| 2884 | pHddCtx->configuredMcastBcastFilter); |
| 2885 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2886 | "offload: already called mcastbcast filter"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2887 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 2888 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2889 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 2890 | /* Call to clear any MC Addr List filter applied after |
| 2891 | * successful connection. |
| 2892 | */ |
| 2893 | wlan_hdd_set_mc_addr_list(pAdapter, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2894 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2895 | } |
| 2896 | break; |
| 2897 | case eCSR_ROAM_IBSS_LEAVE: |
| 2898 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2899 | "****eCSR_ROAM_IBSS_LEAVE****"); |
| 2900 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2901 | break; |
| 2902 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
| 2903 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2904 | "****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 2905 | // To Do - address probable memory leak with WEP encryption upon successful association |
| 2906 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2907 | { |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 2908 | //Clear saved connection information in HDD |
| 2909 | hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2910 | } |
Abhishek Singh | 57a0bd9 | 2014-06-13 11:17:27 +0530 | [diff] [blame] | 2911 | halStatus = hdd_AssociationCompletionHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2912 | |
| 2913 | break; |
| 2914 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2915 | halStatus = hdd_AssociationCompletionHandler( pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2916 | pRoamInfo, roamId, roamStatus, roamResult ); |
| 2917 | break; |
| 2918 | case eCSR_ROAM_IBSS_IND: |
Jeff Johnson | 81c1788 | 2013-05-03 09:53:35 -0700 | [diff] [blame] | 2919 | hdd_RoamIbssIndicationHandler( pAdapter, pRoamInfo, roamId, |
| 2920 | roamStatus, roamResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2921 | break; |
| 2922 | |
| 2923 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
| 2924 | halStatus = roamRoamConnectStatusUpdateHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2925 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2926 | |
| 2927 | case eCSR_ROAM_MIC_ERROR_IND: |
| 2928 | halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2929 | break; |
| 2930 | |
| 2931 | case eCSR_ROAM_SET_KEY_COMPLETE: |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 2932 | { |
| 2933 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 2934 | |
| 2935 | if((pHddCtx) && |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 2936 | (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) && |
| 2937 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 2938 | (eCSR_ROAM_RESULT_NONE == roamResult)) |
| 2939 | { |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 2940 | /* Send DTIM period to the FW; only if the wlan is already |
| 2941 | in suspend. This is the case with roaming (reassoc), |
| 2942 | DELETE_BSS_REQ zeroes out Modulated/Dynamic DTIM sent in |
| 2943 | previous suspend_wlan. Sending SET_POWER_PARAMS_REQ |
| 2944 | before the ENTER_BMPS_REQ ensures Listen Interval is |
| 2945 | regained back to LI * Modulated DTIM */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 2946 | hdd_set_pwrparams(pHddCtx); |
| 2947 | pHddStaCtx->hdd_ReassocScenario = VOS_FALSE; |
| 2948 | |
| 2949 | /* At this point, device should not be in BMPS; |
Srinivas Girigowda | eb03ee3 | 2013-07-16 11:48:41 -0700 | [diff] [blame] | 2950 | if due to unexpected scenario, if we are in BMPS, |
| 2951 | then trigger Exit and Enter BMPS to take DTIM period |
| 2952 | effective */ |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 2953 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) |
| 2954 | { |
| 2955 | hddLog( LOGE, FL("Not expected: device is already in BMPS mode, Exit & Enter BMPS again!")); |
| 2956 | |
Srinivas Girigowda | 1c3f72e | 2013-12-18 16:07:00 -0800 | [diff] [blame] | 2957 | sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2958 | iw_full_power_cbfn, pAdapter, |
| 2959 | eSME_FULL_PWR_NEEDED_BY_HDD); |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 2960 | } |
| 2961 | } |
| 2962 | halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 2963 | pHddStaCtx->hdd_ReassocScenario = FALSE; |
Srinivas Girigowda | 66c05eb | 2013-07-14 13:06:01 -0700 | [diff] [blame] | 2964 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2965 | break; |
| 2966 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2967 | case eCSR_ROAM_FT_RESPONSE: |
| 2968 | hdd_SendFTEvent(pAdapter); |
| 2969 | break; |
| 2970 | #endif |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 2971 | #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] | 2972 | case eCSR_ROAM_PMK_NOTIFY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 2973 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2974 | { |
| 2975 | /* Notify the supplicant of a new candidate */ |
| 2976 | halStatus = wlan_hdd_cfg80211_pmksa_candidate_notify(pAdapter, pRoamInfo, 1, false); |
| 2977 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2978 | break; |
| 2979 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2980 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 2981 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 2982 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 2983 | /* This event is to notify pre-auth initiation */ |
| 2984 | if (VOS_STATUS_SUCCESS != |
| 2985 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, pRoamInfo)) |
| 2986 | { |
| 2987 | halStatus = eHAL_STATUS_FAILURE; |
| 2988 | } |
| 2989 | break; |
| 2990 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 2991 | /* This event will notify pre-auth completion in case of success */ |
| 2992 | if (VOS_STATUS_SUCCESS != |
| 2993 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 2994 | pRoamInfo, 1)) |
| 2995 | { |
| 2996 | halStatus = eHAL_STATUS_FAILURE; |
| 2997 | } |
| 2998 | break; |
| 2999 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 3000 | /* This event will notify pre-auth completion in case of failure. */ |
| 3001 | if (VOS_STATUS_SUCCESS != |
| 3002 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 3003 | pRoamInfo, 0)) |
| 3004 | { |
| 3005 | halStatus = eHAL_STATUS_FAILURE; |
| 3006 | } |
| 3007 | break; |
| 3008 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 3009 | /* This event is to notify handover success. |
| 3010 | It will be only invoked on success */ |
| 3011 | if (VOS_STATUS_SUCCESS != |
| 3012 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, pRoamInfo)) |
| 3013 | { |
| 3014 | halStatus = eHAL_STATUS_FAILURE; |
| 3015 | } |
| 3016 | break; |
| 3017 | #endif |
| 3018 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3019 | case eCSR_ROAM_INDICATE_MGMT_FRAME: |
| 3020 | hdd_indicateMgmtFrame( pAdapter, |
| 3021 | pRoamInfo->nFrameLength, |
| 3022 | pRoamInfo->pbFrames, |
| 3023 | pRoamInfo->frameType, |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 3024 | pRoamInfo->rxChan, |
| 3025 | pRoamInfo->rxRssi ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3026 | break; |
| 3027 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 3028 | hdd_remainChanReadyHandler( pAdapter ); |
| 3029 | break; |
| 3030 | case eCSR_ROAM_SEND_ACTION_CNF: |
| 3031 | hdd_sendActionCnf( pAdapter, |
| 3032 | (roamResult == eCSR_ROAM_RESULT_NONE) ? TRUE : FALSE ); |
| 3033 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3034 | #ifdef FEATURE_WLAN_TDLS |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 3035 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3036 | halStatus = hdd_RoamTdlsStatusUpdateHandler( pAdapter, pRoamInfo, |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 3037 | roamId, roamStatus, roamResult ); |
| 3038 | break ; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 3039 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 3040 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, pRoamInfo->reasonCode); |
| 3041 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3042 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3043 | #ifdef WLAN_FEATURE_11W |
| 3044 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 3045 | hdd_indicateUnprotMgmtFrame(pAdapter, pRoamInfo->nFrameLength, |
| 3046 | pRoamInfo->pbFrames, |
| 3047 | pRoamInfo->frameType); |
| 3048 | break; |
| 3049 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3050 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 3051 | case eCSR_ROAM_TSM_IE_IND: |
| 3052 | hdd_indicateTsmIe(pAdapter, pRoamInfo->tsmIe.tsid, |
| 3053 | pRoamInfo->tsmIe.state, pRoamInfo->tsmIe.msmt_interval); |
| 3054 | break; |
| 3055 | |
| 3056 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 3057 | { |
| 3058 | if (eCSR_AUTH_TYPE_CCKM_WPA == pHddStaCtx->conn_info.authType || |
| 3059 | eCSR_AUTH_TYPE_CCKM_RSN == pHddStaCtx->conn_info.authType) |
| 3060 | { |
| 3061 | hdd_indicateCckmPreAuth(pAdapter, pRoamInfo); |
| 3062 | } |
| 3063 | break; |
| 3064 | } |
| 3065 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3066 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 3067 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3068 | hdd_indicateEseAdjApRepInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 3069 | break; |
| 3070 | } |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 3071 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3072 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 3073 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3074 | hdd_indicateEseBcnReportInd(pAdapter, pRoamInfo); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 3075 | break; |
| 3076 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3077 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3078 | default: |
| 3079 | break; |
| 3080 | } |
| 3081 | return( halStatus ); |
| 3082 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3083 | eCsrAuthType hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3084 | { |
| 3085 | eCsrAuthType auth_type; |
| 3086 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3087 | if ( memcmp(auth_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3088 | { |
| 3089 | auth_type = eCSR_AUTH_TYPE_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3090 | } else |
| 3091 | if (memcmp(auth_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3092 | { |
| 3093 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3094 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3095 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3096 | if (memcmp(auth_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3097 | { |
| 3098 | // Check for 11r FT Authentication with PSK |
| 3099 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3100 | } else |
| 3101 | if (memcmp(auth_suite , ccpRSNOui03, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3102 | { |
| 3103 | // Check for 11R FT Authentication with 802.1X |
| 3104 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3105 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3106 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3107 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3108 | if (memcmp(auth_suite , ccpRSNOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3109 | { |
| 3110 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 3111 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3112 | #endif /* FEATURE_WLAN_ESE */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3113 | #ifdef WLAN_FEATURE_11W |
| 3114 | if (memcmp(auth_suite , ccpRSNOui07, 4) == 0) |
| 3115 | { |
| 3116 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 3117 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 3118 | if (memcmp(auth_suite , ccpRSNOui08, 4) == 0) |
| 3119 | { |
| 3120 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 3121 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3122 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3123 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3124 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 3125 | } |
| 3126 | return auth_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3127 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 3128 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3129 | eCsrAuthType |
| 3130 | hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3131 | { |
| 3132 | eCsrAuthType auth_type; |
| 3133 | // is the auth type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3134 | if ( memcmp(auth_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3135 | { |
| 3136 | auth_type = eCSR_AUTH_TYPE_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3137 | } else |
| 3138 | if (memcmp(auth_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3139 | { |
| 3140 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3141 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3142 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3143 | if (memcmp(auth_suite , ccpWpaOui06, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3144 | { |
| 3145 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3146 | } else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3147 | #endif /* FEATURE_WLAN_ESE */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3148 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3149 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 3150 | } |
| 3151 | hddLog(LOG1, FL("auth_type: %d"), auth_type); |
| 3152 | return auth_type; |
| 3153 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 3154 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3155 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3156 | hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3157 | { |
| 3158 | eCsrEncryptionType cipher_type; |
| 3159 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3160 | if ( memcmp(cipher_suite , ccpRSNOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3161 | { |
| 3162 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3163 | } |
| 3164 | else if (memcmp(cipher_suite , ccpRSNOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3165 | { |
| 3166 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3167 | } |
| 3168 | else if (memcmp(cipher_suite , ccpRSNOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3169 | { |
| 3170 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3171 | } |
| 3172 | else if (memcmp(cipher_suite , ccpRSNOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3173 | { |
| 3174 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3175 | } |
| 3176 | else if (memcmp(cipher_suite , ccpRSNOui05, 4) == 0) |
| 3177 | { |
| 3178 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3179 | } |
| 3180 | else |
| 3181 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3182 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 3183 | } |
| 3184 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 3185 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3186 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3187 | /* To find if the MAC address is NULL */ |
| 3188 | static tANI_U8 hdd_IsMACAddrNULL (tANI_U8 *macAddr, tANI_U8 length) |
| 3189 | { |
| 3190 | int i; |
| 3191 | for (i = 0; i < length; i++) |
| 3192 | { |
| 3193 | if (0x00 != (macAddr[i])) |
| 3194 | { |
| 3195 | return FALSE; |
| 3196 | } |
| 3197 | } |
| 3198 | return TRUE; |
| 3199 | } /****** end hdd_IsMACAddrNULL() ******/ |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 3200 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3201 | eCsrEncryptionType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3202 | hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3203 | { |
| 3204 | eCsrEncryptionType cipher_type; |
| 3205 | // is the cipher type supported? |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3206 | if ( memcmp(cipher_suite , ccpWpaOui04, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3207 | { |
| 3208 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3209 | } else |
| 3210 | if (memcmp(cipher_suite , ccpWpaOui02, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3211 | { |
| 3212 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3213 | } else |
| 3214 | if (memcmp(cipher_suite , ccpWpaOui00, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3215 | { |
| 3216 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3217 | } else |
| 3218 | if (memcmp(cipher_suite , ccpWpaOui01, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3219 | { |
| 3220 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3221 | } else |
| 3222 | if (memcmp(cipher_suite , ccpWpaOui05, 4) == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3223 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3224 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3225 | } else |
| 3226 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3227 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 3228 | } |
| 3229 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 3230 | return cipher_type; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3232 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3233 | static tANI_S32 hdd_ProcessGENIE(hdd_adapter_t *pAdapter, |
| 3234 | struct ether_addr *pBssid, |
| 3235 | eCsrEncryptionType *pEncryptType, |
| 3236 | eCsrEncryptionType *mcEncryptType, |
| 3237 | eCsrAuthType *pAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3238 | #ifdef WLAN_FEATURE_11W |
| 3239 | u_int8_t *pMfpRequired, |
| 3240 | u_int8_t *pMfpCapable, |
| 3241 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3242 | u_int16_t gen_ie_len, |
| 3243 | u_int8_t *gen_ie) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3244 | { |
| 3245 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3246 | eHalStatus result; |
| 3247 | tDot11fIERSN dot11RSNIE; |
| 3248 | tDot11fIEWPA dot11WPAIE; |
| 3249 | tANI_U32 i; |
| 3250 | tANI_U8 *pRsnIe; |
| 3251 | tANI_U16 RSNIeLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3252 | tPmkidCacheInfo PMKIDCache[4]; // Local transfer memory |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 3253 | v_BOOL_t updatePMKCache = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3254 | |
| 3255 | /* Clear struct of tDot11fIERSN and tDot11fIEWPA specifically setting present |
| 3256 | flag to 0 */ |
| 3257 | memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) ); |
| 3258 | memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) ); |
| 3259 | |
| 3260 | // Validity checks |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3261 | if ((gen_ie_len < VOS_MIN(DOT11F_IE_RSN_MIN_LEN, DOT11F_IE_WPA_MIN_LEN)) || |
| 3262 | (gen_ie_len > VOS_MAX(DOT11F_IE_RSN_MAX_LEN, DOT11F_IE_WPA_MAX_LEN)) ) |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 3263 | { |
| 3264 | hddLog(LOGE, "%s: Invalid DOT11F IE Length passed :%d", |
| 3265 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3266 | return -EINVAL; |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 3267 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3268 | // Type check |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3269 | if ( gen_ie[0] == DOT11F_EID_RSN) |
| 3270 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3271 | // Validity checks |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3272 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3273 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) ) |
| 3274 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 3275 | hddLog(LOGE, "%s: Invalid DOT11F RSN IE length :%d\n", |
| 3276 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3277 | return -EINVAL; |
| 3278 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3279 | // Skip past the EID byte and length byte |
| 3280 | pRsnIe = gen_ie + 2; |
| 3281 | RSNIeLen = gen_ie_len - 2; |
| 3282 | // Unpack the RSN IE |
| 3283 | dot11fUnpackIeRSN((tpAniSirGlobal) halHandle, |
| 3284 | pRsnIe, |
| 3285 | RSNIeLen, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3286 | &dot11RSNIE); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3287 | // Copy out the encryption and authentication types |
| 3288 | hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3289 | __func__, dot11RSNIE.pwise_cipher_suite_count ); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3290 | hddLog(LOG1, FL("%s: authentication suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3291 | __func__, dot11RSNIE.akm_suite_count); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3292 | /*Here we have followed the apple base code, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3293 | but probably I suspect we can do something different*/ |
| 3294 | //dot11RSNIE.akm_suite_count |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3295 | // Just translate the FIRST one |
| 3296 | *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suites[0]); |
| 3297 | //dot11RSNIE.pwise_cipher_suite_count |
| 3298 | *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]); |
| 3299 | //dot11RSNIE.gp_cipher_suite_count |
| 3300 | *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3301 | #ifdef WLAN_FEATURE_11W |
| 3302 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1 ; |
| 3303 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1 ; |
| 3304 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3305 | // Set the PMKSA ID Cache for this interface |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3306 | for (i=0; i<dot11RSNIE.pmkid_count; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3307 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3308 | if ( pBssid == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3309 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 3310 | hddLog(LOGE, "%s: pBssid passed is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3311 | break; |
| 3312 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 3313 | if ( hdd_IsMACAddrNULL( (u_char *) pBssid->ether_addr_octet , 6)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3314 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 3315 | hddLog(LOGE, "%s: Invalid MAC adrr", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3316 | break; |
| 3317 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 3318 | updatePMKCache = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3319 | // For right now, I assume setASSOCIATE() has passed in the bssid. |
| 3320 | vos_mem_copy(PMKIDCache[i].BSSID, |
| 3321 | pBssid, ETHER_ADDR_LEN); |
| 3322 | vos_mem_copy(PMKIDCache[i].PMKID, |
| 3323 | dot11RSNIE.pmkid[i], |
| 3324 | CSR_RSN_PMKID_SIZE); |
| 3325 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 3326 | |
| 3327 | if (updatePMKCache) |
| 3328 | { |
| 3329 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 3330 | hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with cache entry %d."), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3331 | __func__, i ); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 3332 | // Finally set the PMKSA ID Cache in CSR |
| 3333 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
| 3334 | PMKIDCache, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 3335 | dot11RSNIE.pmkid_count, |
| 3336 | FALSE); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 3337 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3338 | } |
| 3339 | else if (gen_ie[0] == DOT11F_EID_WPA) |
| 3340 | { |
| 3341 | // Validity checks |
| 3342 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) || |
| 3343 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) |
| 3344 | { |
Arun Kumar Khandavalli | 138f3c1 | 2013-12-13 16:24:33 +0530 | [diff] [blame] | 3345 | hddLog(LOGE, "%s: Invalid DOT11F WPA IE length :%d\n", |
| 3346 | __func__, gen_ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3347 | return -EINVAL; |
| 3348 | } |
| 3349 | // 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] | 3350 | pRsnIe = gen_ie + 2 + 4; |
| 3351 | RSNIeLen = gen_ie_len - (2 + 4); |
| 3352 | // Unpack the WPA IE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3353 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 3354 | pRsnIe, |
| 3355 | RSNIeLen, |
| 3356 | &dot11WPAIE); |
| 3357 | // Copy out the encryption and authentication types |
| 3358 | hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3359 | __func__, dot11WPAIE.unicast_cipher_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3360 | hddLog(LOG1, FL("%s: WPA authentication suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3361 | __func__, dot11WPAIE.auth_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3362 | //dot11WPAIE.auth_suite_count |
| 3363 | // Just translate the FIRST one |
| 3364 | *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]); |
| 3365 | //dot11WPAIE.unicast_cipher_count |
| 3366 | *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]); |
| 3367 | //dot11WPAIE.unicast_cipher_count |
| 3368 | *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 3369 | } |
| 3370 | else |
| 3371 | { |
| 3372 | hddLog(LOGW, FL("gen_ie[0]: %d"), gen_ie[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3373 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3374 | } |
| 3375 | return 0; |
| 3376 | } |
| 3377 | int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 3378 | { |
| 3379 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3380 | v_U32_t status = 0; |
| 3381 | eCsrEncryptionType RSNEncryptType; |
| 3382 | eCsrEncryptionType mcRSNEncryptType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3383 | #ifdef WLAN_FEATURE_11W |
| 3384 | u_int8_t RSNMfpRequired; |
| 3385 | u_int8_t RSNMfpCapable; |
| 3386 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3387 | struct ether_addr bSsid; // MAC address of assoc peer |
| 3388 | // MAC address of assoc peer |
| 3389 | // But, this routine is only called when we are NOT associated. |
| 3390 | vos_mem_copy(bSsid.ether_addr_octet, |
| 3391 | pWextState->roamProfile.BSSIDs.bssid, |
| 3392 | sizeof(bSsid.ether_addr_octet)); |
| 3393 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) |
| 3394 | { |
| 3395 | //continue |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3396 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3397 | else |
| 3398 | { |
| 3399 | return 0; |
| 3400 | } |
| 3401 | // The actual processing may eventually be more extensive than this. |
| 3402 | // Right now, just consume any PMKIDs that are sent in by the app. |
| 3403 | status = hdd_ProcessGENIE(pAdapter, |
| 3404 | &bSsid, // MAC address of assoc peer |
| 3405 | &RSNEncryptType, |
| 3406 | &mcRSNEncryptType, |
| 3407 | RSNAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3408 | #ifdef WLAN_FEATURE_11W |
| 3409 | &RSNMfpRequired, |
| 3410 | &RSNMfpCapable, |
| 3411 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3412 | pWextState->WPARSNIE[1]+2, |
| 3413 | pWextState->WPARSNIE); |
| 3414 | if (status == 0) |
| 3415 | { |
| 3416 | // Now copy over all the security attributes you have parsed out |
| 3417 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 3418 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3419 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3420 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; // Use the cipher type in the RSN IE |
| 3421 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = mcRSNEncryptType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3422 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 3423 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && |
| 3424 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
| 3425 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) |
| 3426 | { |
| 3427 | /*For wpa none supplicant sends the WPA IE with unicast cipher as |
| 3428 | eCSR_ENCRYPT_TYPE_NONE ,where as the multicast cipher as |
| 3429 | either AES/TKIP based on group cipher configuration |
| 3430 | mentioned in the wpa_supplicant.conf.*/ |
| 3431 | |
| 3432 | /*Set the unicast cipher same as multicast cipher*/ |
| 3433 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 3434 | = mcRSNEncryptType; |
| 3435 | } |
| 3436 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3437 | #ifdef WLAN_FEATURE_11W |
| 3438 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 3439 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 3440 | #endif |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3441 | hddLog( LOG1, "%s: CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", __func__, *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3442 | } |
| 3443 | return 0; |
| 3444 | } |
| 3445 | int hdd_set_csr_auth_type ( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 3446 | { |
| 3447 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3448 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 3449 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3450 | ENTER(); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3452 | pRoamProfile->AuthType.numEntries = 1; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3453 | 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] | 3454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3455 | switch( pHddStaCtx->conn_info.authType) |
| 3456 | { |
| 3457 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3458 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3459 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 3460 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 3461 | #endif |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3462 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 3463 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3464 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM ; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3465 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3466 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3467 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3468 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3469 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 3470 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 3471 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3472 | 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] | 3473 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
| 3474 | } else |
| 3475 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3476 | hddLog( LOG1, "%s: Last chance to set authType to CCKM WPA.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3477 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3478 | } else |
| 3479 | #endif |
| 3480 | if((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 3481 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3482 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA; |
| 3483 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3484 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 3485 | == IW_AUTH_KEY_MGMT_PSK) { |
| 3486 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3487 | } else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3488 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3489 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3490 | } |
| 3491 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3492 | #ifdef FEATURE_WLAN_ESE |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3493 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 3494 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 3495 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3496 | 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] | 3497 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3498 | } else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3499 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN)) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3500 | hddLog( LOG1, "%s: Last chance to set authType to CCKM RSN.", __func__); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3501 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3502 | } else |
| 3503 | #endif |
| 3504 | |
| 3505 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3506 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 3507 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3508 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3509 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3510 | }else |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3511 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3512 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 3513 | == IW_AUTH_KEY_MGMT_PSK)) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3514 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN_PSK; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3515 | } else |
| 3516 | #endif |
| 3517 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3518 | #ifdef WLAN_FEATURE_11W |
| 3519 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 3520 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 3521 | } else |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 3522 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 3523 | pRoamProfile->AuthType.authType[0] = |
| 3524 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 3525 | } else |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3526 | #endif |
| 3527 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3528 | if( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3529 | == IW_AUTH_KEY_MGMT_802_1X) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3530 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN; |
| 3531 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3532 | if ( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 3533 | == IW_AUTH_KEY_MGMT_PSK) { |
| 3534 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3535 | } else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3536 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3537 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3538 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3539 | break; |
| 3540 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3541 | case eCSR_AUTH_TYPE_SHARED_KEY: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3542 | |
| 3543 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3544 | break; |
| 3545 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3546 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3547 | #ifdef FEATURE_WLAN_ESE |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3548 | hddLog( LOG1, "%s: In default, unknown auth type.", __func__); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3549 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3550 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 3551 | break; |
| 3552 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3554 | hddLog( LOG1, "%s Set roam Authtype to %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3555 | __func__, pWextState->roamProfile.AuthType.authType[0]); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3557 | EXIT(); |
| 3558 | return 0; |
| 3559 | } |
| 3560 | |
| 3561 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3562 | |
| 3563 | \brief iw_set_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3564 | This function sets the ssid received from wpa_supplicant |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3565 | to the CSR roam profile. |
| 3566 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3567 | \param - dev - Pointer to the net device. |
| 3568 | - info - Pointer to the iw_request_info. |
| 3569 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3570 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3571 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3573 | --------------------------------------------------------------------------*/ |
| 3574 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3575 | int iw_set_essid(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3576 | struct iw_request_info *info, |
| 3577 | union iwreq_data *wrqu, char *extra) |
| 3578 | { |
| 3579 | v_U32_t status = 0; |
| 3580 | hdd_wext_state_t *pWextState; |
| 3581 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3582 | v_U32_t roamId; |
| 3583 | tCsrRoamProfile *pRoamProfile; |
| 3584 | eMib_dot11DesiredBssType connectedBssType; |
| 3585 | eCsrAuthType RSNAuthType; |
| 3586 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3587 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3588 | |
| 3589 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3590 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3591 | ENTER(); |
| 3592 | |
| 3593 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3594 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 3595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3596 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 3597 | return 0; |
| 3598 | } |
| 3599 | |
| 3600 | if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
| 3601 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__); |
| 3602 | return -EBUSY; |
| 3603 | } |
| 3604 | if( SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length ) |
| 3605 | return -EINVAL; |
| 3606 | pRoamProfile = &pWextState->roamProfile; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3607 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3608 | { |
| 3609 | if ( hdd_connGetConnectedBssType( pHddStaCtx, &connectedBssType ) || |
| 3610 | ( eMib_dot11DesiredBssType_independent == pHddStaCtx->conn_info.connDot11DesiredBssType )) |
| 3611 | { |
| 3612 | VOS_STATUS vosStatus; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3613 | // need to issue a disconnect to CSR. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3614 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 3615 | vosStatus = sme_RoamDisconnect( hHal, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 3616 | |
| 3617 | if(VOS_STATUS_SUCCESS == vosStatus) |
| 3618 | wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var, |
| 3619 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 3620 | } |
| 3621 | } |
| 3622 | /** wpa_supplicant 0.8.x, wext driver uses */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3623 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3624 | { |
| 3625 | return -EINVAL; |
| 3626 | } |
| 3627 | /** wpa_supplicant 0.8.x, wext driver uses */ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3628 | /** when cfg80211 defined, wpa_supplicant wext driver uses |
| 3629 | zero-length, null-string ssid for force disconnection. |
| 3630 | after disconnection (if previously connected) and cleaning ssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3631 | driver MUST return success */ |
| 3632 | if ( 0 == wrqu->essid.length ) { |
| 3633 | return 0; |
| 3634 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3635 | |
| 3636 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 3637 | &pWextState->roamProfile.uapsd_mask); |
| 3638 | if (VOS_STATUS_SUCCESS != status) |
| 3639 | { |
| 3640 | pWextState->roamProfile.uapsd_mask = 0; |
| 3641 | } |
| 3642 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3643 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3644 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = wrqu->essid.length; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3645 | |
| 3646 | 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] | 3647 | vos_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId), extra, wrqu->essid.length); |
| 3648 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion || |
| 3649 | IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion ) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3650 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3651 | //set gen ie |
| 3652 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 3653 | |
| 3654 | //set auth |
| 3655 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 3656 | } |
| 3657 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3658 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3659 | if (pAdapter->wapi_info.nWapiMode) |
| 3660 | { |
| 3661 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 3662 | { |
| 3663 | case WAPI_AUTH_MODE_PSK: |
| 3664 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3665 | 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] | 3666 | pRoamProfile->AuthType.numEntries = 1; |
| 3667 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 3668 | break; |
| 3669 | } |
| 3670 | case WAPI_AUTH_MODE_CERT: |
| 3671 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3672 | 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] | 3673 | pRoamProfile->AuthType.numEntries = 1; |
| 3674 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 3675 | break; |
| 3676 | } |
| 3677 | } // End of switch |
| 3678 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 3679 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 3680 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3681 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3682 | pRoamProfile->EncryptionType.numEntries = 1; |
| 3683 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 3684 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 3685 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 3686 | } |
| 3687 | } |
| 3688 | #endif /* FEATURE_WLAN_WAPI */ |
| 3689 | /* if previous genIE is not NULL, update AssocIE */ |
| 3690 | if (0 != pWextState->genIE.length) |
| 3691 | { |
| 3692 | memset( &pWextState->assocAddIE, 0, sizeof(pWextState->assocAddIE) ); |
| 3693 | memcpy( pWextState->assocAddIE.addIEdata, pWextState->genIE.addIEdata, |
| 3694 | pWextState->genIE.length); |
| 3695 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 3696 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 3697 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 3698 | |
| 3699 | /* clear previous genIE after use it */ |
| 3700 | memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) ); |
| 3701 | } |
| 3702 | |
| 3703 | /* assumes it is not WPS Association by default, except when pAddIEAssoc has WPS IE */ |
| 3704 | pWextState->roamProfile.bWPSAssociation = FALSE; |
| 3705 | |
| 3706 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 3707 | pWextState->roamProfile.nAddIEAssocLength)) |
| 3708 | pWextState->roamProfile.bWPSAssociation = TRUE; |
| 3709 | |
| 3710 | |
| 3711 | // Disable auto BMPS entry by PMC until DHCP is done |
| 3712 | sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), TRUE); |
| 3713 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3714 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3715 | (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3716 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 3717 | if ( eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType ) |
| 3718 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3719 | hdd_select_cbmode(pAdapter, |
| 3720 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->AdHocChannel5G); |
| 3721 | } |
| 3722 | status = sme_RoamConnect( hHal,pAdapter->sessionId, |
| 3723 | &(pWextState->roamProfile), &roamId); |
| 3724 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 3725 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 3726 | |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 3727 | EXIT(); |
| 3728 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3729 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 3730 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3731 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3732 | |
| 3733 | \brief iw_get_essid() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3734 | This function returns the essid to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3735 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3736 | \param - dev - Pointer to the net device. |
| 3737 | - info - Pointer to the iw_request_info. |
| 3738 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3739 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3740 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3742 | --------------------------------------------------------------------------*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3743 | int iw_get_essid(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3744 | struct iw_request_info *info, |
| 3745 | struct iw_point *dwrq, char *extra) |
| 3746 | { |
| 3747 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3748 | hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3749 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3750 | ENTER(); |
| 3751 | |
| 3752 | if((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 3753 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 3754 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected || |
| 3755 | pHddStaCtx->conn_info.connState == eConnectionState_IbssDisconnected) && |
| 3756 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) |
| 3757 | { |
| 3758 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 3759 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, dwrq->length); |
| 3760 | dwrq->flags = 1; |
| 3761 | } else { |
| 3762 | memset(extra, 0, dwrq->length); |
| 3763 | dwrq->length = 0; |
| 3764 | dwrq->flags = 0; |
| 3765 | } |
| 3766 | EXIT(); |
| 3767 | return 0; |
| 3768 | } |
| 3769 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3770 | |
| 3771 | \brief iw_set_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3772 | This function sets the auth type received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3773 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3774 | \param - dev - Pointer to the net device. |
| 3775 | - info - Pointer to the iw_request_info. |
| 3776 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3777 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3778 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3779 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3780 | --------------------------------------------------------------------------*/ |
| 3781 | int iw_set_auth(struct net_device *dev,struct iw_request_info *info, |
| 3782 | union iwreq_data *wrqu,char *extra) |
| 3783 | { |
| 3784 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3785 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3786 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3787 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3788 | eCsrEncryptionType mcEncryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3789 | eCsrEncryptionType ucEncryptionType; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3790 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3791 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3792 | |
| 3793 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3794 | { |
| 3795 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3796 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3797 | return -EBUSY; |
| 3798 | } |
| 3799 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3800 | switch(wrqu->param.flags & IW_AUTH_INDEX) |
| 3801 | { |
| 3802 | case IW_AUTH_WPA_VERSION: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3803 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3804 | pWextState->wpaVersion = wrqu->param.value; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3805 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3806 | break; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3808 | case IW_AUTH_CIPHER_PAIRWISE: |
| 3809 | { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3810 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3811 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3812 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3813 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 3814 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3815 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3816 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 3817 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3818 | } |
| 3819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3820 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3821 | |
| 3822 | if( (IW_AUTH_KEY_MGMT_802_1X |
| 3823 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3824 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) ) |
| 3825 | /*Dynamic WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3826 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3827 | else |
| 3828 | /*Static WEP key*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3829 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3830 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3831 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3832 | |
| 3833 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 3834 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3835 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3836 | /*Dynamic WEP key*/ |
| 3837 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 3838 | else |
| 3839 | /*Static WEP key*/ |
| 3840 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3841 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3842 | } |
| 3843 | else { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3844 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3845 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3846 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3847 | return -EINVAL; |
| 3848 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3849 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3850 | pRoamProfile->EncryptionType.numEntries = 1; |
| 3851 | pRoamProfile->EncryptionType.encryptionType[0] = ucEncryptionType; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3852 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3853 | break; |
| 3854 | case IW_AUTH_CIPHER_GROUP: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3855 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3856 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 3857 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 3858 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3860 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 3861 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 3862 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3863 | |
| 3864 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3865 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 3866 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3867 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3868 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3869 | |
| 3870 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 3871 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 3872 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3873 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3874 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3875 | |
| 3876 | else |
| 3877 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3878 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3879 | |
| 3880 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) |
| 3881 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3882 | /*Dynamic WEP keys won't work with shared keys*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3883 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 3884 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3885 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3886 | { |
| 3887 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 3888 | } |
| 3889 | else |
| 3890 | { |
| 3891 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3892 | } |
| 3893 | } |
| 3894 | else { |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3895 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3896 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3897 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3898 | return -EINVAL; |
| 3899 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3900 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3901 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 3902 | pRoamProfile->mcEncryptionType.encryptionType[0] = mcEncryptionType; |
| 3903 | } |
| 3904 | break; |
| 3905 | |
| 3906 | case IW_AUTH_80211_AUTH_ALG: |
| 3907 | { |
| 3908 | /*Save the auth algo here and set auth type to SME Roam profile |
| 3909 | in the iw_set_ap_address*/ |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3910 | if( wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3911 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3913 | else if(wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 3914 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 3915 | |
| 3916 | else if(wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 3917 | /*Not supported*/ |
| 3918 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3919 | pWextState->roamProfile.AuthType.authType[0] = pHddStaCtx->conn_info.authType; |
| 3920 | } |
| 3921 | break; |
| 3922 | |
| 3923 | case IW_AUTH_KEY_MGMT: |
| 3924 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3925 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3926 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 3927 | /*Check for CCKM AKM type */ |
| 3928 | if ( wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3929 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: CCKM AKM Set %d", |
| 3930 | __func__, wrqu->param.value); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3931 | /* Set the CCKM bit in authKeyMgmt */ |
| 3932 | /* Right now, this breaks all ref to authKeyMgmt because our |
| 3933 | * code doesn't realize it is a "bitfield" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3934 | */ |
| 3935 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 3936 | /*Set the key management to 802.1X*/ |
| 3937 | //pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3938 | pWextState->isESEConnection = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3939 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 3940 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_CCKM_RSN; |
| 3941 | } else if ( wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 3942 | /*Save the key management*/ |
| 3943 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 3944 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 3945 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 3946 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 3947 | } else if (!( wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
| 3948 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; //eCSR_AUTH_TYPE_WPA_NONE |
| 3949 | /*Save the key management anyway*/ |
| 3950 | pWextState->authKeyMgmt = wrqu->param.value; |
| 3951 | } else { // It must be IW_AUTH_KEY_MGMT_802_1X |
| 3952 | /*Save the key management*/ |
| 3953 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 3954 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 3955 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 3956 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 3957 | } |
| 3958 | #else |
| 3959 | /*Save the key management*/ |
| 3960 | pWextState->authKeyMgmt = wrqu->param.value; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 3961 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3962 | } |
| 3963 | break; |
| 3964 | |
| 3965 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 3966 | { |
| 3967 | if(wrqu->param.value) { |
| 3968 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 3969 | "Counter Measure started %d", wrqu->param.value); |
| 3970 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED; |
| 3971 | } |
| 3972 | else { |
| 3973 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 3974 | "Counter Measure stopped=%d", wrqu->param.value); |
| 3975 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED; |
| 3976 | } |
| 3977 | } |
| 3978 | break; |
| 3979 | case IW_AUTH_DROP_UNENCRYPTED: |
| 3980 | case IW_AUTH_WPA_ENABLED: |
| 3981 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 3982 | case IW_AUTH_ROAMING_CONTROL: |
| 3983 | case IW_AUTH_PRIVACY_INVOKED: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3984 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3985 | default: |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3986 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3987 | hddLog(LOGW, "%s called with unsupported auth type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3988 | wrqu->param.flags & IW_AUTH_INDEX); |
| 3989 | break; |
| 3990 | } |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3991 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3992 | EXIT(); |
| 3993 | return 0; |
| 3994 | } |
| 3995 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3996 | |
| 3997 | \brief iw_get_auth() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3998 | This function returns the auth type to the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 3999 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4000 | \param - dev - Pointer to the net device. |
| 4001 | - info - Pointer to the iw_request_info. |
| 4002 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4003 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4004 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4005 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4006 | --------------------------------------------------------------------------*/ |
| 4007 | int iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 4008 | union iwreq_data *wrqu,char *extra) |
| 4009 | { |
| 4010 | hdd_adapter_t* pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4011 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4012 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 4013 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4014 | |
| 4015 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4016 | { |
| 4017 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4018 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4019 | return -EBUSY; |
| 4020 | } |
| 4021 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4022 | switch(pRoamProfile->negotiatedAuthType) |
| 4023 | { |
| 4024 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 4025 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 4026 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 4027 | break; |
| 4028 | case eCSR_AUTH_TYPE_WPA: |
| 4029 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 4030 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 4031 | break; |
| 4032 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4033 | case eCSR_AUTH_TYPE_FT_RSN: |
| 4034 | #endif |
| 4035 | case eCSR_AUTH_TYPE_RSN: |
| 4036 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 4037 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 4038 | break; |
| 4039 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 4040 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 4041 | break; |
| 4042 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 4043 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 4044 | break; |
| 4045 | case eCSR_AUTH_TYPE_UNKNOWN: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4046 | hddLog(LOG1,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4047 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 4048 | break; |
| 4049 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 4050 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 4051 | break; |
| 4052 | case eCSR_AUTH_TYPE_WPA_PSK: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 4053 | hddLog(LOG1,"%s called with WPA PSK auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4054 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 4055 | return -EIO; |
| 4056 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4057 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 4058 | #endif |
| 4059 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4060 | #ifdef WLAN_FEATURE_11W |
| 4061 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 4062 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4063 | #endif |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 4064 | hddLog(LOG1,"%s called with RSN PSK auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4065 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 4066 | return -EIO; |
| 4067 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 4068 | hddLog(LOGE,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4069 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 4070 | return -EIO; |
| 4071 | } |
| 4072 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) |
| 4073 | { |
| 4074 | switch(pRoamProfile->negotiatedUCEncryptionType) |
| 4075 | { |
| 4076 | case eCSR_ENCRYPT_TYPE_NONE: |
| 4077 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 4078 | break; |
| 4079 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 4080 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 4081 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 4082 | break; |
| 4083 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 4084 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 4085 | break; |
| 4086 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 4087 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 4088 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 4089 | break; |
| 4090 | case eCSR_ENCRYPT_TYPE_AES: |
| 4091 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 4092 | break; |
| 4093 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 4094 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 4095 | __func__, pRoamProfile->negotiatedUCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4096 | return -EIO; |
| 4097 | } |
| 4098 | } |
| 4099 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4100 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4101 | { |
| 4102 | switch(pRoamProfile->negotiatedMCEncryptionType) |
| 4103 | { |
| 4104 | case eCSR_ENCRYPT_TYPE_NONE: |
| 4105 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 4106 | break; |
| 4107 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 4108 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 4109 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 4110 | break; |
| 4111 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 4112 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 4113 | break; |
| 4114 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 4115 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 4116 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 4117 | break; |
| 4118 | case eCSR_ENCRYPT_TYPE_AES: |
| 4119 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 4120 | break; |
| 4121 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 4122 | hddLog(LOG1, "%s called with unknown auth type %d ", |
| 4123 | __func__, pRoamProfile->negotiatedMCEncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4124 | return -EIO; |
| 4125 | } |
| 4126 | } |
| 4127 | |
| 4128 | hddLog(LOG1, "%s called with auth type %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4129 | __func__, pRoamProfile->AuthType.authType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4130 | EXIT(); |
| 4131 | return 0; |
| 4132 | } |
| 4133 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4134 | |
| 4135 | \brief iw_set_ap_address() - |
| 4136 | This function calls the sme_RoamConnect function to associate |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4137 | to the AP with the specified BSSID received from the wpa_supplicant. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4138 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4139 | \param - dev - Pointer to the net device. |
| 4140 | - info - Pointer to the iw_request_info. |
| 4141 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4142 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4143 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4144 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4145 | --------------------------------------------------------------------------*/ |
| 4146 | int iw_set_ap_address(struct net_device *dev, |
| 4147 | struct iw_request_info *info, |
| 4148 | union iwreq_data *wrqu, char *extra) |
| 4149 | { |
| 4150 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 4151 | v_U8_t *pMacAddress=NULL; |
| 4152 | ENTER(); |
| 4153 | pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data; |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 4154 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s "MAC_ADDRESS_STR, |
| 4155 | __func__, MAC_ADDR_ARRAY(pMacAddress)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4156 | vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid )); |
| 4157 | EXIT(); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4158 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4159 | return 0; |
| 4160 | } |
| 4161 | /**--------------------------------------------------------------------------- |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4162 | |
| 4163 | \brief iw_get_ap_address() - |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4164 | This function returns the BSSID to the wpa_supplicant |
| 4165 | \param - dev - Pointer to the net device. |
| 4166 | - info - Pointer to the iw_request_info. |
| 4167 | - wrqu - Pointer to the iwreq_data. |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4168 | - extra - Pointer to the data. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4169 | \return - 0 for success, non zero for failure |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 4170 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4171 | --------------------------------------------------------------------------*/ |
| 4172 | int iw_get_ap_address(struct net_device *dev, |
| 4173 | struct iw_request_info *info, |
| 4174 | union iwreq_data *wrqu, char *extra) |
| 4175 | { |
| 4176 | //hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4177 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 4178 | |
| 4179 | ENTER(); |
| 4180 | |
| 4181 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 4182 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 4183 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 4184 | memcpy(wrqu->ap_addr.sa_data,pHddStaCtx->conn_info.bssId,ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4185 | } |
| 4186 | else |
| 4187 | { |
| 4188 | memset(wrqu->ap_addr.sa_data,0,sizeof(wrqu->ap_addr.sa_data)); |
| 4189 | } |
| 4190 | EXIT(); |
| 4191 | return 0; |
| 4192 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 4193 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4194 | #ifdef WLAN_FEATURE_11W |
| 4195 | /**--------------------------------------------------------------------------- |
| 4196 | |
| 4197 | \brief hdd_indicateUnprotMgmtFrame - |
| 4198 | This function forwards the unprotected management frame to the supplicant |
| 4199 | \param - pAdapter - Pointer to HDD adapter |
| 4200 | - nFrameLength - Length of the unprotected frame being passed |
| 4201 | - pbFrames - Pointer to the frame buffer |
| 4202 | - frameType - 802.11 frame type |
| 4203 | \return - nothing |
| 4204 | |
| 4205 | --------------------------------------------------------------------------*/ |
| 4206 | void hdd_indicateUnprotMgmtFrame( hdd_adapter_t *pAdapter, |
| 4207 | tANI_U32 nFrameLength, |
| 4208 | tANI_U8* pbFrames, |
| 4209 | tANI_U8 frameType ) |
| 4210 | { |
| 4211 | tANI_U8 type = 0; |
| 4212 | tANI_U8 subType = 0; |
| 4213 | |
| 4214 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d", |
| 4215 | __func__, frameType, nFrameLength); |
| 4216 | |
| 4217 | /* Sanity Checks */ |
| 4218 | if (NULL == pAdapter) |
| 4219 | { |
| 4220 | hddLog( LOGE, FL("pAdapter is NULL")); |
| 4221 | return; |
| 4222 | } |
| 4223 | |
| 4224 | if (NULL == pAdapter->dev) |
| 4225 | { |
| 4226 | hddLog( LOGE, FL("pAdapter->dev is NULL")); |
| 4227 | return; |
| 4228 | } |
| 4229 | |
| 4230 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 4231 | { |
| 4232 | hddLog( LOGE, FL("pAdapter has invalid magic")); |
| 4233 | return; |
| 4234 | } |
| 4235 | |
| 4236 | if( !nFrameLength ) |
| 4237 | { |
| 4238 | hddLog( LOGE, FL("Frame Length is Invalid ZERO")); |
| 4239 | return; |
| 4240 | } |
| 4241 | |
| 4242 | if (NULL == pbFrames) { |
| 4243 | hddLog( LOGE, FL("pbFrames is NULL")); |
| 4244 | return; |
| 4245 | } |
| 4246 | |
| 4247 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 4248 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 4249 | |
| 4250 | /* Get pAdapter from Destination mac address of the frame */ |
| 4251 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) |
| 4252 | { |
| 4253 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, nFrameLength); |
| 4254 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 4255 | } |
| 4256 | else if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DEAUTH) |
| 4257 | { |
| 4258 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, nFrameLength); |
| 4259 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 4260 | } |
| 4261 | else |
| 4262 | { |
| 4263 | hddLog( LOGE, FL("Frame type %d and subtype %d are not valid"), type, subType); |
| 4264 | return; |
| 4265 | } |
| 4266 | } |
| 4267 | #endif |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4268 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4269 | #if defined (FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4270 | void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid, |
| 4271 | tANI_U8 state, |
| 4272 | tANI_U16 measInterval ) |
| 4273 | { |
| 4274 | union iwreq_data wrqu; |
| 4275 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 4276 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4277 | |
| 4278 | if (NULL == pAdapter) |
| 4279 | return; |
| 4280 | |
| 4281 | // create the event |
| 4282 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4283 | memset(buf, '\0', sizeof(buf)); |
| 4284 | |
| 4285 | hddLog(VOS_TRACE_LEVEL_INFO, "TSM Ind tid(%d) state(%d) MeasInt(%d)", |
| 4286 | tid, state, measInterval); |
| 4287 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 4288 | 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] | 4289 | |
| 4290 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 4291 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4292 | // send the event |
| 4293 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4294 | } |
| 4295 | |
| 4296 | void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 4297 | { |
| 4298 | union iwreq_data wrqu; |
| 4299 | char buf[IW_CUSTOM_MAX + 1]; |
| 4300 | char *pos = buf; |
| 4301 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4302 | |
| 4303 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4304 | return; |
| 4305 | |
| 4306 | // create the event |
| 4307 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4308 | memset(buf, '\0', sizeof(buf)); |
| 4309 | |
| 4310 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 4311 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXPREAUTHNOTIFY=%02x:%02x:%02x:%02x:%02x:%02x %u:%u", |
| 4312 | pRoamInfo->bssid[0], pRoamInfo->bssid[1], pRoamInfo->bssid[2], |
| 4313 | pRoamInfo->bssid[3], pRoamInfo->bssid[4], pRoamInfo->bssid[5], |
| 4314 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4315 | |
| 4316 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4317 | pos += nBytes; |
| 4318 | freeBytes -= nBytes; |
| 4319 | |
| 4320 | vos_mem_copy(pos, pRoamInfo->bssid, WNI_CFG_BSSID_LEN); |
| 4321 | pos += WNI_CFG_BSSID_LEN; |
| 4322 | freeBytes -= WNI_CFG_BSSID_LEN; |
| 4323 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 4324 | nBytes = snprintf(pos, freeBytes, " %u:%u", pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 4325 | freeBytes -= nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4326 | |
| 4327 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 4328 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4329 | |
| 4330 | // send the event |
| 4331 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4332 | } |
| 4333 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4334 | void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4335 | { |
| 4336 | union iwreq_data wrqu; |
| 4337 | char buf[IW_CUSTOM_MAX + 1]; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 4338 | int nBytes = 0; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4339 | |
| 4340 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4341 | return; |
| 4342 | |
| 4343 | // create the event |
| 4344 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4345 | memset(buf, '\0', sizeof(buf)); |
| 4346 | |
| 4347 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
| 4348 | |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 4349 | nBytes = snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4350 | |
| 4351 | wrqu.data.pointer = buf; |
Varun Reddy Yeturu | df0e7a7 | 2013-12-05 12:12:23 -0800 | [diff] [blame] | 4352 | wrqu.data.length = nBytes; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4353 | |
| 4354 | // send the event |
| 4355 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4356 | } |
| 4357 | |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 4358 | void hdd_indicateEseBcnReportNoResults(const hdd_adapter_t *pAdapter, |
| 4359 | const tANI_U16 measurementToken, |
| 4360 | const tANI_BOOLEAN flag, |
| 4361 | const tANI_U8 numBss) |
| 4362 | { |
| 4363 | union iwreq_data wrqu; |
| 4364 | char buf[IW_CUSTOM_MAX]; |
| 4365 | char *pos = buf; |
| 4366 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4367 | |
| 4368 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4369 | memset(buf, '\0', sizeof(buf)); |
| 4370 | |
| 4371 | hddLog(VOS_TRACE_LEVEL_INFO, FL("CCXBCNREP=%d %d %d"), measurementToken, flag, |
| 4372 | numBss); |
| 4373 | |
| 4374 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4375 | flag, numBss); |
| 4376 | |
| 4377 | wrqu.data.pointer = buf; |
| 4378 | wrqu.data.length = nBytes; |
| 4379 | // send the event |
| 4380 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4381 | } |
| 4382 | |
| 4383 | |
| 4384 | static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4385 | const tCsrRoamInfo *pRoamInfo) |
| 4386 | { |
| 4387 | union iwreq_data wrqu; |
| 4388 | char buf[IW_CUSTOM_MAX + 1]; |
| 4389 | char *pos = buf; |
| 4390 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4391 | tANI_U8 i = 0, len = 0; |
| 4392 | tANI_U8 tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4393 | tANI_U8 lastSent = 0, sendBss = 0; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4394 | int bcnRepFieldSize = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0].bcnReportFields); |
| 4395 | tANI_U8 ieLenByte = 1; |
| 4396 | /* CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes */ |
| 4397 | #define ESEBCNREPHEADER_LEN (18) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4398 | |
| 4399 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4400 | return; |
| 4401 | |
| 4402 | /* Custom event can pass maximum of 256 bytes of data, |
| 4403 | based on the IE len we need to identify how many BSS info can |
| 4404 | be filled in to custom event data */ |
| 4405 | /* |
| 4406 | meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4407 | bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4408 | CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4409 | */ |
| 4410 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4411 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) && (!pRoamInfo->pEseBcnReportRsp->numBss)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4412 | { |
| 4413 | hddLog(VOS_TRACE_LEVEL_INFO, "Measurement Done but no scan results"); |
| 4414 | /* If the measurement is none and no scan results found, |
| 4415 | indicate the supplicant about measurement done */ |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 4416 | hdd_indicateEseBcnReportNoResults(pAdapter, |
| 4417 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 4418 | pRoamInfo->pEseBcnReportRsp->flag, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4419 | pRoamInfo->pEseBcnReportRsp->numBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4420 | } |
| 4421 | else |
| 4422 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4423 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4424 | { |
| 4425 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4426 | memset(buf, '\0', sizeof(buf)); |
| 4427 | tot_bcn_ieLen = 0; |
| 4428 | sendBss = 0; |
| 4429 | pos = buf; |
| 4430 | freeBytes = IW_CUSTOM_MAX; |
| 4431 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4432 | for (i = lastSent; i < pRoamInfo->pEseBcnReportRsp->numBss; i++) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4433 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4434 | len = bcnRepFieldSize + ieLenByte + pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen; |
| 4435 | if ((len + tot_bcn_ieLen) > (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4436 | { |
| 4437 | break; |
| 4438 | } |
| 4439 | tot_bcn_ieLen += len; |
| 4440 | sendBss++; |
| 4441 | hddLog(VOS_TRACE_LEVEL_INFO, "i(%d) sizeof bcnReportFields(%d)" |
| 4442 | "IeLength(%d) Length of Ie(%d) totLen(%d)", |
| 4443 | i, bcnRepFieldSize, 1, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4444 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen, |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4445 | tot_bcn_ieLen); |
| 4446 | } |
| 4447 | |
| 4448 | hddLog(VOS_TRACE_LEVEL_INFO, "Sending %d BSS Info", sendBss); |
| 4449 | hddLog(VOS_TRACE_LEVEL_INFO, "CCXBCNREP=%d %d %d %d", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4450 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 4451 | sendBss, tot_bcn_ieLen); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4452 | |
| 4453 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4454 | pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag, |
| 4455 | sendBss); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4456 | pos += nBytes; |
| 4457 | freeBytes -= nBytes; |
| 4458 | |
| 4459 | /* Copy total Beacon report data length */ |
| 4460 | vos_mem_copy(pos, (char*)&tot_bcn_ieLen, sizeof(tot_bcn_ieLen)); |
| 4461 | pos += sizeof(tot_bcn_ieLen); |
| 4462 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4463 | |
| 4464 | for (i = 0; i < sendBss; i++) |
| 4465 | { |
| 4466 | hddLog(VOS_TRACE_LEVEL_INFO, "ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Arun Kumar Khandavalli | e876821 | 2014-02-17 16:43:34 +0530 | [diff] [blame] | 4467 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4468 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4469 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4470 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ChanNum, |
| 4471 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Spare, |
| 4472 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.MeasDuration, |
| 4473 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.PhyType, |
| 4474 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.RecvSigPower, |
| 4475 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ParentTsf, |
| 4476 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[0], |
| 4477 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[1], |
| 4478 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.BcnInterval, |
| 4479 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.CapabilityInfo, |
| 4480 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[0], |
| 4481 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[1], |
| 4482 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[2], |
| 4483 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[3], |
| 4484 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[4], |
| 4485 | pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[5]); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4486 | |
| 4487 | /* bcn report fields are copied */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4488 | len = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields); |
| 4489 | vos_mem_copy(pos, (char*)&pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4490 | pos += len; |
| 4491 | freeBytes -= len; |
| 4492 | |
| 4493 | /* Add 1 byte of ie len */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4494 | len = pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].ieLen; |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4495 | vos_mem_copy(pos, (char*)&len, sizeof(len)); |
| 4496 | pos += sizeof(len); |
| 4497 | freeBytes -= sizeof(len); |
| 4498 | |
| 4499 | /* copy IE from scan results */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4500 | vos_mem_copy(pos, (char*)pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].pBuf, len); |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 4501 | pos += len; |
| 4502 | freeBytes -= len; |
| 4503 | } |
| 4504 | |
| 4505 | wrqu.data.pointer = buf; |
| 4506 | wrqu.data.length = strlen(buf); |
| 4507 | |
| 4508 | // send the event |
| 4509 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4510 | lastSent += sendBss; |
| 4511 | } |
| 4512 | } |
| 4513 | } |
| 4514 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4515 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4516 | |