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