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