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