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