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