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