blob: 18d8afcb2aeef6b84b02c0b6a815de42eb40313a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028/**========================================================================
29
30 \file wlan_hdd_assoc.c
31 \brief WLAN Host Device Driver implementation
Shailender Karmuchia734f332013-04-19 14:02:48 -070032
Jeff Johnson295189b2012-06-20 16:38:30 -070033 ========================================================================*/
Shailender Karmuchia734f332013-04-19 14:02:48 -070034/**=========================================================================
35 EDIT HISTORY FOR FILE
36
37
38 This section contains comments describing changes made to the module.
39 Notice that changes are listed in reverse chronological order.
40
41
42 $Header:$ $DateTime: $ $Author: $
43
44
45 when who what, where, why
Jeff Johnson295189b2012-06-20 16:38:30 -070046 -------- --- --------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -070047 05/06/09 Shailender Created module.
Jeff Johnson295189b2012-06-20 16:38:30 -070048 ==========================================================================*/
Shailender Karmuchia734f332013-04-19 14:02:48 -070049
Jeff Johnson295189b2012-06-20 16:38:30 -070050#include "wlan_hdd_includes.h"
51#include <aniGlobal.h>
52#include "dot11f.h"
53#include "wlan_nlink_common.h"
54#include "wlan_btc_svc.h"
55#include "wlan_hdd_power.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070056#include <linux/ieee80211.h>
57#include <linux/wireless.h>
58#include <net/cfg80211.h>
59#include "wlan_hdd_cfg80211.h"
60#include "csrInsideApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070061#include "wlan_hdd_p2p.h"
Mohit Khanna698ba2a2012-12-04 15:08:18 -080062#ifdef FEATURE_WLAN_TDLS
63#include "wlan_hdd_tdls.h"
64#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070065#include "sme_Api.h"
Sushant Kaushikba6764e2014-06-30 19:52:09 +053066#include "wlan_hdd_hostapd.h"
Mukul Sharma84f27252014-07-14 18:11:42 +053067#ifdef DEBUG_ROAM_DELAY
68#include "vos_utils.h"
69#endif
70
Jeff Johnson295189b2012-06-20 16:38:30 -070071v_BOOL_t mibIsDot11DesiredBssTypeInfrastructure( hdd_adapter_t *pAdapter );
72
Shailender Karmuchia734f332013-04-19 14:02:48 -070073struct ether_addr
Jeff Johnson295189b2012-06-20 16:38:30 -070074{
75 u_char ether_addr_octet[6];
76};
77// These are needed to recognize WPA and RSN suite types
78#define HDD_WPA_OUI_SIZE 4
79v_U8_t ccpWpaOui00[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x00 };
80v_U8_t ccpWpaOui01[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x01 };
81v_U8_t ccpWpaOui02[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 };
82v_U8_t ccpWpaOui03[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x03 };
83v_U8_t ccpWpaOui04[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x04 };
84v_U8_t ccpWpaOui05[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x05 };
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080085#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -070086v_U8_t ccpWpaOui06[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080087#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -070088#define HDD_RSN_OUI_SIZE 4
89v_U8_t ccpRSNOui00[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x00 }; // group cipher
90v_U8_t ccpRSNOui01[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x01 }; // WEP-40 or RSN
91v_U8_t ccpRSNOui02[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x02 }; // TKIP or RSN-PSK
92v_U8_t ccpRSNOui03[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x03 }; // Reserved
93v_U8_t ccpRSNOui04[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x04 }; // AES-CCMP
94v_U8_t ccpRSNOui05[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 }; // WEP-104
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080095#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -070096v_U8_t ccpRSNOui06[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080097#endif /* FEATURE_WLAN_ESE */
Chet Lanctot186b5732013-03-18 10:26:30 -070098#ifdef WLAN_FEATURE_11W
99v_U8_t ccpRSNOui07[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x06 }; // RSN-PSK-SHA256
Abhishek Singhae408032014-09-25 17:22:04 +0530100/* RSN-8021X-SHA256 */
101v_U8_t ccpRSNOui08[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 };
Chet Lanctot186b5732013-03-18 10:26:30 -0700102#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700103
Shailender Karmuchia734f332013-04-19 14:02:48 -0700104#if defined(WLAN_FEATURE_VOWIFI_11R)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105// Offset where the EID-Len-IE, start.
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700106#define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2)*/
107#define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */
Jeff Johnson295189b2012-06-20 16:38:30 -0700108#endif
109
110#define BEACON_FRAME_IES_OFFSET 12
111
Chet Lanctot186b5732013-03-18 10:26:30 -0700112#ifdef WLAN_FEATURE_11W
113void hdd_indicateUnprotMgmtFrame(hdd_adapter_t *pAdapter,
114 tANI_U32 nFrameLength,
115 tANI_U8* pbFrames,
116 tANI_U8 frameType );
117#endif
118
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800119#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700120static void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid,
121 tANI_U8 state,
122 tANI_U16 measInterval );
123static void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800124static void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo);
125static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, const tCsrRoamInfo *pRoamInfo);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700126
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800127#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700128
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530129static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter,
130 tCsrRoamInfo *pRoamInfo,
131 tANI_U32 roamId,
132 eRoamCmdStatus roamStatus,
133 eCsrRoamResult roamResult );
134
Madan Mohan Koyyalamudid5acbf52012-11-28 01:45:08 +0530135v_VOID_t hdd_connSetConnectionState( hdd_station_ctx_t *pHddStaCtx,
136 eConnectionState connState )
137{
138 // save the new connection state
Arun Kumar Khandavalli94a2bb02013-12-28 19:17:25 +0530139 hddLog(LOG1, FL("ConnectionState Changed from oldState:%d to State:%d"),
140 pHddStaCtx->conn_info.connState,connState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700141 pHddStaCtx->conn_info.connState = connState;
142}
143
144// returns FALSE if not connected.
145// returns TRUE for the two 'connected' states (Infra Associated or IBSS Connected ).
146// returns the connection state. Can specify NULL if you dont' want to get the actual state.
147
Shailender Karmuchia734f332013-04-19 14:02:48 -0700148static inline v_BOOL_t hdd_connGetConnectionState( hdd_station_ctx_t *pHddStaCtx,
149 eConnectionState *pConnState )
Jeff Johnson295189b2012-06-20 16:38:30 -0700150{
Shailender Karmuchia734f332013-04-19 14:02:48 -0700151 v_BOOL_t fConnected;
Jeff Johnson295189b2012-06-20 16:38:30 -0700152 eConnectionState connState;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700153
Jeff Johnson295189b2012-06-20 16:38:30 -0700154 // get the connection state.
155 connState = pHddStaCtx->conn_info.connState;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700156 // Set the fConnected return variable based on the Connected State.
Jeff Johnson295189b2012-06-20 16:38:30 -0700157 if ( eConnectionState_Associated == connState ||
Shailender Karmuchi642e9812013-05-30 14:34:49 -0700158 eConnectionState_IbssConnected == connState ||
159 eConnectionState_IbssDisconnected == connState)
Jeff Johnson295189b2012-06-20 16:38:30 -0700160 {
161 fConnected = VOS_TRUE;
162 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700163 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700164 {
165 fConnected = VOS_FALSE;
166 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700167
Jeff Johnson295189b2012-06-20 16:38:30 -0700168 if ( pConnState )
169 {
170 *pConnState = connState;
171 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700172
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 return( fConnected );
174}
175
176v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx )
177{
178 return( hdd_connGetConnectionState( pHddStaCtx, NULL ) );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700179}
Jeff Johnson295189b2012-06-20 16:38:30 -0700180
Agarwal Ashish450ffde2014-04-08 19:53:00 +0530181eCsrBand hdd_connGetConnectedBand( hdd_station_ctx_t *pHddStaCtx )
182{
183 v_U8_t staChannel = 0;
184
185 if ( eConnectionState_Associated == pHddStaCtx->conn_info.connState )
186 {
187 staChannel = pHddStaCtx->conn_info.operationChannel;
188 }
189
190 if ( staChannel > 0 && staChannel < 14 )
191 return eCSR_BAND_24;
192 else if (staChannel >= 36 && staChannel <= 165 )
193 return eCSR_BAND_5G;
194 else /* If station is not connected return as eCSR_BAND_ALL */
195 return eCSR_BAND_ALL;
196}
197
198
Jeff Johnson295189b2012-06-20 16:38:30 -0700199//TODO - Not used anyhwere. Can be removed.
200#if 0
201//
202v_BOOL_t hdd_connIsConnectedInfra( hdd_adapter_t *pAdapter )
203{
204 v_BOOL_t fConnectedInfra = FALSE;
205 eConnectionState connState;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700206
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 if ( hdd_connGetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connState ) )
Shailender Karmuchia734f332013-04-19 14:02:48 -0700208 {
209 if ( eConnectionState_Associated == connState )
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 {
211 fConnectedInfra = TRUE;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700212 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700213 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700214
Jeff Johnson295189b2012-06-20 16:38:30 -0700215 return( fConnectedInfra );
216}
217#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -0700218
Jeff Johnson295189b2012-06-20 16:38:30 -0700219static inline v_BOOL_t hdd_connGetConnectedCipherAlgo( hdd_station_ctx_t *pHddStaCtx, eCsrEncryptionType *pConnectedCipherAlgo )
220{
221 v_BOOL_t fConnected = VOS_FALSE;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700222
Jeff Johnson295189b2012-06-20 16:38:30 -0700223 fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700224
225 if ( pConnectedCipherAlgo )
Jeff Johnson295189b2012-06-20 16:38:30 -0700226 {
227 *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType;
228 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700229
Jeff Johnson295189b2012-06-20 16:38:30 -0700230 return( fConnected );
231}
Shailender Karmuchia734f332013-04-19 14:02:48 -0700232
Jeff Johnson295189b2012-06-20 16:38:30 -0700233inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eMib_dot11DesiredBssType *pConnectedBssType )
234{
235 v_BOOL_t fConnected = VOS_FALSE;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700236
Jeff Johnson295189b2012-06-20 16:38:30 -0700237 fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700238
239 if ( pConnectedBssType )
Jeff Johnson295189b2012-06-20 16:38:30 -0700240 {
241 *pConnectedBssType = pHddStaCtx->conn_info.connDot11DesiredBssType;
242 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700243
Jeff Johnson295189b2012-06-20 16:38:30 -0700244 return( fConnected );
245}
246
247static inline void hdd_connSaveConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eCsrRoamBssType csrRoamBssType )
248{
Shailender Karmuchia734f332013-04-19 14:02:48 -0700249 switch( csrRoamBssType )
Jeff Johnson295189b2012-06-20 16:38:30 -0700250 {
251 case eCSR_BSS_TYPE_INFRASTRUCTURE:
252 pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_infrastructure;
253 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700254
Jeff Johnson295189b2012-06-20 16:38:30 -0700255 case eCSR_BSS_TYPE_IBSS:
256 case eCSR_BSS_TYPE_START_IBSS:
257 pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_independent;
258 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700259
260 /** We will never set the BssType to 'any' when attempting a connection
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 so CSR should never send this back to us.*/
Shailender Karmuchia734f332013-04-19 14:02:48 -0700262 case eCSR_BSS_TYPE_ANY:
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 default:
264 VOS_ASSERT( 0 );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700265 break;
266 }
267
Jeff Johnson295189b2012-06-20 16:38:30 -0700268}
269
270void hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType )
271{
272 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
273 eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700274
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 VOS_ASSERT( pRoamInfo );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700276
277 if ( pRoamInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700279 // Save the BSSID for the connection...
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 if ( eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType )
281 {
282 VOS_ASSERT( pRoamInfo->pBssDesc );
283 vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,6 );
284
285 // Save the Station ID for this station from the 'Roam Info'.
286 //For IBSS mode, staId is assigned in NEW_PEER_IND
287 //For reassoc, the staID doesn't change and it may be invalid in this structure
288 //so no change here.
289 if( !pRoamInfo->fReassocReq )
290 {
291 pHddStaCtx->conn_info.staId [0]= pRoamInfo->staId;
292 }
293 }
294 else if ( eCSR_BSS_TYPE_IBSS == eBssType )
Shailender Karmuchia734f332013-04-19 14:02:48 -0700295 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700296 vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,sizeof(pRoamInfo->bssid) );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700297 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 else
299 {
300 // can't happen. We need a valid IBSS or Infra setting in the BSSDescription
301 // or we can't function.
302 VOS_ASSERT( 0 );
303 }
304
305 // notify WMM
306 hdd_wmm_connect(pAdapter, pRoamInfo, eBssType);
307
308 if( !pRoamInfo->u.pConnectedProfile )
309 {
310 VOS_ASSERT( pRoamInfo->u.pConnectedProfile );
311 }
312 else
313 {
314 // Get Multicast Encryption Type
315 encryptType = pRoamInfo->u.pConnectedProfile->mcEncryptionType;
316 pHddStaCtx->conn_info.mcEncryptionType = encryptType;
317 // Get Unicast Encrytion Type
318 encryptType = pRoamInfo->u.pConnectedProfile->EncryptionType;
319 pHddStaCtx->conn_info.ucEncryptionType = encryptType;
320
321 pHddStaCtx->conn_info.authType = pRoamInfo->u.pConnectedProfile->AuthType;
322
323 pHddStaCtx->conn_info.operationChannel = pRoamInfo->u.pConnectedProfile->operationChannel;
324
325 // Save the ssid for the connection
326 vos_mem_copy( &pHddStaCtx->conn_info.SSID.SSID, &pRoamInfo->u.pConnectedProfile->SSID, sizeof( tSirMacSSid ) );
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +0530327
328 // Save dot11mode in which STA associated to AP
329 pHddStaCtx->conn_info.dot11Mode = pRoamInfo->u.pConnectedProfile->dot11Mode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700331 }
332
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 // save the connected BssType
Shailender Karmuchia734f332013-04-19 14:02:48 -0700334 hdd_connSaveConnectedBssType( pHddStaCtx, eBssType );
335
Jeff Johnson295189b2012-06-20 16:38:30 -0700336}
337
338#if defined(WLAN_FEATURE_VOWIFI_11R)
339/*
340 * Send the 11R key information to the supplicant.
341 * Only then can the supplicant generate the PMK-R1.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800342 * (BTW, the ESE supplicant also needs the Assoc Resp IEs
Jeff Johnson295189b2012-06-20 16:38:30 -0700343 * for the same purpose.)
344 *
345 * Mainly the Assoc Rsp IEs are passed here. For the IMDA
346 * this contains the R1KHID, R0KHID and the MDID.
347 * For FT, this consists of the Reassoc Rsp FTIEs.
348 * This is the Assoc Response.
349 */
Shailender Karmuchia734f332013-04-19 14:02:48 -0700350static void hdd_SendFTAssocResponse(struct net_device *dev, hdd_adapter_t *pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 tCsrRoamInfo *pCsrRoamInfo)
352{
353 union iwreq_data wrqu;
354 char *buff;
355 unsigned int len = 0;
356 u8 *pFTAssocRsp = NULL;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700357
358 if (pCsrRoamInfo->nAssocRspLength == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 {
360 hddLog(LOGE,
361 "%s: pCsrRoamInfo->nAssocRspLength=%d",
362 __func__, (int)pCsrRoamInfo->nAssocRspLength);
363 return;
364 }
365
Shailender Karmuchia734f332013-04-19 14:02:48 -0700366 pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength +
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 pCsrRoamInfo->nAssocReqLength);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700368 if (pFTAssocRsp == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700369 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700370 hddLog(LOGE, "%s: AssocReq or AssocRsp is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 return;
372 }
373
374 // pFTAssocRsp needs to point to the IEs
375 pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET;
376 hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__,
377 (unsigned int)pFTAssocRsp[0],
378 (unsigned int)pFTAssocRsp[1]);
379
380 // We need to send the IEs to the supplicant.
381 buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700382 if (buff == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700384 hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 return;
386 }
387
388 // Send the Assoc Resp, the supplicant needs this for initial Auth.
389 len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700390 wrqu.data.length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -0700391 memset(buff, 0, IW_GENERIC_IE_MAX);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700392 memcpy(buff, pFTAssocRsp, len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff);
394
395 kfree(buff);
396}
Shailender Karmuchia734f332013-04-19 14:02:48 -0700397#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -0700398
399#ifdef WLAN_FEATURE_VOWIFI_11R
400
401/*---------------------------------------------------
402 *
403 * Send the FTIEs, RIC IEs during FT. This is eventually
404 * used to send the FT events to the supplicant
405 *
406 * At the reception of Auth2 we send the RIC followed
407 * by the auth response IEs to the supplicant.
408 * Once both are received in the supplicant, an FT
409 * event is generated to the supplicant.
410 *
411 *---------------------------------------------------
412 */
413void hdd_SendFTEvent(hdd_adapter_t *pAdapter)
414{
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 tANI_U16 auth_resp_len = 0;
416 tANI_U32 ric_ies_length = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
418
Gopichand Nakkala66923aa2013-03-06 23:17:24 +0530419#if defined(KERNEL_SUPPORT_11R_CFG80211)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700420 struct cfg80211_ft_event_params ftEvent;
421 v_U8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN];
422 v_U8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN];
423 struct net_device *dev = pAdapter->dev;
424#else
425 char *buff;
426 union iwreq_data wrqu;
427 tANI_U16 str_len;
428#endif
429
Gopichand Nakkala66923aa2013-03-06 23:17:24 +0530430#if defined(KERNEL_SUPPORT_11R_CFG80211)
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530431 vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN);
432 vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700433
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530434 sme_GetRICIEs( pHddCtx->hHal, (u8 *)ricIe,
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -0800435 DOT11F_IE_FTINFO_MAX_LEN, &ric_ies_length );
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530436 if (ric_ies_length == 0)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700437 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530438 hddLog(LOGW,
439 "%s: RIC IEs is of length 0 not sending RIC Information for now",
440 __func__);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700441 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700442
443 ftEvent.ric_ies = ricIe;
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530444 ftEvent.ric_ies_len = ric_ies_length;
445 hddLog(LOG1, "%s: RIC IEs is of length %d", __func__, (int)ric_ies_length);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700446
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530447 sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe,
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -0800448 DOT11F_IE_FTINFO_MAX_LEN, &auth_resp_len);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700449
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530450 if (auth_resp_len == 0)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700451 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530452 hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700453 return;
454 }
455
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530456 sme_SetFTPreAuthState(pHddCtx->hHal, TRUE);
Gopichand Nakkala356fb102013-03-06 12:34:04 +0530457
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530458 ftEvent.target_ap = ftIe;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700459
460 ftEvent.ies = (u8 *)(ftIe + SIR_MAC_ADDR_LENGTH);
461 ftEvent.ies_len = auth_resp_len - SIR_MAC_ADDR_LENGTH;
462
Jeff Johnson59a121e2013-11-30 09:46:08 -0800463 hddLog(LOG1, "%s ftEvent.ies_len %zu", __FUNCTION__, ftEvent.ies_len);
464 hddLog(LOG1, "%s ftEvent.ric_ies_len %zu",
465 __FUNCTION__, ftEvent.ric_ies_len );
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530466 hddLog(LOG1, "%s ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x ",
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -0800467 __FUNCTION__, ftEvent.target_ap[0], ftEvent.target_ap[1],
468 ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4],
469 ftEvent.target_ap[5]);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700470
Gopichand Nakkala356fb102013-03-06 12:34:04 +0530471 (void)cfg80211_ft_event(dev, &ftEvent);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700472
473#else
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530474 // We need to send the IEs to the supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530476 if (buff == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530478 hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 return;
480 }
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530481 vos_mem_zero(buff, IW_CUSTOM_MAX);
Jeff Johnson295189b2012-06-20 16:38:30 -0700482
Shailender Karmuchia734f332013-04-19 14:02:48 -0700483 // Sme needs to send the RIC IEs first
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX);
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530485 sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]),
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -0800486 (IW_CUSTOM_MAX - str_len), &ric_ies_length );
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530487 if (ric_ies_length == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530489 hddLog(LOGW,
490 "%s: RIC IEs is of length 0 not sending RIC Information for now",
491 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 }
493 else
494 {
495 wrqu.data.length = str_len + ric_ies_length;
496 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff);
497 }
498
499 // Sme needs to provide the Auth Resp
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530500 vos_mem_zero(buff, IW_CUSTOM_MAX);
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX);
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530502 sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len],
503 (IW_CUSTOM_MAX - str_len), &auth_resp_len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700504
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530505 if (auth_resp_len == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530507 hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 return;
509 }
510
511 wrqu.data.length = str_len + auth_resp_len;
512 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff);
513
514 kfree(buff);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700515#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700516}
517
518#endif /* WLAN_FEATURE_VOWIFI_11R */
519
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800520#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700521
522/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800523 * Send the ESE required "new AP Channel info" to the supplicant.
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 * (This keeps the supplicant "up to date" on the current channel.)
525 *
526 * The current (new AP) channel information is passed in.
527 */
Shailender Karmuchia734f332013-04-19 14:02:48 -0700528static void hdd_SendNewAPChannelInfo(struct net_device *dev, hdd_adapter_t *pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 tCsrRoamInfo *pCsrRoamInfo)
530{
531 union iwreq_data wrqu;
532 tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc;
Jeff Johnson295189b2012-06-20 16:38:30 -0700533
Shailender Karmuchia734f332013-04-19 14:02:48 -0700534
535 if (descriptor == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 {
537 hddLog(LOGE,
Arif Hussain6d2a3322013-11-17 19:50:10 -0800538 "%s: pCsrRoamInfo->pBssDesc=%p",
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 __func__, descriptor);
540 return;
541 }
542
543 // Send the Channel event, the supplicant needs this to generate the Adjacent AP report.
Arif Hussain6d2a3322013-11-17 19:50:10 -0800544 hddLog(LOGW, "%s: Sending up an SIOCGIWFREQ, channelId=%d", __func__, descriptor->channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 memset(&wrqu, '\0', sizeof(wrqu));
546 wrqu.freq.m = descriptor->channelId;
547 wrqu.freq.e = 0;
548 wrqu.freq.i = 0;
549 wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL);
550}
551
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800552#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700553
554void hdd_SendUpdateBeaconIEsEvent(hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo)
555{
556 union iwreq_data wrqu;
557 u8 *pBeaconIes;
558 u8 currentLen = 0;
559 char *buff;
560 int totalIeLen = 0, currentOffset = 0, strLen;
561
562 memset(&wrqu, '\0', sizeof(wrqu));
563
564 if (0 == pCsrRoamInfo->nBeaconLength)
565 {
566 hddLog(LOGE, "%s: pCsrRoamInfo->nBeaconFrameLength = 0", __func__);
567 return;
568 }
569 pBeaconIes = (u8 *)(pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700570 if (pBeaconIes == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700572 hddLog(LOGE, "%s: Beacon IEs is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 return;
574 }
575
576 // pBeaconIes needs to point to the IEs
577 hddLog(LOG1, "%s: Beacon IEs is now at %02x%02x", __func__,
578 (unsigned int)pBeaconIes[0],
579 (unsigned int)pBeaconIes[1]);
580 hddLog(LOG1, "%s: Beacon IEs length = %d", __func__, pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700581
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 // We need to send the IEs to the supplicant.
583 buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700584 if (buff == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700586 hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 return;
588 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700589 vos_mem_zero(buff, IW_CUSTOM_MAX);
Jeff Johnson295189b2012-06-20 16:38:30 -0700590
591 strLen = strlcpy(buff,"BEACONIEs=", IW_CUSTOM_MAX);
592 currentLen = strLen + 1;
593
594 totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET;
595 do
596 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700597 /* If the beacon size exceeds max CUSTOM event size, break it into chunks of CUSTOM event
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 * max size and send it to supplicant. Changes are done in supplicant to handle this */
599 vos_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1));
600 currentLen = VOS_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1);
601 vos_mem_copy(&buff[strLen + 1], pBeaconIes+currentOffset, currentLen);
602 currentOffset += currentLen;
603 totalIeLen -= currentLen;
604 wrqu.data.length = strLen + 1 + currentLen;
605 if (totalIeLen)
Shailender Karmuchia734f332013-04-19 14:02:48 -0700606 buff[strLen] = 1; // This tells supplicant more chunks are pending
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 else
608 buff[strLen] = 0; // For last chunk of beacon IE to supplicant
609
610 hddLog(LOG1, "%s: Beacon IEs length to supplicant = %d", __func__, currentLen);
611 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff);
612 } while (totalIeLen > 0);
613
614 kfree(buff);
615}
616
617static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRoamInfo)
618{
619 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
620 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
621 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
622 union iwreq_data wrqu;
623 int we_event;
624 char *msg;
625 int type = -1;
626
Shailender Karmuchia734f332013-04-19 14:02:48 -0700627#if defined (WLAN_FEATURE_VOWIFI_11R)
628 // Added to find the auth type on the fly at run time
629 // rather than with cfg to see if FT is enabled
630 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile);
632#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -0700633
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 memset(&wrqu, '\0', sizeof(wrqu));
Shailender Karmuchia734f332013-04-19 14:02:48 -0700635 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 we_event = SIOCGIWAP;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700637
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */
639 {
Agarwal Ashish51325b52014-06-16 16:50:49 +0530640 /* In case of roaming ; We are not doing disconnect.
641 * If disconnect is not being done for roam; We will not
642 * decrease count for Active sessions. We should not increase active
643 * active session in case of roaming.
644 */
Padma, Santhosh Kumar87ba40f2014-11-26 19:40:15 +0530645 if((pHddStaCtx->ft_carrier_on == FALSE) && !pCsrRoamInfo->fReassocReq)
Agarwal Ashish51325b52014-06-16 16:50:49 +0530646 {
647 wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode);
648 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, sizeof(pCsrRoamInfo->pBssDesc->bssId));
650 type = WLAN_STA_ASSOC_DONE_IND;
651
Madan Mohan Koyyalamudi26bd7142012-10-30 18:14:19 -0700652#ifdef WLAN_FEATURE_P2P_DEBUG
653 if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
654 {
655 if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_1)
656 {
657 globalP2PConnectionStatus = P2P_CLIENT_CONNECTED_STATE_1;
658 hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from "
659 "Connecting state to Connected State for 8-way "
660 "Handshake");
661 }
662 else if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_2)
663 {
664 globalP2PConnectionStatus = P2P_CLIENT_COMPLETED_STATE;
665 hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from "
666 "Connecting state to P2P Client Connection Completed");
667 }
668 }
669#endif
Arif Hussain77d044f2014-01-03 19:56:04 -0800670 pr_info("wlan: " MAC_ADDRESS_STR " connected to " MAC_ADDRESS_STR "\n",
671 MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes),
Kiet Lam34947452014-01-21 23:23:40 -0800672 MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data));
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo);
674
675 /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or
676 * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled
677 * and fFTEnable is TRUE */
678#ifdef WLAN_FEATURE_VOWIFI_11R
679 // Send FT Keys to the supplicant when FT is enabled
680 if ((pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN_PSK) ||
Shailender Karmuchia734f332013-04-19 14:02:48 -0700681 (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800682#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 || (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) ||
684 (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA)
685#endif
686 )
687 {
688 hdd_SendFTAssocResponse(dev, pAdapter, pCsrRoamInfo);
689 }
690#endif
691 }
692 else if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) // IBss Associated
693 {
Agarwal Ashish51325b52014-06-16 16:50:49 +0530694 wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode);
Jeff Johnson4416a782013-03-25 14:17:50 -0700695 memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, ETH_ALEN);
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 type = WLAN_STA_ASSOC_DONE_IND;
Arif Hussain24bafea2013-11-15 15:10:03 -0800697 pr_info("wlan: new IBSS connection to " MAC_ADDRESS_STR"\n",
698 MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 }
700 else /* Not Associated */
701 {
702 pr_info("wlan: disconnected\n");
703 type = WLAN_STA_DISASSOC_DONE_IND;
704 memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN);
705 }
Sudhir Sattayappa Kohalli90e4c752013-03-21 14:25:04 -0700706 hdd_dump_concurrency_info(pHddCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700707
708 msg = NULL;
709 /*During the WLAN uninitialization,supplicant is stopped before the
710 driver so not sending the status of the connection to supplicant*/
Mihir Shete18156292014-03-11 15:38:30 +0530711 if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 {
713 wireless_send_event(dev, we_event, &wrqu, msg);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800714#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */
Shailender Karmuchia734f332013-04-19 14:02:48 -0700716 {
717 if ( (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) ||
718 (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 hdd_SendNewAPChannelInfo(dev, pAdapter, pCsrRoamInfo);
720 }
721#endif
722 }
723 send_btc_nlink_msg(type, 0);
724}
725
726void hdd_connRemoveConnectInfo( hdd_station_ctx_t *pHddStaCtx )
727{
728 // Remove staId, bssId and peerMacAddress
729 pHddStaCtx->conn_info.staId [ 0 ] = 0;
730 vos_mem_zero( &pHddStaCtx->conn_info.bssId, sizeof( v_MACADDR_t ) );
731 vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], sizeof( v_MACADDR_t ) );
732
733 // Clear all security settings
734 pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
735 pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
736 pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
737
738 vos_mem_zero( &pHddStaCtx->conn_info.Keys, sizeof( tCsrKeys ) );
Ravi Joshib58ca0d2013-10-29 09:50:23 -0700739 vos_mem_zero( &pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700740
741 // Set not-connected state
742 pHddStaCtx->conn_info.connDot11DesiredBssType = eCSR_BSS_TYPE_ANY;
Jeff Johnson295189b2012-06-20 16:38:30 -0700743
744 vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) );
745}
746/* TODO Revist this function. and data path */
747static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
748{
749 VOS_STATUS vosStatus;
Ravi Joshif9520d62013-10-18 04:11:46 -0700750 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
751
752 if (WLAN_HDD_IBSS != pAdapter->device_mode)
753 {
754 hdd_disconnect_tx_rx(pAdapter);
755 }
756 else
757 {
758 // Need to cleanup all queues only if the last peer leaves
759 if (eConnectionState_IbssDisconnected == pHddStaCtx->conn_info.connState)
760 {
761 netif_tx_disable(pAdapter->dev);
762 netif_carrier_off(pAdapter->dev);
763 hdd_disconnect_tx_rx(pAdapter);
764 }
765 else
766 {
767 // There is atleast one more peer, do not cleanup all queues
768 hdd_flush_ibss_tx_queues(pAdapter, staId);
769 }
770 }
771
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
773 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
774 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +0530775 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 "%s: WLANTL_ClearSTAClient() failed to for staID %d. "
Jeff Johnson0299d0a2013-10-30 12:37:43 -0700777 "Status= %d [0x%08X]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700778 __func__, staId, vosStatus, vosStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 }
780 return( vosStatus );
781}
782
783
784static eHalStatus hdd_DisConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
785 tANI_U32 roamId, eRoamCmdStatus roamStatus,
786 eCsrRoamResult roamResult )
787{
788 eHalStatus status = eHAL_STATUS_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -0700789 VOS_STATUS vstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 struct net_device *dev = pAdapter->dev;
791 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
792 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
krunal soni3fc26642013-10-08 22:41:42 -0700793 v_U8_t sta_id;
Abhishek Singha6cfaa42014-06-23 13:11:07 +0530794 v_BOOL_t sendDisconInd = TRUE;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700795
796 // Sanity check
797 if(dev == NULL)
798 {
Agarwal Ashish971c2882013-10-30 20:11:12 +0530799 hddLog(VOS_TRACE_LEVEL_ERROR,
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700800 "%s: net_dev is released return", __func__);
801 return eHAL_STATUS_FAILURE;
802 }
803
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 // notify apps that we can't pass traffic anymore
805 netif_tx_disable(dev);
806 netif_carrier_off(dev);
Mukul Sharma09ab4bd2014-11-24 18:07:26 +0530807 //TxTimeoutCount need to reset in case of disconnect handler
808 pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700809
Jeff Johnsone7245742012-09-05 17:12:55 -0700810 INIT_COMPLETION(pAdapter->disconnect_comp_var);
Abhishek Singha6cfaa42014-06-23 13:11:07 +0530811 /* HDD has initiated disconnect, do not send disconnect indication
812 * to kernel as it will be handled by __cfg80211_disconnect.
813 */
Agarwal Ashishc65b5ca2014-07-28 21:02:57 +0530814 /* If only STA mode is on */
815 if((pHddCtx->concurrency_mode <= 1) &&
816 (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <= 1))
817 {
818 pHddCtx->isAmpAllowed = VOS_TRUE;
819 }
820
Agarwal Ashish47d18112014-08-04 19:55:07 +0530821 /* Need to apply spin lock before decreasing active sessions
822 * as there can be chance for double decrement if context switch
823 * Calls wlan_hdd_disconnect.
824 */
825
826 spin_lock_bh(&pAdapter->lock_for_active_session);
Abhishek Singha6cfaa42014-06-23 13:11:07 +0530827 if ( eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState )
828 {
829 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
830 FL(" HDD has initiated a disconnect, no need to send"
831 " disconnect indication to kernel"));
832 sendDisconInd = FALSE;
833 }
Agarwal Ashishc65b5ca2014-07-28 21:02:57 +0530834 else if (eConnectionState_Associated == pHddStaCtx->conn_info.connState)
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 {
Agarwal Ashishc65b5ca2014-07-28 21:02:57 +0530836 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Agarwal Ashish47d18112014-08-04 19:55:07 +0530837 FL(" Set HDD connState to eConnectionState_Disconnecting from %d "),
838 pHddStaCtx->conn_info.connState);
Agarwal Ashishc65b5ca2014-07-28 21:02:57 +0530839 hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting );
840 wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 }
Agarwal Ashish47d18112014-08-04 19:55:07 +0530842 spin_unlock_bh(&pAdapter->lock_for_active_session);
843
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 hdd_clearRoamProfileIe( pAdapter );
Kumar Anand82c009f2014-05-29 00:29:42 -0700845
846 hdd_wmm_init( pAdapter );
Jeff Johnson295189b2012-06-20 16:38:30 -0700847
848 // indicate 'disconnect' status to wpa_supplicant...
849 hdd_SendAssociationEvent(dev,pRoamInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 /* indicate disconnected event to nl80211 */
851 if(roamStatus != eCSR_ROAM_IBSS_LEAVE)
852 {
853 /*During the WLAN uninitialization,supplicant is stopped before the
854 driver so not sending the status of the connection to supplicant*/
Mihir Shete18156292014-03-11 15:38:30 +0530855 if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700857 hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
858 "%s: sent disconnected event to nl80211",
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 __func__);
Madan Mohan Koyyalamudi26bd7142012-10-30 18:14:19 -0700860#ifdef WLAN_FEATURE_P2P_DEBUG
861 if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
862 {
863 if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTED_STATE_1)
864 {
865 globalP2PConnectionStatus = P2P_CLIENT_DISCONNECTED_STATE;
866 hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] 8 way Handshake completed "
867 "and moved to disconnected state");
868 }
869 else if(globalP2PConnectionStatus == P2P_CLIENT_COMPLETED_STATE)
870 {
871 globalP2PConnectionStatus = P2P_NOT_ACTIVE;
872 hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] P2P Client is removed "
873 "and moved to inactive state");
874 }
875 }
876#endif
Abhishek Singha6cfaa42014-06-23 13:11:07 +0530877 /*Only send indication to kernel if not initiated by kernel*/
878 if ( sendDisconInd )
Jeff Johnson295189b2012-06-20 16:38:30 -0700879 {
Abhishek Singha6cfaa42014-06-23 13:11:07 +0530880 /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */
881 if ( eCSR_ROAM_LOSTLINK == roamStatus )
882 {
883 cfg80211_disconnected(dev, pRoamInfo->reasonCode, NULL, 0, GFP_KERNEL);
884 }
885 else
886 {
887 cfg80211_disconnected(dev, WLAN_REASON_UNSPECIFIED, NULL, 0, GFP_KERNEL);
888 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 //If the Device Mode is Station
891 // and the P2P Client is Connected
892 //Enable BMPS
Jeff Johnsone7245742012-09-05 17:12:55 -0700893
894 // In case of JB, as Change-Iface may or maynot be called for p2p0
Shailender Karmuchia734f332013-04-19 14:02:48 -0700895 // Enable BMPS/IMPS in case P2P_CLIENT disconnected
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -0700896 if(VOS_STATUS_SUCCESS == hdd_issta_p2p_clientconnected(pHddCtx))
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 {
898 //Enable BMPS only of other Session is P2P Client
899 hdd_context_t *pHddCtx = NULL;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700900 v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
Jeff Johnson295189b2012-06-20 16:38:30 -0700901
902 if (NULL != pVosContext)
903 {
904 pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
905
906 if(NULL != pHddCtx)
907 {
908 //Only P2P Client is there Enable Bmps back
Agarwal Ashish51325b52014-06-16 16:50:49 +0530909 if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) &&
910 (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE]))
Jeff Johnson295189b2012-06-20 16:38:30 -0700911 {
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +0530912 if (pHddCtx->hdd_wlan_suspended)
913 {
914 hdd_set_pwrparams(pHddCtx);
915 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 hdd_enable_bmps_imps(pHddCtx);
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +0530917 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700918 }
919 }
920 }
921 }
922 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700923
Madan Mohan Koyyalamudi70c52d32013-08-07 14:42:16 +0530924 hdd_wmm_adapter_clear(pAdapter);
Mukul Sharmac159c432014-01-15 15:42:46 +0530925#if defined(WLAN_FEATURE_VOWIFI_11R)
926 sme_FTReset(WLAN_HDD_GET_HAL_CTX(pAdapter));
927#endif
Katya Nigam63ce1772014-09-26 15:53:49 +0530928
929 if (eCSR_ROAM_IBSS_LEAVE == roamStatus)
930 {
931 sta_id = IBSS_BROADCAST_STAID;
932 vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id );
933 if ( !VOS_IS_STATUS_SUCCESS(vstatus ) )
934 {
935 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
936 "hdd_roamDeregisterSTA() failed to for staID %d. "
937 "Status= %d [0x%x]",
938 sta_id, status, status );
939
940 status = eHAL_STATUS_FAILURE;
941 }
942
943 pHddCtx->sta_to_adapter[sta_id] = NULL;
944
945 }
946
947
948 sta_id = pHddStaCtx->conn_info.staId[0];
949
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 //We should clear all sta register with TL, for now, only one.
krunal soni3fc26642013-10-08 22:41:42 -0700951 vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id );
Jeff Johnson43971f52012-07-17 12:26:56 -0700952 if ( !VOS_IS_STATUS_SUCCESS(vstatus ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700953 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +0530954 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson295189b2012-06-20 16:38:30 -0700955 "hdd_roamDeregisterSTA() failed to for staID %d. "
956 "Status= %d [0x%x]",
krunal soni3fc26642013-10-08 22:41:42 -0700957 sta_id, status, status );
Jeff Johnson295189b2012-06-20 16:38:30 -0700958
959 status = eHAL_STATUS_FAILURE;
960 }
961
krunal soni3fc26642013-10-08 22:41:42 -0700962 pHddCtx->sta_to_adapter[sta_id] = NULL;
Katya Nigam63ce1772014-09-26 15:53:49 +0530963
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 // Clear saved connection information in HDD
965 hdd_connRemoveConnectInfo( pHddStaCtx );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530966 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
967 "%s: Set HDD connState to eConnectionState_NotConnected",
968 __func__);
969 hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected );
Gopichand Nakkala870cbae2013-03-15 21:16:09 +0530970#ifdef WLAN_FEATURE_GTK_OFFLOAD
971 if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
972 (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode))
973 {
Gopichand Nakkalad36ee622013-05-07 14:13:27 +0530974 memset(&pHddStaCtx->gtkOffloadReqParams, 0,
975 sizeof (tSirGtkOffloadParams));
976 pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE;
Gopichand Nakkala870cbae2013-03-15 21:16:09 +0530977 }
978#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700979
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800980#ifdef FEATURE_WLAN_TDLS
krunal soni3fc26642013-10-08 22:41:42 -0700981 if (eCSR_ROAM_IBSS_LEAVE != roamStatus)
982 {
983 wlan_hdd_tdls_disconnection_callback(pAdapter);
984 }
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800985#endif
986
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 //Unblock anyone waiting for disconnect to complete
988 complete(&pAdapter->disconnect_comp_var);
989 return( status );
990}
991static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter,
992 tCsrRoamInfo *pRoamInfo,
993 v_U8_t staId,
994 v_MACADDR_t *pPeerMacAddress,
995 tSirBssDescription *pBssDesc )
996{
997 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
998 WLAN_STADescType staDesc = {0};
999 eCsrEncryptionType connectedCipherAlgo;
1000 v_BOOL_t fConnected;
1001 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1002 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07001003 hdd_config_t *cfg_param = pHddCtx->cfg_ini;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001004
1005 if ( NULL == pBssDesc)
1006 {
1007 return VOS_STATUS_E_FAILURE;
1008 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001009 // Get the Station ID from the one saved during the assocation.
1010 staDesc.ucSTAId = staId;
1011
1012 if ( pHddStaCtx->conn_info.connDot11DesiredBssType == eMib_dot11DesiredBssType_infrastructure)
Jeff Johnson295189b2012-06-20 16:38:30 -07001013 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001014 staDesc.wSTAType = WLAN_STA_INFRA;
1015
1016 // grab the bssid from the connection info in the adapter structure and hand that
1017 // over to TL when registering.
1018 vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId,sizeof(pHddStaCtx->conn_info.bssId) );
1019 }
1020 else
1021 {
1022 // for an IBSS 'connect', setup the Station Descriptor for TL.
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 staDesc.wSTAType = WLAN_STA_IBSS;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001024
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 // Note that for IBSS, the STA MAC address and BSSID are goign to be different where
1026 // in infrastructure, they are the same (BSSID is the MAC address of the AP). So,
1027 // for IBSS we have a second field to pass to TL in the STA descriptor that we don't
1028 // pass when making an Infrastructure connection.
1029 vos_mem_copy( staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes) );
1030 vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 );
1031 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07001032
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent );
1034
1035 // set the QoS field appropriately
1036 if (hdd_wmm_is_active(pAdapter))
1037 {
1038 staDesc.ucQosEnabled = 1;
1039 }
1040 else
1041 {
1042 staDesc.ucQosEnabled = 0;
1043 }
1044
1045 fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
1046 if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE )
1047 {
1048 staDesc.ucProtectedFrame = 1;
1049 }
1050 else
1051 {
1052 staDesc.ucProtectedFrame = 0;
1053
1054 }
1055
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001056#ifdef FEATURE_WLAN_ESE
1057 staDesc.ucIsEseSta = pRoamInfo->isESEAssoc;
1058#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001059
1060#ifdef VOLANS_ENABLE_SW_REPLAY_CHECK
1061 /* check whether replay check is valid for the station or not */
1062 if( (eCSR_ENCRYPT_TYPE_TKIP == connectedCipherAlgo) || (eCSR_ENCRYPT_TYPE_AES == connectedCipherAlgo))
1063 {
1064 /* Encryption mode is either TKIP or AES
1065 and replay check is valid for only these
1066 two encryption modes */
1067 staDesc.ucIsReplayCheckValid = VOS_TRUE;
1068 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1069 "HDD register TL ucIsReplayCheckValid %d: Replay check is needed for station", staDesc.ucIsReplayCheckValid);
1070 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07001071
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 else
1073 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001074 /* For other encryption modes replay check is
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 not needed */
Shailender Karmuchia734f332013-04-19 14:02:48 -07001076 staDesc.ucIsReplayCheckValid = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001077 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1078 "HDD register TL ucIsReplayCheckValid %d", staDesc.ucIsReplayCheckValid);
1079 }
1080#endif
1081
1082#ifdef FEATURE_WLAN_WAPI
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001083 hddLog(LOG1, "%s: WAPI STA Registered: %d", __func__, pAdapter->wapi_info.fIsWapiSta);
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 if (pAdapter->wapi_info.fIsWapiSta)
1085 {
1086 staDesc.ucIsWapiSta = 1;
1087 }
1088 else
1089 {
1090 staDesc.ucIsWapiSta = 0;
1091 }
1092#endif /* FEATURE_WLAN_WAPI */
1093
1094 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
1095 "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame );
1096
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 // UMA is Not ready yet, Xlation will be done by TL
1098 staDesc.ucSwFrameTXXlation = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 staDesc.ucSwFrameRXXlation = 1;
1100 staDesc.ucAddRmvLLC = 1;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001101 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "HDD register TL QoS_enabled=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 staDesc.ucQosEnabled );
1103 // Initialize signatures and state
1104 staDesc.ucUcastSig = pRoamInfo->ucastSig;
1105 staDesc.ucBcastSig = pRoamInfo->bcastSig;
1106 staDesc.ucInitState = pRoamInfo->fAuthRequired ?
1107 WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001108 // Register the Station with TL...
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08001109 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "%s: HDD register TL ucInitState=%d", __func__, staDesc.ucInitState );
Shailender Karmuchia734f332013-04-19 14:02:48 -07001110 vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext,
1111 hdd_rx_packet_cbk,
1112 hdd_tx_complete_cbk,
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 hdd_tx_fetch_packet_cbk, &staDesc,
1114 pBssDesc->rssi );
Shailender Karmuchia734f332013-04-19 14:02:48 -07001115
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
1117 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001118 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07001119 "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]",
Jeff Johnson295189b2012-06-20 16:38:30 -07001120 vosStatus, vosStatus );
Shailender Karmuchia734f332013-04-19 14:02:48 -07001121 return vosStatus;
1122 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001123
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07001124 if ( cfg_param->dynSplitscan &&
1125 ( VOS_TIMER_STATE_RUNNING !=
1126 vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)))
1127 {
1128 vos_timer_start(&pHddCtx->tx_rx_trafficTmr,
1129 cfg_param->trafficMntrTmrForSplitScan);
1130 }
1131
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05301132 // if (WPA), tell TL to go to 'connected' and after keys come to the driver,
1133 // then go to 'authenticated'. For all other authentication types
1134 // (those that donot require upper layer authentication) we can put
1135 // TL directly into 'authenticated' state.
Shailender Karmuchia734f332013-04-19 14:02:48 -07001136 if (staDesc.wSTAType != WLAN_STA_IBSS)
1137 VOS_ASSERT( fConnected );
1138
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05301139 if ( !pRoamInfo->fAuthRequired )
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07001140 {
1141 // Connections that do not need Upper layer auth, transition TL directly
1142 // to 'Authenticated' state.
1143 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId,
1144 WLANTL_STA_AUTHENTICATED );
1145
1146 pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
1147 }
1148 else
1149 {
1150 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05301151 "ULA auth StaId= %d. Changing TL state to CONNECTED"
1152 "at Join time", pHddStaCtx->conn_info.staId[0] );
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07001153 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId,
Gopichand Nakkala29149562013-05-10 21:43:41 +05301154 WLANTL_STA_CONNECTED );
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07001155 pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE;
1156 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001157 return( vosStatus );
1158}
1159
Jeff Johnson295189b2012-06-20 16:38:30 -07001160static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter,
1161 tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength)
1162{
1163 unsigned int len = 0;
1164 u8 *pFTAssocRsp = NULL;
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07001165 v_U8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL);
Jeff Johnson295189b2012-06-20 16:38:30 -07001166 tANI_U32 rspRsnLength = 0;
1167 struct ieee80211_channel *chan;
1168
Agarwal Ashish51325b52014-06-16 16:50:49 +05301169 if (!rspRsnIe) {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07001170 hddLog(LOGE, "%s: Unable to allocate RSN IE", __func__);
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07001171 return;
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07001172 }
1173
Agarwal Ashish51325b52014-06-16 16:50:49 +05301174 if (pCsrRoamInfo == NULL) {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07001175 hddLog(LOGE, "%s: Invalid CSR roam info", __func__);
1176 goto done;
1177 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001178
Agarwal Ashish51325b52014-06-16 16:50:49 +05301179 if (pCsrRoamInfo->nAssocRspLength == 0) {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07001180 hddLog(LOGE, "%s: Invalid assoc response length", __func__);
1181 goto done;
1182 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001183
1184 pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength +
1185 pCsrRoamInfo->nAssocReqLength);
1186 if (pFTAssocRsp == NULL)
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07001187 goto done;
Jeff Johnson295189b2012-06-20 16:38:30 -07001188
1189 //pFTAssocRsp needs to point to the IEs
1190 pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET;
Arif Hussain6d2a3322013-11-17 19:50:10 -08001191 hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 (unsigned int)pFTAssocRsp[0],
1193 (unsigned int)pFTAssocRsp[1]);
1194
1195 // Send the Assoc Resp, the supplicant needs this for initial Auth.
Madan Mohan Koyyalamudi1bed23d2012-11-13 10:59:48 -08001196 len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 rspRsnLength = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07001198 memcpy(rspRsnIe, pFTAssocRsp, len);
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07001199 memset(rspRsnIe + len, 0, IW_GENERIC_IE_MAX - len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001200
1201 chan = ieee80211_get_channel(pAdapter->wdev.wiphy, (int) pCsrRoamInfo->pBssDesc->channelId);
1202 cfg80211_roamed(dev,chan,pCsrRoamInfo->bssid,
1203 reqRsnIe, reqRsnLength,
1204 rspRsnIe, rspRsnLength,GFP_KERNEL);
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07001205
1206done:
1207 kfree(rspRsnIe);
Jeff Johnson295189b2012-06-20 16:38:30 -07001208}
Jeff Johnson295189b2012-06-20 16:38:30 -07001209
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301210void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter)
1211{
1212 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
1213 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1214 tCsrRoamInfo roamInfo;
1215 roamInfo.fAuthRequired = FALSE;
1216 vos_mem_copy(roamInfo.bssid,
1217 pHddStaCtx->roam_info.bssid,
1218 WNI_CFG_BSSID_LEN);
1219 vos_mem_copy(roamInfo.peerMac,
1220 pHddStaCtx->roam_info.peerMac,
1221 WNI_CFG_BSSID_LEN);
1222
1223 halStatus = hdd_RoamSetKeyCompleteHandler(pAdapter,
1224 &roamInfo,
1225 pHddStaCtx->roam_info.roamId,
1226 pHddStaCtx->roam_info.roamStatus,
1227 eCSR_ROAM_RESULT_AUTHENTICATED);
1228 if (halStatus != eHAL_STATUS_SUCCESS)
1229 {
1230 hddLog(LOGE, "%s: Set Key complete failure", __func__);
1231 }
1232 pHddStaCtx->roam_info.deferKeyComplete = FALSE;
1233}
1234
Shailender Karmuchia734f332013-04-19 14:02:48 -07001235static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
1236 tANI_U32 roamId, eRoamCmdStatus roamStatus,
Jeff Johnson295189b2012-06-20 16:38:30 -07001237 eCsrRoamResult roamResult )
1238{
1239 struct net_device *dev = pAdapter->dev;
1240 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
1241 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Sushant Kaushikba6764e2014-06-30 19:52:09 +05301242 hdd_adapter_t *pHostapdAdapter = NULL;
Girish Gowli257a7e62014-08-02 15:50:43 +05301243 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Madan Mohan Koyyalamudi2dd4c8d2012-11-08 14:44:14 -08001244 v_U8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN];
1245 tANI_U32 reqRsnLength = DOT11F_IE_RSN_MAX_LEN;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001246#if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) || defined (WLAN_FEATURE_VOWIFI_11R)
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 int ft_carrier_on = FALSE;
1248#endif
1249 int status;
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301250 v_BOOL_t hddDisconInProgress = FALSE;
1251
1252 /* HDD has initiated disconnect, do not send connect result indication
1253 * to kernel as it will be handled by __cfg80211_disconnect.
1254 */
1255 if(( eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) &&
1256 (( eCSR_ROAM_RESULT_ASSOCIATED == roamResult) ||
1257 ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus)) )
1258 {
1259 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1260 FL(" Disconnect from HDD in progress "));
1261 hddDisconInProgress = TRUE;
1262 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07001263
Jeff Johnson295189b2012-06-20 16:38:30 -07001264 if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult )
1265 {
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301266 if ( !hddDisconInProgress )
1267 {
1268 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Abhishek Singhf4669da2014-05-26 15:07:49 +05301269 "%s: Set HDD connState to eConnectionState_Associated",
1270 __func__);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301271 hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Associated );
1272 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001273
c_hpothu44ff4e02014-05-08 00:13:57 +05301274 pAdapter->maxRateFlags = pRoamInfo->maxRateFlags;
Jeff Johnson295189b2012-06-20 16:38:30 -07001275 // Save the connection info from CSR...
1276 hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE );
1277#ifdef FEATURE_WLAN_WAPI
1278 if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE ||
1279 pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK )
1280 {
1281 pAdapter->wapi_info.fIsWapiSta = 1;
1282 }
1283 else
1284 {
1285 pAdapter->wapi_info.fIsWapiSta = 0;
1286 }
1287#endif /* FEATURE_WLAN_WAPI */
1288
1289 // indicate 'connect' status to userspace
1290 hdd_SendAssociationEvent(dev,pRoamInfo);
1291
1292
Shailender Karmuchia734f332013-04-19 14:02:48 -07001293 // Initialize the Linkup event completion variable
Jeff Johnson295189b2012-06-20 16:38:30 -07001294 INIT_COMPLETION(pAdapter->linkup_event_var);
1295
1296 /*
1297 Sometimes Switching ON the Carrier is taking time to activate the device properly. Before allowing any
1298 packet to go up to the application, device activation has to be ensured for proper queue mapping by the
Shailender Karmuchia734f332013-04-19 14:02:48 -07001299 kernel. we have registered net device notifier for device change notification. With this we will come to
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 know that the device is getting activated properly.
1301 */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001302#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Katya Nigamb130d572014-11-24 16:38:16 +05301303 if (pHddStaCtx->ft_carrier_on == FALSE && !hddDisconInProgress )
Jeff Johnson295189b2012-06-20 16:38:30 -07001304 {
1305#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07001306 // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 pAdapter->isLinkUpSvcNeeded = TRUE;
1308
Shailender Karmuchia734f332013-04-19 14:02:48 -07001309 // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 pAdapter->isLinkUpSvcNeeded = TRUE;
1311
1312 // Switch on the Carrier to activate the device
1313 netif_carrier_on(dev);
1314
1315 // Wait for the Link to up to ensure all the queues are set properly by the kernel
1316 status = wait_for_completion_interruptible_timeout(&pAdapter->linkup_event_var,
1317 msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT));
Shailender Karmuchia734f332013-04-19 14:02:48 -07001318 if(!status)
Jeff Johnson295189b2012-06-20 16:38:30 -07001319 {
1320 hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning:ASSOC_LINKUP_TIMEOUT", __func__);
1321 }
1322
1323 // Disable Linkup Event Servicing - no more service required from the net device notifier call
1324 pAdapter->isLinkUpSvcNeeded = FALSE;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001325#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07001327 else {
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 pHddStaCtx->ft_carrier_on = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001329 ft_carrier_on = TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 }
1331#endif
Sandeep Puligillad91dccb2014-06-18 11:51:48 +05301332 /* Check for STAID */
1333 if( (WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId )
1334 pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter;
1335 else
1336 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Wrong Staid: %d", __func__, pRoamInfo->staId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001337
Gopichand Nakkalac3694582013-02-13 20:51:22 -08001338#ifdef FEATURE_WLAN_TDLS
1339 wlan_hdd_tdls_connection_callback(pAdapter);
1340#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001341 //For reassoc, the station is already registered, all we need is to change the state
1342 //of the STA in TL.
1343 //If authentication is required (WPA/WPA2/DWEP), change TL to CONNECTED instead of AUTHENTICATED
Mukul Sharma5b2ff502014-11-06 14:43:50 +05301344 //pRoamInfo->fReassocReq will be set only for the reassoc to same ap
Jeff Johnson295189b2012-06-20 16:38:30 -07001345 if( !pRoamInfo->fReassocReq )
1346 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001347 struct cfg80211_bss *bss;
1348#ifdef WLAN_FEATURE_VOWIFI_11R
1349 u8 *pFTAssocRsp = NULL;
1350 unsigned int assocRsplen = 0;
1351 u8 *pFTAssocReq = NULL;
1352 unsigned int assocReqlen = 0;
1353 struct ieee80211_channel *chan;
1354#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001355 v_U8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN];
Jeff Johnson295189b2012-06-20 16:38:30 -07001356 tANI_U32 rspRsnLength = DOT11F_IE_RSN_MAX_LEN;
Jeff Johnson295189b2012-06-20 16:38:30 -07001357
1358 /* add bss_id to cfg80211 data base */
1359 bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo);
1360 if (NULL == bss)
1361 {
1362 pr_err("wlan: Not able to create BSS entry\n");
Katya Nigam346d4e92014-09-02 16:16:12 +05301363 netif_carrier_off(dev);
Jeff Johnson295189b2012-06-20 16:38:30 -07001364 return eHAL_STATUS_FAILURE;
1365 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001366#ifdef WLAN_FEATURE_VOWIFI_11R
1367 if(pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN ||
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001368 pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN_PSK )
Jeff Johnson295189b2012-06-20 16:38:30 -07001369 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001370
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001371 //Association Response
Shailender Karmuchia734f332013-04-19 14:02:48 -07001372 pFTAssocRsp = (u8 *)(pRoamInfo->pbFrames + pRoamInfo->nBeaconLength +
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001373 pRoamInfo->nAssocReqLength);
Shailender Karmuchia734f332013-04-19 14:02:48 -07001374 if (pFTAssocRsp != NULL)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001375 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001376 // pFTAssocRsp needs to point to the IEs
1377 pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET;
1378 hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__,
1379 (unsigned int)pFTAssocRsp[0],
1380 (unsigned int)pFTAssocRsp[1]);
1381 assocRsplen = pRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001382 }
1383 else
1384 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001385 hddLog(LOGE, "%s:AssocRsp is NULL", __func__);
1386 assocRsplen = 0;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001387 }
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001388
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001389 //Association Request
Shailender Karmuchia734f332013-04-19 14:02:48 -07001390 pFTAssocReq = (u8 *)(pRoamInfo->pbFrames +
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001391 pRoamInfo->nBeaconLength);
Shailender Karmuchia734f332013-04-19 14:02:48 -07001392 if (pFTAssocReq != NULL)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001393 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001394 if(!ft_carrier_on)
1395 {
1396 // pFTAssocReq needs to point to the IEs
1397 pFTAssocReq += FT_ASSOC_REQ_IES_OFFSET;
1398 hddLog(LOG1, "%s: pFTAssocReq is now at %02x%02x", __func__,
1399 (unsigned int)pFTAssocReq[0],
1400 (unsigned int)pFTAssocReq[1]);
1401 assocReqlen = pRoamInfo->nAssocReqLength - FT_ASSOC_REQ_IES_OFFSET;
1402 }
1403 else
1404 {
1405 /* This should contain only the FTIEs */
1406 assocReqlen = pRoamInfo->nAssocReqLength;
1407 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001408 }
1409 else
1410 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001411 hddLog(LOGE, "%s:AssocReq is NULL", __func__);
1412 assocReqlen = 0;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001413 }
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001414
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001415 if(ft_carrier_on)
1416 {
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301417 if ( !hddDisconInProgress )
1418 {
1419 hddLog(LOG1, "%s ft_carrier_on is %d, sending roamed "
Arif Hussain6d2a3322013-11-17 19:50:10 -08001420 "indication", __FUNCTION__, ft_carrier_on);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301421 chan = ieee80211_get_channel(pAdapter->wdev.wiphy,
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001422 (int)pRoamInfo->pBssDesc->channelId);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301423 hddLog(LOG1, "assocReqlen %d assocRsplen %d", assocReqlen,
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001424 assocRsplen);
Girish Gowlidf0ed732014-08-11 12:39:39 +05301425#ifdef DEBUG_ROAM_DELAY
1426 //HACK we are using the buff len as Auth Type
1427 vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0);
1428#endif
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301429 cfg80211_roamed(dev,chan, pRoamInfo->bssid,
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001430 pFTAssocReq, assocReqlen, pFTAssocRsp, assocRsplen,
1431 GFP_KERNEL);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301432 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301433 if (sme_GetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter)))
1434 {
1435 sme_SetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter), FALSE);
1436 pRoamInfo->fAuthRequired = FALSE;
1437
1438 vos_mem_copy(pHddStaCtx->roam_info.bssid,
1439 pRoamInfo->bssid,
1440 HDD_MAC_ADDR_LEN);
1441 vos_mem_copy(pHddStaCtx->roam_info.peerMac,
1442 pRoamInfo->peerMac,
1443 HDD_MAC_ADDR_LEN);
1444 pHddStaCtx->roam_info.roamId = roamId;
1445 pHddStaCtx->roam_info.roamStatus = roamStatus;
1446 pHddStaCtx->roam_info.deferKeyComplete = TRUE;
1447 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001448 }
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301449 else if ( !hddDisconInProgress )
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001450 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001451 hddLog(LOG1, "%s ft_carrier_on is %d, sending connect "
Arif Hussain6d2a3322013-11-17 19:50:10 -08001452 "indication", __FUNCTION__, ft_carrier_on);
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001453 cfg80211_connect_result(dev, pRoamInfo->bssid,
1454 pFTAssocReq, assocReqlen,
1455 pFTAssocRsp, assocRsplen,
1456 WLAN_STATUS_SUCCESS,
1457 GFP_KERNEL);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001458 }
1459 }
1460 else
1461#endif
1462 {
1463 /* wpa supplicant expecting WPA/RSN IE in connect result */
1464 csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
1465 pAdapter->sessionId,
1466 &reqRsnLength,
1467 reqRsnIe);
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001468
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001469 csrRoamGetWpaRsnRspIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
1470 pAdapter->sessionId,
1471 &rspRsnLength,
1472 rspRsnIe);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301473 if ( !hddDisconInProgress )
1474 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001475#if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301476 if(ft_carrier_on)
Mukul Sharma84f27252014-07-14 18:11:42 +05301477 {
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301478 hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength);
Mukul Sharma84f27252014-07-14 18:11:42 +05301479#ifdef DEBUG_ROAM_DELAY
1480 //HACK we are using the buff len as Auth Type
1481 vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0);
1482#endif
1483 }
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301484 else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001485#endif /* FEATURE_WLAN_ESE */
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001486
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301487 {
1488 hddLog(VOS_TRACE_LEVEL_INFO,
Deepthi Gowri6649f6a2014-02-18 17:31:23 +05301489 "%s: sending connect indication to nl80211:"
1490 " for bssid " MAC_ADDRESS_STR
1491 " reason:%d and Status:%d\n",
1492 __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid),
1493 roamResult, roamStatus);
1494
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301495 /* inform connect result to nl80211 */
1496 cfg80211_connect_result(dev, pRoamInfo->bssid,
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08001497 reqRsnIe, reqRsnLength,
1498 rspRsnIe, rspRsnLength,
1499 WLAN_STATUS_SUCCESS,
1500 GFP_KERNEL);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301501 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001502 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001503 }
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301504 if ( !hddDisconInProgress )
1505 {
1506 cfg80211_put_bss(
Yue Maf49ba872013-08-19 12:04:25 -07001507#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301508 pHddCtx->wiphy,
Yue Maf49ba872013-08-19 12:04:25 -07001509#endif
1510 bss);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301511 // Register the Station with TL after associated...
1512 vosStatus = hdd_roamRegisterSTA( pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 pRoamInfo,
1514 pHddStaCtx->conn_info.staId[ 0 ],
1515 NULL,
1516 pRoamInfo->pBssDesc );
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301517 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001518 }
1519 else
1520 {
Madan Mohan Koyyalamudi2dd4c8d2012-11-08 14:44:14 -08001521 /* wpa supplicant expecting WPA/RSN IE in connect result */
1522 /* in case of reassociation also need to indicate it to supplicant */
1523 csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
1524 pAdapter->sessionId,
1525 &reqRsnLength,
1526 reqRsnIe);
1527
1528 hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07001529 //Reassoc successfully
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05301530 if( pRoamInfo->fAuthRequired )
1531 {
1532 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext,
1533 pHddStaCtx->conn_info.staId[ 0 ],
1534 WLANTL_STA_CONNECTED );
1535 pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE;
1536 }
1537 else
1538 {
1539 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
1540 "%s: staId: %d Changing TL state to AUTHENTICATED",
1541 __func__, pHddStaCtx->conn_info.staId[ 0 ] );
1542 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext,
1543 pHddStaCtx->conn_info.staId[ 0 ],
1544 WLANTL_STA_AUTHENTICATED );
1545 pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
1546 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 }
1548
1549 if ( VOS_IS_STATUS_SUCCESS( vosStatus ) )
1550 {
1551 // perform any WMM-related association processing
1552 hdd_wmm_assoc(pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE);
1553 }
1554 else
1555 {
1556 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07001557 "Cannot register STA with TL. Failed with vosStatus = %d [%08X]",
Jeff Johnson295189b2012-06-20 16:38:30 -07001558 vosStatus, vosStatus );
1559 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001560#ifdef WLAN_FEATURE_11W
1561 vos_mem_zero( &pAdapter->hdd_stats.hddPmfStats,
1562 sizeof(pAdapter->hdd_stats.hddPmfStats) );
1563#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 // Start the Queue
Katya Nigamb130d572014-11-24 16:38:16 +05301565 if ( !hddDisconInProgress )
1566 netif_tx_wake_all_queues(dev);
Mukul Sharma84f27252014-07-14 18:11:42 +05301567#ifdef DEBUG_ROAM_DELAY
1568 vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0);
1569#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07001570 }
1571 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001573 hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
1574
1575 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07001576 if (pRoamInfo)
Arif Hussain24bafea2013-11-15 15:10:03 -08001577 pr_info("wlan: connection failed with " MAC_ADDRESS_STR
1578 " reason:%d and Status:%d\n",
1579 MAC_ADDR_ARRAY(pRoamInfo->bssid),
1580 roamResult, roamStatus);
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07001581 else
Arif Hussain24bafea2013-11-15 15:10:03 -08001582 pr_info("wlan: connection failed with " MAC_ADDRESS_STR
1583 " reason:%d and Status:%d\n",
1584 MAC_ADDR_ARRAY(pWextState->req_bssId),
1585 roamResult, roamStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001586
Abhishek Singhf4669da2014-05-26 15:07:49 +05301587 /* Set connection state to eConnectionState_NotConnected only when CSR
1588 * has completed operation - with a ASSOCIATION_FAILURE status
1589 */
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301590 if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress )
Abhishek Singhf4669da2014-05-26 15:07:49 +05301591 {
1592 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1593 "%s: Set HDD connState to eConnectionState_NotConnected",
1594 __func__);
1595 hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected);
1596 }
Agarwal Ashish51325b52014-06-16 16:50:49 +05301597 if((pHddCtx->concurrency_mode <= 1) &&
1598 (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001599 {
1600 pHddCtx->isAmpAllowed = VOS_TRUE;
1601 }
1602
1603 //If the Device Mode is Station
1604 // and the P2P Client is Connected
1605 //Enable BMPS
Jeff Johnsone7245742012-09-05 17:12:55 -07001606
1607 // In case of JB, as Change-Iface may or maynot be called for p2p0
Shailender Karmuchia734f332013-04-19 14:02:48 -07001608 // Enable BMPS/IMPS in case P2P_CLIENT disconnected
Jeff Johnsone7245742012-09-05 17:12:55 -07001609 if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
1610 (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) &&
Agarwal Ashish51325b52014-06-16 16:50:49 +05301611 (vos_concurrent_open_sessions_running()))
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 {
1613 //Enable BMPS only of other Session is P2P Client
1614 hdd_context_t *pHddCtx = NULL;
1615 v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
1616
1617 if (NULL != pVosContext)
1618 {
1619 pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
1620
1621 if(NULL != pHddCtx)
1622 {
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05301623 //Only P2P Client is there Enable Bmps back
Agarwal Ashish51325b52014-06-16 16:50:49 +05301624 if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) &&
1625 (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE]))
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05301626 {
1627 if (pHddCtx->hdd_wlan_suspended)
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08001628 {
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05301629 hdd_set_pwrparams(pHddCtx);
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08001630 }
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05301631 hdd_enable_bmps_imps(pHddCtx);
1632 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 }
1634 }
1635 }
1636
James Zmudafbf5ffc2013-03-25 12:45:35 -07001637 /* CR465478: Only send up a connection failure result when CSR has
Varun Reddy Yeturuda7f0d52013-12-20 11:16:57 -08001638 * completed operation - with a ASSOCIATION_FAILURE status.*/
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301639 if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress )
Jeff Johnsone7245742012-09-05 17:12:55 -07001640 {
Deepthi Gowri6649f6a2014-02-18 17:31:23 +05301641 if (pRoamInfo)
1642 hddLog(VOS_TRACE_LEVEL_ERROR,
1643 "%s: send connect failure to nl80211:"
1644 " for bssid " MAC_ADDRESS_STR
1645 " reason:%d and Status:%d\n" ,
1646 __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid),
1647 roamResult, roamStatus);
1648 else
1649 hddLog(VOS_TRACE_LEVEL_ERROR,
1650 "%s: connect failed:"
1651 " for bssid " MAC_ADDRESS_STR
1652 " reason:%d and Status:%d\n" ,
1653 __func__, MAC_ADDR_ARRAY(pWextState->req_bssId),
1654 roamResult, roamStatus);
1655
c_hpothudaa90e22014-06-24 17:23:43 +05301656 /*Clear the roam profile*/
1657 hdd_clearRoamProfileIe( pAdapter );
1658
James Zmudafbf5ffc2013-03-25 12:45:35 -07001659 /* inform association failure event to nl80211 */
1660 if ( eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult )
1661 {
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07001662 if (pRoamInfo)
1663 cfg80211_connect_result ( dev, pRoamInfo->bssid,
1664 NULL, 0, NULL, 0,
1665 WLAN_STATUS_ASSOC_DENIED_UNSPEC,
1666 GFP_KERNEL );
1667 else
1668 cfg80211_connect_result ( dev, pWextState->req_bssId,
1669 NULL, 0, NULL, 0,
1670 WLAN_STATUS_ASSOC_DENIED_UNSPEC,
1671 GFP_KERNEL );
James Zmudafbf5ffc2013-03-25 12:45:35 -07001672 }
1673 else
1674 {
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07001675 if (pRoamInfo)
1676 cfg80211_connect_result ( dev, pRoamInfo->bssid,
1677 NULL, 0, NULL, 0,
1678 WLAN_STATUS_UNSPECIFIED_FAILURE,
1679 GFP_KERNEL );
1680 else
1681 cfg80211_connect_result ( dev, pWextState->req_bssId,
1682 NULL, 0, NULL, 0,
1683 WLAN_STATUS_UNSPECIFIED_FAILURE,
1684 GFP_KERNEL );
James Zmudafbf5ffc2013-03-25 12:45:35 -07001685 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001686 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001687
Kumar Anand82c009f2014-05-29 00:29:42 -07001688 hdd_wmm_init( pAdapter );
Madan Mohan Koyyalamudiee255f12012-09-28 15:41:19 -07001689
c_hpothu24f40982014-04-18 18:00:36 +05301690 if (pRoamInfo)
1691 {
1692 WLANTL_AssocFailed(pRoamInfo->staId);
1693 }
Mihir Sheteb7337272014-04-11 15:53:08 +05301694
Jeff Johnson295189b2012-06-20 16:38:30 -07001695 netif_tx_disable(dev);
1696 netif_carrier_off(dev);
Shailender Karmuchia734f332013-04-19 14:02:48 -07001697
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 }
1699
Sushant Kaushikbf584e92014-08-06 17:59:20 +05301700 if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult)
Sushant Kaushikba6764e2014-06-30 19:52:09 +05301701 {
1702 pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP);
1703 if (pHostapdAdapter != NULL)
1704 {
Sushant Kaushikbf584e92014-08-06 17:59:20 +05301705 /* Restart SAP if its operating channel is different
1706 * from AP channel.
1707 */
1708 if (pHostapdAdapter->sessionCtx.ap.operatingChannel !=
1709 (int)pRoamInfo->pBssDesc->channelId)
1710 {
1711 hddLog(VOS_TRACE_LEVEL_INFO,"Restart Sap as SAP channel is %d "
1712 "and STA channel is %d", pHostapdAdapter->sessionCtx.ap.operatingChannel,
1713 (int)pRoamInfo->pBssDesc->channelId);
1714 hdd_restart_softap(pHddCtx, pHostapdAdapter);
1715 }
Sushant Kaushikba6764e2014-06-30 19:52:09 +05301716 }
1717 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001718 return eHAL_STATUS_SUCCESS;
1719}
1720
1721/**============================================================================
1722 *
Jeff Johnson81c17882013-05-03 09:53:35 -07001723 @brief hdd_RoamIbssIndicationHandler() - Here we update the status of the
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 Ibss when we receive information that we have started/joined an ibss session
Shailender Karmuchia734f332013-04-19 14:02:48 -07001725
Jeff Johnson295189b2012-06-20 16:38:30 -07001726 ===========================================================================*/
Jeff Johnson81c17882013-05-03 09:53:35 -07001727static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter,
1728 tCsrRoamInfo *pRoamInfo,
1729 tANI_U32 roamId,
1730 eRoamCmdStatus roamStatus,
1731 eCsrRoamResult roamResult )
Jeff Johnson295189b2012-06-20 16:38:30 -07001732{
Jeff Johnson81c17882013-05-03 09:53:35 -07001733 hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d",
1734 __func__, pAdapter->dev->name, roamId, roamStatus, roamResult);
1735
Jeff Johnson295189b2012-06-20 16:38:30 -07001736 switch( roamResult )
1737 {
1738 // both IBSS Started and IBSS Join should come in here.
1739 case eCSR_ROAM_RESULT_IBSS_STARTED:
1740 case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS:
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07001741 case eCSR_ROAM_RESULT_IBSS_COALESCED:
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001743 hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
1744 v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001745
Jeff Johnson81c17882013-05-03 09:53:35 -07001746 if (NULL == pRoamInfo)
1747 {
1748 VOS_ASSERT(0);
1749 return;
1750 }
1751
1752 /* When IBSS Started comes from CSR, we need to move
1753 * connection state to IBSS Disconnected (meaning no peers
1754 * are in the IBSS).
1755 */
Abhishek Singhf4669da2014-05-26 15:07:49 +05301756 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1757 "%s: Set HDD connState to eConnectionState_IbssDisconnected",
1758 __func__);
Jeff Johnson81c17882013-05-03 09:53:35 -07001759 hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
1760 eConnectionState_IbssDisconnected );
Abhishek Singh1c21c4d2014-04-25 16:40:19 +05301761 /*notify wmm */
1762 hdd_wmm_connect(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS);
Shailender Karmuchia734f332013-04-19 14:02:48 -07001763 pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter;
1764 hdd_roamRegisterSTA (pAdapter, pRoamInfo,
1765 IBSS_BROADCAST_STAID,
1766 &broadcastMacAddr, pRoamInfo->pBssDesc);
Jeff Johnson295189b2012-06-20 16:38:30 -07001767
Jeff Johnson81c17882013-05-03 09:53:35 -07001768 if (pRoamInfo->pBssDesc)
1769 {
1770 struct cfg80211_bss *bss;
1771
1772 /* we created the IBSS, notify supplicant */
1773 hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: created ibss "
1774 MAC_ADDRESS_STR,
1775 __func__, pAdapter->dev->name,
1776 MAC_ADDR_ARRAY(pRoamInfo->pBssDesc->bssId));
1777
1778 /* we must first give cfg80211 the BSS information */
1779 bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo);
1780 if (NULL == bss)
1781 {
1782 hddLog(VOS_TRACE_LEVEL_ERROR,
1783 "%s: %s: unable to create IBSS entry",
1784 __func__, pAdapter->dev->name);
1785 return;
1786 }
1787
1788 cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL);
Yue Maf49ba872013-08-19 12:04:25 -07001789 cfg80211_put_bss(
1790#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
1791 pHddCtx->wiphy,
1792#endif
1793 bss);
Jeff Johnson81c17882013-05-03 09:53:35 -07001794 }
1795
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 break;
1797 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07001798
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 case eCSR_ROAM_RESULT_IBSS_START_FAILED:
1800 {
Jeff Johnson81c17882013-05-03 09:53:35 -07001801 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unable to create IBSS",
1802 __func__, pAdapter->dev->name);
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 break;
1804 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07001805
Jeff Johnson295189b2012-06-20 16:38:30 -07001806 default:
Jeff Johnson81c17882013-05-03 09:53:35 -07001807 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unexpected result %d",
1808 __func__, pAdapter->dev->name, (int)roamResult);
Jeff Johnson295189b2012-06-20 16:38:30 -07001809 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001810 }
1811
Jeff Johnson81c17882013-05-03 09:53:35 -07001812 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001813}
1814
1815/**============================================================================
1816 *
1817 @brief roamSaveIbssStation() - Save the IBSS peer MAC address in the adapter.
1818 This information is passed to iwconfig later. The peer that joined
1819 last is passed as information to iwconfig.
Shailender Karmuchia734f332013-04-19 14:02:48 -07001820 If we add HDD_MAX_NUM_IBSS_STA or less STA we return success else we
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 return FALSE.
Shailender Karmuchia734f332013-04-19 14:02:48 -07001822
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 ===========================================================================*/
1824static int roamSaveIbssStation( hdd_station_ctx_t *pHddStaCtx, v_U8_t staId, v_MACADDR_t *peerMacAddress )
1825{
1826 int fSuccess = FALSE;
1827 int idx = 0;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001828
Jeff Johnson295189b2012-06-20 16:38:30 -07001829 for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
1830 {
1831 if ( 0 == pHddStaCtx->conn_info.staId[ idx ] )
1832 {
1833 pHddStaCtx->conn_info.staId[ idx ] = staId;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001834
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ], peerMacAddress );
Shailender Karmuchia734f332013-04-19 14:02:48 -07001836
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 fSuccess = TRUE;
1838 break;
1839 }
1840 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07001841
1842 return( fSuccess );
Jeff Johnson295189b2012-06-20 16:38:30 -07001843}
1844/**============================================================================
1845 *
1846 @brief roamRemoveIbssStation() - Remove the IBSS peer MAC address in the adapter.
Shailender Karmuchia734f332013-04-19 14:02:48 -07001847 If we remove HDD_MAX_NUM_IBSS_STA or less STA we return success else we
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 return FALSE.
Shailender Karmuchia734f332013-04-19 14:02:48 -07001849
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 ===========================================================================*/
Ravi Joshicc57ed42013-10-12 16:31:25 -07001851static int roamRemoveIbssStation( hdd_adapter_t *pAdapter, v_U8_t staId )
Jeff Johnson295189b2012-06-20 16:38:30 -07001852{
1853 int fSuccess = FALSE;
1854 int idx = 0;
1855 v_U8_t valid_idx = 0;
1856 v_U8_t del_idx = 0;
Ravi Joshi8a934352013-09-25 16:46:58 -07001857 v_U8_t empty_slots = 0;
Ravi Joshicc57ed42013-10-12 16:31:25 -07001858 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Shailender Karmuchia734f332013-04-19 14:02:48 -07001859
Jeff Johnson295189b2012-06-20 16:38:30 -07001860 for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
1861 {
1862 if ( staId == pHddStaCtx->conn_info.staId[ idx ] )
1863 {
1864 pHddStaCtx->conn_info.staId[ idx ] = 0;
1865
1866 vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] );
1867
1868 fSuccess = TRUE;
Ravi Joshi8a934352013-09-25 16:46:58 -07001869
Jeff Johnson295189b2012-06-20 16:38:30 -07001870 // Note the deleted Index, if its 0 we need special handling
1871 del_idx = idx;
Ravi Joshi8a934352013-09-25 16:46:58 -07001872
1873 empty_slots++;
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 }
1875 else
1876 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001877 if (pHddStaCtx->conn_info.staId[idx] != 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 {
1879 valid_idx = idx;
1880 }
Ravi Joshi8a934352013-09-25 16:46:58 -07001881 else
1882 {
1883 // Found an empty slot
1884 empty_slots++;
1885 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001886 }
1887 }
1888
Ravi Joshi8a934352013-09-25 16:46:58 -07001889 if (HDD_MAX_NUM_IBSS_STA == empty_slots)
1890 {
1891 // Last peer departed, set the IBSS state appropriately
1892 pHddStaCtx->conn_info.connState = eConnectionState_IbssDisconnected;
Ravi Joshicc57ed42013-10-12 16:31:25 -07001893 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Ravi Joshi8a934352013-09-25 16:46:58 -07001894 "Last IBSS Peer Departed!!!" );
1895 }
1896
Jeff Johnson295189b2012-06-20 16:38:30 -07001897 // Find next active staId, to have a valid sta trigger for TL.
1898 if (fSuccess == TRUE)
1899 {
1900 if (del_idx == 0)
1901 {
1902 if (pHddStaCtx->conn_info.staId[valid_idx] != 0)
1903 {
1904 pHddStaCtx->conn_info.staId[0] = pHddStaCtx->conn_info.staId[valid_idx];
1905 vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ 0 ],
1906 &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ]);
1907
1908 pHddStaCtx->conn_info.staId[valid_idx] = 0;
1909 vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ] );
1910 }
1911 }
1912 }
1913 return( fSuccess );
1914}
1915
1916/**============================================================================
1917 *
Shailender Karmuchia734f332013-04-19 14:02:48 -07001918 @brief roamIbssConnectHandler() : We update the status of the IBSS to
Jeff Johnson295189b2012-06-20 16:38:30 -07001919 connected in this function.
Shailender Karmuchia734f332013-04-19 14:02:48 -07001920
Jeff Johnson295189b2012-06-20 16:38:30 -07001921 ===========================================================================*/
1922static eHalStatus roamIbssConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo )
1923{
Shailender Karmuchi642e9812013-05-30 14:34:49 -07001924 struct cfg80211_bss *bss;
Abhishek Singhf4669da2014-05-26 15:07:49 +05301925 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1926 "%s: IBSS Connect Indication from SME!!! "
1927 "Set HDD connState to eConnectionState_IbssConnected",
1928 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 // Set the internal connection state to show 'IBSS Connected' (IBSS with a partner stations)...
1930 hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssConnected );
1931
1932 // Save the connection info from CSR...
1933 hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS );
1934
1935 // Send the bssid address to the wext.
1936 hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 /* add bss_id to cfg80211 data base */
Shailender Karmuchi642e9812013-05-30 14:34:49 -07001938 bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo);
1939 if (NULL == bss)
1940 {
1941 hddLog(VOS_TRACE_LEVEL_ERROR,
1942 "%s: %s: unable to create IBSS entry",
1943 __func__, pAdapter->dev->name);
1944 return eHAL_STATUS_FAILURE;
1945 }
Yue Maf49ba872013-08-19 12:04:25 -07001946 cfg80211_put_bss(
1947#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
1948 WLAN_HDD_GET_CTX(pAdapter)->wiphy,
1949#endif
1950 bss);
Jeff Johnson295189b2012-06-20 16:38:30 -07001951
1952 return( eHAL_STATUS_SUCCESS );
1953}
1954/**============================================================================
1955 *
Mukul Sharmad2589a52014-04-23 21:06:25 +05301956 @brief hdd_ReConfigSuspendDataClearedDuringRoaming() - Reconfigure the
1957 suspend related data which was cleared during roaming in FWR.
1958
1959 ===========================================================================*/
1960static void hdd_ReConfigSuspendDataClearedDuringRoaming(hdd_context_t *pHddCtx)
1961{
1962 VOS_STATUS vstatus = VOS_STATUS_E_FAILURE;
1963 hdd_adapter_t *pAdapter;
1964 hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
1965 ENTER();
1966
1967 spin_lock(&pHddCtx->filter_lock);
1968 if (VOS_FALSE == pHddCtx->sus_res_mcastbcast_filter_valid)
1969 {
1970 pHddCtx->sus_res_mcastbcast_filter =
1971 pHddCtx->configuredMcastBcastFilter;
1972 pHddCtx->sus_res_mcastbcast_filter_valid = VOS_TRUE;
1973 hddLog(VOS_TRACE_LEVEL_INFO, FL("offload: callback to associated"));
1974 hddLog(VOS_TRACE_LEVEL_INFO,
1975 FL("saving configuredMcastBcastFilter = %d"),
1976 pHddCtx->configuredMcastBcastFilter);
1977 hddLog(VOS_TRACE_LEVEL_INFO,
1978 FL("offload: calling hdd_conf_mcastbcast_filter"));
1979 }
1980 spin_unlock(&pHddCtx->filter_lock);
1981
1982 hdd_conf_mcastbcast_filter(pHddCtx, TRUE);
1983 if(pHddCtx->hdd_mcastbcast_filter_set != TRUE)
1984 hddLog(VOS_TRACE_LEVEL_ERROR, FL("Not able to set mcast/bcast filter "));
1985
1986 vstatus = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
1987 //No need to configure GTK Offload from here because it might possible
1988 //cfg80211_set_rekey_data might not yet came, anyway GTK offload will
1989 //be handled as part of cfg80211_set_rekey_data processing.
1990 while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == vstatus )
1991 {
1992 pAdapter = pAdapterNode->pAdapter;
1993 if( pAdapter &&
1994 (( pAdapter->device_mode == WLAN_HDD_INFRA_STATION) ||
1995 (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)))
1996 {
1997 if (pHddCtx->cfg_ini->fhostArpOffload)
1998 {
1999 //Configure ARPOFFLOAD
2000 vstatus = hdd_conf_arp_offload(pAdapter, TRUE);
2001 if (!VOS_IS_STATUS_SUCCESS(vstatus))
2002 {
2003 hddLog(VOS_TRACE_LEVEL_ERROR,
2004 FL("Failed to disable ARPOffload Feature %d"), vstatus);
2005 }
2006 }
2007#ifdef WLAN_NS_OFFLOAD
2008 //Configure NSOFFLOAD
2009 if (pHddCtx->cfg_ini->fhostNSOffload)
2010 {
2011 hdd_conf_ns_offload(pAdapter, TRUE);
2012 }
2013#endif
Mukul Sharma25e70c32014-05-22 12:50:24 +05302014#ifdef WLAN_FEATURE_PACKET_FILTERING
2015 /* During suspend, configure MC Addr list filter to the firmware
2016 * function takes care of checking necessary conditions before
2017 * configuring.
2018 */
2019 wlan_hdd_set_mc_addr_list(pAdapter, TRUE);
2020#endif
Mukul Sharmad2589a52014-04-23 21:06:25 +05302021 }
2022 vstatus = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
2023 pAdapterNode = pNext;
2024 }
2025 EXIT();
2026}
2027
2028/**============================================================================
2029 *
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 @brief hdd_RoamSetKeyCompleteHandler() - Update the security parameters.
Shailender Karmuchia734f332013-04-19 14:02:48 -07002031
Jeff Johnson295189b2012-06-20 16:38:30 -07002032 ===========================================================================*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07002033static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
2034 tANI_U32 roamId, eRoamCmdStatus roamStatus,
Jeff Johnson295189b2012-06-20 16:38:30 -07002035 eCsrRoamResult roamResult )
2036{
2037 eCsrEncryptionType connectedCipherAlgo;
2038 v_BOOL_t fConnected = FALSE;
2039 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
2040 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
2041 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
2042 ENTER();
Srinivas Girigowda5a737f22013-06-28 15:21:48 -07002043
2044 if (NULL == pRoamInfo)
2045 {
2046 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "pRoamInfo is NULL");
2047 return eHAL_STATUS_FAILURE;
2048 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 // if ( WPA ), tell TL to go to 'authenticated' after the keys are set.
Shailender Karmuchia734f332013-04-19 14:02:48 -07002050 // then go to 'authenticated'. For all other authentication types (those that do
Jeff Johnson295189b2012-06-20 16:38:30 -07002051 // not require upper layer authentication) we can put TL directly into 'authenticated'
2052 // state.
Shailender Karmuchi642e9812013-05-30 14:34:49 -07002053 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
2054 "Set Key completion roamStatus =%d roamResult=%d " MAC_ADDRESS_STR,
2055 roamStatus, roamResult, MAC_ADDR_ARRAY(pRoamInfo->peerMac));
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002056
Jeff Johnson295189b2012-06-20 16:38:30 -07002057 fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
2058 if( fConnected )
2059 {
Shailender Karmuchi642e9812013-05-30 14:34:49 -07002060 if ( WLAN_HDD_IBSS == pAdapter->device_mode )
2061 {
2062 v_U8_t staId;
2063
2064 v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
2065
2066 if ( 0 == memcmp( pRoamInfo->peerMac,
2067 &broadcastMacAddr, VOS_MAC_ADDR_SIZE ) )
2068 {
2069 vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext,
2070 IBSS_BROADCAST_STAID);
2071 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
2072 }
2073 else
2074 {
2075 vosStatus = hdd_Ibss_GetStaId(pHddStaCtx,
2076 (v_MACADDR_t*)pRoamInfo->peerMac,
2077 &staId);
2078 if ( VOS_STATUS_SUCCESS == vosStatus )
2079 {
2080 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
2081 "WLAN TL STA Ptk Installed for STAID=%d", staId);
2082 vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext,
2083 staId);
2084 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
2085 }
2086 }
2087 }
2088 else
2089 {
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05302090 // TODO: Considering getting a state machine in HDD later.
2091 // This routine is invoked twice. 1)set PTK 2)set GTK.
2092 // The folloing if statement will be TRUE when setting GTK.
2093 // At this time we don't handle the state in detail.
2094 // Related CR: 174048 - TL not in authenticated state
2095 if ( ( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) &&
2096 (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired )
2097 {
2098 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set "
2099 "for StaId= %d. Changing TL state to AUTHENTICATED",
2100 pHddStaCtx->conn_info.staId[ 0 ] );
2101
2102 // Connections that do not need Upper layer authentication,
2103 // transition TL to 'Authenticated' state after the keys are set.
2104 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext,
2105 pHddStaCtx->conn_info.staId[ 0 ],
2106 WLANTL_STA_AUTHENTICATED );
2107
2108 pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
Mukul Sharmad2589a52014-04-23 21:06:25 +05302109 //Need to call offload because when roaming happen at that time fwr
2110 //clean offload info as part of the DelBss
2111 // No need to configure offload if host was not suspended
2112 spin_lock(&pHddCtx->filter_lock);
2113 if(pHddCtx->hdd_wlan_suspended)
2114 {
2115 spin_unlock(&pHddCtx->filter_lock);
2116 hdd_ReConfigSuspendDataClearedDuringRoaming(pHddCtx);
2117 }
2118 else
2119 {
2120 spin_unlock(&pHddCtx->filter_lock);
2121 }
Mukul Sharma84f27252014-07-14 18:11:42 +05302122#ifdef DEBUG_ROAM_DELAY
2123 vos_record_roam_event(e_HDD_SET_GTK_RSP, NULL, 0);
2124#endif
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05302125 }
2126 else
2127 {
2128 vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext,
2129 pHddStaCtx->conn_info.staId[ 0 ]);
Mukul Sharma84f27252014-07-14 18:11:42 +05302130#ifdef DEBUG_ROAM_DELAY
2131 vos_record_roam_event(e_HDD_SET_PTK_RSP, (void *)pRoamInfo->peerMac, 6);
2132#endif
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05302133 }
2134
2135 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
Shailender Karmuchi642e9812013-05-30 14:34:49 -07002136 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 }
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05302138 else
2139 {
2140 // possible disassoc after issuing set key and waiting set key complete
2141 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
2142 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002143
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 EXIT();
2145 return( eHAL_STATUS_SUCCESS );
2146}
2147/**============================================================================
2148 *
2149 @brief hdd_RoamMicErrorIndicationHandler() - This function indicates the Mic failure to the supplicant.
2150 ===========================================================================*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07002151static eHalStatus hdd_RoamMicErrorIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 tANI_U32 roamId, eRoamCmdStatus roamStatus, eCsrRoamResult roamResult )
Shailender Karmuchia734f332013-04-19 14:02:48 -07002153{
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
2155
2156 if( eConnectionState_Associated == pHddStaCtx->conn_info.connState &&
2157 TKIP_COUNTER_MEASURE_STOPED == pHddStaCtx->WextState.mTKIPCounterMeasures )
2158 {
2159 struct iw_michaelmicfailure msg;
2160 union iwreq_data wreq;
2161 memset(&msg, '\0', sizeof(msg));
2162 msg.src_addr.sa_family = ARPHRD_ETHER;
2163 memcpy(msg.src_addr.sa_data, pRoamInfo->u.pMICFailureInfo->taMacAddr, sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr));
Arif Hussain24bafea2013-11-15 15:10:03 -08002164 hddLog(LOG1, "MIC MAC " MAC_ADDRESS_STR,
2165 MAC_ADDR_ARRAY(msg.src_addr.sa_data));
Shailender Karmuchia734f332013-04-19 14:02:48 -07002166
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 if(pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE)
2168 msg.flags = IW_MICFAILURE_GROUP;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002169 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 msg.flags = IW_MICFAILURE_PAIRWISE;
2171 memset(&wreq, 0, sizeof(wreq));
2172 wreq.data.length = sizeof(msg);
2173 wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, (char *)&msg);
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 /* inform mic failure to nl80211 */
Shailender Karmuchia734f332013-04-19 14:02:48 -07002175 cfg80211_michael_mic_failure(pAdapter->dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 pRoamInfo->u.pMICFailureInfo->taMacAddr,
2177 ((pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) ?
2178 NL80211_KEYTYPE_GROUP :
2179 NL80211_KEYTYPE_PAIRWISE),
Shailender Karmuchia734f332013-04-19 14:02:48 -07002180 pRoamInfo->u.pMICFailureInfo->keyId,
2181 pRoamInfo->u.pMICFailureInfo->TSC,
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 GFP_KERNEL);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002183
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002185
Jeff Johnson295189b2012-06-20 16:38:30 -07002186 return( eHAL_STATUS_SUCCESS );
2187}
2188
2189/**============================================================================
2190 *
Shailender Karmuchia734f332013-04-19 14:02:48 -07002191 @brief roamRoamConnectStatusUpdateHandler() - The Ibss connection status is
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 updated regularly here in this function.
Shailender Karmuchia734f332013-04-19 14:02:48 -07002193
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 ===========================================================================*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07002195static eHalStatus roamRoamConnectStatusUpdateHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
2196 tANI_U32 roamId, eRoamCmdStatus roamStatus,
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 eCsrRoamResult roamResult )
2198{
2199 VOS_STATUS vosStatus;
2200
2201 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
2202 switch( roamResult )
2203 {
2204 case eCSR_ROAM_RESULT_IBSS_NEW_PEER:
2205 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07002206 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002207 struct station_info staInfo;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002208
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002209 pr_info ( "IBSS New Peer indication from SME "
Shailender Karmuchia734f332013-04-19 14:02:48 -07002210 "with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d",
2211 MAC_ADDR_ARRAY(pRoamInfo->peerMac),
2212 MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 pRoamInfo->staId );
Shailender Karmuchia734f332013-04-19 14:02:48 -07002214
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 if ( !roamSaveIbssStation( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pRoamInfo->staId, (v_MACADDR_t *)pRoamInfo->peerMac ) )
2216 {
2217 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
2218 "New IBSS peer but we already have the max we can handle. Can't register this one" );
2219 break;
2220 }
2221
2222 pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter;
2223
Shailender Karmuchia734f332013-04-19 14:02:48 -07002224 pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter;
2225 WLANTL_UpdateSTABssIdforIBSS(pHddCtx->pvosContext,
2226 IBSS_BROADCAST_STAID,pHddStaCtx->conn_info.bssId);
2227
2228 // Register the Station with TL for the new peer.
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 vosStatus = hdd_roamRegisterSTA( pAdapter,
2230 pRoamInfo,
2231 pRoamInfo->staId,
2232 (v_MACADDR_t *)pRoamInfo->peerMac,
2233 pRoamInfo->pBssDesc );
2234 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
2235 {
2236 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07002237 "Cannot register STA with TL for IBSS. Failed with vosStatus = %d [%08X]",
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 vosStatus, vosStatus );
2239 }
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002240 pHddStaCtx->ibss_sta_generation++;
2241 memset(&staInfo, 0, sizeof(staInfo));
2242 staInfo.filled = 0;
2243 staInfo.generation = pHddStaCtx->ibss_sta_generation;
2244
2245 cfg80211_new_sta(pAdapter->dev,
2246 (const u8 *)pRoamInfo->peerMac,
2247 &staInfo, GFP_KERNEL);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002248
Shailender Karmuchi642e9812013-05-30 14:34:49 -07002249 if ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddStaCtx->ibss_enc_key.encType
2250 ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddStaCtx->ibss_enc_key.encType
2251 ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType
2252 ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType )
2253 {
2254 pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX;
2255 memcpy(&pHddStaCtx->ibss_enc_key.peerMac,
2256 pRoamInfo->peerMac, WNI_CFG_BSSID_LEN);
2257
2258 VOS_TRACE( VOS_MODULE_ID_HDD,
Arif Hussain6d2a3322013-11-17 19:50:10 -08002259 VOS_TRACE_LEVEL_INFO_HIGH, "New peer joined set PTK encType=%d",
Shailender Karmuchi642e9812013-05-30 14:34:49 -07002260 pHddStaCtx->ibss_enc_key.encType);
2261
2262 vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),
2263 pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId );
2264
2265 if ( VOS_STATUS_SUCCESS != vosStatus )
2266 {
2267 hddLog(VOS_TRACE_LEVEL_ERROR,
2268 "%s: sme_RoamSetKey failed, returned %d",
2269 __func__, vosStatus);
2270 return VOS_STATUS_E_FAILURE;
2271 }
2272 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 netif_carrier_on(pAdapter->dev);
2274 netif_tx_start_all_queues(pAdapter->dev);
2275 break;
2276 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002277
Jeff Johnson295189b2012-06-20 16:38:30 -07002278 case eCSR_ROAM_RESULT_IBSS_CONNECT:
2279 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07002280
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 roamIbssConnectHandler( pAdapter, pRoamInfo );
Shailender Karmuchia734f332013-04-19 14:02:48 -07002282
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002284 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002285 case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED:
2286 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07002287 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07002288
Ravi Joshicc57ed42013-10-12 16:31:25 -07002289 if ( !roamRemoveIbssStation(pAdapter, pRoamInfo->staId ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 {
2291 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
2292 "IBSS peer departed by cannot find peer in our registration table with TL" );
2293 }
2294
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002295 pr_info ( "IBSS Peer Departed from SME "
Shailender Karmuchia734f332013-04-19 14:02:48 -07002296 "with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d",
2297 MAC_ADDR_ARRAY(pRoamInfo->peerMac),
2298 MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId),
2299 pRoamInfo->staId );
2300
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 hdd_roamDeregisterSTA( pAdapter, pRoamInfo->staId );
2302
2303 pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL;
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002304 pHddStaCtx->ibss_sta_generation++;
Ravi Joshicc57ed42013-10-12 16:31:25 -07002305
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002306 cfg80211_del_sta(pAdapter->dev,
2307 (const u8 *)&pRoamInfo->peerMac,
2308 GFP_KERNEL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 break;
2310 }
2311 case eCSR_ROAM_RESULT_IBSS_INACTIVE:
2312 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07002313 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
2314 "Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME");
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 // Stop only when we are inactive
2316 netif_tx_disable(pAdapter->dev);
2317 netif_carrier_off(pAdapter->dev);
Abhishek Singhf4669da2014-05-26 15:07:49 +05302318 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2319 "%s: Set HDD connState to eConnectionState_NotConnected",
2320 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_NotConnected );
Shailender Karmuchia734f332013-04-19 14:02:48 -07002322
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 // Send the bssid address to the wext.
2324 hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo);
2325 // clean up data path
2326 hdd_disconnect_tx_rx(pAdapter);
2327 break;
2328 }
2329 default:
2330 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002331
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002333
Jeff Johnson295189b2012-06-20 16:38:30 -07002334 return( eHAL_STATUS_SUCCESS );
2335}
2336
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002337#ifdef FEATURE_WLAN_TDLS
2338/**============================================================================
2339 *
2340 @brief hdd_roamRegisterTDLSSTA() - Construct the staDesc and register with
2341 TL the new STA. This is called as part of ADD_STA in the TDLS setup
2342 Return: VOS_STATUS
Shailender Karmuchia734f332013-04-19 14:02:48 -07002343
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002344 ===========================================================================*/
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002345VOS_STATUS hdd_roamRegisterTDLSSTA( hdd_adapter_t *pAdapter,
2346 tANI_U8 *peerMac, tANI_U16 staId, tANI_U8 ucastSig)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002347{
2348 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002349 v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002350 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
2351 WLAN_STADescType staDesc = {0};
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002352 eCsrEncryptionType connectedCipherAlgo = eCSR_ENCRYPT_TYPE_UNKNOWN;
2353 v_BOOL_t fConnected = FALSE;
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07002354 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
2355 hdd_config_t *cfg_param = pHddCtx->cfg_ini;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002356
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002357 fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
2358 if (!fConnected) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07002359 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002360 "%s not connected. ignored", __func__);
2361 return VOS_FALSE;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002362 }
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002363
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002364 /*
2365 * TDLS sta in BSS should be set as STA type TDLS and STA MAC should
2366 * be peer MAC, here we are wokrking on direct Link
2367 */
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002368 staDesc.ucSTAId = staId ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002369
2370 staDesc.wSTAType = WLAN_STA_TDLS ;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002371
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002372 vos_mem_copy( staDesc.vSTAMACAddress.bytes, peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002373 sizeof(tSirMacAddr) );
2374
2375 vos_mem_copy(staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 );
2376 vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent );
2377
2378 /* set the QoS field appropriately ..*/
2379 (hdd_wmm_is_active(pAdapter)) ? (staDesc.ucQosEnabled = 1)
2380 : (staDesc.ucQosEnabled = 0) ;
2381
2382 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "HDD register \
Arif Hussain6d2a3322013-11-17 19:50:10 -08002383 TL QoS_enabled=%d", staDesc.ucQosEnabled );
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002384
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002385 staDesc.ucProtectedFrame = (connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002386
2387 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
Arif Hussain6d2a3322013-11-17 19:50:10 -08002388 "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame );
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002389
Shailender Karmuchia734f332013-04-19 14:02:48 -07002390 /*
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002391 * UMA is ready we inform TL to do frame translation.
2392 */
2393 staDesc.ucSwFrameTXXlation = 1;
2394 staDesc.ucSwFrameRXXlation = 1;
2395 staDesc.ucAddRmvLLC = 1;
2396
2397 /* Initialize signatures and state */
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002398 staDesc.ucUcastSig = ucastSig ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002399
2400 /* tdls Direct Link do not need bcastSig */
2401 staDesc.ucBcastSig = 0 ;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002402
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002403#ifdef VOLANS_ENABLE_SW_REPLAY_CHECK
2404 if(staDesc.ucProtectedFrame)
2405 staDesc.ucIsReplayCheckValid = VOS_TRUE;
2406 else
2407 staDesc.ucIsReplayCheckValid = VOS_FALSE;
2408#endif
2409
Gopichand Nakkala471708b2013-06-04 20:03:01 +05302410 staDesc.ucInitState = WLANTL_STA_CONNECTED ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002411
Shailender Karmuchia734f332013-04-19 14:02:48 -07002412 /* Register the Station with TL... */
2413 vosStatus = WLANTL_RegisterSTAClient( pVosContext,
2414 hdd_rx_packet_cbk,
2415 hdd_tx_complete_cbk,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002416 hdd_tx_fetch_packet_cbk, &staDesc, 0 );
Shailender Karmuchia734f332013-04-19 14:02:48 -07002417
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002418 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
2419 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07002420 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07002421 "%s: WLANTL_RegisterSTAClient() failed to register. "
2422 "Status= %d [0x%08X]", __func__, vosStatus, vosStatus );
Shailender Karmuchia734f332013-04-19 14:02:48 -07002423 return vosStatus;
2424 }
2425
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07002426 if ( cfg_param->dynSplitscan &&
2427 ( VOS_TIMER_STATE_RUNNING !=
2428 vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)) )
2429 {
2430 vos_timer_start(&pHddCtx->tx_rx_trafficTmr,
2431 cfg_param->trafficMntrTmrForSplitScan);
2432 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002433 return( vosStatus );
2434}
2435
Chauhan Rajeshb48f96d2013-01-24 21:00:15 -08002436static VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
2437{
2438 VOS_STATUS vosStatus;
2439 vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
2440 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
2441 {
2442 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
2443 "%s: WLANTL_ClearSTAClient() failed to for staID %d. "
Jeff Johnson0299d0a2013-10-30 12:37:43 -07002444 "Status= %d [0x%08X]",
Chauhan Rajeshb48f96d2013-01-24 21:00:15 -08002445 __func__, staId, vosStatus, vosStatus );
2446 }
2447 return( vosStatus );
2448}
2449
2450
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002451/*
2452 * HDD interface between SME and TL to ensure TDLS client registration with
2453 * TL in case of new TDLS client is added and deregistration at the time
2454 * TDLS client is deleted.
2455 */
2456
Shailender Karmuchia734f332013-04-19 14:02:48 -07002457eHalStatus hdd_RoamTdlsStatusUpdateHandler(hdd_adapter_t *pAdapter,
2458 tCsrRoamInfo *pRoamInfo,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002459 tANI_U32 roamId,
Shailender Karmuchia734f332013-04-19 14:02:48 -07002460 eRoamCmdStatus roamStatus,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002461 eCsrRoamResult roamResult)
2462{
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002463 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002464 eHalStatus status = eHAL_STATUS_FAILURE ;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002465 tANI_U8 staIdx;
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002466
2467#ifdef WLAN_FEATURE_TDLS_DEBUG
Kaushik, Sushant8489f472014-01-27 11:41:22 +05302468 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussain24bafea2013-11-15 15:10:03 -08002469 ("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR),
2470 roamResult == eCSR_ROAM_RESULT_ADD_TDLS_PEER ?
2471 "ADD_TDLS_PEER" :
2472 roamResult == eCSR_ROAM_RESULT_DELETE_TDLS_PEER ?
2473 "DEL_TDLS_PEER" :
2474 roamResult == eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ?
2475 "DEL_TDLS_PEER_IND" :
2476 roamResult == eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ?
2477 "DEL_ALL_TDLS_PEER_IND" :
2478 roamResult == eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ?
2479 "UPDATE_TDLS_PEER" :
2480 roamResult == eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ?
2481 "LINK_ESTABLISH_REQ_RSP" : "UNKNOWN",
2482 pRoamInfo->staId, MAC_ADDR_ARRAY(pRoamInfo->peerMac));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002483#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002484 switch( roamResult )
2485 {
2486 case eCSR_ROAM_RESULT_ADD_TDLS_PEER:
2487 {
Lee Hoonkif987a0b2013-01-29 02:07:07 -08002488 if(eSIR_SME_SUCCESS != pRoamInfo->statusCode)
2489 {
2490 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002491 ("%s: Add Sta is failed. %d"),__func__, pRoamInfo->statusCode);
Lee Hoonkif987a0b2013-01-29 02:07:07 -08002492 }
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002493 else
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002494 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002495
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002496 /* check if there is available index for this new TDLS STA */
2497 for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ )
2498 {
2499 if (0 == pHddCtx->tdlsConnInfo[staIdx].staId )
2500 {
2501 pHddCtx->tdlsConnInfo[staIdx].sessionId = pRoamInfo->sessionId;
2502 pHddCtx->tdlsConnInfo[staIdx].staId = pRoamInfo->staId;
2503
2504 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Arif Hussain24bafea2013-11-15 15:10:03 -08002505 ("TDLS: STA IDX at %d is %d "
2506 "of mac " MAC_ADDRESS_STR),
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002507 staIdx, pHddCtx->tdlsConnInfo[staIdx].staId,
Arif Hussain24bafea2013-11-15 15:10:03 -08002508 MAC_ADDR_ARRAY(pRoamInfo->peerMac));
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002509
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002510 vos_copy_macaddr(&pHddCtx->tdlsConnInfo[staIdx].peerMac,
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002511 (v_MACADDR_t *)pRoamInfo->peerMac) ;
2512 status = eHAL_STATUS_SUCCESS ;
2513 break ;
2514 }
2515 }
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002516 if (staIdx < HDD_MAX_NUM_TDLS_STA)
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002517 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002518 if (-1 == wlan_hdd_tdls_set_sta_id(pAdapter, pRoamInfo->peerMac, pRoamInfo->staId)) {
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002519 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
2520 "wlan_hdd_tdls_set_sta_id() failed");
2521 return VOS_FALSE;
2522 }
2523
2524 (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[pRoamInfo->staId] = pAdapter;
Gopichand Nakkala471708b2013-06-04 20:03:01 +05302525 /* store the ucast signature , if required for further reference. */
2526
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002527 wlan_hdd_tdls_set_signature( pAdapter, pRoamInfo->peerMac, pRoamInfo->ucastSig );
Gopichand Nakkala471708b2013-06-04 20:03:01 +05302528 /* start TDLS client registration with TL */
2529 status = hdd_roamRegisterTDLSSTA( pAdapter,
2530 pRoamInfo->peerMac,
2531 pRoamInfo->staId,
2532 pRoamInfo->ucastSig);
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002533 }
2534 else
2535 {
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002536 status = eHAL_STATUS_FAILURE;
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002537 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Hoonki Lee66b75f32013-04-16 18:30:07 -07002538 "%s: no available slot in conn_info. staId %d cannot be stored", __func__, pRoamInfo->staId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002539 }
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002540 pAdapter->tdlsAddStaStatus = status;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002541 }
Hoonki Lee11f7dda2013-02-14 16:55:44 -08002542 complete(&pAdapter->tdls_add_station_comp);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002543 break ;
2544 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002545 case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER:
2546 {
2547 if (eSIR_SME_SUCCESS != pRoamInfo->statusCode)
2548 {
2549 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
2550 "%s: Add Sta is failed. %d", __func__, pRoamInfo->statusCode);
2551 }
2552 /* store the ucast signature which will be used later when
2553 * registering to TL
2554 */
2555 pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode;
2556 complete(&pAdapter->tdls_add_station_comp);
2557 break;
2558 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302559 case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP:
2560 {
2561 if (eSIR_SME_SUCCESS != pRoamInfo->statusCode)
2562 {
2563 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
2564 "%s: Link Establish Request failed. %d", __func__, pRoamInfo->statusCode);
2565 }
2566 complete(&pAdapter->tdls_link_establish_req_comp);
2567 break;
2568 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002569 case eCSR_ROAM_RESULT_DELETE_TDLS_PEER:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002570 {
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002571 hddTdlsPeer_t *curr_peer;
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002572 for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002573 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002574 if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) &&
2575 pRoamInfo->staId == pHddCtx->tdlsConnInfo[staIdx].staId)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002576 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002577 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002578 ("HDD: del STA IDX = %x"), pRoamInfo->staId) ;
2579
Madan Mohan Koyyalamudi96797442013-10-08 16:04:42 +05302580 curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, TRUE);
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002581 if (NULL != curr_peer && TDLS_IS_CONNECTED(curr_peer))
2582 {
2583 hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId );
2584 wlan_hdd_tdls_decrement_peer_count(pAdapter);
2585 }
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002586 wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac);
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002587
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002588 pHddCtx->tdlsConnInfo[staIdx].staId = 0 ;
2589 pHddCtx->tdlsConnInfo[staIdx].sessionId = 255;
2590 vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002591 sizeof(v_MACADDR_t)) ;
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002592 wlan_hdd_tdls_check_bmps(pAdapter);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002593 status = eHAL_STATUS_SUCCESS ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002594 break ;
2595 }
2596 }
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002597 complete(&pAdapter->tdls_del_station_comp);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002598 }
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002599 break ;
Hoonki Leee6bfe942013-02-05 15:01:19 -08002600 case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND:
2601 {
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002602 hddTdlsPeer_t *curr_peer;
Hoonki Leee6bfe942013-02-05 15:01:19 -08002603 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
2604 "%s: Sending teardown to supplicant with reason code %u",
2605 __func__, pRoamInfo->reasonCode);
2606
2607#ifdef CONFIG_TDLS_IMPLICIT
Madan Mohan Koyyalamudi96797442013-10-08 16:04:42 +05302608 curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, TRUE);
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002609 wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, pRoamInfo->reasonCode);
Hoonki Leee6bfe942013-02-05 15:01:19 -08002610#endif
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002611 status = eHAL_STATUS_SUCCESS ;
2612 break ;
2613 }
2614 case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND:
2615 {
2616 /* 0 staIdx is assigned to AP we dont want to touch that */
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002617 for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ )
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002618 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002619 if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) &&
2620 pHddCtx->tdlsConnInfo[staIdx].staId)
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002621 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002622 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Arif Hussain24bafea2013-11-15 15:10:03 -08002623 ("hdd_tdlsStatusUpdate: staIdx %d " MAC_ADDRESS_STR),
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002624 pHddCtx->tdlsConnInfo[staIdx].staId,
Arif Hussain24bafea2013-11-15 15:10:03 -08002625 MAC_ADDR_ARRAY(pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes));
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002626 wlan_hdd_tdls_reset_peer(pAdapter, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes);
2627 hdd_roamDeregisterTDLSSTA ( pAdapter, pHddCtx->tdlsConnInfo[staIdx].staId );
2628 wlan_hdd_tdls_decrement_peer_count(pAdapter);
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002629
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002630 vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac,
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002631 sizeof(v_MACADDR_t)) ;
Gopichand Nakkala4327a152013-03-04 23:22:42 -08002632 pHddCtx->tdlsConnInfo[staIdx].staId = 0 ;
2633 pHddCtx->tdlsConnInfo[staIdx].sessionId = 255;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002634
2635 status = eHAL_STATUS_SUCCESS ;
2636 }
2637 }
Gopichand Nakkala40ab2752013-04-04 20:11:36 +05302638 wlan_hdd_tdls_check_bmps(pAdapter);
Hoonki Leee6bfe942013-02-05 15:01:19 -08002639 break ;
2640 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002641 default:
2642 {
2643 break ;
2644 }
2645 }
2646
2647 return status ;
2648}
2649#endif
2650
Srinivas Girigowda1c3f72e2013-12-18 16:07:00 -08002651static void iw_full_power_cbfn (void *pContext, eHalStatus status)
2652{
2653 hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext;
2654 hdd_context_t *pHddCtx = NULL;
2655 int ret;
2656
2657 if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
2658 {
2659 hddLog(VOS_TRACE_LEVEL_ERROR,
2660 "%s: Bad param, pAdapter [%p]",
2661 __func__, pAdapter);
2662 return;
2663 }
2664
2665 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
2666 ret = wlan_hdd_validate_context(pHddCtx);
2667 if (0 != ret)
2668 {
2669 hddLog(VOS_TRACE_LEVEL_ERROR,
2670 "%s: HDD context is not valid (%d)", __func__, ret);
2671 return;
2672 }
2673
2674 if (pHddCtx->cfg_ini->fIsBmpsEnabled)
2675 {
2676 sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), NULL, NULL);
2677 }
2678}
2679
Shailender Karmuchia734f332013-04-19 14:02:48 -07002680eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 eRoamCmdStatus roamStatus, eCsrRoamResult roamResult )
2682{
2683 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
2684 hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext;
Pratik Bhalgatec625f72012-11-22 17:17:38 +05302685 hdd_wext_state_t *pWextState = NULL;
2686 hdd_station_ctx_t *pHddStaCtx = NULL;
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07002687 VOS_STATUS status = VOS_STATUS_SUCCESS;
Amar Singhal49fdfd52013-08-13 13:25:12 -07002688 hdd_context_t *pHddCtx = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002689
2690 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07002691 "CSR Callback: status= %d result= %d roamID=%d",
Shailender Karmuchia734f332013-04-19 14:02:48 -07002692 roamStatus, roamResult, roamId );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002693
2694 /*Sanity check*/
Pratik Bhalgatec625f72012-11-22 17:17:38 +05302695 if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002696 {
2697 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
Pratik Bhalgatec625f72012-11-22 17:17:38 +05302698 "invalid adapter or adapter has invalid magic");
2699 return eHAL_STATUS_FAILURE;
2700 }
2701
2702 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
2703 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
2704
2705 if ((NULL == pWextState) || (NULL == pHddStaCtx))
2706 {
2707 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
2708 "invalid WEXT state or HDD station context");
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002709 return eHAL_STATUS_FAILURE;
2710 }
2711
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 switch( roamStatus )
2713 {
2714 case eCSR_ROAM_SESSION_OPENED:
2715 if(pAdapter != NULL)
2716 {
2717 set_bit(SME_SESSION_OPENED, &pAdapter->event_flags);
2718 complete(&pAdapter->session_open_comp_var);
2719 }
2720 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002721
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002722#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
2723 /* We did pre-auth,then we attempted a 11r or ese reassoc.
Jeff Johnson295189b2012-06-20 16:38:30 -07002724 * reassoc failed due to failure, timeout, reject from ap
Shailender Karmuchia734f332013-04-19 14:02:48 -07002725 * in any case tell the OS, our carrier is off and mark
Jeff Johnson295189b2012-06-20 16:38:30 -07002726 * interface down */
2727 case eCSR_ROAM_FT_REASSOC_FAILED:
Agarwal Ashish971c2882013-10-30 20:11:12 +05302728 hddLog(LOGE, FL("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d"),
2729 roamStatus, roamResult, pAdapter->sessionId);
c_hpothuef45bc32014-09-11 10:10:18 +05302730 sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter));
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
2732 /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */
2733 if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) {
Jeff Johnson295189b2012-06-20 16:38:30 -07002734 (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE;
2735 }
2736 pHddStaCtx->ft_carrier_on = FALSE;
Kanchanapally, Vidyullathad883c652014-05-09 21:17:04 +05302737 pHddStaCtx->hdd_ReassocScenario = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002738 break;
2739
2740 case eCSR_ROAM_FT_START:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002741 // When we roam for EsE and 11r, we dont want the
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 // OS to be informed that the link is down. So mark
Shailender Karmuchia734f332013-04-19 14:02:48 -07002743 // the link ready for ft_start. After this the
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 // eCSR_ROAM_SHOULD_ROAM will be received.
2745 // Where in we will not mark the link down
2746 // Also we want to stop tx at this point when we will be
2747 // doing disassoc at this time. This saves 30-60 msec
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07002748 // after reassoc.
Jeff Johnson295189b2012-06-20 16:38:30 -07002749 {
2750 struct net_device *dev = pAdapter->dev;
2751 netif_tx_disable(dev);
Mukul Sharma84f27252014-07-14 18:11:42 +05302752#ifdef DEBUG_ROAM_DELAY
2753 vos_record_roam_event(e_HDD_DISABLE_TX_QUEUE, NULL, 0);
2754#endif
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07002755 /*
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002756 * Deregister for this STA with TL with the objective to flush
2757 * all the packets for this STA from wmm_tx_queue. If not done here,
2758 * we would run into a race condition (CR390567) wherein TX
2759 * thread would schedule packets from wmm_tx_queue AFTER peer STA has
2760 * been deleted. And, these packets get assigned with a STA idx of
2761 * self-sta (since the peer STA has been deleted) and get transmitted
2762 * on the new channel before the reassoc request. Since there will be
2763 * no ACK on the new channel, each packet gets retransmitted which
2764 * takes several seconds before the transmission of reassoc request.
2765 * This leads to reassoc-timeout and roam failure.
2766 */
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07002767 status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] );
2768 if ( !VOS_IS_STATUS_SUCCESS(status ) )
2769 {
2770 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
2771 FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"),
2772 pHddStaCtx->conn_info.staId[0], status, status );
2773 halStatus = eHAL_STATUS_FAILURE;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002774 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002775 }
2776 pHddStaCtx->ft_carrier_on = TRUE;
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07002777 pHddStaCtx->hdd_ReassocScenario = VOS_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 break;
2779#endif
2780
2781 case eCSR_ROAM_SHOULD_ROAM:
2782 // Dont need to do anything
2783 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002784 struct net_device *dev = pAdapter->dev;
2785 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
2786 // notify apps that we can't pass traffic anymore
2787 netif_tx_disable(dev);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002788#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002789 if (pHddStaCtx->ft_carrier_on == FALSE)
2790 {
2791#endif
2792 netif_carrier_off(dev);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002793#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002794 }
2795#endif
2796
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002797#if !(defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR))
Jeff Johnson295189b2012-06-20 16:38:30 -07002798 //We should clear all sta register with TL, for now, only one.
2799 status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] );
2800 if ( !VOS_IS_STATUS_SUCCESS(status ) )
2801 {
2802 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
2803 FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"),
2804 pHddStaCtx->conn_info.staId[0], status, status );
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07002805 halStatus = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 }
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07002807#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002808 }
2809 break;
2810 case eCSR_ROAM_LOSTLINK:
2811 case eCSR_ROAM_DISASSOCIATED:
2812 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002813 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2814 "****eCSR_ROAM_DISASSOCIATED****");
c_hpothuef45bc32014-09-11 10:10:18 +05302815 sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter));
Jeff Johnson295189b2012-06-20 16:38:30 -07002816 halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
2817 /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */
Amar Singhal49fdfd52013-08-13 13:25:12 -07002818 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
2819 if (pHddCtx->hdd_mcastbcast_filter_set == TRUE)
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05302820 {
Amar Singhal49fdfd52013-08-13 13:25:12 -07002821 hdd_conf_mcastbcast_filter(pHddCtx, FALSE);
Amar Singhalf8ba2b82013-12-02 12:54:38 -08002822
2823 if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) {
2824 pHddCtx->configuredMcastBcastFilter =
2825 pHddCtx->sus_res_mcastbcast_filter;
2826 pHddCtx->sus_res_mcastbcast_filter_valid = VOS_FALSE;
2827 }
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05302828
Amar Singhald53568e2013-09-26 11:03:45 -07002829 hddLog(VOS_TRACE_LEVEL_INFO,
2830 "offload: disassociation happening, restoring configuredMcastBcastFilter");
2831 hddLog(VOS_TRACE_LEVEL_INFO,"McastBcastFilter = %d",
2832 pHddCtx->configuredMcastBcastFilter);
2833 hddLog(VOS_TRACE_LEVEL_INFO,
2834 "offload: already called mcastbcast filter");
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE;
2836 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002837#ifdef WLAN_FEATURE_PACKET_FILTERING
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05302838 /* Call to clear any MC Addr List filter applied after
2839 * successful connection.
2840 */
2841 wlan_hdd_set_mc_addr_list(pAdapter, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002842#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002843 }
2844 break;
2845 case eCSR_ROAM_IBSS_LEAVE:
2846 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2847 "****eCSR_ROAM_IBSS_LEAVE****");
2848 halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
2849 break;
2850 case eCSR_ROAM_ASSOCIATION_COMPLETION:
2851 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2852 "****eCSR_ROAM_ASSOCIATION_COMPLETION****");
Abhishek Singh57a0bd92014-06-13 11:17:27 +05302853 // To Do - address probable memory leak with WEP encryption upon successful association
2854 if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult)
Jeff Johnson295189b2012-06-20 16:38:30 -07002855 {
Abhishek Singh57a0bd92014-06-13 11:17:27 +05302856 //Clear saved connection information in HDD
2857 hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002858 }
Abhishek Singh57a0bd92014-06-13 11:17:27 +05302859 halStatus = hdd_AssociationCompletionHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002860
2861 break;
2862 case eCSR_ROAM_ASSOCIATION_FAILURE:
Shailender Karmuchia734f332013-04-19 14:02:48 -07002863 halStatus = hdd_AssociationCompletionHandler( pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -07002864 pRoamInfo, roamId, roamStatus, roamResult );
2865 break;
2866 case eCSR_ROAM_IBSS_IND:
Jeff Johnson81c17882013-05-03 09:53:35 -07002867 hdd_RoamIbssIndicationHandler( pAdapter, pRoamInfo, roamId,
2868 roamStatus, roamResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002869 break;
2870
2871 case eCSR_ROAM_CONNECT_STATUS_UPDATE:
2872 halStatus = roamRoamConnectStatusUpdateHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
Shailender Karmuchia734f332013-04-19 14:02:48 -07002873 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002874
2875 case eCSR_ROAM_MIC_ERROR_IND:
2876 halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
2877 break;
2878
2879 case eCSR_ROAM_SET_KEY_COMPLETE:
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07002880 {
2881 hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
2882
2883 if((pHddCtx) &&
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07002884 (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) &&
2885 (TRUE == pHddCtx->hdd_wlan_suspended) &&
2886 (eCSR_ROAM_RESULT_NONE == roamResult))
2887 {
Srinivas Girigowdaeb03ee32013-07-16 11:48:41 -07002888 /* Send DTIM period to the FW; only if the wlan is already
2889 in suspend. This is the case with roaming (reassoc),
2890 DELETE_BSS_REQ zeroes out Modulated/Dynamic DTIM sent in
2891 previous suspend_wlan. Sending SET_POWER_PARAMS_REQ
2892 before the ENTER_BMPS_REQ ensures Listen Interval is
2893 regained back to LI * Modulated DTIM */
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07002894 hdd_set_pwrparams(pHddCtx);
2895 pHddStaCtx->hdd_ReassocScenario = VOS_FALSE;
2896
2897 /* At this point, device should not be in BMPS;
Srinivas Girigowdaeb03ee32013-07-16 11:48:41 -07002898 if due to unexpected scenario, if we are in BMPS,
2899 then trigger Exit and Enter BMPS to take DTIM period
2900 effective */
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07002901 if (BMPS == pmcGetPmcState(pHddCtx->hHal))
2902 {
2903 hddLog( LOGE, FL("Not expected: device is already in BMPS mode, Exit & Enter BMPS again!"));
2904
Srinivas Girigowda1c3f72e2013-12-18 16:07:00 -08002905 sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter),
2906 iw_full_power_cbfn, pAdapter,
2907 eSME_FULL_PWR_NEEDED_BY_HDD);
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07002908 }
2909 }
2910 halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
Kanchanapally, Vidyullathad883c652014-05-09 21:17:04 +05302911 pHddStaCtx->hdd_ReassocScenario = FALSE;
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07002912 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002913 break;
2914#ifdef WLAN_FEATURE_VOWIFI_11R
2915 case eCSR_ROAM_FT_RESPONSE:
2916 hdd_SendFTEvent(pAdapter);
2917 break;
2918#endif
Madan Mohan Koyyalamudi1b4afb02012-10-22 15:25:16 -07002919#if defined(FEATURE_WLAN_LFR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002920 case eCSR_ROAM_PMK_NOTIFY:
Shailender Karmuchia734f332013-04-19 14:02:48 -07002921 if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType)
Jeff Johnson43971f52012-07-17 12:26:56 -07002922 {
2923 /* Notify the supplicant of a new candidate */
2924 halStatus = wlan_hdd_cfg80211_pmksa_candidate_notify(pAdapter, pRoamInfo, 1, false);
2925 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002926 break;
2927#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002928
Yue Maef608272013-04-08 23:09:17 -07002929#ifdef FEATURE_WLAN_LFR_METRICS
2930 case eCSR_ROAM_PREAUTH_INIT_NOTIFY:
2931 /* This event is to notify pre-auth initiation */
2932 if (VOS_STATUS_SUCCESS !=
2933 wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, pRoamInfo))
2934 {
2935 halStatus = eHAL_STATUS_FAILURE;
2936 }
2937 break;
2938 case eCSR_ROAM_PREAUTH_STATUS_SUCCESS:
2939 /* This event will notify pre-auth completion in case of success */
2940 if (VOS_STATUS_SUCCESS !=
2941 wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter,
2942 pRoamInfo, 1))
2943 {
2944 halStatus = eHAL_STATUS_FAILURE;
2945 }
2946 break;
2947 case eCSR_ROAM_PREAUTH_STATUS_FAILURE:
2948 /* This event will notify pre-auth completion in case of failure. */
2949 if (VOS_STATUS_SUCCESS !=
2950 wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter,
2951 pRoamInfo, 0))
2952 {
2953 halStatus = eHAL_STATUS_FAILURE;
2954 }
2955 break;
2956 case eCSR_ROAM_HANDOVER_SUCCESS:
2957 /* This event is to notify handover success.
2958 It will be only invoked on success */
2959 if (VOS_STATUS_SUCCESS !=
2960 wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, pRoamInfo))
2961 {
2962 halStatus = eHAL_STATUS_FAILURE;
2963 }
2964 break;
2965#endif
2966
Jeff Johnson295189b2012-06-20 16:38:30 -07002967 case eCSR_ROAM_INDICATE_MGMT_FRAME:
2968 hdd_indicateMgmtFrame( pAdapter,
2969 pRoamInfo->nFrameLength,
2970 pRoamInfo->pbFrames,
2971 pRoamInfo->frameType,
Chilam NG571c65a2013-01-19 12:27:36 +05302972 pRoamInfo->rxChan,
2973 pRoamInfo->rxRssi );
Jeff Johnson295189b2012-06-20 16:38:30 -07002974 break;
2975 case eCSR_ROAM_REMAIN_CHAN_READY:
2976 hdd_remainChanReadyHandler( pAdapter );
2977 break;
2978 case eCSR_ROAM_SEND_ACTION_CNF:
2979 hdd_sendActionCnf( pAdapter,
2980 (roamResult == eCSR_ROAM_RESULT_NONE) ? TRUE : FALSE );
2981 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002982#ifdef FEATURE_WLAN_TDLS
Ng Chilamfc416462012-12-27 17:26:52 -08002983 case eCSR_ROAM_TDLS_STATUS_UPDATE:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002984 halStatus = hdd_RoamTdlsStatusUpdateHandler( pAdapter, pRoamInfo,
Ng Chilamfc416462012-12-27 17:26:52 -08002985 roamId, roamStatus, roamResult );
2986 break ;
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002987 case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND:
2988 wlan_hdd_tdls_mgmt_completion_callback(pAdapter, pRoamInfo->reasonCode);
2989 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002990#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07002991#ifdef WLAN_FEATURE_11W
2992 case eCSR_ROAM_UNPROT_MGMT_FRAME_IND:
2993 hdd_indicateUnprotMgmtFrame(pAdapter, pRoamInfo->nFrameLength,
2994 pRoamInfo->pbFrames,
2995 pRoamInfo->frameType);
2996 break;
2997#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002998#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002999 case eCSR_ROAM_TSM_IE_IND:
3000 hdd_indicateTsmIe(pAdapter, pRoamInfo->tsmIe.tsid,
3001 pRoamInfo->tsmIe.state, pRoamInfo->tsmIe.msmt_interval);
3002 break;
3003
3004 case eCSR_ROAM_CCKM_PREAUTH_NOTIFY:
3005 {
3006 if (eCSR_AUTH_TYPE_CCKM_WPA == pHddStaCtx->conn_info.authType ||
3007 eCSR_AUTH_TYPE_CCKM_RSN == pHddStaCtx->conn_info.authType)
3008 {
3009 hdd_indicateCckmPreAuth(pAdapter, pRoamInfo);
3010 }
3011 break;
3012 }
3013
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003014 case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND:
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003015 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003016 hdd_indicateEseAdjApRepInd(pAdapter, pRoamInfo);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003017 break;
3018 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003019
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003020 case eCSR_ROAM_ESE_BCN_REPORT_IND:
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003021 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003022 hdd_indicateEseBcnReportInd(pAdapter, pRoamInfo);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003023 break;
3024 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003025#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07003026 default:
3027 break;
3028 }
3029 return( halStatus );
3030}
Shailender Karmuchia734f332013-04-19 14:02:48 -07003031eCsrAuthType hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4])
Jeff Johnson295189b2012-06-20 16:38:30 -07003032{
3033 eCsrAuthType auth_type;
3034 // is the auth type supported?
Shailender Karmuchia734f332013-04-19 14:02:48 -07003035 if ( memcmp(auth_suite , ccpRSNOui01, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 {
3037 auth_type = eCSR_AUTH_TYPE_RSN;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003038 } else
3039 if (memcmp(auth_suite , ccpRSNOui02, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003040 {
3041 auth_type = eCSR_AUTH_TYPE_RSN_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003042 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07003043#ifdef WLAN_FEATURE_VOWIFI_11R
Shailender Karmuchia734f332013-04-19 14:02:48 -07003044 if (memcmp(auth_suite , ccpRSNOui04, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003045 {
3046 // Check for 11r FT Authentication with PSK
3047 auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003048 } else
3049 if (memcmp(auth_suite , ccpRSNOui03, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 {
3051 // Check for 11R FT Authentication with 802.1X
3052 auth_type = eCSR_AUTH_TYPE_FT_RSN;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003053 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07003054#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003055#ifdef FEATURE_WLAN_ESE
Shailender Karmuchia734f332013-04-19 14:02:48 -07003056 if (memcmp(auth_suite , ccpRSNOui06, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 {
3058 auth_type = eCSR_AUTH_TYPE_CCKM_RSN;
3059 } else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003060#endif /* FEATURE_WLAN_ESE */
Chet Lanctot186b5732013-03-18 10:26:30 -07003061#ifdef WLAN_FEATURE_11W
3062 if (memcmp(auth_suite , ccpRSNOui07, 4) == 0)
3063 {
3064 auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256;
3065 } else
Abhishek Singhae408032014-09-25 17:22:04 +05303066 if (memcmp(auth_suite , ccpRSNOui08, 4) == 0)
3067 {
3068 auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256;
3069 } else
Chet Lanctot186b5732013-03-18 10:26:30 -07003070#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07003071 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 auth_type = eCSR_AUTH_TYPE_UNKNOWN;
3073 }
3074 return auth_type;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003075}
Jeff Johnson7dda7772013-02-27 08:36:13 -08003076
Shailender Karmuchia734f332013-04-19 14:02:48 -07003077eCsrAuthType
3078hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4])
Jeff Johnson295189b2012-06-20 16:38:30 -07003079{
3080 eCsrAuthType auth_type;
3081 // is the auth type supported?
Shailender Karmuchia734f332013-04-19 14:02:48 -07003082 if ( memcmp(auth_suite , ccpWpaOui01, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003083 {
3084 auth_type = eCSR_AUTH_TYPE_WPA;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003085 } else
3086 if (memcmp(auth_suite , ccpWpaOui02, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003087 {
3088 auth_type = eCSR_AUTH_TYPE_WPA_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003089 } else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003090#ifdef FEATURE_WLAN_ESE
Shailender Karmuchia734f332013-04-19 14:02:48 -07003091 if (memcmp(auth_suite , ccpWpaOui06, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003092 {
3093 auth_type = eCSR_AUTH_TYPE_CCKM_WPA;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003094 } else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003095#endif /* FEATURE_WLAN_ESE */
Shailender Karmuchia734f332013-04-19 14:02:48 -07003096 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003097 auth_type = eCSR_AUTH_TYPE_UNKNOWN;
3098 }
3099 hddLog(LOG1, FL("auth_type: %d"), auth_type);
3100 return auth_type;
3101}
Jeff Johnson7dda7772013-02-27 08:36:13 -08003102
Shailender Karmuchia734f332013-04-19 14:02:48 -07003103eCsrEncryptionType
Jeff Johnson295189b2012-06-20 16:38:30 -07003104hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4])
Jeff Johnson295189b2012-06-20 16:38:30 -07003105{
3106 eCsrEncryptionType cipher_type;
3107 // is the cipher type supported?
Shailender Karmuchia734f332013-04-19 14:02:48 -07003108 if ( memcmp(cipher_suite , ccpRSNOui04, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003109 {
3110 cipher_type = eCSR_ENCRYPT_TYPE_AES;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003111 }
3112 else if (memcmp(cipher_suite , ccpRSNOui02, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003113 {
3114 cipher_type = eCSR_ENCRYPT_TYPE_TKIP;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003115 }
3116 else if (memcmp(cipher_suite , ccpRSNOui00, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003117 {
3118 cipher_type = eCSR_ENCRYPT_TYPE_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003119 }
3120 else if (memcmp(cipher_suite , ccpRSNOui01, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 {
3122 cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003123 }
3124 else if (memcmp(cipher_suite , ccpRSNOui05, 4) == 0)
3125 {
3126 cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3127 }
3128 else
3129 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003130 cipher_type = eCSR_ENCRYPT_TYPE_FAILED;
3131 }
3132 hddLog(LOG1, FL("cipher_type: %d"), cipher_type);
3133 return cipher_type;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003134}
Jeff Johnson295189b2012-06-20 16:38:30 -07003135/* To find if the MAC address is NULL */
3136static tANI_U8 hdd_IsMACAddrNULL (tANI_U8 *macAddr, tANI_U8 length)
3137{
3138 int i;
3139 for (i = 0; i < length; i++)
3140 {
3141 if (0x00 != (macAddr[i]))
3142 {
3143 return FALSE;
3144 }
3145 }
3146 return TRUE;
3147} /****** end hdd_IsMACAddrNULL() ******/
Jeff Johnson7dda7772013-02-27 08:36:13 -08003148
Shailender Karmuchia734f332013-04-19 14:02:48 -07003149eCsrEncryptionType
Jeff Johnson295189b2012-06-20 16:38:30 -07003150hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4])
Jeff Johnson295189b2012-06-20 16:38:30 -07003151{
3152 eCsrEncryptionType cipher_type;
3153 // is the cipher type supported?
Shailender Karmuchia734f332013-04-19 14:02:48 -07003154 if ( memcmp(cipher_suite , ccpWpaOui04, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003155 {
3156 cipher_type = eCSR_ENCRYPT_TYPE_AES;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003157 } else
3158 if (memcmp(cipher_suite , ccpWpaOui02, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003159 {
3160 cipher_type = eCSR_ENCRYPT_TYPE_TKIP;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003161 } else
3162 if (memcmp(cipher_suite , ccpWpaOui00, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003163 {
3164 cipher_type = eCSR_ENCRYPT_TYPE_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003165 } else
3166 if (memcmp(cipher_suite , ccpWpaOui01, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003167 {
3168 cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003169 } else
3170 if (memcmp(cipher_suite , ccpWpaOui05, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003171 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003172 cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3173 } else
3174 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003175 cipher_type = eCSR_ENCRYPT_TYPE_FAILED;
3176 }
3177 hddLog(LOG1, FL("cipher_type: %d"), cipher_type);
3178 return cipher_type;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003179}
Jeff Johnson295189b2012-06-20 16:38:30 -07003180
Shailender Karmuchia734f332013-04-19 14:02:48 -07003181static tANI_S32 hdd_ProcessGENIE(hdd_adapter_t *pAdapter,
3182 struct ether_addr *pBssid,
3183 eCsrEncryptionType *pEncryptType,
3184 eCsrEncryptionType *mcEncryptType,
3185 eCsrAuthType *pAuthType,
Chet Lanctot186b5732013-03-18 10:26:30 -07003186#ifdef WLAN_FEATURE_11W
3187 u_int8_t *pMfpRequired,
3188 u_int8_t *pMfpCapable,
3189#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07003190 u_int16_t gen_ie_len,
3191 u_int8_t *gen_ie)
Jeff Johnson295189b2012-06-20 16:38:30 -07003192{
3193 tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003194 eHalStatus result;
3195 tDot11fIERSN dot11RSNIE;
3196 tDot11fIEWPA dot11WPAIE;
3197 tANI_U32 i;
3198 tANI_U8 *pRsnIe;
3199 tANI_U16 RSNIeLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07003200 tPmkidCacheInfo PMKIDCache[4]; // Local transfer memory
Dhanashri Atre51981c62013-06-13 11:47:57 -07003201 v_BOOL_t updatePMKCache = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003202
3203 /* Clear struct of tDot11fIERSN and tDot11fIEWPA specifically setting present
3204 flag to 0 */
3205 memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) );
3206 memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) );
3207
3208 // Validity checks
Shailender Karmuchia734f332013-04-19 14:02:48 -07003209 if ((gen_ie_len < VOS_MIN(DOT11F_IE_RSN_MIN_LEN, DOT11F_IE_WPA_MIN_LEN)) ||
3210 (gen_ie_len > VOS_MAX(DOT11F_IE_RSN_MAX_LEN, DOT11F_IE_WPA_MAX_LEN)) )
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05303211 {
3212 hddLog(LOGE, "%s: Invalid DOT11F IE Length passed :%d",
3213 __func__, gen_ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07003214 return -EINVAL;
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05303215 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003216 // Type check
Shailender Karmuchia734f332013-04-19 14:02:48 -07003217 if ( gen_ie[0] == DOT11F_EID_RSN)
3218 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003219 // Validity checks
Shailender Karmuchia734f332013-04-19 14:02:48 -07003220 if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) ||
Jeff Johnson295189b2012-06-20 16:38:30 -07003221 (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) )
3222 {
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05303223 hddLog(LOGE, "%s: Invalid DOT11F RSN IE length :%d\n",
3224 __func__, gen_ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07003225 return -EINVAL;
3226 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003227 // Skip past the EID byte and length byte
3228 pRsnIe = gen_ie + 2;
3229 RSNIeLen = gen_ie_len - 2;
3230 // Unpack the RSN IE
3231 dot11fUnpackIeRSN((tpAniSirGlobal) halHandle,
3232 pRsnIe,
3233 RSNIeLen,
Jeff Johnson295189b2012-06-20 16:38:30 -07003234 &dot11RSNIE);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003235 // Copy out the encryption and authentication types
3236 hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003237 __func__, dot11RSNIE.pwise_cipher_suite_count );
Shailender Karmuchia734f332013-04-19 14:02:48 -07003238 hddLog(LOG1, FL("%s: authentication suite count: %d"),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003239 __func__, dot11RSNIE.akm_suite_count);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003240 /*Here we have followed the apple base code,
Jeff Johnson295189b2012-06-20 16:38:30 -07003241 but probably I suspect we can do something different*/
3242 //dot11RSNIE.akm_suite_count
Shailender Karmuchia734f332013-04-19 14:02:48 -07003243 // Just translate the FIRST one
3244 *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suites[0]);
3245 //dot11RSNIE.pwise_cipher_suite_count
3246 *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]);
3247 //dot11RSNIE.gp_cipher_suite_count
3248 *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite);
Chet Lanctot186b5732013-03-18 10:26:30 -07003249#ifdef WLAN_FEATURE_11W
3250 *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1 ;
3251 *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1 ;
3252#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003253 // Set the PMKSA ID Cache for this interface
Shailender Karmuchia734f332013-04-19 14:02:48 -07003254 for (i=0; i<dot11RSNIE.pmkid_count; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07003255 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003256 if ( pBssid == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 {
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05303258 hddLog(LOGE, "%s: pBssid passed is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003259 break;
3260 }
Dhanashri Atre51981c62013-06-13 11:47:57 -07003261 if ( hdd_IsMACAddrNULL( (u_char *) pBssid->ether_addr_octet , 6))
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 {
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05303263 hddLog(LOGE, "%s: Invalid MAC adrr", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 break;
3265 }
Dhanashri Atre51981c62013-06-13 11:47:57 -07003266 updatePMKCache = TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003267 // For right now, I assume setASSOCIATE() has passed in the bssid.
3268 vos_mem_copy(PMKIDCache[i].BSSID,
3269 pBssid, ETHER_ADDR_LEN);
3270 vos_mem_copy(PMKIDCache[i].PMKID,
3271 dot11RSNIE.pmkid[i],
3272 CSR_RSN_PMKID_SIZE);
3273 }
Dhanashri Atre51981c62013-06-13 11:47:57 -07003274
3275 if (updatePMKCache)
3276 {
3277 // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache
Jeff Johnson0299d0a2013-10-30 12:37:43 -07003278 hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with cache entry %d."),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003279 __func__, i );
Dhanashri Atre51981c62013-06-13 11:47:57 -07003280 // Finally set the PMKSA ID Cache in CSR
3281 result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId,
3282 PMKIDCache,
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303283 dot11RSNIE.pmkid_count,
3284 FALSE);
Dhanashri Atre51981c62013-06-13 11:47:57 -07003285 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 }
3287 else if (gen_ie[0] == DOT11F_EID_WPA)
3288 {
3289 // Validity checks
3290 if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) ||
3291 (gen_ie_len > DOT11F_IE_WPA_MAX_LEN))
3292 {
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05303293 hddLog(LOGE, "%s: Invalid DOT11F WPA IE length :%d\n",
3294 __func__, gen_ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 return -EINVAL;
3296 }
3297 // Skip past the EID byte and length byte - and four byte WiFi OUI
Shailender Karmuchia734f332013-04-19 14:02:48 -07003298 pRsnIe = gen_ie + 2 + 4;
3299 RSNIeLen = gen_ie_len - (2 + 4);
3300 // Unpack the WPA IE
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 dot11fUnpackIeWPA((tpAniSirGlobal) halHandle,
3302 pRsnIe,
3303 RSNIeLen,
3304 &dot11WPAIE);
3305 // Copy out the encryption and authentication types
3306 hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003307 __func__, dot11WPAIE.unicast_cipher_count );
Jeff Johnson295189b2012-06-20 16:38:30 -07003308 hddLog(LOG1, FL("%s: WPA authentication suite count: %d"),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003309 __func__, dot11WPAIE.auth_suite_count);
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 //dot11WPAIE.auth_suite_count
3311 // Just translate the FIRST one
3312 *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]);
3313 //dot11WPAIE.unicast_cipher_count
3314 *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]);
3315 //dot11WPAIE.unicast_cipher_count
3316 *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher);
3317 }
3318 else
3319 {
3320 hddLog(LOGW, FL("gen_ie[0]: %d"), gen_ie[0]);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003321 return -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 }
3323 return 0;
3324}
3325int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType)
3326{
3327 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
3328 v_U32_t status = 0;
3329 eCsrEncryptionType RSNEncryptType;
3330 eCsrEncryptionType mcRSNEncryptType;
Chet Lanctot186b5732013-03-18 10:26:30 -07003331#ifdef WLAN_FEATURE_11W
3332 u_int8_t RSNMfpRequired;
3333 u_int8_t RSNMfpCapable;
3334#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003335 struct ether_addr bSsid; // MAC address of assoc peer
3336 // MAC address of assoc peer
3337 // But, this routine is only called when we are NOT associated.
3338 vos_mem_copy(bSsid.ether_addr_octet,
3339 pWextState->roamProfile.BSSIDs.bssid,
3340 sizeof(bSsid.ether_addr_octet));
3341 if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN || pWextState->WPARSNIE[0] == DOT11F_EID_WPA)
3342 {
3343 //continue
Shailender Karmuchia734f332013-04-19 14:02:48 -07003344 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 else
3346 {
3347 return 0;
3348 }
3349 // The actual processing may eventually be more extensive than this.
3350 // Right now, just consume any PMKIDs that are sent in by the app.
3351 status = hdd_ProcessGENIE(pAdapter,
3352 &bSsid, // MAC address of assoc peer
3353 &RSNEncryptType,
3354 &mcRSNEncryptType,
3355 RSNAuthType,
Chet Lanctot186b5732013-03-18 10:26:30 -07003356#ifdef WLAN_FEATURE_11W
3357 &RSNMfpRequired,
3358 &RSNMfpCapable,
3359#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 pWextState->WPARSNIE[1]+2,
3361 pWextState->WPARSNIE);
3362 if (status == 0)
3363 {
3364 // Now copy over all the security attributes you have parsed out
3365 pWextState->roamProfile.EncryptionType.numEntries = 1;
3366 pWextState->roamProfile.mcEncryptionType.numEntries = 1;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003367
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; // Use the cipher type in the RSN IE
3369 pWextState->roamProfile.mcEncryptionType.encryptionType[0] = mcRSNEncryptType;
Chet Lanctot186b5732013-03-18 10:26:30 -07003370
Shailender Karmuchi642e9812013-05-30 14:34:49 -07003371 if ( (WLAN_HDD_IBSS == pAdapter->device_mode) &&
3372 ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) ||
3373 (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType)))
3374 {
3375 /*For wpa none supplicant sends the WPA IE with unicast cipher as
3376 eCSR_ENCRYPT_TYPE_NONE ,where as the multicast cipher as
3377 either AES/TKIP based on group cipher configuration
3378 mentioned in the wpa_supplicant.conf.*/
3379
3380 /*Set the unicast cipher same as multicast cipher*/
3381 pWextState->roamProfile.EncryptionType.encryptionType[0]
3382 = mcRSNEncryptType;
3383 }
3384
Chet Lanctot186b5732013-03-18 10:26:30 -07003385#ifdef WLAN_FEATURE_11W
3386 pWextState->roamProfile.MFPRequired = RSNMfpRequired;
3387 pWextState->roamProfile.MFPCapable = RSNMfpCapable;
3388#endif
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003389 hddLog( LOG1, "%s: CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", __func__, *RSNAuthType, RSNEncryptType, mcRSNEncryptType);
Jeff Johnson295189b2012-06-20 16:38:30 -07003390 }
3391 return 0;
3392}
3393int hdd_set_csr_auth_type ( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType)
3394{
3395 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
3396 tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile);
3397 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
3398 ENTER();
Shailender Karmuchia734f332013-04-19 14:02:48 -07003399
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 pRoamProfile->AuthType.numEntries = 1;
Arif Hussain6d2a3322013-11-17 19:50:10 -08003401 hddLog( LOG1, "%s: pHddStaCtx->conn_info.authType = %d", __func__, pHddStaCtx->conn_info.authType);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003402
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 switch( pHddStaCtx->conn_info.authType)
3404 {
3405 case eCSR_AUTH_TYPE_OPEN_SYSTEM:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003406#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07003407 case eCSR_AUTH_TYPE_CCKM_WPA:
3408 case eCSR_AUTH_TYPE_CCKM_RSN:
3409#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07003410 if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) {
3411
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM ;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003413 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07003414 if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003415
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003416#ifdef FEATURE_WLAN_ESE
Shailender Karmuchia734f332013-04-19 14:02:48 -07003417 if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) &&
3418 ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
3419 == IW_AUTH_KEY_MGMT_802_1X)) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003420 hddLog( LOG1, "%s: set authType to CCKM WPA. AKM also 802.1X.", __func__);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003421 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA;
3422 } else
3423 if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA)) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003424 hddLog( LOG1, "%s: Last chance to set authType to CCKM WPA.", __func__);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003425 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 } else
3427#endif
3428 if((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
3429 == IW_AUTH_KEY_MGMT_802_1X) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003430 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA;
3431 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07003432 if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK)
3433 == IW_AUTH_KEY_MGMT_PSK) {
3434 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003435 } else {
Jeff Johnson295189b2012-06-20 16:38:30 -07003436 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003437 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003438 }
3439 if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003440#ifdef FEATURE_WLAN_ESE
Shailender Karmuchia734f332013-04-19 14:02:48 -07003441 if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) &&
3442 ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
3443 == IW_AUTH_KEY_MGMT_802_1X)) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003444 hddLog( LOG1, "%s: set authType to CCKM RSN. AKM also 802.1X.", __func__);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003445 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN;
Jeff Johnson295189b2012-06-20 16:38:30 -07003446 } else
Shailender Karmuchia734f332013-04-19 14:02:48 -07003447 if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN)) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003448 hddLog( LOG1, "%s: Last chance to set authType to CCKM RSN.", __func__);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003449 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN;
Jeff Johnson295189b2012-06-20 16:38:30 -07003450 } else
3451#endif
3452
3453#ifdef WLAN_FEATURE_VOWIFI_11R
Shailender Karmuchia734f332013-04-19 14:02:48 -07003454 if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) &&
3455 ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
Jeff Johnson295189b2012-06-20 16:38:30 -07003456 == IW_AUTH_KEY_MGMT_802_1X)) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003457 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN;
Jeff Johnson43971f52012-07-17 12:26:56 -07003458 }else
Shailender Karmuchia734f332013-04-19 14:02:48 -07003459 if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003460 ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK)
3461 == IW_AUTH_KEY_MGMT_PSK)) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003462 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN_PSK;
Jeff Johnson295189b2012-06-20 16:38:30 -07003463 } else
3464#endif
3465
Chet Lanctot186b5732013-03-18 10:26:30 -07003466#ifdef WLAN_FEATURE_11W
3467 if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) {
3468 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK_SHA256;
3469 } else
Abhishek Singhae408032014-09-25 17:22:04 +05303470 if (RSNAuthType == eCSR_AUTH_TYPE_RSN_8021X_SHA256) {
3471 pRoamProfile->AuthType.authType[0] =
3472 eCSR_AUTH_TYPE_RSN_8021X_SHA256;
3473 } else
Chet Lanctot186b5732013-03-18 10:26:30 -07003474#endif
3475
Shailender Karmuchia734f332013-04-19 14:02:48 -07003476 if( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 == IW_AUTH_KEY_MGMT_802_1X) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003478 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN;
3479 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07003480 if ( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK)
3481 == IW_AUTH_KEY_MGMT_PSK) {
3482 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003483 } else {
Jeff Johnson295189b2012-06-20 16:38:30 -07003484 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003485 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003486 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003487 break;
3488
Jeff Johnson295189b2012-06-20 16:38:30 -07003489 case eCSR_AUTH_TYPE_SHARED_KEY:
Shailender Karmuchia734f332013-04-19 14:02:48 -07003490
3491 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 break;
3493 default:
Shailender Karmuchia734f332013-04-19 14:02:48 -07003494
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003495#ifdef FEATURE_WLAN_ESE
Arif Hussain6d2a3322013-11-17 19:50:10 -08003496 hddLog( LOG1, "%s: In default, unknown auth type.", __func__);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003497#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN;
3499 break;
3500 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003501
Jeff Johnson295189b2012-06-20 16:38:30 -07003502 hddLog( LOG1, "%s Set roam Authtype to %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003503 __func__, pWextState->roamProfile.AuthType.authType[0]);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003504
Jeff Johnson295189b2012-06-20 16:38:30 -07003505 EXIT();
3506 return 0;
3507}
3508
3509/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07003510
3511 \brief iw_set_essid() -
Jeff Johnson295189b2012-06-20 16:38:30 -07003512 This function sets the ssid received from wpa_supplicant
Shailender Karmuchia734f332013-04-19 14:02:48 -07003513 to the CSR roam profile.
3514
Jeff Johnson295189b2012-06-20 16:38:30 -07003515 \param - dev - Pointer to the net device.
3516 - info - Pointer to the iw_request_info.
3517 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07003518 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07003519 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07003520
Jeff Johnson295189b2012-06-20 16:38:30 -07003521 --------------------------------------------------------------------------*/
3522
Shailender Karmuchia734f332013-04-19 14:02:48 -07003523int iw_set_essid(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07003524 struct iw_request_info *info,
3525 union iwreq_data *wrqu, char *extra)
3526{
3527 v_U32_t status = 0;
3528 hdd_wext_state_t *pWextState;
3529 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
3530 v_U32_t roamId;
3531 tCsrRoamProfile *pRoamProfile;
3532 eMib_dot11DesiredBssType connectedBssType;
3533 eCsrAuthType RSNAuthType;
3534 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
3535 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003536
3537 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
3538
Jeff Johnson295189b2012-06-20 16:38:30 -07003539 ENTER();
3540
3541 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
3542 {
Agarwal Ashish971c2882013-10-30 20:11:12 +05303543 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 "%s:LOGP in Progress. Ignore!!!",__func__);
3545 return 0;
3546 }
3547
3548 if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) {
3549 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__);
3550 return -EBUSY;
3551 }
3552 if( SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length )
3553 return -EINVAL;
3554 pRoamProfile = &pWextState->roamProfile;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003555 if (pRoamProfile)
Jeff Johnson295189b2012-06-20 16:38:30 -07003556 {
3557 if ( hdd_connGetConnectedBssType( pHddStaCtx, &connectedBssType ) ||
3558 ( eMib_dot11DesiredBssType_independent == pHddStaCtx->conn_info.connDot11DesiredBssType ))
3559 {
3560 VOS_STATUS vosStatus;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003561 // need to issue a disconnect to CSR.
Jeff Johnson295189b2012-06-20 16:38:30 -07003562 INIT_COMPLETION(pAdapter->disconnect_comp_var);
3563 vosStatus = sme_RoamDisconnect( hHal, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED );
3564
3565 if(VOS_STATUS_SUCCESS == vosStatus)
3566 wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var,
3567 msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
3568 }
3569 }
3570 /** wpa_supplicant 0.8.x, wext driver uses */
Shailender Karmuchia734f332013-04-19 14:02:48 -07003571 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003572 {
3573 return -EINVAL;
3574 }
3575 /** wpa_supplicant 0.8.x, wext driver uses */
Shailender Karmuchia734f332013-04-19 14:02:48 -07003576 /** when cfg80211 defined, wpa_supplicant wext driver uses
3577 zero-length, null-string ssid for force disconnection.
3578 after disconnection (if previously connected) and cleaning ssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 driver MUST return success */
3580 if ( 0 == wrqu->essid.length ) {
3581 return 0;
3582 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003583
3584 status = hdd_wmm_get_uapsd_mask(pAdapter,
3585 &pWextState->roamProfile.uapsd_mask);
3586 if (VOS_STATUS_SUCCESS != status)
3587 {
3588 pWextState->roamProfile.uapsd_mask = 0;
3589 }
3590 pWextState->roamProfile.SSIDs.numOfSSIDs = 1;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003591
Jeff Johnson295189b2012-06-20 16:38:30 -07003592 pWextState->roamProfile.SSIDs.SSIDList->SSID.length = wrqu->essid.length;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003593
3594 vos_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003595 vos_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId), extra, wrqu->essid.length);
3596 if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion ||
3597 IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion ) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003598
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 //set gen ie
3600 hdd_SetGENIEToCsr(pAdapter, &RSNAuthType);
3601
3602 //set auth
3603 hdd_set_csr_auth_type(pAdapter, RSNAuthType);
3604 }
3605#ifdef FEATURE_WLAN_WAPI
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003606 hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003607 if (pAdapter->wapi_info.nWapiMode)
3608 {
3609 switch (pAdapter->wapi_info.wapiAuthMode)
3610 {
3611 case WAPI_AUTH_MODE_PSK:
3612 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003613 hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, pAdapter->wapi_info.wapiAuthMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003614 pRoamProfile->AuthType.numEntries = 1;
3615 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK;
3616 break;
3617 }
3618 case WAPI_AUTH_MODE_CERT:
3619 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003620 hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, pAdapter->wapi_info.wapiAuthMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003621 pRoamProfile->AuthType.numEntries = 1;
3622 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
3623 break;
3624 }
3625 } // End of switch
3626 if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK ||
3627 pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT)
3628 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003629 hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003630 pRoamProfile->EncryptionType.numEntries = 1;
3631 pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI;
3632 pRoamProfile->mcEncryptionType.numEntries = 1;
3633 pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI;
3634 }
3635 }
3636#endif /* FEATURE_WLAN_WAPI */
3637 /* if previous genIE is not NULL, update AssocIE */
3638 if (0 != pWextState->genIE.length)
3639 {
3640 memset( &pWextState->assocAddIE, 0, sizeof(pWextState->assocAddIE) );
3641 memcpy( pWextState->assocAddIE.addIEdata, pWextState->genIE.addIEdata,
3642 pWextState->genIE.length);
3643 pWextState->assocAddIE.length = pWextState->genIE.length;
3644 pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata;
3645 pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length;
3646
3647 /* clear previous genIE after use it */
3648 memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) );
3649 }
3650
3651 /* assumes it is not WPS Association by default, except when pAddIEAssoc has WPS IE */
3652 pWextState->roamProfile.bWPSAssociation = FALSE;
3653
3654 if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc,
3655 pWextState->roamProfile.nAddIEAssocLength))
3656 pWextState->roamProfile.bWPSAssociation = TRUE;
3657
3658
3659 // Disable auto BMPS entry by PMC until DHCP is done
3660 sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), TRUE);
3661
Shailender Karmuchia734f332013-04-19 14:02:48 -07003662 pWextState->roamProfile.csrPersona = pAdapter->device_mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07003663 (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003664
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07003665 if ( eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType )
3666 {
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07003667 hdd_select_cbmode(pAdapter,
3668 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->AdHocChannel5G);
3669 }
3670 status = sme_RoamConnect( hHal,pAdapter->sessionId,
3671 &(pWextState->roamProfile), &roamId);
3672 pRoamProfile->ChannelInfo.ChannelList = NULL;
3673 pRoamProfile->ChannelInfo.numOfChannels = 0;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07003674
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07003675 EXIT();
3676 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003677}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07003678
Jeff Johnson295189b2012-06-20 16:38:30 -07003679/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07003680
3681 \brief iw_get_essid() -
Jeff Johnson295189b2012-06-20 16:38:30 -07003682 This function returns the essid to the wpa_supplicant.
Shailender Karmuchia734f332013-04-19 14:02:48 -07003683
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 \param - dev - Pointer to the net device.
3685 - info - Pointer to the iw_request_info.
3686 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07003687 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07003689
Jeff Johnson295189b2012-06-20 16:38:30 -07003690 --------------------------------------------------------------------------*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07003691int iw_get_essid(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 struct iw_request_info *info,
3693 struct iw_point *dwrq, char *extra)
3694{
3695 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003696 hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07003697 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
3698 ENTER();
3699
3700 if((pHddStaCtx->conn_info.connState == eConnectionState_Associated &&
3701 wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) ||
3702 ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected ||
3703 pHddStaCtx->conn_info.connState == eConnectionState_IbssDisconnected) &&
3704 wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0))
3705 {
3706 dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length;
3707 memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, dwrq->length);
3708 dwrq->flags = 1;
3709 } else {
3710 memset(extra, 0, dwrq->length);
3711 dwrq->length = 0;
3712 dwrq->flags = 0;
3713 }
3714 EXIT();
3715 return 0;
3716}
3717/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07003718
3719 \brief iw_set_auth() -
Jeff Johnson295189b2012-06-20 16:38:30 -07003720 This function sets the auth type received from the wpa_supplicant.
Shailender Karmuchia734f332013-04-19 14:02:48 -07003721
Jeff Johnson295189b2012-06-20 16:38:30 -07003722 \param - dev - Pointer to the net device.
3723 - info - Pointer to the iw_request_info.
3724 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07003725 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07003726 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07003727
Jeff Johnson295189b2012-06-20 16:38:30 -07003728 --------------------------------------------------------------------------*/
3729int iw_set_auth(struct net_device *dev,struct iw_request_info *info,
3730 union iwreq_data *wrqu,char *extra)
3731{
3732 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003733 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07003734 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
3735 tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003736 eCsrEncryptionType mcEncryptionType;
Jeff Johnson295189b2012-06-20 16:38:30 -07003737 eCsrEncryptionType ucEncryptionType;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003738
Jeff Johnson295189b2012-06-20 16:38:30 -07003739 ENTER();
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08003740
3741 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
3742 {
3743 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
3744 "%s:LOGP in Progress. Ignore!!!", __func__);
3745 return -EBUSY;
3746 }
3747
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 switch(wrqu->param.flags & IW_AUTH_INDEX)
3749 {
3750 case IW_AUTH_WPA_VERSION:
Shailender Karmuchia734f332013-04-19 14:02:48 -07003751
Jeff Johnson295189b2012-06-20 16:38:30 -07003752 pWextState->wpaVersion = wrqu->param.value;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003753
Jeff Johnson295189b2012-06-20 16:38:30 -07003754 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003755
Jeff Johnson295189b2012-06-20 16:38:30 -07003756 case IW_AUTH_CIPHER_PAIRWISE:
3757 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003758 if(wrqu->param.value & IW_AUTH_CIPHER_NONE) {
Jeff Johnson295189b2012-06-20 16:38:30 -07003759 ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003760 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003761 else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
3762 ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003763 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003764 else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) {
3765 ucEncryptionType = eCSR_ENCRYPT_TYPE_AES;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003766 }
3767
Jeff Johnson295189b2012-06-20 16:38:30 -07003768 else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003769
3770 if( (IW_AUTH_KEY_MGMT_802_1X
3771 == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) )
Jeff Johnson295189b2012-06-20 16:38:30 -07003772 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) )
3773 /*Dynamic WEP key*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07003774 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40;
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 else
3776 /*Static WEP key*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07003777 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
3778 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003779 else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003780
3781 if( ( IW_AUTH_KEY_MGMT_802_1X
3782 == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) )
Jeff Johnson295189b2012-06-20 16:38:30 -07003783 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
3784 /*Dynamic WEP key*/
3785 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104;
3786 else
3787 /*Static WEP key*/
3788 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003789
Jeff Johnson295189b2012-06-20 16:38:30 -07003790 }
3791 else {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003792
Jeff Johnson295189b2012-06-20 16:38:30 -07003793 hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER",
Shailender Karmuchia734f332013-04-19 14:02:48 -07003794 __func__, wrqu->param.value);
Jeff Johnson295189b2012-06-20 16:38:30 -07003795 return -EINVAL;
3796 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003797
Jeff Johnson295189b2012-06-20 16:38:30 -07003798 pRoamProfile->EncryptionType.numEntries = 1;
3799 pRoamProfile->EncryptionType.encryptionType[0] = ucEncryptionType;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003800 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003801 break;
3802 case IW_AUTH_CIPHER_GROUP:
Shailender Karmuchia734f332013-04-19 14:02:48 -07003803 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003804 if(wrqu->param.value & IW_AUTH_CIPHER_NONE) {
3805 mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
3806 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003807
Jeff Johnson295189b2012-06-20 16:38:30 -07003808 else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
3809 mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP;
3810 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003811
3812 else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) {
Jeff Johnson295189b2012-06-20 16:38:30 -07003813 mcEncryptionType = eCSR_ENCRYPT_TYPE_AES;
3814 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003815
Jeff Johnson295189b2012-06-20 16:38:30 -07003816 else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003817
3818 if( ( IW_AUTH_KEY_MGMT_802_1X
3819 == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X ))
3820 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
3821
Jeff Johnson295189b2012-06-20 16:38:30 -07003822 mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003823
3824 else
3825 mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003826 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003827
3828 else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104)
3829 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003830 /*Dynamic WEP keys won't work with shared keys*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07003831 if( ( IW_AUTH_KEY_MGMT_802_1X
3832 == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X))
Jeff Johnson295189b2012-06-20 16:38:30 -07003833 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
3834 {
3835 mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104;
3836 }
3837 else
3838 {
3839 mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3840 }
3841 }
3842 else {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003843
Jeff Johnson295189b2012-06-20 16:38:30 -07003844 hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER",
Shailender Karmuchia734f332013-04-19 14:02:48 -07003845 __func__, wrqu->param.value);
Jeff Johnson295189b2012-06-20 16:38:30 -07003846 return -EINVAL;
3847 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003848
Jeff Johnson295189b2012-06-20 16:38:30 -07003849 pRoamProfile->mcEncryptionType.numEntries = 1;
3850 pRoamProfile->mcEncryptionType.encryptionType[0] = mcEncryptionType;
3851 }
3852 break;
3853
3854 case IW_AUTH_80211_AUTH_ALG:
3855 {
3856 /*Save the auth algo here and set auth type to SME Roam profile
3857 in the iw_set_ap_address*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07003858 if( wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM)
Jeff Johnson295189b2012-06-20 16:38:30 -07003859 pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003860
Jeff Johnson295189b2012-06-20 16:38:30 -07003861 else if(wrqu->param.value & IW_AUTH_ALG_SHARED_KEY)
3862 pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY;
3863
3864 else if(wrqu->param.value & IW_AUTH_ALG_LEAP)
3865 /*Not supported*/
3866 pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
3867 pWextState->roamProfile.AuthType.authType[0] = pHddStaCtx->conn_info.authType;
3868 }
3869 break;
3870
3871 case IW_AUTH_KEY_MGMT:
3872 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003873#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07003874#define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */
3875 /*Check for CCKM AKM type */
3876 if ( wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003877 hddLog(VOS_TRACE_LEVEL_INFO,"%s: CCKM AKM Set %d",
3878 __func__, wrqu->param.value);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003879 /* Set the CCKM bit in authKeyMgmt */
3880 /* Right now, this breaks all ref to authKeyMgmt because our
3881 * code doesn't realize it is a "bitfield"
Jeff Johnson295189b2012-06-20 16:38:30 -07003882 */
3883 pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM;
3884 /*Set the key management to 802.1X*/
3885 //pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003886 pWextState->isESEConnection = eANI_BOOLEAN_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003887 //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA.
3888 pWextState->collectedAuthType = eCSR_AUTH_TYPE_CCKM_RSN;
3889 } else if ( wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) {
3890 /*Save the key management*/
3891 pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK;
3892 //pWextState->authKeyMgmt = wrqu->param.value;
3893 //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA.
3894 pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN;
3895 } else if (!( wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) {
3896 pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; //eCSR_AUTH_TYPE_WPA_NONE
3897 /*Save the key management anyway*/
3898 pWextState->authKeyMgmt = wrqu->param.value;
3899 } else { // It must be IW_AUTH_KEY_MGMT_802_1X
3900 /*Save the key management*/
3901 pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X;
3902 //pWextState->authKeyMgmt = wrqu->param.value;
3903 //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA.
3904 pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN;
3905 }
3906#else
3907 /*Save the key management*/
3908 pWextState->authKeyMgmt = wrqu->param.value;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003909#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -07003910 }
3911 break;
3912
3913 case IW_AUTH_TKIP_COUNTERMEASURES:
3914 {
3915 if(wrqu->param.value) {
3916 hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
3917 "Counter Measure started %d", wrqu->param.value);
3918 pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED;
3919 }
3920 else {
3921 hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
3922 "Counter Measure stopped=%d", wrqu->param.value);
3923 pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED;
3924 }
3925 }
3926 break;
3927 case IW_AUTH_DROP_UNENCRYPTED:
3928 case IW_AUTH_WPA_ENABLED:
3929 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
3930 case IW_AUTH_ROAMING_CONTROL:
3931 case IW_AUTH_PRIVACY_INVOKED:
Shailender Karmuchia734f332013-04-19 14:02:48 -07003932
Jeff Johnson295189b2012-06-20 16:38:30 -07003933 default:
Shailender Karmuchia734f332013-04-19 14:02:48 -07003934
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003935 hddLog(LOGW, "%s called with unsupported auth type %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07003936 wrqu->param.flags & IW_AUTH_INDEX);
3937 break;
3938 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003939
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 EXIT();
3941 return 0;
3942}
3943/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07003944
3945 \brief iw_get_auth() -
Jeff Johnson295189b2012-06-20 16:38:30 -07003946 This function returns the auth type to the wpa_supplicant.
Shailender Karmuchia734f332013-04-19 14:02:48 -07003947
Jeff Johnson295189b2012-06-20 16:38:30 -07003948 \param - dev - Pointer to the net device.
3949 - info - Pointer to the iw_request_info.
3950 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07003951 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07003952 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07003953
Jeff Johnson295189b2012-06-20 16:38:30 -07003954 --------------------------------------------------------------------------*/
3955int iw_get_auth(struct net_device *dev,struct iw_request_info *info,
3956 union iwreq_data *wrqu,char *extra)
3957{
3958 hdd_adapter_t* pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003959 hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07003960 tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
3961 ENTER();
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08003962
3963 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
3964 {
3965 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
3966 "%s:LOGP in Progress. Ignore!!!", __func__);
3967 return -EBUSY;
3968 }
3969
Jeff Johnson295189b2012-06-20 16:38:30 -07003970 switch(pRoamProfile->negotiatedAuthType)
3971 {
3972 case eCSR_AUTH_TYPE_WPA_NONE:
3973 wrqu->param.flags = IW_AUTH_WPA_VERSION;
3974 wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED;
3975 break;
3976 case eCSR_AUTH_TYPE_WPA:
3977 wrqu->param.flags = IW_AUTH_WPA_VERSION;
3978 wrqu->param.value = IW_AUTH_WPA_VERSION_WPA;
3979 break;
3980#ifdef WLAN_FEATURE_VOWIFI_11R
3981 case eCSR_AUTH_TYPE_FT_RSN:
3982#endif
3983 case eCSR_AUTH_TYPE_RSN:
3984 wrqu->param.flags = IW_AUTH_WPA_VERSION;
3985 wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2;
3986 break;
3987 case eCSR_AUTH_TYPE_OPEN_SYSTEM:
3988 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
3989 break;
3990 case eCSR_AUTH_TYPE_SHARED_KEY:
3991 wrqu->param.value = IW_AUTH_ALG_SHARED_KEY;
3992 break;
3993 case eCSR_AUTH_TYPE_UNKNOWN:
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003994 hddLog(LOG1,"%s called with unknown auth type", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003995 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
3996 break;
3997 case eCSR_AUTH_TYPE_AUTOSWITCH:
3998 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
3999 break;
4000 case eCSR_AUTH_TYPE_WPA_PSK:
Agarwal Ashish971c2882013-10-30 20:11:12 +05304001 hddLog(LOG1,"%s called with WPA PSK auth type", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004002 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
4003 return -EIO;
4004#ifdef WLAN_FEATURE_VOWIFI_11R
4005 case eCSR_AUTH_TYPE_FT_RSN_PSK:
4006#endif
4007 case eCSR_AUTH_TYPE_RSN_PSK:
Chet Lanctot186b5732013-03-18 10:26:30 -07004008#ifdef WLAN_FEATURE_11W
4009 case eCSR_AUTH_TYPE_RSN_PSK_SHA256:
Abhishek Singhae408032014-09-25 17:22:04 +05304010 case eCSR_AUTH_TYPE_RSN_8021X_SHA256:
Chet Lanctot186b5732013-03-18 10:26:30 -07004011#endif
Agarwal Ashish971c2882013-10-30 20:11:12 +05304012 hddLog(LOG1,"%s called with RSN PSK auth type", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004013 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
4014 return -EIO;
4015 default:
Agarwal Ashish971c2882013-10-30 20:11:12 +05304016 hddLog(LOGE,"%s called with unknown auth type", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
4018 return -EIO;
4019 }
4020 if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE))
4021 {
4022 switch(pRoamProfile->negotiatedUCEncryptionType)
4023 {
4024 case eCSR_ENCRYPT_TYPE_NONE:
4025 wrqu->param.value = IW_AUTH_CIPHER_NONE;
4026 break;
4027 case eCSR_ENCRYPT_TYPE_WEP40:
4028 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
4029 wrqu->param.value = IW_AUTH_CIPHER_WEP40;
4030 break;
4031 case eCSR_ENCRYPT_TYPE_TKIP:
4032 wrqu->param.value = IW_AUTH_CIPHER_TKIP;
4033 break;
4034 case eCSR_ENCRYPT_TYPE_WEP104:
4035 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
4036 wrqu->param.value = IW_AUTH_CIPHER_WEP104;
4037 break;
4038 case eCSR_ENCRYPT_TYPE_AES:
4039 wrqu->param.value = IW_AUTH_CIPHER_CCMP;
4040 break;
4041 default:
Agarwal Ashish971c2882013-10-30 20:11:12 +05304042 hddLog(LOG1, "%s called with unknown auth type %d ",
4043 __func__, pRoamProfile->negotiatedUCEncryptionType);
Jeff Johnson295189b2012-06-20 16:38:30 -07004044 return -EIO;
4045 }
4046 }
4047
Shailender Karmuchia734f332013-04-19 14:02:48 -07004048 if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP))
Jeff Johnson295189b2012-06-20 16:38:30 -07004049 {
4050 switch(pRoamProfile->negotiatedMCEncryptionType)
4051 {
4052 case eCSR_ENCRYPT_TYPE_NONE:
4053 wrqu->param.value = IW_AUTH_CIPHER_NONE;
4054 break;
4055 case eCSR_ENCRYPT_TYPE_WEP40:
4056 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
4057 wrqu->param.value = IW_AUTH_CIPHER_WEP40;
4058 break;
4059 case eCSR_ENCRYPT_TYPE_TKIP:
4060 wrqu->param.value = IW_AUTH_CIPHER_TKIP;
4061 break;
4062 case eCSR_ENCRYPT_TYPE_WEP104:
4063 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
4064 wrqu->param.value = IW_AUTH_CIPHER_WEP104;
4065 break;
4066 case eCSR_ENCRYPT_TYPE_AES:
4067 wrqu->param.value = IW_AUTH_CIPHER_CCMP;
4068 break;
4069 default:
Agarwal Ashish971c2882013-10-30 20:11:12 +05304070 hddLog(LOG1, "%s called with unknown auth type %d ",
4071 __func__, pRoamProfile->negotiatedMCEncryptionType);
Jeff Johnson295189b2012-06-20 16:38:30 -07004072 return -EIO;
4073 }
4074 }
4075
4076 hddLog(LOG1, "%s called with auth type %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004077 __func__, pRoamProfile->AuthType.authType[0]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004078 EXIT();
4079 return 0;
4080}
4081/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07004082
4083 \brief iw_set_ap_address() -
4084 This function calls the sme_RoamConnect function to associate
Jeff Johnson295189b2012-06-20 16:38:30 -07004085 to the AP with the specified BSSID received from the wpa_supplicant.
Shailender Karmuchia734f332013-04-19 14:02:48 -07004086
Jeff Johnson295189b2012-06-20 16:38:30 -07004087 \param - dev - Pointer to the net device.
4088 - info - Pointer to the iw_request_info.
4089 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07004090 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07004091 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07004092
Jeff Johnson295189b2012-06-20 16:38:30 -07004093 --------------------------------------------------------------------------*/
4094int iw_set_ap_address(struct net_device *dev,
4095 struct iw_request_info *info,
4096 union iwreq_data *wrqu, char *extra)
4097{
4098 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev));
4099 v_U8_t *pMacAddress=NULL;
4100 ENTER();
4101 pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data;
Arif Hussain24bafea2013-11-15 15:10:03 -08004102 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s "MAC_ADDRESS_STR,
4103 __func__, MAC_ADDR_ARRAY(pMacAddress));
Jeff Johnson295189b2012-06-20 16:38:30 -07004104 vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid ));
4105 EXIT();
Shailender Karmuchia734f332013-04-19 14:02:48 -07004106
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 return 0;
4108}
4109/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07004110
4111 \brief iw_get_ap_address() -
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 This function returns the BSSID to the wpa_supplicant
4113 \param - dev - Pointer to the net device.
4114 - info - Pointer to the iw_request_info.
4115 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07004116 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07004117 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07004118
Jeff Johnson295189b2012-06-20 16:38:30 -07004119 --------------------------------------------------------------------------*/
4120int iw_get_ap_address(struct net_device *dev,
4121 struct iw_request_info *info,
4122 union iwreq_data *wrqu, char *extra)
4123{
4124 //hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
4125 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev));
4126
4127 ENTER();
4128
4129 if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) ||
4130 (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState))
4131 {
Jeff Johnson4416a782013-03-25 14:17:50 -07004132 memcpy(wrqu->ap_addr.sa_data,pHddStaCtx->conn_info.bssId,ETH_ALEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 }
4134 else
4135 {
4136 memset(wrqu->ap_addr.sa_data,0,sizeof(wrqu->ap_addr.sa_data));
4137 }
4138 EXIT();
4139 return 0;
4140}
Jeff Johnsond13512a2012-07-17 11:42:19 -07004141
Chet Lanctot186b5732013-03-18 10:26:30 -07004142#ifdef WLAN_FEATURE_11W
4143/**---------------------------------------------------------------------------
4144
4145 \brief hdd_indicateUnprotMgmtFrame -
4146 This function forwards the unprotected management frame to the supplicant
4147 \param - pAdapter - Pointer to HDD adapter
4148 - nFrameLength - Length of the unprotected frame being passed
4149 - pbFrames - Pointer to the frame buffer
4150 - frameType - 802.11 frame type
4151 \return - nothing
4152
4153 --------------------------------------------------------------------------*/
4154void hdd_indicateUnprotMgmtFrame( hdd_adapter_t *pAdapter,
4155 tANI_U32 nFrameLength,
4156 tANI_U8* pbFrames,
4157 tANI_U8 frameType )
4158{
4159 tANI_U8 type = 0;
4160 tANI_U8 subType = 0;
4161
4162 hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d",
4163 __func__, frameType, nFrameLength);
4164
4165 /* Sanity Checks */
4166 if (NULL == pAdapter)
4167 {
4168 hddLog( LOGE, FL("pAdapter is NULL"));
4169 return;
4170 }
4171
4172 if (NULL == pAdapter->dev)
4173 {
4174 hddLog( LOGE, FL("pAdapter->dev is NULL"));
4175 return;
4176 }
4177
4178 if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
4179 {
4180 hddLog( LOGE, FL("pAdapter has invalid magic"));
4181 return;
4182 }
4183
4184 if( !nFrameLength )
4185 {
4186 hddLog( LOGE, FL("Frame Length is Invalid ZERO"));
4187 return;
4188 }
4189
4190 if (NULL == pbFrames) {
4191 hddLog( LOGE, FL("pbFrames is NULL"));
4192 return;
4193 }
4194
4195 type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]);
4196 subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]);
4197
4198 /* Get pAdapter from Destination mac address of the frame */
4199 if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC)
4200 {
4201 cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, nFrameLength);
4202 pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++;
4203 }
4204 else if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DEAUTH)
4205 {
4206 cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, nFrameLength);
4207 pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++;
4208 }
4209 else
4210 {
4211 hddLog( LOGE, FL("Frame type %d and subtype %d are not valid"), type, subType);
4212 return;
4213 }
4214}
4215#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004216
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004217#if defined (FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004218void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid,
4219 tANI_U8 state,
4220 tANI_U16 measInterval )
4221{
4222 union iwreq_data wrqu;
4223 char buf[IW_CUSTOM_MAX + 1];
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08004224 int nBytes = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004225
4226 if (NULL == pAdapter)
4227 return;
4228
4229 // create the event
4230 memset(&wrqu, '\0', sizeof(wrqu));
4231 memset(buf, '\0', sizeof(buf));
4232
4233 hddLog(VOS_TRACE_LEVEL_INFO, "TSM Ind tid(%d) state(%d) MeasInt(%d)",
4234 tid, state, measInterval);
4235
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08004236 nBytes = snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d",tid,state,measInterval);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004237
4238 wrqu.data.pointer = buf;
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08004239 wrqu.data.length = nBytes;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004240 // send the event
4241 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
4242}
4243
4244void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo)
4245{
4246 union iwreq_data wrqu;
4247 char buf[IW_CUSTOM_MAX + 1];
4248 char *pos = buf;
4249 int nBytes = 0, freeBytes = IW_CUSTOM_MAX;
4250
4251 if ((NULL == pAdapter) || (NULL == pRoamInfo))
4252 return;
4253
4254 // create the event
4255 memset(&wrqu, '\0', sizeof(wrqu));
4256 memset(buf, '\0', sizeof(buf));
4257
4258 /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */
Arun Kumar Khandavallie8768212014-02-17 16:43:34 +05304259 hddLog(VOS_TRACE_LEVEL_INFO, "CCXPREAUTHNOTIFY=%02x:%02x:%02x:%02x:%02x:%02x %u:%u",
4260 pRoamInfo->bssid[0], pRoamInfo->bssid[1], pRoamInfo->bssid[2],
4261 pRoamInfo->bssid[3], pRoamInfo->bssid[4], pRoamInfo->bssid[5],
4262 pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004263
4264 nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY=");
4265 pos += nBytes;
4266 freeBytes -= nBytes;
4267
4268 vos_mem_copy(pos, pRoamInfo->bssid, WNI_CFG_BSSID_LEN);
4269 pos += WNI_CFG_BSSID_LEN;
4270 freeBytes -= WNI_CFG_BSSID_LEN;
4271
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08004272 nBytes = snprintf(pos, freeBytes, " %u:%u", pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]);
4273 freeBytes -= nBytes;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004274
4275 wrqu.data.pointer = buf;
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08004276 wrqu.data.length = (IW_CUSTOM_MAX - freeBytes);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004277
4278 // send the event
4279 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
4280}
4281
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004282void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004283{
4284 union iwreq_data wrqu;
4285 char buf[IW_CUSTOM_MAX + 1];
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08004286 int nBytes = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004287
4288 if ((NULL == pAdapter) || (NULL == pRoamInfo))
4289 return;
4290
4291 // create the event
4292 memset(&wrqu, '\0', sizeof(wrqu));
4293 memset(buf, '\0', sizeof(buf));
4294
4295 hddLog(VOS_TRACE_LEVEL_INFO, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay);
4296
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08004297 nBytes = snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004298
4299 wrqu.data.pointer = buf;
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08004300 wrqu.data.length = nBytes;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004301
4302 // send the event
4303 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
4304}
4305
Srinivas Girigowda0c6d7fe2014-05-28 18:18:10 -07004306void hdd_indicateEseBcnReportNoResults(const hdd_adapter_t *pAdapter,
4307 const tANI_U16 measurementToken,
4308 const tANI_BOOLEAN flag,
4309 const tANI_U8 numBss)
4310{
4311 union iwreq_data wrqu;
4312 char buf[IW_CUSTOM_MAX];
4313 char *pos = buf;
4314 int nBytes = 0, freeBytes = IW_CUSTOM_MAX;
4315
4316 memset(&wrqu, '\0', sizeof(wrqu));
4317 memset(buf, '\0', sizeof(buf));
4318
4319 hddLog(VOS_TRACE_LEVEL_INFO, FL("CCXBCNREP=%d %d %d"), measurementToken, flag,
4320 numBss);
4321
4322 nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken,
4323 flag, numBss);
4324
4325 wrqu.data.pointer = buf;
4326 wrqu.data.length = nBytes;
4327 // send the event
4328 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
4329}
4330
4331
4332static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004333 const tCsrRoamInfo *pRoamInfo)
4334{
4335 union iwreq_data wrqu;
4336 char buf[IW_CUSTOM_MAX + 1];
4337 char *pos = buf;
4338 int nBytes = 0, freeBytes = IW_CUSTOM_MAX;
4339 tANI_U8 i = 0, len = 0;
4340 tANI_U8 tot_bcn_ieLen = 0; /* total size of the beacon report data */
4341 tANI_U8 lastSent = 0, sendBss = 0;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004342 int bcnRepFieldSize = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0].bcnReportFields);
4343 tANI_U8 ieLenByte = 1;
4344 /* CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes */
4345#define ESEBCNREPHEADER_LEN (18)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004346
4347 if ((NULL == pAdapter) || (NULL == pRoamInfo))
4348 return;
4349
4350 /* Custom event can pass maximum of 256 bytes of data,
4351 based on the IE len we need to identify how many BSS info can
4352 be filled in to custom event data */
4353 /*
4354 meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data
4355 bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces
4356 CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes
4357 */
4358
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004359 if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) && (!pRoamInfo->pEseBcnReportRsp->numBss))
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004360 {
4361 hddLog(VOS_TRACE_LEVEL_INFO, "Measurement Done but no scan results");
4362 /* If the measurement is none and no scan results found,
4363 indicate the supplicant about measurement done */
Srinivas Girigowda0c6d7fe2014-05-28 18:18:10 -07004364 hdd_indicateEseBcnReportNoResults(pAdapter,
4365 pRoamInfo->pEseBcnReportRsp->measurementToken,
4366 pRoamInfo->pEseBcnReportRsp->flag,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004367 pRoamInfo->pEseBcnReportRsp->numBss);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004368 }
4369 else
4370 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004371 while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004372 {
4373 memset(&wrqu, '\0', sizeof(wrqu));
4374 memset(buf, '\0', sizeof(buf));
4375 tot_bcn_ieLen = 0;
4376 sendBss = 0;
4377 pos = buf;
4378 freeBytes = IW_CUSTOM_MAX;
4379
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004380 for (i = lastSent; i < pRoamInfo->pEseBcnReportRsp->numBss; i++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004381 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004382 len = bcnRepFieldSize + ieLenByte + pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen;
4383 if ((len + tot_bcn_ieLen) > (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN))
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004384 {
4385 break;
4386 }
4387 tot_bcn_ieLen += len;
4388 sendBss++;
4389 hddLog(VOS_TRACE_LEVEL_INFO, "i(%d) sizeof bcnReportFields(%d)"
4390 "IeLength(%d) Length of Ie(%d) totLen(%d)",
4391 i, bcnRepFieldSize, 1,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004392 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004393 tot_bcn_ieLen);
4394 }
4395
4396 hddLog(VOS_TRACE_LEVEL_INFO, "Sending %d BSS Info", sendBss);
4397 hddLog(VOS_TRACE_LEVEL_INFO, "CCXBCNREP=%d %d %d %d",
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004398 pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag,
4399 sendBss, tot_bcn_ieLen);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004400
4401 nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ",
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004402 pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag,
4403 sendBss);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004404 pos += nBytes;
4405 freeBytes -= nBytes;
4406
4407 /* Copy total Beacon report data length */
4408 vos_mem_copy(pos, (char*)&tot_bcn_ieLen, sizeof(tot_bcn_ieLen));
4409 pos += sizeof(tot_bcn_ieLen);
4410 freeBytes -= sizeof(tot_bcn_ieLen);
4411
4412 for (i = 0; i < sendBss; i++)
4413 {
4414 hddLog(VOS_TRACE_LEVEL_INFO, "ChanNum(%d) Spare(%d) MeasDuration(%d)"
Arun Kumar Khandavallie8768212014-02-17 16:43:34 +05304415 " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)"
4416 " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)"
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004417 " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)",
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004418 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ChanNum,
4419 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Spare,
4420 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.MeasDuration,
4421 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.PhyType,
4422 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.RecvSigPower,
4423 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ParentTsf,
4424 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[0],
4425 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[1],
4426 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.BcnInterval,
4427 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.CapabilityInfo,
4428 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[0],
4429 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[1],
4430 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[2],
4431 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[3],
4432 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[4],
4433 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[5]);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004434
4435 /* bcn report fields are copied */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004436 len = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields);
4437 vos_mem_copy(pos, (char*)&pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields, len);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004438 pos += len;
4439 freeBytes -= len;
4440
4441 /* Add 1 byte of ie len */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004442 len = pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].ieLen;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004443 vos_mem_copy(pos, (char*)&len, sizeof(len));
4444 pos += sizeof(len);
4445 freeBytes -= sizeof(len);
4446
4447 /* copy IE from scan results */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004448 vos_mem_copy(pos, (char*)pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].pBuf, len);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004449 pos += len;
4450 freeBytes -= len;
4451 }
4452
4453 wrqu.data.pointer = buf;
4454 wrqu.data.length = strlen(buf);
4455
4456 // send the event
4457 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
4458 lastSent += sendBss;
4459 }
4460 }
4461}
4462
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004463#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004464