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