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