blob: 287b29c14fd85638b4f4bd977e92f8f7200b3066 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Agrawal Ashishc407f192017-01-23 17:18:35 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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"
Konamki, Sreelakshmib9c45712015-07-29 11:48:19 +053056#include "wlan_hdd_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057#include <linux/ieee80211.h>
58#include <linux/wireless.h>
59#include <net/cfg80211.h>
60#include "wlan_hdd_cfg80211.h"
61#include "csrInsideApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070062#include "wlan_hdd_p2p.h"
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +053063#include <vos_sched.h>
Mohit Khanna698ba2a2012-12-04 15:08:18 -080064#include "wlan_hdd_tdls.h"
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#include "vos_utils.h"
Siddharth Bhalda0d1622015-04-24 15:47:49 +053068#include <wlan_hdd_wext.h>
Mukul Sharma84f27252014-07-14 18:11:42 +053069
Jeff Johnson295189b2012-06-20 16:38:30 -070070v_BOOL_t mibIsDot11DesiredBssTypeInfrastructure( hdd_adapter_t *pAdapter );
71
Shailender Karmuchia734f332013-04-19 14:02:48 -070072struct ether_addr
Jeff Johnson295189b2012-06-20 16:38:30 -070073{
74 u_char ether_addr_octet[6];
75};
76// These are needed to recognize WPA and RSN suite types
77#define HDD_WPA_OUI_SIZE 4
78v_U8_t ccpWpaOui00[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x00 };
79v_U8_t ccpWpaOui01[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x01 };
80v_U8_t ccpWpaOui02[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 };
81v_U8_t ccpWpaOui03[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x03 };
82v_U8_t ccpWpaOui04[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x04 };
83v_U8_t ccpWpaOui05[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x05 };
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080084#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -070085v_U8_t ccpWpaOui06[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080086#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -070087#define HDD_RSN_OUI_SIZE 4
88v_U8_t ccpRSNOui00[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x00 }; // group cipher
89v_U8_t ccpRSNOui01[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x01 }; // WEP-40 or RSN
90v_U8_t ccpRSNOui02[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x02 }; // TKIP or RSN-PSK
91v_U8_t ccpRSNOui03[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x03 }; // Reserved
92v_U8_t ccpRSNOui04[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x04 }; // AES-CCMP
93v_U8_t ccpRSNOui05[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 }; // WEP-104
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080094#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -070095v_U8_t ccpRSNOui06[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080096#endif /* FEATURE_WLAN_ESE */
Chet Lanctot186b5732013-03-18 10:26:30 -070097#ifdef WLAN_FEATURE_11W
98v_U8_t ccpRSNOui07[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x06 }; // RSN-PSK-SHA256
Abhishek Singhae408032014-09-25 17:22:04 +053099/* RSN-8021X-SHA256 */
100v_U8_t ccpRSNOui08[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 };
Chet Lanctot186b5732013-03-18 10:26:30 -0700101#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700102
Shailender Karmuchia734f332013-04-19 14:02:48 -0700103#if defined(WLAN_FEATURE_VOWIFI_11R)
Jeff Johnson295189b2012-06-20 16:38:30 -0700104// Offset where the EID-Len-IE, start.
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700105#define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2)*/
106#define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */
Jeff Johnson295189b2012-06-20 16:38:30 -0700107#endif
108
109#define BEACON_FRAME_IES_OFFSET 12
110
Chet Lanctot186b5732013-03-18 10:26:30 -0700111#ifdef WLAN_FEATURE_11W
112void hdd_indicateUnprotMgmtFrame(hdd_adapter_t *pAdapter,
113 tANI_U32 nFrameLength,
114 tANI_U8* pbFrames,
115 tANI_U8 frameType );
116#endif
117
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800118#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700119static void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid,
120 tANI_U8 state,
121 tANI_U16 measInterval );
122static void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800123static void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo);
124static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter, const tCsrRoamInfo *pRoamInfo);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700125
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800126#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700127
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530128static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter,
129 tCsrRoamInfo *pRoamInfo,
130 tANI_U32 roamId,
131 eRoamCmdStatus roamStatus,
132 eCsrRoamResult roamResult );
133
Madan Mohan Koyyalamudid5acbf52012-11-28 01:45:08 +0530134v_VOID_t hdd_connSetConnectionState( hdd_station_ctx_t *pHddStaCtx,
135 eConnectionState connState )
136{
137 // save the new connection state
Arun Kumar Khandavalli94a2bb02013-12-28 19:17:25 +0530138 hddLog(LOG1, FL("ConnectionState Changed from oldState:%d to State:%d"),
139 pHddStaCtx->conn_info.connState,connState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700140 pHddStaCtx->conn_info.connState = connState;
141}
142
143// returns FALSE if not connected.
144// returns TRUE for the two 'connected' states (Infra Associated or IBSS Connected ).
145// returns the connection state. Can specify NULL if you dont' want to get the actual state.
146
Shailender Karmuchia734f332013-04-19 14:02:48 -0700147static inline v_BOOL_t hdd_connGetConnectionState( hdd_station_ctx_t *pHddStaCtx,
148 eConnectionState *pConnState )
Jeff Johnson295189b2012-06-20 16:38:30 -0700149{
Shailender Karmuchia734f332013-04-19 14:02:48 -0700150 v_BOOL_t fConnected;
Jeff Johnson295189b2012-06-20 16:38:30 -0700151 eConnectionState connState;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700152
Jeff Johnson295189b2012-06-20 16:38:30 -0700153 // get the connection state.
154 connState = pHddStaCtx->conn_info.connState;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700155 // Set the fConnected return variable based on the Connected State.
Jeff Johnson295189b2012-06-20 16:38:30 -0700156 if ( eConnectionState_Associated == connState ||
Shailender Karmuchi642e9812013-05-30 14:34:49 -0700157 eConnectionState_IbssConnected == connState ||
158 eConnectionState_IbssDisconnected == connState)
Jeff Johnson295189b2012-06-20 16:38:30 -0700159 {
160 fConnected = VOS_TRUE;
161 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700162 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700163 {
164 fConnected = VOS_FALSE;
165 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700166
Jeff Johnson295189b2012-06-20 16:38:30 -0700167 if ( pConnState )
168 {
169 *pConnState = connState;
170 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700171
Jeff Johnson295189b2012-06-20 16:38:30 -0700172 return( fConnected );
173}
174
175v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx )
176{
177 return( hdd_connGetConnectionState( pHddStaCtx, NULL ) );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700178}
Jeff Johnson295189b2012-06-20 16:38:30 -0700179
Agarwal Ashish450ffde2014-04-08 19:53:00 +0530180eCsrBand hdd_connGetConnectedBand( hdd_station_ctx_t *pHddStaCtx )
181{
182 v_U8_t staChannel = 0;
183
184 if ( eConnectionState_Associated == pHddStaCtx->conn_info.connState )
185 {
186 staChannel = pHddStaCtx->conn_info.operationChannel;
187 }
188
189 if ( staChannel > 0 && staChannel < 14 )
190 return eCSR_BAND_24;
191 else if (staChannel >= 36 && staChannel <= 165 )
192 return eCSR_BAND_5G;
193 else /* If station is not connected return as eCSR_BAND_ALL */
194 return eCSR_BAND_ALL;
195}
196
197
Jeff Johnson295189b2012-06-20 16:38:30 -0700198//TODO - Not used anyhwere. Can be removed.
199#if 0
200//
201v_BOOL_t hdd_connIsConnectedInfra( hdd_adapter_t *pAdapter )
202{
203 v_BOOL_t fConnectedInfra = FALSE;
204 eConnectionState connState;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700205
Jeff Johnson295189b2012-06-20 16:38:30 -0700206 if ( hdd_connGetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connState ) )
Shailender Karmuchia734f332013-04-19 14:02:48 -0700207 {
208 if ( eConnectionState_Associated == connState )
Jeff Johnson295189b2012-06-20 16:38:30 -0700209 {
210 fConnectedInfra = TRUE;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700211 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700212 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700213
Jeff Johnson295189b2012-06-20 16:38:30 -0700214 return( fConnectedInfra );
215}
216#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -0700217
Jeff Johnson295189b2012-06-20 16:38:30 -0700218static inline v_BOOL_t hdd_connGetConnectedCipherAlgo( hdd_station_ctx_t *pHddStaCtx, eCsrEncryptionType *pConnectedCipherAlgo )
219{
220 v_BOOL_t fConnected = VOS_FALSE;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700221
Jeff Johnson295189b2012-06-20 16:38:30 -0700222 fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700223
224 if ( pConnectedCipherAlgo )
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 {
226 *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType;
227 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700228
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 return( fConnected );
230}
Shailender Karmuchia734f332013-04-19 14:02:48 -0700231
Jeff Johnson295189b2012-06-20 16:38:30 -0700232inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eMib_dot11DesiredBssType *pConnectedBssType )
233{
234 v_BOOL_t fConnected = VOS_FALSE;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700235
Jeff Johnson295189b2012-06-20 16:38:30 -0700236 fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700237
238 if ( pConnectedBssType )
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 {
240 *pConnectedBssType = pHddStaCtx->conn_info.connDot11DesiredBssType;
241 }
Shailender Karmuchia734f332013-04-19 14:02:48 -0700242
Jeff Johnson295189b2012-06-20 16:38:30 -0700243 return( fConnected );
244}
245
246static inline void hdd_connSaveConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eCsrRoamBssType csrRoamBssType )
247{
Shailender Karmuchia734f332013-04-19 14:02:48 -0700248 switch( csrRoamBssType )
Jeff Johnson295189b2012-06-20 16:38:30 -0700249 {
250 case eCSR_BSS_TYPE_INFRASTRUCTURE:
251 pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_infrastructure;
252 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700253
Jeff Johnson295189b2012-06-20 16:38:30 -0700254 case eCSR_BSS_TYPE_IBSS:
255 case eCSR_BSS_TYPE_START_IBSS:
256 pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_independent;
257 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700258
259 /** We will never set the BssType to 'any' when attempting a connection
Jeff Johnson295189b2012-06-20 16:38:30 -0700260 so CSR should never send this back to us.*/
Shailender Karmuchia734f332013-04-19 14:02:48 -0700261 case eCSR_BSS_TYPE_ANY:
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 default:
263 VOS_ASSERT( 0 );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700264 break;
265 }
266
Jeff Johnson295189b2012-06-20 16:38:30 -0700267}
268
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +0530269/**
270 * hdd_copy_vht_caps()- copy vht caps info from roam info to
271 * hdd station context.
272 * @hdd_sta_ctx: pointer to hdd station context
273 * @roam_info: pointer to roam info
274 *
275 * Return: None
276 */
277static void hdd_copy_ht_caps(hdd_station_ctx_t *hdd_sta_ctx,
278 tCsrRoamInfo *roam_info)
279{
280 tDot11fIEHTCaps *roam_ht_cap = &roam_info->ht_caps;
281 struct ieee80211_ht_cap *hdd_ht_cap = &hdd_sta_ctx->conn_info.ht_caps;
282 uint32_t i, temp_ht_cap;
283
284 vos_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap));
285
286 if (roam_ht_cap->advCodingCap)
287 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING;
288 if (roam_ht_cap->supportedChannelWidthSet)
289 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
290 temp_ht_cap = roam_ht_cap->mimoPowerSave &
291 (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT);
292 if (temp_ht_cap)
293 hdd_ht_cap->cap_info |=
294 temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT;
295 if (roam_ht_cap->greenField)
296 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD;
297 if (roam_ht_cap->shortGI20MHz)
298 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20;
299 if (roam_ht_cap->shortGI40MHz)
300 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40;
301 if (roam_ht_cap->txSTBC)
302 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC;
303 temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >>
304 IEEE80211_HT_CAP_RX_STBC_SHIFT);
305 if (temp_ht_cap)
306 hdd_ht_cap->cap_info |=
307 temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT;
308 if (roam_ht_cap->delayedBA)
309 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA;
310 if (roam_ht_cap->maximalAMSDUsize)
311 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU;
312 if (roam_ht_cap->dsssCckMode40MHz)
313 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40;
314 if (roam_ht_cap->psmp)
315 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED;
316 if (roam_ht_cap->stbcControlFrame)
317 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT;
318 if (roam_ht_cap->lsigTXOPProtection)
319 hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT;
320
321
322 /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
323 if (roam_ht_cap->maxRxAMPDUFactor)
324 hdd_ht_cap->ampdu_params_info |=
325 IEEE80211_HT_AMPDU_PARM_FACTOR;
326 temp_ht_cap = roam_ht_cap->mpduDensity &
327 (IEEE80211_HT_AMPDU_PARM_DENSITY >>
328 IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
329 if (temp_ht_cap)
330 hdd_ht_cap->ampdu_params_info |=
331 temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT;
332
333 /* 802.11n HT extended capabilities masks */
334 if (roam_ht_cap->pco)
335 hdd_ht_cap->extended_ht_cap_info |=
336 IEEE80211_HT_EXT_CAP_PCO;
337 temp_ht_cap = roam_ht_cap->transitionTime &
338 (IEEE80211_HT_EXT_CAP_PCO_TIME >>
339 IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT);
340 if (temp_ht_cap)
341 hdd_ht_cap->extended_ht_cap_info |=
342 temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT;
343 temp_ht_cap = roam_ht_cap->mcsFeedback &
344 (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT);
345 if (temp_ht_cap)
346 hdd_ht_cap->extended_ht_cap_info |=
347 temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT;
348
349 /* tx_bf_cap_info capabilities */
350 if (roam_ht_cap->txBF)
351 hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF;
352 if (roam_ht_cap->rxStaggeredSounding)
353 hdd_ht_cap->tx_BF_cap_info |=
354 TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING;
355 if (roam_ht_cap->txStaggeredSounding)
356 hdd_ht_cap->tx_BF_cap_info |=
357 TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING;
358 if (roam_ht_cap->rxZLF)
359 hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL;
360 if (roam_ht_cap->txZLF)
361 hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL;
362 if (roam_ht_cap->implicitTxBF)
363 hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF;
364 temp_ht_cap = roam_ht_cap->calibration &
365 (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT);
366 if (temp_ht_cap)
367 hdd_ht_cap->tx_BF_cap_info |=
368 temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT;
369 if (roam_ht_cap->explicitCSITxBF)
370 hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF;
371 if (roam_ht_cap->explicitUncompressedSteeringMatrix)
372 hdd_ht_cap->tx_BF_cap_info |=
373 TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT;
374 temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback &
375 (TX_BF_CAP_INFO_EXP_BF_CSI_FB >>
376 TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT);
377 if (temp_ht_cap)
378 hdd_ht_cap->tx_BF_cap_info |=
379 temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT;
380 temp_ht_cap =
381 roam_ht_cap->explicitUncompressedSteeringMatrixFeedback &
382 (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >>
383 TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT);
384 if (temp_ht_cap)
385 hdd_ht_cap->tx_BF_cap_info |=
386 temp_ht_cap <<
387 TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT;
388 temp_ht_cap =
389 roam_ht_cap->explicitCompressedSteeringMatrixFeedback &
390 (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >>
391 TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT);
392 if (temp_ht_cap)
393 hdd_ht_cap->tx_BF_cap_info |=
394 temp_ht_cap <<
395 TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT;
396 temp_ht_cap = roam_ht_cap->csiNumBFAntennae &
397 (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >>
398 TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT);
399 if (temp_ht_cap)
400 hdd_ht_cap->tx_BF_cap_info |=
401 temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT;
402 temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae &
403 (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >>
404 TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT);
405 if (temp_ht_cap)
406 hdd_ht_cap->tx_BF_cap_info |=
407 temp_ht_cap <<
408 TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT;
409 temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae &
410 (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >>
411 TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT);
412 if (temp_ht_cap)
413 hdd_ht_cap->tx_BF_cap_info |=
414 temp_ht_cap <<
415 TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT;
416
417 /* antenna selection */
418 if (roam_ht_cap->antennaSelection)
419 hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO;
420 if (roam_ht_cap->explicitCSIFeedbackTx)
421 hdd_ht_cap->antenna_selection_info |=
422 ANTENNA_SEL_INFO_EXP_CSI_FB_TX;
423 if (roam_ht_cap->antennaIndicesFeedbackTx)
424 hdd_ht_cap->antenna_selection_info |=
425 ANTENNA_SEL_INFO_ANT_ID_FB_TX;
426 if (roam_ht_cap->explicitCSIFeedback)
427 hdd_ht_cap->antenna_selection_info |=
428 ANTENNA_SEL_INFO_EXP_CSI_FB;
429 if (roam_ht_cap->antennaIndicesFeedback)
430 hdd_ht_cap->antenna_selection_info |=
431 ANTENNA_SEL_INFO_ANT_ID_FB;
432 if (roam_ht_cap->rxAS)
433 hdd_ht_cap->antenna_selection_info |=
434 ANTENNA_SEL_INFO_RX_AS;
435 if (roam_ht_cap->txSoundingPPDUs)
436 hdd_ht_cap->antenna_selection_info |=
437 ANTENNA_SEL_INFO_TX_SOUNDING_PPDU;
438
439 /* mcs data rate */
440 for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i)
441 hdd_ht_cap->mcs.rx_mask[i] =
442 roam_ht_cap->supportedMCSSet[i];
443 hdd_ht_cap->mcs.rx_highest =
444 ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) |
445 ((short) (roam_ht_cap->supportedMCSSet[10]));
446 hdd_ht_cap->mcs.tx_params =
447 roam_ht_cap->supportedMCSSet[12];
448}
449
450
451#define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003
452#define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2
453#define VHT_CAP_RXSTBC_MASK_SHIFT 8
454#define VHT_CAP_BEAMFORMEE_STS_SHIFT 13
455#define VHT_CAP_BEAMFORMEE_STS_MASK \
456 (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT)
457#define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16
458#define VHT_CAP_SOUNDING_DIMENSIONS_MASK \
459 (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT)
460#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23
461#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
462 (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT)
463#define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26
464
465/**
466 * hdd_copy_ht_caps()- copy ht caps info from roam info to
467 * hdd station context.
468 * @hdd_sta_ctx: pointer to hdd station context
469 * @roam_info: pointer to roam info
470 *
471 * Return: None
472 */
473static void hdd_copy_vht_caps(hdd_station_ctx_t *hdd_sta_ctx,
474 tCsrRoamInfo *roam_info)
475{
476 tDot11fIEVHTCaps *roam_vht_cap = &roam_info->vht_caps;
477 struct ieee80211_vht_cap *hdd_vht_cap =
478 &hdd_sta_ctx->conn_info.vht_caps;
479 uint32_t temp_vht_cap;
480
481 vos_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap));
482
483 temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK;
484 hdd_vht_cap->vht_cap_info |= temp_vht_cap;
485 temp_vht_cap = roam_vht_cap->supportedChannelWidthSet &
486 (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >>
487 VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT);
488 if (temp_vht_cap)
489 if (roam_vht_cap->supportedChannelWidthSet &
490 (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >>
491 VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT))
492 hdd_vht_cap->vht_cap_info |=
493 temp_vht_cap <<
494 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
495 if (roam_vht_cap->supportedChannelWidthSet &
496 (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >>
497 VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT))
498 hdd_vht_cap->vht_cap_info |=
499 temp_vht_cap <<
500 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
501 if (roam_vht_cap->ldpcCodingCap)
502 hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC;
503 if (roam_vht_cap->shortGI80MHz)
504 hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80;
505 if (roam_vht_cap->shortGI160and80plus80MHz)
506 hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160;
507 if (roam_vht_cap->txSTBC)
508 hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC;
509 temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >>
510 VHT_CAP_RXSTBC_MASK_SHIFT);
511 if (temp_vht_cap)
512 hdd_vht_cap->vht_cap_info |=
513 temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT;
514 if (roam_vht_cap->suBeamFormerCap)
515 hdd_vht_cap->vht_cap_info |=
516 IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE;
517 if (roam_vht_cap->suBeamformeeCap)
518 hdd_vht_cap->vht_cap_info |=
519 IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE;
520 temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup &
521 (VHT_CAP_BEAMFORMEE_STS_MASK);
522 if (temp_vht_cap)
523 hdd_vht_cap->vht_cap_info |=
524 temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT;
525 temp_vht_cap = roam_vht_cap->numSoundingDim &
526 (VHT_CAP_SOUNDING_DIMENSIONS_MASK);
527 if (temp_vht_cap)
528 hdd_vht_cap->vht_cap_info |=
529 temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT;
530 if (roam_vht_cap->muBeamformerCap)
531 hdd_vht_cap->vht_cap_info |=
532 IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE;
533 if (roam_vht_cap->muBeamformeeCap)
534 hdd_vht_cap->vht_cap_info |=
535 IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
536 if (roam_vht_cap->vhtTXOPPS)
537 hdd_vht_cap->vht_cap_info |=
538 IEEE80211_VHT_CAP_VHT_TXOP_PS;
539 if (roam_vht_cap->htcVHTCap)
540 hdd_vht_cap->vht_cap_info |=
541 IEEE80211_VHT_CAP_HTC_VHT;
542 temp_vht_cap = roam_vht_cap->maxAMPDULenExp &
543 (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK);
544 if (temp_vht_cap)
545 hdd_vht_cap->vht_cap_info |=
546 temp_vht_cap <<
547 VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT;
548 temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap &
549 (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >>
550 VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT);
551 if (temp_vht_cap)
552 hdd_vht_cap->vht_cap_info |= temp_vht_cap <<
553 VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT;
554 if (roam_vht_cap->rxAntPattern)
555 hdd_vht_cap->vht_cap_info |=
556 IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN;
557 if (roam_vht_cap->txAntPattern)
558 hdd_vht_cap->vht_cap_info |=
559 IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;
560 hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap;
561 hdd_vht_cap->supp_mcs.rx_highest =
562 ((uint16_t)roam_vht_cap->rxHighSupDataRate);
563 hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap;
564 hdd_vht_cap->supp_mcs.tx_highest =
565 ((uint16_t)roam_vht_cap->txSupDataRate);
566}
567
568/* ht param */
569#define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10
570#define HT_PARAM_SERVICE_INT_GRAN 0xe0
571#define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5
572
573/* operatinon mode */
574#define HT_OP_MODE_TX_BURST_LIMIT 0x0008
575
576/* stbc_param */
577#define HT_STBC_PARAM_MCS 0x007f
578
579/**
580 * hdd_copy_ht_operation()- copy HT operation element from roam info to
581 * hdd station context.
582 * @hdd_sta_ctx: pointer to hdd station context
583 * @roam_info: pointer to roam info
584 *
585 * Return: None
586 */
587static void hdd_copy_ht_operation(hdd_station_ctx_t *hdd_sta_ctx,
588 tCsrRoamInfo *roam_info)
589{
590 tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation;
591 struct ieee80211_ht_operation *hdd_ht_ops =
592 &hdd_sta_ctx->conn_info.ht_operation;
593 uint32_t i, temp_ht_ops;
594
595 vos_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation));
596
597 hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel;
598
599 /* HT_PARAMS */
600 temp_ht_ops = roam_ht_ops->secondaryChannelOffset &
601 IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
602 if (temp_ht_ops)
603 hdd_ht_ops->ht_param |= temp_ht_ops;
604 else
605 hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE;
606 if (roam_ht_ops->recommendedTxWidthSet)
607 hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY;
608 if (roam_ht_ops->rifsMode)
609 hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE;
610 if (roam_ht_ops->controlledAccessOnly)
611 hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY;
612 temp_ht_ops = roam_ht_ops->serviceIntervalGranularity &
613 (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT);
614 if (temp_ht_ops)
615 hdd_ht_ops->ht_param |= temp_ht_ops <<
616 HT_PARAM_SERVICE_INT_GRAN_SHIFT;
617
618 /* operation mode */
619 temp_ht_ops = roam_ht_ops->opMode &
620 IEEE80211_HT_OP_MODE_PROTECTION;
621 switch (temp_ht_ops) {
622 case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER:
623 hdd_ht_ops->operation_mode |=
624 IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER;
625 break;
626 case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ:
627 hdd_ht_ops->operation_mode |=
628 IEEE80211_HT_OP_MODE_PROTECTION_20MHZ;
629 break;
630 case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED:
631 hdd_ht_ops->operation_mode |=
632 IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED;
633 break;
634 case IEEE80211_HT_OP_MODE_PROTECTION_NONE:
635 default:
636 hdd_ht_ops->operation_mode |=
637 IEEE80211_HT_OP_MODE_PROTECTION_NONE;
638 }
639 if (roam_ht_ops->nonGFDevicesPresent)
640 hdd_ht_ops->operation_mode |=
641 IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT;
642 if (roam_ht_ops->transmitBurstLimit)
643 hdd_ht_ops->operation_mode |=
644 HT_OP_MODE_TX_BURST_LIMIT;
645 if (roam_ht_ops->obssNonHTStaPresent)
646 hdd_ht_ops->operation_mode |=
647 IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT;
648
649 /* stbc_param */
650 temp_ht_ops = roam_ht_ops->basicSTBCMCS &
651 HT_STBC_PARAM_MCS;
652 if (temp_ht_ops)
653 hdd_ht_ops->stbc_param |= temp_ht_ops;
654 if (roam_ht_ops->dualCTSProtection)
655 hdd_ht_ops->stbc_param |=
656 IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT;
657 if (roam_ht_ops->secondaryBeacon)
658 hdd_ht_ops->stbc_param |=
659 IEEE80211_HT_STBC_PARAM_STBC_BEACON;
660 if (roam_ht_ops->lsigTXOPProtectionFullSupport)
661 hdd_ht_ops->stbc_param |=
662 IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT;
663 if (roam_ht_ops->pcoActive)
664 hdd_ht_ops->stbc_param |=
665 IEEE80211_HT_STBC_PARAM_PCO_ACTIVE;
666 if (roam_ht_ops->pcoPhase)
667 hdd_ht_ops->stbc_param |=
668 IEEE80211_HT_STBC_PARAM_PCO_PHASE;
669
670 /* basic MCs set */
671 for (i = 0; i < 16; ++i)
672 hdd_ht_ops->basic_set[i] =
673 roam_ht_ops->basicMCSSet[i];
674}
675
676/**
677 * hdd_copy_vht_operation()- copy VHT operations element from roam info to
678 * hdd station context.
679 * @hdd_sta_ctx: pointer to hdd station context
680 * @roam_info: pointer to roam info
681 *
682 * Return: None
683 */
684static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx,
685 tCsrRoamInfo *roam_info)
686{
687 tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation;
688 struct ieee80211_vht_operation *hdd_vht_ops =
689 &hdd_sta_ctx->conn_info.vht_operation;
690
691 vos_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation));
692
693 hdd_vht_ops->chan_width = roam_vht_ops->chanWidth;
694 hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1;
695 hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2;
696 hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet;
697}
698
699
700/**
701 * hdd_save_bss_info() - save connection info in hdd sta ctx
702 * @adapter: Pointer to adapter
703 * @roam_info: pointer to roam info
704 *
705 * Return: None
706 */
707static void hdd_save_bss_info(hdd_adapter_t *adapter,
708 tCsrRoamInfo *roam_info)
709{
710 hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
711
712 hdd_sta_ctx->conn_info.freq = vos_chan_to_freq(
713 hdd_sta_ctx->conn_info.operationChannel);
714 if (roam_info->vht_caps.present) {
715 hdd_sta_ctx->conn_info.conn_flag.vht_present = true;
716 hdd_copy_vht_caps(hdd_sta_ctx, roam_info);
717 } else {
718 hdd_sta_ctx->conn_info.conn_flag.vht_present = false;
719 }
720 if (roam_info->ht_caps.present) {
721 hdd_sta_ctx->conn_info.conn_flag.ht_present = true;
722 hdd_copy_ht_caps(hdd_sta_ctx, roam_info);
723 } else {
724 hdd_sta_ctx->conn_info.conn_flag.ht_present = false;
725 }
726 if (roam_info->reassoc)
727 hdd_sta_ctx->conn_info.roam_count++;
728 if (roam_info->hs20vendor_ie.present) {
729 hdd_sta_ctx->conn_info.conn_flag.hs20_present = true;
730 vos_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie,
731 &roam_info->hs20vendor_ie,
732 sizeof(roam_info->hs20vendor_ie));
733 } else {
734 hdd_sta_ctx->conn_info.conn_flag.hs20_present = false;
735 }
736 if (roam_info->ht_operation.present) {
737 hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true;
738 hdd_copy_ht_operation(hdd_sta_ctx, roam_info);
739 } else {
740 hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false;
741 }
742 if (roam_info->vht_operation.present) {
743 hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true;
744 hdd_copy_vht_operation(hdd_sta_ctx, roam_info);
745 } else {
746 hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false;
747 }
748}
749
Jeff Johnson295189b2012-06-20 16:38:30 -0700750void hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType )
751{
752 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
753 eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700754
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 VOS_ASSERT( pRoamInfo );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700756
757 if ( pRoamInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700759 // Save the BSSID for the connection...
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 if ( eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType )
761 {
762 VOS_ASSERT( pRoamInfo->pBssDesc );
763 vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,6 );
764
765 // Save the Station ID for this station from the 'Roam Info'.
766 //For IBSS mode, staId is assigned in NEW_PEER_IND
767 //For reassoc, the staID doesn't change and it may be invalid in this structure
768 //so no change here.
769 if( !pRoamInfo->fReassocReq )
770 {
771 pHddStaCtx->conn_info.staId [0]= pRoamInfo->staId;
772 }
773 }
774 else if ( eCSR_BSS_TYPE_IBSS == eBssType )
Shailender Karmuchia734f332013-04-19 14:02:48 -0700775 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,sizeof(pRoamInfo->bssid) );
Shailender Karmuchia734f332013-04-19 14:02:48 -0700777 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 else
779 {
780 // can't happen. We need a valid IBSS or Infra setting in the BSSDescription
781 // or we can't function.
782 VOS_ASSERT( 0 );
783 }
784
785 // notify WMM
786 hdd_wmm_connect(pAdapter, pRoamInfo, eBssType);
787
788 if( !pRoamInfo->u.pConnectedProfile )
789 {
790 VOS_ASSERT( pRoamInfo->u.pConnectedProfile );
791 }
792 else
793 {
794 // Get Multicast Encryption Type
795 encryptType = pRoamInfo->u.pConnectedProfile->mcEncryptionType;
796 pHddStaCtx->conn_info.mcEncryptionType = encryptType;
797 // Get Unicast Encrytion Type
798 encryptType = pRoamInfo->u.pConnectedProfile->EncryptionType;
799 pHddStaCtx->conn_info.ucEncryptionType = encryptType;
800
801 pHddStaCtx->conn_info.authType = pRoamInfo->u.pConnectedProfile->AuthType;
802
803 pHddStaCtx->conn_info.operationChannel = pRoamInfo->u.pConnectedProfile->operationChannel;
804
805 // Save the ssid for the connection
806 vos_mem_copy( &pHddStaCtx->conn_info.SSID.SSID, &pRoamInfo->u.pConnectedProfile->SSID, sizeof( tSirMacSSid ) );
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +0530807
808 // Save dot11mode in which STA associated to AP
809 pHddStaCtx->conn_info.dot11Mode = pRoamInfo->u.pConnectedProfile->dot11Mode;
Deepthi Gowriae6a1662015-10-12 12:59:37 +0530810
811 pHddStaCtx->conn_info.rate_flags = pRoamInfo->maxRateFlags;
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 }
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +0530813 hdd_save_bss_info(pAdapter, pRoamInfo);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700814 }
815
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 // save the connected BssType
Shailender Karmuchia734f332013-04-19 14:02:48 -0700817 hdd_connSaveConnectedBssType( pHddStaCtx, eBssType );
818
Jeff Johnson295189b2012-06-20 16:38:30 -0700819}
820
821#if defined(WLAN_FEATURE_VOWIFI_11R)
822/*
823 * Send the 11R key information to the supplicant.
824 * Only then can the supplicant generate the PMK-R1.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800825 * (BTW, the ESE supplicant also needs the Assoc Resp IEs
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 * for the same purpose.)
827 *
828 * Mainly the Assoc Rsp IEs are passed here. For the IMDA
829 * this contains the R1KHID, R0KHID and the MDID.
830 * For FT, this consists of the Reassoc Rsp FTIEs.
831 * This is the Assoc Response.
832 */
Shailender Karmuchia734f332013-04-19 14:02:48 -0700833static void hdd_SendFTAssocResponse(struct net_device *dev, hdd_adapter_t *pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 tCsrRoamInfo *pCsrRoamInfo)
835{
836 union iwreq_data wrqu;
837 char *buff;
838 unsigned int len = 0;
839 u8 *pFTAssocRsp = NULL;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700840
841 if (pCsrRoamInfo->nAssocRspLength == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 {
843 hddLog(LOGE,
844 "%s: pCsrRoamInfo->nAssocRspLength=%d",
845 __func__, (int)pCsrRoamInfo->nAssocRspLength);
846 return;
847 }
848
Shailender Karmuchia734f332013-04-19 14:02:48 -0700849 pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength +
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 pCsrRoamInfo->nAssocReqLength);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700851 if (pFTAssocRsp == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700853 hddLog(LOGE, "%s: AssocReq or AssocRsp is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 return;
855 }
856
857 // pFTAssocRsp needs to point to the IEs
858 pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET;
859 hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__,
860 (unsigned int)pFTAssocRsp[0],
861 (unsigned int)pFTAssocRsp[1]);
862
863 // We need to send the IEs to the supplicant.
864 buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700865 if (buff == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 {
Shailender Karmuchia734f332013-04-19 14:02:48 -0700867 hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 return;
869 }
870
871 // Send the Assoc Resp, the supplicant needs this for initial Auth.
872 len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
Shailender Karmuchia734f332013-04-19 14:02:48 -0700873 wrqu.data.length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 memset(buff, 0, IW_GENERIC_IE_MAX);
Shailender Karmuchia734f332013-04-19 14:02:48 -0700875 memcpy(buff, pFTAssocRsp, len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700876 wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff);
877
878 kfree(buff);
879}
Shailender Karmuchia734f332013-04-19 14:02:48 -0700880#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -0700881
882#ifdef WLAN_FEATURE_VOWIFI_11R
883
884/*---------------------------------------------------
885 *
886 * Send the FTIEs, RIC IEs during FT. This is eventually
887 * used to send the FT events to the supplicant
888 *
889 * At the reception of Auth2 we send the RIC followed
890 * by the auth response IEs to the supplicant.
891 * Once both are received in the supplicant, an FT
892 * event is generated to the supplicant.
893 *
894 *---------------------------------------------------
895 */
896void hdd_SendFTEvent(hdd_adapter_t *pAdapter)
897{
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 tANI_U16 auth_resp_len = 0;
899 tANI_U32 ric_ies_length = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
901
Gopichand Nakkala66923aa2013-03-06 23:17:24 +0530902#if defined(KERNEL_SUPPORT_11R_CFG80211)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700903 struct cfg80211_ft_event_params ftEvent;
904 v_U8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN];
905 v_U8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN];
906 struct net_device *dev = pAdapter->dev;
907#else
908 char *buff;
909 union iwreq_data wrqu;
910 tANI_U16 str_len;
911#endif
912
Gopichand Nakkala66923aa2013-03-06 23:17:24 +0530913#if defined(KERNEL_SUPPORT_11R_CFG80211)
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530914 vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN);
915 vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700916
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +0530917 sme_GetRICIEs(pHddCtx->hHal, (u8 *)ricIe,
918 DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length );
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530919 if (ric_ies_length == 0)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700920 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530921 hddLog(LOGW,
922 "%s: RIC IEs is of length 0 not sending RIC Information for now",
923 __func__);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700924 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700925
926 ftEvent.ric_ies = ricIe;
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530927 ftEvent.ric_ies_len = ric_ies_length;
928 hddLog(LOG1, "%s: RIC IEs is of length %d", __func__, (int)ric_ies_length);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700929
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530930 sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe,
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -0800931 DOT11F_IE_FTINFO_MAX_LEN, &auth_resp_len);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700932
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530933 if (auth_resp_len == 0)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700934 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530935 hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700936 return;
937 }
938
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530939 sme_SetFTPreAuthState(pHddCtx->hHal, TRUE);
Gopichand Nakkala356fb102013-03-06 12:34:04 +0530940
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530941 ftEvent.target_ap = ftIe;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700942
943 ftEvent.ies = (u8 *)(ftIe + SIR_MAC_ADDR_LENGTH);
944 ftEvent.ies_len = auth_resp_len - SIR_MAC_ADDR_LENGTH;
945
Jeff Johnson59a121e2013-11-30 09:46:08 -0800946 hddLog(LOG1, "%s ftEvent.ies_len %zu", __FUNCTION__, ftEvent.ies_len);
947 hddLog(LOG1, "%s ftEvent.ric_ies_len %zu",
948 __FUNCTION__, ftEvent.ric_ies_len );
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530949 hddLog(LOG1, "%s ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x ",
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -0800950 __FUNCTION__, ftEvent.target_ap[0], ftEvent.target_ap[1],
951 ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4],
952 ftEvent.target_ap[5]);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700953
Gopichand Nakkala356fb102013-03-06 12:34:04 +0530954 (void)cfg80211_ft_event(dev, &ftEvent);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700955
956#else
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530957 // We need to send the IEs to the supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -0700958 buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530959 if (buff == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700960 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530961 hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700962 return;
963 }
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530964 vos_mem_zero(buff, IW_CUSTOM_MAX);
Jeff Johnson295189b2012-06-20 16:38:30 -0700965
Shailender Karmuchia734f332013-04-19 14:02:48 -0700966 // Sme needs to send the RIC IEs first
Jeff Johnson295189b2012-06-20 16:38:30 -0700967 str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX);
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530968 sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]),
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -0800969 (IW_CUSTOM_MAX - str_len), &ric_ies_length );
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530970 if (ric_ies_length == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700971 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530972 hddLog(LOGW,
973 "%s: RIC IEs is of length 0 not sending RIC Information for now",
974 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 }
976 else
977 {
978 wrqu.data.length = str_len + ric_ies_length;
979 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff);
980 }
981
982 // Sme needs to provide the Auth Resp
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530983 vos_mem_zero(buff, IW_CUSTOM_MAX);
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX);
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530985 sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len],
986 (IW_CUSTOM_MAX - str_len), &auth_resp_len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700987
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530988 if (auth_resp_len == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 {
Gopichand Nakkalad7d13652013-02-15 01:48:00 +0530990 hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__);
Bhargav Shah8b5b2f72015-07-14 11:53:46 +0530991 kfree(buff);
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 return;
993 }
994
995 wrqu.data.length = str_len + auth_resp_len;
996 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff);
997
998 kfree(buff);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700999#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001000}
1001
1002#endif /* WLAN_FEATURE_VOWIFI_11R */
1003
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001004#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001005
1006/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001007 * Send the ESE required "new AP Channel info" to the supplicant.
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 * (This keeps the supplicant "up to date" on the current channel.)
1009 *
1010 * The current (new AP) channel information is passed in.
1011 */
Shailender Karmuchia734f332013-04-19 14:02:48 -07001012static void hdd_SendNewAPChannelInfo(struct net_device *dev, hdd_adapter_t *pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -07001013 tCsrRoamInfo *pCsrRoamInfo)
1014{
1015 union iwreq_data wrqu;
1016 tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc;
Jeff Johnson295189b2012-06-20 16:38:30 -07001017
Shailender Karmuchia734f332013-04-19 14:02:48 -07001018
1019 if (descriptor == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001020 {
1021 hddLog(LOGE,
Jeff Johnsonc135a9a2017-09-19 08:37:24 -07001022 "%s: pCsrRoamInfo->pBssDesc=%pK",
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 __func__, descriptor);
1024 return;
1025 }
1026
1027 // Send the Channel event, the supplicant needs this to generate the Adjacent AP report.
Arif Hussain6d2a3322013-11-17 19:50:10 -08001028 hddLog(LOGW, "%s: Sending up an SIOCGIWFREQ, channelId=%d", __func__, descriptor->channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 memset(&wrqu, '\0', sizeof(wrqu));
1030 wrqu.freq.m = descriptor->channelId;
1031 wrqu.freq.e = 0;
1032 wrqu.freq.i = 0;
1033 wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL);
1034}
1035
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001036#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -07001037
1038void hdd_SendUpdateBeaconIEsEvent(hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo)
1039{
1040 union iwreq_data wrqu;
1041 u8 *pBeaconIes;
1042 u8 currentLen = 0;
1043 char *buff;
1044 int totalIeLen = 0, currentOffset = 0, strLen;
1045
1046 memset(&wrqu, '\0', sizeof(wrqu));
1047
1048 if (0 == pCsrRoamInfo->nBeaconLength)
1049 {
1050 hddLog(LOGE, "%s: pCsrRoamInfo->nBeaconFrameLength = 0", __func__);
1051 return;
1052 }
1053 pBeaconIes = (u8 *)(pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET);
Shailender Karmuchia734f332013-04-19 14:02:48 -07001054 if (pBeaconIes == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001056 hddLog(LOGE, "%s: Beacon IEs is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001057 return;
1058 }
1059
1060 // pBeaconIes needs to point to the IEs
1061 hddLog(LOG1, "%s: Beacon IEs is now at %02x%02x", __func__,
1062 (unsigned int)pBeaconIes[0],
1063 (unsigned int)pBeaconIes[1]);
1064 hddLog(LOG1, "%s: Beacon IEs length = %d", __func__, pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET);
Shailender Karmuchia734f332013-04-19 14:02:48 -07001065
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 // We need to send the IEs to the supplicant.
1067 buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
Shailender Karmuchia734f332013-04-19 14:02:48 -07001068 if (buff == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001070 hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 return;
1072 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07001073 vos_mem_zero(buff, IW_CUSTOM_MAX);
Jeff Johnson295189b2012-06-20 16:38:30 -07001074
1075 strLen = strlcpy(buff,"BEACONIEs=", IW_CUSTOM_MAX);
1076 currentLen = strLen + 1;
1077
1078 totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET;
1079 do
1080 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001081 /* If the beacon size exceeds max CUSTOM event size, break it into chunks of CUSTOM event
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 * max size and send it to supplicant. Changes are done in supplicant to handle this */
1083 vos_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1));
1084 currentLen = VOS_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1);
1085 vos_mem_copy(&buff[strLen + 1], pBeaconIes+currentOffset, currentLen);
1086 currentOffset += currentLen;
1087 totalIeLen -= currentLen;
1088 wrqu.data.length = strLen + 1 + currentLen;
1089 if (totalIeLen)
Shailender Karmuchia734f332013-04-19 14:02:48 -07001090 buff[strLen] = 1; // This tells supplicant more chunks are pending
Jeff Johnson295189b2012-06-20 16:38:30 -07001091 else
1092 buff[strLen] = 0; // For last chunk of beacon IE to supplicant
1093
1094 hddLog(LOG1, "%s: Beacon IEs length to supplicant = %d", __func__, currentLen);
1095 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff);
1096 } while (totalIeLen > 0);
1097
1098 kfree(buff);
1099}
1100
1101static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRoamInfo)
1102{
1103 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1104 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
1105 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1106 union iwreq_data wrqu;
1107 int we_event;
1108 char *msg;
1109 int type = -1;
1110
Shailender Karmuchia734f332013-04-19 14:02:48 -07001111#if defined (WLAN_FEATURE_VOWIFI_11R)
1112 // Added to find the auth type on the fly at run time
1113 // rather than with cfg to see if FT is enabled
1114 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile);
1116#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07001117
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 memset(&wrqu, '\0', sizeof(wrqu));
Shailender Karmuchia734f332013-04-19 14:02:48 -07001119 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
Jeff Johnson295189b2012-06-20 16:38:30 -07001120 we_event = SIOCGIWAP;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001121
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */
1123 {
Agarwal Ashish51325b52014-06-16 16:50:49 +05301124 /* In case of roaming ; We are not doing disconnect.
1125 * If disconnect is not being done for roam; We will not
1126 * decrease count for Active sessions. We should not increase active
1127 * active session in case of roaming.
1128 */
Padma, Santhosh Kumar87ba40f2014-11-26 19:40:15 +05301129 if((pHddStaCtx->ft_carrier_on == FALSE) && !pCsrRoamInfo->fReassocReq)
Agarwal Ashish51325b52014-06-16 16:50:49 +05301130 {
1131 wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode);
1132 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, sizeof(pCsrRoamInfo->pBssDesc->bssId));
1134 type = WLAN_STA_ASSOC_DONE_IND;
1135
Madan Mohan Koyyalamudi26bd7142012-10-30 18:14:19 -07001136#ifdef WLAN_FEATURE_P2P_DEBUG
1137 if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
1138 {
1139 if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_1)
1140 {
1141 globalP2PConnectionStatus = P2P_CLIENT_CONNECTED_STATE_1;
1142 hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from "
1143 "Connecting state to Connected State for 8-way "
1144 "Handshake");
1145 }
1146 else if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_2)
1147 {
1148 globalP2PConnectionStatus = P2P_CLIENT_COMPLETED_STATE;
1149 hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from "
1150 "Connecting state to P2P Client Connection Completed");
1151 }
1152 }
1153#endif
SaidiReddy Yenugaa8b32f92016-07-27 19:29:18 +05301154 hddLog(VOS_TRACE_LEVEL_INFO, MAC_ADDRESS_STR " connected to "
Sushant Kaushikdc3184b2015-10-09 12:00:21 +05301155 MAC_ADDRESS_STR,
Arif Hussain77d044f2014-01-03 19:56:04 -08001156 MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes),
Kiet Lam34947452014-01-21 23:23:40 -08001157 MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data));
Jeff Johnson295189b2012-06-20 16:38:30 -07001158 hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo);
1159
Bhargav Shahd0715912015-10-01 18:17:37 +05301160 hdd_manage_delack_timer(pHddCtx);
1161
Jeff Johnson295189b2012-06-20 16:38:30 -07001162 /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or
1163 * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled
1164 * and fFTEnable is TRUE */
1165#ifdef WLAN_FEATURE_VOWIFI_11R
1166 // Send FT Keys to the supplicant when FT is enabled
1167 if ((pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN_PSK) ||
Shailender Karmuchia734f332013-04-19 14:02:48 -07001168 (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001169#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001170 || (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) ||
1171 (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA)
1172#endif
1173 )
1174 {
1175 hdd_SendFTAssocResponse(dev, pAdapter, pCsrRoamInfo);
1176 }
1177#endif
1178 }
1179 else if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) // IBss Associated
1180 {
Agarwal Ashish51325b52014-06-16 16:50:49 +05301181 wlan_hdd_incr_active_session(pHddCtx, pAdapter->device_mode);
Jeff Johnson4416a782013-03-25 14:17:50 -07001182 memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, ETH_ALEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 type = WLAN_STA_ASSOC_DONE_IND;
Deepthi Gowric7591cc2015-12-28 15:43:17 +05301184
1185 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1186 "wlan: new IBSS connection to " MAC_ADDRESS_STR,
1187 MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 }
1189 else /* Not Associated */
1190 {
Deepthi Gowric7591cc2015-12-28 15:43:17 +05301191 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1192 "wlan: disconnected");
Jeff Johnson295189b2012-06-20 16:38:30 -07001193 type = WLAN_STA_DISASSOC_DONE_IND;
1194 memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN);
Bhargav Shahd0715912015-10-01 18:17:37 +05301195
1196 hdd_manage_delack_timer(pHddCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 }
Sudhir Sattayappa Kohalli90e4c752013-03-21 14:25:04 -07001198 hdd_dump_concurrency_info(pHddCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -07001199
1200 msg = NULL;
1201 /*During the WLAN uninitialization,supplicant is stopped before the
1202 driver so not sending the status of the connection to supplicant*/
Mihir Shete18156292014-03-11 15:38:30 +05301203 if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001204 {
1205 wireless_send_event(dev, we_event, &wrqu, msg);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001206#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */
Shailender Karmuchia734f332013-04-19 14:02:48 -07001208 {
1209 if ( (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) ||
1210 (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 hdd_SendNewAPChannelInfo(dev, pAdapter, pCsrRoamInfo);
1212 }
1213#endif
1214 }
1215 send_btc_nlink_msg(type, 0);
1216}
1217
1218void hdd_connRemoveConnectInfo( hdd_station_ctx_t *pHddStaCtx )
1219{
1220 // Remove staId, bssId and peerMacAddress
1221 pHddStaCtx->conn_info.staId [ 0 ] = 0;
1222 vos_mem_zero( &pHddStaCtx->conn_info.bssId, sizeof( v_MACADDR_t ) );
1223 vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], sizeof( v_MACADDR_t ) );
1224
1225 // Clear all security settings
1226 pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
1227 pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
1228 pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
1229
1230 vos_mem_zero( &pHddStaCtx->conn_info.Keys, sizeof( tCsrKeys ) );
Ravi Joshib58ca0d2013-10-29 09:50:23 -07001231 vos_mem_zero( &pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001232
1233 // Set not-connected state
1234 pHddStaCtx->conn_info.connDot11DesiredBssType = eCSR_BSS_TYPE_ANY;
Jeff Johnson295189b2012-06-20 16:38:30 -07001235
1236 vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) );
1237}
Katya Nigam47528772015-02-11 12:24:49 +05301238
1239VOS_STATUS hdd_ibss_deinit_tx_rx_sta ( hdd_adapter_t *pAdapter, v_U8_t STAId )
1240{
Katya Nigam1fd24402015-02-16 14:52:19 +05301241 v_U8_t ac;
1242 /**Track whether OS TX queue has been disabled.*/
1243 v_BOOL_t txSuspended[NUM_TX_QUEUES];
1244 v_U8_t tlAC;
Katya Nigam47528772015-02-11 12:24:49 +05301245 v_U8_t i;
1246 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1247 hdd_ibss_peer_info_t *pPeerInfo;
1248
1249 if( NULL == pHddStaCtx )
1250 {
1251 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1252 "%s: HDD station context NULL ",__func__);
1253 return VOS_STATUS_E_FAILURE;
1254 }
Katya Nigam1fd24402015-02-16 14:52:19 +05301255
Katya Nigam47528772015-02-11 12:24:49 +05301256 pPeerInfo = &pHddStaCtx->ibss_peer_info;
1257 if (FALSE == pPeerInfo->ibssStaInfo[STAId].isUsed)
1258 {
1259 VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
1260 "%s: Deinit station not inited %d", __func__, STAId );
1261 return VOS_STATUS_E_FAILURE;
1262 }
1263
1264 hdd_flush_ibss_tx_queues(pAdapter, STAId);
Katya Nigam1fd24402015-02-16 14:52:19 +05301265
1266 for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++)
1267 {
1268 tlAC = hdd_QdiscAcToTlAC[ac];
1269 txSuspended[ac] = pPeerInfo->ibssStaInfo[STAId].txSuspended[tlAC];
1270 }
1271
Katya Nigam47528772015-02-11 12:24:49 +05301272 vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t));
1273
Katya Nigam1fd24402015-02-16 14:52:19 +05301274 /* re-init hdd list, since netdev can still open adapter until
1275 * driver gets unloaded
1276 */
1277 for (i = 0; i < NUM_TX_QUEUES; i ++)
1278 {
1279 hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i],
1280 HDD_TX_QUEUE_MAX_LEN);
1281 }
1282
1283 for (ac = HDD_LINUX_AC_VO; ac <= HDD_LINUX_AC_BK; ac++)
1284 {
1285 if (txSuspended[ac])
1286 {
1287 VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
1288 "%s: TX queue re-enabled", __func__);
1289 netif_wake_subqueue(pAdapter->dev, ac);
1290 }
1291 }
Katya Nigam47528772015-02-11 12:24:49 +05301292 return VOS_STATUS_SUCCESS;
1293}
1294
1295static VOS_STATUS hdd_ibss_DeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
1296{
1297 VOS_STATUS vosStatus;
1298
1299 vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
1300 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
1301 {
1302 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1303 "%s: WLANTL_ClearSTAClient() failed to for staID %d. "
1304 "Status= %d [0x%08X]",
1305 __func__, staId, vosStatus, vosStatus );
1306 }
1307
1308 vosStatus = hdd_ibss_deinit_tx_rx_sta ( pAdapter, staId );
1309 if( VOS_STATUS_E_FAILURE == vosStatus )
1310 {
1311 VOS_TRACE ( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
1312 "hdd_ibss_deinit_tx_rx_sta() failed for staID %d. "
1313 "Status = %d [0x%08X]",
1314 staId, vosStatus, vosStatus );
1315 }
1316
1317 return( vosStatus );
1318}
1319
1320VOS_STATUS hdd_ibss_init_tx_rx_sta( hdd_adapter_t *pAdapter, v_U8_t STAId, v_MACADDR_t *pmacAddrSTA)
1321{
1322 v_U8_t i = 0;
1323 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1324 hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info;
1325
1326 if (pPeerInfo->ibssStaInfo[STAId].isUsed)
1327 {
1328 VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
1329 "%s: Reinit station %d", __func__, STAId );
1330 return VOS_STATUS_E_FAILURE;
1331 }
1332
1333 vos_mem_zero(&pPeerInfo->ibssStaInfo[STAId], sizeof(hdd_ibss_station_info_t));
1334 for (i = 0; i < NUM_TX_QUEUES; i ++)
1335 {
1336 hdd_list_init(&pPeerInfo->ibssStaInfo[STAId].wmm_tx_queue[i], HDD_TX_QUEUE_MAX_LEN);
1337 }
1338
1339 pPeerInfo->ibssStaInfo[STAId].isUsed = VOS_TRUE;
1340 pPeerInfo->ibssStaInfo[STAId].isDeauthInProgress = VOS_FALSE;
1341 vos_copy_macaddr( &pPeerInfo->ibssStaInfo[STAId].macAddrSTA, pmacAddrSTA);
1342
1343 return VOS_STATUS_SUCCESS;
1344}
1345
1346static VOS_STATUS hdd_ibss_RegisterSTA( hdd_adapter_t *pAdapter,
1347 tCsrRoamInfo *pRoamInfo,
1348 v_U8_t staId,
1349 v_MACADDR_t *pPeerMacAddress,
1350 tSirBssDescription *pBssDesc )
1351{
1352 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1353 WLAN_STADescType staDesc = {0};
1354 eCsrEncryptionType connectedCipherAlgo;
1355 v_BOOL_t fConnected;
1356 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1357 hdd_ibss_peer_info_t * pPeerInfo = &pHddStaCtx->ibss_peer_info;
1358 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
1359
1360 if ( pPeerInfo->ibssStaInfo[staId].isUsed )
1361 {
1362 VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
1363 "clean up old entry for STA %d", staId);
1364 hdd_ibss_DeregisterSTA( pAdapter, staId );
1365 }
1366
1367 staDesc.ucSTAId = staId;
1368 staDesc.wSTAType = WLAN_STA_IBSS;
1369
1370 // Note that for IBSS, the STA MAC address and BSSID are goign to be different where
1371 // in infrastructure, they are the same (BSSID is the MAC address of the AP). So,
1372 // for IBSS we have a second field to pass to TL in the STA descriptor that we don't
1373 // pass when making an Infrastructure connection.
1374 vos_mem_copy(staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes));
1375 vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId, 6 );
1376 vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent );
1377
1378 if (hdd_wmm_is_active(pAdapter))
1379 {
1380 staDesc.ucQosEnabled = 1;
1381 }
1382 else
1383 {
1384 staDesc.ucQosEnabled = 0;
1385 }
1386 VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO,
1387 "HDD SOFTAP register TL QoS_enabled=%d",
1388 staDesc.ucQosEnabled );
1389
1390 fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
1391 if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE )
1392 {
1393 staDesc.ucProtectedFrame = 1;
1394 }
1395 else
1396 {
1397 staDesc.ucProtectedFrame = 0;
1398
1399 }
1400
1401 hdd_ibss_init_tx_rx_sta(pAdapter, staId, &staDesc.vSTAMACAddress);
1402
1403 // UMA is Not ready yet, Xlation will be done by TL
1404 staDesc.ucSwFrameTXXlation = 1;
1405 staDesc.ucSwFrameRXXlation = 1;
1406 staDesc.ucAddRmvLLC = 1;
1407 // Initialize signatures and state
1408 staDesc.ucUcastSig = pRoamInfo->ucastSig;
1409 staDesc.ucBcastSig = pRoamInfo->bcastSig;
1410 staDesc.ucInitState = WLANTL_STA_AUTHENTICATED;
1411
1412 staDesc.ucIsReplayCheckValid = VOS_FALSE;
1413
1414 // Register the Station with TL.
1415 vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext,
1416 hdd_rx_packet_cbk,
1417 hdd_tx_complete_cbk,
1418 hdd_ibss_tx_fetch_packet_cbk, &staDesc,
1419 pBssDesc->rssi );
1420 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
1421 {
1422 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1423 "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]",
1424 vosStatus, vosStatus );
1425 return vosStatus;
1426 }
1427
1428 //Timer value should be in milliseconds
1429 if ( pHddCtx->cfg_ini->dynSplitscan &&
1430 ( VOS_TIMER_STATE_RUNNING !=
1431 vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)))
1432 {
1433 vos_timer_start(&pHddCtx->tx_rx_trafficTmr,
1434 pHddCtx->cfg_ini->trafficMntrTmrForSplitScan);
1435 }
1436
1437 pPeerInfo->ibssStaInfo[staId].ucSTAId = staId;
1438 pPeerInfo->ibssStaInfo[staId].isQosEnabled = staDesc.ucQosEnabled;
1439
1440 vosStatus = WLANTL_ChangeSTAState( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staDesc.ucSTAId,
1441 WLANTL_STA_AUTHENTICATED );
1442
1443 pPeerInfo->ibssStaInfo[staId].tlSTAState = WLANTL_STA_AUTHENTICATED;
1444 pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
1445
1446 return( vosStatus );
1447}
1448
Jeff Johnson295189b2012-06-20 16:38:30 -07001449/* TODO Revist this function. and data path */
1450static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
1451{
1452 VOS_STATUS vosStatus;
Ravi Joshif9520d62013-10-18 04:11:46 -07001453
Katya Nigam47528772015-02-11 12:24:49 +05301454 hdd_disconnect_tx_rx(pAdapter);
Ravi Joshif9520d62013-10-18 04:11:46 -07001455
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
1457 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
1458 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05301459 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 "%s: WLANTL_ClearSTAClient() failed to for staID %d. "
Jeff Johnson0299d0a2013-10-30 12:37:43 -07001461 "Status= %d [0x%08X]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001462 __func__, staId, vosStatus, vosStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 }
1464 return( vosStatus );
1465}
1466
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +05301467/**
1468 * hdd_print_bss_info() - print bss info
1469 * @hdd_sta_ctx: pointer to hdd station context
1470 *
1471 * Return: None
1472 */
1473void hdd_print_bss_info(hdd_station_ctx_t *hdd_sta_ctx)
1474{
1475 uint32_t *cap_info;
1476
1477 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"WIFI DATA LOGGER");
1478 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"channel: %d",
1479 hdd_sta_ctx->conn_info.freq);
1480 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"dot11mode: %d",
1481 hdd_sta_ctx->conn_info.dot11Mode);
1482 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"AKM: %d",
1483 hdd_sta_ctx->conn_info.authType);
1484 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ssid: %.*s",
1485 hdd_sta_ctx->conn_info.SSID.SSID.length,
1486 hdd_sta_ctx->conn_info.SSID.SSID.ssId);
1487 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"roam count: %d",
1488 hdd_sta_ctx->conn_info.roam_count);
1489 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ant_info: %d",
1490 hdd_sta_ctx->conn_info.txrate.nss);
1491 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate legacy %d",
1492 hdd_sta_ctx->conn_info.txrate.legacy);
1493 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"datarate mcs: %d",
1494 hdd_sta_ctx->conn_info.txrate.mcs);
1495 if (hdd_sta_ctx->conn_info.conn_flag.ht_present) {
1496 cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps;
1497 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"ht caps: %x",
1498 *cap_info);
1499 }
1500 if (hdd_sta_ctx->conn_info.conn_flag.vht_present) {
1501 cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps;
1502 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"vht caps: %x",
1503 *cap_info);
1504 }
1505 if (hdd_sta_ctx->conn_info.conn_flag.hs20_present)
1506 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"hs20 info: %x",
1507 hdd_sta_ctx->conn_info.hs20vendor_ie.release_num);
1508 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"signal: %d",
1509 hdd_sta_ctx->conn_info.signal);
1510 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"noise: %d",
1511 hdd_sta_ctx->conn_info.noise);
1512}
1513
Jeff Johnson295189b2012-06-20 16:38:30 -07001514
1515static eHalStatus hdd_DisConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
1516 tANI_U32 roamId, eRoamCmdStatus roamStatus,
1517 eCsrRoamResult roamResult )
1518{
1519 eHalStatus status = eHAL_STATUS_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07001520 VOS_STATUS vstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 struct net_device *dev = pAdapter->dev;
1522 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
1523 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
krunal soni3fc26642013-10-08 22:41:42 -07001524 v_U8_t sta_id;
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301525 v_BOOL_t sendDisconInd = TRUE;
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001526
1527 // Sanity check
1528 if(dev == NULL)
1529 {
Agarwal Ashish971c2882013-10-30 20:11:12 +05301530 hddLog(VOS_TRACE_LEVEL_ERROR,
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001531 "%s: net_dev is released return", __func__);
1532 return eHAL_STATUS_FAILURE;
1533 }
1534
Jeff Johnson295189b2012-06-20 16:38:30 -07001535 // notify apps that we can't pass traffic anymore
Padma, Santhosh Kumar9dacb5c2014-12-17 19:22:56 +05301536 hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 netif_tx_disable(dev);
1538 netif_carrier_off(dev);
Mukul Sharma09ab4bd2014-11-24 18:07:26 +05301539 //TxTimeoutCount need to reset in case of disconnect handler
1540 pAdapter->hdd_stats.hddTxRxStats.continuousTxTimeoutCount = 0;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001541
Jeff Johnsone7245742012-09-05 17:12:55 -07001542 INIT_COMPLETION(pAdapter->disconnect_comp_var);
Agarwal Ashishc65b5ca2014-07-28 21:02:57 +05301543 /* If only STA mode is on */
1544 if((pHddCtx->concurrency_mode <= 1) &&
1545 (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <= 1))
1546 {
1547 pHddCtx->isAmpAllowed = VOS_TRUE;
1548 }
1549
Agarwal Ashish47d18112014-08-04 19:55:07 +05301550 /* Need to apply spin lock before decreasing active sessions
1551 * as there can be chance for double decrement if context switch
1552 * Calls wlan_hdd_disconnect.
1553 */
1554
1555 spin_lock_bh(&pAdapter->lock_for_active_session);
Abhishek Singh087de602015-10-21 17:18:55 +05301556
1557 /* HDD has initiated disconnect, do not send disconnect indication
Mahesh A Saptasagarb5a15142016-05-25 11:27:43 +05301558 * to kernel. Sending disconnected event to kernel for userspace
1559 * initiated disconnect will be handled by diconnect handler call
1560 * to cfg80211_disconnected
Abhishek Singh087de602015-10-21 17:18:55 +05301561 */
Mahesh A Saptasagarb5a15142016-05-25 11:27:43 +05301562 if ((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) ||
1563 (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState))
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301564 {
1565 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1566 FL(" HDD has initiated a disconnect, no need to send"
1567 " disconnect indication to kernel"));
1568 sendDisconInd = FALSE;
1569 }
Agarwal Ashishc65b5ca2014-07-28 21:02:57 +05301570 else if (eConnectionState_Associated == pHddStaCtx->conn_info.connState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 {
Agarwal Ashishc65b5ca2014-07-28 21:02:57 +05301572 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Abhishek Singh087de602015-10-21 17:18:55 +05301573 FL("Set HDD connState to eConnectionState_Disconnecting from %d "),
Agarwal Ashish47d18112014-08-04 19:55:07 +05301574 pHddStaCtx->conn_info.connState);
Agarwal Ashishc65b5ca2014-07-28 21:02:57 +05301575 hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting );
1576 wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 }
Agarwal Ashish47d18112014-08-04 19:55:07 +05301578 spin_unlock_bh(&pAdapter->lock_for_active_session);
1579
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 hdd_clearRoamProfileIe( pAdapter );
Kumar Anand82c009f2014-05-29 00:29:42 -07001581
1582 hdd_wmm_init( pAdapter );
Jeff Johnson295189b2012-06-20 16:38:30 -07001583
1584 // indicate 'disconnect' status to wpa_supplicant...
1585 hdd_SendAssociationEvent(dev,pRoamInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 /* indicate disconnected event to nl80211 */
1587 if(roamStatus != eCSR_ROAM_IBSS_LEAVE)
1588 {
1589 /*During the WLAN uninitialization,supplicant is stopped before the
1590 driver so not sending the status of the connection to supplicant*/
Mihir Shete18156292014-03-11 15:38:30 +05301591 if(pHddCtx->isLoadUnloadInProgress == WLAN_HDD_NO_LOAD_UNLOAD_IN_PROGRESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 {
Sushant Kaushik0b343422015-05-25 17:15:55 +05301593 if (sendDisconInd)
1594 hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
1595 "%s: sent disconnected event to nl80211",
1596 __func__);
Madan Mohan Koyyalamudi26bd7142012-10-30 18:14:19 -07001597#ifdef WLAN_FEATURE_P2P_DEBUG
1598 if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
1599 {
1600 if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTED_STATE_1)
1601 {
1602 globalP2PConnectionStatus = P2P_CLIENT_DISCONNECTED_STATE;
1603 hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] 8 way Handshake completed "
1604 "and moved to disconnected state");
1605 }
1606 else if(globalP2PConnectionStatus == P2P_CLIENT_COMPLETED_STATE)
1607 {
1608 globalP2PConnectionStatus = P2P_NOT_ACTIVE;
1609 hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] P2P Client is removed "
1610 "and moved to inactive state");
1611 }
1612 }
1613#endif
Sushant Kaushikbad61892015-07-10 16:43:28 +05301614 if ((roamStatus == eCSR_ROAM_LOSTLINK) &&
1615 !pRoamInfo->reasonCode)
1616 wlan_hdd_get_frame_logs(pAdapter,
1617 WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301618 /*Only send indication to kernel if not initiated by kernel*/
1619 if ( sendDisconInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001620 {
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301621 /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */
1622 if ( eCSR_ROAM_LOSTLINK == roamStatus )
1623 {
Mahesh A Saptasagar9ff4bcc2016-06-01 17:17:50 +05301624 wlan_hdd_cfg80211_indicate_disconnect(dev, false,
1625 pRoamInfo->reasonCode);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301626 }
1627 else
1628 {
Mahesh A Saptasagar9ff4bcc2016-06-01 17:17:50 +05301629 wlan_hdd_cfg80211_indicate_disconnect(dev, false,
Mahesh A Saptasagarb5a15142016-05-25 11:27:43 +05301630 WLAN_REASON_UNSPECIFIED);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05301631 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 }
Masti, Narayanraddi575ccc72015-08-17 18:04:57 +05301633
1634 if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
1635 {
1636 hddLog(LOG1,
1637 FL("P2P client is getting removed and we are tryig to re-enable TDLS"));
1638 wlan_hdd_tdls_reenable(pHddCtx);
Masti, Narayanraddifdde4d02015-04-16 14:41:51 +05301639 }
Masti, Narayanraddi575ccc72015-08-17 18:04:57 +05301640
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 //If the Device Mode is Station
1642 // and the P2P Client is Connected
1643 //Enable BMPS
Jeff Johnsone7245742012-09-05 17:12:55 -07001644
1645 // In case of JB, as Change-Iface may or maynot be called for p2p0
Shailender Karmuchia734f332013-04-19 14:02:48 -07001646 // Enable BMPS/IMPS in case P2P_CLIENT disconnected
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -07001647 if(VOS_STATUS_SUCCESS == hdd_issta_p2p_clientconnected(pHddCtx))
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 {
1649 //Enable BMPS only of other Session is P2P Client
1650 hdd_context_t *pHddCtx = NULL;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001651 v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
1653 if (NULL != pVosContext)
1654 {
1655 pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
1656
1657 if(NULL != pHddCtx)
1658 {
1659 //Only P2P Client is there Enable Bmps back
Agarwal Ashish51325b52014-06-16 16:50:49 +05301660 if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) &&
1661 (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE]))
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 {
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05301663 if (pHddCtx->hdd_wlan_suspended)
1664 {
1665 hdd_set_pwrparams(pHddCtx);
1666 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001667 hdd_enable_bmps_imps(pHddCtx);
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05301668 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 }
1670 }
1671 }
1672 }
1673 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07001674
Madan Mohan Koyyalamudi70c52d32013-08-07 14:42:16 +05301675 hdd_wmm_adapter_clear(pAdapter);
Kapil Guptae6867482016-06-26 13:31:37 +05301676 /* Clear PER based roam stats */
1677#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1678 if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) &&
1679 (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
1680 pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled &&
1681 pHddCtx->cfg_ini->isPERRoamRxPathEnabled)
1682 sme_unset_per_roam_rxconfig(pHddCtx->hHal);
1683#endif
Mukul Sharmac159c432014-01-15 15:42:46 +05301684#if defined(WLAN_FEATURE_VOWIFI_11R)
1685 sme_FTReset(WLAN_HDD_GET_HAL_CTX(pAdapter));
1686#endif
Katya Nigam63ce1772014-09-26 15:53:49 +05301687
1688 if (eCSR_ROAM_IBSS_LEAVE == roamStatus)
1689 {
Abhishek Singh06e67ba2014-12-08 17:16:33 +05301690 v_U8_t i;
1691
Katya Nigam63ce1772014-09-26 15:53:49 +05301692 sta_id = IBSS_BROADCAST_STAID;
Katya Nigam47528772015-02-11 12:24:49 +05301693 vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id );
Katya Nigam63ce1772014-09-26 15:53:49 +05301694 if ( !VOS_IS_STATUS_SUCCESS(vstatus ) )
1695 {
1696 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Abhishek Singh06e67ba2014-12-08 17:16:33 +05301697 FL("hdd_roamDeregisterSTA() failed to for staID %d. "
1698 "Status= %d [0x%x]"),
Katya Nigam63ce1772014-09-26 15:53:49 +05301699 sta_id, status, status );
1700
1701 status = eHAL_STATUS_FAILURE;
1702 }
Katya Nigam63ce1772014-09-26 15:53:49 +05301703 pHddCtx->sta_to_adapter[sta_id] = NULL;
1704
Abhishek Singh06e67ba2014-12-08 17:16:33 +05301705 /*Clear all the peer sta register with TL.*/
1706 for (i =0; i < HDD_MAX_NUM_IBSS_STA; i++ )
1707 {
1708 if (0 != pHddStaCtx->conn_info.staId[i])
1709 {
1710 sta_id = pHddStaCtx->conn_info.staId[i];
1711
1712 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1713 FL("Deregister StaID %d"),sta_id);
Katya Nigam47528772015-02-11 12:24:49 +05301714 vstatus = hdd_ibss_DeregisterSTA( pAdapter, sta_id );
Abhishek Singh06e67ba2014-12-08 17:16:33 +05301715 if ( !VOS_IS_STATUS_SUCCESS(vstatus ) )
1716 {
1717 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1718 FL("hdd_roamDeregisterSTA() failed to for staID %d. "
1719 "Status= %d [0x%x]"),
1720 sta_id, status, status );
1721 status = eHAL_STATUS_FAILURE;
1722 }
1723
Nirav Shah7e3c8132015-06-22 23:51:42 +05301724 vstatus = hdd_sta_id_hash_remove_entry(pAdapter,
1725 sta_id, &pHddStaCtx->conn_info.peerMacAddress[i]);
1726 if (vstatus != VOS_STATUS_SUCCESS) {
1727 hddLog(VOS_TRACE_LEVEL_ERROR,
1728 FL("Not able to remove staid hash %d"),
1729 sta_id);
1730 status = eHAL_STATUS_FAILURE;
1731 } else {
1732 hddLog(VOS_TRACE_LEVEL_INFO,
1733 FL("ibss station removed sta_id %d mac:"
1734 MAC_ADDRESS_STR), sta_id,
1735 MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[i].bytes));
1736 }
1737
Abhishek Singh06e67ba2014-12-08 17:16:33 +05301738 /*set the staid and peer mac as 0, all other reset are
1739 * done in hdd_connRemoveConnectInfo.
1740 */
1741 pHddStaCtx->conn_info.staId[i]= 0;
1742 vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[i], sizeof( v_MACADDR_t ) );
1743
1744 if (sta_id < (WLAN_MAX_STA_COUNT + 3))
1745 pHddCtx->sta_to_adapter[sta_id] = NULL;
1746 }
1747 }
1748
Katya Nigam63ce1772014-09-26 15:53:49 +05301749 }
Abhishek Singh06e67ba2014-12-08 17:16:33 +05301750 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001751 {
Abhishek Singh06e67ba2014-12-08 17:16:33 +05301752 sta_id = pHddStaCtx->conn_info.staId[0];
Abhishek Singhbfb3c9e2016-07-22 11:25:43 +05301753 /* clear scan cache for Link Lost */
1754 if (pRoamInfo && !pRoamInfo->reasonCode &&
1755 (eCSR_ROAM_LOSTLINK == roamStatus)) {
1756 wlan_hdd_cfg80211_update_bss_list(pAdapter,
1757 pHddStaCtx->conn_info.bssId);
1758 sme_remove_bssid_from_scan_list(pHddCtx->hHal,
1759 pHddStaCtx->conn_info.bssId);
1760 }
Abhishek Singh06e67ba2014-12-08 17:16:33 +05301761
1762 //We should clear all sta register with TL, for now, only one.
1763 vstatus = hdd_roamDeregisterSTA( pAdapter, sta_id );
1764 if ( !VOS_IS_STATUS_SUCCESS(vstatus ) )
1765 {
1766 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1767 FL("hdd_roamDeregisterSTA() failed to for staID %d. "
1768 "Status= %d [0x%x]"),
krunal soni3fc26642013-10-08 22:41:42 -07001769 sta_id, status, status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001770
Abhishek Singh06e67ba2014-12-08 17:16:33 +05301771 status = eHAL_STATUS_FAILURE;
1772 }
1773
1774 pHddCtx->sta_to_adapter[sta_id] = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 }
Srinivas Dasarideb7ae92014-12-19 15:26:40 +05301776
1777#ifdef WLAN_FEATURE_LINK_LAYER_STATS
1778 if (VOS_STATUS_SUCCESS !=
1779 WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
1780 pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE_AC))
1781 {
1782 hddLog(VOS_TRACE_LEVEL_ERROR, "%s:"
1783 "WLANTL_ClearInterfaceStats Failed", __func__);
1784 }
1785 pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0;
1786 pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0;
1787 pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0;
1788 pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0;
1789#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
Sravan Kumar Kairamf9f95122017-01-18 20:54:05 +05301790 pAdapter->dad = false;
Srinivas Dasarideb7ae92014-12-19 15:26:40 +05301791
Jeff Johnson295189b2012-06-20 16:38:30 -07001792 // Clear saved connection information in HDD
1793 hdd_connRemoveConnectInfo( pHddStaCtx );
Abhishek Singhf4669da2014-05-26 15:07:49 +05301794 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1795 "%s: Set HDD connState to eConnectionState_NotConnected",
1796 __func__);
1797 hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected );
Gopichand Nakkala870cbae2013-03-15 21:16:09 +05301798#ifdef WLAN_FEATURE_GTK_OFFLOAD
1799 if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
1800 (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode))
1801 {
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301802 memset(&pHddStaCtx->gtkOffloadReqParams, 0,
1803 sizeof (tSirGtkOffloadParams));
1804 pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE;
Gopichand Nakkala870cbae2013-03-15 21:16:09 +05301805 }
1806#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001807
Gopichand Nakkalac3694582013-02-13 20:51:22 -08001808#ifdef FEATURE_WLAN_TDLS
krunal soni3fc26642013-10-08 22:41:42 -07001809 if (eCSR_ROAM_IBSS_LEAVE != roamStatus)
1810 {
1811 wlan_hdd_tdls_disconnection_callback(pAdapter);
1812 }
Gopichand Nakkalac3694582013-02-13 20:51:22 -08001813#endif
1814
Jeff Johnson295189b2012-06-20 16:38:30 -07001815 //Unblock anyone waiting for disconnect to complete
1816 complete(&pAdapter->disconnect_comp_var);
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +05301817 hdd_print_bss_info(pHddStaCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -07001818 return( status );
1819}
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05301820
1821static void hdd_postTLPacketPendingInd(hdd_adapter_t *pAdapter,
1822 v_U8_t staId)
1823{
1824 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
1825 v_SINT_t i;
1826 v_SIZE_t size;
1827 VOS_STATUS status;
1828 v_BOOL_t granted = VOS_FALSE;
1829
1830 if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) ||
1831 (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ||
1832 (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE))
1833 {
1834 //Indicate to TL that there is pending data if a queue is non empty
1835 for (i = WLANTL_AC_HIGH_PRIO; i>=0; --i)
1836 {
1837 size = 0;
1838 hdd_list_size(&pAdapter->wmm_tx_queue[i], &size);
1839 if (size > 0)
1840 {
1841 if (i != WLANTL_AC_HIGH_PRIO)
1842 {
1843 if (VOS_FALSE ==
1844 pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessAllowed)
1845 {
1846 hdd_wmm_acquire_access(pAdapter,
1847 (WLANTL_ACEnumType)i, &granted);
1848 pAdapter->psbChanged |= (1 << i);
1849 }
1850 else
1851 granted = VOS_TRUE;
1852 }
1853
1854 if (granted || (i == WLANTL_AC_HIGH_PRIO))
1855 {
1856 status = WLANTL_STAPktPending(pHddCtx->pvosContext,
1857 staId, (WLANTL_ACEnumType)i);
1858 if (!VOS_IS_STATUS_SUCCESS(status))
1859 {
1860 VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
1861 "%s: Failure in indicating pkt to TL for QID=%d",
1862 __func__, i);
1863 }
1864 }
1865 }
1866 }
1867 }
1868}
1869
Jeff Johnson295189b2012-06-20 16:38:30 -07001870static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter,
1871 tCsrRoamInfo *pRoamInfo,
1872 v_U8_t staId,
1873 v_MACADDR_t *pPeerMacAddress,
1874 tSirBssDescription *pBssDesc )
1875{
1876 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1877 WLAN_STADescType staDesc = {0};
1878 eCsrEncryptionType connectedCipherAlgo;
1879 v_BOOL_t fConnected;
1880 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1881 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07001882 hdd_config_t *cfg_param = pHddCtx->cfg_ini;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001883
1884 if ( NULL == pBssDesc)
1885 {
1886 return VOS_STATUS_E_FAILURE;
1887 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001888 // Get the Station ID from the one saved during the assocation.
1889 staDesc.ucSTAId = staId;
1890
Katya Nigam47528772015-02-11 12:24:49 +05301891 staDesc.wSTAType = WLAN_STA_INFRA;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001892
Katya Nigam47528772015-02-11 12:24:49 +05301893 // grab the bssid from the connection info in the adapter structure and hand that
1894 // over to TL when registering.
1895 vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId,
1896 sizeof(pHddStaCtx->conn_info.bssId) );
Shailender Karmuchia734f332013-04-19 14:02:48 -07001897
Jeff Johnson295189b2012-06-20 16:38:30 -07001898 vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent );
1899
1900 // set the QoS field appropriately
1901 if (hdd_wmm_is_active(pAdapter))
1902 {
1903 staDesc.ucQosEnabled = 1;
1904 }
1905 else
1906 {
1907 staDesc.ucQosEnabled = 0;
1908 }
1909
1910 fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
1911 if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE )
1912 {
1913 staDesc.ucProtectedFrame = 1;
1914 }
1915 else
1916 {
1917 staDesc.ucProtectedFrame = 0;
1918
1919 }
1920
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001921#ifdef FEATURE_WLAN_ESE
1922 staDesc.ucIsEseSta = pRoamInfo->isESEAssoc;
1923#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001924
Jeff Johnson295189b2012-06-20 16:38:30 -07001925 /* check whether replay check is valid for the station or not */
1926 if( (eCSR_ENCRYPT_TYPE_TKIP == connectedCipherAlgo) || (eCSR_ENCRYPT_TYPE_AES == connectedCipherAlgo))
1927 {
1928 /* Encryption mode is either TKIP or AES
1929 and replay check is valid for only these
1930 two encryption modes */
1931 staDesc.ucIsReplayCheckValid = VOS_TRUE;
1932 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1933 "HDD register TL ucIsReplayCheckValid %d: Replay check is needed for station", staDesc.ucIsReplayCheckValid);
1934 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 else
1936 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001937 /* For other encryption modes replay check is
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 not needed */
Shailender Karmuchia734f332013-04-19 14:02:48 -07001939 staDesc.ucIsReplayCheckValid = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1941 "HDD register TL ucIsReplayCheckValid %d", staDesc.ucIsReplayCheckValid);
1942 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001943
1944#ifdef FEATURE_WLAN_WAPI
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001945 hddLog(LOG1, "%s: WAPI STA Registered: %d", __func__, pAdapter->wapi_info.fIsWapiSta);
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 if (pAdapter->wapi_info.fIsWapiSta)
1947 {
1948 staDesc.ucIsWapiSta = 1;
1949 }
1950 else
1951 {
1952 staDesc.ucIsWapiSta = 0;
1953 }
1954#endif /* FEATURE_WLAN_WAPI */
1955
1956 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
1957 "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame );
1958
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 // UMA is Not ready yet, Xlation will be done by TL
1960 staDesc.ucSwFrameTXXlation = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 staDesc.ucSwFrameRXXlation = 1;
1962 staDesc.ucAddRmvLLC = 1;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001963 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "HDD register TL QoS_enabled=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 staDesc.ucQosEnabled );
1965 // Initialize signatures and state
1966 staDesc.ucUcastSig = pRoamInfo->ucastSig;
1967 staDesc.ucBcastSig = pRoamInfo->bcastSig;
1968 staDesc.ucInitState = pRoamInfo->fAuthRequired ?
1969 WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED;
Shailender Karmuchia734f332013-04-19 14:02:48 -07001970 // Register the Station with TL...
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08001971 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 -07001972 vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext,
1973 hdd_rx_packet_cbk,
1974 hdd_tx_complete_cbk,
Jeff Johnson295189b2012-06-20 16:38:30 -07001975 hdd_tx_fetch_packet_cbk, &staDesc,
1976 pBssDesc->rssi );
Shailender Karmuchia734f332013-04-19 14:02:48 -07001977
Jeff Johnson295189b2012-06-20 16:38:30 -07001978 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
1979 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07001980 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07001981 "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08X]",
Jeff Johnson295189b2012-06-20 16:38:30 -07001982 vosStatus, vosStatus );
Shailender Karmuchia734f332013-04-19 14:02:48 -07001983 return vosStatus;
1984 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001985
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07001986 if ( cfg_param->dynSplitscan &&
1987 ( VOS_TIMER_STATE_RUNNING !=
1988 vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)))
1989 {
1990 vos_timer_start(&pHddCtx->tx_rx_trafficTmr,
1991 cfg_param->trafficMntrTmrForSplitScan);
1992 }
1993
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05301994 // if (WPA), tell TL to go to 'connected' and after keys come to the driver,
1995 // then go to 'authenticated'. For all other authentication types
1996 // (those that donot require upper layer authentication) we can put
1997 // TL directly into 'authenticated' state.
Shailender Karmuchia734f332013-04-19 14:02:48 -07001998 if (staDesc.wSTAType != WLAN_STA_IBSS)
1999 VOS_ASSERT( fConnected );
2000
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05302001 if ( !pRoamInfo->fAuthRequired )
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002002 {
2003 // Connections that do not need Upper layer auth, transition TL directly
2004 // to 'Authenticated' state.
2005 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId,
2006 WLANTL_STA_AUTHENTICATED );
2007
2008 pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05302009
2010 hdd_postTLPacketPendingInd(pAdapter, staDesc.ucSTAId);
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002011 }
2012 else
2013 {
2014 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05302015 "ULA auth StaId= %d. Changing TL state to CONNECTED"
2016 "at Join time", pHddStaCtx->conn_info.staId[0] );
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002017 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId,
Gopichand Nakkala29149562013-05-10 21:43:41 +05302018 WLANTL_STA_CONNECTED );
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002019 pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE;
2020 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002021 return( vosStatus );
2022}
2023
Jeff Johnson295189b2012-06-20 16:38:30 -07002024static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter,
2025 tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength)
2026{
2027 unsigned int len = 0;
2028 u8 *pFTAssocRsp = NULL;
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07002029 v_U8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 tANI_U32 rspRsnLength = 0;
Abhishek Singh5a597e62016-12-05 15:16:30 +05302031 struct cfg80211_bss* bss;
2032 tCsrRoamConnectedProfile roam_profile;
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 struct ieee80211_channel *chan;
Abhishek Singh5a597e62016-12-05 15:16:30 +05302034 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07002035
Agarwal Ashish51325b52014-06-16 16:50:49 +05302036 if (!rspRsnIe) {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07002037 hddLog(LOGE, "%s: Unable to allocate RSN IE", __func__);
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07002038 return;
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07002039 }
2040
Agarwal Ashish51325b52014-06-16 16:50:49 +05302041 if (pCsrRoamInfo == NULL) {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07002042 hddLog(LOGE, "%s: Invalid CSR roam info", __func__);
2043 goto done;
2044 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002045
Agarwal Ashish51325b52014-06-16 16:50:49 +05302046 if (pCsrRoamInfo->nAssocRspLength == 0) {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07002047 hddLog(LOGE, "%s: Invalid assoc response length", __func__);
2048 goto done;
2049 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002050
2051 pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength +
2052 pCsrRoamInfo->nAssocReqLength);
2053 if (pFTAssocRsp == NULL)
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07002054 goto done;
Jeff Johnson295189b2012-06-20 16:38:30 -07002055
2056 //pFTAssocRsp needs to point to the IEs
2057 pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET;
Arif Hussain6d2a3322013-11-17 19:50:10 -08002058 hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07002059 (unsigned int)pFTAssocRsp[0],
2060 (unsigned int)pFTAssocRsp[1]);
2061
2062 // Send the Assoc Resp, the supplicant needs this for initial Auth.
Madan Mohan Koyyalamudi1bed23d2012-11-13 10:59:48 -08002063 len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 rspRsnLength = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 memcpy(rspRsnIe, pFTAssocRsp, len);
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07002066 memset(rspRsnIe + len, 0, IW_GENERIC_IE_MAX - len);
Jeff Johnson295189b2012-06-20 16:38:30 -07002067
Abhishek Singh5a597e62016-12-05 15:16:30 +05302068 chan = ieee80211_get_channel(pAdapter->wdev.wiphy,
2069 (int) pCsrRoamInfo->pBssDesc->channelId);
2070 vos_mem_zero(&roam_profile, sizeof(tCsrRoamConnectedProfile));
2071 sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roam_profile);
2072 bss = hdd_get_bss_entry(pAdapter->wdev.wiphy,
2073 chan, pCsrRoamInfo->bssid,
2074 &roam_profile.SSID.ssId[0],
2075 roam_profile.SSID.length);
2076 cfg80211_roamed_bss(dev, bss,
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 reqRsnIe, reqRsnLength,
2078 rspRsnIe, rspRsnLength,GFP_KERNEL);
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07002079
2080done:
2081 kfree(rspRsnIe);
Jeff Johnson295189b2012-06-20 16:38:30 -07002082}
Jeff Johnson295189b2012-06-20 16:38:30 -07002083
Gopichand Nakkala3d295922013-05-07 16:19:14 +05302084void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter)
2085{
2086 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
2087 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
2088 tCsrRoamInfo roamInfo;
2089 roamInfo.fAuthRequired = FALSE;
2090 vos_mem_copy(roamInfo.bssid,
2091 pHddStaCtx->roam_info.bssid,
2092 WNI_CFG_BSSID_LEN);
2093 vos_mem_copy(roamInfo.peerMac,
2094 pHddStaCtx->roam_info.peerMac,
2095 WNI_CFG_BSSID_LEN);
2096
2097 halStatus = hdd_RoamSetKeyCompleteHandler(pAdapter,
2098 &roamInfo,
2099 pHddStaCtx->roam_info.roamId,
2100 pHddStaCtx->roam_info.roamStatus,
2101 eCSR_ROAM_RESULT_AUTHENTICATED);
2102 if (halStatus != eHAL_STATUS_SUCCESS)
2103 {
2104 hddLog(LOGE, "%s: Set Key complete failure", __func__);
2105 }
2106 pHddStaCtx->roam_info.deferKeyComplete = FALSE;
2107}
2108
Shailender Karmuchia734f332013-04-19 14:02:48 -07002109static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
2110 tANI_U32 roamId, eRoamCmdStatus roamStatus,
Jeff Johnson295189b2012-06-20 16:38:30 -07002111 eCsrRoamResult roamResult )
2112{
2113 struct net_device *dev = pAdapter->dev;
2114 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
2115 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Sushant Kaushikba6764e2014-06-30 19:52:09 +05302116 hdd_adapter_t *pHostapdAdapter = NULL;
Girish Gowli257a7e62014-08-02 15:50:43 +05302117 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Madan Mohan Koyyalamudi2dd4c8d2012-11-08 14:44:14 -08002118 v_U8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN];
2119 tANI_U32 reqRsnLength = DOT11F_IE_RSN_MAX_LEN;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002120#if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) || defined (WLAN_FEATURE_VOWIFI_11R)
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 int ft_carrier_on = FALSE;
2122#endif
2123 int status;
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302124 v_BOOL_t hddDisconInProgress = FALSE;
2125
2126 /* HDD has initiated disconnect, do not send connect result indication
2127 * to kernel as it will be handled by __cfg80211_disconnect.
2128 */
Agarwal Ashishc089cec2015-08-10 13:10:04 +05302129 if (((eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) ||
2130 (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState)) &&
2131 ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) ||
2132 (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus)))
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302133 {
2134 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2135 FL(" Disconnect from HDD in progress "));
2136 hddDisconInProgress = TRUE;
2137 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002138
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult )
2140 {
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302141 if ( !hddDisconInProgress )
2142 {
2143 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Abhishek Singhf4669da2014-05-26 15:07:49 +05302144 "%s: Set HDD connState to eConnectionState_Associated",
2145 __func__);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302146 hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Associated );
2147 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002148
c_hpothu44ff4e02014-05-08 00:13:57 +05302149 pAdapter->maxRateFlags = pRoamInfo->maxRateFlags;
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 // Save the connection info from CSR...
2151 hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE );
Kapil Guptae6867482016-06-26 13:31:37 +05302152
2153#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2154 if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) &&
2155 (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
2156 !hddDisconInProgress &&
2157 pHddCtx->cfg_ini && pHddCtx->cfg_ini->isPERRoamEnabled &&
2158 pHddCtx->cfg_ini->isPERRoamRxPathEnabled)
2159 sme_set_per_roam_rxconfig(pHddCtx->hHal,
2160 pHddStaCtx->conn_info.staId[0],
2161 pHddCtx->cfg_ini->rateDownThreshold,
2162 pHddCtx->cfg_ini->rateUpThreshold,
2163 pHddCtx->cfg_ini->PERroamTriggerPercent,
2164 pHddCtx->cfg_ini->PERroamRxPktsThreshold,
2165 pHddCtx->cfg_ini->waitPeriodForNextPERScan);
2166#endif
2167
Jeff Johnson295189b2012-06-20 16:38:30 -07002168#ifdef FEATURE_WLAN_WAPI
2169 if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE ||
2170 pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK )
2171 {
2172 pAdapter->wapi_info.fIsWapiSta = 1;
2173 }
2174 else
2175 {
2176 pAdapter->wapi_info.fIsWapiSta = 0;
2177 }
2178#endif /* FEATURE_WLAN_WAPI */
2179
2180 // indicate 'connect' status to userspace
2181 hdd_SendAssociationEvent(dev,pRoamInfo);
2182
2183
Shailender Karmuchia734f332013-04-19 14:02:48 -07002184 // Initialize the Linkup event completion variable
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 INIT_COMPLETION(pAdapter->linkup_event_var);
2186
2187 /*
2188 Sometimes Switching ON the Carrier is taking time to activate the device properly. Before allowing any
2189 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 -07002190 kernel. we have registered net device notifier for device change notification. With this we will come to
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 know that the device is getting activated properly.
2192 */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002193#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Katya Nigamb130d572014-11-24 16:38:16 +05302194 if (pHddStaCtx->ft_carrier_on == FALSE && !hddDisconInProgress )
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 {
2196#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07002197 // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 pAdapter->isLinkUpSvcNeeded = TRUE;
2199
Shailender Karmuchia734f332013-04-19 14:02:48 -07002200 // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 pAdapter->isLinkUpSvcNeeded = TRUE;
2202
2203 // Switch on the Carrier to activate the device
2204 netif_carrier_on(dev);
2205
2206 // Wait for the Link to up to ensure all the queues are set properly by the kernel
2207 status = wait_for_completion_interruptible_timeout(&pAdapter->linkup_event_var,
2208 msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT));
Shailender Karmuchia734f332013-04-19 14:02:48 -07002209 if(!status)
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 {
2211 hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning:ASSOC_LINKUP_TIMEOUT", __func__);
2212 }
2213
2214 // Disable Linkup Event Servicing - no more service required from the net device notifier call
2215 pAdapter->isLinkUpSvcNeeded = FALSE;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002216#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002218 else {
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 pHddStaCtx->ft_carrier_on = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 ft_carrier_on = TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 }
2222#endif
Sandeep Puligillad91dccb2014-06-18 11:51:48 +05302223 /* Check for STAID */
2224 if( (WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId )
2225 pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter;
2226 else
2227 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Wrong Staid: %d", __func__, pRoamInfo->staId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002228
2229 //For reassoc, the station is already registered, all we need is to change the state
2230 //of the STA in TL.
2231 //If authentication is required (WPA/WPA2/DWEP), change TL to CONNECTED instead of AUTHENTICATED
Mukul Sharma5b2ff502014-11-06 14:43:50 +05302232 //pRoamInfo->fReassocReq will be set only for the reassoc to same ap
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 if( !pRoamInfo->fReassocReq )
2234 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002235 struct cfg80211_bss *bss;
2236#ifdef WLAN_FEATURE_VOWIFI_11R
2237 u8 *pFTAssocRsp = NULL;
2238 unsigned int assocRsplen = 0;
2239 u8 *pFTAssocReq = NULL;
2240 unsigned int assocReqlen = 0;
2241 struct ieee80211_channel *chan;
2242#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 v_U8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN];
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 tANI_U32 rspRsnLength = DOT11F_IE_RSN_MAX_LEN;
Jeff Johnson295189b2012-06-20 16:38:30 -07002245
2246 /* add bss_id to cfg80211 data base */
2247 bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo);
2248 if (NULL == bss)
2249 {
Abhishek Singh7ca68f32016-06-28 10:23:10 +05302250 hddLog(LOGE,
2251 FL("Not able to create BSS entry"));
Katya Nigam346d4e92014-09-02 16:16:12 +05302252 netif_carrier_off(dev);
Abhishek Singh7ca68f32016-06-28 10:23:10 +05302253 if (!hddDisconInProgress) {
2254 /*
2255 * Here driver was not able to update cfg80211 database
2256 * this can happen if connected channel is not valid,
2257 * i.e reg domain was changed during connection.
2258 * Queue disconnect for the session if disconnect is
2259 * not in progress.
2260 */
2261 hddLog(LOGE, FL("Disconnecting..."));
2262 sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
2263 pAdapter->sessionId,
2264 eCSR_DISCONNECT_REASON_UNSPECIFIED);
2265 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 return eHAL_STATUS_FAILURE;
2267 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002268#ifdef WLAN_FEATURE_VOWIFI_11R
2269 if(pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN ||
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002270 pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN_PSK )
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002272
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002273 //Association Response
Shailender Karmuchia734f332013-04-19 14:02:48 -07002274 pFTAssocRsp = (u8 *)(pRoamInfo->pbFrames + pRoamInfo->nBeaconLength +
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002275 pRoamInfo->nAssocReqLength);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002276 if (pFTAssocRsp != NULL)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002277 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002278 // pFTAssocRsp needs to point to the IEs
2279 pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET;
2280 hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__,
2281 (unsigned int)pFTAssocRsp[0],
2282 (unsigned int)pFTAssocRsp[1]);
2283 assocRsplen = pRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002284 }
2285 else
2286 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002287 hddLog(LOGE, "%s:AssocRsp is NULL", __func__);
2288 assocRsplen = 0;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002289 }
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002290
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002291 //Association Request
Shailender Karmuchia734f332013-04-19 14:02:48 -07002292 pFTAssocReq = (u8 *)(pRoamInfo->pbFrames +
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002293 pRoamInfo->nBeaconLength);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002294 if (pFTAssocReq != NULL)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002295 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002296 if(!ft_carrier_on)
2297 {
2298 // pFTAssocReq needs to point to the IEs
2299 pFTAssocReq += FT_ASSOC_REQ_IES_OFFSET;
2300 hddLog(LOG1, "%s: pFTAssocReq is now at %02x%02x", __func__,
2301 (unsigned int)pFTAssocReq[0],
2302 (unsigned int)pFTAssocReq[1]);
2303 assocReqlen = pRoamInfo->nAssocReqLength - FT_ASSOC_REQ_IES_OFFSET;
2304 }
2305 else
2306 {
2307 /* This should contain only the FTIEs */
2308 assocReqlen = pRoamInfo->nAssocReqLength;
2309 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002310 }
2311 else
2312 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002313 hddLog(LOGE, "%s:AssocReq is NULL", __func__);
2314 assocReqlen = 0;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002315 }
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002316
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002317 if(ft_carrier_on)
2318 {
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302319 if ( !hddDisconInProgress )
2320 {
Abhishek Singh5a597e62016-12-05 15:16:30 +05302321 struct cfg80211_bss *roam_bss;
2322
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302323 hddLog(LOG1, "%s ft_carrier_on is %d, sending roamed "
Arif Hussain6d2a3322013-11-17 19:50:10 -08002324 "indication", __FUNCTION__, ft_carrier_on);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302325 chan = ieee80211_get_channel(pAdapter->wdev.wiphy,
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002326 (int)pRoamInfo->pBssDesc->channelId);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302327 hddLog(LOG1, "assocReqlen %d assocRsplen %d", assocReqlen,
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002328 assocRsplen);
Anurag Chouhan6f6198c2016-08-28 12:43:46 +05302329 if (pHddCtx->cfg_ini &&
2330 pHddCtx->cfg_ini->gEnableRoamDelayStats)
Girish Gowlibf0e1ab2015-01-19 16:05:16 +05302331 {
2332 vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0);
2333 }
Abhishek Singh5a597e62016-12-05 15:16:30 +05302334 roam_bss = hdd_get_bss_entry(pAdapter->wdev.wiphy,
2335 chan, pRoamInfo->bssid,
2336 pRoamInfo->u.pConnectedProfile->SSID.ssId,
2337 pRoamInfo->u.pConnectedProfile->SSID.length);
2338 cfg80211_roamed_bss(dev, roam_bss,
2339 pFTAssocReq, assocReqlen,
2340 pFTAssocRsp, assocRsplen,
2341 GFP_KERNEL);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302342 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +05302343 if (sme_GetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter)))
2344 {
2345 sme_SetFTPTKState(WLAN_HDD_GET_HAL_CTX(pAdapter), FALSE);
2346 pRoamInfo->fAuthRequired = FALSE;
2347
2348 vos_mem_copy(pHddStaCtx->roam_info.bssid,
2349 pRoamInfo->bssid,
2350 HDD_MAC_ADDR_LEN);
2351 vos_mem_copy(pHddStaCtx->roam_info.peerMac,
2352 pRoamInfo->peerMac,
2353 HDD_MAC_ADDR_LEN);
2354 pHddStaCtx->roam_info.roamId = roamId;
2355 pHddStaCtx->roam_info.roamStatus = roamStatus;
2356 pHddStaCtx->roam_info.deferKeyComplete = TRUE;
2357 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002358 }
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302359 else if ( !hddDisconInProgress )
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002360 {
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002361 hddLog(LOG1, "%s ft_carrier_on is %d, sending connect "
Arif Hussain6d2a3322013-11-17 19:50:10 -08002362 "indication", __FUNCTION__, ft_carrier_on);
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302363 hdd_connect_result(dev, pRoamInfo->bssid, pRoamInfo,
2364 pFTAssocReq, assocReqlen,
2365 pFTAssocRsp, assocRsplen,
2366 WLAN_STATUS_SUCCESS,
2367 GFP_KERNEL);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002368 }
2369 }
2370 else
2371#endif
2372 {
2373 /* wpa supplicant expecting WPA/RSN IE in connect result */
2374 csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
2375 pAdapter->sessionId,
2376 &reqRsnLength,
2377 reqRsnIe);
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002378
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002379 csrRoamGetWpaRsnRspIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
2380 pAdapter->sessionId,
2381 &rspRsnLength,
2382 rspRsnIe);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302383 if ( !hddDisconInProgress )
2384 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002385#if defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302386 if(ft_carrier_on)
Mukul Sharma84f27252014-07-14 18:11:42 +05302387 {
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302388 hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength);
Anurag Chouhan6f6198c2016-08-28 12:43:46 +05302389 if (pHddCtx->cfg_ini &&
2390 pHddCtx->cfg_ini->gEnableRoamDelayStats)
Girish Gowlibf0e1ab2015-01-19 16:05:16 +05302391 {
2392 vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0);
2393 }
Mukul Sharma84f27252014-07-14 18:11:42 +05302394 }
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302395 else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002396#endif /* FEATURE_WLAN_ESE */
Madan Mohan Koyyalamudif146b382012-11-06 18:53:10 -08002397
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302398 {
2399 hddLog(VOS_TRACE_LEVEL_INFO,
Deepthi Gowri6649f6a2014-02-18 17:31:23 +05302400 "%s: sending connect indication to nl80211:"
2401 " for bssid " MAC_ADDRESS_STR
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302402 " result:%d and Status:%d",
Deepthi Gowri6649f6a2014-02-18 17:31:23 +05302403 __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid),
2404 roamResult, roamStatus);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302405 /* inform connect result to nl80211 */
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302406 hdd_connect_result(dev, pRoamInfo->bssid,
2407 pRoamInfo,
2408 reqRsnIe, reqRsnLength,
2409 rspRsnIe, rspRsnLength,
2410 WLAN_STATUS_SUCCESS,
2411 GFP_KERNEL);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302412 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002413 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002414 }
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302415 if ( !hddDisconInProgress )
2416 {
2417 cfg80211_put_bss(
Yue Maf49ba872013-08-19 12:04:25 -07002418#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302419 pHddCtx->wiphy,
Yue Maf49ba872013-08-19 12:04:25 -07002420#endif
2421 bss);
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302422 // Register the Station with TL after associated...
2423 vosStatus = hdd_roamRegisterSTA( pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 pRoamInfo,
2425 pHddStaCtx->conn_info.staId[ 0 ],
2426 NULL,
2427 pRoamInfo->pBssDesc );
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302428 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002429 }
2430 else
2431 {
Madan Mohan Koyyalamudi2dd4c8d2012-11-08 14:44:14 -08002432 /* wpa supplicant expecting WPA/RSN IE in connect result */
2433 /* in case of reassociation also need to indicate it to supplicant */
2434 csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
2435 pAdapter->sessionId,
2436 &reqRsnLength,
2437 reqRsnIe);
2438
2439 hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07002440 //Reassoc successfully
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05302441 if( pRoamInfo->fAuthRequired )
2442 {
2443 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext,
2444 pHddStaCtx->conn_info.staId[ 0 ],
2445 WLANTL_STA_CONNECTED );
2446 pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE;
2447 }
2448 else
2449 {
2450 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
2451 "%s: staId: %d Changing TL state to AUTHENTICATED",
2452 __func__, pHddStaCtx->conn_info.staId[ 0 ] );
2453 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext,
2454 pHddStaCtx->conn_info.staId[ 0 ],
2455 WLANTL_STA_AUTHENTICATED );
2456 pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05302457 hdd_postTLPacketPendingInd(pAdapter,
2458 pHddStaCtx->conn_info.staId[0]);
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05302459 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 }
2461
2462 if ( VOS_IS_STATUS_SUCCESS( vosStatus ) )
2463 {
2464 // perform any WMM-related association processing
2465 hdd_wmm_assoc(pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE);
2466 }
2467 else
2468 {
2469 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07002470 "Cannot register STA with TL. Failed with vosStatus = %d [%08X]",
Jeff Johnson295189b2012-06-20 16:38:30 -07002471 vosStatus, vosStatus );
2472 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002473#ifdef WLAN_FEATURE_11W
2474 vos_mem_zero( &pAdapter->hdd_stats.hddPmfStats,
2475 sizeof(pAdapter->hdd_stats.hddPmfStats) );
2476#endif
Padma, Santhosh Kumar9dacb5c2014-12-17 19:22:56 +05302477
Jeff Johnson295189b2012-06-20 16:38:30 -07002478 // Start the Queue
Katya Nigamb130d572014-11-24 16:38:16 +05302479 if ( !hddDisconInProgress )
Padma, Santhosh Kumar9dacb5c2014-12-17 19:22:56 +05302480 {
2481 hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
Katya Nigamb130d572014-11-24 16:38:16 +05302482 netif_tx_wake_all_queues(dev);
Padma, Santhosh Kumar9dacb5c2014-12-17 19:22:56 +05302483 }
Anurag Chouhan6f6198c2016-08-28 12:43:46 +05302484 if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->gEnableRoamDelayStats)
Girish Gowlibf0e1ab2015-01-19 16:05:16 +05302485 {
2486 vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0);
2487 }
Padma, Santhosh Kumar38cef182016-02-18 12:22:51 +05302488#ifdef FEATURE_WLAN_TDLS
2489 wlan_hdd_tdls_connection_callback(pAdapter);
2490#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07002491 }
2492 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002493 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
2495
2496 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07002497 if (pRoamInfo)
Deepthi Gowric7591cc2015-12-28 15:43:17 +05302498 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
2499 "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d",
2500 MAC_ADDR_ARRAY(pRoamInfo->bssid), roamResult, roamStatus);
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07002501 else
Deepthi Gowric7591cc2015-12-28 15:43:17 +05302502 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
2503 "wlan: connection failed with " MAC_ADDRESS_STR " result:%d and Status:%d",
Arif Hussain24bafea2013-11-15 15:10:03 -08002504 MAC_ADDR_ARRAY(pWextState->req_bssId),
2505 roamResult, roamStatus);
Abhishek Singh6782c9e2017-06-06 13:37:45 +05302506 if (!pHddStaCtx->get_mgmt_log_sent) {
2507 pHddStaCtx->get_mgmt_log_sent = TRUE;
Abhishek Singh611295e2015-07-09 11:11:54 +05302508 wlan_hdd_get_frame_logs(pAdapter,
Siddharth Bhalda0d1622015-04-24 15:47:49 +05302509 WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR);
Abhishek Singh6782c9e2017-06-06 13:37:45 +05302510 }
Siddharth Bhalda0d1622015-04-24 15:47:49 +05302511
Abhishek Singhbfb3c9e2016-07-22 11:25:43 +05302512 if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) ||
2513 (pRoamInfo &&
2514 ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) ||
2515 (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode) ||
2516 (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == pRoamInfo->statusCode)))) {
2517 wlan_hdd_cfg80211_update_bss_list(pAdapter,
2518 pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId);
2519 sme_remove_bssid_from_scan_list(pHddCtx->hHal,
2520 pRoamInfo ? pRoamInfo->bssid : pWextState->req_bssId);
2521 }
Abhishek Singhf4669da2014-05-26 15:07:49 +05302522 /* Set connection state to eConnectionState_NotConnected only when CSR
2523 * has completed operation - with a ASSOCIATION_FAILURE status
2524 */
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302525 if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress )
Abhishek Singhf4669da2014-05-26 15:07:49 +05302526 {
2527 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2528 "%s: Set HDD connState to eConnectionState_NotConnected",
2529 __func__);
2530 hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected);
2531 }
Agarwal Ashish51325b52014-06-16 16:50:49 +05302532 if((pHddCtx->concurrency_mode <= 1) &&
2533 (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1))
Jeff Johnson295189b2012-06-20 16:38:30 -07002534 {
2535 pHddCtx->isAmpAllowed = VOS_TRUE;
2536 }
2537
2538 //If the Device Mode is Station
2539 // and the P2P Client is Connected
2540 //Enable BMPS
Jeff Johnsone7245742012-09-05 17:12:55 -07002541
2542 // In case of JB, as Change-Iface may or maynot be called for p2p0
Shailender Karmuchia734f332013-04-19 14:02:48 -07002543 // Enable BMPS/IMPS in case P2P_CLIENT disconnected
Jeff Johnsone7245742012-09-05 17:12:55 -07002544 if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
2545 (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) &&
Agarwal Ashish51325b52014-06-16 16:50:49 +05302546 (vos_concurrent_open_sessions_running()))
Jeff Johnson295189b2012-06-20 16:38:30 -07002547 {
2548 //Enable BMPS only of other Session is P2P Client
2549 hdd_context_t *pHddCtx = NULL;
2550 v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
2551
2552 if (NULL != pVosContext)
2553 {
2554 pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
2555
2556 if(NULL != pHddCtx)
2557 {
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05302558 //Only P2P Client is there Enable Bmps back
Agarwal Ashish51325b52014-06-16 16:50:49 +05302559 if((0 == pHddCtx->no_of_open_sessions[VOS_STA_SAP_MODE]) &&
2560 (0 == pHddCtx->no_of_open_sessions[VOS_P2P_GO_MODE]))
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05302561 {
2562 if (pHddCtx->hdd_wlan_suspended)
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08002563 {
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05302564 hdd_set_pwrparams(pHddCtx);
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08002565 }
Gopichand Nakkalaa2fe5b02013-06-06 16:32:28 +05302566 hdd_enable_bmps_imps(pHddCtx);
2567 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 }
2569 }
2570 }
2571
James Zmudafbf5ffc2013-03-25 12:45:35 -07002572 /* CR465478: Only send up a connection failure result when CSR has
Varun Reddy Yeturuda7f0d52013-12-20 11:16:57 -08002573 * completed operation - with a ASSOCIATION_FAILURE status.*/
Abhishek Singha6cfaa42014-06-23 13:11:07 +05302574 if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus && !hddDisconInProgress )
Jeff Johnsone7245742012-09-05 17:12:55 -07002575 {
Masti, Narayanraddi575ccc72015-08-17 18:04:57 +05302576
2577 if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
2578 {
2579 hddLog(LOG1,
2580 FL("Assoication Failure for P2P client and we are trying to re-enable TDLS"));
2581 wlan_hdd_tdls_reenable(pHddCtx);
2582 }
2583
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +05302584 if (pRoamInfo) {
Deepthi Gowri6649f6a2014-02-18 17:31:23 +05302585 hddLog(VOS_TRACE_LEVEL_ERROR,
2586 "%s: send connect failure to nl80211:"
2587 " for bssid " MAC_ADDRESS_STR
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302588 " result:%d and Status:%d reasonCode %d" ,
Deepthi Gowri6649f6a2014-02-18 17:31:23 +05302589 __func__, MAC_ADDR_ARRAY(pRoamInfo->bssid),
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302590 roamResult, roamStatus, pRoamInfo->reasonCode);
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +05302591 pHddStaCtx->conn_info.assoc_status_code =
2592 pRoamInfo->statusCode;
2593 } else {
Deepthi Gowri6649f6a2014-02-18 17:31:23 +05302594 hddLog(VOS_TRACE_LEVEL_ERROR,
2595 "%s: connect failed:"
2596 " for bssid " MAC_ADDRESS_STR
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302597 " result:%d and Status:%d" ,
Deepthi Gowri6649f6a2014-02-18 17:31:23 +05302598 __func__, MAC_ADDR_ARRAY(pWextState->req_bssId),
2599 roamResult, roamStatus);
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +05302600 }
Deepthi Gowri6649f6a2014-02-18 17:31:23 +05302601
James Zmudafbf5ffc2013-03-25 12:45:35 -07002602 /* inform association failure event to nl80211 */
2603 if ( eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult )
2604 {
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07002605 if (pRoamInfo)
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302606 hdd_connect_result(dev, pRoamInfo->bssid, NULL,
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07002607 NULL, 0, NULL, 0,
2608 WLAN_STATUS_ASSOC_DENIED_UNSPEC,
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302609 GFP_KERNEL);
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07002610 else
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302611 hdd_connect_result(dev, pWextState->req_bssId, NULL,
Kiran Kumar Lokerec8550fa2013-04-15 22:23:00 -07002612 NULL, 0, NULL, 0,
2613 WLAN_STATUS_ASSOC_DENIED_UNSPEC,
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302614 GFP_KERNEL);
James Zmudafbf5ffc2013-03-25 12:45:35 -07002615 }
2616 else
2617 {
Gao Wu6ca73b32016-05-09 14:35:49 +08002618 if (pRoamInfo)
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302619 hdd_connect_result(dev, pRoamInfo->bssid, NULL,
Gao Wu6ca73b32016-05-09 14:35:49 +08002620 NULL, 0, NULL, 0,
2621 pRoamInfo->reasonCode ?
2622 pRoamInfo->reasonCode :
2623 WLAN_STATUS_UNSPECIFIED_FAILURE,
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302624 GFP_KERNEL);
Gao Wu6ca73b32016-05-09 14:35:49 +08002625 else
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302626 hdd_connect_result(dev, pWextState->req_bssId, NULL,
Gao Wu6ca73b32016-05-09 14:35:49 +08002627 NULL, 0, NULL, 0,
2628 WLAN_STATUS_UNSPECIFIED_FAILURE,
Abhishek Singhbbe0b2a2016-12-05 11:57:36 +05302629 GFP_KERNEL);
James Zmudafbf5ffc2013-03-25 12:45:35 -07002630 }
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302631 /*Clear the roam profile*/
2632 hdd_clearRoamProfileIe( pAdapter );
Jeff Johnsone7245742012-09-05 17:12:55 -07002633 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002634
Kumar Anand82c009f2014-05-29 00:29:42 -07002635 hdd_wmm_init( pAdapter );
Madan Mohan Koyyalamudiee255f12012-09-28 15:41:19 -07002636
c_hpothu24f40982014-04-18 18:00:36 +05302637 if (pRoamInfo)
2638 {
2639 WLANTL_AssocFailed(pRoamInfo->staId);
2640 }
Mihir Sheteb7337272014-04-11 15:53:08 +05302641
Padma, Santhosh Kumar9dacb5c2014-12-17 19:22:56 +05302642 hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002643 netif_tx_disable(dev);
2644 netif_carrier_off(dev);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002645
Jeff Johnson295189b2012-06-20 16:38:30 -07002646 }
2647
Sushant Kaushikbf584e92014-08-06 17:59:20 +05302648 if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult)
Sushant Kaushikba6764e2014-06-30 19:52:09 +05302649 {
2650 pHostapdAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_SOFTAP);
2651 if (pHostapdAdapter != NULL)
2652 {
Sushant Kaushikbf584e92014-08-06 17:59:20 +05302653 /* Restart SAP if its operating channel is different
2654 * from AP channel.
2655 */
2656 if (pHostapdAdapter->sessionCtx.ap.operatingChannel !=
2657 (int)pRoamInfo->pBssDesc->channelId)
2658 {
2659 hddLog(VOS_TRACE_LEVEL_INFO,"Restart Sap as SAP channel is %d "
2660 "and STA channel is %d", pHostapdAdapter->sessionCtx.ap.operatingChannel,
2661 (int)pRoamInfo->pBssDesc->channelId);
Deepthi Gowric9c777d2014-12-10 16:17:11 +05302662 hdd_hostapd_stop(pHostapdAdapter->dev);
Agrawal Ashish574b3e62017-02-09 18:58:34 +05302663 if (pHddCtx->cfg_ini->enable_sap_auth_offload)
2664 hdd_force_scc_restart_sap(pHostapdAdapter,
2665 pHddCtx, (int)pRoamInfo->pBssDesc->channelId);
2666
Sushant Kaushikbf584e92014-08-06 17:59:20 +05302667 }
Sushant Kaushikba6764e2014-06-30 19:52:09 +05302668 }
2669 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002670 return eHAL_STATUS_SUCCESS;
2671}
2672
2673/**============================================================================
2674 *
Jeff Johnson81c17882013-05-03 09:53:35 -07002675 @brief hdd_RoamIbssIndicationHandler() - Here we update the status of the
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 Ibss when we receive information that we have started/joined an ibss session
Shailender Karmuchia734f332013-04-19 14:02:48 -07002677
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 ===========================================================================*/
Jeff Johnson81c17882013-05-03 09:53:35 -07002679static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter,
2680 tCsrRoamInfo *pRoamInfo,
2681 tANI_U32 roamId,
2682 eRoamCmdStatus roamStatus,
2683 eCsrRoamResult roamResult )
Jeff Johnson295189b2012-06-20 16:38:30 -07002684{
Katya Nigam47528772015-02-11 12:24:49 +05302685 hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
2686 v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
2687 struct cfg80211_bss *bss;
Abhishek Singhb25e8442015-06-23 14:28:05 +05302688 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Katya Nigam47528772015-02-11 12:24:49 +05302689
Jeff Johnson81c17882013-05-03 09:53:35 -07002690 hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d",
2691 __func__, pAdapter->dev->name, roamId, roamStatus, roamResult);
2692
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 switch( roamResult )
2694 {
2695 // both IBSS Started and IBSS Join should come in here.
2696 case eCSR_ROAM_RESULT_IBSS_STARTED:
2697 case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS:
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07002698 case eCSR_ROAM_RESULT_IBSS_COALESCED:
Jeff Johnson295189b2012-06-20 16:38:30 -07002699 {
Jeff Johnson81c17882013-05-03 09:53:35 -07002700 if (NULL == pRoamInfo)
2701 {
2702 VOS_ASSERT(0);
2703 return;
2704 }
2705
2706 /* When IBSS Started comes from CSR, we need to move
2707 * connection state to IBSS Disconnected (meaning no peers
2708 * are in the IBSS).
2709 */
Abhishek Singhf4669da2014-05-26 15:07:49 +05302710 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2711 "%s: Set HDD connState to eConnectionState_IbssDisconnected",
2712 __func__);
Jeff Johnson81c17882013-05-03 09:53:35 -07002713 hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
2714 eConnectionState_IbssDisconnected );
Abhishek Singh1c21c4d2014-04-25 16:40:19 +05302715 /*notify wmm */
2716 hdd_wmm_connect(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002717 pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter;
Jeff Johnson295189b2012-06-20 16:38:30 -07002718
Jeff Johnson81c17882013-05-03 09:53:35 -07002719 if (pRoamInfo->pBssDesc)
2720 {
Anand N Sunkadfec40682015-07-29 09:51:17 +05302721#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
2722 struct ieee80211_channel *chan;
2723 int chan_no;
2724 unsigned int freq;
2725#endif
Katya Nigam47528772015-02-11 12:24:49 +05302726 hdd_ibss_RegisterSTA (pAdapter, pRoamInfo,
2727 IBSS_BROADCAST_STAID,
2728 &broadcastMacAddr, pRoamInfo->pBssDesc);
Jeff Johnson81c17882013-05-03 09:53:35 -07002729
2730 /* we created the IBSS, notify supplicant */
2731 hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: created ibss "
2732 MAC_ADDRESS_STR,
2733 __func__, pAdapter->dev->name,
2734 MAC_ADDR_ARRAY(pRoamInfo->pBssDesc->bssId));
2735
2736 /* we must first give cfg80211 the BSS information */
2737 bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo);
2738 if (NULL == bss)
2739 {
2740 hddLog(VOS_TRACE_LEVEL_ERROR,
2741 "%s: %s: unable to create IBSS entry",
2742 __func__, pAdapter->dev->name);
2743 return;
2744 }
Abhishek Singh00b71972016-01-07 10:51:04 +05302745#ifdef WLAN_FEATURE_RMC
2746 netif_carrier_on(pAdapter->dev);
2747 hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
2748 netif_tx_start_all_queues(pAdapter->dev);
2749#endif
Anand N Sunkadfec40682015-07-29 09:51:17 +05302750#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
2751 chan_no = pRoamInfo->pBssDesc->channelId;
Jeff Johnson81c17882013-05-03 09:53:35 -07002752
Anand N Sunkadfec40682015-07-29 09:51:17 +05302753 if (chan_no <= 14)
2754 freq = ieee80211_channel_to_frequency(chan_no,
2755 IEEE80211_BAND_2GHZ);
2756 else
2757 freq = ieee80211_channel_to_frequency(chan_no,
2758 IEEE80211_BAND_5GHZ);
2759
2760 chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq);
2761
2762 if (chan)
2763 cfg80211_ibss_joined(pAdapter->dev, bss->bssid,
2764 chan, GFP_KERNEL);
2765 else
2766 hddLog(LOGE, FL("%s: chanId: %d, can't find channel"),
2767 pAdapter->dev->name,
2768 (int)pRoamInfo->pBssDesc->channelId);
2769#else
Jeff Johnson81c17882013-05-03 09:53:35 -07002770 cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL);
Anand N Sunkadfec40682015-07-29 09:51:17 +05302771#endif
Yue Maf49ba872013-08-19 12:04:25 -07002772 cfg80211_put_bss(
2773#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
2774 pHddCtx->wiphy,
2775#endif
2776 bss);
Jeff Johnson81c17882013-05-03 09:53:35 -07002777 }
Katya Nigam47528772015-02-11 12:24:49 +05302778 else
2779 {
2780 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
2781 "%s: NULL Bss Desc",__func__);
2782 }
Abhishek Singhb25e8442015-06-23 14:28:05 +05302783
2784 /* Set Broadcast key again in case IBSS_COALESCED as DEL BSS,
2785 * in IBSS_COALESCED will remove the BC key.
2786 */
2787 if ((eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) &&
2788 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY
2789 == pHddStaCtx->ibss_enc_key.encType
2790 ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY
2791 == pHddStaCtx->ibss_enc_key.encType
2792 ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType
2793 ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType ))
2794 {
2795 u8 grpmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
2796 VOS_STATUS vosStatus;
2797
2798 pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX;
2799
2800 memcpy(&pHddStaCtx->ibss_enc_key.peerMac,
2801 grpmacaddr, WNI_CFG_BSSID_LEN);
2802 hddLog(VOS_TRACE_LEVEL_INFO,
2803 FL(" SET GTK in case of COALESCED"));
2804 vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),
2805 pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId );
2806 if ( VOS_STATUS_SUCCESS != vosStatus )
2807 {
2808 hddLog(VOS_TRACE_LEVEL_ERROR,
2809 FL("sme_RoamSetKey failed, returned %d"),vosStatus);
2810 }
2811 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 break;
2813 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002814
Jeff Johnson295189b2012-06-20 16:38:30 -07002815 case eCSR_ROAM_RESULT_IBSS_START_FAILED:
2816 {
Jeff Johnson81c17882013-05-03 09:53:35 -07002817 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unable to create IBSS",
2818 __func__, pAdapter->dev->name);
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 break;
2820 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002821
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 default:
Jeff Johnson81c17882013-05-03 09:53:35 -07002823 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: %s: unexpected result %d",
2824 __func__, pAdapter->dev->name, (int)roamResult);
Jeff Johnson295189b2012-06-20 16:38:30 -07002825 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002826 }
2827
Jeff Johnson81c17882013-05-03 09:53:35 -07002828 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002829}
2830
2831/**============================================================================
2832 *
2833 @brief roamSaveIbssStation() - Save the IBSS peer MAC address in the adapter.
2834 This information is passed to iwconfig later. The peer that joined
2835 last is passed as information to iwconfig.
Shailender Karmuchia734f332013-04-19 14:02:48 -07002836 If we add HDD_MAX_NUM_IBSS_STA or less STA we return success else we
Jeff Johnson295189b2012-06-20 16:38:30 -07002837 return FALSE.
Shailender Karmuchia734f332013-04-19 14:02:48 -07002838
Jeff Johnson295189b2012-06-20 16:38:30 -07002839 ===========================================================================*/
Nirav Shah7e3c8132015-06-22 23:51:42 +05302840static int roamSaveIbssStation(hdd_adapter_t *pAdapter, v_U8_t staId, v_MACADDR_t *peerMacAddress)
Jeff Johnson295189b2012-06-20 16:38:30 -07002841{
2842 int fSuccess = FALSE;
2843 int idx = 0;
Nirav Shah7e3c8132015-06-22 23:51:42 +05302844 VOS_STATUS status;
2845 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002846
Jeff Johnson295189b2012-06-20 16:38:30 -07002847 for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
2848 {
2849 if ( 0 == pHddStaCtx->conn_info.staId[ idx ] )
2850 {
2851 pHddStaCtx->conn_info.staId[ idx ] = staId;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002852
Jeff Johnson295189b2012-06-20 16:38:30 -07002853 vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ], peerMacAddress );
Shailender Karmuchia734f332013-04-19 14:02:48 -07002854
Jeff Johnson295189b2012-06-20 16:38:30 -07002855 fSuccess = TRUE;
2856 break;
2857 }
2858 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07002859
Nirav Shah7e3c8132015-06-22 23:51:42 +05302860 status = hdd_sta_id_hash_add_entry(pAdapter, staId, peerMacAddress);
2861 if (status != VOS_STATUS_SUCCESS) {
2862 hddLog(VOS_TRACE_LEVEL_ERROR,
2863 FL("Not able to add staid hash %d"), staId);
2864 return FALSE;
2865 }
2866
2867 hddLog(VOS_TRACE_LEVEL_INFO,
2868 FL("New station added sta_id %d mac:"
2869 MAC_ADDRESS_STR), staId,
2870 MAC_ADDR_ARRAY(peerMacAddress->bytes));
2871
Shailender Karmuchia734f332013-04-19 14:02:48 -07002872 return( fSuccess );
Jeff Johnson295189b2012-06-20 16:38:30 -07002873}
2874/**============================================================================
2875 *
2876 @brief roamRemoveIbssStation() - Remove the IBSS peer MAC address in the adapter.
Shailender Karmuchia734f332013-04-19 14:02:48 -07002877 If we remove HDD_MAX_NUM_IBSS_STA or less STA we return success else we
Jeff Johnson295189b2012-06-20 16:38:30 -07002878 return FALSE.
Shailender Karmuchia734f332013-04-19 14:02:48 -07002879
Jeff Johnson295189b2012-06-20 16:38:30 -07002880 ===========================================================================*/
Ravi Joshicc57ed42013-10-12 16:31:25 -07002881static int roamRemoveIbssStation( hdd_adapter_t *pAdapter, v_U8_t staId )
Jeff Johnson295189b2012-06-20 16:38:30 -07002882{
2883 int fSuccess = FALSE;
2884 int idx = 0;
2885 v_U8_t valid_idx = 0;
2886 v_U8_t del_idx = 0;
Ravi Joshi8a934352013-09-25 16:46:58 -07002887 v_U8_t empty_slots = 0;
Ravi Joshicc57ed42013-10-12 16:31:25 -07002888 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Nirav Shah7e3c8132015-06-22 23:51:42 +05302889 VOS_STATUS status;
Shailender Karmuchia734f332013-04-19 14:02:48 -07002890
Jeff Johnson295189b2012-06-20 16:38:30 -07002891 for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ )
2892 {
2893 if ( staId == pHddStaCtx->conn_info.staId[ idx ] )
2894 {
2895 pHddStaCtx->conn_info.staId[ idx ] = 0;
Nirav Shah7e3c8132015-06-22 23:51:42 +05302896 status = hdd_sta_id_hash_remove_entry(pAdapter,
2897 staId, &pHddStaCtx->conn_info.peerMacAddress[idx]);
2898 if (status != VOS_STATUS_SUCCESS) {
2899 hddLog(VOS_TRACE_LEVEL_ERROR,
2900 FL("Not able to remove staid hash %d"), staId );
2901 fSuccess = FALSE;
2902 } else {
2903 hddLog(VOS_TRACE_LEVEL_INFO,
2904 FL("station removed sta_id %d mac:"
2905 MAC_ADDRESS_STR), staId,
2906 MAC_ADDR_ARRAY(pHddStaCtx->conn_info.peerMacAddress[idx].bytes));
Jeff Johnson295189b2012-06-20 16:38:30 -07002907
Nirav Shah7e3c8132015-06-22 23:51:42 +05302908 vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] );
Jeff Johnson295189b2012-06-20 16:38:30 -07002909
Nirav Shah7e3c8132015-06-22 23:51:42 +05302910 fSuccess = TRUE;
2911 // Note the deleted Index, if its 0 we need special handling
2912 del_idx = idx;
2913 empty_slots++;
2914 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 }
2916 else
2917 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07002918 if (pHddStaCtx->conn_info.staId[idx] != 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07002919 {
2920 valid_idx = idx;
2921 }
Ravi Joshi8a934352013-09-25 16:46:58 -07002922 else
2923 {
2924 // Found an empty slot
2925 empty_slots++;
2926 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002927 }
2928 }
2929
Ravi Joshi8a934352013-09-25 16:46:58 -07002930 if (HDD_MAX_NUM_IBSS_STA == empty_slots)
2931 {
2932 // Last peer departed, set the IBSS state appropriately
2933 pHddStaCtx->conn_info.connState = eConnectionState_IbssDisconnected;
Ravi Joshicc57ed42013-10-12 16:31:25 -07002934 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Ravi Joshi8a934352013-09-25 16:46:58 -07002935 "Last IBSS Peer Departed!!!" );
2936 }
2937
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 // Find next active staId, to have a valid sta trigger for TL.
2939 if (fSuccess == TRUE)
2940 {
2941 if (del_idx == 0)
2942 {
2943 if (pHddStaCtx->conn_info.staId[valid_idx] != 0)
2944 {
2945 pHddStaCtx->conn_info.staId[0] = pHddStaCtx->conn_info.staId[valid_idx];
2946 vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ 0 ],
2947 &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ]);
2948
2949 pHddStaCtx->conn_info.staId[valid_idx] = 0;
2950 vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ] );
2951 }
2952 }
2953 }
2954 return( fSuccess );
2955}
2956
2957/**============================================================================
2958 *
Shailender Karmuchia734f332013-04-19 14:02:48 -07002959 @brief roamIbssConnectHandler() : We update the status of the IBSS to
Jeff Johnson295189b2012-06-20 16:38:30 -07002960 connected in this function.
Shailender Karmuchia734f332013-04-19 14:02:48 -07002961
Jeff Johnson295189b2012-06-20 16:38:30 -07002962 ===========================================================================*/
2963static eHalStatus roamIbssConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo )
2964{
Shailender Karmuchi642e9812013-05-30 14:34:49 -07002965 struct cfg80211_bss *bss;
Abhishek Singhf4669da2014-05-26 15:07:49 +05302966 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2967 "%s: IBSS Connect Indication from SME!!! "
2968 "Set HDD connState to eConnectionState_IbssConnected",
2969 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002970 // Set the internal connection state to show 'IBSS Connected' (IBSS with a partner stations)...
2971 hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssConnected );
2972
2973 // Save the connection info from CSR...
2974 hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS );
2975
2976 // Send the bssid address to the wext.
2977 hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07002978 /* add bss_id to cfg80211 data base */
Shailender Karmuchi642e9812013-05-30 14:34:49 -07002979 bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo);
2980 if (NULL == bss)
2981 {
2982 hddLog(VOS_TRACE_LEVEL_ERROR,
2983 "%s: %s: unable to create IBSS entry",
2984 __func__, pAdapter->dev->name);
2985 return eHAL_STATUS_FAILURE;
2986 }
Yue Maf49ba872013-08-19 12:04:25 -07002987 cfg80211_put_bss(
2988#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
2989 WLAN_HDD_GET_CTX(pAdapter)->wiphy,
2990#endif
2991 bss);
Jeff Johnson295189b2012-06-20 16:38:30 -07002992
2993 return( eHAL_STATUS_SUCCESS );
2994}
Mukul Sharmad2589a52014-04-23 21:06:25 +05302995
2996/**============================================================================
2997 *
Jeff Johnson295189b2012-06-20 16:38:30 -07002998 @brief hdd_RoamSetKeyCompleteHandler() - Update the security parameters.
Shailender Karmuchia734f332013-04-19 14:02:48 -07002999
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 ===========================================================================*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07003001static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
3002 tANI_U32 roamId, eRoamCmdStatus roamStatus,
Jeff Johnson295189b2012-06-20 16:38:30 -07003003 eCsrRoamResult roamResult )
3004{
3005 eCsrEncryptionType connectedCipherAlgo;
3006 v_BOOL_t fConnected = FALSE;
3007 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
3008 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Bhargav Shaha805ef22015-07-29 17:31:38 +05303009 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05303011 WLANTL_STAStateType prevTLState = WLANTL_STA_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003012 ENTER();
Srinivas Girigowda5a737f22013-06-28 15:21:48 -07003013
3014 if (NULL == pRoamInfo)
3015 {
3016 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "pRoamInfo is NULL");
3017 return eHAL_STATUS_FAILURE;
3018 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 // if ( WPA ), tell TL to go to 'authenticated' after the keys are set.
Shailender Karmuchia734f332013-04-19 14:02:48 -07003020 // then go to 'authenticated'. For all other authentication types (those that do
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 // not require upper layer authentication) we can put TL directly into 'authenticated'
3022 // state.
Shailender Karmuchi642e9812013-05-30 14:34:49 -07003023 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
3024 "Set Key completion roamStatus =%d roamResult=%d " MAC_ADDRESS_STR,
3025 roamStatus, roamResult, MAC_ADDR_ARRAY(pRoamInfo->peerMac));
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003026
Jeff Johnson295189b2012-06-20 16:38:30 -07003027 fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
3028 if( fConnected )
3029 {
Shailender Karmuchi642e9812013-05-30 14:34:49 -07003030 if ( WLAN_HDD_IBSS == pAdapter->device_mode )
3031 {
3032 v_U8_t staId;
3033
3034 v_MACADDR_t broadcastMacAddr = VOS_MAC_ADDR_BROADCAST_INITIALIZER;
3035
3036 if ( 0 == memcmp( pRoamInfo->peerMac,
3037 &broadcastMacAddr, VOS_MAC_ADDR_SIZE ) )
3038 {
3039 vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext,
3040 IBSS_BROADCAST_STAID);
Abhishek Singhb25e8442015-06-23 14:28:05 +05303041 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
3042 "WLAN TL STA GTK Installed for STAID=%d", IBSS_BROADCAST_STAID);
Shailender Karmuchi642e9812013-05-30 14:34:49 -07003043 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
3044 }
3045 else
3046 {
3047 vosStatus = hdd_Ibss_GetStaId(pHddStaCtx,
3048 (v_MACADDR_t*)pRoamInfo->peerMac,
3049 &staId);
3050 if ( VOS_STATUS_SUCCESS == vosStatus )
3051 {
3052 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
3053 "WLAN TL STA Ptk Installed for STAID=%d", staId);
3054 vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext,
3055 staId);
3056 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
3057 }
3058 }
3059 }
3060 else
3061 {
Bhargav Shaha805ef22015-07-29 17:31:38 +05303062 WLANTL_GetSTAState(pHddCtx->pvosContext,
3063 pHddStaCtx->conn_info.staId[0],
3064 &prevTLState);
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05303065 // TODO: Considering getting a state machine in HDD later.
3066 // This routine is invoked twice. 1)set PTK 2)set GTK.
3067 // The folloing if statement will be TRUE when setting GTK.
3068 // At this time we don't handle the state in detail.
3069 // Related CR: 174048 - TL not in authenticated state
3070 if ( ( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) &&
3071 (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired )
3072 {
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05303073
3074 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set "
3075 "for StaId=%d. Changing TL state to AUTHENTICATED from"
3076 " state:%d", pHddStaCtx->conn_info.staId[0], prevTLState);
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05303077
3078 // Connections that do not need Upper layer authentication,
3079 // transition TL to 'Authenticated' state after the keys are set.
3080 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext,
3081 pHddStaCtx->conn_info.staId[ 0 ],
3082 WLANTL_STA_AUTHENTICATED );
3083
3084 pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05303085
3086 if (WLANTL_STA_AUTHENTICATED != prevTLState)
3087 hdd_postTLPacketPendingInd(pAdapter,
3088 pHddStaCtx->conn_info.staId[0]);
Mukul Sharmad2589a52014-04-23 21:06:25 +05303089 //Need to call offload because when roaming happen at that time fwr
3090 //clean offload info as part of the DelBss
3091 // No need to configure offload if host was not suspended
3092 spin_lock(&pHddCtx->filter_lock);
3093 if(pHddCtx->hdd_wlan_suspended)
3094 {
3095 spin_unlock(&pHddCtx->filter_lock);
3096 hdd_ReConfigSuspendDataClearedDuringRoaming(pHddCtx);
3097 }
3098 else
3099 {
3100 spin_unlock(&pHddCtx->filter_lock);
3101 }
Girish Gowlibf0e1ab2015-01-19 16:05:16 +05303102 if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
3103 {
3104 vos_record_roam_event(e_HDD_SET_GTK_RSP, NULL, 0);
3105 }
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05303106 }
3107 else
3108 {
3109 vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext,
3110 pHddStaCtx->conn_info.staId[ 0 ]);
Bhargav Shaha805ef22015-07-29 17:31:38 +05303111
3112 /* In case of OSEN move TL to 'Authenticated' after PTK is set */
3113 if (pWextState->roamProfile.bOSENAssociation == VOS_TRUE)
3114 {
3115 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "PTK set"
3116 " for StaId=%d. Due to OSEN, Changing TL state to"
3117 "AUTHENTICATED from state:%d",
3118 pHddStaCtx->conn_info.staId[0], prevTLState);
3119
3120 vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext,
3121 pHddStaCtx->conn_info.staId[ 0 ],
3122 WLANTL_STA_AUTHENTICATED );
3123
3124 pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE;
3125
3126 if (WLANTL_STA_AUTHENTICATED != prevTLState)
3127 hdd_postTLPacketPendingInd(pAdapter,
3128 pHddStaCtx->conn_info.staId[0]);
3129 }
3130
3131
3132
Girish Gowlibf0e1ab2015-01-19 16:05:16 +05303133 if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
3134 {
3135 vos_record_roam_event(e_HDD_SET_PTK_RSP, (void *)pRoamInfo->peerMac, 6);
3136 }
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05303137 }
3138
3139 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
Shailender Karmuchi642e9812013-05-30 14:34:49 -07003140 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003141 }
Gopichand Nakkalaecdebab2013-06-04 18:44:34 +05303142 else
3143 {
3144 // possible disassoc after issuing set key and waiting set key complete
3145 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
3146 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003147
Jeff Johnson295189b2012-06-20 16:38:30 -07003148 EXIT();
3149 return( eHAL_STATUS_SUCCESS );
3150}
3151/**============================================================================
3152 *
3153 @brief hdd_RoamMicErrorIndicationHandler() - This function indicates the Mic failure to the supplicant.
3154 ===========================================================================*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07003155static eHalStatus hdd_RoamMicErrorIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
Jeff Johnson295189b2012-06-20 16:38:30 -07003156 tANI_U32 roamId, eRoamCmdStatus roamStatus, eCsrRoamResult roamResult )
Shailender Karmuchia734f332013-04-19 14:02:48 -07003157{
Jeff Johnson295189b2012-06-20 16:38:30 -07003158 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
3159
3160 if( eConnectionState_Associated == pHddStaCtx->conn_info.connState &&
3161 TKIP_COUNTER_MEASURE_STOPED == pHddStaCtx->WextState.mTKIPCounterMeasures )
3162 {
3163 struct iw_michaelmicfailure msg;
3164 union iwreq_data wreq;
3165 memset(&msg, '\0', sizeof(msg));
3166 msg.src_addr.sa_family = ARPHRD_ETHER;
3167 memcpy(msg.src_addr.sa_data, pRoamInfo->u.pMICFailureInfo->taMacAddr, sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr));
Arif Hussain24bafea2013-11-15 15:10:03 -08003168 hddLog(LOG1, "MIC MAC " MAC_ADDRESS_STR,
3169 MAC_ADDR_ARRAY(msg.src_addr.sa_data));
Shailender Karmuchia734f332013-04-19 14:02:48 -07003170
Jeff Johnson295189b2012-06-20 16:38:30 -07003171 if(pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE)
3172 msg.flags = IW_MICFAILURE_GROUP;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003173 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003174 msg.flags = IW_MICFAILURE_PAIRWISE;
3175 memset(&wreq, 0, sizeof(wreq));
3176 wreq.data.length = sizeof(msg);
3177 wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, (char *)&msg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003178 /* inform mic failure to nl80211 */
Shailender Karmuchia734f332013-04-19 14:02:48 -07003179 cfg80211_michael_mic_failure(pAdapter->dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07003180 pRoamInfo->u.pMICFailureInfo->taMacAddr,
3181 ((pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) ?
3182 NL80211_KEYTYPE_GROUP :
3183 NL80211_KEYTYPE_PAIRWISE),
Shailender Karmuchia734f332013-04-19 14:02:48 -07003184 pRoamInfo->u.pMICFailureInfo->keyId,
3185 pRoamInfo->u.pMICFailureInfo->TSC,
Jeff Johnson295189b2012-06-20 16:38:30 -07003186 GFP_KERNEL);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003187
Jeff Johnson295189b2012-06-20 16:38:30 -07003188 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003189
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 return( eHAL_STATUS_SUCCESS );
3191}
3192
3193/**============================================================================
3194 *
Shailender Karmuchia734f332013-04-19 14:02:48 -07003195 @brief roamRoamConnectStatusUpdateHandler() - The Ibss connection status is
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 updated regularly here in this function.
Shailender Karmuchia734f332013-04-19 14:02:48 -07003197
Jeff Johnson295189b2012-06-20 16:38:30 -07003198 ===========================================================================*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07003199static eHalStatus roamRoamConnectStatusUpdateHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
3200 tANI_U32 roamId, eRoamCmdStatus roamStatus,
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 eCsrRoamResult roamResult )
3202{
3203 VOS_STATUS vosStatus;
3204
3205 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
3206 switch( roamResult )
3207 {
3208 case eCSR_ROAM_RESULT_IBSS_NEW_PEER:
3209 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003210 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
SaidiReddy Yenugabe255a62016-12-07 16:21:07 +05303211 struct station_info *staInfo;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003212
Deepthi Gowric7591cc2015-12-28 15:43:17 +05303213 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3214 "IBSS New Peer indication from SME with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d",
Shailender Karmuchia734f332013-04-19 14:02:48 -07003215 MAC_ADDR_ARRAY(pRoamInfo->peerMac),
3216 MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07003217 pRoamInfo->staId );
Shailender Karmuchia734f332013-04-19 14:02:48 -07003218
Jeff Johnson295189b2012-06-20 16:38:30 -07003219 pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter;
3220
Shailender Karmuchia734f332013-04-19 14:02:48 -07003221 pHddCtx->sta_to_adapter[IBSS_BROADCAST_STAID] = pAdapter;
3222 WLANTL_UpdateSTABssIdforIBSS(pHddCtx->pvosContext,
3223 IBSS_BROADCAST_STAID,pHddStaCtx->conn_info.bssId);
3224
3225 // Register the Station with TL for the new peer.
Katya Nigam47528772015-02-11 12:24:49 +05303226 vosStatus = hdd_ibss_RegisterSTA( pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -07003227 pRoamInfo,
3228 pRoamInfo->staId,
3229 (v_MACADDR_t *)pRoamInfo->peerMac,
3230 pRoamInfo->pBssDesc );
3231 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
3232 {
3233 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07003234 "Cannot register STA with TL for IBSS. Failed with vosStatus = %d [%08X]",
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 vosStatus, vosStatus );
3236 }
Abhishek Singhdecf1b62016-02-09 11:53:58 +05303237 if (!roamSaveIbssStation(pAdapter,
3238 pRoamInfo->staId,
3239 (v_MACADDR_t *)pRoamInfo->peerMac))
3240 {
3241 hddLog(LOGW, FL("Not Able to add sta in sta hash"));
3242 break;
3243 }
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07003244 pHddStaCtx->ibss_sta_generation++;
SaidiReddy Yenugabe255a62016-12-07 16:21:07 +05303245
3246 staInfo = vos_mem_malloc(sizeof(*staInfo));
3247 if (staInfo == NULL) {
3248 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3249 "memory allocation for station_info failed");
3250 return eHAL_STATUS_FAILED_ALLOC;
3251 }
3252
3253 memset(staInfo, 0, sizeof(*staInfo));
3254 staInfo->filled = 0;
3255 staInfo->generation = pHddStaCtx->ibss_sta_generation;
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07003256
3257 cfg80211_new_sta(pAdapter->dev,
3258 (const u8 *)pRoamInfo->peerMac,
SaidiReddy Yenugabe255a62016-12-07 16:21:07 +05303259 staInfo, GFP_KERNEL);
3260 vos_mem_free(staInfo);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003261
Shailender Karmuchi642e9812013-05-30 14:34:49 -07003262 if ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pHddStaCtx->ibss_enc_key.encType
3263 ||eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pHddStaCtx->ibss_enc_key.encType
3264 ||eCSR_ENCRYPT_TYPE_TKIP == pHddStaCtx->ibss_enc_key.encType
3265 ||eCSR_ENCRYPT_TYPE_AES == pHddStaCtx->ibss_enc_key.encType )
3266 {
3267 pHddStaCtx->ibss_enc_key.keyDirection = eSIR_TX_RX;
Abhishek Singhb25e8442015-06-23 14:28:05 +05303268
Shailender Karmuchi642e9812013-05-30 14:34:49 -07003269 memcpy(&pHddStaCtx->ibss_enc_key.peerMac,
3270 pRoamInfo->peerMac, WNI_CFG_BSSID_LEN);
3271
3272 VOS_TRACE( VOS_MODULE_ID_HDD,
Arif Hussain6d2a3322013-11-17 19:50:10 -08003273 VOS_TRACE_LEVEL_INFO_HIGH, "New peer joined set PTK encType=%d",
Shailender Karmuchi642e9812013-05-30 14:34:49 -07003274 pHddStaCtx->ibss_enc_key.encType);
3275
3276 vosStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),
3277 pAdapter->sessionId, &pHddStaCtx->ibss_enc_key, &roamId );
3278
3279 if ( VOS_STATUS_SUCCESS != vosStatus )
3280 {
3281 hddLog(VOS_TRACE_LEVEL_ERROR,
3282 "%s: sme_RoamSetKey failed, returned %d",
3283 __func__, vosStatus);
3284 return VOS_STATUS_E_FAILURE;
3285 }
3286 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003287 netif_carrier_on(pAdapter->dev);
Padma, Santhosh Kumar9dacb5c2014-12-17 19:22:56 +05303288 hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003289 netif_tx_start_all_queues(pAdapter->dev);
3290 break;
3291 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003292
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 case eCSR_ROAM_RESULT_IBSS_CONNECT:
3294 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003295
Jeff Johnson295189b2012-06-20 16:38:30 -07003296 roamIbssConnectHandler( pAdapter, pRoamInfo );
Shailender Karmuchia734f332013-04-19 14:02:48 -07003297
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003299 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003300 case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED:
3301 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003302 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07003303
Ravi Joshicc57ed42013-10-12 16:31:25 -07003304 if ( !roamRemoveIbssStation(pAdapter, pRoamInfo->staId ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07003305 {
3306 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
3307 "IBSS peer departed by cannot find peer in our registration table with TL" );
3308 }
3309
Deepthi Gowric7591cc2015-12-28 15:43:17 +05303310 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3311 "IBSS Peer Departed from SME with peerMac " MAC_ADDRESS_STR " BSSID: " MAC_ADDRESS_STR " and stationID= %d",
Shailender Karmuchia734f332013-04-19 14:02:48 -07003312 MAC_ADDR_ARRAY(pRoamInfo->peerMac),
3313 MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId),
3314 pRoamInfo->staId );
3315
Katya Nigam47528772015-02-11 12:24:49 +05303316 hdd_ibss_DeregisterSTA( pAdapter, pRoamInfo->staId );
Jeff Johnson295189b2012-06-20 16:38:30 -07003317
3318 pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL;
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07003319 pHddStaCtx->ibss_sta_generation++;
Ravi Joshicc57ed42013-10-12 16:31:25 -07003320
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07003321 cfg80211_del_sta(pAdapter->dev,
3322 (const u8 *)&pRoamInfo->peerMac,
3323 GFP_KERNEL);
Jeff Johnson295189b2012-06-20 16:38:30 -07003324 break;
3325 }
3326 case eCSR_ROAM_RESULT_IBSS_INACTIVE:
3327 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003328 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
3329 "Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME");
Jeff Johnson295189b2012-06-20 16:38:30 -07003330 // Stop only when we are inactive
Padma, Santhosh Kumar9dacb5c2014-12-17 19:22:56 +05303331 hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003332 netif_tx_disable(pAdapter->dev);
3333 netif_carrier_off(pAdapter->dev);
Abhishek Singhf4669da2014-05-26 15:07:49 +05303334 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
3335 "%s: Set HDD connState to eConnectionState_NotConnected",
3336 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003337 hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_NotConnected );
Shailender Karmuchia734f332013-04-19 14:02:48 -07003338
Jeff Johnson295189b2012-06-20 16:38:30 -07003339 // Send the bssid address to the wext.
3340 hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo);
3341 // clean up data path
3342 hdd_disconnect_tx_rx(pAdapter);
3343 break;
3344 }
3345 default:
3346 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003347
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003349
Jeff Johnson295189b2012-06-20 16:38:30 -07003350 return( eHAL_STATUS_SUCCESS );
3351}
3352
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003353#ifdef FEATURE_WLAN_TDLS
3354/**============================================================================
3355 *
3356 @brief hdd_roamRegisterTDLSSTA() - Construct the staDesc and register with
3357 TL the new STA. This is called as part of ADD_STA in the TDLS setup
3358 Return: VOS_STATUS
Shailender Karmuchia734f332013-04-19 14:02:48 -07003359
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003360 ===========================================================================*/
Anand N Sunkad9bfc2622015-07-30 15:18:54 +05303361VOS_STATUS hdd_roamRegisterTDLSSTA(hdd_adapter_t *pAdapter,
3362#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
3363 const tANI_U8 *peerMac,
3364#else
3365 tANI_U8 *peerMac,
3366#endif
3367 tANI_U16 staId, tANI_U8 ucastSig)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003368{
3369 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Shailender Karmuchia734f332013-04-19 14:02:48 -07003370 v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003371 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
3372 WLAN_STADescType staDesc = {0};
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003373 eCsrEncryptionType connectedCipherAlgo = eCSR_ENCRYPT_TYPE_UNKNOWN;
3374 v_BOOL_t fConnected = FALSE;
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07003375 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
3376 hdd_config_t *cfg_param = pHddCtx->cfg_ini;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003377
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003378 fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
3379 if (!fConnected) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003380 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003381 "%s not connected. ignored", __func__);
3382 return VOS_FALSE;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003383 }
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003384
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003385 /*
3386 * TDLS sta in BSS should be set as STA type TDLS and STA MAC should
3387 * be peer MAC, here we are wokrking on direct Link
3388 */
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003389 staDesc.ucSTAId = staId ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003390
3391 staDesc.wSTAType = WLAN_STA_TDLS ;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003392
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003393 vos_mem_copy( staDesc.vSTAMACAddress.bytes, peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003394 sizeof(tSirMacAddr) );
3395
3396 vos_mem_copy(staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 );
3397 vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent );
3398
3399 /* set the QoS field appropriately ..*/
3400 (hdd_wmm_is_active(pAdapter)) ? (staDesc.ucQosEnabled = 1)
3401 : (staDesc.ucQosEnabled = 0) ;
3402
3403 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "HDD register \
Arif Hussain6d2a3322013-11-17 19:50:10 -08003404 TL QoS_enabled=%d", staDesc.ucQosEnabled );
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003405
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003406 staDesc.ucProtectedFrame = (connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003407
3408 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
Arif Hussain6d2a3322013-11-17 19:50:10 -08003409 "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame );
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003410
Shailender Karmuchia734f332013-04-19 14:02:48 -07003411 /*
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003412 * UMA is ready we inform TL to do frame translation.
3413 */
3414 staDesc.ucSwFrameTXXlation = 1;
3415 staDesc.ucSwFrameRXXlation = 1;
3416 staDesc.ucAddRmvLLC = 1;
3417
3418 /* Initialize signatures and state */
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003419 staDesc.ucUcastSig = ucastSig ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003420
3421 /* tdls Direct Link do not need bcastSig */
3422 staDesc.ucBcastSig = 0 ;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003423
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003424 if(staDesc.ucProtectedFrame)
3425 staDesc.ucIsReplayCheckValid = VOS_TRUE;
3426 else
3427 staDesc.ucIsReplayCheckValid = VOS_FALSE;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003428
Gopichand Nakkala471708b2013-06-04 20:03:01 +05303429 staDesc.ucInitState = WLANTL_STA_CONNECTED ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003430
Shailender Karmuchia734f332013-04-19 14:02:48 -07003431 /* Register the Station with TL... */
3432 vosStatus = WLANTL_RegisterSTAClient( pVosContext,
3433 hdd_rx_packet_cbk,
3434 hdd_tx_complete_cbk,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003435 hdd_tx_fetch_packet_cbk, &staDesc, 0 );
Shailender Karmuchia734f332013-04-19 14:02:48 -07003436
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003437 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
3438 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07003439 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07003440 "%s: WLANTL_RegisterSTAClient() failed to register. "
3441 "Status= %d [0x%08X]", __func__, vosStatus, vosStatus );
Shailender Karmuchia734f332013-04-19 14:02:48 -07003442 return vosStatus;
3443 }
3444
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07003445 if ( cfg_param->dynSplitscan &&
3446 ( VOS_TIMER_STATE_RUNNING !=
3447 vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)) )
3448 {
3449 vos_timer_start(&pHddCtx->tx_rx_trafficTmr,
3450 cfg_param->trafficMntrTmrForSplitScan);
3451 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003452 return( vosStatus );
3453}
3454
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +05303455VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId )
Chauhan Rajeshb48f96d2013-01-24 21:00:15 -08003456{
3457 VOS_STATUS vosStatus;
3458 vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId );
3459 if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
3460 {
3461 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
3462 "%s: WLANTL_ClearSTAClient() failed to for staID %d. "
Jeff Johnson0299d0a2013-10-30 12:37:43 -07003463 "Status= %d [0x%08X]",
Chauhan Rajeshb48f96d2013-01-24 21:00:15 -08003464 __func__, staId, vosStatus, vosStatus );
3465 }
3466 return( vosStatus );
3467}
3468
3469
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003470/*
3471 * HDD interface between SME and TL to ensure TDLS client registration with
3472 * TL in case of new TDLS client is added and deregistration at the time
3473 * TDLS client is deleted.
3474 */
3475
Shailender Karmuchia734f332013-04-19 14:02:48 -07003476eHalStatus hdd_RoamTdlsStatusUpdateHandler(hdd_adapter_t *pAdapter,
3477 tCsrRoamInfo *pRoamInfo,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003478 tANI_U32 roamId,
Shailender Karmuchia734f332013-04-19 14:02:48 -07003479 eRoamCmdStatus roamStatus,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003480 eCsrRoamResult roamResult)
3481{
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003482 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003483 eHalStatus status = eHAL_STATUS_FAILURE ;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003484 tANI_U8 staIdx;
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003485
Kaushik, Sushant8489f472014-01-27 11:41:22 +05303486 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
Arif Hussain24bafea2013-11-15 15:10:03 -08003487 ("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR),
3488 roamResult == eCSR_ROAM_RESULT_ADD_TDLS_PEER ?
3489 "ADD_TDLS_PEER" :
3490 roamResult == eCSR_ROAM_RESULT_DELETE_TDLS_PEER ?
3491 "DEL_TDLS_PEER" :
3492 roamResult == eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ?
3493 "DEL_TDLS_PEER_IND" :
3494 roamResult == eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ?
3495 "DEL_ALL_TDLS_PEER_IND" :
3496 roamResult == eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ?
3497 "UPDATE_TDLS_PEER" :
3498 roamResult == eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ?
Masti, Narayanraddi36c67622016-01-06 16:07:34 +05303499 "LINK_ESTABLISH_REQ_RSP" :
3500 roamResult == eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP ?
3501 "CHANNEL_SWITCH_REQ_RSP" : "UNKNOWN",
Arif Hussain24bafea2013-11-15 15:10:03 -08003502 pRoamInfo->staId, MAC_ADDR_ARRAY(pRoamInfo->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003503 switch( roamResult )
3504 {
3505 case eCSR_ROAM_RESULT_ADD_TDLS_PEER:
3506 {
Lee Hoonkif987a0b2013-01-29 02:07:07 -08003507 if(eSIR_SME_SUCCESS != pRoamInfo->statusCode)
3508 {
Masti, Narayanraddi83dbfc22016-01-07 16:26:06 +05303509 hddTdlsPeer_t *curr_peer;
3510
Lee Hoonkif987a0b2013-01-29 02:07:07 -08003511 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003512 ("%s: Add Sta is failed. %d"),__func__, pRoamInfo->statusCode);
Ganesh Kondabattinif065c1f2015-08-05 23:05:23 +05303513 wlan_hdd_tdls_check_bmps(pAdapter);
Masti, Narayanraddi83dbfc22016-01-07 16:26:06 +05303514
3515 mutex_lock(&pHddCtx->tdls_lock);
3516 curr_peer = wlan_hdd_tdls_find_peer(pAdapter,
3517 pRoamInfo->peerMac, FALSE);
3518 if (NULL != curr_peer)
3519 curr_peer->link_status = eTDLS_LINK_TEARING;
3520 else
3521 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
3522 "%s %d curr_peer is Null", __func__,__LINE__);
3523 mutex_unlock(&pHddCtx->tdls_lock);
Lee Hoonkif987a0b2013-01-29 02:07:07 -08003524 }
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003525 else
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003526 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003527
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003528 /* check if there is available index for this new TDLS STA */
3529 for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ )
3530 {
3531 if (0 == pHddCtx->tdlsConnInfo[staIdx].staId )
3532 {
3533 pHddCtx->tdlsConnInfo[staIdx].sessionId = pRoamInfo->sessionId;
3534 pHddCtx->tdlsConnInfo[staIdx].staId = pRoamInfo->staId;
3535
3536 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Arif Hussain24bafea2013-11-15 15:10:03 -08003537 ("TDLS: STA IDX at %d is %d "
3538 "of mac " MAC_ADDRESS_STR),
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003539 staIdx, pHddCtx->tdlsConnInfo[staIdx].staId,
Arif Hussain24bafea2013-11-15 15:10:03 -08003540 MAC_ADDR_ARRAY(pRoamInfo->peerMac));
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003541
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003542 vos_copy_macaddr(&pHddCtx->tdlsConnInfo[staIdx].peerMac,
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003543 (v_MACADDR_t *)pRoamInfo->peerMac) ;
3544 status = eHAL_STATUS_SUCCESS ;
3545 break ;
3546 }
3547 }
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003548 if (staIdx < HDD_MAX_NUM_TDLS_STA)
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003549 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003550 if (-1 == wlan_hdd_tdls_set_sta_id(pAdapter, pRoamInfo->peerMac, pRoamInfo->staId)) {
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003551 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3552 "wlan_hdd_tdls_set_sta_id() failed");
3553 return VOS_FALSE;
3554 }
3555
3556 (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[pRoamInfo->staId] = pAdapter;
Gopichand Nakkala471708b2013-06-04 20:03:01 +05303557 /* store the ucast signature , if required for further reference. */
3558
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003559 wlan_hdd_tdls_set_signature( pAdapter, pRoamInfo->peerMac, pRoamInfo->ucastSig );
Gopichand Nakkala471708b2013-06-04 20:03:01 +05303560 /* start TDLS client registration with TL */
3561 status = hdd_roamRegisterTDLSSTA( pAdapter,
3562 pRoamInfo->peerMac,
3563 pRoamInfo->staId,
3564 pRoamInfo->ucastSig);
Pradeep Reddy POTTETIa9991b62015-03-26 18:03:19 +05303565 wlan_hdd_tdls_increment_peer_count(pAdapter);
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003566 }
3567 else
3568 {
Gopichand Nakkalab977a972013-02-18 19:15:09 -08003569 status = eHAL_STATUS_FAILURE;
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003570 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Hoonki Lee66b75f32013-04-16 18:30:07 -07003571 "%s: no available slot in conn_info. staId %d cannot be stored", __func__, pRoamInfo->staId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003572 }
Gopichand Nakkalab977a972013-02-18 19:15:09 -08003573 pAdapter->tdlsAddStaStatus = status;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003574 }
Hoonki Lee11f7dda2013-02-14 16:55:44 -08003575 complete(&pAdapter->tdls_add_station_comp);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003576 break ;
3577 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003578 case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER:
3579 {
3580 if (eSIR_SME_SUCCESS != pRoamInfo->statusCode)
3581 {
3582 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3583 "%s: Add Sta is failed. %d", __func__, pRoamInfo->statusCode);
3584 }
3585 /* store the ucast signature which will be used later when
3586 * registering to TL
3587 */
3588 pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode;
3589 complete(&pAdapter->tdls_add_station_comp);
3590 break;
3591 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05303592 case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP:
3593 {
3594 if (eSIR_SME_SUCCESS != pRoamInfo->statusCode)
3595 {
Masti, Narayanraddif10fd792015-12-15 15:01:01 +05303596 hddTdlsPeer_t *curr_peer;
3597
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05303598 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3599 "%s: Link Establish Request failed. %d", __func__, pRoamInfo->statusCode);
Masti, Narayanraddif10fd792015-12-15 15:01:01 +05303600
3601 mutex_lock(&pHddCtx->tdls_lock);
3602 curr_peer = wlan_hdd_tdls_find_peer(pAdapter,
3603 pRoamInfo->peerMac, FALSE);
3604 if (curr_peer)
3605 curr_peer->link_status = eTDLS_LINK_TEARING;
3606 else
3607 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3608 "%s %d curr_peer is Null",__func__,__LINE__);
3609 mutex_unlock(&pHddCtx->tdls_lock);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05303610 }
3611 complete(&pAdapter->tdls_link_establish_req_comp);
3612 break;
3613 }
Masti, Narayanraddi36c67622016-01-06 16:07:34 +05303614 case eCSR_ROAM_RESULT_CHANNEL_SWITCH_REQ_RSP:
3615 {
3616 if (eSIR_SME_SUCCESS != pRoamInfo->statusCode)
3617 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3618 "%s: Channel switch request failed. %d", __func__,
3619 pRoamInfo->statusCode);
3620 else
3621 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
3622 "%s: Channel switch request Success", __func__);
3623 break;
3624 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003625 case eCSR_ROAM_RESULT_DELETE_TDLS_PEER:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003626 {
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07003627 hddTdlsPeer_t *curr_peer;
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003628 for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003629 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003630 if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) &&
3631 pRoamInfo->staId == pHddCtx->tdlsConnInfo[staIdx].staId)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003632 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003633 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003634 ("HDD: del STA IDX = %x"), pRoamInfo->staId) ;
3635
Masti, Narayanraddi6b93b472015-09-04 17:48:11 +05303636 mutex_lock(&pHddCtx->tdls_lock);
3637 curr_peer = wlan_hdd_tdls_find_peer(pAdapter,
3638 pRoamInfo->peerMac, FALSE);
Agarwal Ashish9cd86382014-12-18 18:24:36 +05303639 if (NULL != curr_peer)
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07003640 {
Agarwal Ashish9cd86382014-12-18 18:24:36 +05303641 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
3642 " Current status for peer" MAC_ADDRESS_STR "is %d",
3643 MAC_ADDR_ARRAY(pRoamInfo->peerMac), curr_peer->link_status);
Pradeep Reddy POTTETIa9991b62015-03-26 18:03:19 +05303644 if (TDLS_IS_CONNECTED(curr_peer) ||
3645 (eTDLS_LINK_CONNECTING == curr_peer->link_status))
Agarwal Ashish9cd86382014-12-18 18:24:36 +05303646 {
Masti, Narayanraddi6b93b472015-09-04 17:48:11 +05303647 mutex_unlock(&pHddCtx->tdls_lock);
Agarwal Ashish9cd86382014-12-18 18:24:36 +05303648 hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId );
3649 }
Masti, Narayanraddi6b93b472015-09-04 17:48:11 +05303650 else
3651 mutex_unlock(&pHddCtx->tdls_lock);
3652
Pradeep Reddy POTTETIa9991b62015-03-26 18:03:19 +05303653 wlan_hdd_tdls_decrement_peer_count(pAdapter);
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07003654 }
Masti, Narayanraddi6b93b472015-09-04 17:48:11 +05303655 else
3656 mutex_unlock(&pHddCtx->tdls_lock);
3657
Masti, Narayanraddi9e4f4082015-10-17 16:05:15 +05303658 mutex_lock(&pHddCtx->tdls_lock);
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003659 wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac);
Masti, Narayanraddi9e4f4082015-10-17 16:05:15 +05303660 mutex_unlock(&pHddCtx->tdls_lock);
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003661
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003662 pHddCtx->tdlsConnInfo[staIdx].staId = 0 ;
3663 pHddCtx->tdlsConnInfo[staIdx].sessionId = 255;
3664 vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003665 sizeof(v_MACADDR_t)) ;
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003666 wlan_hdd_tdls_check_bmps(pAdapter);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003667 status = eHAL_STATUS_SUCCESS ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003668 break ;
3669 }
3670 }
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07003671 complete(&pAdapter->tdls_del_station_comp);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003672 }
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003673 break ;
Hoonki Leee6bfe942013-02-05 15:01:19 -08003674 case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND:
3675 {
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07003676 hddTdlsPeer_t *curr_peer;
Hoonki Leee6bfe942013-02-05 15:01:19 -08003677 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3678 "%s: Sending teardown to supplicant with reason code %u",
3679 __func__, pRoamInfo->reasonCode);
3680
3681#ifdef CONFIG_TDLS_IMPLICIT
Masti, Narayanraddi6b93b472015-09-04 17:48:11 +05303682 mutex_lock(&pHddCtx->tdls_lock);
3683 curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac,
3684 FALSE);
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07003685 wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, pRoamInfo->reasonCode);
Abhishek Singh96568922016-01-05 15:28:12 +05303686 hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT,
3687 curr_peer->peerMac);
Masti, Narayanraddi6b93b472015-09-04 17:48:11 +05303688 mutex_unlock(&pHddCtx->tdls_lock);
Hoonki Leee6bfe942013-02-05 15:01:19 -08003689#endif
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003690 status = eHAL_STATUS_SUCCESS ;
3691 break ;
3692 }
3693 case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND:
3694 {
3695 /* 0 staIdx is assigned to AP we dont want to touch that */
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003696 for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ )
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003697 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003698 if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) &&
3699 pHddCtx->tdlsConnInfo[staIdx].staId)
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003700 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003701 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Arif Hussain24bafea2013-11-15 15:10:03 -08003702 ("hdd_tdlsStatusUpdate: staIdx %d " MAC_ADDRESS_STR),
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003703 pHddCtx->tdlsConnInfo[staIdx].staId,
Arif Hussain24bafea2013-11-15 15:10:03 -08003704 MAC_ADDR_ARRAY(pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes));
Masti, Narayanraddi9e4f4082015-10-17 16:05:15 +05303705
3706 mutex_lock(&pHddCtx->tdls_lock);
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003707 wlan_hdd_tdls_reset_peer(pAdapter, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes);
Masti, Narayanraddi9e4f4082015-10-17 16:05:15 +05303708 mutex_unlock(&pHddCtx->tdls_lock);
3709
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003710 hdd_roamDeregisterTDLSSTA ( pAdapter, pHddCtx->tdlsConnInfo[staIdx].staId );
3711 wlan_hdd_tdls_decrement_peer_count(pAdapter);
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003712
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003713 vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac,
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003714 sizeof(v_MACADDR_t)) ;
Gopichand Nakkala4327a152013-03-04 23:22:42 -08003715 pHddCtx->tdlsConnInfo[staIdx].staId = 0 ;
3716 pHddCtx->tdlsConnInfo[staIdx].sessionId = 255;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003717
3718 status = eHAL_STATUS_SUCCESS ;
3719 }
3720 }
Gopichand Nakkala40ab2752013-04-04 20:11:36 +05303721 wlan_hdd_tdls_check_bmps(pAdapter);
Hoonki Leee6bfe942013-02-05 15:01:19 -08003722 break ;
3723 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08003724 default:
3725 {
3726 break ;
3727 }
3728 }
3729
3730 return status ;
3731}
3732#endif
3733
Arun Khandavalli7eeb1592015-10-19 21:36:57 +05303734void iw_full_power_cbfn (void *pContext, eHalStatus status)
Srinivas Girigowda1c3f72e2013-12-18 16:07:00 -08003735{
3736 hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext;
3737 hdd_context_t *pHddCtx = NULL;
3738 int ret;
3739
Hanumantha Reddy Pothula7dc0e6c2015-03-06 15:11:16 +05303740 ENTER();
3741
Srinivas Girigowda1c3f72e2013-12-18 16:07:00 -08003742 if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
3743 {
3744 hddLog(VOS_TRACE_LEVEL_ERROR,
Jeff Johnsonc135a9a2017-09-19 08:37:24 -07003745 "%s: Bad param, pAdapter [%pK]",
Srinivas Girigowda1c3f72e2013-12-18 16:07:00 -08003746 __func__, pAdapter);
3747 return;
3748 }
3749
3750 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
3751 ret = wlan_hdd_validate_context(pHddCtx);
3752 if (0 != ret)
3753 {
Srinivas Girigowda1c3f72e2013-12-18 16:07:00 -08003754 return;
3755 }
3756
3757 if (pHddCtx->cfg_ini->fIsBmpsEnabled)
3758 {
3759 sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), NULL, NULL);
3760 }
Hanumantha Reddy Pothula7dc0e6c2015-03-06 15:11:16 +05303761
3762 EXIT();
Srinivas Girigowda1c3f72e2013-12-18 16:07:00 -08003763}
3764
Shailender Karmuchia734f332013-04-19 14:02:48 -07003765eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId,
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 eRoamCmdStatus roamStatus, eCsrRoamResult roamResult )
3767{
3768 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
3769 hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext;
Pratik Bhalgatec625f72012-11-22 17:17:38 +05303770 hdd_wext_state_t *pWextState = NULL;
3771 hdd_station_ctx_t *pHddStaCtx = NULL;
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07003772 VOS_STATUS status = VOS_STATUS_SUCCESS;
Selvaraj, Sridhar59c50392016-06-09 17:08:05 +05303773 struct cfg80211_bss *bss_status;
Amar Singhal49fdfd52013-08-13 13:25:12 -07003774 hdd_context_t *pHddCtx = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003775
3776 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07003777 "CSR Callback: status= %d result= %d roamID=%d",
Shailender Karmuchia734f332013-04-19 14:02:48 -07003778 roamStatus, roamResult, roamId );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003779
3780 /*Sanity check*/
Pratik Bhalgatec625f72012-11-22 17:17:38 +05303781 if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003782 {
3783 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
Pratik Bhalgatec625f72012-11-22 17:17:38 +05303784 "invalid adapter or adapter has invalid magic");
3785 return eHAL_STATUS_FAILURE;
3786 }
3787
3788 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
3789 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
3790
3791 if ((NULL == pWextState) || (NULL == pHddStaCtx))
3792 {
3793 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
3794 "invalid WEXT state or HDD station context");
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003795 return eHAL_STATUS_FAILURE;
3796 }
3797
Konamki, Sreelakshmib9c45712015-07-29 11:48:19 +05303798 MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG,
3799 pAdapter->sessionId, roamStatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07003800 switch( roamStatus )
3801 {
3802 case eCSR_ROAM_SESSION_OPENED:
Sreelakshmi Konamki41d95e22015-08-28 12:51:32 +05303803 set_bit(SME_SESSION_OPENED, &pAdapter->event_flags);
3804 complete(&pAdapter->session_open_comp_var);
Jeff Johnson295189b2012-06-20 16:38:30 -07003805 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07003806
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003807#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
3808 /* We did pre-auth,then we attempted a 11r or ese reassoc.
Jeff Johnson295189b2012-06-20 16:38:30 -07003809 * reassoc failed due to failure, timeout, reject from ap
Shailender Karmuchia734f332013-04-19 14:02:48 -07003810 * in any case tell the OS, our carrier is off and mark
Jeff Johnson295189b2012-06-20 16:38:30 -07003811 * interface down */
3812 case eCSR_ROAM_FT_REASSOC_FAILED:
Agarwal Ashish971c2882013-10-30 20:11:12 +05303813 hddLog(LOGE, FL("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d"),
3814 roamStatus, roamResult, pAdapter->sessionId);
c_hpothuef45bc32014-09-11 10:10:18 +05303815 sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter));
Jeff Johnson295189b2012-06-20 16:38:30 -07003816 halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
3817 /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */
3818 if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) {
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE;
3820 }
3821 pHddStaCtx->ft_carrier_on = FALSE;
Kanchanapally, Vidyullathad883c652014-05-09 21:17:04 +05303822 pHddStaCtx->hdd_ReassocScenario = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003823 break;
3824
3825 case eCSR_ROAM_FT_START:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003826 // When we roam for EsE and 11r, we dont want the
Jeff Johnson295189b2012-06-20 16:38:30 -07003827 // OS to be informed that the link is down. So mark
Shailender Karmuchia734f332013-04-19 14:02:48 -07003828 // the link ready for ft_start. After this the
Jeff Johnson295189b2012-06-20 16:38:30 -07003829 // eCSR_ROAM_SHOULD_ROAM will be received.
3830 // Where in we will not mark the link down
3831 // Also we want to stop tx at this point when we will be
3832 // doing disassoc at this time. This saves 30-60 msec
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07003833 // after reassoc.
Jeff Johnson295189b2012-06-20 16:38:30 -07003834 {
3835 struct net_device *dev = pAdapter->dev;
Padma, Santhosh Kumar9dacb5c2014-12-17 19:22:56 +05303836 hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003837 netif_tx_disable(dev);
Girish Gowlibf0e1ab2015-01-19 16:05:16 +05303838 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
3839 if (pHddCtx->cfg_ini->gEnableRoamDelayStats)
3840 {
3841 vos_record_roam_event(e_HDD_DISABLE_TX_QUEUE, NULL, 0);
3842 }
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07003843 /*
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05303844 * Deregister this STA with TL, but do not flush the packets
3845 * for this STA from wmm_tx_queue. Since there is no valid STA
3846 * for these packets they will not be transmitted. Eventually
3847 * after the reassociation is successful, these packets will be
3848 * transmitted after registering STA with TL again. This ensures
3849 * that driver does not drop packets during roaming.
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07003850 */
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05303851 status = WLANTL_ClearSTAClient(pHddCtx->pvosContext,
3852 pHddStaCtx->conn_info.staId[0]);
3853 if (!VOS_IS_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07003854 {
Kanchanapally, Vidyullathaed969c62015-02-18 11:39:11 +05303855 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3856 FL("WLANTL_ClearSTAClient failed for staID %d."
3857 "Status= %d [0x%x]"), pHddStaCtx->conn_info.staId[0],
3858 status, status);
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07003859 halStatus = eHAL_STATUS_FAILURE;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07003860 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003861 }
3862 pHddStaCtx->ft_carrier_on = TRUE;
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07003863 pHddStaCtx->hdd_ReassocScenario = VOS_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003864 break;
3865#endif
3866
3867 case eCSR_ROAM_SHOULD_ROAM:
3868 // Dont need to do anything
3869 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003870 struct net_device *dev = pAdapter->dev;
3871 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
3872 // notify apps that we can't pass traffic anymore
Padma, Santhosh Kumar9dacb5c2014-12-17 19:22:56 +05303873 hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003874 netif_tx_disable(dev);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003875#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003876 if (pHddStaCtx->ft_carrier_on == FALSE)
3877 {
3878#endif
3879 netif_carrier_off(dev);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003880#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003881 }
3882#endif
3883
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003884#if !(defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR))
Jeff Johnson295189b2012-06-20 16:38:30 -07003885 //We should clear all sta register with TL, for now, only one.
3886 status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] );
3887 if ( !VOS_IS_STATUS_SUCCESS(status ) )
3888 {
3889 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
3890 FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"),
3891 pHddStaCtx->conn_info.staId[0], status, status );
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07003892 halStatus = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003893 }
Madan Mohan Koyyalamudi2d8cc892012-09-18 16:24:34 -07003894#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003895 }
3896 break;
3897 case eCSR_ROAM_LOSTLINK:
3898 case eCSR_ROAM_DISASSOCIATED:
3899 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003900 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
3901 "****eCSR_ROAM_DISASSOCIATED****");
c_hpothuef45bc32014-09-11 10:10:18 +05303902 sme_resetCoexEevent(WLAN_HDD_GET_HAL_CTX(pAdapter));
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
3904 /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */
Amar Singhal49fdfd52013-08-13 13:25:12 -07003905 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
3906 if (pHddCtx->hdd_mcastbcast_filter_set == TRUE)
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05303907 {
Amar Singhal49fdfd52013-08-13 13:25:12 -07003908 hdd_conf_mcastbcast_filter(pHddCtx, FALSE);
Amar Singhalf8ba2b82013-12-02 12:54:38 -08003909
3910 if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) {
3911 pHddCtx->configuredMcastBcastFilter =
3912 pHddCtx->sus_res_mcastbcast_filter;
3913 pHddCtx->sus_res_mcastbcast_filter_valid = VOS_FALSE;
3914 }
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05303915
Amar Singhald53568e2013-09-26 11:03:45 -07003916 hddLog(VOS_TRACE_LEVEL_INFO,
3917 "offload: disassociation happening, restoring configuredMcastBcastFilter");
3918 hddLog(VOS_TRACE_LEVEL_INFO,"McastBcastFilter = %d",
3919 pHddCtx->configuredMcastBcastFilter);
3920 hddLog(VOS_TRACE_LEVEL_INFO,
3921 "offload: already called mcastbcast filter");
Jeff Johnson295189b2012-06-20 16:38:30 -07003922 (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE;
3923 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07003924#ifdef WLAN_FEATURE_PACKET_FILTERING
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05303925 /* Call to clear any MC Addr List filter applied after
3926 * successful connection.
3927 */
3928 wlan_hdd_set_mc_addr_list(pAdapter, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003929#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003930 }
3931 break;
3932 case eCSR_ROAM_IBSS_LEAVE:
3933 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
3934 "****eCSR_ROAM_IBSS_LEAVE****");
3935 halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
3936 break;
3937 case eCSR_ROAM_ASSOCIATION_COMPLETION:
3938 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
3939 "****eCSR_ROAM_ASSOCIATION_COMPLETION****");
Abhishek Singh57a0bd92014-06-13 11:17:27 +05303940 // To Do - address probable memory leak with WEP encryption upon successful association
3941 if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult)
Jeff Johnson295189b2012-06-20 16:38:30 -07003942 {
Abhishek Singh57a0bd92014-06-13 11:17:27 +05303943 //Clear saved connection information in HDD
3944 hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 }
Abhishek Singh57a0bd92014-06-13 11:17:27 +05303946 halStatus = hdd_AssociationCompletionHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07003947
3948 break;
3949 case eCSR_ROAM_ASSOCIATION_FAILURE:
Shailender Karmuchia734f332013-04-19 14:02:48 -07003950 halStatus = hdd_AssociationCompletionHandler( pAdapter,
Jeff Johnson295189b2012-06-20 16:38:30 -07003951 pRoamInfo, roamId, roamStatus, roamResult );
3952 break;
3953 case eCSR_ROAM_IBSS_IND:
Jeff Johnson81c17882013-05-03 09:53:35 -07003954 hdd_RoamIbssIndicationHandler( pAdapter, pRoamInfo, roamId,
3955 roamStatus, roamResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07003956 break;
3957
3958 case eCSR_ROAM_CONNECT_STATUS_UPDATE:
3959 halStatus = roamRoamConnectStatusUpdateHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
Shailender Karmuchia734f332013-04-19 14:02:48 -07003960 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003961
3962 case eCSR_ROAM_MIC_ERROR_IND:
3963 halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
3964 break;
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +05303965 case eCSR_ROAM_LOST_LINK_PARAMS_IND:
3966 {
3967 /*
3968 * The RSSI will be subtracted from 100 as FW is sending the RSSI by
3969 * adding the 100 value.
3970 */
3971 pAdapter->rssi_on_disconnect = pRoamInfo->u.pLostLinkParams->rssi - 100;
3972 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
3973 "%s : Rssi on Disconnect : %d",
3974 __func__, pAdapter->rssi_on_disconnect);
3975 break;
3976 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003977 case eCSR_ROAM_SET_KEY_COMPLETE:
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07003978 {
3979 hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
3980
3981 if((pHddCtx) &&
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07003982 (TRUE == pHddCtx->hdd_wlan_suspended) &&
Padma, Santhosh Kumarc3eca802016-02-17 19:58:28 +05303983 ((eCSR_ROAM_RESULT_NONE == roamResult)||
Padma, Santhosh Kumarbb75a142016-02-25 18:36:46 +05303984 (pRoamInfo && pRoamInfo->is11rAssoc)))
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07003985 {
Srinivas Girigowdaeb03ee32013-07-16 11:48:41 -07003986 /* Send DTIM period to the FW; only if the wlan is already
3987 in suspend. This is the case with roaming (reassoc),
3988 DELETE_BSS_REQ zeroes out Modulated/Dynamic DTIM sent in
3989 previous suspend_wlan. Sending SET_POWER_PARAMS_REQ
3990 before the ENTER_BMPS_REQ ensures Listen Interval is
3991 regained back to LI * Modulated DTIM */
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07003992 hdd_set_pwrparams(pHddCtx);
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07003993
3994 /* At this point, device should not be in BMPS;
Srinivas Girigowdaeb03ee32013-07-16 11:48:41 -07003995 if due to unexpected scenario, if we are in BMPS,
3996 then trigger Exit and Enter BMPS to take DTIM period
3997 effective */
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07003998 if (BMPS == pmcGetPmcState(pHddCtx->hHal))
3999 {
4000 hddLog( LOGE, FL("Not expected: device is already in BMPS mode, Exit & Enter BMPS again!"));
4001
Srinivas Girigowda1c3f72e2013-12-18 16:07:00 -08004002 sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter),
4003 iw_full_power_cbfn, pAdapter,
4004 eSME_FULL_PWR_NEEDED_BY_HDD);
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07004005 }
4006 }
Padma, Santhosh Kumara4c34572015-07-09 20:00:41 +05304007
4008 if ((pHddCtx) &&
Padma, Santhosh Kumar0a623eb2015-07-27 11:55:29 +05304009 (FULL_POWER == pmcGetPmcState(pHddCtx->hHal)) &&
4010 (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) &&
Padma, Santhosh Kumarc3eca802016-02-17 19:58:28 +05304011 ((eCSR_ROAM_RESULT_NONE == roamResult) ||
Padma, Santhosh Kumarbb75a142016-02-25 18:36:46 +05304012 (pRoamInfo && pRoamInfo->is11rAssoc)))
Padma, Santhosh Kumara4c34572015-07-09 20:00:41 +05304013 {
4014 hddLog( LOG1, FL("Device in full power."
4015 "Stop and start traffic timer for roaming"));
4016 pmcStopTrafficTimer(pHddCtx->hHal);
4017 if (pmcStartTrafficTimer(pHddCtx->hHal,
4018 TRAFFIC_TIMER_ROAMING) != eHAL_STATUS_SUCCESS)
4019 {
4020 hddLog(LOGP, FL("Cannot start traffic timer"));
4021 }
4022 }
4023
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07004024 halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
Padma, Santhosh Kumarc3eca802016-02-17 19:58:28 +05304025 if ((eCSR_ROAM_RESULT_NONE == roamResult) ||
Padma, Santhosh Kumarbb75a142016-02-25 18:36:46 +05304026 (pRoamInfo && pRoamInfo->is11rAssoc))
Padma, Santhosh Kumar0a623eb2015-07-27 11:55:29 +05304027 pHddStaCtx->hdd_ReassocScenario = FALSE;
Srinivas Girigowda66c05eb2013-07-14 13:06:01 -07004028 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004029 break;
4030#ifdef WLAN_FEATURE_VOWIFI_11R
4031 case eCSR_ROAM_FT_RESPONSE:
4032 hdd_SendFTEvent(pAdapter);
4033 break;
4034#endif
Madan Mohan Koyyalamudi1b4afb02012-10-22 15:25:16 -07004035#if defined(FEATURE_WLAN_LFR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004036 case eCSR_ROAM_PMK_NOTIFY:
Shailender Karmuchia734f332013-04-19 14:02:48 -07004037 if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType)
Jeff Johnson43971f52012-07-17 12:26:56 -07004038 {
4039 /* Notify the supplicant of a new candidate */
4040 halStatus = wlan_hdd_cfg80211_pmksa_candidate_notify(pAdapter, pRoamInfo, 1, false);
4041 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004042 break;
4043#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004044
Yue Maef608272013-04-08 23:09:17 -07004045#ifdef FEATURE_WLAN_LFR_METRICS
4046 case eCSR_ROAM_PREAUTH_INIT_NOTIFY:
4047 /* This event is to notify pre-auth initiation */
4048 if (VOS_STATUS_SUCCESS !=
4049 wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, pRoamInfo))
4050 {
4051 halStatus = eHAL_STATUS_FAILURE;
4052 }
4053 break;
4054 case eCSR_ROAM_PREAUTH_STATUS_SUCCESS:
4055 /* This event will notify pre-auth completion in case of success */
4056 if (VOS_STATUS_SUCCESS !=
4057 wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter,
4058 pRoamInfo, 1))
4059 {
4060 halStatus = eHAL_STATUS_FAILURE;
4061 }
4062 break;
4063 case eCSR_ROAM_PREAUTH_STATUS_FAILURE:
4064 /* This event will notify pre-auth completion in case of failure. */
4065 if (VOS_STATUS_SUCCESS !=
4066 wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter,
4067 pRoamInfo, 0))
4068 {
4069 halStatus = eHAL_STATUS_FAILURE;
4070 }
4071 break;
4072 case eCSR_ROAM_HANDOVER_SUCCESS:
4073 /* This event is to notify handover success.
4074 It will be only invoked on success */
4075 if (VOS_STATUS_SUCCESS !=
4076 wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, pRoamInfo))
4077 {
4078 halStatus = eHAL_STATUS_FAILURE;
4079 }
4080 break;
4081#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004082 case eCSR_ROAM_REMAIN_CHAN_READY:
4083 hdd_remainChanReadyHandler( pAdapter );
4084 break;
4085 case eCSR_ROAM_SEND_ACTION_CNF:
4086 hdd_sendActionCnf( pAdapter,
4087 (roamResult == eCSR_ROAM_RESULT_NONE) ? TRUE : FALSE );
4088 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004089#ifdef FEATURE_WLAN_TDLS
Ng Chilamfc416462012-12-27 17:26:52 -08004090 case eCSR_ROAM_TDLS_STATUS_UPDATE:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08004091 halStatus = hdd_RoamTdlsStatusUpdateHandler( pAdapter, pRoamInfo,
Ng Chilamfc416462012-12-27 17:26:52 -08004092 roamId, roamStatus, roamResult );
4093 break ;
Gopichand Nakkalab977a972013-02-18 19:15:09 -08004094 case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND:
4095 wlan_hdd_tdls_mgmt_completion_callback(pAdapter, pRoamInfo->reasonCode);
4096 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004097#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07004098#ifdef WLAN_FEATURE_11W
4099 case eCSR_ROAM_UNPROT_MGMT_FRAME_IND:
4100 hdd_indicateUnprotMgmtFrame(pAdapter, pRoamInfo->nFrameLength,
4101 pRoamInfo->pbFrames,
4102 pRoamInfo->frameType);
4103 break;
4104#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004105#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004106 case eCSR_ROAM_TSM_IE_IND:
4107 hdd_indicateTsmIe(pAdapter, pRoamInfo->tsmIe.tsid,
4108 pRoamInfo->tsmIe.state, pRoamInfo->tsmIe.msmt_interval);
4109 break;
4110
4111 case eCSR_ROAM_CCKM_PREAUTH_NOTIFY:
4112 {
4113 if (eCSR_AUTH_TYPE_CCKM_WPA == pHddStaCtx->conn_info.authType ||
4114 eCSR_AUTH_TYPE_CCKM_RSN == pHddStaCtx->conn_info.authType)
4115 {
4116 hdd_indicateCckmPreAuth(pAdapter, pRoamInfo);
4117 }
4118 break;
4119 }
4120
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004121 case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND:
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004122 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004123 hdd_indicateEseAdjApRepInd(pAdapter, pRoamInfo);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004124 break;
4125 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004126
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004127 case eCSR_ROAM_ESE_BCN_REPORT_IND:
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004128 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004129 hdd_indicateEseBcnReportInd(pAdapter, pRoamInfo);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08004130 break;
4131 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004132#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Girish Gowlia95daca2015-02-04 20:31:31 +05304133 case eCSR_ROAM_UPDATE_MAX_RATE_IND:
4134 {
4135 pAdapter->maxRateFlags = roamResult;
4136 break;
4137 }
Selvaraj, Sridhar59c50392016-06-09 17:08:05 +05304138 case eCSR_ROAM_UPDATE_SCAN_RESULT:
4139 if (pRoamInfo && pRoamInfo->pBssDesc) {
4140 bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter,
4141 pRoamInfo->pBssDesc);
4142 if (bss_status)
4143 cfg80211_put_bss(
4144#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS)
4145 (WLAN_HDD_GET_CTX(pAdapter))->wiphy,
4146#endif
4147 bss_status);
4148 else
4149 hddLog(LOG1, FL("UPDATE_SCAN_RESULT returned NULL"));
4150 }
4151 break;
Girish Gowlia95daca2015-02-04 20:31:31 +05304152 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07004153 break;
4154 }
4155 return( halStatus );
4156}
Shailender Karmuchia734f332013-04-19 14:02:48 -07004157eCsrAuthType hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4])
Jeff Johnson295189b2012-06-20 16:38:30 -07004158{
4159 eCsrAuthType auth_type;
4160 // is the auth type supported?
Shailender Karmuchia734f332013-04-19 14:02:48 -07004161 if ( memcmp(auth_suite , ccpRSNOui01, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004162 {
4163 auth_type = eCSR_AUTH_TYPE_RSN;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004164 } else
4165 if (memcmp(auth_suite , ccpRSNOui02, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004166 {
4167 auth_type = eCSR_AUTH_TYPE_RSN_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004168 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004169#ifdef WLAN_FEATURE_VOWIFI_11R
Shailender Karmuchia734f332013-04-19 14:02:48 -07004170 if (memcmp(auth_suite , ccpRSNOui04, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004171 {
4172 // Check for 11r FT Authentication with PSK
4173 auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004174 } else
4175 if (memcmp(auth_suite , ccpRSNOui03, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004176 {
4177 // Check for 11R FT Authentication with 802.1X
4178 auth_type = eCSR_AUTH_TYPE_FT_RSN;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004179 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004180#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004181#ifdef FEATURE_WLAN_ESE
Shailender Karmuchia734f332013-04-19 14:02:48 -07004182 if (memcmp(auth_suite , ccpRSNOui06, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004183 {
4184 auth_type = eCSR_AUTH_TYPE_CCKM_RSN;
4185 } else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004186#endif /* FEATURE_WLAN_ESE */
Chet Lanctot186b5732013-03-18 10:26:30 -07004187#ifdef WLAN_FEATURE_11W
4188 if (memcmp(auth_suite , ccpRSNOui07, 4) == 0)
4189 {
4190 auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256;
4191 } else
Abhishek Singhae408032014-09-25 17:22:04 +05304192 if (memcmp(auth_suite , ccpRSNOui08, 4) == 0)
4193 {
4194 auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256;
4195 } else
Chet Lanctot186b5732013-03-18 10:26:30 -07004196#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07004197 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004198 auth_type = eCSR_AUTH_TYPE_UNKNOWN;
4199 }
4200 return auth_type;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004201}
Jeff Johnson7dda7772013-02-27 08:36:13 -08004202
Shailender Karmuchia734f332013-04-19 14:02:48 -07004203eCsrAuthType
4204hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4])
Jeff Johnson295189b2012-06-20 16:38:30 -07004205{
4206 eCsrAuthType auth_type;
4207 // is the auth type supported?
Shailender Karmuchia734f332013-04-19 14:02:48 -07004208 if ( memcmp(auth_suite , ccpWpaOui01, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004209 {
4210 auth_type = eCSR_AUTH_TYPE_WPA;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004211 } else
4212 if (memcmp(auth_suite , ccpWpaOui02, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004213 {
4214 auth_type = eCSR_AUTH_TYPE_WPA_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004215 } else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004216#ifdef FEATURE_WLAN_ESE
Shailender Karmuchia734f332013-04-19 14:02:48 -07004217 if (memcmp(auth_suite , ccpWpaOui06, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 {
4219 auth_type = eCSR_AUTH_TYPE_CCKM_WPA;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004220 } else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004221#endif /* FEATURE_WLAN_ESE */
Shailender Karmuchia734f332013-04-19 14:02:48 -07004222 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 auth_type = eCSR_AUTH_TYPE_UNKNOWN;
4224 }
4225 hddLog(LOG1, FL("auth_type: %d"), auth_type);
4226 return auth_type;
4227}
Jeff Johnson7dda7772013-02-27 08:36:13 -08004228
Shailender Karmuchia734f332013-04-19 14:02:48 -07004229eCsrEncryptionType
Jeff Johnson295189b2012-06-20 16:38:30 -07004230hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4])
Jeff Johnson295189b2012-06-20 16:38:30 -07004231{
4232 eCsrEncryptionType cipher_type;
4233 // is the cipher type supported?
Shailender Karmuchia734f332013-04-19 14:02:48 -07004234 if ( memcmp(cipher_suite , ccpRSNOui04, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004235 {
4236 cipher_type = eCSR_ENCRYPT_TYPE_AES;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004237 }
4238 else if (memcmp(cipher_suite , ccpRSNOui02, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004239 {
4240 cipher_type = eCSR_ENCRYPT_TYPE_TKIP;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004241 }
4242 else if (memcmp(cipher_suite , ccpRSNOui00, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004243 {
4244 cipher_type = eCSR_ENCRYPT_TYPE_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004245 }
4246 else if (memcmp(cipher_suite , ccpRSNOui01, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004247 {
4248 cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004249 }
4250 else if (memcmp(cipher_suite , ccpRSNOui05, 4) == 0)
4251 {
4252 cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4253 }
4254 else
4255 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004256 cipher_type = eCSR_ENCRYPT_TYPE_FAILED;
4257 }
4258 hddLog(LOG1, FL("cipher_type: %d"), cipher_type);
4259 return cipher_type;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004260}
Jeff Johnson295189b2012-06-20 16:38:30 -07004261/* To find if the MAC address is NULL */
4262static tANI_U8 hdd_IsMACAddrNULL (tANI_U8 *macAddr, tANI_U8 length)
4263{
4264 int i;
4265 for (i = 0; i < length; i++)
4266 {
4267 if (0x00 != (macAddr[i]))
4268 {
4269 return FALSE;
4270 }
4271 }
4272 return TRUE;
4273} /****** end hdd_IsMACAddrNULL() ******/
Jeff Johnson7dda7772013-02-27 08:36:13 -08004274
Shailender Karmuchia734f332013-04-19 14:02:48 -07004275eCsrEncryptionType
Jeff Johnson295189b2012-06-20 16:38:30 -07004276hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4])
Jeff Johnson295189b2012-06-20 16:38:30 -07004277{
4278 eCsrEncryptionType cipher_type;
4279 // is the cipher type supported?
Shailender Karmuchia734f332013-04-19 14:02:48 -07004280 if ( memcmp(cipher_suite , ccpWpaOui04, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 {
4282 cipher_type = eCSR_ENCRYPT_TYPE_AES;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004283 } else
4284 if (memcmp(cipher_suite , ccpWpaOui02, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004285 {
4286 cipher_type = eCSR_ENCRYPT_TYPE_TKIP;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004287 } else
4288 if (memcmp(cipher_suite , ccpWpaOui00, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004289 {
4290 cipher_type = eCSR_ENCRYPT_TYPE_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004291 } else
4292 if (memcmp(cipher_suite , ccpWpaOui01, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 {
4294 cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004295 } else
4296 if (memcmp(cipher_suite , ccpWpaOui05, 4) == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07004297 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07004298 cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4299 } else
4300 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004301 cipher_type = eCSR_ENCRYPT_TYPE_FAILED;
4302 }
4303 hddLog(LOG1, FL("cipher_type: %d"), cipher_type);
4304 return cipher_type;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004305}
Jeff Johnson295189b2012-06-20 16:38:30 -07004306
Shailender Karmuchia734f332013-04-19 14:02:48 -07004307static tANI_S32 hdd_ProcessGENIE(hdd_adapter_t *pAdapter,
4308 struct ether_addr *pBssid,
4309 eCsrEncryptionType *pEncryptType,
4310 eCsrEncryptionType *mcEncryptType,
4311 eCsrAuthType *pAuthType,
Chet Lanctot186b5732013-03-18 10:26:30 -07004312#ifdef WLAN_FEATURE_11W
4313 u_int8_t *pMfpRequired,
4314 u_int8_t *pMfpCapable,
4315#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07004316 u_int16_t gen_ie_len,
4317 u_int8_t *gen_ie)
Jeff Johnson295189b2012-06-20 16:38:30 -07004318{
4319 tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004320 eHalStatus result;
4321 tDot11fIERSN dot11RSNIE;
4322 tDot11fIEWPA dot11WPAIE;
4323 tANI_U32 i;
4324 tANI_U8 *pRsnIe;
4325 tANI_U16 RSNIeLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07004326 tPmkidCacheInfo PMKIDCache[4]; // Local transfer memory
Dhanashri Atre51981c62013-06-13 11:47:57 -07004327 v_BOOL_t updatePMKCache = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004328
4329 /* Clear struct of tDot11fIERSN and tDot11fIEWPA specifically setting present
4330 flag to 0 */
4331 memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) );
4332 memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) );
4333
Jeff Johnson295189b2012-06-20 16:38:30 -07004334 // Type check
Shailender Karmuchia734f332013-04-19 14:02:48 -07004335 if ( gen_ie[0] == DOT11F_EID_RSN)
4336 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004337 // Validity checks
Shailender Karmuchia734f332013-04-19 14:02:48 -07004338 if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) ||
Jeff Johnson295189b2012-06-20 16:38:30 -07004339 (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) )
4340 {
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05304341 hddLog(LOGE, "%s: Invalid DOT11F RSN IE length :%d\n",
4342 __func__, gen_ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07004343 return -EINVAL;
4344 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07004345 // Skip past the EID byte and length byte
4346 pRsnIe = gen_ie + 2;
4347 RSNIeLen = gen_ie_len - 2;
4348 // Unpack the RSN IE
4349 dot11fUnpackIeRSN((tpAniSirGlobal) halHandle,
4350 pRsnIe,
4351 RSNIeLen,
Jeff Johnson295189b2012-06-20 16:38:30 -07004352 &dot11RSNIE);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004353 // Copy out the encryption and authentication types
4354 hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004355 __func__, dot11RSNIE.pwise_cipher_suite_count );
Shailender Karmuchia734f332013-04-19 14:02:48 -07004356 hddLog(LOG1, FL("%s: authentication suite count: %d"),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004357 __func__, dot11RSNIE.akm_suite_count);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004358 /*Here we have followed the apple base code,
Jeff Johnson295189b2012-06-20 16:38:30 -07004359 but probably I suspect we can do something different*/
4360 //dot11RSNIE.akm_suite_count
Shailender Karmuchia734f332013-04-19 14:02:48 -07004361 // Just translate the FIRST one
4362 *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suites[0]);
4363 //dot11RSNIE.pwise_cipher_suite_count
4364 *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]);
4365 //dot11RSNIE.gp_cipher_suite_count
4366 *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite);
Chet Lanctot186b5732013-03-18 10:26:30 -07004367#ifdef WLAN_FEATURE_11W
4368 *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1 ;
4369 *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1 ;
4370#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004371 // Set the PMKSA ID Cache for this interface
Shailender Karmuchia734f332013-04-19 14:02:48 -07004372 for (i=0; i<dot11RSNIE.pmkid_count; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07004373 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07004374 if ( pBssid == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07004375 {
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05304376 hddLog(LOGE, "%s: pBssid passed is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004377 break;
4378 }
Dhanashri Atre51981c62013-06-13 11:47:57 -07004379 if ( hdd_IsMACAddrNULL( (u_char *) pBssid->ether_addr_octet , 6))
Jeff Johnson295189b2012-06-20 16:38:30 -07004380 {
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05304381 hddLog(LOGE, "%s: Invalid MAC adrr", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004382 break;
4383 }
Dhanashri Atre51981c62013-06-13 11:47:57 -07004384 updatePMKCache = TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004385 // For right now, I assume setASSOCIATE() has passed in the bssid.
4386 vos_mem_copy(PMKIDCache[i].BSSID,
4387 pBssid, ETHER_ADDR_LEN);
4388 vos_mem_copy(PMKIDCache[i].PMKID,
4389 dot11RSNIE.pmkid[i],
4390 CSR_RSN_PMKID_SIZE);
4391 }
Dhanashri Atre51981c62013-06-13 11:47:57 -07004392
4393 if (updatePMKCache)
4394 {
4395 // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache
Jeff Johnson0299d0a2013-10-30 12:37:43 -07004396 hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with cache entry %d."),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004397 __func__, i );
Dhanashri Atre51981c62013-06-13 11:47:57 -07004398 // Finally set the PMKSA ID Cache in CSR
4399 result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId,
4400 PMKIDCache,
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304401 dot11RSNIE.pmkid_count,
4402 FALSE);
Dhanashri Atre51981c62013-06-13 11:47:57 -07004403 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 }
4405 else if (gen_ie[0] == DOT11F_EID_WPA)
4406 {
4407 // Validity checks
4408 if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) ||
4409 (gen_ie_len > DOT11F_IE_WPA_MAX_LEN))
4410 {
Arun Kumar Khandavalli138f3c12013-12-13 16:24:33 +05304411 hddLog(LOGE, "%s: Invalid DOT11F WPA IE length :%d\n",
4412 __func__, gen_ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07004413 return -EINVAL;
4414 }
4415 // Skip past the EID byte and length byte - and four byte WiFi OUI
Shailender Karmuchia734f332013-04-19 14:02:48 -07004416 pRsnIe = gen_ie + 2 + 4;
4417 RSNIeLen = gen_ie_len - (2 + 4);
4418 // Unpack the WPA IE
Jeff Johnson295189b2012-06-20 16:38:30 -07004419 dot11fUnpackIeWPA((tpAniSirGlobal) halHandle,
4420 pRsnIe,
4421 RSNIeLen,
4422 &dot11WPAIE);
4423 // Copy out the encryption and authentication types
4424 hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004425 __func__, dot11WPAIE.unicast_cipher_count );
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 hddLog(LOG1, FL("%s: WPA authentication suite count: %d"),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004427 __func__, dot11WPAIE.auth_suite_count);
Jeff Johnson295189b2012-06-20 16:38:30 -07004428 //dot11WPAIE.auth_suite_count
4429 // Just translate the FIRST one
4430 *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]);
4431 //dot11WPAIE.unicast_cipher_count
4432 *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]);
4433 //dot11WPAIE.unicast_cipher_count
4434 *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher);
4435 }
4436 else
4437 {
4438 hddLog(LOGW, FL("gen_ie[0]: %d"), gen_ie[0]);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004439 return -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004440 }
4441 return 0;
4442}
4443int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType)
4444{
4445 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
4446 v_U32_t status = 0;
4447 eCsrEncryptionType RSNEncryptType;
4448 eCsrEncryptionType mcRSNEncryptType;
Chet Lanctot186b5732013-03-18 10:26:30 -07004449#ifdef WLAN_FEATURE_11W
Abhishek Singh4f6406d2015-10-07 13:43:52 +05304450 u_int8_t RSNMfpRequired = 0;
4451 u_int8_t RSNMfpCapable = 0;
Chet Lanctot186b5732013-03-18 10:26:30 -07004452#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004453 struct ether_addr bSsid; // MAC address of assoc peer
4454 // MAC address of assoc peer
4455 // But, this routine is only called when we are NOT associated.
4456 vos_mem_copy(bSsid.ether_addr_octet,
4457 pWextState->roamProfile.BSSIDs.bssid,
4458 sizeof(bSsid.ether_addr_octet));
4459 if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN || pWextState->WPARSNIE[0] == DOT11F_EID_WPA)
4460 {
4461 //continue
Shailender Karmuchia734f332013-04-19 14:02:48 -07004462 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 else
4464 {
4465 return 0;
4466 }
4467 // The actual processing may eventually be more extensive than this.
4468 // Right now, just consume any PMKIDs that are sent in by the app.
4469 status = hdd_ProcessGENIE(pAdapter,
4470 &bSsid, // MAC address of assoc peer
4471 &RSNEncryptType,
4472 &mcRSNEncryptType,
4473 RSNAuthType,
Chet Lanctot186b5732013-03-18 10:26:30 -07004474#ifdef WLAN_FEATURE_11W
4475 &RSNMfpRequired,
4476 &RSNMfpCapable,
4477#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 pWextState->WPARSNIE[1]+2,
4479 pWextState->WPARSNIE);
4480 if (status == 0)
4481 {
4482 // Now copy over all the security attributes you have parsed out
4483 pWextState->roamProfile.EncryptionType.numEntries = 1;
4484 pWextState->roamProfile.mcEncryptionType.numEntries = 1;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004485
Jeff Johnson295189b2012-06-20 16:38:30 -07004486 pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; // Use the cipher type in the RSN IE
4487 pWextState->roamProfile.mcEncryptionType.encryptionType[0] = mcRSNEncryptType;
Chet Lanctot186b5732013-03-18 10:26:30 -07004488
Shailender Karmuchi642e9812013-05-30 14:34:49 -07004489 if ( (WLAN_HDD_IBSS == pAdapter->device_mode) &&
4490 ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) ||
4491 (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType)))
4492 {
4493 /*For wpa none supplicant sends the WPA IE with unicast cipher as
4494 eCSR_ENCRYPT_TYPE_NONE ,where as the multicast cipher as
4495 either AES/TKIP based on group cipher configuration
4496 mentioned in the wpa_supplicant.conf.*/
4497
4498 /*Set the unicast cipher same as multicast cipher*/
4499 pWextState->roamProfile.EncryptionType.encryptionType[0]
4500 = mcRSNEncryptType;
4501 }
4502
Chet Lanctot186b5732013-03-18 10:26:30 -07004503#ifdef WLAN_FEATURE_11W
Abhishek Singh4f6406d2015-10-07 13:43:52 +05304504 hddLog( LOG1, FL("RSNMfpRequired = %d, RSNMfpCapable = %d"),
4505 RSNMfpRequired, RSNMfpCapable);
Chet Lanctot186b5732013-03-18 10:26:30 -07004506 pWextState->roamProfile.MFPRequired = RSNMfpRequired;
4507 pWextState->roamProfile.MFPCapable = RSNMfpCapable;
4508#endif
Abhishek Singh4f6406d2015-10-07 13:43:52 +05304509 hddLog( LOG1,
4510 FL("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d"),
4511 *RSNAuthType, RSNEncryptType, mcRSNEncryptType);
Jeff Johnson295189b2012-06-20 16:38:30 -07004512 }
4513 return 0;
4514}
4515int hdd_set_csr_auth_type ( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType)
4516{
4517 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
4518 tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile);
4519 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
4520 ENTER();
Shailender Karmuchia734f332013-04-19 14:02:48 -07004521
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 pRoamProfile->AuthType.numEntries = 1;
Arif Hussain6d2a3322013-11-17 19:50:10 -08004523 hddLog( LOG1, "%s: pHddStaCtx->conn_info.authType = %d", __func__, pHddStaCtx->conn_info.authType);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004524
Jeff Johnson295189b2012-06-20 16:38:30 -07004525 switch( pHddStaCtx->conn_info.authType)
4526 {
4527 case eCSR_AUTH_TYPE_OPEN_SYSTEM:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004528#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 case eCSR_AUTH_TYPE_CCKM_WPA:
4530 case eCSR_AUTH_TYPE_CCKM_RSN:
4531#endif
Shailender Karmuchia734f332013-04-19 14:02:48 -07004532 if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) {
4533
Jeff Johnson295189b2012-06-20 16:38:30 -07004534 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM ;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004535 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07004537
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004538#ifdef FEATURE_WLAN_ESE
Shailender Karmuchia734f332013-04-19 14:02:48 -07004539 if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) &&
4540 ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
4541 == IW_AUTH_KEY_MGMT_802_1X)) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004542 hddLog( LOG1, "%s: set authType to CCKM WPA. AKM also 802.1X.", __func__);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004543 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA;
4544 } else
4545 if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA)) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004546 hddLog( LOG1, "%s: Last chance to set authType to CCKM WPA.", __func__);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004547 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA;
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 } else
4549#endif
4550 if((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
4551 == IW_AUTH_KEY_MGMT_802_1X) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07004552 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA;
4553 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004554 if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK)
4555 == IW_AUTH_KEY_MGMT_PSK) {
4556 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004557 } else {
Jeff Johnson295189b2012-06-20 16:38:30 -07004558 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004559 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004560 }
4561 if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004562#ifdef FEATURE_WLAN_ESE
Shailender Karmuchia734f332013-04-19 14:02:48 -07004563 if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) &&
4564 ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
4565 == IW_AUTH_KEY_MGMT_802_1X)) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004566 hddLog( LOG1, "%s: set authType to CCKM RSN. AKM also 802.1X.", __func__);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004567 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN;
Jeff Johnson295189b2012-06-20 16:38:30 -07004568 } else
Shailender Karmuchia734f332013-04-19 14:02:48 -07004569 if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN)) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004570 hddLog( LOG1, "%s: Last chance to set authType to CCKM RSN.", __func__);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004571 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN;
Jeff Johnson295189b2012-06-20 16:38:30 -07004572 } else
4573#endif
4574
4575#ifdef WLAN_FEATURE_VOWIFI_11R
Shailender Karmuchia734f332013-04-19 14:02:48 -07004576 if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) &&
4577 ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
Jeff Johnson295189b2012-06-20 16:38:30 -07004578 == IW_AUTH_KEY_MGMT_802_1X)) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07004579 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN;
Jeff Johnson43971f52012-07-17 12:26:56 -07004580 }else
Shailender Karmuchia734f332013-04-19 14:02:48 -07004581 if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK)
4583 == IW_AUTH_KEY_MGMT_PSK)) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07004584 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN_PSK;
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 } else
4586#endif
4587
Chet Lanctot186b5732013-03-18 10:26:30 -07004588#ifdef WLAN_FEATURE_11W
4589 if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) {
4590 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK_SHA256;
4591 } else
Abhishek Singhae408032014-09-25 17:22:04 +05304592 if (RSNAuthType == eCSR_AUTH_TYPE_RSN_8021X_SHA256) {
4593 pRoamProfile->AuthType.authType[0] =
4594 eCSR_AUTH_TYPE_RSN_8021X_SHA256;
4595 } else
Chet Lanctot186b5732013-03-18 10:26:30 -07004596#endif
4597
Shailender Karmuchia734f332013-04-19 14:02:48 -07004598 if( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)
Jeff Johnson295189b2012-06-20 16:38:30 -07004599 == IW_AUTH_KEY_MGMT_802_1X) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07004600 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN;
4601 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004602 if ( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK)
4603 == IW_AUTH_KEY_MGMT_PSK) {
4604 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004605 } else {
Jeff Johnson295189b2012-06-20 16:38:30 -07004606 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004607 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004608 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07004609 break;
4610
Jeff Johnson295189b2012-06-20 16:38:30 -07004611 case eCSR_AUTH_TYPE_SHARED_KEY:
Shailender Karmuchia734f332013-04-19 14:02:48 -07004612
4613 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY;
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 break;
4615 default:
Shailender Karmuchia734f332013-04-19 14:02:48 -07004616
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004617#ifdef FEATURE_WLAN_ESE
Arif Hussain6d2a3322013-11-17 19:50:10 -08004618 hddLog( LOG1, "%s: In default, unknown auth type.", __func__);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004619#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -07004620 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN;
4621 break;
4622 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07004623
Jeff Johnson295189b2012-06-20 16:38:30 -07004624 hddLog( LOG1, "%s Set roam Authtype to %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004625 __func__, pWextState->roamProfile.AuthType.authType[0]);
Shailender Karmuchia734f332013-04-19 14:02:48 -07004626
Jeff Johnson295189b2012-06-20 16:38:30 -07004627 EXIT();
4628 return 0;
4629}
4630
Sravan Kumar Kairam091e5b62017-01-23 14:14:20 +05304631/**
4632 * hdd_rx_fwd_eapol() - forward cached eapol frames
4633 * @vosContext : pointer to vos global context
4634 * @pVosPacket: pointer to vos packet
4635 *
4636 * Return: None
4637 *
4638 */
4639void hdd_assoc_registerFwdEapolCB(void *pContext)
4640{
4641 WLANTL_RegisterFwdEapol(pContext, hdd_rx_fwd_eapol);
4642}
4643
Jeff Johnson295189b2012-06-20 16:38:30 -07004644/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07004645
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05304646 \brief __iw_set_essid() -
Jeff Johnson295189b2012-06-20 16:38:30 -07004647 This function sets the ssid received from wpa_supplicant
Shailender Karmuchia734f332013-04-19 14:02:48 -07004648 to the CSR roam profile.
4649
Jeff Johnson295189b2012-06-20 16:38:30 -07004650 \param - dev - Pointer to the net device.
4651 - info - Pointer to the iw_request_info.
4652 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07004653 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07004654 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07004655
Jeff Johnson295189b2012-06-20 16:38:30 -07004656 --------------------------------------------------------------------------*/
4657
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05304658int __iw_set_essid(struct net_device *dev,
4659 struct iw_request_info *info,
4660 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07004661{
4662 v_U32_t status = 0;
4663 hdd_wext_state_t *pWextState;
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304664 hdd_adapter_t *pAdapter;
4665 hdd_context_t *pHddCtx;
Jeff Johnson295189b2012-06-20 16:38:30 -07004666 v_U32_t roamId;
4667 tCsrRoamProfile *pRoamProfile;
Jeff Johnson295189b2012-06-20 16:38:30 -07004668 eCsrAuthType RSNAuthType;
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304669 tHalHandle hHal;
4670 hdd_station_ctx_t *pHddStaCtx;
4671 int ret = 0;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004672
Jeff Johnson295189b2012-06-20 16:38:30 -07004673 ENTER();
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304674 pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
4675 if (NULL == pAdapter)
Jeff Johnson295189b2012-06-20 16:38:30 -07004676 {
Agarwal Ashish971c2882013-10-30 20:11:12 +05304677 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304678 "%s: Adapter is NULL",__func__);
4679 return -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004680 }
4681
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304682 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
4683 ret = wlan_hdd_validate_context(pHddCtx);
4684 if (0 != ret)
4685 {
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304686 return ret;
4687 }
4688
4689 hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
4690 if (NULL == hHal)
4691 {
4692 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4693 "%s: Hal Context is NULL",__func__);
4694 return -EINVAL;
4695 }
4696 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
4697 if (NULL == pHddStaCtx)
4698 {
4699 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4700 "%s: STA Context is NULL",__func__);
4701 return -EINVAL;
4702 }
4703 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
4704 if (NULL == pWextState)
4705 {
4706 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4707 "%s: pWextState is NULL",__func__);
4708 return -EINVAL;
4709 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004710 if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) {
4711 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__);
4712 return -EBUSY;
4713 }
4714 if( SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length )
4715 return -EINVAL;
4716 pRoamProfile = &pWextState->roamProfile;
Jeff Johnson295189b2012-06-20 16:38:30 -07004717
Agrawal Ashishc407f192017-01-23 17:18:35 +05304718 /*Try disconnecting if already in connected state*/
4719 status = wlan_hdd_try_disconnect(pAdapter);
4720 if (0 > status)
Jeff Johnson295189b2012-06-20 16:38:30 -07004721 {
Agrawal Ashishc407f192017-01-23 17:18:35 +05304722 hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing"
4723 " connection"));
4724 return -EALREADY;
Jeff Johnson295189b2012-06-20 16:38:30 -07004725 }
4726 /** wpa_supplicant 0.8.x, wext driver uses */
Shailender Karmuchia734f332013-04-19 14:02:48 -07004727 /** when cfg80211 defined, wpa_supplicant wext driver uses
4728 zero-length, null-string ssid for force disconnection.
4729 after disconnection (if previously connected) and cleaning ssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07004730 driver MUST return success */
4731 if ( 0 == wrqu->essid.length ) {
4732 return 0;
4733 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004734
4735 status = hdd_wmm_get_uapsd_mask(pAdapter,
4736 &pWextState->roamProfile.uapsd_mask);
4737 if (VOS_STATUS_SUCCESS != status)
4738 {
4739 pWextState->roamProfile.uapsd_mask = 0;
4740 }
4741 pWextState->roamProfile.SSIDs.numOfSSIDs = 1;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004742
Jeff Johnson295189b2012-06-20 16:38:30 -07004743 pWextState->roamProfile.SSIDs.SSIDList->SSID.length = wrqu->essid.length;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004744
4745 vos_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004746 vos_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId), extra, wrqu->essid.length);
4747 if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion ||
4748 IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion ) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07004749
Jeff Johnson295189b2012-06-20 16:38:30 -07004750 //set gen ie
4751 hdd_SetGENIEToCsr(pAdapter, &RSNAuthType);
4752
4753 //set auth
4754 hdd_set_csr_auth_type(pAdapter, RSNAuthType);
4755 }
4756#ifdef FEATURE_WLAN_WAPI
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004757 hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004758 if (pAdapter->wapi_info.nWapiMode)
4759 {
4760 switch (pAdapter->wapi_info.wapiAuthMode)
4761 {
4762 case WAPI_AUTH_MODE_PSK:
4763 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004764 hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, pAdapter->wapi_info.wapiAuthMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004765 pRoamProfile->AuthType.numEntries = 1;
4766 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK;
4767 break;
4768 }
4769 case WAPI_AUTH_MODE_CERT:
4770 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004771 hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, pAdapter->wapi_info.wapiAuthMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004772 pRoamProfile->AuthType.numEntries = 1;
4773 pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
4774 break;
4775 }
4776 } // End of switch
4777 if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK ||
4778 pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT)
4779 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004780 hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004781 pRoamProfile->EncryptionType.numEntries = 1;
4782 pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI;
4783 pRoamProfile->mcEncryptionType.numEntries = 1;
4784 pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI;
4785 }
4786 }
4787#endif /* FEATURE_WLAN_WAPI */
4788 /* if previous genIE is not NULL, update AssocIE */
4789 if (0 != pWextState->genIE.length)
4790 {
4791 memset( &pWextState->assocAddIE, 0, sizeof(pWextState->assocAddIE) );
4792 memcpy( pWextState->assocAddIE.addIEdata, pWextState->genIE.addIEdata,
4793 pWextState->genIE.length);
4794 pWextState->assocAddIE.length = pWextState->genIE.length;
4795 pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata;
4796 pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length;
4797
4798 /* clear previous genIE after use it */
4799 memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) );
4800 }
4801
4802 /* assumes it is not WPS Association by default, except when pAddIEAssoc has WPS IE */
4803 pWextState->roamProfile.bWPSAssociation = FALSE;
4804
4805 if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc,
4806 pWextState->roamProfile.nAddIEAssocLength))
4807 pWextState->roamProfile.bWPSAssociation = TRUE;
4808
4809
4810 // Disable auto BMPS entry by PMC until DHCP is done
4811 sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), TRUE);
4812
Shailender Karmuchia734f332013-04-19 14:02:48 -07004813 pWextState->roamProfile.csrPersona = pAdapter->device_mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004815
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07004816 if ( eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType )
4817 {
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07004818 hdd_select_cbmode(pAdapter,
4819 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->AdHocChannel5G);
4820 }
Agarwal Ashish40f9b872015-09-01 16:17:35 +05304821 /*
4822 * Change conn_state to connecting before sme_RoamConnect(),
4823 * because sme_RoamConnect() has a direct path to call
4824 * hdd_smeRoamCallback(), which will change the conn_state
4825 * If direct path, conn_state will be accordingly changed
4826 * to NotConnected or Associated by either
4827 * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler()
4828 * in sme_RoamCallback()
4829 * if sme_RomConnect is to be queued,
4830 * Connecting state will remain until it is completed.
4831 *
4832 * If connection state is not changed,
4833 * connection state will remain in eConnectionState_NotConnected state.
4834 * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true
4835 * if conn state is eConnectionState_NotConnected.
4836 * If "hddDisconInProgress" is set to true then cfg80211 layer is not
4837 * informed of connect result indication which is an issue.
4838 */
4839 if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode ||
4840 WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
4841 {
4842 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
4843 FL("Set HDD connState to eConnectionState_Connecting"));
4844 hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
4845 eConnectionState_Connecting);
4846 }
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07004847 status = sme_RoamConnect( hHal,pAdapter->sessionId,
4848 &(pWextState->roamProfile), &roamId);
Agarwal Ashish40f9b872015-09-01 16:17:35 +05304849
4850 if ((eHAL_STATUS_SUCCESS != status) &&
4851 (WLAN_HDD_INFRA_STATION == pAdapter->device_mode ||
4852 WLAN_HDD_P2P_CLIENT == pAdapter->device_mode))
4853 {
4854 hddLog(VOS_TRACE_LEVEL_ERROR,
4855 FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"),
4856 pAdapter->sessionId, status);
4857 /* change back to NotAssociated */
4858 hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
4859 eConnectionState_NotConnected);
4860 }
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07004861 pRoamProfile->ChannelInfo.ChannelList = NULL;
4862 pRoamProfile->ChannelInfo.numOfChannels = 0;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07004863
Shailender Karmuchi15cd0672013-05-15 19:50:04 -07004864 EXIT();
4865 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004866}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07004867
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05304868int iw_set_essid(struct net_device *dev,
4869 struct iw_request_info *info,
4870 union iwreq_data *wrqu, char *extra)
4871{
4872 int ret;
4873
4874 vos_ssr_protect(__func__);
4875 ret = __iw_set_essid(dev, info, wrqu, extra);
4876 vos_ssr_unprotect(__func__);
4877
4878 return ret;
4879}
4880
Jeff Johnson295189b2012-06-20 16:38:30 -07004881/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07004882
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05304883 \brief __iw_get_essid() -
Jeff Johnson295189b2012-06-20 16:38:30 -07004884 This function returns the essid to the wpa_supplicant.
Shailender Karmuchia734f332013-04-19 14:02:48 -07004885
Jeff Johnson295189b2012-06-20 16:38:30 -07004886 \param - dev - Pointer to the net device.
4887 - info - Pointer to the iw_request_info.
4888 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07004889 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07004890 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07004891
Jeff Johnson295189b2012-06-20 16:38:30 -07004892 --------------------------------------------------------------------------*/
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05304893int __iw_get_essid(struct net_device *dev,
4894 struct iw_request_info *info,
4895 struct iw_point *dwrq, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07004896{
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304897 hdd_adapter_t *pAdapter;
4898 hdd_context_t *pHddCtx;
4899 hdd_wext_state_t *wextBuf;
4900 hdd_station_ctx_t *pHddStaCtx;
4901 int ret = 0;
Hanumantha Reddy Pothula7dc0e6c2015-03-06 15:11:16 +05304902
Jeff Johnson295189b2012-06-20 16:38:30 -07004903 ENTER();
4904
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304905 pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
4906 if (NULL == pAdapter)
4907 {
4908 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4909 "%s: Adapter is NULL",__func__);
4910 return -EINVAL;
4911 }
4912
4913 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
4914 ret = wlan_hdd_validate_context(pHddCtx);
4915 if (0 != ret)
4916 {
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304917 return ret;
4918 }
4919
4920 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
4921 if (NULL == pHddStaCtx)
4922 {
4923 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4924 "%s: STA Context is NULL",__func__);
4925 return -EINVAL;
4926 }
4927
4928 wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
4929 if (NULL == wextBuf)
4930 {
4931 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4932 "%s: wextBuf is NULL",__func__);
4933 return -EINVAL;
4934 }
4935
Jeff Johnson295189b2012-06-20 16:38:30 -07004936 if((pHddStaCtx->conn_info.connState == eConnectionState_Associated &&
4937 wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) ||
4938 ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected ||
4939 pHddStaCtx->conn_info.connState == eConnectionState_IbssDisconnected) &&
4940 wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0))
4941 {
4942 dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length;
4943 memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, dwrq->length);
4944 dwrq->flags = 1;
4945 } else {
4946 memset(extra, 0, dwrq->length);
4947 dwrq->length = 0;
4948 dwrq->flags = 0;
4949 }
4950 EXIT();
4951 return 0;
4952}
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05304953
4954int iw_get_essid(struct net_device *dev,
4955 struct iw_request_info *info,
4956 struct iw_point *dwrq, char *extra)
4957{
4958 int ret;
4959
4960 vos_ssr_protect(__func__);
4961 ret = __iw_get_essid(dev, info, dwrq, extra);
4962 vos_ssr_unprotect(__func__);
4963
4964 return ret;
4965}
Jeff Johnson295189b2012-06-20 16:38:30 -07004966/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07004967
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05304968 \brief __iw_set_auth() -
Jeff Johnson295189b2012-06-20 16:38:30 -07004969 This function sets the auth type received from the wpa_supplicant.
Shailender Karmuchia734f332013-04-19 14:02:48 -07004970
Jeff Johnson295189b2012-06-20 16:38:30 -07004971 \param - dev - Pointer to the net device.
4972 - info - Pointer to the iw_request_info.
4973 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07004974 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07004975 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07004976
Jeff Johnson295189b2012-06-20 16:38:30 -07004977 --------------------------------------------------------------------------*/
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05304978int __iw_set_auth(struct net_device *dev,struct iw_request_info *info,
4979 union iwreq_data *wrqu,char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07004980{
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304981 hdd_adapter_t *pAdapter;
4982 hdd_context_t *pHddCtx;
4983 hdd_wext_state_t *pWextState;
4984 hdd_station_ctx_t *pHddStaCtx;
4985 tCsrRoamProfile *pRoamProfile;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004986 eCsrEncryptionType mcEncryptionType;
Jeff Johnson295189b2012-06-20 16:38:30 -07004987 eCsrEncryptionType ucEncryptionType;
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304988 int ret = 0;
Shailender Karmuchia734f332013-04-19 14:02:48 -07004989
Jeff Johnson295189b2012-06-20 16:38:30 -07004990 ENTER();
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08004991
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304992 pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
4993 if (NULL == pAdapter)
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08004994 {
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05304995 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4996 "%s: Adapter is NULL",__func__);
4997 return -EINVAL;
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08004998 }
4999
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305000 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
5001 ret = wlan_hdd_validate_context(pHddCtx);
5002 if (0 != ret)
5003 {
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305004 return ret;
5005 }
5006
5007 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
5008 if (NULL == pHddStaCtx)
5009 {
5010 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5011 "%s: STA Context is NULL",__func__);
5012 return -EINVAL;
5013 }
5014
5015 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
5016 if (NULL == pWextState)
5017 {
5018 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5019 "%s: pWextState is NULL",__func__);
5020 return -EINVAL;
5021 }
5022
5023 pRoamProfile = &pWextState->roamProfile;
5024
Jeff Johnson295189b2012-06-20 16:38:30 -07005025 switch(wrqu->param.flags & IW_AUTH_INDEX)
5026 {
5027 case IW_AUTH_WPA_VERSION:
Shailender Karmuchia734f332013-04-19 14:02:48 -07005028
Jeff Johnson295189b2012-06-20 16:38:30 -07005029 pWextState->wpaVersion = wrqu->param.value;
Shailender Karmuchia734f332013-04-19 14:02:48 -07005030
Jeff Johnson295189b2012-06-20 16:38:30 -07005031 break;
Shailender Karmuchia734f332013-04-19 14:02:48 -07005032
Jeff Johnson295189b2012-06-20 16:38:30 -07005033 case IW_AUTH_CIPHER_PAIRWISE:
5034 {
Shailender Karmuchia734f332013-04-19 14:02:48 -07005035 if(wrqu->param.value & IW_AUTH_CIPHER_NONE) {
Jeff Johnson295189b2012-06-20 16:38:30 -07005036 ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
Shailender Karmuchia734f332013-04-19 14:02:48 -07005037 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005038 else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
5039 ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP;
Shailender Karmuchia734f332013-04-19 14:02:48 -07005040 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005041 else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) {
5042 ucEncryptionType = eCSR_ENCRYPT_TYPE_AES;
Shailender Karmuchia734f332013-04-19 14:02:48 -07005043 }
5044
Jeff Johnson295189b2012-06-20 16:38:30 -07005045 else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07005046
5047 if( (IW_AUTH_KEY_MGMT_802_1X
5048 == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) )
Jeff Johnson295189b2012-06-20 16:38:30 -07005049 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) )
5050 /*Dynamic WEP key*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07005051 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40;
Jeff Johnson295189b2012-06-20 16:38:30 -07005052 else
5053 /*Static WEP key*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07005054 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
5055 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005056 else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07005057
5058 if( ( IW_AUTH_KEY_MGMT_802_1X
5059 == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) )
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
5061 /*Dynamic WEP key*/
5062 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104;
5063 else
5064 /*Static WEP key*/
5065 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
Shailender Karmuchia734f332013-04-19 14:02:48 -07005066
Jeff Johnson295189b2012-06-20 16:38:30 -07005067 }
5068 else {
Shailender Karmuchia734f332013-04-19 14:02:48 -07005069
Jeff Johnson295189b2012-06-20 16:38:30 -07005070 hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER",
Shailender Karmuchia734f332013-04-19 14:02:48 -07005071 __func__, wrqu->param.value);
Jeff Johnson295189b2012-06-20 16:38:30 -07005072 return -EINVAL;
5073 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07005074
Jeff Johnson295189b2012-06-20 16:38:30 -07005075 pRoamProfile->EncryptionType.numEntries = 1;
5076 pRoamProfile->EncryptionType.encryptionType[0] = ucEncryptionType;
Shailender Karmuchia734f332013-04-19 14:02:48 -07005077 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005078 break;
5079 case IW_AUTH_CIPHER_GROUP:
Shailender Karmuchia734f332013-04-19 14:02:48 -07005080 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005081 if(wrqu->param.value & IW_AUTH_CIPHER_NONE) {
5082 mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
5083 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07005084
Jeff Johnson295189b2012-06-20 16:38:30 -07005085 else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
5086 mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP;
5087 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07005088
5089 else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) {
Jeff Johnson295189b2012-06-20 16:38:30 -07005090 mcEncryptionType = eCSR_ENCRYPT_TYPE_AES;
5091 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07005092
Jeff Johnson295189b2012-06-20 16:38:30 -07005093 else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
Shailender Karmuchia734f332013-04-19 14:02:48 -07005094
5095 if( ( IW_AUTH_KEY_MGMT_802_1X
5096 == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X ))
5097 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
5098
Jeff Johnson295189b2012-06-20 16:38:30 -07005099 mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40;
Shailender Karmuchia734f332013-04-19 14:02:48 -07005100
5101 else
5102 mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
Jeff Johnson295189b2012-06-20 16:38:30 -07005103 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07005104
5105 else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104)
5106 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005107 /*Dynamic WEP keys won't work with shared keys*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07005108 if( ( IW_AUTH_KEY_MGMT_802_1X
5109 == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X))
Jeff Johnson295189b2012-06-20 16:38:30 -07005110 && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
5111 {
5112 mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104;
5113 }
5114 else
5115 {
5116 mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
5117 }
5118 }
5119 else {
Shailender Karmuchia734f332013-04-19 14:02:48 -07005120
Jeff Johnson295189b2012-06-20 16:38:30 -07005121 hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER",
Shailender Karmuchia734f332013-04-19 14:02:48 -07005122 __func__, wrqu->param.value);
Jeff Johnson295189b2012-06-20 16:38:30 -07005123 return -EINVAL;
5124 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07005125
Jeff Johnson295189b2012-06-20 16:38:30 -07005126 pRoamProfile->mcEncryptionType.numEntries = 1;
5127 pRoamProfile->mcEncryptionType.encryptionType[0] = mcEncryptionType;
5128 }
5129 break;
5130
5131 case IW_AUTH_80211_AUTH_ALG:
5132 {
5133 /*Save the auth algo here and set auth type to SME Roam profile
5134 in the iw_set_ap_address*/
Shailender Karmuchia734f332013-04-19 14:02:48 -07005135 if( wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM)
Jeff Johnson295189b2012-06-20 16:38:30 -07005136 pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
Shailender Karmuchia734f332013-04-19 14:02:48 -07005137
Jeff Johnson295189b2012-06-20 16:38:30 -07005138 else if(wrqu->param.value & IW_AUTH_ALG_SHARED_KEY)
5139 pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY;
5140
5141 else if(wrqu->param.value & IW_AUTH_ALG_LEAP)
5142 /*Not supported*/
5143 pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
5144 pWextState->roamProfile.AuthType.authType[0] = pHddStaCtx->conn_info.authType;
5145 }
5146 break;
5147
5148 case IW_AUTH_KEY_MGMT:
5149 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005150#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07005151#define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */
5152 /*Check for CCKM AKM type */
5153 if ( wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08005154 hddLog(VOS_TRACE_LEVEL_INFO,"%s: CCKM AKM Set %d",
5155 __func__, wrqu->param.value);
Shailender Karmuchia734f332013-04-19 14:02:48 -07005156 /* Set the CCKM bit in authKeyMgmt */
5157 /* Right now, this breaks all ref to authKeyMgmt because our
5158 * code doesn't realize it is a "bitfield"
Jeff Johnson295189b2012-06-20 16:38:30 -07005159 */
5160 pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM;
5161 /*Set the key management to 802.1X*/
5162 //pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005163 pWextState->isESEConnection = eANI_BOOLEAN_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005164 //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA.
5165 pWextState->collectedAuthType = eCSR_AUTH_TYPE_CCKM_RSN;
5166 } else if ( wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) {
5167 /*Save the key management*/
5168 pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK;
5169 //pWextState->authKeyMgmt = wrqu->param.value;
5170 //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA.
5171 pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN;
5172 } else if (!( wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) {
5173 pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; //eCSR_AUTH_TYPE_WPA_NONE
5174 /*Save the key management anyway*/
5175 pWextState->authKeyMgmt = wrqu->param.value;
5176 } else { // It must be IW_AUTH_KEY_MGMT_802_1X
5177 /*Save the key management*/
5178 pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X;
5179 //pWextState->authKeyMgmt = wrqu->param.value;
5180 //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA.
5181 pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN;
5182 }
5183#else
5184 /*Save the key management*/
5185 pWextState->authKeyMgmt = wrqu->param.value;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005186#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -07005187 }
5188 break;
5189
5190 case IW_AUTH_TKIP_COUNTERMEASURES:
5191 {
5192 if(wrqu->param.value) {
5193 hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
5194 "Counter Measure started %d", wrqu->param.value);
5195 pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED;
5196 }
5197 else {
5198 hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
5199 "Counter Measure stopped=%d", wrqu->param.value);
5200 pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED;
5201 }
5202 }
5203 break;
5204 case IW_AUTH_DROP_UNENCRYPTED:
5205 case IW_AUTH_WPA_ENABLED:
5206 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
5207 case IW_AUTH_ROAMING_CONTROL:
5208 case IW_AUTH_PRIVACY_INVOKED:
Shailender Karmuchia734f332013-04-19 14:02:48 -07005209
Jeff Johnson295189b2012-06-20 16:38:30 -07005210 default:
Shailender Karmuchia734f332013-04-19 14:02:48 -07005211
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005212 hddLog(LOGW, "%s called with unsupported auth type %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07005213 wrqu->param.flags & IW_AUTH_INDEX);
5214 break;
5215 }
Shailender Karmuchia734f332013-04-19 14:02:48 -07005216
Jeff Johnson295189b2012-06-20 16:38:30 -07005217 EXIT();
5218 return 0;
5219}
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305220
5221int iw_set_auth(struct net_device *dev, struct iw_request_info *info,
5222 union iwreq_data *wrqu, char *extra)
5223{
5224 int ret;
5225
5226 vos_ssr_protect(__func__);
5227 ret = __iw_set_auth(dev, info, wrqu, extra);
5228 vos_ssr_unprotect(__func__);
5229
5230 return ret;
5231}
5232
Jeff Johnson295189b2012-06-20 16:38:30 -07005233/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07005234
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305235 \brief __iw_get_auth() -
Jeff Johnson295189b2012-06-20 16:38:30 -07005236 This function returns the auth type to the wpa_supplicant.
Shailender Karmuchia734f332013-04-19 14:02:48 -07005237
Jeff Johnson295189b2012-06-20 16:38:30 -07005238 \param - dev - Pointer to the net device.
5239 - info - Pointer to the iw_request_info.
5240 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07005241 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07005242 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07005243
Jeff Johnson295189b2012-06-20 16:38:30 -07005244 --------------------------------------------------------------------------*/
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305245int __iw_get_auth(struct net_device *dev,struct iw_request_info *info,
5246 union iwreq_data *wrqu,char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07005247{
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305248 hdd_adapter_t* pAdapter;
5249 hdd_wext_state_t *pWextState;
5250 tCsrRoamProfile *pRoamProfile;
5251 hdd_context_t *pHddCtx;
5252 int ret = 0;
5253
Jeff Johnson295189b2012-06-20 16:38:30 -07005254 ENTER();
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005255
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305256 pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
5257 if (NULL == pAdapter)
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005258 {
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305259 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5260 "%s: Adapter is NULL",__func__);
5261 return -EINVAL;
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005262 }
5263
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305264 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
5265 ret = wlan_hdd_validate_context(pHddCtx);
5266 if (0 != ret)
5267 {
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305268 return ret;
5269 }
5270
5271 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
5272 if (NULL == pWextState)
5273 {
5274 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5275 "%s: pWextState is NULL",__func__);
5276 return -EINVAL;
5277 }
5278 pRoamProfile = &pWextState->roamProfile;
5279
Jeff Johnson295189b2012-06-20 16:38:30 -07005280 switch(pRoamProfile->negotiatedAuthType)
5281 {
5282 case eCSR_AUTH_TYPE_WPA_NONE:
5283 wrqu->param.flags = IW_AUTH_WPA_VERSION;
5284 wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED;
5285 break;
5286 case eCSR_AUTH_TYPE_WPA:
5287 wrqu->param.flags = IW_AUTH_WPA_VERSION;
5288 wrqu->param.value = IW_AUTH_WPA_VERSION_WPA;
5289 break;
5290#ifdef WLAN_FEATURE_VOWIFI_11R
5291 case eCSR_AUTH_TYPE_FT_RSN:
5292#endif
5293 case eCSR_AUTH_TYPE_RSN:
5294 wrqu->param.flags = IW_AUTH_WPA_VERSION;
5295 wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2;
5296 break;
5297 case eCSR_AUTH_TYPE_OPEN_SYSTEM:
5298 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
5299 break;
5300 case eCSR_AUTH_TYPE_SHARED_KEY:
5301 wrqu->param.value = IW_AUTH_ALG_SHARED_KEY;
5302 break;
5303 case eCSR_AUTH_TYPE_UNKNOWN:
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005304 hddLog(LOG1,"%s called with unknown auth type", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005305 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
5306 break;
5307 case eCSR_AUTH_TYPE_AUTOSWITCH:
5308 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
5309 break;
5310 case eCSR_AUTH_TYPE_WPA_PSK:
Agarwal Ashish971c2882013-10-30 20:11:12 +05305311 hddLog(LOG1,"%s called with WPA PSK auth type", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005312 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
5313 return -EIO;
5314#ifdef WLAN_FEATURE_VOWIFI_11R
5315 case eCSR_AUTH_TYPE_FT_RSN_PSK:
5316#endif
5317 case eCSR_AUTH_TYPE_RSN_PSK:
Chet Lanctot186b5732013-03-18 10:26:30 -07005318#ifdef WLAN_FEATURE_11W
5319 case eCSR_AUTH_TYPE_RSN_PSK_SHA256:
Abhishek Singhae408032014-09-25 17:22:04 +05305320 case eCSR_AUTH_TYPE_RSN_8021X_SHA256:
Chet Lanctot186b5732013-03-18 10:26:30 -07005321#endif
Agarwal Ashish971c2882013-10-30 20:11:12 +05305322 hddLog(LOG1,"%s called with RSN PSK auth type", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005323 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
5324 return -EIO;
5325 default:
Agarwal Ashish971c2882013-10-30 20:11:12 +05305326 hddLog(LOGE,"%s called with unknown auth type", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005327 wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM;
5328 return -EIO;
5329 }
5330 if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE))
5331 {
5332 switch(pRoamProfile->negotiatedUCEncryptionType)
5333 {
5334 case eCSR_ENCRYPT_TYPE_NONE:
5335 wrqu->param.value = IW_AUTH_CIPHER_NONE;
5336 break;
5337 case eCSR_ENCRYPT_TYPE_WEP40:
5338 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
5339 wrqu->param.value = IW_AUTH_CIPHER_WEP40;
5340 break;
5341 case eCSR_ENCRYPT_TYPE_TKIP:
5342 wrqu->param.value = IW_AUTH_CIPHER_TKIP;
5343 break;
5344 case eCSR_ENCRYPT_TYPE_WEP104:
5345 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
5346 wrqu->param.value = IW_AUTH_CIPHER_WEP104;
5347 break;
5348 case eCSR_ENCRYPT_TYPE_AES:
5349 wrqu->param.value = IW_AUTH_CIPHER_CCMP;
5350 break;
5351 default:
Agarwal Ashish971c2882013-10-30 20:11:12 +05305352 hddLog(LOG1, "%s called with unknown auth type %d ",
5353 __func__, pRoamProfile->negotiatedUCEncryptionType);
Jeff Johnson295189b2012-06-20 16:38:30 -07005354 return -EIO;
5355 }
5356 }
5357
Shailender Karmuchia734f332013-04-19 14:02:48 -07005358 if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP))
Jeff Johnson295189b2012-06-20 16:38:30 -07005359 {
5360 switch(pRoamProfile->negotiatedMCEncryptionType)
5361 {
5362 case eCSR_ENCRYPT_TYPE_NONE:
5363 wrqu->param.value = IW_AUTH_CIPHER_NONE;
5364 break;
5365 case eCSR_ENCRYPT_TYPE_WEP40:
5366 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
5367 wrqu->param.value = IW_AUTH_CIPHER_WEP40;
5368 break;
5369 case eCSR_ENCRYPT_TYPE_TKIP:
5370 wrqu->param.value = IW_AUTH_CIPHER_TKIP;
5371 break;
5372 case eCSR_ENCRYPT_TYPE_WEP104:
5373 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
5374 wrqu->param.value = IW_AUTH_CIPHER_WEP104;
5375 break;
5376 case eCSR_ENCRYPT_TYPE_AES:
5377 wrqu->param.value = IW_AUTH_CIPHER_CCMP;
5378 break;
5379 default:
Agarwal Ashish971c2882013-10-30 20:11:12 +05305380 hddLog(LOG1, "%s called with unknown auth type %d ",
5381 __func__, pRoamProfile->negotiatedMCEncryptionType);
Jeff Johnson295189b2012-06-20 16:38:30 -07005382 return -EIO;
5383 }
5384 }
5385
5386 hddLog(LOG1, "%s called with auth type %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005387 __func__, pRoamProfile->AuthType.authType[0]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005388 EXIT();
5389 return 0;
5390}
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305391
5392int iw_get_auth(struct net_device *dev,struct iw_request_info *info,
5393 union iwreq_data *wrqu,char *extra)
5394{
5395 int ret;
5396
5397 vos_ssr_protect(__func__);
5398 ret = __iw_get_auth(dev, info, wrqu, extra);
5399 vos_ssr_unprotect(__func__);
5400
5401 return ret;
5402}
5403
Jeff Johnson295189b2012-06-20 16:38:30 -07005404/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07005405
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305406 \brief __iw_set_ap_address() -
Shailender Karmuchia734f332013-04-19 14:02:48 -07005407 This function calls the sme_RoamConnect function to associate
Jeff Johnson295189b2012-06-20 16:38:30 -07005408 to the AP with the specified BSSID received from the wpa_supplicant.
Shailender Karmuchia734f332013-04-19 14:02:48 -07005409
Jeff Johnson295189b2012-06-20 16:38:30 -07005410 \param - dev - Pointer to the net device.
5411 - info - Pointer to the iw_request_info.
5412 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07005413 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07005414 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07005415
Jeff Johnson295189b2012-06-20 16:38:30 -07005416 --------------------------------------------------------------------------*/
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305417int __iw_set_ap_address(struct net_device *dev,
5418 struct iw_request_info *info,
5419 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07005420{
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305421 hdd_station_ctx_t *pHddStaCtx;
5422 hdd_adapter_t *pAdapter;
5423 hdd_context_t *pHddCtx;
5424 v_U8_t *pMacAddress = NULL;
5425 int ret = 0;
Hanumantha Reddy Pothula7dc0e6c2015-03-06 15:11:16 +05305426
Jeff Johnson295189b2012-06-20 16:38:30 -07005427 ENTER();
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305428
5429 pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
5430 if (NULL == pAdapter)
5431 {
5432 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5433 "%s: Adapter is NULL", __func__);
5434 return -EINVAL;
5435 }
5436 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
5437 ret = wlan_hdd_validate_context(pHddCtx);
5438 if (0 != ret)
5439 {
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305440 return ret;
5441 }
5442 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
5443 if (NULL == pHddStaCtx)
5444 {
5445 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5446 "%s: pHddStaCtx is NULL", __func__);
5447 return -EINVAL;
5448 }
5449
Jeff Johnson295189b2012-06-20 16:38:30 -07005450 pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data;
Arif Hussain24bafea2013-11-15 15:10:03 -08005451 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s "MAC_ADDRESS_STR,
5452 __func__, MAC_ADDR_ARRAY(pMacAddress));
Jeff Johnson295189b2012-06-20 16:38:30 -07005453 vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid ));
Shailender Karmuchia734f332013-04-19 14:02:48 -07005454
Hanumantha Reddy Pothula7dc0e6c2015-03-06 15:11:16 +05305455 EXIT();
Jeff Johnson295189b2012-06-20 16:38:30 -07005456 return 0;
5457}
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305458
5459int iw_set_ap_address(struct net_device *dev,
5460 struct iw_request_info *info,
5461 union iwreq_data *wrqu, char *extra)
5462{
5463 int ret;
5464
5465 vos_ssr_protect(__func__);
5466 ret = __iw_set_ap_address(dev, info, wrqu, extra);
5467 vos_ssr_unprotect(__func__);
5468
5469 return ret;
5470}
5471
Jeff Johnson295189b2012-06-20 16:38:30 -07005472/**---------------------------------------------------------------------------
Shailender Karmuchia734f332013-04-19 14:02:48 -07005473
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305474 \brief __iw_get_ap_address() -
Jeff Johnson295189b2012-06-20 16:38:30 -07005475 This function returns the BSSID to the wpa_supplicant
5476 \param - dev - Pointer to the net device.
5477 - info - Pointer to the iw_request_info.
5478 - wrqu - Pointer to the iwreq_data.
Shailender Karmuchia734f332013-04-19 14:02:48 -07005479 - extra - Pointer to the data.
Jeff Johnson295189b2012-06-20 16:38:30 -07005480 \return - 0 for success, non zero for failure
Shailender Karmuchia734f332013-04-19 14:02:48 -07005481
Jeff Johnson295189b2012-06-20 16:38:30 -07005482 --------------------------------------------------------------------------*/
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305483int __iw_get_ap_address(struct net_device *dev,
5484 struct iw_request_info *info,
5485 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07005486{
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305487 hdd_station_ctx_t *pHddStaCtx;
5488 hdd_adapter_t *pAdapter;
5489 hdd_context_t *pHddCtx;
5490 int ret = 0;
Hanumantha Reddy Pothula7dc0e6c2015-03-06 15:11:16 +05305491
Jeff Johnson295189b2012-06-20 16:38:30 -07005492 ENTER();
5493
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305494 pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
5495 if (NULL == pAdapter)
5496 {
5497 hddLog(VOS_TRACE_LEVEL_ERROR,
5498 "%s: Adapter is NULL", __func__);
5499 return -EINVAL;
5500 }
5501 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
5502 ret = wlan_hdd_validate_context(pHddCtx);
5503 if (0 != ret)
5504 {
Mahesh A Saptasagar153c4662015-02-06 12:13:08 +05305505 return ret;
5506 }
5507 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
5508 if (NULL == pHddStaCtx)
5509 {
5510 hddLog(VOS_TRACE_LEVEL_ERROR,
5511 "%s: pHddStaCtx is NULL", __func__);
5512 return -EINVAL;
5513 }
5514
Jeff Johnson295189b2012-06-20 16:38:30 -07005515 if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) ||
5516 (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState))
5517 {
Jeff Johnson4416a782013-03-25 14:17:50 -07005518 memcpy(wrqu->ap_addr.sa_data,pHddStaCtx->conn_info.bssId,ETH_ALEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07005519 }
5520 else
5521 {
5522 memset(wrqu->ap_addr.sa_data,0,sizeof(wrqu->ap_addr.sa_data));
5523 }
5524 EXIT();
5525 return 0;
5526}
Jeff Johnsond13512a2012-07-17 11:42:19 -07005527
Mahesh A Saptasagard68eb282014-12-17 14:20:19 +05305528int iw_get_ap_address(struct net_device *dev,
5529 struct iw_request_info *info,
5530 union iwreq_data *wrqu, char *extra)
5531{
5532 int ret;
5533
5534 vos_ssr_protect(__func__);
5535 ret = __iw_get_ap_address(dev, info, wrqu, extra);
5536 vos_ssr_unprotect(__func__);
5537
5538 return ret;
5539}
5540
Chet Lanctot186b5732013-03-18 10:26:30 -07005541#ifdef WLAN_FEATURE_11W
5542/**---------------------------------------------------------------------------
5543
5544 \brief hdd_indicateUnprotMgmtFrame -
5545 This function forwards the unprotected management frame to the supplicant
5546 \param - pAdapter - Pointer to HDD adapter
5547 - nFrameLength - Length of the unprotected frame being passed
5548 - pbFrames - Pointer to the frame buffer
5549 - frameType - 802.11 frame type
5550 \return - nothing
5551
5552 --------------------------------------------------------------------------*/
5553void hdd_indicateUnprotMgmtFrame( hdd_adapter_t *pAdapter,
5554 tANI_U32 nFrameLength,
5555 tANI_U8* pbFrames,
5556 tANI_U8 frameType )
5557{
5558 tANI_U8 type = 0;
5559 tANI_U8 subType = 0;
5560
5561 hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d",
5562 __func__, frameType, nFrameLength);
5563
5564 /* Sanity Checks */
5565 if (NULL == pAdapter)
5566 {
5567 hddLog( LOGE, FL("pAdapter is NULL"));
5568 return;
5569 }
5570
5571 if (NULL == pAdapter->dev)
5572 {
5573 hddLog( LOGE, FL("pAdapter->dev is NULL"));
5574 return;
5575 }
5576
5577 if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
5578 {
5579 hddLog( LOGE, FL("pAdapter has invalid magic"));
5580 return;
5581 }
5582
5583 if( !nFrameLength )
5584 {
5585 hddLog( LOGE, FL("Frame Length is Invalid ZERO"));
5586 return;
5587 }
5588
5589 if (NULL == pbFrames) {
5590 hddLog( LOGE, FL("pbFrames is NULL"));
5591 return;
5592 }
5593
5594 type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]);
5595 subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]);
5596
5597 /* Get pAdapter from Destination mac address of the frame */
5598 if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC)
5599 {
Anand N Sunkade9adb1b2015-07-29 09:56:45 +05305600#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
5601 cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength);
5602#else
Chet Lanctot186b5732013-03-18 10:26:30 -07005603 cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, nFrameLength);
Anand N Sunkade9adb1b2015-07-29 09:56:45 +05305604#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07005605 pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++;
5606 }
5607 else if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DEAUTH)
5608 {
Anand N Sunkade9adb1b2015-07-29 09:56:45 +05305609#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
5610 cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, nFrameLength);
5611#else
Chet Lanctot186b5732013-03-18 10:26:30 -07005612 cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, nFrameLength);
Anand N Sunkade9adb1b2015-07-29 09:56:45 +05305613#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07005614 pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++;
5615 }
5616 else
5617 {
5618 hddLog( LOGE, FL("Frame type %d and subtype %d are not valid"), type, subType);
5619 return;
5620 }
5621}
5622#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005623
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005624#if defined (FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005625void hdd_indicateTsmIe(hdd_adapter_t *pAdapter, tANI_U8 tid,
5626 tANI_U8 state,
5627 tANI_U16 measInterval )
5628{
5629 union iwreq_data wrqu;
5630 char buf[IW_CUSTOM_MAX + 1];
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08005631 int nBytes = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005632
5633 if (NULL == pAdapter)
5634 return;
5635
5636 // create the event
5637 memset(&wrqu, '\0', sizeof(wrqu));
5638 memset(buf, '\0', sizeof(buf));
5639
5640 hddLog(VOS_TRACE_LEVEL_INFO, "TSM Ind tid(%d) state(%d) MeasInt(%d)",
5641 tid, state, measInterval);
5642
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08005643 nBytes = snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d",tid,state,measInterval);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005644
5645 wrqu.data.pointer = buf;
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08005646 wrqu.data.length = nBytes;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005647 // send the event
5648 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
5649}
5650
5651void hdd_indicateCckmPreAuth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo)
5652{
5653 union iwreq_data wrqu;
5654 char buf[IW_CUSTOM_MAX + 1];
5655 char *pos = buf;
5656 int nBytes = 0, freeBytes = IW_CUSTOM_MAX;
5657
5658 if ((NULL == pAdapter) || (NULL == pRoamInfo))
5659 return;
5660
5661 // create the event
5662 memset(&wrqu, '\0', sizeof(wrqu));
5663 memset(buf, '\0', sizeof(buf));
5664
5665 /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */
Arun Kumar Khandavallie8768212014-02-17 16:43:34 +05305666 hddLog(VOS_TRACE_LEVEL_INFO, "CCXPREAUTHNOTIFY=%02x:%02x:%02x:%02x:%02x:%02x %u:%u",
5667 pRoamInfo->bssid[0], pRoamInfo->bssid[1], pRoamInfo->bssid[2],
5668 pRoamInfo->bssid[3], pRoamInfo->bssid[4], pRoamInfo->bssid[5],
5669 pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005670
5671 nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY=");
5672 pos += nBytes;
5673 freeBytes -= nBytes;
5674
5675 vos_mem_copy(pos, pRoamInfo->bssid, WNI_CFG_BSSID_LEN);
5676 pos += WNI_CFG_BSSID_LEN;
5677 freeBytes -= WNI_CFG_BSSID_LEN;
5678
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08005679 nBytes = snprintf(pos, freeBytes, " %u:%u", pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]);
5680 freeBytes -= nBytes;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005681
5682 wrqu.data.pointer = buf;
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08005683 wrqu.data.length = (IW_CUSTOM_MAX - freeBytes);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005684
5685 // send the event
5686 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
5687}
5688
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005689void hdd_indicateEseAdjApRepInd(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005690{
5691 union iwreq_data wrqu;
5692 char buf[IW_CUSTOM_MAX + 1];
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08005693 int nBytes = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005694
5695 if ((NULL == pAdapter) || (NULL == pRoamInfo))
5696 return;
5697
5698 // create the event
5699 memset(&wrqu, '\0', sizeof(wrqu));
5700 memset(buf, '\0', sizeof(buf));
5701
5702 hddLog(VOS_TRACE_LEVEL_INFO, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay);
5703
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08005704 nBytes = snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005705
5706 wrqu.data.pointer = buf;
Varun Reddy Yeturudf0e7a72013-12-05 12:12:23 -08005707 wrqu.data.length = nBytes;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005708
5709 // send the event
5710 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
5711}
5712
Srinivas Girigowda0c6d7fe2014-05-28 18:18:10 -07005713void hdd_indicateEseBcnReportNoResults(const hdd_adapter_t *pAdapter,
5714 const tANI_U16 measurementToken,
5715 const tANI_BOOLEAN flag,
5716 const tANI_U8 numBss)
5717{
5718 union iwreq_data wrqu;
5719 char buf[IW_CUSTOM_MAX];
5720 char *pos = buf;
5721 int nBytes = 0, freeBytes = IW_CUSTOM_MAX;
5722
5723 memset(&wrqu, '\0', sizeof(wrqu));
5724 memset(buf, '\0', sizeof(buf));
5725
5726 hddLog(VOS_TRACE_LEVEL_INFO, FL("CCXBCNREP=%d %d %d"), measurementToken, flag,
5727 numBss);
5728
5729 nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken,
5730 flag, numBss);
5731
5732 wrqu.data.pointer = buf;
5733 wrqu.data.length = nBytes;
5734 // send the event
5735 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
5736}
5737
5738
5739static void hdd_indicateEseBcnReportInd(const hdd_adapter_t *pAdapter,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005740 const tCsrRoamInfo *pRoamInfo)
5741{
5742 union iwreq_data wrqu;
5743 char buf[IW_CUSTOM_MAX + 1];
5744 char *pos = buf;
5745 int nBytes = 0, freeBytes = IW_CUSTOM_MAX;
5746 tANI_U8 i = 0, len = 0;
5747 tANI_U8 tot_bcn_ieLen = 0; /* total size of the beacon report data */
5748 tANI_U8 lastSent = 0, sendBss = 0;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005749 int bcnRepFieldSize = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0].bcnReportFields);
5750 tANI_U8 ieLenByte = 1;
5751 /* CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes */
5752#define ESEBCNREPHEADER_LEN (18)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005753
5754 if ((NULL == pAdapter) || (NULL == pRoamInfo))
5755 return;
5756
5757 /* Custom event can pass maximum of 256 bytes of data,
5758 based on the IE len we need to identify how many BSS info can
5759 be filled in to custom event data */
5760 /*
5761 meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data
5762 bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces
5763 CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes
5764 */
5765
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005766 if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) && (!pRoamInfo->pEseBcnReportRsp->numBss))
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005767 {
5768 hddLog(VOS_TRACE_LEVEL_INFO, "Measurement Done but no scan results");
5769 /* If the measurement is none and no scan results found,
5770 indicate the supplicant about measurement done */
Srinivas Girigowda0c6d7fe2014-05-28 18:18:10 -07005771 hdd_indicateEseBcnReportNoResults(pAdapter,
5772 pRoamInfo->pEseBcnReportRsp->measurementToken,
5773 pRoamInfo->pEseBcnReportRsp->flag,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005774 pRoamInfo->pEseBcnReportRsp->numBss);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005775 }
5776 else
5777 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005778 while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005779 {
5780 memset(&wrqu, '\0', sizeof(wrqu));
5781 memset(buf, '\0', sizeof(buf));
5782 tot_bcn_ieLen = 0;
5783 sendBss = 0;
5784 pos = buf;
5785 freeBytes = IW_CUSTOM_MAX;
5786
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005787 for (i = lastSent; i < pRoamInfo->pEseBcnReportRsp->numBss; i++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005788 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005789 len = bcnRepFieldSize + ieLenByte + pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen;
5790 if ((len + tot_bcn_ieLen) > (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN))
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005791 {
5792 break;
5793 }
5794 tot_bcn_ieLen += len;
5795 sendBss++;
5796 hddLog(VOS_TRACE_LEVEL_INFO, "i(%d) sizeof bcnReportFields(%d)"
5797 "IeLength(%d) Length of Ie(%d) totLen(%d)",
5798 i, bcnRepFieldSize, 1,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005799 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i].ieLen,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005800 tot_bcn_ieLen);
5801 }
5802
5803 hddLog(VOS_TRACE_LEVEL_INFO, "Sending %d BSS Info", sendBss);
5804 hddLog(VOS_TRACE_LEVEL_INFO, "CCXBCNREP=%d %d %d %d",
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005805 pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag,
5806 sendBss, tot_bcn_ieLen);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005807
5808 nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ",
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005809 pRoamInfo->pEseBcnReportRsp->measurementToken, pRoamInfo->pEseBcnReportRsp->flag,
5810 sendBss);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005811 pos += nBytes;
5812 freeBytes -= nBytes;
5813
5814 /* Copy total Beacon report data length */
5815 vos_mem_copy(pos, (char*)&tot_bcn_ieLen, sizeof(tot_bcn_ieLen));
5816 pos += sizeof(tot_bcn_ieLen);
5817 freeBytes -= sizeof(tot_bcn_ieLen);
5818
5819 for (i = 0; i < sendBss; i++)
5820 {
5821 hddLog(VOS_TRACE_LEVEL_INFO, "ChanNum(%d) Spare(%d) MeasDuration(%d)"
Arun Kumar Khandavallie8768212014-02-17 16:43:34 +05305822 " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)"
5823 " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)"
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005824 " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)",
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005825 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ChanNum,
5826 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Spare,
5827 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.MeasDuration,
5828 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.PhyType,
5829 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.RecvSigPower,
5830 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.ParentTsf,
5831 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[0],
5832 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.TargetTsf[1],
5833 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.BcnInterval,
5834 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.CapabilityInfo,
5835 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[0],
5836 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[1],
5837 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[2],
5838 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[3],
5839 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[4],
5840 pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields.Bssid[5]);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005841
5842 /* bcn report fields are copied */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005843 len = sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields);
5844 vos_mem_copy(pos, (char*)&pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].bcnReportFields, len);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005845 pos += len;
5846 freeBytes -= len;
5847
5848 /* Add 1 byte of ie len */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005849 len = pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].ieLen;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005850 vos_mem_copy(pos, (char*)&len, sizeof(len));
5851 pos += sizeof(len);
5852 freeBytes -= sizeof(len);
5853
5854 /* copy IE from scan results */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005855 vos_mem_copy(pos, (char*)pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[i+lastSent].pBuf, len);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08005856 pos += len;
5857 freeBytes -= len;
5858 }
5859
5860 wrqu.data.pointer = buf;
5861 wrqu.data.length = strlen(buf);
5862
5863 // send the event
5864 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
5865 lastSent += sendBss;
5866 }
5867 }
5868}
5869
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005870#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005871