Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -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. |
| 20 | */ |
| 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 | |
| 28 | /** |
| 29 | * DOC: wlan_hdd_assoc.c |
| 30 | * |
| 31 | * WLAN Host Device Driver implementation |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | #include "wlan_hdd_includes.h" |
| 36 | #include <ani_global.h> |
| 37 | #include "dot11f.h" |
| 38 | #include "wlan_hdd_power.h" |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 39 | #include "wlan_hdd_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 40 | #include <linux/ieee80211.h> |
| 41 | #include <linux/wireless.h> |
| 42 | #include <linux/etherdevice.h> |
| 43 | #include <net/cfg80211.h> |
| 44 | #include "wlan_hdd_cfg80211.h" |
| 45 | #include "csr_inside_api.h" |
| 46 | #include "wlan_hdd_p2p.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | #include "wlan_hdd_tdls.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include "sme_api.h" |
| 49 | #include "wlan_hdd_hostapd.h" |
| 50 | #include <wlan_hdd_ipa.h> |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 51 | #include "wlan_hdd_lpass.h" |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 52 | #include <wlan_logging_sock_svc.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 53 | #include <cds_sched.h> |
| 54 | #include "cds_concurrency.h" |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 55 | #include <cds_utils.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 56 | #include "sme_power_save_api.h" |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 57 | #include "wlan_hdd_napi.h" |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 58 | #include <cdp_txrx_cmn.h> |
| 59 | #include <cdp_txrx_flow_ctrl_legacy.h> |
| 60 | #include <cdp_txrx_peer_ops.h> |
| 61 | #include <cdp_txrx_misc.h> |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 62 | #include <wlan_logging_sock_svc.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 63 | |
| 64 | /* These are needed to recognize WPA and RSN suite types */ |
| 65 | #define HDD_WPA_OUI_SIZE 4 |
| 66 | #define HDD_RSN_OUI_SIZE 4 |
| 67 | uint8_t ccp_wpa_oui00[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 68 | uint8_t ccp_wpa_oui01[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 69 | uint8_t ccp_wpa_oui02[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 70 | uint8_t ccp_wpa_oui03[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 71 | uint8_t ccp_wpa_oui04[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 72 | uint8_t ccp_wpa_oui05[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x05 }; |
| 73 | |
| 74 | #ifdef FEATURE_WLAN_ESE |
| 75 | /* CCKM */ |
| 76 | uint8_t ccp_wpa_oui06[HDD_WPA_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 77 | /* CCKM */ |
| 78 | uint8_t ccp_rsn_oui06[HDD_RSN_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 79 | #endif /* FEATURE_WLAN_ESE */ |
| 80 | |
| 81 | /* group cipher */ |
| 82 | uint8_t ccp_rsn_oui00[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x00 }; |
| 83 | |
| 84 | /* WEP-40 or RSN */ |
| 85 | uint8_t ccp_rsn_oui01[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x01 }; |
| 86 | |
| 87 | /* TKIP or RSN-PSK */ |
| 88 | uint8_t ccp_rsn_oui02[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x02 }; |
| 89 | |
| 90 | /* Reserved */ |
| 91 | uint8_t ccp_rsn_oui03[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x03 }; |
| 92 | |
| 93 | /* AES-CCMP */ |
| 94 | uint8_t ccp_rsn_oui04[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x04 }; |
| 95 | |
| 96 | /* WEP-104 */ |
| 97 | uint8_t ccp_rsn_oui05[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 98 | |
| 99 | #ifdef WLAN_FEATURE_11W |
| 100 | /* RSN-PSK-SHA256 */ |
| 101 | uint8_t ccp_rsn_oui07[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x06 }; |
| 102 | |
| 103 | /* RSN-8021X-SHA256 */ |
| 104 | uint8_t ccp_rsn_oui08[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 105 | #endif |
| 106 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 107 | /* Offset where the EID-Len-IE, start. */ |
| 108 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2) */ |
| 109 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 110 | |
| 111 | #define BEACON_FRAME_IES_OFFSET 12 |
| 112 | #define HDD_PEER_AUTHORIZE_WAIT 10 |
| 113 | |
| 114 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 115 | * beacon_filter_table - table of IEs used for beacon filtering |
| 116 | */ |
| 117 | static const int beacon_filter_table[] = { |
| 118 | SIR_MAC_DS_PARAM_SET_EID, |
| 119 | SIR_MAC_ERP_INFO_EID, |
| 120 | SIR_MAC_EDCA_PARAM_SET_EID, |
| 121 | SIR_MAC_QOS_CAPABILITY_EID, |
| 122 | SIR_MAC_HT_INFO_EID, |
| 123 | SIR_MAC_VHT_OPMODE_EID, |
| 124 | SIR_MAC_VHT_OPERATION_EID, |
| 125 | }; |
| 126 | |
| 127 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 128 | * hdd_conn_set_authenticated() - set authentication state |
| 129 | * @pAdapter: pointer to the adapter |
| 130 | * @authState: authentication state |
| 131 | * |
| 132 | * This function updates the global HDD station context |
| 133 | * authentication state. |
| 134 | * |
| 135 | * Return: none |
| 136 | */ |
| 137 | static void |
| 138 | hdd_conn_set_authenticated(hdd_adapter_t *pAdapter, uint8_t authState) |
| 139 | { |
| 140 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 141 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 142 | |
| 143 | /* save the new connection state */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 144 | hdd_notice("Authenticated state Changed from oldState:%d to State:%d", |
| 145 | pHddStaCtx->conn_info.uIsAuthenticated, authState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 146 | pHddStaCtx->conn_info.uIsAuthenticated = authState; |
| 147 | |
| 148 | /* Check is pending ROC request or not when auth state changed */ |
| 149 | schedule_delayed_work(&pHddCtx->roc_req_work, 0); |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * hdd_conn_set_connection_state() - set connection state |
| 154 | * @pAdapter: pointer to the adapter |
| 155 | * @connState: connection state |
| 156 | * |
| 157 | * This function updates the global HDD station context connection state. |
| 158 | * |
| 159 | * Return: none |
| 160 | */ |
| 161 | void hdd_conn_set_connection_state(hdd_adapter_t *pAdapter, |
| 162 | eConnectionState connState) |
| 163 | { |
| 164 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 165 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 166 | |
| 167 | /* save the new connection state */ |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 168 | hdd_info("%pS Changed connectionState Changed from oldState:%d to State:%d", |
| 169 | (void *)_RET_IP_, pHddStaCtx->conn_info.connState, |
| 170 | connState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 171 | pHddStaCtx->conn_info.connState = connState; |
| 172 | |
| 173 | /* Check is pending ROC request or not when connection state changed */ |
| 174 | schedule_delayed_work(&pHddCtx->roc_req_work, 0); |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * hdd_conn_get_connection_state() - get connection state |
| 179 | * @pAdapter: pointer to the adapter |
| 180 | * @pConnState: pointer to connection state |
| 181 | * |
| 182 | * This function updates the global HDD station context connection state. |
| 183 | * |
| 184 | * Return: true if (Infra Associated or IBSS Connected) |
| 185 | * and sets output parameter pConnState; |
| 186 | * false otherwise |
| 187 | */ |
| 188 | static inline bool hdd_conn_get_connection_state(hdd_station_ctx_t *pHddStaCtx, |
| 189 | eConnectionState *pConnState) |
| 190 | { |
| 191 | bool fConnected = false; |
| 192 | eConnectionState connState; |
| 193 | |
| 194 | /* get the connection state. */ |
| 195 | connState = pHddStaCtx->conn_info.connState; |
| 196 | |
| 197 | if (eConnectionState_Associated == connState || |
| 198 | eConnectionState_IbssConnected == connState || |
| 199 | eConnectionState_IbssDisconnected == connState) { |
| 200 | fConnected = true; |
| 201 | } |
| 202 | |
| 203 | if (pConnState) |
| 204 | *pConnState = connState; |
| 205 | |
| 206 | return fConnected; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * hdd_is_connecting() - Function to check connection progress |
| 211 | * @hdd_sta_ctx: pointer to global HDD Station context |
| 212 | * |
| 213 | * Return: true if connecting, false otherwise |
| 214 | */ |
| 215 | bool hdd_is_connecting(hdd_station_ctx_t *hdd_sta_ctx) |
| 216 | { |
| 217 | return hdd_sta_ctx->conn_info.connState == |
| 218 | eConnectionState_Connecting; |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * hdd_conn_is_connected() - Function to check connection status |
| 223 | * @pHddStaCtx: pointer to global HDD Station context |
| 224 | * |
| 225 | * Return: false if any errors encountered, true otherwise |
| 226 | */ |
| 227 | bool hdd_conn_is_connected(hdd_station_ctx_t *pHddStaCtx) |
| 228 | { |
| 229 | return hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * hdd_conn_get_connected_band() - get current connection radio band |
| 234 | * @pHddStaCtx: pointer to global HDD Station context |
| 235 | * |
| 236 | * Return: eCSR_BAND_24 or eCSR_BAND_5G based on current AP connection |
| 237 | * eCSR_BAND_ALL if not connected |
| 238 | */ |
| 239 | eCsrBand hdd_conn_get_connected_band(hdd_station_ctx_t *pHddStaCtx) |
| 240 | { |
| 241 | uint8_t staChannel = 0; |
| 242 | |
| 243 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 244 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 245 | |
| 246 | if (staChannel > 0 && staChannel < 14) |
| 247 | return eCSR_BAND_24; |
| 248 | else if (staChannel >= 36 && staChannel <= 184) |
| 249 | return eCSR_BAND_5G; |
| 250 | else /* If station is not connected return as eCSR_BAND_ALL */ |
| 251 | return eCSR_BAND_ALL; |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
| 256 | * @pHddStaCtx: pointer to global HDD Station context |
| 257 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 258 | * |
| 259 | * Return: false if any errors encountered, true otherwise |
| 260 | */ |
| 261 | static inline bool |
| 262 | hdd_conn_get_connected_cipher_algo(hdd_station_ctx_t *pHddStaCtx, |
| 263 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 264 | { |
| 265 | bool fConnected = false; |
| 266 | |
| 267 | fConnected = hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 268 | |
| 269 | if (pConnectedCipherAlgo) |
| 270 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 271 | |
| 272 | return fConnected; |
| 273 | } |
| 274 | |
| 275 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 276 | * hdd_remove_beacon_filter() - remove beacon filter |
| 277 | * @adapter: Pointer to the hdd adapter |
| 278 | * |
| 279 | * Return: 0 on success and errno on failure |
| 280 | */ |
| 281 | static int hdd_remove_beacon_filter(hdd_adapter_t *adapter) |
| 282 | { |
| 283 | QDF_STATUS status; |
| 284 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 285 | |
| 286 | status = sme_remove_beacon_filter(hdd_ctx->hHal, |
| 287 | adapter->sessionId); |
| 288 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 289 | hdd_err("sme_remove_beacon_filter() failed"); |
| 290 | return -EFAULT; |
| 291 | } |
| 292 | |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * hdd_add_beacon_filter() - add beacon filter |
| 298 | * @adapter: Pointer to the hdd adapter |
| 299 | * |
| 300 | * Return: 0 on success and errno on failure |
| 301 | */ |
| 302 | static int hdd_add_beacon_filter(hdd_adapter_t *adapter) |
| 303 | { |
| 304 | int i; |
| 305 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 306 | QDF_STATUS status; |
| 307 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 308 | |
| 309 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 310 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 311 | (unsigned long int *)ie_map); |
| 312 | |
| 313 | status = sme_add_beacon_filter(hdd_ctx->hHal, |
| 314 | adapter->sessionId, ie_map); |
| 315 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 316 | hdd_err("sme_add_beacon_filter() failed"); |
| 317 | return -EFAULT; |
| 318 | } |
| 319 | return 0; |
| 320 | } |
| 321 | |
| 322 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 323 | * hdd_copy_vht_caps()- copy vht caps info from roam info to |
| 324 | * hdd station context. |
| 325 | * @hdd_sta_ctx: pointer to hdd station context |
| 326 | * @roam_info: pointer to roam info |
| 327 | * |
| 328 | * Return: None |
| 329 | */ |
| 330 | static void hdd_copy_ht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 331 | tCsrRoamInfo *roam_info) |
| 332 | { |
| 333 | tDot11fIEHTCaps *roam_ht_cap = &roam_info->ht_caps; |
| 334 | struct ieee80211_ht_cap *hdd_ht_cap = &hdd_sta_ctx->conn_info.ht_caps; |
| 335 | uint32_t i, temp_ht_cap; |
| 336 | |
| 337 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 338 | |
| 339 | if (roam_ht_cap->advCodingCap) |
| 340 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 341 | if (roam_ht_cap->supportedChannelWidthSet) |
| 342 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 343 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 344 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 345 | if (temp_ht_cap) |
| 346 | hdd_ht_cap->cap_info |= |
| 347 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 348 | if (roam_ht_cap->greenField) |
| 349 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 350 | if (roam_ht_cap->shortGI20MHz) |
| 351 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 352 | if (roam_ht_cap->shortGI40MHz) |
| 353 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 354 | if (roam_ht_cap->txSTBC) |
| 355 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 356 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 357 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 358 | if (temp_ht_cap) |
| 359 | hdd_ht_cap->cap_info |= |
| 360 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 361 | if (roam_ht_cap->delayedBA) |
| 362 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 363 | if (roam_ht_cap->maximalAMSDUsize) |
| 364 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 365 | if (roam_ht_cap->dsssCckMode40MHz) |
| 366 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 367 | if (roam_ht_cap->psmp) |
| 368 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 369 | if (roam_ht_cap->stbcControlFrame) |
| 370 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 371 | if (roam_ht_cap->lsigTXOPProtection) |
| 372 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 373 | |
| 374 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 375 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 376 | hdd_ht_cap->ampdu_params_info |= |
| 377 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 378 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 379 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 380 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 381 | if (temp_ht_cap) |
| 382 | hdd_ht_cap->ampdu_params_info |= |
| 383 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 384 | |
| 385 | /* 802.11n HT extended capabilities masks */ |
| 386 | if (roam_ht_cap->pco) |
| 387 | hdd_ht_cap->extended_ht_cap_info |= |
| 388 | IEEE80211_HT_EXT_CAP_PCO; |
| 389 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 390 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 391 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 392 | if (temp_ht_cap) |
| 393 | hdd_ht_cap->extended_ht_cap_info |= |
| 394 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 395 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 396 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 397 | if (temp_ht_cap) |
| 398 | hdd_ht_cap->extended_ht_cap_info |= |
| 399 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 400 | |
| 401 | /* tx_bf_cap_info capabilities */ |
| 402 | if (roam_ht_cap->txBF) |
| 403 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 404 | if (roam_ht_cap->rxStaggeredSounding) |
| 405 | hdd_ht_cap->tx_BF_cap_info |= |
| 406 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 407 | if (roam_ht_cap->txStaggeredSounding) |
| 408 | hdd_ht_cap->tx_BF_cap_info |= |
| 409 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 410 | if (roam_ht_cap->rxZLF) |
| 411 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 412 | if (roam_ht_cap->txZLF) |
| 413 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 414 | if (roam_ht_cap->implicitTxBF) |
| 415 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 416 | temp_ht_cap = roam_ht_cap->calibration & |
| 417 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 418 | if (temp_ht_cap) |
| 419 | hdd_ht_cap->tx_BF_cap_info |= |
| 420 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 421 | if (roam_ht_cap->explicitCSITxBF) |
| 422 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 423 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 424 | hdd_ht_cap->tx_BF_cap_info |= |
| 425 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 426 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 427 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 428 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 429 | if (temp_ht_cap) |
| 430 | hdd_ht_cap->tx_BF_cap_info |= |
| 431 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 432 | temp_ht_cap = |
| 433 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 434 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 435 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 436 | if (temp_ht_cap) |
| 437 | hdd_ht_cap->tx_BF_cap_info |= |
| 438 | temp_ht_cap << |
| 439 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 440 | temp_ht_cap = |
| 441 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 442 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 443 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 444 | if (temp_ht_cap) |
| 445 | hdd_ht_cap->tx_BF_cap_info |= |
| 446 | temp_ht_cap << |
| 447 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 448 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 449 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 450 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 451 | if (temp_ht_cap) |
| 452 | hdd_ht_cap->tx_BF_cap_info |= |
| 453 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 454 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 455 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 456 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 457 | if (temp_ht_cap) |
| 458 | hdd_ht_cap->tx_BF_cap_info |= |
| 459 | temp_ht_cap << |
| 460 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 461 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 462 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 463 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 464 | if (temp_ht_cap) |
| 465 | hdd_ht_cap->tx_BF_cap_info |= |
| 466 | temp_ht_cap << |
| 467 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 468 | |
| 469 | /* antenna selection */ |
| 470 | if (roam_ht_cap->antennaSelection) |
| 471 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 472 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 473 | hdd_ht_cap->antenna_selection_info |= |
| 474 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 475 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 476 | hdd_ht_cap->antenna_selection_info |= |
| 477 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 478 | if (roam_ht_cap->explicitCSIFeedback) |
| 479 | hdd_ht_cap->antenna_selection_info |= |
| 480 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 481 | if (roam_ht_cap->antennaIndicesFeedback) |
| 482 | hdd_ht_cap->antenna_selection_info |= |
| 483 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 484 | if (roam_ht_cap->rxAS) |
| 485 | hdd_ht_cap->antenna_selection_info |= |
| 486 | ANTENNA_SEL_INFO_RX_AS; |
| 487 | if (roam_ht_cap->txSoundingPPDUs) |
| 488 | hdd_ht_cap->antenna_selection_info |= |
| 489 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 490 | |
| 491 | /* mcs data rate */ |
| 492 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 493 | hdd_ht_cap->mcs.rx_mask[i] = |
| 494 | roam_ht_cap->supportedMCSSet[i]; |
| 495 | hdd_ht_cap->mcs.rx_highest = |
| 496 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 497 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
| 498 | hdd_ht_cap->mcs.tx_params = |
| 499 | roam_ht_cap->supportedMCSSet[12]; |
| 500 | } |
| 501 | |
| 502 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 503 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 504 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 505 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 506 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 507 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 508 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 509 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 510 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 511 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 512 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 513 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 514 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 515 | |
| 516 | /** |
| 517 | * hdd_copy_ht_caps()- copy ht caps info from roam info to |
| 518 | * hdd station context. |
| 519 | * @hdd_sta_ctx: pointer to hdd station context |
| 520 | * @roam_info: pointer to roam info |
| 521 | * |
| 522 | * Return: None |
| 523 | */ |
| 524 | static void hdd_copy_vht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 525 | tCsrRoamInfo *roam_info) |
| 526 | { |
| 527 | tDot11fIEVHTCaps *roam_vht_cap = &roam_info->vht_caps; |
| 528 | struct ieee80211_vht_cap *hdd_vht_cap = |
| 529 | &hdd_sta_ctx->conn_info.vht_caps; |
| 530 | uint32_t temp_vht_cap; |
| 531 | |
| 532 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 533 | |
| 534 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 535 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 536 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 537 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 538 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
| 539 | if (temp_vht_cap) |
| 540 | if (roam_vht_cap->supportedChannelWidthSet & |
| 541 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 542 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 543 | hdd_vht_cap->vht_cap_info |= |
| 544 | temp_vht_cap << |
| 545 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 546 | if (roam_vht_cap->supportedChannelWidthSet & |
| 547 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 548 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 549 | hdd_vht_cap->vht_cap_info |= |
| 550 | temp_vht_cap << |
| 551 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
| 552 | if (roam_vht_cap->ldpcCodingCap) |
| 553 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 554 | if (roam_vht_cap->shortGI80MHz) |
| 555 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 556 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 557 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 558 | if (roam_vht_cap->txSTBC) |
| 559 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 560 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 561 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 562 | if (temp_vht_cap) |
| 563 | hdd_vht_cap->vht_cap_info |= |
| 564 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 565 | if (roam_vht_cap->suBeamFormerCap) |
| 566 | hdd_vht_cap->vht_cap_info |= |
| 567 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 568 | if (roam_vht_cap->suBeamformeeCap) |
| 569 | hdd_vht_cap->vht_cap_info |= |
| 570 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 571 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 572 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 573 | if (temp_vht_cap) |
| 574 | hdd_vht_cap->vht_cap_info |= |
| 575 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 576 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 577 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 578 | if (temp_vht_cap) |
| 579 | hdd_vht_cap->vht_cap_info |= |
| 580 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 581 | if (roam_vht_cap->muBeamformerCap) |
| 582 | hdd_vht_cap->vht_cap_info |= |
| 583 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 584 | if (roam_vht_cap->muBeamformeeCap) |
| 585 | hdd_vht_cap->vht_cap_info |= |
| 586 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 587 | if (roam_vht_cap->vhtTXOPPS) |
| 588 | hdd_vht_cap->vht_cap_info |= |
| 589 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 590 | if (roam_vht_cap->htcVHTCap) |
| 591 | hdd_vht_cap->vht_cap_info |= |
| 592 | IEEE80211_VHT_CAP_HTC_VHT; |
| 593 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 594 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 595 | if (temp_vht_cap) |
| 596 | hdd_vht_cap->vht_cap_info |= |
| 597 | temp_vht_cap << |
| 598 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 599 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 600 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 601 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 602 | if (temp_vht_cap) |
| 603 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 604 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 605 | if (roam_vht_cap->rxAntPattern) |
| 606 | hdd_vht_cap->vht_cap_info |= |
| 607 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 608 | if (roam_vht_cap->txAntPattern) |
| 609 | hdd_vht_cap->vht_cap_info |= |
| 610 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 611 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 612 | hdd_vht_cap->supp_mcs.rx_highest = |
| 613 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 614 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 615 | hdd_vht_cap->supp_mcs.tx_highest = |
| 616 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 617 | } |
| 618 | |
| 619 | /* ht param */ |
| 620 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 621 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 622 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 623 | |
| 624 | /* operatinon mode */ |
| 625 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 626 | |
| 627 | /* stbc_param */ |
| 628 | #define HT_STBC_PARAM_MCS 0x007f |
| 629 | |
| 630 | /** |
| 631 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 632 | * hdd station context. |
| 633 | * @hdd_sta_ctx: pointer to hdd station context |
| 634 | * @roam_info: pointer to roam info |
| 635 | * |
| 636 | * Return: None |
| 637 | */ |
| 638 | static void hdd_copy_ht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 639 | tCsrRoamInfo *roam_info) |
| 640 | { |
| 641 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 642 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 643 | &hdd_sta_ctx->conn_info.ht_operation; |
| 644 | uint32_t i, temp_ht_ops; |
| 645 | |
| 646 | qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 647 | |
| 648 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 649 | |
| 650 | /* HT_PARAMS */ |
| 651 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 652 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 653 | if (temp_ht_ops) |
| 654 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 655 | else |
| 656 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 657 | if (roam_ht_ops->recommendedTxWidthSet) |
| 658 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 659 | if (roam_ht_ops->rifsMode) |
| 660 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 661 | if (roam_ht_ops->controlledAccessOnly) |
| 662 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 663 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 664 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 665 | if (temp_ht_ops) |
| 666 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 667 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 668 | |
| 669 | /* operation mode */ |
| 670 | temp_ht_ops = roam_ht_ops->opMode & |
| 671 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 672 | switch (temp_ht_ops) { |
| 673 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 674 | hdd_ht_ops->operation_mode |= |
| 675 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 676 | break; |
| 677 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 678 | hdd_ht_ops->operation_mode |= |
| 679 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 680 | break; |
| 681 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 682 | hdd_ht_ops->operation_mode |= |
| 683 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 684 | break; |
| 685 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 686 | default: |
| 687 | hdd_ht_ops->operation_mode |= |
| 688 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 689 | } |
| 690 | if (roam_ht_ops->nonGFDevicesPresent) |
| 691 | hdd_ht_ops->operation_mode |= |
| 692 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 693 | if (roam_ht_ops->transmitBurstLimit) |
| 694 | hdd_ht_ops->operation_mode |= |
| 695 | HT_OP_MODE_TX_BURST_LIMIT; |
| 696 | if (roam_ht_ops->obssNonHTStaPresent) |
| 697 | hdd_ht_ops->operation_mode |= |
| 698 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 699 | |
| 700 | /* stbc_param */ |
| 701 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 702 | HT_STBC_PARAM_MCS; |
| 703 | if (temp_ht_ops) |
| 704 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 705 | if (roam_ht_ops->dualCTSProtection) |
| 706 | hdd_ht_ops->stbc_param |= |
| 707 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 708 | if (roam_ht_ops->secondaryBeacon) |
| 709 | hdd_ht_ops->stbc_param |= |
| 710 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 711 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 712 | hdd_ht_ops->stbc_param |= |
| 713 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 714 | if (roam_ht_ops->pcoActive) |
| 715 | hdd_ht_ops->stbc_param |= |
| 716 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 717 | if (roam_ht_ops->pcoPhase) |
| 718 | hdd_ht_ops->stbc_param |= |
| 719 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 720 | |
| 721 | /* basic MCs set */ |
| 722 | for (i = 0; i < 16; ++i) |
| 723 | hdd_ht_ops->basic_set[i] = |
| 724 | roam_ht_ops->basicMCSSet[i]; |
| 725 | } |
| 726 | |
| 727 | /** |
| 728 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 729 | * hdd station context. |
| 730 | * @hdd_sta_ctx: pointer to hdd station context |
| 731 | * @roam_info: pointer to roam info |
| 732 | * |
| 733 | * Return: None |
| 734 | */ |
| 735 | static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 736 | tCsrRoamInfo *roam_info) |
| 737 | { |
| 738 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 739 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 740 | &hdd_sta_ctx->conn_info.vht_operation; |
| 741 | |
| 742 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 743 | |
| 744 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
| 745 | hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1; |
| 746 | hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2; |
| 747 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 748 | } |
| 749 | |
| 750 | |
| 751 | /** |
| 752 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 753 | * @adapter: Pointer to adapter |
| 754 | * @roam_info: pointer to roam info |
| 755 | * |
| 756 | * Return: None |
| 757 | */ |
| 758 | static void hdd_save_bss_info(hdd_adapter_t *adapter, |
| 759 | tCsrRoamInfo *roam_info) |
| 760 | { |
| 761 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 762 | |
| 763 | hdd_sta_ctx->conn_info.freq = cds_chan_to_freq( |
| 764 | hdd_sta_ctx->conn_info.operationChannel); |
| 765 | if (roam_info->vht_caps.present) { |
| 766 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
| 767 | hdd_copy_vht_caps(hdd_sta_ctx, roam_info); |
| 768 | } else { |
| 769 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 770 | } |
| 771 | if (roam_info->ht_caps.present) { |
| 772 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
| 773 | hdd_copy_ht_caps(hdd_sta_ctx, roam_info); |
| 774 | } else { |
| 775 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 776 | } |
| 777 | if (roam_info->reassoc) |
| 778 | hdd_sta_ctx->conn_info.roam_count++; |
| 779 | if (roam_info->hs20vendor_ie.present) { |
| 780 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 781 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 782 | &roam_info->hs20vendor_ie, |
| 783 | sizeof(roam_info->hs20vendor_ie)); |
| 784 | } else { |
| 785 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 786 | } |
| 787 | if (roam_info->ht_operation.present) { |
| 788 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 789 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 790 | } else { |
| 791 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 792 | } |
| 793 | if (roam_info->vht_operation.present) { |
| 794 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 795 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 796 | } else { |
| 797 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 798 | } |
| 799 | } |
| 800 | |
| 801 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 802 | * hdd_conn_save_connect_info() - save current connection information |
| 803 | * @pAdapter: pointer to adapter |
| 804 | * @pRoamInfo: pointer to roam info |
| 805 | * @eBssType: bss type |
| 806 | * |
| 807 | * Return: none |
| 808 | */ |
| 809 | static void |
| 810 | hdd_conn_save_connect_info(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 811 | eCsrRoamBssType eBssType) |
| 812 | { |
| 813 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 814 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 815 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 816 | QDF_ASSERT(pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 817 | |
| 818 | if (pRoamInfo) { |
| 819 | /* Save the BSSID for the connection */ |
| 820 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 821 | QDF_ASSERT(pRoamInfo->pBssDesc); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 822 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 823 | &pRoamInfo->bssid); |
| 824 | |
| 825 | /* |
| 826 | * Save the Station ID for this station from |
| 827 | * the 'Roam Info'. For IBSS mode, staId is |
| 828 | * assigned in NEW_PEER_IND. For reassoc, |
| 829 | * the staID doesn't change and it may be invalid |
| 830 | * in this structure so no change here. |
| 831 | */ |
| 832 | if (!pRoamInfo->fReassocReq) { |
| 833 | pHddStaCtx->conn_info.staId[0] = |
| 834 | pRoamInfo->staId; |
| 835 | } |
| 836 | } else if (eCSR_BSS_TYPE_IBSS == eBssType) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 837 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 838 | &pRoamInfo->bssid); |
| 839 | } else { |
| 840 | /* |
| 841 | * can't happen. We need a valid IBSS or Infra setting |
| 842 | * in the BSSDescription or we can't function. |
| 843 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 844 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 845 | } |
| 846 | |
| 847 | /* notify WMM */ |
| 848 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 849 | |
| 850 | if (!pRoamInfo->u.pConnectedProfile) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 851 | QDF_ASSERT(pRoamInfo->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 852 | } else { |
| 853 | /* Get Multicast Encryption Type */ |
| 854 | encryptType = |
| 855 | pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 856 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 857 | /* Get Unicast Encryption Type */ |
| 858 | encryptType = |
| 859 | pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 860 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 861 | |
| 862 | pHddStaCtx->conn_info.authType = |
| 863 | pRoamInfo->u.pConnectedProfile->AuthType; |
| 864 | |
| 865 | pHddStaCtx->conn_info.operationChannel = |
| 866 | pRoamInfo->u.pConnectedProfile->operationChannel; |
| 867 | |
| 868 | /* Save the ssid for the connection */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 869 | qdf_mem_copy(&pHddStaCtx->conn_info.SSID.SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 870 | &pRoamInfo->u.pConnectedProfile->SSID, |
| 871 | sizeof(tSirMacSSid)); |
| 872 | |
| 873 | /* Save dot11mode in which STA associated to AP */ |
| 874 | pHddStaCtx->conn_info.dot11Mode = |
| 875 | pRoamInfo->u.pConnectedProfile->dot11Mode; |
| 876 | |
| 877 | pHddStaCtx->conn_info.proxyARPService = |
| 878 | pRoamInfo->u.pConnectedProfile->proxyARPService; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 879 | |
| 880 | pHddStaCtx->conn_info.nss = pRoamInfo->chan_info.nss; |
| 881 | |
| 882 | pHddStaCtx->conn_info.rate_flags = |
| 883 | pRoamInfo->chan_info.rate_flags; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 884 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 885 | hdd_save_bss_info(pAdapter, pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 886 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 887 | } |
| 888 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 889 | /** |
| 890 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 891 | * @dev: pointer to net device |
| 892 | * @pAdapter: pointer to adapter |
| 893 | * @pCsrRoamInfo: pointer to roam info |
| 894 | * |
| 895 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 896 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 897 | * for the same purpose.) |
| 898 | * |
| 899 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 900 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 901 | * This is the Assoc Response. |
| 902 | * |
| 903 | * Return: none |
| 904 | */ |
| 905 | static void |
| 906 | hdd_send_ft_assoc_response(struct net_device *dev, |
| 907 | hdd_adapter_t *pAdapter, |
| 908 | tCsrRoamInfo *pCsrRoamInfo) |
| 909 | { |
| 910 | union iwreq_data wrqu; |
| 911 | char *buff; |
| 912 | unsigned int len = 0; |
| 913 | u8 *pFTAssocRsp = NULL; |
| 914 | |
| 915 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 916 | hdd_err("pCsrRoamInfo->nAssocRspLength=%d", |
| 917 | (int)pCsrRoamInfo->nAssocRspLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 918 | return; |
| 919 | } |
| 920 | |
| 921 | pFTAssocRsp = |
| 922 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 923 | pCsrRoamInfo->nAssocReqLength); |
| 924 | if (pFTAssocRsp == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 925 | hdd_err("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 926 | return; |
| 927 | } |
| 928 | /* pFTAssocRsp needs to point to the IEs */ |
| 929 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 930 | hdd_notice("AssocRsp is now at %02x%02x", |
| 931 | (unsigned int)pFTAssocRsp[0], |
| 932 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 933 | |
| 934 | /* We need to send the IEs to the supplicant. */ |
| 935 | buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC); |
| 936 | if (buff == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 937 | hdd_err("kmalloc unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 938 | return; |
| 939 | } |
| 940 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
| 941 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 942 | wrqu.data.length = len; |
| 943 | memset(buff, 0, IW_GENERIC_IE_MAX); |
| 944 | memcpy(buff, pFTAssocRsp, len); |
| 945 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 946 | |
| 947 | kfree(buff); |
| 948 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 949 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 950 | /** |
| 951 | * hdd_send_ft_event() - send fast transition event |
| 952 | * @pAdapter: pointer to adapter |
| 953 | * |
| 954 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 955 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 956 | * followed by the auth response IEs to the supplicant. |
| 957 | * Once both are received in the supplicant, an FT event is generated |
| 958 | * to the supplicant. |
| 959 | * |
| 960 | * Return: none |
| 961 | */ |
| 962 | static void hdd_send_ft_event(hdd_adapter_t *pAdapter) |
| 963 | { |
| 964 | uint16_t auth_resp_len = 0; |
| 965 | uint32_t ric_ies_length = 0; |
| 966 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 967 | |
| 968 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 969 | struct cfg80211_ft_event_params ftEvent; |
| 970 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 971 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 972 | struct net_device *dev = pAdapter->dev; |
| 973 | #else |
| 974 | char *buff; |
| 975 | union iwreq_data wrqu; |
| 976 | uint16_t str_len; |
| 977 | #endif |
| 978 | |
| 979 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 980 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 981 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 982 | |
| 983 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, (u8 *) ricIe, |
| 984 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
| 985 | if (ric_ies_length == 0) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 986 | hdd_warn("RIC IEs is of length 0 not sending RIC Information for now"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 987 | } |
| 988 | |
| 989 | ftEvent.ric_ies = ricIe; |
| 990 | ftEvent.ric_ies_len = ric_ies_length; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 991 | hdd_notice("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 992 | |
| 993 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 994 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 995 | &auth_resp_len); |
| 996 | |
| 997 | if (auth_resp_len == 0) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 998 | hdd_err("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 999 | return; |
| 1000 | } |
| 1001 | |
| 1002 | sme_set_ft_pre_auth_state(pHddCtx->hHal, pAdapter->sessionId, true); |
| 1003 | |
| 1004 | ftEvent.target_ap = ftIe; |
| 1005 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1006 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1007 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1008 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1009 | hdd_notice("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1010 | hdd_notice("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1011 | hdd_notice("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1012 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1013 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1014 | ftEvent.target_ap[5]); |
| 1015 | |
| 1016 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1017 | |
| 1018 | #else |
| 1019 | /* We need to send the IEs to the supplicant */ |
| 1020 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
| 1021 | if (buff == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1022 | hdd_err("kmalloc unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1023 | return; |
| 1024 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1025 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1026 | |
| 1027 | /* Sme needs to send the RIC IEs first */ |
| 1028 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
| 1029 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, |
| 1030 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1031 | &ric_ies_length); |
| 1032 | if (ric_ies_length == 0) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1033 | hdd_warn("RIC IEs is of length 0 not sending RIC Information for now"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1034 | } else { |
| 1035 | wrqu.data.length = str_len + ric_ies_length; |
| 1036 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1037 | } |
| 1038 | |
| 1039 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1040 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1041 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
| 1042 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1043 | (u8 *) &buff[str_len], |
| 1044 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1045 | |
| 1046 | if (auth_resp_len == 0) { |
| 1047 | kfree(buff); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1048 | hdd_err("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1049 | return; |
| 1050 | } |
| 1051 | |
| 1052 | wrqu.data.length = str_len + auth_resp_len; |
| 1053 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1054 | |
| 1055 | kfree(buff); |
| 1056 | #endif |
| 1057 | } |
| 1058 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1059 | #ifdef FEATURE_WLAN_ESE |
| 1060 | /** |
| 1061 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1062 | * @dev: pointer to net device |
| 1063 | * @pAdapter: pointer to adapter |
| 1064 | * @pCsrRoamInfo: pointer to roam info |
| 1065 | * |
| 1066 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1067 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1068 | * |
| 1069 | * The current (new AP) channel information is passed in. |
| 1070 | * |
| 1071 | * Return: none |
| 1072 | */ |
| 1073 | static void |
| 1074 | hdd_send_new_ap_channel_info(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 1075 | tCsrRoamInfo *pCsrRoamInfo) |
| 1076 | { |
| 1077 | union iwreq_data wrqu; |
| 1078 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
| 1079 | |
| 1080 | if (descriptor == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1081 | hdd_err("pCsrRoamInfo->pBssDesc(%p)", descriptor); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1082 | return; |
| 1083 | } |
| 1084 | /* |
| 1085 | * Send the Channel event, the supplicant needs this to generate |
| 1086 | * the Adjacent AP report. |
| 1087 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1088 | hdd_warn("Sending up an SIOCGIWFREQ, channelId(%d)", |
| 1089 | descriptor->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1090 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1091 | wrqu.freq.m = descriptor->channelId; |
| 1092 | wrqu.freq.e = 0; |
| 1093 | wrqu.freq.i = 0; |
| 1094 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1095 | } |
| 1096 | |
| 1097 | #endif /* FEATURE_WLAN_ESE */ |
| 1098 | |
| 1099 | /** |
| 1100 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
| 1101 | * @pAdapter: pointer to adapter |
| 1102 | * @pCsrRoamInfo: pointer to roam info |
| 1103 | * |
| 1104 | * Return: none |
| 1105 | */ |
| 1106 | static void |
| 1107 | hdd_send_update_beacon_ies_event(hdd_adapter_t *pAdapter, |
| 1108 | tCsrRoamInfo *pCsrRoamInfo) |
| 1109 | { |
| 1110 | union iwreq_data wrqu; |
| 1111 | u8 *pBeaconIes; |
| 1112 | u8 currentLen = 0; |
| 1113 | char *buff; |
| 1114 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1115 | |
| 1116 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1117 | |
| 1118 | if (0 == pCsrRoamInfo->nBeaconLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1119 | hdd_warn("pCsrRoamInfo->nBeaconFrameLength = 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1120 | return; |
| 1121 | } |
| 1122 | pBeaconIes = (u8 *) (pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
| 1123 | if (pBeaconIes == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1124 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1125 | return; |
| 1126 | } |
| 1127 | /* pBeaconIes needs to point to the IEs */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1128 | hdd_notice("Beacon IEs is now at %02x%02x", |
| 1129 | (unsigned int)pBeaconIes[0], |
| 1130 | (unsigned int)pBeaconIes[1]); |
| 1131 | hdd_notice("Beacon IEs length = %d", |
| 1132 | pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1133 | |
| 1134 | /* We need to send the IEs to the supplicant. */ |
| 1135 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
| 1136 | if (buff == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1137 | hdd_err("kmalloc unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1138 | return; |
| 1139 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1140 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1141 | |
| 1142 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1143 | currentLen = strLen + 1; |
| 1144 | |
| 1145 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1146 | do { |
| 1147 | /* |
| 1148 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1149 | * into chunks of CUSTOM event max size and send it to |
| 1150 | * supplicant. Changes are done in supplicant to handle this. |
| 1151 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1152 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1154 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1155 | qdf_mem_copy(&buff[strLen + 1], pBeaconIes + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1156 | currentLen); |
| 1157 | currentOffset += currentLen; |
| 1158 | totalIeLen -= currentLen; |
| 1159 | wrqu.data.length = strLen + 1 + currentLen; |
| 1160 | if (totalIeLen) |
| 1161 | buff[strLen] = 1; /* more chunks pending */ |
| 1162 | else |
| 1163 | buff[strLen] = 0; /* last chunk */ |
| 1164 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1165 | hdd_notice("Beacon IEs length to supplicant = %d", |
| 1166 | currentLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1167 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1168 | } while (totalIeLen > 0); |
| 1169 | |
| 1170 | kfree(buff); |
| 1171 | } |
| 1172 | |
| 1173 | /** |
| 1174 | * hdd_send_association_event() - send association event |
| 1175 | * @dev: pointer to net device |
| 1176 | * @pCsrRoamInfo: pointer to roam info |
| 1177 | * |
| 1178 | * Return: none |
| 1179 | */ |
| 1180 | static void hdd_send_association_event(struct net_device *dev, |
| 1181 | tCsrRoamInfo *pCsrRoamInfo) |
| 1182 | { |
| 1183 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1184 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1185 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1186 | union iwreq_data wrqu; |
| 1187 | int we_event; |
| 1188 | char *msg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1189 | struct qdf_mac_addr peerMacAddr; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1190 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1191 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1192 | /* Added to find the auth type on the fly at run time */ |
| 1193 | /* rather than with cfg to see if FT is enabled */ |
| 1194 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1195 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1196 | |
| 1197 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1198 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1199 | we_event = SIOCGIWAP; |
| 1200 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1201 | if (NULL != pCsrRoamInfo) |
| 1202 | if (pCsrRoamInfo->roamSynchInProgress) |
| 1203 | /* change logging before release */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1204 | hdd_info("LFR3:hdd_send_association_event"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1205 | #endif |
| 1206 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) { |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1207 | tSirSmeChanInfo chan_info; |
| 1208 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1209 | if (!pCsrRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1210 | hdd_err("STA in associated state but pCsrRoamInfo is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1211 | return; |
| 1212 | } |
| 1213 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1214 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
| 1215 | cds_incr_active_session(pAdapter->device_mode, |
| 1216 | pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1217 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, |
| 1218 | sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1219 | |
| 1220 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1221 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1222 | if (global_p2p_connection_status == |
| 1223 | P2P_CLIENT_CONNECTING_STATE_1) { |
| 1224 | global_p2p_connection_status = |
| 1225 | P2P_CLIENT_CONNECTED_STATE_1; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1226 | hdd_err("[P2P State] Changing state from Connecting state to Connected State for 8-way Handshake"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1227 | } else if (global_p2p_connection_status == |
| 1228 | P2P_CLIENT_CONNECTING_STATE_2) { |
| 1229 | global_p2p_connection_status = |
| 1230 | P2P_CLIENT_COMPLETED_STATE; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1231 | hdd_err("[P2P State] Changing state from Connecting state to P2P Client Connection Completed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1232 | } |
| 1233 | } |
| 1234 | #endif |
| 1235 | pr_info("wlan: " MAC_ADDRESS_STR " connected to " |
| 1236 | MAC_ADDRESS_STR "\n", |
| 1237 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1238 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
| 1239 | hdd_send_update_beacon_ies_event(pAdapter, pCsrRoamInfo); |
| 1240 | |
| 1241 | /* |
| 1242 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1243 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1244 | * fFTEnable is true. |
| 1245 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1246 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1247 | if ((pRoamProfile->AuthType.authType[0] == |
| 1248 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 1249 | || (pRoamProfile->AuthType.authType[0] == |
| 1250 | eCSR_AUTH_TYPE_FT_RSN) |
| 1251 | #ifdef FEATURE_WLAN_ESE |
| 1252 | || (pRoamProfile->AuthType.authType[0] == |
| 1253 | eCSR_AUTH_TYPE_CCKM_RSN) |
| 1254 | || (pRoamProfile->AuthType.authType[0] == |
| 1255 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1256 | #endif |
| 1257 | ) { |
| 1258 | hdd_send_ft_assoc_response(dev, pAdapter, pCsrRoamInfo); |
| 1259 | } |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1260 | qdf_copy_macaddr(&peerMacAddr, |
| 1261 | &pHddStaCtx->conn_info.bssId); |
| 1262 | chan_info.chan_id = pCsrRoamInfo->chan_info.chan_id; |
| 1263 | chan_info.mhz = pCsrRoamInfo->chan_info.mhz; |
| 1264 | chan_info.info = pCsrRoamInfo->chan_info.info; |
| 1265 | chan_info.band_center_freq1 = |
| 1266 | pCsrRoamInfo->chan_info.band_center_freq1; |
| 1267 | chan_info.band_center_freq2 = |
| 1268 | pCsrRoamInfo->chan_info.band_center_freq2; |
| 1269 | chan_info.reg_info_1 = |
| 1270 | pCsrRoamInfo->chan_info.reg_info_1; |
| 1271 | chan_info.reg_info_2 = |
| 1272 | pCsrRoamInfo->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1273 | |
| 1274 | qdf_status = hdd_add_peer_object(pAdapter->hdd_vdev, |
| 1275 | pAdapter->device_mode, |
| 1276 | peerMacAddr.bytes); |
| 1277 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 1278 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1279 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
| 1280 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1281 | /* send peer status indication to oem app */ |
| 1282 | hdd_send_peer_status_ind_to_oem_app(&peerMacAddr, |
| 1283 | ePeerConnected, |
| 1284 | pCsrRoamInfo-> |
| 1285 | timingMeasCap, |
| 1286 | pAdapter->sessionId, |
| 1287 | &chan_info, |
| 1288 | pAdapter->device_mode); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1289 | /* Update tdls module about connection event */ |
| 1290 | wlan_hdd_tdls_notify_connect(pAdapter, pCsrRoamInfo); |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 1291 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1292 | #ifdef MSM_PLATFORM |
Ravi Joshi | ae8e9a7 | 2016-08-03 17:38:03 -0700 | [diff] [blame] | 1293 | #if defined(CONFIG_ICNSS) || defined(CONFIG_CNSS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1294 | /* start timer in sta/p2p_cli */ |
| 1295 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1296 | pAdapter->prev_tx_packets = pAdapter->stats.tx_packets; |
| 1297 | pAdapter->prev_rx_packets = pAdapter->stats.rx_packets; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1298 | cdp_get_intra_bss_fwd_pkts_count( |
| 1299 | cds_get_context(QDF_MODULE_ID_SOC), pAdapter->sessionId, |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1300 | &pAdapter->prev_fwd_tx_packets, |
| 1301 | &pAdapter->prev_fwd_rx_packets); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1302 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
| 1303 | hdd_start_bus_bw_compute_timer(pAdapter); |
| 1304 | #endif |
| 1305 | #endif |
| 1306 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
| 1307 | pHddStaCtx->conn_info.connState) { |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 1308 | cds_update_connection_info(pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1309 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId.bytes, |
| 1310 | ETH_ALEN); |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 1311 | hdd_err("wlan: new IBSS connection to " MAC_ADDRESS_STR, |
| 1312 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes)); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1313 | |
| 1314 | qdf_status = hdd_add_peer_object(pAdapter->hdd_vdev, |
| 1315 | QDF_IBSS_MODE, |
| 1316 | pCsrRoamInfo->bssid.bytes); |
| 1317 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 1318 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1319 | MAC_ADDR_ARRAY(pCsrRoamInfo->bssid.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1320 | } else { /* Not Associated */ |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 1321 | hdd_err("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1322 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Chandrasekaran, Manishekar | 6e9aa1b | 2015-12-02 18:04:00 +0530 | [diff] [blame] | 1323 | cds_decr_session_set_pcl(pAdapter->device_mode, |
| 1324 | pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1325 | |
| 1326 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1327 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1328 | #endif |
| 1329 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1330 | if ((pAdapter->device_mode == QDF_STA_MODE) || |
| 1331 | (pAdapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1332 | qdf_copy_macaddr(&peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1333 | &pHddStaCtx->conn_info.bssId); |
| 1334 | |
| 1335 | /* send peer status indication to oem app */ |
| 1336 | hdd_send_peer_status_ind_to_oem_app(&peerMacAddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1337 | ePeerDisconnected, 0, |
| 1338 | pAdapter->sessionId, |
| 1339 | NULL, |
| 1340 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1341 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1342 | |
| 1343 | qdf_status = hdd_remove_peer_object(pAdapter->hdd_vdev, |
| 1344 | peerMacAddr.bytes); |
| 1345 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 1346 | hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails", |
| 1347 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
| 1348 | |
Jeff Johnson | cef59bb | 2016-09-23 15:28:47 -0700 | [diff] [blame] | 1349 | hdd_lpass_notify_disconnect(pAdapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1350 | /* Update tdls module about the disconnection event */ |
| 1351 | wlan_hdd_tdls_notify_disconnect(pAdapter); |
| 1352 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1353 | #ifdef MSM_PLATFORM |
| 1354 | /* stop timer in sta/p2p_cli */ |
| 1355 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1356 | pAdapter->prev_tx_packets = 0; |
| 1357 | pAdapter->prev_rx_packets = 0; |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1358 | pAdapter->prev_fwd_tx_packets = 0; |
| 1359 | pAdapter->prev_fwd_rx_packets = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1360 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
| 1361 | hdd_stop_bus_bw_compute_timer(pAdapter); |
| 1362 | #endif |
| 1363 | } |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 1364 | cds_dump_concurrency_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1365 | /* Send SCC/MCC Switching event to IPA */ |
| 1366 | hdd_ipa_send_mcc_scc_msg(pHddCtx, pHddCtx->mcc_mode); |
| 1367 | |
| 1368 | msg = NULL; |
| 1369 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 1370 | driver so not sending the status of the connection to supplicant */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1371 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1372 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1373 | #ifdef FEATURE_WLAN_ESE |
| 1374 | if (eConnectionState_Associated == |
| 1375 | pHddStaCtx->conn_info.connState) { |
| 1376 | if ((pRoamProfile->AuthType.authType[0] == |
| 1377 | eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1378 | (pRoamProfile->AuthType.authType[0] == |
| 1379 | eCSR_AUTH_TYPE_CCKM_WPA)) |
| 1380 | hdd_send_new_ap_channel_info(dev, pAdapter, |
| 1381 | pCsrRoamInfo); |
| 1382 | } |
| 1383 | #endif |
| 1384 | } |
| 1385 | } |
| 1386 | |
| 1387 | /** |
| 1388 | * hdd_conn_remove_connect_info() - remove connection info |
| 1389 | * @pHddStaCtx: pointer to global HDD station context |
| 1390 | * @pCsrRoamInfo: pointer to roam info |
| 1391 | * |
| 1392 | * Return: none |
| 1393 | */ |
| 1394 | static void hdd_conn_remove_connect_info(hdd_station_ctx_t *pHddStaCtx) |
| 1395 | { |
| 1396 | /* Remove staId, bssId and peerMacAddress */ |
| 1397 | pHddStaCtx->conn_info.staId[0] = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1398 | qdf_mem_zero(&pHddStaCtx->conn_info.bssId, QDF_MAC_ADDR_SIZE); |
| 1399 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1400 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1401 | |
| 1402 | /* Clear all security settings */ |
| 1403 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1404 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1405 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1406 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1407 | qdf_mem_zero(&pHddStaCtx->conn_info.Keys, sizeof(tCsrKeys)); |
| 1408 | qdf_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1409 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1410 | pHddStaCtx->conn_info.proxyARPService = 0; |
| 1411 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1412 | qdf_mem_zero(&pHddStaCtx->conn_info.SSID, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1413 | } |
| 1414 | |
| 1415 | /** |
| 1416 | * hdd_roam_deregister_sta() - deregister station |
| 1417 | * @pAdapter: pointer to adapter |
| 1418 | * @staId: station identifier |
| 1419 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1420 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1421 | */ |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 1422 | QDF_STATUS hdd_roam_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1423 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1424 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1425 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1426 | |
| 1427 | if (eConnectionState_IbssDisconnected == |
| 1428 | pHddStaCtx->conn_info.connState) { |
| 1429 | /* |
| 1430 | * Do not set the carrier off when the last peer leaves. |
| 1431 | * We will set the carrier off while stopping the IBSS. |
| 1432 | */ |
| 1433 | } |
| 1434 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1435 | qdf_status = cdp_peer_clear(cds_get_context(QDF_MODULE_ID_SOC), |
| 1436 | cds_get_context(QDF_MODULE_ID_TXRX), staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1437 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1438 | hdd_err("cdp_peer_clear() failed for staID %d. Status(%d) [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1439 | staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1440 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1441 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1442 | } |
| 1443 | |
| 1444 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1445 | * hdd_print_bss_info() - print bss info |
| 1446 | * @hdd_sta_ctx: pointer to hdd station context |
| 1447 | * |
| 1448 | * Return: None |
| 1449 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1450 | static void hdd_print_bss_info(hdd_station_ctx_t *hdd_sta_ctx) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1451 | { |
| 1452 | uint32_t *cap_info; |
| 1453 | |
| 1454 | hdd_info("WIFI DATA LOGGER"); |
| 1455 | hdd_info("channel: %d", |
| 1456 | hdd_sta_ctx->conn_info.freq); |
| 1457 | hdd_info("dot11mode: %d", |
| 1458 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1459 | hdd_info("AKM: %d", |
| 1460 | hdd_sta_ctx->conn_info.authType); |
| 1461 | hdd_info("ssid: %.*s", |
| 1462 | hdd_sta_ctx->conn_info.SSID.SSID.length, |
| 1463 | hdd_sta_ctx->conn_info.SSID.SSID.ssId); |
| 1464 | hdd_info("roam count: %d", |
| 1465 | hdd_sta_ctx->conn_info.roam_count); |
| 1466 | hdd_info("ant_info: %d", |
| 1467 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1468 | hdd_info("datarate legacy %d", |
| 1469 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1470 | hdd_info("datarate mcs: %d", |
| 1471 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1472 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1473 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1474 | hdd_info("ht caps: %x", *cap_info); |
| 1475 | } |
| 1476 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1477 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1478 | hdd_info("vht caps: %x", *cap_info); |
| 1479 | } |
| 1480 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1481 | hdd_info("hs20 info: %x", |
| 1482 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1483 | hdd_info("signal: %d", |
| 1484 | hdd_sta_ctx->conn_info.signal); |
| 1485 | hdd_info("noise: %d", |
| 1486 | hdd_sta_ctx->conn_info.noise); |
| 1487 | } |
| 1488 | |
| 1489 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1490 | * hdd_dis_connect_handler() - disconnect event handler |
| 1491 | * @pAdapter: pointer to adapter |
| 1492 | * @pRoamInfo: pointer to roam info |
| 1493 | * @roamId: roam identifier |
| 1494 | * @roamStatus: roam status |
| 1495 | * @roamResult: roam result |
| 1496 | * |
| 1497 | * This function handles disconnect event: |
| 1498 | * 1. Disable transmit queues; |
| 1499 | * 2. Clean up internal connection states and data structures; |
| 1500 | * 3. Send disconnect indication to supplicant. |
| 1501 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1502 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1503 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1504 | static QDF_STATUS hdd_dis_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1505 | tCsrRoamInfo *pRoamInfo, |
| 1506 | uint32_t roamId, |
| 1507 | eRoamCmdStatus roamStatus, |
| 1508 | eCsrRoamResult roamResult) |
| 1509 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1510 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1511 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1512 | struct net_device *dev = pAdapter->dev; |
| 1513 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1514 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1515 | uint8_t sta_id; |
| 1516 | bool sendDisconInd = true; |
| 1517 | |
| 1518 | if (dev == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1519 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1520 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1521 | } |
| 1522 | /* notify apps that we can't pass traffic anymore */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1523 | hdd_notice("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1524 | wlan_hdd_netif_queue_control(pAdapter, WLAN_NETIF_TX_DISABLE_N_CARRIER, |
| 1525 | WLAN_CONTROL_PATH); |
| 1526 | |
| 1527 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 1528 | hdd_ipa_wlan_evt(pAdapter, pHddStaCtx->conn_info.staId[0], |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 1529 | HDD_IPA_STA_DISCONNECT, |
| 1530 | pHddStaCtx->conn_info.bssId.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1531 | |
| 1532 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1533 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1534 | #endif |
| 1535 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1536 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 1537 | pAdapter->sessionId, |
| 1538 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1539 | |
| 1540 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1541 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1542 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1543 | * to cfg80211_disconnected. |
| 1544 | */ |
| 1545 | if ((eConnectionState_Disconnecting == |
| 1546 | pHddStaCtx->conn_info.connState) || |
| 1547 | (eConnectionState_NotConnected == |
| 1548 | pHddStaCtx->conn_info.connState)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1549 | hdd_notice("HDD has initiated a disconnect, no need to send disconnect indication to kernel"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1550 | sendDisconInd = false; |
| 1551 | } |
| 1552 | |
| 1553 | if (pHddStaCtx->conn_info.connState != eConnectionState_Disconnecting) { |
| 1554 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1555 | hdd_conn_set_connection_state(pAdapter, |
| 1556 | eConnectionState_Disconnecting); |
| 1557 | } |
| 1558 | |
| 1559 | hdd_clear_roam_profile_ie(pAdapter); |
| 1560 | hdd_wmm_init(pAdapter); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1561 | hdd_info("Invoking packetdump deregistration API"); |
| 1562 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1563 | |
| 1564 | /* indicate 'disconnect' status to wpa_supplicant... */ |
| 1565 | hdd_send_association_event(dev, pRoamInfo); |
| 1566 | /* indicate disconnected event to nl80211 */ |
| 1567 | if (roamStatus != eCSR_ROAM_IBSS_LEAVE) { |
| 1568 | /* |
| 1569 | * Only send indication to kernel if not initiated |
| 1570 | * by kernel |
| 1571 | */ |
| 1572 | if (sendDisconInd) { |
| 1573 | /* |
| 1574 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1575 | * to ICS UI. |
| 1576 | */ |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1577 | if (eCSR_ROAM_LOSTLINK == roamStatus) { |
| 1578 | if (pRoamInfo->reasonCode == |
| 1579 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
| 1580 | pr_info("wlan: disconnected due to poor signal, rssi is %d dB\n", pRoamInfo->rxRssi); |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1581 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1582 | dev, false, |
| 1583 | pRoamInfo->reasonCode); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1584 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1585 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1586 | dev, false, |
| 1587 | WLAN_REASON_UNSPECIFIED |
| 1588 | ); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1589 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1590 | |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1591 | hdd_info("sent disconnected event to nl80211, reason code %d", |
| 1592 | (eCSR_ROAM_LOSTLINK == roamStatus) ? |
| 1593 | pRoamInfo->reasonCode : |
| 1594 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1595 | } |
| 1596 | /* |
| 1597 | * During the WLAN uninitialization,supplicant is stopped |
| 1598 | * before the driver so not sending the status of the |
| 1599 | * connection to supplicant. |
| 1600 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1601 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1602 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1603 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1604 | if (global_p2p_connection_status == |
| 1605 | P2P_CLIENT_CONNECTED_STATE_1) { |
| 1606 | global_p2p_connection_status = |
| 1607 | P2P_CLIENT_DISCONNECTED_STATE; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1608 | hdd_err("[P2P State] 8 way Handshake completed and moved to disconnected state"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1609 | } else if (global_p2p_connection_status == |
| 1610 | P2P_CLIENT_COMPLETED_STATE) { |
| 1611 | global_p2p_connection_status = |
| 1612 | P2P_NOT_ACTIVE; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1613 | hdd_err("[P2P State] P2P Client is removed and moved to inactive state"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1614 | } |
| 1615 | } |
| 1616 | #endif |
| 1617 | |
| 1618 | } |
| 1619 | } |
| 1620 | |
| 1621 | hdd_wmm_adapter_clear(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1622 | sme_ft_reset(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1623 | if (hdd_remove_beacon_filter(pAdapter) != 0) |
| 1624 | hdd_err("hdd_remove_beacon_filter() failed"); |
| 1625 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1626 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1627 | uint8_t i; |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 1628 | sta_id = pHddStaCtx->broadcast_staid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1629 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1630 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 1631 | hdd_err("hdd_roam_deregister_sta() failed for staID %d Status=%d [0x%x]", |
| 1632 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1633 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | } |
| 1635 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1636 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1637 | for (i = 0; i < MAX_PEERS; i++) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1638 | if (0 == pHddStaCtx->conn_info.staId[i]) |
| 1639 | continue; |
| 1640 | sta_id = pHddStaCtx->conn_info.staId[i]; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1641 | hdd_info("Deregister StaID %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1642 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1643 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1644 | hdd_err("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]", |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1645 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1646 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1647 | } |
| 1648 | /* set the staid and peer mac as 0, all other |
| 1649 | * reset are done in hdd_connRemoveConnectInfo. |
| 1650 | */ |
| 1651 | pHddStaCtx->conn_info.staId[i] = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1652 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1653 | sizeof(struct qdf_mac_addr)); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1654 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1655 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1656 | } |
| 1657 | } else { |
| 1658 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1659 | |
| 1660 | /* clear scan cache for Link Lost */ |
| 1661 | if (pRoamInfo && !pRoamInfo->reasonCode && |
| 1662 | (eCSR_ROAM_RESULT_DEAUTH_IND == roamResult)) { |
| 1663 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 1664 | pHddStaCtx->conn_info.bssId.bytes); |
| 1665 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1666 | pHddStaCtx->conn_info.bssId.bytes); |
| 1667 | } |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1668 | /* We should clear all sta register with TL, |
| 1669 | * for now, only one. |
| 1670 | */ |
| 1671 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1672 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1673 | hdd_err("hdd_roam_deregister_sta() failed to for staID %d. Status= %d [0x%x]", |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1674 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1675 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1676 | } |
| 1677 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1678 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1679 | /* Clear saved connection information in HDD */ |
| 1680 | hdd_conn_remove_connect_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1681 | hdd_conn_set_connection_state(pAdapter, eConnectionState_NotConnected); |
| 1682 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1683 | if ((QDF_STA_MODE == pAdapter->device_mode) || |
| 1684 | (QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1685 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 1686 | sizeof(tSirGtkOffloadParams)); |
| 1687 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
| 1688 | } |
| 1689 | #endif |
| 1690 | |
| 1691 | #ifdef FEATURE_WLAN_TDLS |
| 1692 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1693 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1694 | #endif |
| 1695 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1696 | if ((QDF_STA_MODE == pAdapter->device_mode) || |
| 1697 | (QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1698 | sme_ps_disable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX |
| 1699 | (pAdapter), |
| 1700 | pAdapter->sessionId); |
| 1701 | } |
Mahesh A Saptasagar | 6dda202 | 2016-09-03 12:59:09 +0530 | [diff] [blame] | 1702 | wlan_hdd_clear_link_layer_stats(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1703 | /* Unblock anyone waiting for disconnect to complete */ |
| 1704 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1705 | hdd_print_bss_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1706 | return status; |
| 1707 | } |
| 1708 | |
| 1709 | /** |
| 1710 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1711 | * @vdev_id: vdevid |
| 1712 | * |
| 1713 | * Return: None |
| 1714 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1715 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1716 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1717 | hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1718 | hdd_adapter_t *adapter = NULL; |
| 1719 | |
| 1720 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
| 1721 | if (adapter == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1722 | hdd_err("Invalid vdev_id"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1723 | } |
| 1724 | complete(&adapter->sta_authorized_event); |
| 1725 | } |
| 1726 | |
| 1727 | /** |
| 1728 | * hdd_change_peer_state() - change peer state |
| 1729 | * @pAdapter: HDD adapter |
| 1730 | * @sta_state: peer state |
| 1731 | * @roam_synch_in_progress: roam synch in progress |
| 1732 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1733 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1734 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1735 | QDF_STATUS hdd_change_peer_state(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1736 | uint8_t sta_id, |
| 1737 | enum ol_txrx_peer_state sta_state, |
| 1738 | bool roam_synch_in_progress) |
| 1739 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1740 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1741 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1742 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1743 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1744 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1745 | |
| 1746 | if (!pdev) { |
| 1747 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1748 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1749 | } |
| 1750 | |
| 1751 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1752 | hdd_err("Invalid sta id :%d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1753 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1754 | } |
| 1755 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1756 | peer = cdp_peer_find_by_local_id(soc, pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1757 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1758 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1759 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1760 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1761 | if (peer_mac_addr == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1762 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1763 | return QDF_STATUS_E_FAULT; |
| 1764 | } |
| 1765 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1766 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1767 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1768 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1769 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1770 | } |
| 1771 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1772 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1773 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1774 | #endif |
| 1775 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1776 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1777 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 1778 | /* make sure event is reset */ |
| 1779 | INIT_COMPLETION(pAdapter->sta_authorized_event); |
| 1780 | #endif |
| 1781 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1782 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1783 | hdd_set_peer_authorized_event, |
| 1784 | pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1785 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1786 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1787 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1788 | } |
| 1789 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1790 | if (pAdapter->device_mode == QDF_STA_MODE || |
| 1791 | pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1792 | #if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || defined(QCA_LL_TX_FLOW_CONTROL_V2) |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1793 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1794 | unsigned long rc; |
| 1795 | |
| 1796 | /* wait for event from firmware to set the event */ |
| 1797 | rc = wait_for_completion_timeout( |
| 1798 | &pAdapter->sta_authorized_event, |
| 1799 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
| 1800 | if (!rc) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1801 | hdd_notice("timeout waiting for sta_authorized_event"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1802 | } |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1803 | vdev = cdp_peer_get_vdev(soc, peer); |
| 1804 | cdp_fc_vdev_unpause(soc, vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1805 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1806 | #endif |
| 1807 | } |
| 1808 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1809 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1810 | } |
| 1811 | |
| 1812 | /** |
| 1813 | * hdd_roam_register_sta() - register station |
| 1814 | * @pAdapter: pointer to adapter |
| 1815 | * @pRoamInfo: pointer to roam info |
| 1816 | * @staId: station identifier |
| 1817 | * @pPeerMacAddress: peer MAC address |
| 1818 | * @pBssDesc: pointer to BSS description |
| 1819 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1820 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1821 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 1822 | QDF_STATUS hdd_roam_register_sta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1823 | tCsrRoamInfo *pRoamInfo, |
| 1824 | uint8_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1825 | struct qdf_mac_addr *pPeerMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1826 | tSirBssDescription *pBssDesc) |
| 1827 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1828 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | struct ol_txrx_desc_type staDesc = { 0 }; |
| 1830 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 1831 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1832 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1833 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1834 | |
| 1835 | if (NULL == pBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1836 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1837 | |
| 1838 | /* Get the Station ID from the one saved during the association */ |
| 1839 | staDesc.sta_id = staId; |
| 1840 | |
| 1841 | /* set the QoS field appropriately */ |
| 1842 | if (hdd_wmm_is_active(pAdapter)) |
| 1843 | staDesc.is_qos_enabled = 1; |
| 1844 | else |
| 1845 | staDesc.is_qos_enabled = 0; |
| 1846 | |
| 1847 | #ifdef FEATURE_WLAN_WAPI |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1848 | hdd_notice("WAPI STA Registered: %d", |
| 1849 | pAdapter->wapi_info.fIsWapiSta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1850 | if (pAdapter->wapi_info.fIsWapiSta) |
| 1851 | staDesc.is_wapi_supported = 1; |
| 1852 | else |
| 1853 | staDesc.is_wapi_supported = 0; |
| 1854 | #endif /* FEATURE_WLAN_WAPI */ |
| 1855 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1856 | /* Register the vdev transmit and receive functions */ |
| 1857 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 1858 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1859 | |
| 1860 | pAdapter->txrx_vdev = cdp_get_vdev_from_vdev_id(soc, pdev, |
| 1861 | pAdapter->sessionId); |
| 1862 | if (!pAdapter->txrx_vdev) { |
| 1863 | hdd_err("%s find vdev fail", __func__); |
| 1864 | return QDF_STATUS_E_FAILURE; |
| 1865 | } |
| 1866 | |
| 1867 | txrx_ops.tx.tx = NULL; |
| 1868 | cdp_vdev_register(soc, pAdapter->txrx_vdev, pAdapter, &txrx_ops); |
| 1869 | if (!txrx_ops.tx.tx) { |
| 1870 | hdd_err("%s vdev register fail", __func__); |
| 1871 | return QDF_STATUS_E_FAILURE; |
| 1872 | } |
| 1873 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1874 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1875 | qdf_status = cdp_peer_register(soc, pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1876 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1877 | hdd_warn("cdp_peer_register() failed to register. Status=%d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1878 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1879 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1880 | } |
| 1881 | |
| 1882 | if (!pRoamInfo->fAuthRequired) { |
| 1883 | /* |
| 1884 | * Connections that do not need Upper layer auth, transition |
| 1885 | * TLSHIM directly to 'Authenticated' state |
| 1886 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1887 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1888 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1889 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1890 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1891 | pRoamInfo->roamSynchInProgress |
| 1892 | #else |
| 1893 | false |
| 1894 | #endif |
| 1895 | ); |
| 1896 | |
| 1897 | hdd_conn_set_authenticated(pAdapter, true); |
| 1898 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1899 | hdd_info("ULA auth StaId= %d. Changing TL state to CONNECTED at Join time", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1900 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1901 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1902 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1903 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1904 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1905 | pRoamInfo->roamSynchInProgress |
| 1906 | #else |
| 1907 | false |
| 1908 | #endif |
| 1909 | ); |
| 1910 | hdd_conn_set_authenticated(pAdapter, false); |
| 1911 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1912 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1913 | } |
| 1914 | |
| 1915 | /** |
| 1916 | * hdd_send_re_assoc_event() - send reassoc event |
| 1917 | * @dev: pointer to net device |
| 1918 | * @pAdapter: pointer to adapter |
| 1919 | * @pCsrRoamInfo: pointer to roam info |
| 1920 | * @reqRsnIe: pointer to RSN Information element |
| 1921 | * @reqRsnLength: length of RSN IE |
| 1922 | * |
| 1923 | * Return: none |
| 1924 | */ |
| 1925 | static void hdd_send_re_assoc_event(struct net_device *dev, |
| 1926 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo, |
| 1927 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 1928 | { |
| 1929 | unsigned int len = 0; |
| 1930 | u8 *pFTAssocRsp = NULL; |
| 1931 | uint8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 1932 | uint8_t *assoc_req_ies = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1933 | uint32_t rspRsnLength = 0; |
| 1934 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1935 | uint8_t buf_ssid_ie[2 + SIR_MAC_SSID_EID_MAX]; /* 2 bytes-EID and len */ |
| 1936 | uint8_t *buf_ptr, ssid_ie_len; |
| 1937 | struct cfg80211_bss *bss = NULL; |
| 1938 | uint8_t *final_req_ie = NULL; |
| 1939 | tCsrRoamConnectedProfile roam_profile; |
| 1940 | tHalHandle hal_handle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1941 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 1942 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 1943 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | if (!rspRsnIe) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1945 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 1946 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1947 | } |
| 1948 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 1949 | if (!assoc_req_ies) { |
| 1950 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 1951 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 1952 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1953 | if (pCsrRoamInfo == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1954 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1955 | goto done; |
| 1956 | } |
| 1957 | |
| 1958 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1959 | hdd_err("Invalid assoc response length"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1960 | goto done; |
| 1961 | } |
| 1962 | |
| 1963 | pFTAssocRsp = |
| 1964 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 1965 | pCsrRoamInfo->nAssocReqLength); |
| 1966 | if (pFTAssocRsp == NULL) |
| 1967 | goto done; |
| 1968 | |
| 1969 | /* pFTAssocRsp needs to point to the IEs */ |
| 1970 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1971 | hdd_info("AssocRsp is now at %02x%02x", |
| 1972 | (unsigned int)pFTAssocRsp[0], (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1973 | |
| 1974 | /* |
| 1975 | * Active session count is decremented upon disconnection, but during |
| 1976 | * roaming, there is no disconnect indication and hence active session |
| 1977 | * count is not decremented. |
| 1978 | * After roaming is completed, active session count is incremented |
| 1979 | * as a part of connect indication but effectively after roaming the |
| 1980 | * active session count should still be the same and hence upon |
| 1981 | * successful reassoc decrement the active session count here. |
| 1982 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1983 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Chandrasekaran, Manishekar | 6e9aa1b | 2015-12-02 18:04:00 +0530 | [diff] [blame] | 1984 | cds_decr_session_set_pcl(pAdapter->device_mode, |
| 1985 | pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1986 | |
| 1987 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
| 1988 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 1989 | rspRsnLength = len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1990 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 1991 | qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1992 | |
| 1993 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
| 1994 | (int)pCsrRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | sme_roam_get_connect_profile(hal_handle, pAdapter->sessionId, |
| 1996 | &roam_profile); |
| 1997 | bss = cfg80211_get_bss(pAdapter->wdev.wiphy, chan, |
| 1998 | pCsrRoamInfo->bssid.bytes, |
| 1999 | &roam_profile.SSID.ssId[0], roam_profile.SSID.length, |
Ryan Hsu | 535d16a | 2016-01-18 16:45:12 -0800 | [diff] [blame] | 2000 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) && !defined(WITH_BACKPORTS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2001 | WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); |
Ryan Hsu | 535d16a | 2016-01-18 16:45:12 -0800 | [diff] [blame] | 2002 | #else |
| 2003 | IEEE80211_BSS_TYPE_ESS, IEEE80211_PRIVACY_ANY); |
| 2004 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2005 | |
| 2006 | if (bss == NULL) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2007 | hdd_err("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2008 | buf_ptr = buf_ssid_ie; |
| 2009 | *buf_ptr = SIR_MAC_SSID_EID; |
| 2010 | buf_ptr++; |
| 2011 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2012 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2013 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2014 | roam_profile.SSID.length); |
| 2015 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2016 | hdd_notice("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2017 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2018 | buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2019 | final_req_ie = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); |
| 2020 | if (final_req_ie == NULL) |
| 2021 | goto done; |
| 2022 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2023 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2024 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2025 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
| 2026 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2027 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2028 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2029 | hdd_notice("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2030 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2031 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2032 | cfg80211_roamed_bss(dev, bss, |
| 2033 | final_req_ie, (ssid_ie_len + reqRsnLength), |
| 2034 | rspRsnIe, rspRsnLength, GFP_KERNEL); |
| 2035 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2036 | qdf_mem_copy(assoc_req_ies, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2037 | (u8 *)pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength, |
| 2038 | pCsrRoamInfo->nAssocReqLength); |
| 2039 | |
| 2040 | hdd_notice("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2041 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2042 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength); |
| 2043 | |
Prakash Dhavali | 989127d | 2016-11-29 14:56:44 +0530 | [diff] [blame] | 2044 | wlan_hdd_send_roam_auth_event(pAdapter, pCsrRoamInfo->bssid.bytes, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2045 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength, |
| 2046 | rspRsnIe, rspRsnLength, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2047 | pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2048 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2049 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2050 | if (final_req_ie) |
| 2051 | kfree(final_req_ie); |
| 2052 | kfree(rspRsnIe); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2053 | kfree(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2054 | } |
| 2055 | |
| 2056 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2057 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2058 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2059 | * |
| 2060 | * Return: roam sync status if roaming offloaded else false |
| 2061 | */ |
| 2062 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2063 | bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2064 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2065 | if (roaminfo) |
| 2066 | return roaminfo->roamSynchInProgress; |
| 2067 | else |
| 2068 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2069 | } |
| 2070 | #endif |
| 2071 | |
| 2072 | |
| 2073 | /** |
| 2074 | * hdd_change_sta_state_authenticated()- |
| 2075 | * This function changes STA state to authenticated |
| 2076 | * @adapter: pointer to the adapter structure. |
| 2077 | * @roaminfo: pointer to the RoamInfo structure. |
| 2078 | * |
| 2079 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2080 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2081 | * |
| 2082 | * Return: 0 on success and errno on failure |
| 2083 | */ |
| 2084 | static int hdd_change_sta_state_authenticated(hdd_adapter_t *adapter, |
| 2085 | tCsrRoamInfo *roaminfo) |
| 2086 | { |
| 2087 | int ret; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2088 | uint32_t timeout; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2089 | hdd_station_ctx_t *hddstactx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2090 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2091 | |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2092 | timeout = hddstactx->hdd_ReassocScenario ? |
| 2093 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2094 | hdd_ctx->config->auto_bmps_timer_val * 1000; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2095 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2096 | hdd_info("Changing TL state to AUTHENTICATED for StaId= %d", |
| 2097 | hddstactx->conn_info.staId[0]); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2098 | |
| 2099 | /* Connections that do not need Upper layer authentication, |
| 2100 | * transition TL to 'Authenticated' state after the keys are set |
| 2101 | */ |
| 2102 | ret = hdd_change_peer_state(adapter, |
| 2103 | hddstactx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2104 | OL_TXRX_PEER_STATE_AUTH, |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2105 | hdd_is_roam_sync_in_progress(roaminfo)); |
| 2106 | hdd_conn_set_authenticated(adapter, true); |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2107 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 2108 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2109 | sme_ps_enable_auto_ps_timer( |
| 2110 | WLAN_HDD_GET_HAL_CTX(adapter), |
| 2111 | adapter->sessionId, |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2112 | timeout); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2113 | } |
| 2114 | |
| 2115 | return ret; |
| 2116 | } |
| 2117 | |
| 2118 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2119 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
| 2120 | * @pAdapter: pointer to adapter |
| 2121 | * @pRoamInfo: pointer to roam info |
| 2122 | * @roamId: roam id |
| 2123 | * @roamStatus: roam status |
| 2124 | * @roamResult: roam result |
| 2125 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2126 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2127 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2128 | static QDF_STATUS hdd_roam_set_key_complete_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2129 | tCsrRoamInfo *pRoamInfo, |
| 2130 | uint32_t roamId, |
| 2131 | eRoamCmdStatus roamStatus, |
| 2132 | eCsrRoamResult roamResult) |
| 2133 | { |
| 2134 | eCsrEncryptionType connectedCipherAlgo; |
| 2135 | bool fConnected = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2136 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2137 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2138 | tHalHandle hal_ctx = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2139 | tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); |
| 2140 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2141 | ENTER(); |
| 2142 | |
| 2143 | if (NULL == pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2144 | hdd_info("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2145 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2146 | } |
| 2147 | /* |
| 2148 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2149 | * then go to 'authenticated'. For all other authentication types |
| 2150 | * (those that do not require upper layer authentication) we can put TL |
| 2151 | * directly into 'authenticated' state. |
| 2152 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2153 | hdd_info("Set Key completion roamStatus =%d roamResult=%d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2154 | MAC_ADDRESS_STR, roamStatus, roamResult, |
| 2155 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 2156 | |
| 2157 | fConnected = hdd_conn_get_connected_cipher_algo(pHddStaCtx, |
| 2158 | &connectedCipherAlgo); |
| 2159 | if (fConnected) { |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2160 | if (QDF_IBSS_MODE == pAdapter->device_mode) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2161 | uint8_t staId; |
| 2162 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 2163 | if (qdf_is_macaddr_broadcast(&pRoamInfo->peerMac)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2164 | pHddStaCtx->roam_info.roamingState = |
| 2165 | HDD_ROAM_STATE_NONE; |
| 2166 | } else { |
Deepak Dhamdhere | 5872c8c | 2016-06-02 15:51:47 -0700 | [diff] [blame] | 2167 | qdf_status = hdd_get_peer_sta_id( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2168 | pHddStaCtx, |
| 2169 | &pRoamInfo->peerMac, |
| 2170 | &staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2171 | if (QDF_STATUS_SUCCESS == qdf_status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2172 | hdd_info("WLAN TL STA Ptk Installed for STAID=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2173 | staId); |
| 2174 | pHddStaCtx->roam_info.roamingState = |
| 2175 | HDD_ROAM_STATE_NONE; |
| 2176 | } |
| 2177 | } |
| 2178 | } else { |
| 2179 | /* |
| 2180 | * TODO: Considering getting a state machine in |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2181 | * HDD later.This routine is invoked twice. |
| 2182 | * 1)set PTK 2)set GTK.The following if |
| 2183 | * statement will be TRUE when setting GTK. |
| 2184 | * At this time we don't handle the state in detail. |
| 2185 | * Related CR: 174048 - TL not in authenticated state |
| 2186 | */ |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2187 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2188 | pHddStaCtx->conn_info.gtk_installed = true; |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2189 | /* |
| 2190 | * PTK exchange happens in preauthentication |
| 2191 | * itself if key_mgmt is FT-PSK, ptk_installed |
| 2192 | * was false as there is no set PTK after |
| 2193 | * roaming. STA TL state moves to authenticated |
| 2194 | * only if ptk_installed is true. So, make |
| 2195 | * ptk_installed to true in case of 11R roaming. |
| 2196 | */ |
| 2197 | if (csr_neighbor_roam_is11r_assoc(mac_ctx, |
| 2198 | pAdapter->sessionId)) |
| 2199 | pHddStaCtx->conn_info.ptk_installed = |
| 2200 | true; |
| 2201 | } else { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2202 | pHddStaCtx->conn_info.ptk_installed = true; |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2203 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2204 | |
| 2205 | /* In WPA case move STA to authenticated when |
| 2206 | * ptk is installed.Earlier in WEP case STA |
| 2207 | * was moved to AUTHENTICATED prior to setting |
| 2208 | * the unicast key and it was resulting in sending |
| 2209 | * few un-encrypted packet. Now in WEP case |
| 2210 | * STA state will be moved to AUTHENTICATED |
| 2211 | * after we set the unicast and broadcast key. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2212 | */ |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2213 | if ((pHddStaCtx->conn_info.ucEncryptionType == |
| 2214 | eCSR_ENCRYPT_TYPE_WEP40) || |
| 2215 | (pHddStaCtx->conn_info.ucEncryptionType == |
| 2216 | eCSR_ENCRYPT_TYPE_WEP104) || |
| 2217 | (pHddStaCtx->conn_info.ucEncryptionType == |
| 2218 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2219 | (pHddStaCtx->conn_info.ucEncryptionType == |
| 2220 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2221 | if (pHddStaCtx->conn_info.gtk_installed && |
| 2222 | pHddStaCtx->conn_info.ptk_installed) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2223 | qdf_status = |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2224 | hdd_change_sta_state_authenticated(pAdapter, |
| 2225 | pRoamInfo); |
| 2226 | } else if (pHddStaCtx->conn_info.ptk_installed) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2227 | qdf_status = |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2228 | hdd_change_sta_state_authenticated(pAdapter, |
| 2229 | pRoamInfo); |
| 2230 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2231 | |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2232 | if (pHddStaCtx->conn_info.gtk_installed && |
| 2233 | pHddStaCtx->conn_info.ptk_installed) { |
| 2234 | pHddStaCtx->conn_info.gtk_installed = false; |
| 2235 | pHddStaCtx->conn_info.ptk_installed = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2236 | } |
| 2237 | |
| 2238 | pHddStaCtx->roam_info.roamingState = |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2239 | HDD_ROAM_STATE_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2240 | } |
| 2241 | } else { |
| 2242 | /* |
| 2243 | * possible disassoc after issuing set key and waiting |
| 2244 | * set key complete. |
| 2245 | */ |
| 2246 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2247 | } |
| 2248 | |
| 2249 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2250 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2251 | } |
| 2252 | |
| 2253 | /** |
| 2254 | * hdd_perform_roam_set_key_complete() - perform set key complete |
| 2255 | * @pAdapter: pointer to adapter |
| 2256 | * |
| 2257 | * Return: none |
| 2258 | */ |
| 2259 | void hdd_perform_roam_set_key_complete(hdd_adapter_t *pAdapter) |
| 2260 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2261 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2262 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2263 | tCsrRoamInfo roamInfo; |
| 2264 | roamInfo.fAuthRequired = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2265 | qdf_mem_copy(roamInfo.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2266 | pHddStaCtx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2267 | qdf_mem_copy(roamInfo.peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2268 | pHddStaCtx->roam_info.peerMac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2269 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2270 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2271 | hdd_roam_set_key_complete_handler(pAdapter, |
| 2272 | &roamInfo, |
| 2273 | pHddStaCtx->roam_info.roamId, |
| 2274 | pHddStaCtx->roam_info.roamStatus, |
| 2275 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2276 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2277 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2278 | |
| 2279 | pHddStaCtx->roam_info.deferKeyComplete = false; |
| 2280 | } |
| 2281 | |
| 2282 | /** |
| 2283 | * hdd_association_completion_handler() - association completion handler |
| 2284 | * @pAdapter: pointer to adapter |
| 2285 | * @pRoamInfo: pointer to roam info |
| 2286 | * @roamId: roam id |
| 2287 | * @roamStatus: roam status |
| 2288 | * @roamResult: roam result |
| 2289 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2290 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2291 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2292 | static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2293 | tCsrRoamInfo *pRoamInfo, |
| 2294 | uint32_t roamId, |
| 2295 | eRoamCmdStatus roamStatus, |
| 2296 | eCsrRoamResult roamResult) |
| 2297 | { |
| 2298 | struct net_device *dev = pAdapter->dev; |
| 2299 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2300 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2301 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2302 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2303 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2304 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2305 | bool hddDisconInProgress = false; |
| 2306 | unsigned long rc; |
| 2307 | |
| 2308 | if (!pHddCtx) { |
| 2309 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2310 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2311 | } |
| 2312 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2313 | /* validate config */ |
| 2314 | if (!pHddCtx->config) { |
| 2315 | hdd_err("config is NULL"); |
| 2316 | return QDF_STATUS_E_NULL_VALUE; |
| 2317 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2318 | /* HDD has initiated disconnect, do not send connect result indication |
| 2319 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2320 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2321 | if (((eConnectionState_Disconnecting == |
| 2322 | pHddStaCtx->conn_info.connState) || |
| 2323 | (eConnectionState_NotConnected == |
| 2324 | pHddStaCtx->conn_info.connState)) && |
| 2325 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2326 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2327 | hdd_info("Disconnect from HDD in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2328 | hddDisconInProgress = true; |
| 2329 | } |
| 2330 | |
| 2331 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) { |
| 2332 | if (NULL == pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2333 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2334 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2335 | } |
| 2336 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2337 | hdd_conn_set_connection_state(pAdapter, |
| 2338 | eConnectionState_Associated); |
| 2339 | } |
| 2340 | /* Save the connection info from CSR... */ |
| 2341 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, |
| 2342 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2343 | |
| 2344 | if (hdd_add_beacon_filter(pAdapter) != 0) |
| 2345 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2346 | #ifdef FEATURE_WLAN_WAPI |
| 2347 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2348 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
| 2349 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2350 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
| 2351 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2352 | } else { |
| 2353 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2354 | } |
| 2355 | #endif /* FEATURE_WLAN_WAPI */ |
| 2356 | |
| 2357 | /* Indicate 'connect' status to user space */ |
| 2358 | hdd_send_association_event(dev, pRoamInfo); |
| 2359 | |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 2360 | if (cds_is_mcc_in_24G()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2361 | if (pHddCtx->miracast_value) |
| 2362 | cds_set_mas(pAdapter, pHddCtx->miracast_value); |
| 2363 | } |
| 2364 | |
| 2365 | /* Initialize the Linkup event completion variable */ |
| 2366 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2367 | |
| 2368 | /* |
| 2369 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2370 | * the device properly. Before allowing any packet to go up to |
| 2371 | * the application, device activation has to be ensured for |
| 2372 | * proper queue mapping by the kernel. we have registered net |
| 2373 | * device notifier for device change notification. With this we |
| 2374 | * will come to know that the device is getting |
| 2375 | * activated properly. |
| 2376 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2377 | if (pHddStaCtx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2378 | /* |
| 2379 | * Enable Linkup Event Servicing which allows the net |
| 2380 | * device notifier to set the linkup event variable. |
| 2381 | */ |
| 2382 | pAdapter->isLinkUpSvcNeeded = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2383 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2384 | /* Switch on the Carrier to activate the device */ |
| 2385 | wlan_hdd_netif_queue_control(pAdapter, |
| 2386 | WLAN_NETIF_CARRIER_ON, |
| 2387 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2388 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2389 | /* |
| 2390 | * Wait for the Link to up to ensure all the queues |
| 2391 | * are set properly by the kernel. |
| 2392 | */ |
| 2393 | rc = wait_for_completion_timeout( |
| 2394 | &pAdapter->linkup_event_var, |
| 2395 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2396 | ); |
| 2397 | if (!rc) |
| 2398 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2399 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2400 | /* |
| 2401 | * Disable Linkup Event Servicing - no more service |
| 2402 | * required from the net device notifier call. |
| 2403 | */ |
| 2404 | pAdapter->isLinkUpSvcNeeded = false; |
| 2405 | } else { |
| 2406 | pHddStaCtx->ft_carrier_on = false; |
| 2407 | ft_carrier_on = true; |
| 2408 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2409 | if ((WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId) |
| 2410 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2411 | else |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2412 | hdd_err("Wrong Staid: %d", pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2413 | |
| 2414 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2415 | |
| 2416 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 2417 | hdd_ipa_wlan_evt(pAdapter, pRoamInfo->staId, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 2418 | HDD_IPA_STA_CONNECT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2419 | pRoamInfo->bssid.bytes); |
| 2420 | |
| 2421 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2422 | wlan_hdd_auto_shutdown_enable(pHddCtx, false); |
| 2423 | #endif |
| 2424 | |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 2425 | hdd_info("check for SAP restart"); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 2426 | cds_check_concurrent_intf_and_restart_sap(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2427 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2428 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 2429 | pAdapter->sessionId, |
| 2430 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2431 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2432 | /* |
| 2433 | * For reassoc, the station is already registered, all we need |
| 2434 | * is to change the state of the STA in TL. |
| 2435 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2436 | * CONNECTED instead of AUTHENTICATED. |
| 2437 | */ |
| 2438 | if (!pRoamInfo->fReassocReq) { |
| 2439 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2440 | u8 *pFTAssocRsp = NULL; |
| 2441 | unsigned int assocRsplen = 0; |
| 2442 | u8 *pFTAssocReq = NULL; |
| 2443 | unsigned int assocReqlen = 0; |
| 2444 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2445 | uint8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2446 | uint32_t rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
| 2447 | |
| 2448 | /* add bss_id to cfg80211 data base */ |
| 2449 | bss = |
| 2450 | wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 2451 | pRoamInfo); |
| 2452 | if (NULL == bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2453 | hdd_err("wlan: Not able to create BSS entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2454 | wlan_hdd_netif_queue_control(pAdapter, |
| 2455 | WLAN_NETIF_CARRIER_OFF, |
| 2456 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2457 | if (!hddDisconInProgress) { |
| 2458 | /* |
| 2459 | * Here driver was not able to add bss |
| 2460 | * in cfg80211 database this can happen |
| 2461 | * if connected channel is not valid, |
| 2462 | * i.e reg domain was changed during |
| 2463 | * connection. Queue disconnect for the |
| 2464 | * session if disconnect is not in |
| 2465 | * progress. |
| 2466 | */ |
| 2467 | hdd_err("Disconnecting..."); |
| 2468 | sme_roam_disconnect( |
| 2469 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2470 | pAdapter->sessionId, |
| 2471 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2472 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2473 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2474 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2475 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2476 | eCSR_AUTH_TYPE_FT_RSN |
| 2477 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2478 | eCSR_AUTH_TYPE_FT_RSN_PSK) { |
| 2479 | |
| 2480 | /* Association Response */ |
| 2481 | pFTAssocRsp = |
| 2482 | (u8 *) (pRoamInfo->pbFrames + |
| 2483 | pRoamInfo->nBeaconLength + |
| 2484 | pRoamInfo->nAssocReqLength); |
| 2485 | if (pFTAssocRsp != NULL) { |
| 2486 | /* |
| 2487 | * pFTAssocRsp needs to point to the IEs |
| 2488 | */ |
| 2489 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2490 | hdd_info("AssocRsp is now at %02x%02x", |
| 2491 | (unsigned int)pFTAssocRsp[0], |
| 2492 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2493 | assocRsplen = |
| 2494 | pRoamInfo->nAssocRspLength - |
| 2495 | FT_ASSOC_RSP_IES_OFFSET; |
| 2496 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2497 | hdd_err("AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2498 | assocRsplen = 0; |
| 2499 | } |
| 2500 | |
| 2501 | /* Association Request */ |
| 2502 | pFTAssocReq = (u8 *) (pRoamInfo->pbFrames + |
| 2503 | pRoamInfo->nBeaconLength); |
| 2504 | if (pFTAssocReq != NULL) { |
| 2505 | if (!ft_carrier_on) { |
| 2506 | /* |
| 2507 | * pFTAssocReq needs to point to |
| 2508 | * the IEs |
| 2509 | */ |
| 2510 | pFTAssocReq += |
| 2511 | FT_ASSOC_REQ_IES_OFFSET; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2512 | hdd_info("pFTAssocReq is now at %02x%02x", |
| 2513 | (unsigned int) |
| 2514 | pFTAssocReq[0], |
| 2515 | (unsigned int) |
| 2516 | pFTAssocReq[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2517 | assocReqlen = |
| 2518 | pRoamInfo->nAssocReqLength - |
| 2519 | FT_ASSOC_REQ_IES_OFFSET; |
| 2520 | } else { |
| 2521 | /* |
| 2522 | * This should contain only the |
| 2523 | * FTIEs |
| 2524 | */ |
| 2525 | assocReqlen = |
| 2526 | pRoamInfo->nAssocReqLength; |
| 2527 | } |
| 2528 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2529 | hdd_err("AssocReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2530 | assocReqlen = 0; |
| 2531 | } |
| 2532 | |
| 2533 | if (ft_carrier_on) { |
| 2534 | if (!hddDisconInProgress) { |
| 2535 | /* |
| 2536 | * After roaming is completed, |
| 2537 | * active session count is |
| 2538 | * incremented as a part of |
| 2539 | * connect indication but |
| 2540 | * effectively the active |
| 2541 | * session count should still |
| 2542 | * be the same and hence upon |
| 2543 | * successful reassoc |
| 2544 | * decrement the active session |
| 2545 | * count here. |
| 2546 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2547 | if (!hdd_is_roam_sync_in_progress |
| 2548 | (pRoamInfo)) |
| 2549 | cds_decr_session_set_pcl |
| 2550 | (pAdapter->device_mode, |
| 2551 | pAdapter->sessionId); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2552 | hdd_info("ft_carrier_on is %d, sending roamed indication", |
| 2553 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2554 | chan = |
| 2555 | ieee80211_get_channel |
| 2556 | (pAdapter->wdev.wiphy, |
| 2557 | (int)pRoamInfo->pBssDesc-> |
| 2558 | channelId); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2559 | hdd_info( |
| 2560 | "assocReqlen %d assocRsplen %d", |
| 2561 | assocReqlen, |
| 2562 | assocRsplen); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2563 | |
| 2564 | hdd_notice( |
| 2565 | "Reassoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2566 | QDF_TRACE_HEX_DUMP( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2567 | QDF_MODULE_ID_HDD, |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2568 | QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2569 | pFTAssocReq, |
| 2570 | assocReqlen); |
| 2571 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2572 | cfg80211_roamed(dev, chan, |
| 2573 | pRoamInfo-> |
| 2574 | bssid.bytes, |
| 2575 | pFTAssocReq, |
| 2576 | assocReqlen, |
| 2577 | pFTAssocRsp, |
| 2578 | assocRsplen, |
| 2579 | GFP_KERNEL); |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2580 | wlan_hdd_send_roam_auth_event( |
Prakash Dhavali | 989127d | 2016-11-29 14:56:44 +0530 | [diff] [blame] | 2581 | pAdapter, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2582 | pRoamInfo->bssid.bytes, |
| 2583 | pFTAssocReq, |
| 2584 | assocReqlen, |
| 2585 | pFTAssocRsp, |
| 2586 | assocRsplen, |
| 2587 | pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2588 | } |
| 2589 | if (sme_get_ftptk_state |
| 2590 | (WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2591 | pAdapter->sessionId)) { |
| 2592 | sme_set_ftptk_state |
| 2593 | (WLAN_HDD_GET_HAL_CTX |
| 2594 | (pAdapter), |
| 2595 | pAdapter->sessionId, |
| 2596 | false); |
| 2597 | pRoamInfo->fAuthRequired = |
| 2598 | false; |
| 2599 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2600 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2601 | roam_info.bssid, |
| 2602 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2603 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2604 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2605 | roam_info.peerMac, |
| 2606 | pRoamInfo->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2607 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2608 | pHddStaCtx->roam_info.roamId = |
| 2609 | roamId; |
| 2610 | pHddStaCtx->roam_info. |
| 2611 | roamStatus = roamStatus; |
| 2612 | pHddStaCtx->roam_info. |
| 2613 | deferKeyComplete = true; |
| 2614 | } |
| 2615 | } else if (!hddDisconInProgress) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2616 | hdd_info("ft_carrier_on is %d, sending connect indication", |
| 2617 | ft_carrier_on); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2618 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2619 | pRoamInfo-> |
| 2620 | bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2621 | pRoamInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2622 | pFTAssocReq, |
| 2623 | assocReqlen, |
| 2624 | pFTAssocRsp, |
| 2625 | assocRsplen, |
| 2626 | WLAN_STATUS_SUCCESS, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2627 | GFP_KERNEL, |
| 2628 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2629 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 2630 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2631 | /* |
| 2632 | * wpa supplicant expecting WPA/RSN IE in |
| 2633 | * connect result. |
| 2634 | */ |
| 2635 | csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX |
| 2636 | (pAdapter), |
| 2637 | pAdapter->sessionId, |
| 2638 | &reqRsnLength, |
| 2639 | reqRsnIe); |
| 2640 | |
| 2641 | csr_roam_get_wpa_rsn_rsp_ie(WLAN_HDD_GET_HAL_CTX |
| 2642 | (pAdapter), |
| 2643 | pAdapter->sessionId, |
| 2644 | &rspRsnLength, |
| 2645 | rspRsnIe); |
| 2646 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2647 | if (ft_carrier_on) |
| 2648 | hdd_send_re_assoc_event(dev, |
| 2649 | pAdapter, |
| 2650 | pRoamInfo, |
| 2651 | reqRsnIe, |
| 2652 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2653 | else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2654 | hdd_info("sending connect indication to nl80211:for bssid " |
| 2655 | MAC_ADDRESS_STR |
| 2656 | " result:%d and Status:%d", |
| 2657 | MAC_ADDR_ARRAY |
| 2658 | (pRoamInfo->bssid.bytes), |
| 2659 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2660 | |
| 2661 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2662 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2663 | pRoamInfo-> |
| 2664 | bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2665 | pRoamInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2666 | reqRsnIe, |
| 2667 | reqRsnLength, |
| 2668 | rspRsnIe, |
| 2669 | rspRsnLength, |
| 2670 | WLAN_STATUS_SUCCESS, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2671 | GFP_KERNEL, |
| 2672 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2673 | } |
| 2674 | } |
| 2675 | } |
| 2676 | if (!hddDisconInProgress) { |
| 2677 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2678 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2679 | bss); |
| 2680 | |
| 2681 | /* |
| 2682 | * Perform any WMM-related association |
| 2683 | * processing. |
| 2684 | */ |
| 2685 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2686 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2687 | |
| 2688 | /* |
| 2689 | * Start the Queue - Start tx queues before |
| 2690 | * hdd_roam_register_sta, since |
| 2691 | * hdd_roam_register_sta will flush any cached |
| 2692 | * data frames immediately. |
| 2693 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2694 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2695 | wlan_hdd_netif_queue_control(pAdapter, |
| 2696 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2697 | WLAN_CONTROL_PATH); |
| 2698 | |
| 2699 | /* |
| 2700 | * Register the Station with TL after associated |
| 2701 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2702 | qdf_status = hdd_roam_register_sta(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2703 | pRoamInfo, |
| 2704 | pHddStaCtx-> |
| 2705 | conn_info. |
| 2706 | staId[0], |
| 2707 | NULL, |
| 2708 | pRoamInfo-> |
| 2709 | pBssDesc); |
| 2710 | } |
| 2711 | } else { |
| 2712 | /* |
| 2713 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 2714 | * in case of reassociation also need to indicate it to |
| 2715 | * supplicant. |
| 2716 | */ |
| 2717 | csr_roam_get_wpa_rsn_req_ie( |
| 2718 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2719 | pAdapter->sessionId, |
| 2720 | &reqRsnLength, reqRsnIe); |
| 2721 | |
| 2722 | hdd_send_re_assoc_event(dev, pAdapter, pRoamInfo, |
| 2723 | reqRsnIe, reqRsnLength); |
| 2724 | /* Reassoc successfully */ |
| 2725 | if (pRoamInfo->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2726 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2727 | hdd_change_peer_state(pAdapter, |
| 2728 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2729 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2730 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2731 | pRoamInfo->roamSynchInProgress |
| 2732 | #else |
| 2733 | false |
| 2734 | #endif |
| 2735 | ); |
| 2736 | hdd_conn_set_authenticated(pAdapter, false); |
| 2737 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2738 | hdd_info("staId: %d Changing TL state to AUTHENTICATED", |
| 2739 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2740 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2741 | hdd_change_peer_state(pAdapter, |
| 2742 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2743 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2745 | pRoamInfo->roamSynchInProgress |
| 2746 | #else |
| 2747 | false |
| 2748 | #endif |
| 2749 | ); |
| 2750 | hdd_conn_set_authenticated(pAdapter, true); |
| 2751 | } |
| 2752 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2753 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2754 | /* |
| 2755 | * Perform any WMM-related association |
| 2756 | * processing |
| 2757 | */ |
| 2758 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2759 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2760 | } |
| 2761 | |
| 2762 | /* Start the tx queues */ |
| 2763 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2764 | if (pRoamInfo->roamSynchInProgress) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2765 | hdd_info("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2766 | #endif |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2767 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2768 | wlan_hdd_netif_queue_control(pAdapter, |
| 2769 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2770 | WLAN_CONTROL_PATH); |
| 2771 | } |
| 2772 | |
Padma, Santhosh Kumar | 724f63d | 2016-08-09 16:04:31 +0530 | [diff] [blame] | 2773 | #ifdef FEATURE_WLAN_TDLS |
| 2774 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 2775 | #endif |
| 2776 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2777 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2778 | hdd_err("STA register with TL failed. status(=%d) [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2779 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2780 | } |
| 2781 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2782 | qdf_mem_zero(&pAdapter->hdd_stats.hddPmfStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2783 | sizeof(pAdapter->hdd_stats.hddPmfStats)); |
| 2784 | #endif |
| 2785 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2786 | bool connect_timeout = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2787 | hdd_wext_state_t *pWextState = |
| 2788 | WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2789 | if (pRoamInfo) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2790 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
| 2791 | " result:%d and Status:%d", |
| 2792 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 2793 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2794 | else |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 2795 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
| 2796 | " result:%d and Status:%d", |
| 2797 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 2798 | roamResult, roamStatus); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 2799 | |
| 2800 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 2801 | (pRoamInfo && |
| 2802 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
| 2803 | pRoamInfo->statusCode) || |
| 2804 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
| 2805 | pRoamInfo->statusCode) || |
| 2806 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
| 2807 | pRoamInfo->statusCode)))) { |
| 2808 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 2809 | pRoamInfo ? |
| 2810 | pRoamInfo->bssid.bytes : |
| 2811 | pWextState->req_bssId.bytes); |
| 2812 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 2813 | pRoamInfo ? |
| 2814 | pRoamInfo->bssid.bytes : |
| 2815 | pWextState->req_bssId.bytes); |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2816 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 2817 | } |
| 2818 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2819 | /* |
| 2820 | * CR465478: Only send up a connection failure result when CSR |
| 2821 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 2822 | */ |
| 2823 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus |
| 2824 | && !hddDisconInProgress) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 2825 | if (pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2826 | hdd_err("send connect failure to nl80211: for bssid " |
| 2827 | MAC_ADDRESS_STR |
| 2828 | " result:%d and Status:%d reasoncode %d", |
| 2829 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 2830 | roamResult, roamStatus, |
| 2831 | pRoamInfo->reasonCode); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 2832 | pHddStaCtx->conn_info.assoc_status_code = |
| 2833 | pRoamInfo->statusCode; |
| 2834 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2835 | else |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2836 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2837 | MAC_ADDRESS_STR |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2838 | " result:%d and Status:%d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2839 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 2840 | roamResult, roamStatus); |
| 2841 | |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 2842 | hdd_err("Invoking packetdump deregistration API"); |
| 2843 | wlan_deregister_txrx_packetdump(); |
| 2844 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2845 | /* inform association failure event to nl80211 */ |
| 2846 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
| 2847 | roamResult) { |
| 2848 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2849 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2850 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2851 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2852 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2853 | GFP_KERNEL, |
| 2854 | connect_timeout); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2855 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2856 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2857 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2858 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2859 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2860 | GFP_KERNEL, |
| 2861 | connect_timeout); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2862 | } else { |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 2863 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2864 | hdd_connect_result(dev, |
| 2865 | pRoamInfo->bssid.bytes, |
| 2866 | NULL, NULL, 0, NULL, 0, |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 2867 | pRoamInfo->reasonCode ? |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 2868 | pRoamInfo->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2869 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2870 | GFP_KERNEL, |
| 2871 | connect_timeout); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 2872 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2873 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2874 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2875 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2876 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2877 | GFP_KERNEL, |
| 2878 | connect_timeout); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2879 | } |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 2880 | hdd_clear_roam_profile_ie(pAdapter); |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 2881 | } else if ((eCSR_ROAM_CANCELLED == roamStatus |
| 2882 | && !hddDisconInProgress)) { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2883 | hdd_connect_result(dev, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 2884 | pWextState->req_bssId.bytes, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2885 | NULL, NULL, 0, NULL, 0, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 2886 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 2887 | GFP_KERNEL, |
| 2888 | connect_timeout); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2889 | } |
| 2890 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2891 | /* |
| 2892 | * Set connection state to eConnectionState_NotConnected only |
| 2893 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 2894 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2895 | */ |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 2896 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) || |
| 2897 | (eCSR_ROAM_CANCELLED == roamStatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2898 | && !hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2899 | hdd_conn_set_connection_state(pAdapter, |
| 2900 | eConnectionState_NotConnected); |
| 2901 | } |
| 2902 | hdd_wmm_init(pAdapter); |
| 2903 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2904 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2905 | wlan_hdd_netif_queue_control(pAdapter, |
| 2906 | WLAN_NETIF_TX_DISABLE_N_CARRIER, |
| 2907 | WLAN_CONTROL_PATH); |
| 2908 | } |
| 2909 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2910 | if (QDF_STATUS_SUCCESS != cds_check_and_restart_sap( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2911 | roamResult, pHddStaCtx)) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2912 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2913 | |
Govind Singh | 24db1ed | 2015-12-18 15:54:59 +0530 | [diff] [blame] | 2914 | if (NULL != pRoamInfo && NULL != pRoamInfo->pBssDesc) { |
| 2915 | cds_force_sap_on_scc(roamResult, |
| 2916 | pRoamInfo->pBssDesc->channelId); |
| 2917 | } else { |
| 2918 | hdd_err("pRoamInfo profile is not set properly"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2919 | return QDF_STATUS_E_FAILURE; |
Govind Singh | 24db1ed | 2015-12-18 15:54:59 +0530 | [diff] [blame] | 2920 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2921 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2922 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2923 | } |
| 2924 | |
| 2925 | /** |
| 2926 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
| 2927 | * @pAdapter: pointer to adapter |
| 2928 | * @pRoamInfo: pointer to roam info |
| 2929 | * @roamId: roam id |
| 2930 | * @roamStatus: roam status |
| 2931 | * @roamResult: roam result |
| 2932 | * |
| 2933 | * Here we update the status of the Ibss when we receive information that we |
| 2934 | * have started/joined an ibss session. |
| 2935 | * |
| 2936 | * Return: none |
| 2937 | */ |
| 2938 | static void hdd_roam_ibss_indication_handler(hdd_adapter_t *pAdapter, |
| 2939 | tCsrRoamInfo *pRoamInfo, |
| 2940 | uint32_t roamId, |
| 2941 | eRoamCmdStatus roamStatus, |
| 2942 | eCsrRoamResult roamResult) |
| 2943 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2944 | hdd_info("%s: id %d, status %d, result %d", |
| 2945 | pAdapter->dev->name, roamId, |
| 2946 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2947 | |
| 2948 | switch (roamResult) { |
| 2949 | /* both IBSS Started and IBSS Join should come in here. */ |
| 2950 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 2951 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 2952 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 2953 | { |
| 2954 | hdd_context_t *pHddCtx = |
| 2955 | (hdd_context_t *) pAdapter->pHddCtx; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 2956 | hdd_station_ctx_t *hdd_sta_ctx = |
| 2957 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2958 | struct qdf_mac_addr broadcastMacAddr = |
| 2959 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2960 | |
| 2961 | if (NULL == pRoamInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2962 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2963 | return; |
| 2964 | } |
| 2965 | |
| 2966 | /* When IBSS Started comes from CSR, we need to move |
| 2967 | * connection state to IBSS Disconnected (meaning no peers |
| 2968 | * are in the IBSS). |
| 2969 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2970 | hdd_conn_set_connection_state(pAdapter, |
| 2971 | eConnectionState_IbssDisconnected); |
| 2972 | /* notify wmm */ |
| 2973 | hdd_wmm_connect(pAdapter, pRoamInfo, |
| 2974 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 2975 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 2976 | hdd_sta_ctx->broadcast_staid = pRoamInfo->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 2977 | |
| 2978 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2979 | pAdapter; |
| 2980 | hdd_roam_register_sta(pAdapter, pRoamInfo, |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 2981 | pRoamInfo->staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2982 | &broadcastMacAddr, |
| 2983 | pRoamInfo->pBssDesc); |
| 2984 | |
| 2985 | if (pRoamInfo->pBssDesc) { |
| 2986 | struct cfg80211_bss *bss; |
| 2987 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 2988 | struct ieee80211_channel *chan; |
| 2989 | int chan_no; |
| 2990 | unsigned int freq; |
| 2991 | #endif |
| 2992 | /* we created the IBSS, notify supplicant */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2993 | hdd_info("%s: created ibss " MAC_ADDRESS_STR, |
| 2994 | pAdapter->dev->name, |
| 2995 | MAC_ADDR_ARRAY( |
| 2996 | pRoamInfo->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2997 | |
| 2998 | /* we must first give cfg80211 the BSS information */ |
| 2999 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 3000 | pRoamInfo); |
| 3001 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3002 | hdd_err("%s: unable to create IBSS entry", |
| 3003 | pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3004 | return; |
| 3005 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3006 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3007 | wlan_hdd_netif_queue_control(pAdapter, |
| 3008 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3009 | WLAN_CONTROL_PATH); |
| 3010 | |
| 3011 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3012 | chan_no = pRoamInfo->pBssDesc->channelId; |
| 3013 | |
| 3014 | if (chan_no <= 14) |
| 3015 | freq = ieee80211_channel_to_frequency(chan_no, |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 3016 | NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3017 | else |
| 3018 | freq = ieee80211_channel_to_frequency(chan_no, |
Dustin Brown | a30892e | 2016-10-12 17:28:36 -0700 | [diff] [blame] | 3019 | NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3020 | |
| 3021 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 3022 | |
| 3023 | if (chan) |
| 3024 | cfg80211_ibss_joined(pAdapter->dev, |
| 3025 | bss->bssid, chan, |
| 3026 | GFP_KERNEL); |
| 3027 | else |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3028 | hdd_err("%s: chanId: %d, can't find channel", |
| 3029 | pAdapter->dev->name, |
| 3030 | (int)pRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3031 | #else |
| 3032 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 3033 | GFP_KERNEL); |
| 3034 | #endif |
| 3035 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3036 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3037 | bss); |
| 3038 | } |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3039 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roamResult) { |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 3040 | cds_incr_active_session(pAdapter->device_mode, |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3041 | pAdapter->sessionId); |
| 3042 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roamResult || |
| 3043 | eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) { |
Tushnim Bhattacharyya | ca50b32 | 2015-12-28 17:14:36 -0800 | [diff] [blame] | 3044 | cds_update_connection_info(pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3045 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3046 | break; |
| 3047 | } |
| 3048 | |
| 3049 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3050 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3051 | hdd_err("%s: unable to create IBSS", pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3052 | break; |
| 3053 | } |
| 3054 | |
| 3055 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3056 | hdd_err("%s: unexpected result %d", |
| 3057 | pAdapter->dev->name, (int)roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3058 | break; |
| 3059 | } |
| 3060 | |
| 3061 | return; |
| 3062 | } |
| 3063 | |
| 3064 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3065 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3066 | * @sta_ctx: pointer to hdd station context |
| 3067 | * @sta_id: station ID |
| 3068 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3069 | * |
| 3070 | * This information is passed to iwconfig later. The peer that joined |
| 3071 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3072 | |
| 3073 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3074 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3075 | bool hdd_save_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id, |
| 3076 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3077 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3078 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3079 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3080 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
| 3081 | if (0 == sta_ctx->conn_info.staId[idx]) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3082 | hdd_info("adding peer: %pM, sta_id: %d, at idx: %d", |
| 3083 | peer_mac_addr, sta_id, idx); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3084 | sta_ctx->conn_info.staId[idx] = sta_id; |
| 3085 | qdf_copy_macaddr( |
| 3086 | &sta_ctx->conn_info.peerMacAddress[idx], |
| 3087 | peer_mac_addr); |
| 3088 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3089 | } |
| 3090 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3091 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3092 | } |
| 3093 | |
| 3094 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3095 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3096 | * @sta_ctx: pointer to hdd station context |
| 3097 | * @sta_id: station ID |
| 3098 | * |
| 3099 | * Return: None |
| 3100 | */ |
| 3101 | void hdd_delete_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id) |
| 3102 | { |
| 3103 | int i; |
| 3104 | |
| 3105 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
| 3106 | if (sta_id == sta_ctx->conn_info.staId[i]) { |
| 3107 | sta_ctx->conn_info.staId[i] = 0; |
| 3108 | return; |
| 3109 | } |
| 3110 | } |
| 3111 | |
| 3112 | hdd_err(FL("sta_id %d is not present in peer table"), sta_id); |
| 3113 | } |
| 3114 | |
| 3115 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3116 | * roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter |
| 3117 | * @pAdapter: pointer to adapter |
| 3118 | * @staId: station id |
| 3119 | * |
| 3120 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3121 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3122 | * false otherwise. |
| 3123 | */ |
| 3124 | static bool roam_remove_ibss_station(hdd_adapter_t *pAdapter, uint8_t staId) |
| 3125 | { |
| 3126 | bool fSuccess = false; |
| 3127 | int idx = 0; |
| 3128 | uint8_t valid_idx = 0; |
| 3129 | uint8_t del_idx = 0; |
| 3130 | uint8_t empty_slots = 0; |
| 3131 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3132 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3133 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3134 | if (staId == pHddStaCtx->conn_info.staId[idx]) { |
| 3135 | pHddStaCtx->conn_info.staId[idx] = 0; |
| 3136 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3137 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3138 | peerMacAddress[idx]); |
| 3139 | |
| 3140 | fSuccess = true; |
| 3141 | |
| 3142 | /* |
| 3143 | * Note the deleted Index, if its 0 we need special |
| 3144 | * handling. |
| 3145 | */ |
| 3146 | del_idx = idx; |
| 3147 | |
| 3148 | empty_slots++; |
| 3149 | } else { |
| 3150 | if (pHddStaCtx->conn_info.staId[idx] != 0) { |
| 3151 | valid_idx = idx; |
| 3152 | } else { |
| 3153 | /* Found an empty slot */ |
| 3154 | empty_slots++; |
| 3155 | } |
| 3156 | } |
| 3157 | } |
| 3158 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3159 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3160 | /* Last peer departed, set the IBSS state appropriately */ |
| 3161 | pHddStaCtx->conn_info.connState = |
| 3162 | eConnectionState_IbssDisconnected; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3163 | hdd_err("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3164 | } |
| 3165 | /* Find next active staId, to have a valid sta trigger for TL. */ |
| 3166 | if (fSuccess == true) { |
| 3167 | if (del_idx == 0) { |
| 3168 | if (pHddStaCtx->conn_info.staId[valid_idx] != 0) { |
| 3169 | pHddStaCtx->conn_info.staId[0] = |
| 3170 | pHddStaCtx->conn_info.staId[valid_idx]; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3171 | qdf_copy_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3172 | peerMacAddress[0], |
| 3173 | &pHddStaCtx->conn_info. |
| 3174 | peerMacAddress[valid_idx]); |
| 3175 | |
| 3176 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3177 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3178 | peerMacAddress[valid_idx]); |
| 3179 | } |
| 3180 | } |
| 3181 | } |
| 3182 | return fSuccess; |
| 3183 | } |
| 3184 | |
| 3185 | /** |
| 3186 | * roam_ibss_connect_handler() - IBSS connection handler |
| 3187 | * @pAdapter: pointer to adapter |
| 3188 | * @pRoamInfo: pointer to roam info |
| 3189 | * |
| 3190 | * We update the status of the IBSS to connected in this function. |
| 3191 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3192 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3193 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3194 | static QDF_STATUS roam_ibss_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3195 | tCsrRoamInfo *pRoamInfo) |
| 3196 | { |
| 3197 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3198 | /* |
| 3199 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3200 | * a partner stations). |
| 3201 | */ |
| 3202 | hdd_conn_set_connection_state(pAdapter, eConnectionState_IbssConnected); |
| 3203 | |
| 3204 | /* Save the connection info from CSR... */ |
| 3205 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
| 3206 | |
| 3207 | /* Send the bssid address to the wext. */ |
| 3208 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3209 | /* add bss_id to cfg80211 data base */ |
| 3210 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3211 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3212 | hdd_err("%s: unable to create IBSS entry", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3213 | pAdapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3214 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3215 | } |
| 3216 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3217 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3218 | bss); |
| 3219 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3220 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | } |
| 3222 | |
| 3223 | /** |
| 3224 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
| 3225 | * @pAdapter: pointer to adapter |
| 3226 | * @pRoamInfo: pointer to roam info |
| 3227 | * @roamId: roam id |
| 3228 | * @roamStatus: roam status |
| 3229 | * @roamResult: roam result |
| 3230 | * |
| 3231 | * This function indicates the Mic failure to the supplicant |
| 3232 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3233 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3234 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3235 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3236 | hdd_roam_mic_error_indication_handler(hdd_adapter_t *pAdapter, |
| 3237 | tCsrRoamInfo *pRoamInfo, |
| 3238 | uint32_t roamId, |
| 3239 | eRoamCmdStatus roamStatus, |
| 3240 | eCsrRoamResult roamResult) |
| 3241 | { |
| 3242 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3243 | |
| 3244 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3245 | TKIP_COUNTER_MEASURE_STOPED == |
| 3246 | pHddStaCtx->WextState.mTKIPCounterMeasures) { |
| 3247 | struct iw_michaelmicfailure msg; |
| 3248 | union iwreq_data wreq; |
| 3249 | memset(&msg, '\0', sizeof(msg)); |
| 3250 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3251 | memcpy(msg.src_addr.sa_data, |
| 3252 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3253 | sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr)); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3254 | hdd_info("MIC MAC " MAC_ADDRESS_STR, |
| 3255 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3256 | |
| 3257 | if (pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) |
| 3258 | msg.flags = IW_MICFAILURE_GROUP; |
| 3259 | else |
| 3260 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3261 | memset(&wreq, 0, sizeof(wreq)); |
| 3262 | wreq.data.length = sizeof(msg); |
| 3263 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, |
| 3264 | (char *)&msg); |
| 3265 | /* inform mic failure to nl80211 */ |
| 3266 | cfg80211_michael_mic_failure(pAdapter->dev, |
| 3267 | pRoamInfo->u.pMICFailureInfo-> |
| 3268 | taMacAddr, |
| 3269 | ((pRoamInfo->u.pMICFailureInfo-> |
| 3270 | multicast == |
| 3271 | eSIR_TRUE) ? |
| 3272 | NL80211_KEYTYPE_GROUP : |
| 3273 | NL80211_KEYTYPE_PAIRWISE), |
| 3274 | pRoamInfo->u.pMICFailureInfo-> |
| 3275 | keyId, |
| 3276 | pRoamInfo->u.pMICFailureInfo->TSC, |
| 3277 | GFP_KERNEL); |
| 3278 | |
| 3279 | } |
| 3280 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3281 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3282 | } |
| 3283 | |
| 3284 | /** |
| 3285 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
| 3286 | * @pAdapter: pointer to adapter |
| 3287 | * @pRoamInfo: pointer to roam info |
| 3288 | * @roamId: roam id |
| 3289 | * @roamStatus: roam status |
| 3290 | * @roamResult: roam result |
| 3291 | * |
| 3292 | * The Ibss connection status is updated regularly here in this function. |
| 3293 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3294 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3295 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3296 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3297 | roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter, |
| 3298 | tCsrRoamInfo *pRoamInfo, |
| 3299 | uint32_t roamId, |
| 3300 | eRoamCmdStatus roamStatus, |
| 3301 | eCsrRoamResult roamResult) |
| 3302 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3303 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3304 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3305 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3306 | switch (roamResult) { |
| 3307 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3308 | { |
| 3309 | hdd_station_ctx_t *pHddStaCtx = |
| 3310 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3311 | struct station_info *stainfo; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3312 | |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3313 | hdd_err("IBSS New Peer indication from SME " |
| 3314 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3315 | MAC_ADDRESS_STR " and stationID= %d", |
| 3316 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3317 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3318 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3319 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3320 | if (!hdd_save_peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3321 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 3322 | pRoamInfo->staId, |
| 3323 | &pRoamInfo->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3324 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3325 | break; |
| 3326 | } |
| 3327 | |
| 3328 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3329 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3330 | /* Register the Station with TL for the new peer. */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3331 | qdf_status = hdd_roam_register_sta(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3332 | pRoamInfo, |
| 3333 | pRoamInfo->staId, |
| 3334 | &pRoamInfo->peerMac, |
| 3335 | pRoamInfo->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3336 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3337 | hdd_err("Cannot register STA with TL for IBSS. Failed with qdf_status = %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3338 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3339 | } |
| 3340 | pHddStaCtx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3341 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
| 3342 | if (stainfo == NULL) { |
| 3343 | hdd_err("memory allocation for station_info failed"); |
| 3344 | return QDF_STATUS_E_NOMEM; |
| 3345 | } |
| 3346 | stainfo->filled = 0; |
| 3347 | stainfo->generation = pHddStaCtx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3348 | |
| 3349 | cfg80211_new_sta(pAdapter->dev, |
| 3350 | (const u8 *)pRoamInfo->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3351 | stainfo, GFP_KERNEL); |
| 3352 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3353 | |
| 3354 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == |
| 3355 | pHddStaCtx->ibss_enc_key.encType |
| 3356 | || eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == |
| 3357 | pHddStaCtx->ibss_enc_key.encType |
| 3358 | || eCSR_ENCRYPT_TYPE_TKIP == |
| 3359 | pHddStaCtx->ibss_enc_key.encType |
| 3360 | || eCSR_ENCRYPT_TYPE_AES == |
| 3361 | pHddStaCtx->ibss_enc_key.encType) { |
| 3362 | pHddStaCtx->ibss_enc_key.keyDirection = |
| 3363 | eSIR_TX_RX; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3364 | qdf_copy_macaddr(&pHddStaCtx->ibss_enc_key.peerMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3365 | &pRoamInfo->peerMac); |
| 3366 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3367 | hdd_info("New peer joined set PTK encType=%d", |
| 3368 | pHddStaCtx->ibss_enc_key.encType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3369 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3370 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3371 | sme_roam_set_key(WLAN_HDD_GET_HAL_CTX |
| 3372 | (pAdapter), |
| 3373 | pAdapter->sessionId, |
| 3374 | &pHddStaCtx->ibss_enc_key, |
| 3375 | &roamId); |
| 3376 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3377 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3378 | hdd_err("sme_roam_set_key failed, status=%d", |
| 3379 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3380 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3381 | } |
| 3382 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3383 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3384 | wlan_hdd_netif_queue_control(pAdapter, |
| 3385 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3386 | WLAN_CONTROL_PATH); |
| 3387 | break; |
| 3388 | } |
| 3389 | |
| 3390 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3391 | { |
| 3392 | |
| 3393 | roam_ibss_connect_handler(pAdapter, pRoamInfo); |
| 3394 | |
| 3395 | break; |
| 3396 | } |
| 3397 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3398 | { |
| 3399 | hdd_station_ctx_t *pHddStaCtx = |
| 3400 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3401 | |
| 3402 | if (!roam_remove_ibss_station(pAdapter, pRoamInfo->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3403 | hdd_warn("IBSS peer departed by cannot find peer in our registration table with TL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3404 | |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3405 | hdd_err("IBSS Peer Departed from SME " |
| 3406 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3407 | MAC_ADDRESS_STR " and stationID= %d", |
| 3408 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3409 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3410 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3411 | |
| 3412 | hdd_roam_deregister_sta(pAdapter, pRoamInfo->staId); |
| 3413 | |
| 3414 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
| 3415 | pHddStaCtx->ibss_sta_generation++; |
| 3416 | |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3417 | qdf_status = hdd_remove_peer_object(pAdapter->hdd_vdev, |
| 3418 | pRoamInfo->peerMac.bytes); |
| 3419 | if (QDF_IS_STATUS_ERROR(qdf_status)) |
| 3420 | hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails", |
| 3421 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 3422 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3423 | cfg80211_del_sta(pAdapter->dev, |
| 3424 | (const u8 *)&pRoamInfo->peerMac.bytes, |
| 3425 | GFP_KERNEL); |
| 3426 | break; |
| 3427 | } |
| 3428 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3429 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3430 | hdd_info("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3431 | /* Stop only when we are inactive */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3432 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3433 | wlan_hdd_netif_queue_control(pAdapter, |
| 3434 | WLAN_NETIF_TX_DISABLE_N_CARRIER, |
| 3435 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3436 | hdd_conn_set_connection_state(pAdapter, |
| 3437 | eConnectionState_NotConnected); |
| 3438 | |
| 3439 | /* Send the bssid address to the wext. */ |
| 3440 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3441 | break; |
| 3442 | } |
| 3443 | default: |
| 3444 | break; |
| 3445 | |
| 3446 | } |
| 3447 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3448 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3449 | } |
| 3450 | |
| 3451 | #ifdef FEATURE_WLAN_TDLS |
| 3452 | /** |
| 3453 | * hdd_roam_register_tdlssta() - register new TDLS station |
| 3454 | * @pAdapter: pointer to adapter |
| 3455 | * @peerMac: pointer to peer MAC address |
| 3456 | * @staId: station identifier |
| 3457 | * @ucastSig: unicast signature |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3458 | * @qos: QOS capability of TDLS station/link |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3459 | * |
| 3460 | * Construct the staDesc and register with TL the new STA. |
| 3461 | * This is called as part of ADD_STA in the TDLS setup. |
| 3462 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3463 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3464 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3465 | QDF_STATUS hdd_roam_register_tdlssta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3466 | const uint8_t *peerMac, uint16_t staId, |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3467 | uint8_t ucastSig, uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3468 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3469 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3470 | struct ol_txrx_desc_type staDesc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 3471 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3472 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 3473 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3474 | |
| 3475 | /* |
| 3476 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3477 | * be peer MAC, here we are working on direct Link |
| 3478 | */ |
| 3479 | staDesc.sta_id = staId; |
| 3480 | |
| 3481 | /* set the QoS field appropriately .. */ |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3482 | staDesc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3483 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3484 | /* Register the vdev transmit and receive functions */ |
| 3485 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 3486 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3487 | cdp_vdev_register(soc, |
| 3488 | cdp_get_vdev_from_vdev_id(soc, pdev, pAdapter->sessionId), |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3489 | pAdapter, &txrx_ops); |
| 3490 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3491 | |
| 3492 | /* Register the Station with TL... */ |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3493 | qdf_status = cdp_peer_register(soc, pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3494 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3495 | hdd_err("cdp_peer_register() failed to register. Status=%d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3496 | qdf_status, qdf_status); |
| 3497 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3498 | } |
| 3499 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3500 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3501 | } |
| 3502 | |
| 3503 | /** |
| 3504 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
| 3505 | * @pAdapter: pointer to adapter |
| 3506 | * @staId: station identifier |
| 3507 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3508 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3509 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3510 | static QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3511 | uint8_t staId) |
| 3512 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3513 | QDF_STATUS qdf_status; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3514 | qdf_status = cdp_peer_clear(cds_get_context(QDF_MODULE_ID_SOC), |
| 3515 | cds_get_context(QDF_MODULE_ID_TXRX), staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3516 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3517 | hdd_warn("cdp_peer_clear() failed for staID %d. Status=%d [0x%08X]", |
| 3518 | staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3519 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3520 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3521 | } |
| 3522 | |
| 3523 | /** |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3524 | * hdd_tdls_connection_tracker_update() - update connection tracker state |
| 3525 | * @adapter: pointer to adapter |
| 3526 | * @roam_info: pointer to roam info |
| 3527 | * @hdd_tdls_ctx: tdls context |
| 3528 | * |
| 3529 | * Return: QDF_STATUS enumeration |
| 3530 | */ |
| 3531 | static QDF_STATUS hdd_tdls_connection_tracker_update(hdd_adapter_t *adapter, |
| 3532 | tCsrRoamInfo *roam_info, |
| 3533 | tdlsCtx_t *hdd_tdls_ctx) |
| 3534 | { |
| 3535 | hddTdlsPeer_t *curr_peer; |
| 3536 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3537 | |
| 3538 | curr_peer = wlan_hdd_tdls_find_peer(adapter, |
| 3539 | roam_info->peerMac.bytes, true); |
| 3540 | |
| 3541 | if (!curr_peer) { |
| 3542 | hdd_err("curr_peer is null"); |
| 3543 | return QDF_STATUS_E_FAILURE; |
| 3544 | } |
| 3545 | |
| 3546 | mutex_lock(&hdd_ctx->tdls_lock); |
| 3547 | |
| 3548 | if (eTDLS_LINK_CONNECTED == |
| 3549 | curr_peer->link_status) { |
| 3550 | hdd_err("Received CONNECTION_TRACKER_NOTIFICATION " |
| 3551 | MAC_ADDRESS_STR |
| 3552 | " staId: %d, reason: %d", |
| 3553 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3554 | roam_info->staId, |
| 3555 | roam_info->reasonCode); |
| 3556 | |
| 3557 | if (roam_info->reasonCode == |
| 3558 | eWNI_TDLS_PEER_ENTER_BUF_STA || |
| 3559 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3560 | eWNI_TDLS_ENTER_BT_BUSY_MODE || |
| 3561 | roam_info->reasonCode == |
| 3562 | eWMI_TDLS_SCAN_STARTED_EVENT) |
| 3563 | hdd_ctx->enable_tdls_connection_tracker = false; |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3564 | else if (roam_info->reasonCode == |
| 3565 | eWNI_TDLS_PEER_EXIT_BUF_STA || |
| 3566 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3567 | eWNI_TDLS_EXIT_BT_BUSY_MODE || |
| 3568 | roam_info->reasonCode == |
| 3569 | eWMI_TDLS_SCAN_COMPLETED_EVENT) |
| 3570 | hdd_ctx->enable_tdls_connection_tracker = true; |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3571 | |
| 3572 | } else { |
| 3573 | hdd_err("TDLS not connected, ignore notification, reason: %d", |
| 3574 | roam_info->reasonCode); |
| 3575 | } |
| 3576 | |
| 3577 | mutex_unlock(&hdd_ctx->tdls_lock); |
| 3578 | |
| 3579 | return QDF_STATUS_SUCCESS; |
| 3580 | } |
| 3581 | |
| 3582 | |
| 3583 | |
| 3584 | |
| 3585 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3586 | * hdd_roam_tdls_status_update_handler() - TDLS status update handler |
| 3587 | * @pAdapter: pointer to adapter |
| 3588 | * @pRoamInfo: pointer to roam info |
| 3589 | * @roamId: roam id |
| 3590 | * @roamStatus: roam status |
| 3591 | * @roamResult: roam result |
| 3592 | * |
| 3593 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3594 | * TL in case of new TDLS client is added and deregistration at the time |
| 3595 | * TDLS client is deleted. |
| 3596 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3597 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3598 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3599 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3600 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 3601 | tCsrRoamInfo *pRoamInfo, |
| 3602 | uint32_t roamId, |
| 3603 | eRoamCmdStatus roamStatus, |
| 3604 | eCsrRoamResult roamResult) |
| 3605 | { |
| 3606 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3607 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 3608 | tSmeTdlsPeerStateParams smeTdlsPeerStateParams; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3609 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3610 | uint8_t staIdx; |
| 3611 | hddTdlsPeer_t *curr_peer; |
| 3612 | uint32_t reason; |
| 3613 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3614 | hdd_info("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3615 | roamResult == |
| 3616 | eCSR_ROAM_RESULT_ADD_TDLS_PEER ? "ADD_TDLS_PEER" : roamResult |
| 3617 | == |
| 3618 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? "DEL_TDLS_PEER" : |
| 3619 | roamResult == |
| 3620 | eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? "DEL_TDLS_PEER_IND" |
| 3621 | : roamResult == |
| 3622 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3623 | "DEL_ALL_TDLS_PEER_IND" : roamResult == |
| 3624 | eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? "UPDATE_TDLS_PEER" : |
| 3625 | roamResult == |
| 3626 | eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
| 3627 | "LINK_ESTABLISH_REQ_RSP" : roamResult == |
| 3628 | eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER ? "TDLS_SHOULD_DISCOVER" |
| 3629 | : roamResult == |
| 3630 | eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN ? "TDLS_SHOULD_TEARDOWN" |
| 3631 | : roamResult == |
| 3632 | eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED ? |
| 3633 | "TDLS_SHOULD_PEER_DISCONNECTED" : "UNKNOWN", pRoamInfo->staId, |
| 3634 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 3635 | |
| 3636 | if (!pHddTdlsCtx) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3637 | hdd_info("TDLS ctx is null, ignore roamResult (%d)", |
| 3638 | roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3639 | return status; |
| 3640 | } |
| 3641 | |
| 3642 | switch (roamResult) { |
| 3643 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3644 | { |
| 3645 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3646 | hdd_err("Add Sta failed. status code(=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3647 | pRoamInfo->statusCode); |
Selvaraj, Sridhar | 5d95e63 | 2016-09-14 17:00:38 +0530 | [diff] [blame] | 3648 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
| 3649 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | } else { |
| 3651 | /* |
| 3652 | * Check if there is available index for this new TDLS |
| 3653 | * STA. |
| 3654 | */ |
| 3655 | for (staIdx = 0; |
| 3656 | staIdx < pHddCtx->max_num_tdls_sta; |
| 3657 | staIdx++) { |
| 3658 | if (0 == |
| 3659 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3660 | staId) { |
| 3661 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3662 | sessionId = |
| 3663 | pRoamInfo->sessionId; |
| 3664 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3665 | staId = pRoamInfo->staId; |
| 3666 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3667 | hdd_warn("TDLS: STA IDX at %d is %d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3668 | "of mac " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3669 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3670 | staIdx, |
| 3671 | pHddCtx-> |
| 3672 | tdlsConnInfo[staIdx]. |
| 3673 | staId, |
| 3674 | MAC_ADDR_ARRAY |
| 3675 | (pRoamInfo->peerMac.bytes)); |
| 3676 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3677 | qdf_copy_macaddr(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3678 | tdlsConnInfo |
| 3679 | [staIdx]. |
| 3680 | peerMac, |
| 3681 | &pRoamInfo-> |
| 3682 | peerMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3683 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3684 | break; |
| 3685 | } |
| 3686 | } |
| 3687 | if (staIdx < pHddCtx->max_num_tdls_sta) { |
| 3688 | if (-1 == |
| 3689 | wlan_hdd_tdls_set_sta_id(pAdapter, |
| 3690 | pRoamInfo-> |
| 3691 | peerMac.bytes, |
| 3692 | pRoamInfo-> |
| 3693 | staId)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3694 | hdd_err("wlan_hdd_tdls_set_sta_id() failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3695 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3696 | } |
| 3697 | |
| 3698 | (WLAN_HDD_GET_CTX(pAdapter))-> |
| 3699 | sta_to_adapter[pRoamInfo->staId] = |
| 3700 | pAdapter; |
| 3701 | /* |
| 3702 | * store the ucast signature, |
| 3703 | * if required for further reference. |
| 3704 | */ |
| 3705 | |
| 3706 | wlan_hdd_tdls_set_signature(pAdapter, |
| 3707 | pRoamInfo-> |
| 3708 | peerMac.bytes, |
| 3709 | pRoamInfo-> |
| 3710 | ucastSig); |
| 3711 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3712 | status = QDF_STATUS_E_FAILURE; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3713 | hdd_err("no available slot in conn_info. staId %d cannot be stored", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3714 | pRoamInfo->staId); |
| 3715 | } |
| 3716 | pAdapter->tdlsAddStaStatus = status; |
| 3717 | } |
| 3718 | complete(&pAdapter->tdls_add_station_comp); |
| 3719 | break; |
| 3720 | } |
| 3721 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3722 | { |
| 3723 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3724 | hdd_err("Add Sta failed. status code(=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3725 | pRoamInfo->statusCode); |
| 3726 | } |
| 3727 | /* store the ucast signature which will be used later when |
| 3728 | * registering to TL |
| 3729 | */ |
| 3730 | pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode; |
| 3731 | complete(&pAdapter->tdls_add_station_comp); |
| 3732 | break; |
| 3733 | } |
| 3734 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3735 | { |
| 3736 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3737 | hdd_err("Link Establish Request failed. status(=%d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3738 | pRoamInfo->statusCode); |
| 3739 | } |
| 3740 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3741 | break; |
| 3742 | } |
| 3743 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
| 3744 | { |
| 3745 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 3746 | staIdx++) { |
| 3747 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 3748 | pRoamInfo->sessionId) |
| 3749 | && pRoamInfo->staId == |
| 3750 | pHddCtx->tdlsConnInfo[staIdx].staId) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3751 | hdd_warn("HDD: del STA IDX = %x", |
| 3752 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3753 | |
| 3754 | curr_peer = |
| 3755 | wlan_hdd_tdls_find_peer(pAdapter, |
| 3756 | pRoamInfo-> |
| 3757 | peerMac.bytes, |
| 3758 | true); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3759 | if (NULL != curr_peer) { |
| 3760 | hdd_info("Current status for peer " MAC_ADDRESS_STR " is %d", |
| 3761 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3762 | curr_peer->link_status); |
| 3763 | if (TDLS_IS_CONNECTED(curr_peer)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3764 | hdd_roam_deregister_tdlssta |
| 3765 | (pAdapter, |
| 3766 | pRoamInfo->staId); |
| 3767 | wlan_hdd_tdls_decrement_peer_count |
| 3768 | (pAdapter); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3769 | } else if (eTDLS_LINK_CONNECTING == |
| 3770 | curr_peer->link_status) { |
| 3771 | hdd_roam_deregister_tdlssta |
| 3772 | (pAdapter, |
| 3773 | pRoamInfo->staId); |
| 3774 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3775 | } |
| 3776 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 3777 | pRoamInfo-> |
| 3778 | peerMac.bytes); |
| 3779 | |
| 3780 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 3781 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3782 | sessionId = 255; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3783 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3784 | tdlsConnInfo[staIdx]. |
| 3785 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3786 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3787 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3788 | break; |
| 3789 | } |
| 3790 | } |
| 3791 | complete(&pAdapter->tdls_del_station_comp); |
| 3792 | } |
| 3793 | break; |
| 3794 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 3795 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3796 | hdd_err("Sending teardown to supplicant with reason code %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3797 | pRoamInfo->reasonCode); |
| 3798 | |
| 3799 | curr_peer = |
| 3800 | wlan_hdd_tdls_find_peer(pAdapter, |
| 3801 | pRoamInfo->peerMac.bytes, true); |
| 3802 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, |
| 3803 | pRoamInfo->reasonCode); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 3804 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 3805 | curr_peer->peerMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3806 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3807 | break; |
| 3808 | } |
| 3809 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 3810 | { |
| 3811 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
| 3812 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 3813 | staIdx++) { |
| 3814 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 3815 | pRoamInfo->sessionId) |
| 3816 | && pHddCtx->tdlsConnInfo[staIdx].staId) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3817 | hdd_warn("hdd_tdlsStatusUpdate: staIdx %d " |
| 3818 | MAC_ADDRESS_STR, |
| 3819 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3820 | staId, |
| 3821 | MAC_ADDR_ARRAY(pHddCtx-> |
| 3822 | tdlsConnInfo |
| 3823 | [staIdx]. |
| 3824 | peerMac. |
| 3825 | bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3826 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 3827 | pHddCtx-> |
| 3828 | tdlsConnInfo |
| 3829 | [staIdx]. |
| 3830 | peerMac.bytes); |
| 3831 | hdd_roam_deregister_tdlssta(pAdapter, |
| 3832 | pHddCtx-> |
| 3833 | tdlsConnInfo |
| 3834 | [staIdx]. |
| 3835 | staId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3836 | qdf_mem_zero(&smeTdlsPeerStateParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3837 | sizeof |
| 3838 | (smeTdlsPeerStateParams)); |
| 3839 | smeTdlsPeerStateParams.vdevId = |
| 3840 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3841 | sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3842 | qdf_mem_copy(&smeTdlsPeerStateParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3843 | peerMacAddr, |
| 3844 | &pHddCtx-> |
| 3845 | tdlsConnInfo[staIdx]. |
| 3846 | peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3847 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3848 | smeTdlsPeerStateParams.peerState = |
| 3849 | eSME_TDLS_PEER_STATE_TEARDOWN; |
| 3850 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3851 | hdd_info("calling sme_update_tdls_peer_state for staIdx %d " |
| 3852 | MAC_ADDRESS_STR, |
| 3853 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3854 | staId, |
| 3855 | MAC_ADDR_ARRAY(pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3856 | tdlsConnInfo |
| 3857 | [staIdx]. |
| 3858 | peerMac. |
| 3859 | bytes)); |
| 3860 | status = |
| 3861 | sme_update_tdls_peer_state( |
| 3862 | pHddCtx->hHal, |
| 3863 | &smeTdlsPeerStateParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3864 | if (QDF_STATUS_SUCCESS != status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3865 | hdd_err("sme_update_tdls_peer_state failed for " |
| 3866 | MAC_ADDRESS_STR, |
| 3867 | MAC_ADDR_ARRAY |
| 3868 | (pHddCtx-> |
| 3869 | tdlsConnInfo[staIdx]. |
| 3870 | peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3871 | } |
| 3872 | wlan_hdd_tdls_decrement_peer_count |
| 3873 | (pAdapter); |
| 3874 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3875 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3876 | tdlsConnInfo[staIdx]. |
| 3877 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3878 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3879 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 3880 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3881 | sessionId = 255; |
| 3882 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3883 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3884 | } |
| 3885 | } |
| 3886 | break; |
| 3887 | } |
| 3888 | case eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER: |
| 3889 | { |
| 3890 | /* ignore TDLS_SHOULD_DISCOVER if any concurrency detected */ |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 3891 | if (!cds_check_is_tdls_allowed(pAdapter->device_mode)) { |
| 3892 | hdd_err("TDLS not allowed, ignore SHOULD_DISCOVER"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3893 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3894 | break; |
| 3895 | } |
| 3896 | |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 3897 | if (pHddCtx->tdls_nss_switch_in_progress) { |
| 3898 | hdd_err("TDLS antenna switch is in progress, ignore SHOULD_DISCOVER"); |
| 3899 | status = QDF_STATUS_SUCCESS; |
| 3900 | break; |
| 3901 | } |
| 3902 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3903 | curr_peer = |
| 3904 | wlan_hdd_tdls_get_peer(pAdapter, |
Kabilan Kannan | 36090ce | 2016-05-03 19:28:44 -0700 | [diff] [blame] | 3905 | pRoamInfo->peerMac.bytes, |
| 3906 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3907 | if (!curr_peer) { |
Nitesh Shah | facafba | 2016-11-23 12:16:22 +0530 | [diff] [blame] | 3908 | hdd_info("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3909 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3910 | } else { |
| 3911 | if (eTDLS_LINK_CONNECTED == |
| 3912 | curr_peer->link_status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3913 | hdd_err("TDLS link status is connected, ignore SHOULD_DISCOVER"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3914 | } else { |
| 3915 | /* |
| 3916 | * If external control is enabled then initiate |
| 3917 | * TDLS only if forced peer is set otherwise |
| 3918 | * ignore should Discover trigger from fw. |
| 3919 | */ |
| 3920 | if (pHddCtx->config-> |
| 3921 | fTDLSExternalControl |
| 3922 | && (false == |
| 3923 | curr_peer->isForcedPeer)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3924 | hdd_info("TDLS ExternalControl enabled but curr_peer is not forced, ignore SHOULD_DISCOVER"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3925 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3926 | break; |
| 3927 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3928 | hdd_info("initiate TDLS setup on SHOULD_DISCOVER, fTDLSExternalControl: %d, curr_peer->isForcedPeer: %d, reason: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3929 | pHddCtx->config-> |
| 3930 | fTDLSExternalControl, |
| 3931 | curr_peer->isForcedPeer, |
| 3932 | pRoamInfo->reasonCode); |
| 3933 | } |
Nitesh Shah | 983e8f5 | 2016-11-25 12:36:29 +0530 | [diff] [blame] | 3934 | pHddTdlsCtx->curr_candidate = curr_peer; |
| 3935 | wlan_hdd_tdls_implicit_send_discovery_request( |
| 3936 | pHddTdlsCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3937 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3938 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3939 | } |
| 3940 | break; |
| 3941 | } |
| 3942 | |
| 3943 | case eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN: |
| 3944 | { |
| 3945 | curr_peer = |
| 3946 | wlan_hdd_tdls_find_peer(pAdapter, |
| 3947 | pRoamInfo->peerMac.bytes, true); |
| 3948 | if (!curr_peer) { |
Nitesh Shah | facafba | 2016-11-23 12:16:22 +0530 | [diff] [blame] | 3949 | hdd_info("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3950 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3951 | } else { |
| 3952 | if (eTDLS_LINK_CONNECTED == |
| 3953 | curr_peer->link_status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3954 | hdd_err("Received SHOULD_TEARDOWN for peer " |
| 3955 | MAC_ADDRESS_STR |
| 3956 | " staId: %d, reason: %d", |
| 3957 | MAC_ADDR_ARRAY(pRoamInfo-> |
| 3958 | peerMac.bytes), |
| 3959 | pRoamInfo->staId, |
| 3960 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3961 | |
| 3962 | if (pRoamInfo->reasonCode == |
| 3963 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 3964 | pRoamInfo->reasonCode == |
| 3965 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 3966 | pRoamInfo->reasonCode == |
| 3967 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 3968 | pRoamInfo->reasonCode == |
| 3969 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 3970 | reason = |
| 3971 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 3972 | } else |
| 3973 | reason = |
| 3974 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 3975 | |
| 3976 | wlan_hdd_tdls_indicate_teardown |
| 3977 | (pHddTdlsCtx->pAdapter, curr_peer, |
| 3978 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 3979 | hdd_send_wlan_tdls_teardown_event( |
| 3980 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 3981 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3982 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3983 | hdd_err("TDLS link is not connected, ignore SHOULD_TEARDOWN, reason: %d", |
| 3984 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3985 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3986 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3987 | } |
| 3988 | break; |
| 3989 | } |
| 3990 | |
| 3991 | case eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED: |
| 3992 | { |
| 3993 | curr_peer = |
| 3994 | wlan_hdd_tdls_find_peer(pAdapter, |
| 3995 | pRoamInfo->peerMac.bytes, true); |
| 3996 | if (!curr_peer) { |
Nitesh Shah | facafba | 2016-11-23 12:16:22 +0530 | [diff] [blame] | 3997 | hdd_info("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3998 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3999 | } else { |
| 4000 | if (eTDLS_LINK_CONNECTED == |
| 4001 | curr_peer->link_status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4002 | hdd_err("Received SHOULD_PEER_DISCONNECTED for peer " |
| 4003 | MAC_ADDRESS_STR |
| 4004 | " staId: %d, reason: %d", |
| 4005 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 4006 | pRoamInfo->staId, |
| 4007 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4008 | |
| 4009 | if (pRoamInfo->reasonCode == |
| 4010 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4011 | pRoamInfo->reasonCode == |
| 4012 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4013 | pRoamInfo->reasonCode == |
| 4014 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4015 | pRoamInfo->reasonCode == |
| 4016 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4017 | reason = |
| 4018 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4019 | } else |
| 4020 | reason = |
| 4021 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4022 | |
| 4023 | wlan_hdd_tdls_indicate_teardown |
| 4024 | (pHddTdlsCtx->pAdapter, curr_peer, |
| 4025 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4026 | hdd_send_wlan_tdls_teardown_event( |
| 4027 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4028 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4029 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4030 | hdd_err("TDLS link is not connected, ignore SHOULD_PEER_DISCONNECTED, reason: %d", |
| 4031 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4032 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4033 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4034 | } |
| 4035 | break; |
| 4036 | } |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4037 | |
| 4038 | case eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
| 4039 | status = hdd_tdls_connection_tracker_update(pAdapter, |
| 4040 | pRoamInfo, |
| 4041 | pHddTdlsCtx); |
| 4042 | break; |
| 4043 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4044 | default: |
| 4045 | { |
| 4046 | break; |
| 4047 | } |
| 4048 | } |
| 4049 | |
| 4050 | return status; |
| 4051 | } |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4052 | #else |
| 4053 | |
| 4054 | static inline QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, |
| 4055 | uint8_t staId) |
| 4056 | { |
| 4057 | return QDF_STATUS_SUCCESS; |
| 4058 | } |
| 4059 | |
| 4060 | static inline QDF_STATUS |
| 4061 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 4062 | tCsrRoamInfo *pRoamInfo, |
| 4063 | uint32_t roamId, |
| 4064 | eRoamCmdStatus roamStatus, |
| 4065 | eCsrRoamResult roamResult) |
| 4066 | { |
| 4067 | return QDF_STATUS_SUCCESS; |
| 4068 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4069 | #endif |
| 4070 | |
| 4071 | #ifdef WLAN_FEATURE_11W |
| 4072 | /** |
| 4073 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
| 4074 | * @pAdapter: pointer to the adapter |
| 4075 | * @nFrameLength: Length of the unprotected frame being passed |
| 4076 | * @pbFrames: Pointer to the frame buffer |
| 4077 | * @frameType: 802.11 frame type |
| 4078 | * |
| 4079 | * This function forwards the unprotected management frame to the supplicant. |
| 4080 | * |
| 4081 | * Return: nothing |
| 4082 | */ |
| 4083 | static void |
| 4084 | hdd_indicate_unprot_mgmt_frame(hdd_adapter_t *pAdapter, uint32_t nFrameLength, |
| 4085 | uint8_t *pbFrames, uint8_t frameType) |
| 4086 | { |
| 4087 | uint8_t type = 0; |
| 4088 | uint8_t subType = 0; |
| 4089 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4090 | hdd_info("Frame Type = %d Frame Length = %d", |
| 4091 | frameType, nFrameLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4092 | |
| 4093 | /* Sanity Checks */ |
| 4094 | if (NULL == pAdapter) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4095 | hdd_err("pAdapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4096 | return; |
| 4097 | } |
| 4098 | |
| 4099 | if (NULL == pAdapter->dev) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4100 | hdd_err("pAdapter->dev is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4101 | return; |
| 4102 | } |
| 4103 | |
| 4104 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4105 | hdd_err("pAdapter has invalid magic"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | return; |
| 4107 | } |
| 4108 | |
| 4109 | if (!nFrameLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4110 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4111 | return; |
| 4112 | } |
| 4113 | |
| 4114 | if (NULL == pbFrames) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4115 | hdd_err("pbFrames is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4116 | return; |
| 4117 | } |
| 4118 | |
| 4119 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 4120 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 4121 | |
| 4122 | /* Get pAdapter from Destination mac address of the frame */ |
| 4123 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) { |
| 4124 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4125 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4126 | nFrameLength); |
| 4127 | #else |
| 4128 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, |
| 4129 | nFrameLength); |
| 4130 | #endif |
| 4131 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 4132 | } else if (type == SIR_MAC_MGMT_FRAME && |
| 4133 | subType == SIR_MAC_MGMT_DEAUTH) { |
| 4134 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4135 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4136 | nFrameLength); |
| 4137 | #else |
| 4138 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, |
| 4139 | nFrameLength); |
| 4140 | #endif |
| 4141 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 4142 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4143 | hdd_err("Frame type %d and subtype %d are not valid", |
| 4144 | type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4145 | return; |
| 4146 | } |
| 4147 | } |
| 4148 | #endif |
| 4149 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4150 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4151 | /** |
| 4152 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
| 4153 | * @pAdapter: pointer to adapter |
| 4154 | * @tid: traffic identifier |
| 4155 | * @state: state |
| 4156 | * @measInterval: measurement interval |
| 4157 | * |
| 4158 | * This function sends traffic stream metrics IE information to |
| 4159 | * the supplicant via wireless event. |
| 4160 | * |
| 4161 | * Return: none |
| 4162 | */ |
| 4163 | static void |
| 4164 | hdd_indicate_tsm_ie(hdd_adapter_t *pAdapter, uint8_t tid, |
| 4165 | uint8_t state, uint16_t measInterval) |
| 4166 | { |
| 4167 | union iwreq_data wrqu; |
| 4168 | char buf[IW_CUSTOM_MAX + 1]; |
| 4169 | int nBytes = 0; |
| 4170 | |
| 4171 | if (NULL == pAdapter) |
| 4172 | return; |
| 4173 | |
| 4174 | /* create the event */ |
| 4175 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4176 | memset(buf, '\0', sizeof(buf)); |
| 4177 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4178 | hdd_info("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
| 4179 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4180 | |
| 4181 | nBytes = |
| 4182 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4183 | measInterval); |
| 4184 | |
| 4185 | wrqu.data.pointer = buf; |
| 4186 | wrqu.data.length = nBytes; |
| 4187 | /* send the event */ |
| 4188 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4189 | } |
| 4190 | |
| 4191 | /** |
| 4192 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
| 4193 | * @pAdapter: pointer to adapter |
| 4194 | * @pRoamInfo: pointer to roam info |
| 4195 | * |
| 4196 | * This function sends cckm preauth indication to the supplicant |
| 4197 | * via wireless custom event. |
| 4198 | * |
| 4199 | * Return: none |
| 4200 | */ |
| 4201 | static void |
| 4202 | hdd_indicate_cckm_pre_auth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 4203 | { |
| 4204 | union iwreq_data wrqu; |
| 4205 | char buf[IW_CUSTOM_MAX + 1]; |
| 4206 | char *pos = buf; |
| 4207 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4208 | |
| 4209 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4210 | return; |
| 4211 | |
| 4212 | /* create the event */ |
| 4213 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4214 | memset(buf, '\0', sizeof(buf)); |
| 4215 | |
| 4216 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4217 | hdd_info("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
| 4218 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 4219 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4220 | |
| 4221 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4222 | pos += nBytes; |
| 4223 | freeBytes -= nBytes; |
| 4224 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4225 | qdf_mem_copy(pos, pRoamInfo->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4226 | pos += QDF_MAC_ADDR_SIZE; |
| 4227 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4228 | |
| 4229 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
| 4230 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 4231 | freeBytes -= nBytes; |
| 4232 | |
| 4233 | wrqu.data.pointer = buf; |
| 4234 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4235 | |
| 4236 | /* send the event */ |
| 4237 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4238 | } |
| 4239 | |
| 4240 | /** |
| 4241 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
| 4242 | * @pAdapter: pointer to adapter |
| 4243 | * @pRoamInfo: pointer to roam info |
| 4244 | * |
| 4245 | * Return: none |
| 4246 | */ |
| 4247 | static void |
| 4248 | hdd_indicate_ese_adj_ap_rep_ind(hdd_adapter_t *pAdapter, |
| 4249 | tCsrRoamInfo *pRoamInfo) |
| 4250 | { |
| 4251 | union iwreq_data wrqu; |
| 4252 | char buf[IW_CUSTOM_MAX + 1]; |
| 4253 | int nBytes = 0; |
| 4254 | |
| 4255 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4256 | return; |
| 4257 | |
| 4258 | /* create the event */ |
| 4259 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4260 | memset(buf, '\0', sizeof(buf)); |
| 4261 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4262 | hdd_info("CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4263 | |
| 4264 | nBytes = |
| 4265 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
| 4266 | pRoamInfo->tsmRoamDelay); |
| 4267 | |
| 4268 | wrqu.data.pointer = buf; |
| 4269 | wrqu.data.length = nBytes; |
| 4270 | |
| 4271 | /* send the event */ |
| 4272 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4273 | } |
| 4274 | |
| 4275 | /** |
| 4276 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
| 4277 | * @pAdapter: pointer to adapter |
| 4278 | * @measurementToken: measurement token |
| 4279 | * @flag: flag |
| 4280 | * @numBss: number of bss |
| 4281 | * |
| 4282 | * If the measurement is none and no scan results found, |
| 4283 | * indicate the supplicant about measurement done. |
| 4284 | * |
| 4285 | * Return: none |
| 4286 | */ |
| 4287 | void |
| 4288 | hdd_indicate_ese_bcn_report_no_results(const hdd_adapter_t *pAdapter, |
| 4289 | const uint16_t measurementToken, |
| 4290 | const bool flag, const uint8_t numBss) |
| 4291 | { |
| 4292 | union iwreq_data wrqu; |
| 4293 | char buf[IW_CUSTOM_MAX]; |
| 4294 | char *pos = buf; |
| 4295 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4296 | |
| 4297 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4298 | memset(buf, '\0', sizeof(buf)); |
| 4299 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4300 | hdd_info("CCXBCNREP=%d %d %d", measurementToken, |
| 4301 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4302 | |
| 4303 | nBytes = |
| 4304 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4305 | flag, numBss); |
| 4306 | |
| 4307 | wrqu.data.pointer = buf; |
| 4308 | wrqu.data.length = nBytes; |
| 4309 | /* send the event */ |
| 4310 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4311 | } |
| 4312 | |
| 4313 | /** |
| 4314 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
| 4315 | * @pAdapter: pointer to adapter |
| 4316 | * @pRoamInfo: pointer to roam info |
| 4317 | * |
| 4318 | * If the measurement is none and no scan results found, |
| 4319 | * indicate the supplicant about measurement done. |
| 4320 | * |
| 4321 | * Return: none |
| 4322 | */ |
| 4323 | static void |
| 4324 | hdd_indicate_ese_bcn_report_ind(const hdd_adapter_t *pAdapter, |
| 4325 | const tCsrRoamInfo *pRoamInfo) |
| 4326 | { |
| 4327 | union iwreq_data wrqu; |
| 4328 | char buf[IW_CUSTOM_MAX]; |
| 4329 | char *pos = buf; |
| 4330 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4331 | uint8_t i = 0, len = 0; |
| 4332 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4333 | uint8_t lastSent = 0, sendBss = 0; |
| 4334 | int bcnRepFieldSize = |
| 4335 | sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0]. |
| 4336 | bcnReportFields); |
| 4337 | uint8_t ieLenByte = 1; |
| 4338 | /* |
| 4339 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4340 | */ |
| 4341 | #define ESEBCNREPHEADER_LEN (18) |
| 4342 | |
| 4343 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4344 | return; |
| 4345 | |
| 4346 | /* |
| 4347 | * Custom event can pass maximum of 256 bytes of data, |
| 4348 | * based on the IE len we need to identify how many BSS info can |
| 4349 | * be filled in to custom event data. |
| 4350 | */ |
| 4351 | /* |
| 4352 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4353 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4354 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4355 | */ |
| 4356 | |
| 4357 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) |
| 4358 | && (!pRoamInfo->pEseBcnReportRsp->numBss)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4359 | hdd_info("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4360 | /* If the measurement is none and no scan results found, |
| 4361 | indicate the supplicant about measurement done */ |
| 4362 | hdd_indicate_ese_bcn_report_no_results( |
| 4363 | pAdapter, |
| 4364 | pRoamInfo->pEseBcnReportRsp-> |
| 4365 | measurementToken, |
| 4366 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4367 | pRoamInfo->pEseBcnReportRsp->numBss); |
| 4368 | } else { |
| 4369 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) { |
| 4370 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4371 | memset(buf, '\0', sizeof(buf)); |
| 4372 | tot_bcn_ieLen = 0; |
| 4373 | sendBss = 0; |
| 4374 | pos = buf; |
| 4375 | freeBytes = IW_CUSTOM_MAX; |
| 4376 | |
| 4377 | for (i = lastSent; |
| 4378 | i < pRoamInfo->pEseBcnReportRsp->numBss; i++) { |
| 4379 | len = |
| 4380 | bcnRepFieldSize + ieLenByte + |
| 4381 | pRoamInfo->pEseBcnReportRsp-> |
| 4382 | bcnRepBssInfo[i].ieLen; |
| 4383 | if ((len + tot_bcn_ieLen) > |
| 4384 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4385 | break; |
| 4386 | } |
| 4387 | tot_bcn_ieLen += len; |
| 4388 | sendBss++; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4389 | hdd_info("i(%d) sizeof bcnReportFields(%d) IeLength(%d) Length of Ie(%d) totLen(%d)", |
| 4390 | i, bcnRepFieldSize, 1, |
| 4391 | pRoamInfo->pEseBcnReportRsp-> |
| 4392 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4393 | } |
| 4394 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4395 | hdd_info("Sending %d BSS Info", sendBss); |
| 4396 | hdd_info("CCXBCNREP=%d %d %d %d", |
| 4397 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 4398 | pRoamInfo->pEseBcnReportRsp->flag, sendBss, |
| 4399 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4400 | |
| 4401 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
| 4402 | pRoamInfo->pEseBcnReportRsp-> |
| 4403 | measurementToken, |
| 4404 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4405 | sendBss); |
| 4406 | pos += nBytes; |
| 4407 | freeBytes -= nBytes; |
| 4408 | |
| 4409 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4410 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4411 | sizeof(tot_bcn_ieLen)); |
| 4412 | pos += sizeof(tot_bcn_ieLen); |
| 4413 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4414 | |
| 4415 | for (i = 0; i < sendBss; i++) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4416 | hdd_info("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4417 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4418 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4419 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
| 4420 | pRoamInfo->pEseBcnReportRsp-> |
| 4421 | bcnRepBssInfo[i + |
| 4422 | lastSent].bcnReportFields. |
| 4423 | ChanNum, |
| 4424 | pRoamInfo->pEseBcnReportRsp-> |
| 4425 | bcnRepBssInfo[i + |
| 4426 | lastSent].bcnReportFields. |
| 4427 | Spare, |
| 4428 | pRoamInfo->pEseBcnReportRsp-> |
| 4429 | bcnRepBssInfo[i + |
| 4430 | lastSent].bcnReportFields. |
| 4431 | MeasDuration, |
| 4432 | pRoamInfo->pEseBcnReportRsp-> |
| 4433 | bcnRepBssInfo[i + |
| 4434 | lastSent].bcnReportFields. |
| 4435 | PhyType, |
| 4436 | pRoamInfo->pEseBcnReportRsp-> |
| 4437 | bcnRepBssInfo[i + |
| 4438 | lastSent].bcnReportFields. |
| 4439 | RecvSigPower, |
| 4440 | pRoamInfo->pEseBcnReportRsp-> |
| 4441 | bcnRepBssInfo[i + |
| 4442 | lastSent].bcnReportFields. |
| 4443 | ParentTsf, |
| 4444 | pRoamInfo->pEseBcnReportRsp-> |
| 4445 | bcnRepBssInfo[i + |
| 4446 | lastSent].bcnReportFields. |
| 4447 | TargetTsf[0], |
| 4448 | pRoamInfo->pEseBcnReportRsp-> |
| 4449 | bcnRepBssInfo[i + |
| 4450 | lastSent].bcnReportFields. |
| 4451 | TargetTsf[1], |
| 4452 | pRoamInfo->pEseBcnReportRsp-> |
| 4453 | bcnRepBssInfo[i + |
| 4454 | lastSent].bcnReportFields. |
| 4455 | BcnInterval, |
| 4456 | pRoamInfo->pEseBcnReportRsp-> |
| 4457 | bcnRepBssInfo[i + |
| 4458 | lastSent].bcnReportFields. |
| 4459 | CapabilityInfo, |
| 4460 | pRoamInfo->pEseBcnReportRsp-> |
| 4461 | bcnRepBssInfo[i + |
| 4462 | lastSent].bcnReportFields. |
| 4463 | Bssid[0], |
| 4464 | pRoamInfo->pEseBcnReportRsp-> |
| 4465 | bcnRepBssInfo[i + |
| 4466 | lastSent].bcnReportFields. |
| 4467 | Bssid[1], |
| 4468 | pRoamInfo->pEseBcnReportRsp-> |
| 4469 | bcnRepBssInfo[i + |
| 4470 | lastSent].bcnReportFields. |
| 4471 | Bssid[2], |
| 4472 | pRoamInfo->pEseBcnReportRsp-> |
| 4473 | bcnRepBssInfo[i + |
| 4474 | lastSent].bcnReportFields. |
| 4475 | Bssid[3], |
| 4476 | pRoamInfo->pEseBcnReportRsp-> |
| 4477 | bcnRepBssInfo[i + |
| 4478 | lastSent].bcnReportFields. |
| 4479 | Bssid[4], |
| 4480 | pRoamInfo->pEseBcnReportRsp-> |
| 4481 | bcnRepBssInfo[i + |
| 4482 | lastSent].bcnReportFields. |
| 4483 | Bssid[5]); |
| 4484 | |
| 4485 | /* bcn report fields are copied */ |
| 4486 | len = |
| 4487 | sizeof(pRoamInfo->pEseBcnReportRsp-> |
| 4488 | bcnRepBssInfo[i + |
| 4489 | lastSent]. |
| 4490 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4491 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4492 | (char *)&pRoamInfo-> |
| 4493 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4494 | lastSent]. |
| 4495 | bcnReportFields, len); |
| 4496 | pos += len; |
| 4497 | freeBytes -= len; |
| 4498 | |
| 4499 | /* Add 1 byte of ie len */ |
| 4500 | len = |
| 4501 | pRoamInfo->pEseBcnReportRsp-> |
| 4502 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4503 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4504 | pos += sizeof(len); |
| 4505 | freeBytes -= sizeof(len); |
| 4506 | |
| 4507 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4508 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4509 | (char *)pRoamInfo-> |
| 4510 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4511 | lastSent]. |
| 4512 | pBuf, len); |
| 4513 | pos += len; |
| 4514 | freeBytes -= len; |
| 4515 | } |
| 4516 | |
| 4517 | wrqu.data.pointer = buf; |
| 4518 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4519 | |
| 4520 | /* send the event */ |
| 4521 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, |
| 4522 | buf); |
| 4523 | lastSent += sendBss; |
| 4524 | } |
| 4525 | } |
| 4526 | } |
| 4527 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4528 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4529 | |
| 4530 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4531 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
| 4532 | * @pHddStaCtx: Station Context |
| 4533 | * |
| 4534 | * API to check if the connection authentication type is 8021x_sha256. |
| 4535 | * |
| 4536 | * Return: bool |
| 4537 | */ |
| 4538 | #ifdef WLAN_FEATURE_11W |
| 4539 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4540 | { |
| 4541 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
| 4542 | pHddStaCtx->conn_info.authType; |
| 4543 | } |
| 4544 | #else |
| 4545 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4546 | { |
| 4547 | return false; |
| 4548 | } |
| 4549 | #endif |
| 4550 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame^] | 4551 | /* |
| 4552 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4553 | * @adapter: Pointer to adapter context |
| 4554 | * @roam_info: Pointer to roam info |
| 4555 | * |
| 4556 | * Return: None |
| 4557 | */ |
| 4558 | static void hdd_roam_channel_switch_handler(hdd_adapter_t *adapter, |
| 4559 | tCsrRoamInfo *roam_info) |
| 4560 | { |
| 4561 | struct hdd_chan_change_params chan_change; |
| 4562 | struct cfg80211_bss *bss; |
| 4563 | struct net_device *dev = adapter->dev; |
| 4564 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4565 | struct wiphy *wiphy = wdev->wiphy; |
| 4566 | QDF_STATUS status; |
| 4567 | |
| 4568 | hdd_info("channel switch for session:%d to channel:%d", |
| 4569 | adapter->sessionId, roam_info->chan_info.chan_id); |
| 4570 | |
| 4571 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4572 | chan_change.chan_params.ch_width = |
| 4573 | roam_info->chan_info.ch_width; |
| 4574 | chan_change.chan_params.sec_ch_offset = |
| 4575 | roam_info->chan_info.sec_ch_offset; |
| 4576 | chan_change.chan_params.center_freq_seg0 = |
| 4577 | roam_info->chan_info.band_center_freq1; |
| 4578 | chan_change.chan_params.center_freq_seg1 = |
| 4579 | roam_info->chan_info.band_center_freq2; |
| 4580 | |
| 4581 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
| 4582 | if (NULL == bss) |
| 4583 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4584 | else |
| 4585 | cfg80211_put_bss(wiphy, bss); |
| 4586 | |
| 4587 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change); |
| 4588 | if (QDF_IS_STATUS_ERROR(status)) |
| 4589 | hdd_err("channel change notification failed"); |
| 4590 | |
| 4591 | status = cds_set_hw_mode_on_channel_switch(adapter->sessionId); |
| 4592 | if (QDF_IS_STATUS_ERROR(status)) |
| 4593 | hdd_info("set hw mode change not done"); |
| 4594 | } |
| 4595 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4596 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4597 | * hdd_sme_roam_callback() - hdd sme roam callback |
| 4598 | * @pContext: pointer to adapter context |
| 4599 | * @pRoamInfo: pointer to roam info |
| 4600 | * @roamId: roam id |
| 4601 | * @roamStatus: roam status |
| 4602 | * @roamResult: roam result |
| 4603 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4604 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4605 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4606 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4607 | hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, |
| 4608 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult) |
| 4609 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4610 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4611 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) pContext; |
| 4612 | hdd_wext_state_t *pWextState = NULL; |
| 4613 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4614 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4615 | hdd_context_t *pHddCtx = NULL; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4616 | struct cfg80211_bss *bss_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4617 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4618 | hdd_info("CSR Callback: status= %d result= %d roamID=%d", |
| 4619 | roamStatus, roamResult, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4620 | |
| 4621 | /* Sanity check */ |
| 4622 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4623 | hdd_alert("invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4624 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4625 | } |
| 4626 | |
| 4627 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4628 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4629 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4630 | MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4631 | pAdapter->sessionId, roamStatus)); |
| 4632 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4633 | switch (roamStatus) { |
| 4634 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 6f3a865 | 2015-09-25 10:58:15 +0530 | [diff] [blame] | 4635 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4636 | complete(&pAdapter->session_open_comp_var); |
Peng Xu | 66162de | 2016-02-11 17:01:20 -0800 | [diff] [blame] | 4637 | hdd_debug("session %d opened", pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4638 | break; |
| 4639 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4640 | /* |
| 4641 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4642 | * reassoc failed due to failure, timeout, reject from ap |
| 4643 | * in any case tell the OS, our carrier is off and mark |
| 4644 | * interface down. |
| 4645 | */ |
| 4646 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4647 | hdd_err("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d", |
| 4648 | roamStatus, roamResult, pAdapter->sessionId); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4649 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4650 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4651 | roamStatus, roamResult); |
| 4652 | /* |
| 4653 | * Check if Mcast/Bcast Filters are set, if yes |
| 4654 | * clear the filters here. |
| 4655 | */ |
| 4656 | if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == |
| 4657 | true) { |
| 4658 | (WLAN_HDD_GET_CTX(pAdapter))-> |
| 4659 | hdd_mcastbcast_filter_set = false; |
| 4660 | } |
| 4661 | pHddStaCtx->ft_carrier_on = false; |
| 4662 | pHddStaCtx->hdd_ReassocScenario = false; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4663 | hdd_info("hdd_ReassocScenario set to: %d, ReAssoc Failed, session: %d", |
| 4664 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4665 | break; |
| 4666 | |
| 4667 | case eCSR_ROAM_FT_START: |
| 4668 | /* |
| 4669 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4670 | * informed that the link is down. So mark the link ready for |
| 4671 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4672 | * be received. Where in we will not mark the link down |
| 4673 | * Also we want to stop tx at this point when we will be |
| 4674 | * doing disassoc at this time. This saves 30-60 msec |
| 4675 | * after reassoc. |
| 4676 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4677 | hdd_info("Disabling queues"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4678 | hdd_info("Roam Synch Ind: NAPI Serialize ON"); |
| 4679 | hdd_napi_serialize(1); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4680 | wlan_hdd_netif_queue_control(pAdapter, |
| 4681 | WLAN_NETIF_TX_DISABLE, |
| 4682 | WLAN_CONTROL_PATH); |
| 4683 | status = hdd_roam_deregister_sta(pAdapter, |
| 4684 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4685 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4686 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4687 | pHddStaCtx->ft_carrier_on = true; |
| 4688 | pHddStaCtx->hdd_ReassocScenario = true; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4689 | hdd_info("hdd_ReassocScenario set to: %d, due to eCSR_ROAM_FT_START, session: %d", |
| 4690 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4691 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4692 | case eCSR_ROAM_NAPI_OFF: |
| 4693 | hdd_info("After Roam Synch Comp: NAPI Serialize OFF"); |
| 4694 | hdd_napi_serialize(0); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4695 | hdd_set_roaming_in_progress(false); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4696 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4697 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4698 | /* notify apps that we can't pass traffic anymore */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4699 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4700 | wlan_hdd_netif_queue_control(pAdapter, |
| 4701 | WLAN_NETIF_TX_DISABLE, |
| 4702 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4703 | if (pHddStaCtx->ft_carrier_on == false) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4704 | wlan_hdd_netif_queue_control(pAdapter, |
| 4705 | WLAN_NETIF_CARRIER_OFF, |
| 4706 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4707 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4708 | break; |
| 4709 | case eCSR_ROAM_LOSTLINK: |
| 4710 | if (roamResult == eCSR_ROAM_RESULT_LOSTLINK) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4711 | hdd_info("Roaming started due to connection lost"); |
| 4712 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4713 | wlan_hdd_netif_queue_control(pAdapter, |
| 4714 | WLAN_NETIF_TX_DISABLE_N_CARRIER, |
| 4715 | WLAN_CONTROL_PATH); |
| 4716 | break; |
| 4717 | } |
| 4718 | case eCSR_ROAM_DISASSOCIATED: |
| 4719 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4720 | hdd_info("****eCSR_ROAM_DISASSOCIATED****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4721 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4722 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4723 | roamStatus, roamResult); |
| 4724 | /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */ |
| 4725 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4726 | if (pHddCtx->hdd_mcastbcast_filter_set == true) { |
| 4727 | hdd_conf_mcastbcast_filter(pHddCtx, false); |
| 4728 | |
| 4729 | if (true == |
| 4730 | pHddCtx->sus_res_mcastbcast_filter_valid) { |
| 4731 | pHddCtx->configuredMcastBcastFilter = |
| 4732 | pHddCtx->sus_res_mcastbcast_filter; |
| 4733 | pHddCtx-> |
| 4734 | sus_res_mcastbcast_filter_valid = |
| 4735 | false; |
| 4736 | } |
| 4737 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4738 | hdd_info("offload: disassociation happening, restoring configuredMcastBcastFilter"); |
| 4739 | hdd_info("McastBcastFilter = %d", |
| 4740 | pHddCtx->configuredMcastBcastFilter); |
| 4741 | hdd_info("offload: already called mcastbcast filter"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4742 | (WLAN_HDD_GET_CTX(pAdapter))-> |
| 4743 | hdd_mcastbcast_filter_set = false; |
| 4744 | } |
| 4745 | /* Call to clear any MC Addr List filter applied after |
| 4746 | * successful connection. |
| 4747 | */ |
| 4748 | wlan_hdd_set_mc_addr_list(pAdapter, false); |
| 4749 | } |
| 4750 | break; |
| 4751 | case eCSR_ROAM_IBSS_LEAVE: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4752 | hdd_info("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4753 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4754 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4755 | roamStatus, roamResult); |
| 4756 | break; |
| 4757 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4758 | hdd_info("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4759 | /* |
| 4760 | * To Do - address probable memory leak with WEP encryption upon |
| 4761 | * successful association. |
| 4762 | */ |
| 4763 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) { |
| 4764 | /* Clear saved connection information in HDD */ |
| 4765 | hdd_conn_remove_connect_info( |
| 4766 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
| 4767 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4768 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4769 | hdd_association_completion_handler(pAdapter, pRoamInfo, |
| 4770 | roamId, roamStatus, |
| 4771 | roamResult); |
| 4772 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4773 | if (pRoamInfo) |
| 4774 | pRoamInfo->roamSynchInProgress = false; |
| 4775 | #endif |
| 4776 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 4777 | case eCSR_ROAM_CANCELLED: |
| 4778 | hdd_info("****eCSR_ROAM_CANCELLED****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4779 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4780 | qdf_ret_status = hdd_association_completion_handler(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4781 | pRoamInfo, |
| 4782 | roamId, |
| 4783 | roamStatus, |
| 4784 | roamResult); |
| 4785 | break; |
| 4786 | case eCSR_ROAM_IBSS_IND: |
| 4787 | hdd_roam_ibss_indication_handler(pAdapter, pRoamInfo, roamId, |
| 4788 | roamStatus, roamResult); |
| 4789 | break; |
| 4790 | |
| 4791 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4792 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4793 | roam_roam_connect_status_update_handler(pAdapter, |
| 4794 | pRoamInfo, |
| 4795 | roamId, |
| 4796 | roamStatus, |
| 4797 | roamResult); |
| 4798 | break; |
| 4799 | |
| 4800 | case eCSR_ROAM_MIC_ERROR_IND: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4801 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4802 | hdd_roam_mic_error_indication_handler(pAdapter, |
| 4803 | pRoamInfo, |
| 4804 | roamId, |
| 4805 | roamStatus, |
| 4806 | roamResult); |
| 4807 | break; |
| 4808 | |
| 4809 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 4810 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4811 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4812 | hdd_roam_set_key_complete_handler(pAdapter, pRoamInfo, |
| 4813 | roamId, roamStatus, |
| 4814 | roamResult); |
| 4815 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
| 4816 | pHddStaCtx->hdd_ReassocScenario = false; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4817 | hdd_info("hdd_ReassocScenario set to: %d, set key complete, session: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4818 | pHddStaCtx->hdd_ReassocScenario, |
| 4819 | pAdapter->sessionId); |
| 4820 | } |
| 4821 | } |
| 4822 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 4823 | if (pRoamInfo != NULL) |
| 4824 | pRoamInfo->roamSynchInProgress = false; |
| 4825 | #endif |
| 4826 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4827 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4828 | case eCSR_ROAM_FT_RESPONSE: |
| 4829 | hdd_send_ft_event(pAdapter); |
| 4830 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4831 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4832 | case eCSR_ROAM_PMK_NOTIFY: |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4833 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType |
| 4834 | || hdd_is_8021x_sha256_auth_type(pHddStaCtx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4835 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4836 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4837 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
| 4838 | pAdapter, pRoamInfo, 1, false); |
| 4839 | } |
| 4840 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4841 | |
| 4842 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4843 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 4844 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4845 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4846 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, |
| 4847 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4848 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4849 | } |
| 4850 | break; |
| 4851 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 4852 | /* |
| 4853 | * This event will notify pre-auth completion in case of success |
| 4854 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4855 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4856 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4857 | pRoamInfo, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4858 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4859 | } |
| 4860 | break; |
| 4861 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 4862 | /* |
| 4863 | * This event will notify pre-auth completion incase of failure. |
| 4864 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4865 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4866 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 4867 | pRoamInfo, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4868 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4869 | } |
| 4870 | break; |
| 4871 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 4872 | /* This event is to notify handover success. |
| 4873 | It will be only invoked on success */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4874 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4875 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, |
| 4876 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4877 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4878 | } |
| 4879 | break; |
| 4880 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4881 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 4882 | hdd_remain_chan_ready_handler(pAdapter, pRoamInfo->roc_scan_id); |
| 4883 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4884 | #ifdef FEATURE_WLAN_TDLS |
| 4885 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4886 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4887 | hdd_roam_tdls_status_update_handler(pAdapter, pRoamInfo, |
| 4888 | roamId, |
| 4889 | roamStatus, |
| 4890 | roamResult); |
| 4891 | break; |
| 4892 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 4893 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, |
| 4894 | pRoamInfo->reasonCode); |
| 4895 | break; |
| 4896 | #endif |
| 4897 | #ifdef WLAN_FEATURE_11W |
| 4898 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 4899 | hdd_indicate_unprot_mgmt_frame(pAdapter, |
| 4900 | pRoamInfo->nFrameLength, |
| 4901 | pRoamInfo->pbFrames, |
| 4902 | pRoamInfo->frameType); |
| 4903 | break; |
| 4904 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4905 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4906 | case eCSR_ROAM_TSM_IE_IND: |
| 4907 | hdd_indicate_tsm_ie(pAdapter, pRoamInfo->tsmIe.tsid, |
| 4908 | pRoamInfo->tsmIe.state, |
| 4909 | pRoamInfo->tsmIe.msmt_interval); |
| 4910 | break; |
| 4911 | |
| 4912 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 4913 | { |
| 4914 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
| 4915 | pHddStaCtx->conn_info.authType |
| 4916 | || eCSR_AUTH_TYPE_CCKM_RSN == |
| 4917 | pHddStaCtx->conn_info.authType) { |
| 4918 | hdd_indicate_cckm_pre_auth(pAdapter, pRoamInfo); |
| 4919 | } |
| 4920 | break; |
| 4921 | } |
| 4922 | |
| 4923 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 4924 | { |
| 4925 | hdd_indicate_ese_adj_ap_rep_ind(pAdapter, pRoamInfo); |
| 4926 | break; |
| 4927 | } |
| 4928 | |
| 4929 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 4930 | { |
| 4931 | hdd_indicate_ese_bcn_report_ind(pAdapter, pRoamInfo); |
| 4932 | break; |
| 4933 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4934 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4935 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame^] | 4936 | hdd_roam_channel_switch_handler(pAdapter, pRoamInfo); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4937 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame^] | 4938 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4939 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 4940 | if ((NULL != pRoamInfo) && (NULL != pRoamInfo->pBssDesc)) { |
| 4941 | bss_status = wlan_hdd_cfg80211_inform_bss_frame( |
| 4942 | pAdapter, pRoamInfo->pBssDesc); |
| 4943 | if (NULL == bss_status) |
| 4944 | hdd_info("UPDATE_SCAN_RESULT returned NULL"); |
| 4945 | else |
| 4946 | cfg80211_put_bss( |
| 4947 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 4948 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 4949 | #endif |
| 4950 | bss_status); |
| 4951 | } |
| 4952 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4953 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
| 4954 | hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, |
| 4955 | roamResult); |
| 4956 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4957 | case eCSR_ROAM_START: |
| 4958 | hdd_info("Process ROAM_START from firmware"); |
| 4959 | wlan_hdd_netif_queue_control(pAdapter, |
| 4960 | WLAN_NETIF_TX_DISABLE, |
| 4961 | WLAN_CONTROL_PATH); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4962 | hdd_napi_serialize(1); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4963 | cds_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4964 | hdd_set_roaming_in_progress(true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4965 | cds_restart_opportunistic_timer(true); |
| 4966 | break; |
| 4967 | case eCSR_ROAM_ABORT: |
| 4968 | hdd_info("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4969 | hdd_napi_serialize(0); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4970 | wlan_hdd_netif_queue_control(pAdapter, |
| 4971 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 4972 | WLAN_CONTROL_PATH); |
| 4973 | cds_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4974 | hdd_set_roaming_in_progress(false); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4975 | break; |
| 4976 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4977 | default: |
| 4978 | break; |
| 4979 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4980 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4981 | } |
| 4982 | |
| 4983 | /** |
| 4984 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 4985 | * @auth_suite: auth suite |
| 4986 | * |
| 4987 | * Return: eCsrAuthType enumeration |
| 4988 | */ |
| 4989 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 4990 | { |
| 4991 | eCsrAuthType auth_type; |
| 4992 | /* is the auth type supported? */ |
| 4993 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 4994 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 4995 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 4996 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4997 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4998 | /* Check for 11r FT Authentication with PSK */ |
| 4999 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5000 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 5001 | /* Check for 11R FT Authentication with 802.1X */ |
| 5002 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 5003 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5004 | #ifdef FEATURE_WLAN_ESE |
| 5005 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 5006 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5007 | } else |
| 5008 | #endif /* FEATURE_WLAN_ESE */ |
| 5009 | #ifdef WLAN_FEATURE_11W |
| 5010 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 5011 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5012 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 5013 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5014 | } else |
| 5015 | #endif |
| 5016 | { |
| 5017 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5018 | } |
| 5019 | return auth_type; |
| 5020 | } |
| 5021 | |
| 5022 | /** |
| 5023 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5024 | * @auth_suite: auth suite |
| 5025 | * |
| 5026 | * Return: eCsrAuthType enumeration |
| 5027 | */ |
| 5028 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5029 | { |
| 5030 | eCsrAuthType auth_type; |
| 5031 | /* is the auth type supported? */ |
| 5032 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5033 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5034 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5035 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5036 | } else |
| 5037 | #ifdef FEATURE_WLAN_ESE |
| 5038 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5039 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5040 | } else |
| 5041 | #endif /* FEATURE_WLAN_ESE */ |
| 5042 | { |
| 5043 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5044 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5045 | hdd_info("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5046 | return auth_type; |
| 5047 | } |
| 5048 | |
| 5049 | /** |
| 5050 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5051 | * Translate RSN to CSR encryption type |
| 5052 | * @cipher_suite: cipher suite |
| 5053 | * |
| 5054 | * Return: eCsrEncryptionType enumeration |
| 5055 | */ |
| 5056 | eCsrEncryptionType |
| 5057 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5058 | { |
| 5059 | eCsrEncryptionType cipher_type; |
| 5060 | |
| 5061 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5062 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5063 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5064 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5065 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5066 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5067 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5068 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5069 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 5070 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5071 | else |
| 5072 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5073 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5074 | hdd_info("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5075 | return cipher_type; |
| 5076 | } |
| 5077 | |
| 5078 | /** |
| 5079 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5080 | * Translate WPA to CSR encryption type |
| 5081 | * @cipher_suite: cipher suite |
| 5082 | * |
| 5083 | * Return: eCsrEncryptionType enumeration |
| 5084 | */ |
| 5085 | eCsrEncryptionType |
| 5086 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5087 | { |
| 5088 | eCsrEncryptionType cipher_type; |
| 5089 | |
| 5090 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5091 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5092 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5093 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5094 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5095 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5096 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5097 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5098 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5099 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5100 | else |
| 5101 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5102 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5103 | hdd_info("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5104 | return cipher_type; |
| 5105 | } |
| 5106 | |
| 5107 | /** |
| 5108 | * hdd_process_genie() - process gen ie |
| 5109 | * @pAdapter: pointer to adapter |
| 5110 | * @bssid: pointer to mac address |
| 5111 | * @pEncryptType: pointer to encryption type |
| 5112 | * @mcEncryptType: pointer to multicast encryption type |
| 5113 | * @pAuthType: pointer to auth type |
| 5114 | * |
| 5115 | * Return: 0 on success, error number otherwise |
| 5116 | */ |
| 5117 | static int32_t hdd_process_genie(hdd_adapter_t *pAdapter, |
| 5118 | u8 *bssid, |
| 5119 | eCsrEncryptionType *pEncryptType, |
| 5120 | eCsrEncryptionType *mcEncryptType, |
| 5121 | eCsrAuthType *pAuthType, |
| 5122 | #ifdef WLAN_FEATURE_11W |
| 5123 | uint8_t *pMfpRequired, uint8_t *pMfpCapable, |
| 5124 | #endif |
| 5125 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5126 | { |
| 5127 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5128 | QDF_STATUS result; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5129 | tDot11fIERSN dot11RSNIE; |
| 5130 | tDot11fIEWPA dot11WPAIE; |
| 5131 | uint32_t i; |
| 5132 | uint8_t *pRsnIe; |
| 5133 | uint16_t RSNIeLen; |
| 5134 | tPmkidCacheInfo PMKIDCache[4]; /* Local transfer memory */ |
| 5135 | bool updatePMKCache = false; |
| 5136 | |
| 5137 | /* |
| 5138 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5139 | * setting present flag to 0. |
| 5140 | */ |
| 5141 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 5142 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 5143 | |
| 5144 | /* Type check */ |
| 5145 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5146 | /* Validity checks */ |
| 5147 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5148 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5149 | hdd_err("Invalid DOT11F RSN IE length :%d", |
| 5150 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5151 | return -EINVAL; |
| 5152 | } |
| 5153 | /* Skip past the EID byte and length byte */ |
| 5154 | pRsnIe = gen_ie + 2; |
| 5155 | RSNIeLen = gen_ie_len - 2; |
| 5156 | /* Unpack the RSN IE */ |
| 5157 | dot11f_unpack_ie_rsn((tpAniSirGlobal) halHandle, |
| 5158 | pRsnIe, RSNIeLen, &dot11RSNIE); |
| 5159 | /* Copy out the encryption and authentication types */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5160 | hdd_info("pairwise cipher suite count: %d", |
| 5161 | dot11RSNIE.pwise_cipher_suite_count); |
| 5162 | hdd_info("authentication suite count: %d", |
| 5163 | dot11RSNIE.akm_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5164 | /*Here we have followed the apple base code, |
| 5165 | but probably I suspect we can do something different */ |
| 5166 | /* dot11RSNIE.akm_suite_count */ |
| 5167 | /* Just translate the FIRST one */ |
| 5168 | *pAuthType = |
| 5169 | hdd_translate_rsn_to_csr_auth_type( |
| 5170 | dot11RSNIE.akm_suites[0]); |
| 5171 | /* dot11RSNIE.pwise_cipher_suite_count */ |
| 5172 | *pEncryptType = |
| 5173 | hdd_translate_rsn_to_csr_encryption_type( |
| 5174 | dot11RSNIE.pwise_cipher_suites[0]); |
| 5175 | /* dot11RSNIE.gp_cipher_suite_count */ |
| 5176 | *mcEncryptType = |
| 5177 | hdd_translate_rsn_to_csr_encryption_type( |
| 5178 | dot11RSNIE.gp_cipher_suite); |
| 5179 | #ifdef WLAN_FEATURE_11W |
| 5180 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1; |
| 5181 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1; |
| 5182 | #endif |
| 5183 | /* Set the PMKSA ID Cache for this interface */ |
| 5184 | for (i = 0; i < dot11RSNIE.pmkid_count; i++) { |
| 5185 | if (is_zero_ether_addr(bssid)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5186 | hdd_err("MAC address is all zeroes"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5187 | break; |
| 5188 | } |
| 5189 | updatePMKCache = true; |
| 5190 | /* |
| 5191 | * For right now, I assume setASSOCIATE() has passed |
| 5192 | * in the bssid. |
| 5193 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5194 | qdf_mem_copy(PMKIDCache[i].BSSID.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5195 | bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5196 | qdf_mem_copy(PMKIDCache[i].PMKID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5197 | dot11RSNIE.pmkid[i], CSR_RSN_PMKID_SIZE); |
| 5198 | } |
| 5199 | |
| 5200 | if (updatePMKCache) { |
| 5201 | /* |
| 5202 | * Calling csr_roam_set_pmkid_cache to configure the |
| 5203 | * PMKIDs into the cache. |
| 5204 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5205 | hdd_info("Calling sme_roam_set_pmkid_cache with cache entry %d.", |
| 5206 | i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5207 | /* Finally set the PMKSA ID Cache in CSR */ |
| 5208 | result = |
| 5209 | sme_roam_set_pmkid_cache(halHandle, |
| 5210 | pAdapter->sessionId, |
| 5211 | PMKIDCache, |
| 5212 | dot11RSNIE.pmkid_count, |
| 5213 | false); |
| 5214 | } |
| 5215 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5216 | /* Validity checks */ |
| 5217 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5218 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5219 | hdd_err("Invalid DOT11F WPA IE length :%d", |
| 5220 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5221 | return -EINVAL; |
| 5222 | } |
| 5223 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
| 5224 | pRsnIe = gen_ie + 2 + 4; |
| 5225 | RSNIeLen = gen_ie_len - (2 + 4); |
| 5226 | /* Unpack the WPA IE */ |
| 5227 | dot11f_unpack_ie_wpa((tpAniSirGlobal) halHandle, |
| 5228 | pRsnIe, RSNIeLen, &dot11WPAIE); |
| 5229 | /* Copy out the encryption and authentication types */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5230 | hdd_info("WPA unicast cipher suite count: %d", |
| 5231 | dot11WPAIE.unicast_cipher_count); |
| 5232 | hdd_info("WPA authentication suite count: %d", |
| 5233 | dot11WPAIE.auth_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5234 | /* dot11WPAIE.auth_suite_count */ |
| 5235 | /* Just translate the FIRST one */ |
| 5236 | *pAuthType = |
| 5237 | hdd_translate_wpa_to_csr_auth_type( |
| 5238 | dot11WPAIE.auth_suites[0]); |
| 5239 | /* dot11WPAIE.unicast_cipher_count */ |
| 5240 | *pEncryptType = |
| 5241 | hdd_translate_wpa_to_csr_encryption_type( |
| 5242 | dot11WPAIE.unicast_ciphers[0]); |
| 5243 | /* dot11WPAIE.unicast_cipher_count */ |
| 5244 | *mcEncryptType = |
| 5245 | hdd_translate_wpa_to_csr_encryption_type( |
| 5246 | dot11WPAIE.multicast_cipher); |
| 5247 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5248 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5249 | return -EINVAL; |
| 5250 | } |
| 5251 | return 0; |
| 5252 | } |
| 5253 | |
| 5254 | /** |
| 5255 | * hdd_set_genie_to_csr() - set genie to csr |
| 5256 | * @pAdapter: pointer to adapter |
| 5257 | * @RSNAuthType: pointer to auth type |
| 5258 | * |
| 5259 | * Return: 0 on success, error number otherwise |
| 5260 | */ |
| 5261 | int hdd_set_genie_to_csr(hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 5262 | { |
| 5263 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5264 | uint32_t status = 0; |
| 5265 | eCsrEncryptionType RSNEncryptType; |
| 5266 | eCsrEncryptionType mcRSNEncryptType; |
| 5267 | #ifdef WLAN_FEATURE_11W |
| 5268 | uint8_t RSNMfpRequired = 0; |
| 5269 | uint8_t RSNMfpCapable = 0; |
| 5270 | #endif |
| 5271 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
| 5272 | /* MAC address of assoc peer */ |
| 5273 | /* But, this routine is only called when we are NOT associated. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5274 | qdf_mem_copy(bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5275 | pWextState->roamProfile.BSSIDs.bssid, |
| 5276 | sizeof(bssid)); |
| 5277 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN |
| 5278 | || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) { |
| 5279 | /* continue */ |
| 5280 | } else { |
| 5281 | return 0; |
| 5282 | } |
| 5283 | /* The actual processing may eventually be more extensive than this. */ |
| 5284 | /* Right now, just consume any PMKIDs that are sent in by the app. */ |
| 5285 | status = hdd_process_genie(pAdapter, bssid, |
| 5286 | &RSNEncryptType, |
| 5287 | &mcRSNEncryptType, RSNAuthType, |
| 5288 | #ifdef WLAN_FEATURE_11W |
| 5289 | &RSNMfpRequired, &RSNMfpCapable, |
| 5290 | #endif |
| 5291 | pWextState->WPARSNIE[1] + 2, |
| 5292 | pWextState->WPARSNIE); |
| 5293 | if (status == 0) { |
| 5294 | /* |
| 5295 | * Now copy over all the security attributes |
| 5296 | * you have parsed out. |
| 5297 | */ |
| 5298 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 5299 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5300 | |
| 5301 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; /* Use the cipher type in the RSN IE */ |
| 5302 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 5303 | mcRSNEncryptType; |
| 5304 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5305 | if ((QDF_IBSS_MODE == pAdapter->device_mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5306 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
| 5307 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) { |
| 5308 | /* |
| 5309 | * For wpa none supplicant sends the WPA IE with unicast |
| 5310 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5311 | * multicast cipher as either AES/TKIP based on group |
| 5312 | * cipher configuration mentioned in the |
| 5313 | * wpa_supplicant.conf. |
| 5314 | */ |
| 5315 | |
| 5316 | /* Set the unicast cipher same as multicast cipher */ |
| 5317 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 5318 | = mcRSNEncryptType; |
| 5319 | } |
| 5320 | #ifdef WLAN_FEATURE_11W |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5321 | hdd_info("RSNMfpRequired = %d, RSNMfpCapable = %d", |
| 5322 | RSNMfpRequired, RSNMfpCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5323 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 5324 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 5325 | #endif |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5326 | hdd_info("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
| 5327 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5328 | } |
| 5329 | return 0; |
| 5330 | } |
| 5331 | |
| 5332 | /** |
| 5333 | * hdd_set_csr_auth_type() - set csr auth type |
| 5334 | * @pAdapter: pointer to adapter |
| 5335 | * @RSNAuthType: auth type |
| 5336 | * |
| 5337 | * Return: 0 on success, error number otherwise |
| 5338 | */ |
| 5339 | int hdd_set_csr_auth_type(hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 5340 | { |
| 5341 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5342 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 5343 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5344 | |
| 5345 | pRoamProfile->AuthType.numEntries = 1; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5346 | hdd_info("pHddStaCtx->conn_info.authType = %d", |
| 5347 | pHddStaCtx->conn_info.authType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5348 | |
| 5349 | switch (pHddStaCtx->conn_info.authType) { |
| 5350 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5351 | #ifdef FEATURE_WLAN_ESE |
| 5352 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5353 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5354 | #endif |
| 5355 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 5356 | |
| 5357 | pRoamProfile->AuthType.authType[0] = |
| 5358 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5359 | } else if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
| 5360 | |
| 5361 | #ifdef FEATURE_WLAN_ESE |
| 5362 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 5363 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5364 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5365 | hdd_info("set authType to CCKM WPA. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5366 | pRoamProfile->AuthType.authType[0] = |
| 5367 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5368 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5369 | hdd_info("Last chance to set authType to CCKM WPA."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5370 | pRoamProfile->AuthType.authType[0] = |
| 5371 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5372 | } else |
| 5373 | #endif |
| 5374 | if ((pWextState-> |
| 5375 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5376 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5377 | pRoamProfile->AuthType.authType[0] = |
| 5378 | eCSR_AUTH_TYPE_WPA; |
| 5379 | } else |
| 5380 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5381 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5382 | pRoamProfile->AuthType.authType[0] = |
| 5383 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5384 | } else { |
| 5385 | pRoamProfile->AuthType.authType[0] = |
| 5386 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5387 | } |
| 5388 | } |
| 5389 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
| 5390 | #ifdef FEATURE_WLAN_ESE |
| 5391 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 5392 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5393 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5394 | hdd_info("set authType to CCKM RSN. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5395 | pRoamProfile->AuthType.authType[0] = |
| 5396 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5397 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5398 | hdd_info("Last chance to set authType to CCKM RSN."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5399 | pRoamProfile->AuthType.authType[0] = |
| 5400 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5401 | } else |
| 5402 | #endif |
| 5403 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5404 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 5405 | ((pWextState-> |
| 5406 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5407 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5408 | pRoamProfile->AuthType.authType[0] = |
| 5409 | eCSR_AUTH_TYPE_FT_RSN; |
| 5410 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 5411 | && |
| 5412 | ((pWextState-> |
| 5413 | authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5414 | == IW_AUTH_KEY_MGMT_PSK)) { |
| 5415 | pRoamProfile->AuthType.authType[0] = |
| 5416 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5417 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5418 | |
| 5419 | #ifdef WLAN_FEATURE_11W |
| 5420 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 5421 | pRoamProfile->AuthType.authType[0] = |
| 5422 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5423 | } else if (RSNAuthType == |
| 5424 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 5425 | pRoamProfile->AuthType.authType[0] = |
| 5426 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5427 | } else |
| 5428 | #endif |
| 5429 | |
| 5430 | if ((pWextState-> |
| 5431 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5432 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5433 | pRoamProfile->AuthType.authType[0] = |
| 5434 | eCSR_AUTH_TYPE_RSN; |
| 5435 | } else |
| 5436 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5437 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5438 | pRoamProfile->AuthType.authType[0] = |
| 5439 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5440 | } else { |
| 5441 | pRoamProfile->AuthType.authType[0] = |
| 5442 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5443 | } |
| 5444 | } |
| 5445 | break; |
| 5446 | |
| 5447 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5448 | |
| 5449 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5450 | break; |
| 5451 | default: |
| 5452 | |
| 5453 | #ifdef FEATURE_WLAN_ESE |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5454 | hdd_info("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5455 | #endif /* FEATURE_WLAN_ESE */ |
| 5456 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5457 | break; |
| 5458 | } |
| 5459 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5460 | hdd_info("Set roam Authtype to %d", |
| 5461 | pWextState->roamProfile.AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5462 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5463 | return 0; |
| 5464 | } |
| 5465 | |
| 5466 | /** |
| 5467 | * __iw_set_essid() - This function sets the ssid received from wpa_supplicant |
| 5468 | * to the CSR roam profile. |
| 5469 | * |
| 5470 | * @dev: Pointer to the net device. |
| 5471 | * @info: Pointer to the iw_request_info. |
| 5472 | * @wrqu: Pointer to the iwreq_data. |
| 5473 | * @extra: Pointer to the data. |
| 5474 | * |
| 5475 | * Return: 0 for success, error number on failure |
| 5476 | */ |
| 5477 | static int __iw_set_essid(struct net_device *dev, |
| 5478 | struct iw_request_info *info, |
| 5479 | union iwreq_data *wrqu, char *extra) |
| 5480 | { |
| 5481 | unsigned long rc; |
| 5482 | uint32_t status = 0; |
| 5483 | hdd_wext_state_t *pWextState; |
| 5484 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5485 | hdd_context_t *hdd_ctx; |
| 5486 | uint32_t roamId; |
| 5487 | tCsrRoamProfile *pRoamProfile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5488 | eCsrAuthType RSNAuthType; |
| 5489 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5490 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5491 | int ret; |
| 5492 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5493 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5494 | |
| 5495 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5496 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5497 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5498 | return ret; |
| 5499 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5500 | if (pAdapter->device_mode != QDF_STA_MODE && |
Jeff Johnson | d6e4b63 | 2016-10-03 13:49:27 -0700 | [diff] [blame] | 5501 | pAdapter->device_mode != QDF_IBSS_MODE && |
| 5502 | pAdapter->device_mode != QDF_P2P_CLIENT_MODE) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5503 | hdd_warn("device mode %s(%d) is not allowed", |
| 5504 | hdd_device_mode_to_string(pAdapter->device_mode), |
| 5505 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5506 | return -EINVAL; |
| 5507 | } |
| 5508 | |
| 5509 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5510 | |
| 5511 | if (pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5512 | hdd_info("Counter measure is in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5513 | return -EBUSY; |
| 5514 | } |
| 5515 | if (SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length) |
| 5516 | return -EINVAL; |
| 5517 | |
| 5518 | pRoamProfile = &pWextState->roamProfile; |
Jeff Johnson | d6e4b63 | 2016-10-03 13:49:27 -0700 | [diff] [blame] | 5519 | if (hdd_conn_is_connected(pHddStaCtx) || |
| 5520 | (pAdapter->device_mode == QDF_IBSS_MODE)) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5521 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5522 | |
| 5523 | /* Need to issue a disconnect to CSR. */ |
| 5524 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5525 | qdf_status = sme_roam_disconnect(hHal, pAdapter->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5526 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 5527 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5528 | if (QDF_STATUS_SUCCESS == qdf_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5529 | rc = wait_for_completion_timeout(&pAdapter-> |
| 5530 | disconnect_comp_var, |
| 5531 | msecs_to_jiffies |
| 5532 | (WLAN_WAIT_TIME_DISCONNECT)); |
| 5533 | if (!rc) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5534 | hdd_err("Disconnect event timed out"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5535 | } |
| 5536 | } |
| 5537 | |
| 5538 | /* |
| 5539 | * when cfg80211 defined, wpa_supplicant wext driver uses |
| 5540 | * zero-length, null-string ssid for force disconnection. |
| 5541 | * after disconnection (if previously connected) and cleaning ssid, |
| 5542 | * driver MUST return success. |
| 5543 | */ |
| 5544 | if (0 == wrqu->essid.length) |
| 5545 | return 0; |
| 5546 | |
| 5547 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5548 | &pWextState->roamProfile.uapsd_mask); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5549 | if (QDF_STATUS_SUCCESS != status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5550 | pWextState->roamProfile.uapsd_mask = 0; |
| 5551 | |
| 5552 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
| 5553 | |
| 5554 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = |
| 5555 | wrqu->essid.length; |
| 5556 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5557 | qdf_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5558 | sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5559 | qdf_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5560 | ssId), extra, wrqu->essid.length); |
| 5561 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion |
| 5562 | || IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion) { |
| 5563 | |
| 5564 | /* set gen ie */ |
| 5565 | hdd_set_genie_to_csr(pAdapter, &RSNAuthType); |
| 5566 | |
| 5567 | /* set auth */ |
| 5568 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5569 | } |
| 5570 | #ifdef FEATURE_WLAN_WAPI |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5571 | hdd_notice("Setting WAPI AUTH Type and Encryption Mode values"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5572 | if (pAdapter->wapi_info.nWapiMode) { |
| 5573 | switch (pAdapter->wapi_info.wapiAuthMode) { |
| 5574 | case WAPI_AUTH_MODE_PSK: |
| 5575 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5576 | hdd_notice("WAPI AUTH TYPE: PSK: %d", |
| 5577 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5578 | pRoamProfile->AuthType.numEntries = 1; |
| 5579 | pRoamProfile->AuthType.authType[0] = |
| 5580 | eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5581 | break; |
| 5582 | } |
| 5583 | case WAPI_AUTH_MODE_CERT: |
| 5584 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5585 | hdd_notice("WAPI AUTH TYPE: CERT: %d", |
| 5586 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5587 | pRoamProfile->AuthType.numEntries = 1; |
| 5588 | pRoamProfile->AuthType.authType[0] = |
| 5589 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5590 | break; |
| 5591 | } |
| 5592 | } /* End of switch */ |
| 5593 | if (pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5594 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5595 | hdd_notice("WAPI PAIRWISE/GROUP ENCRYPTION: WPI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5596 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5597 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 5598 | eCSR_ENCRYPT_TYPE_WPI; |
| 5599 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5600 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 5601 | eCSR_ENCRYPT_TYPE_WPI; |
| 5602 | } |
| 5603 | } |
| 5604 | #endif /* FEATURE_WLAN_WAPI */ |
| 5605 | /* if previous genIE is not NULL, update AssocIE */ |
| 5606 | if (0 != pWextState->genIE.length) { |
| 5607 | memset(&pWextState->assocAddIE, 0, |
| 5608 | sizeof(pWextState->assocAddIE)); |
| 5609 | memcpy(pWextState->assocAddIE.addIEdata, |
| 5610 | pWextState->genIE.addIEdata, pWextState->genIE.length); |
| 5611 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5612 | pWextState->roamProfile.pAddIEAssoc = |
| 5613 | pWextState->assocAddIE.addIEdata; |
| 5614 | pWextState->roamProfile.nAddIEAssocLength = |
| 5615 | pWextState->assocAddIE.length; |
| 5616 | |
| 5617 | /* clear previous genIE after use it */ |
| 5618 | memset(&pWextState->genIE, 0, sizeof(pWextState->genIE)); |
| 5619 | } |
| 5620 | |
| 5621 | /* |
| 5622 | * Assumes it is not WPS Association by default, except when |
| 5623 | * pAddIEAssoc has WPS IE. |
| 5624 | */ |
| 5625 | pWextState->roamProfile.bWPSAssociation = false; |
| 5626 | |
| 5627 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5628 | pWextState->roamProfile. |
| 5629 | nAddIEAssocLength)) |
| 5630 | pWextState->roamProfile.bWPSAssociation = true; |
| 5631 | |
| 5632 | /* Disable auto BMPS entry by PMC until DHCP is done */ |
| 5633 | sme_set_dhcp_till_power_active_flag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5634 | true); |
| 5635 | |
| 5636 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
| 5637 | |
| 5638 | if (eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType) { |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5639 | pRoamProfile->ch_params.ch_width = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5640 | hdd_select_cbmode(pAdapter, |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5641 | (WLAN_HDD_GET_CTX(pAdapter))->config->AdHocChannel5G, |
| 5642 | &pRoamProfile->ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5643 | } |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5644 | |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5645 | /* |
| 5646 | * Change conn_state to connecting before sme_roam_connect(), |
| 5647 | * because sme_roam_connect() has a direct path to call |
| 5648 | * hdd_sme_roam_callback(), which will change the conn_state |
| 5649 | * If direct path, conn_state will be accordingly changed to |
| 5650 | * NotConnected or Associated by either |
| 5651 | * hdd_association_completion_handler() or hdd_dis_connect_handler() |
| 5652 | * in sme_RoamCallback()if sme_RomConnect is to be queued, |
| 5653 | * Connecting state will remain until it is completed. |
| 5654 | * |
| 5655 | * If connection state is not changed, |
| 5656 | * connection state will remain in eConnectionState_NotConnected state. |
| 5657 | * In hdd_association_completion_handler, "hddDisconInProgress" is |
| 5658 | * set to true if conn state is eConnectionState_NotConnected. |
| 5659 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 5660 | * informed of connect result indication which is an issue. |
| 5661 | */ |
| 5662 | if (QDF_STA_MODE == pAdapter->device_mode || |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5663 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode) |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5664 | hdd_conn_set_connection_state(pAdapter, |
| 5665 | eConnectionState_Connecting); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5666 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5667 | status = sme_roam_connect(hHal, pAdapter->sessionId, |
| 5668 | &(pWextState->roamProfile), &roamId); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5669 | if ((QDF_STATUS_SUCCESS != status) && |
| 5670 | (QDF_STA_MODE == pAdapter->device_mode || |
| 5671 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
| 5672 | hdd_err("sme_roam_connect (session %d) failed with status %d. -> NotConnected", |
| 5673 | pAdapter->sessionId, status); |
| 5674 | /* change back to NotAssociated */ |
| 5675 | hdd_conn_set_connection_state(pAdapter, |
| 5676 | eConnectionState_NotConnected); |
| 5677 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5678 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5679 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 5680 | |
| 5681 | EXIT(); |
| 5682 | return status; |
| 5683 | } |
| 5684 | |
| 5685 | /** |
| 5686 | * iw_set_essid() - set essid handler function |
| 5687 | * @dev: Pointer to the net device. |
| 5688 | * @info: Pointer to the iw_request_info. |
| 5689 | * @wrqu: Pointer to the iwreq_data. |
| 5690 | * @extra: Pointer to the data. |
| 5691 | * |
| 5692 | * Return: 0 for success, error number on failure |
| 5693 | */ |
| 5694 | int iw_set_essid(struct net_device *dev, |
| 5695 | struct iw_request_info *info, |
| 5696 | union iwreq_data *wrqu, char *extra) |
| 5697 | { |
| 5698 | int ret; |
| 5699 | |
| 5700 | cds_ssr_protect(__func__); |
| 5701 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 5702 | cds_ssr_unprotect(__func__); |
| 5703 | |
| 5704 | return ret; |
| 5705 | } |
| 5706 | |
| 5707 | /** |
| 5708 | * __iw_get_essid() - This function returns the essid to the wpa_supplicant |
| 5709 | * @dev: pointer to the net device |
| 5710 | * @info: pointer to the iw request info |
| 5711 | * @dwrq: pointer to iw_point |
| 5712 | * @extra: pointer to the data |
| 5713 | * |
| 5714 | * Return: 0 on success, error number otherwise |
| 5715 | */ |
| 5716 | static int __iw_get_essid(struct net_device *dev, |
| 5717 | struct iw_request_info *info, |
| 5718 | struct iw_point *dwrq, char *extra) |
| 5719 | { |
| 5720 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5721 | hdd_context_t *hdd_ctx; |
| 5722 | hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5723 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5724 | int ret; |
| 5725 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5726 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5727 | |
| 5728 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5729 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5730 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5731 | return ret; |
| 5732 | |
| 5733 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 5734 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 5735 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected |
| 5736 | || pHddStaCtx->conn_info.connState == |
| 5737 | eConnectionState_IbssDisconnected) |
| 5738 | && wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) { |
| 5739 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 5740 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 5741 | dwrq->length); |
| 5742 | dwrq->flags = 1; |
| 5743 | } else { |
| 5744 | memset(extra, 0, dwrq->length); |
| 5745 | dwrq->length = 0; |
| 5746 | dwrq->flags = 0; |
| 5747 | } |
| 5748 | EXIT(); |
| 5749 | return 0; |
| 5750 | } |
| 5751 | |
| 5752 | /** |
| 5753 | * iw_get_essid() - get essid handler function |
| 5754 | * @dev: Pointer to the net device. |
| 5755 | * @info: Pointer to the iw_request_info. |
| 5756 | * @wrqu: Pointer to the iwreq_data. |
| 5757 | * @extra: Pointer to the data. |
| 5758 | * |
| 5759 | * Return: 0 for success, error number on failure |
| 5760 | */ |
| 5761 | int iw_get_essid(struct net_device *dev, |
| 5762 | struct iw_request_info *info, |
| 5763 | struct iw_point *wrqu, char *extra) |
| 5764 | { |
| 5765 | int ret; |
| 5766 | |
| 5767 | cds_ssr_protect(__func__); |
| 5768 | ret = __iw_get_essid(dev, info, wrqu, extra); |
| 5769 | cds_ssr_unprotect(__func__); |
| 5770 | |
| 5771 | return ret; |
| 5772 | } |
| 5773 | |
| 5774 | /** |
| 5775 | * __iw_set_auth() - |
| 5776 | * This function sets the auth type received from the wpa_supplicant |
| 5777 | * @dev: pointer to the net device |
| 5778 | * @info: pointer to the iw request info |
| 5779 | * @wrqu: pointer to iwreq_data |
| 5780 | * @extra: pointer to the data |
| 5781 | * |
| 5782 | * Return: 0 on success, error number otherwise |
| 5783 | */ |
| 5784 | static int __iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 5785 | union iwreq_data *wrqu, char *extra) |
| 5786 | { |
| 5787 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5788 | hdd_context_t *hdd_ctx; |
| 5789 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5790 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5791 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 5792 | eCsrEncryptionType mcEncryptionType; |
| 5793 | eCsrEncryptionType ucEncryptionType; |
| 5794 | int ret; |
| 5795 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5796 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5797 | |
| 5798 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5799 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5800 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5801 | return ret; |
| 5802 | |
| 5803 | switch (wrqu->param.flags & IW_AUTH_INDEX) { |
| 5804 | case IW_AUTH_WPA_VERSION: |
| 5805 | pWextState->wpaVersion = wrqu->param.value; |
| 5806 | break; |
| 5807 | |
| 5808 | case IW_AUTH_CIPHER_PAIRWISE: |
| 5809 | { |
| 5810 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 5811 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5812 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5813 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5814 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 5815 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5816 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 5817 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 5818 | == |
| 5819 | (pWextState-> |
| 5820 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 5821 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 5822 | pHddStaCtx->conn_info.authType)) |
| 5823 | /*Dynamic WEP key */ |
| 5824 | ucEncryptionType = |
| 5825 | eCSR_ENCRYPT_TYPE_WEP40; |
| 5826 | else |
| 5827 | /*Static WEP key */ |
| 5828 | ucEncryptionType = |
| 5829 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5830 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 5831 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 5832 | == |
| 5833 | (pWextState-> |
| 5834 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 5835 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 5836 | pHddStaCtx->conn_info.authType)) |
| 5837 | /*Dynamic WEP key */ |
| 5838 | ucEncryptionType = |
| 5839 | eCSR_ENCRYPT_TYPE_WEP104; |
| 5840 | else |
| 5841 | /*Static WEP key */ |
| 5842 | ucEncryptionType = |
| 5843 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5844 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5845 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
| 5846 | wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5847 | return -EINVAL; |
| 5848 | } |
| 5849 | |
| 5850 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5851 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 5852 | ucEncryptionType; |
| 5853 | } |
| 5854 | break; |
| 5855 | case IW_AUTH_CIPHER_GROUP: |
| 5856 | { |
| 5857 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 5858 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 5859 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 5860 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 5861 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 5862 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 5863 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 5864 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 5865 | == |
| 5866 | (pWextState-> |
| 5867 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 5868 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 5869 | pHddStaCtx->conn_info.authType)) |
| 5870 | mcEncryptionType = |
| 5871 | eCSR_ENCRYPT_TYPE_WEP40; |
| 5872 | else |
| 5873 | mcEncryptionType = |
| 5874 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5875 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 5876 | /* Dynamic WEP keys won't work with shared keys */ |
| 5877 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 5878 | == |
| 5879 | (pWextState-> |
| 5880 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 5881 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 5882 | pHddStaCtx->conn_info.authType)) { |
| 5883 | mcEncryptionType = |
| 5884 | eCSR_ENCRYPT_TYPE_WEP104; |
| 5885 | } else { |
| 5886 | mcEncryptionType = |
| 5887 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5888 | } |
| 5889 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5890 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5891 | wrqu->param.value); |
| 5892 | return -EINVAL; |
| 5893 | } |
| 5894 | |
| 5895 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5896 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 5897 | mcEncryptionType; |
| 5898 | } |
| 5899 | break; |
| 5900 | |
| 5901 | case IW_AUTH_80211_AUTH_ALG: |
| 5902 | { |
| 5903 | /* Save the auth algo here and set auth type to SME Roam profile |
| 5904 | in the iw_set_ap_address */ |
| 5905 | if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
| 5906 | pHddStaCtx->conn_info.authType = |
| 5907 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5908 | |
| 5909 | else if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 5910 | pHddStaCtx->conn_info.authType = |
| 5911 | eCSR_AUTH_TYPE_SHARED_KEY; |
| 5912 | |
| 5913 | else if (wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 5914 | /*Not supported */ |
| 5915 | pHddStaCtx->conn_info.authType = |
| 5916 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5917 | pWextState->roamProfile.AuthType.authType[0] = |
| 5918 | pHddStaCtx->conn_info.authType; |
| 5919 | } |
| 5920 | break; |
| 5921 | |
| 5922 | case IW_AUTH_KEY_MGMT: |
| 5923 | { |
| 5924 | #ifdef FEATURE_WLAN_ESE |
| 5925 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 5926 | /*Check for CCKM AKM type */ |
| 5927 | if (wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5928 | hdd_info("CCKM AKM Set %d", wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5929 | /* Set the CCKM bit in authKeyMgmt */ |
| 5930 | /* |
| 5931 | * Right now, this breaks all ref to authKeyMgmt because |
| 5932 | * our code doesn't realize it is a "bitfield" |
| 5933 | */ |
| 5934 | pWextState->authKeyMgmt |= |
| 5935 | IW_AUTH_KEY_MGMT_CCKM; |
| 5936 | /* Set the key management to 802.1X */ |
| 5937 | /* pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; */ |
| 5938 | pWextState->isESEConnection = true; |
| 5939 | /* |
| 5940 | * This is test code. I need to actually KNOW whether |
| 5941 | * this is an RSN Assoc or WPA. |
| 5942 | */ |
| 5943 | pWextState->collectedAuthType = |
| 5944 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5945 | } else if (wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 5946 | /* Save the key management */ |
| 5947 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 5948 | pWextState->collectedAuthType = |
| 5949 | eCSR_AUTH_TYPE_RSN; |
| 5950 | } else |
| 5951 | if (!(wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
| 5952 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; |
| 5953 | /* Save the key management anyway */ |
| 5954 | pWextState->authKeyMgmt = wrqu->param.value; |
| 5955 | } else { /* It must be IW_AUTH_KEY_MGMT_802_1X */ |
| 5956 | /* Save the key management */ |
| 5957 | pWextState->authKeyMgmt |= |
| 5958 | IW_AUTH_KEY_MGMT_802_1X; |
| 5959 | pWextState->collectedAuthType = |
| 5960 | eCSR_AUTH_TYPE_RSN; |
| 5961 | } |
| 5962 | #else |
| 5963 | /* Save the key management */ |
| 5964 | pWextState->authKeyMgmt = wrqu->param.value; |
| 5965 | #endif /* FEATURE_WLAN_ESE */ |
| 5966 | } |
| 5967 | break; |
| 5968 | |
| 5969 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 5970 | { |
| 5971 | if (wrqu->param.value) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5972 | hdd_info("Counter Measure started %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5973 | wrqu->param.value); |
| 5974 | pWextState->mTKIPCounterMeasures = |
| 5975 | TKIP_COUNTER_MEASURE_STARTED; |
| 5976 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5977 | hdd_info("Counter Measure stopped=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5978 | wrqu->param.value); |
| 5979 | pWextState->mTKIPCounterMeasures = |
| 5980 | TKIP_COUNTER_MEASURE_STOPED; |
| 5981 | } |
| 5982 | } |
| 5983 | break; |
| 5984 | case IW_AUTH_DROP_UNENCRYPTED: |
| 5985 | case IW_AUTH_WPA_ENABLED: |
| 5986 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 5987 | case IW_AUTH_ROAMING_CONTROL: |
| 5988 | case IW_AUTH_PRIVACY_INVOKED: |
| 5989 | |
| 5990 | default: |
| 5991 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5992 | hdd_warn("called with unsupported auth type %d", |
| 5993 | wrqu->param.flags & IW_AUTH_INDEX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5994 | break; |
| 5995 | } |
| 5996 | |
| 5997 | EXIT(); |
| 5998 | return 0; |
| 5999 | } |
| 6000 | |
| 6001 | /** |
| 6002 | * iw_set_auth() - set auth callback function |
| 6003 | * @dev: Pointer to the net device. |
| 6004 | * @info: Pointer to the iw_request_info. |
| 6005 | * @wrqu: Pointer to the iwreq_data. |
| 6006 | * @extra: Pointer to the data. |
| 6007 | * |
| 6008 | * Return: 0 for success, error number on failure. |
| 6009 | */ |
| 6010 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6011 | union iwreq_data *wrqu, char *extra) |
| 6012 | { |
| 6013 | int ret; |
| 6014 | |
| 6015 | cds_ssr_protect(__func__); |
| 6016 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 6017 | cds_ssr_unprotect(__func__); |
| 6018 | |
| 6019 | return ret; |
| 6020 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6021 | /** |
| 6022 | * __iw_get_auth() - |
| 6023 | * This function returns the auth type to the wpa_supplicant |
| 6024 | * @dev: pointer to the net device |
| 6025 | * @info: pointer to the iw request info |
| 6026 | * @wrqu: pointer to iwreq_data |
| 6027 | * @extra: pointer to the data |
| 6028 | * |
| 6029 | * Return: 0 on success, error number otherwise |
| 6030 | */ |
| 6031 | static int __iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6032 | union iwreq_data *wrqu, char *extra) |
| 6033 | { |
| 6034 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6035 | hdd_context_t *hdd_ctx; |
| 6036 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6037 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6038 | int ret; |
| 6039 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6040 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6041 | |
| 6042 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6043 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6044 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6045 | return ret; |
| 6046 | |
| 6047 | switch (pRoamProfile->negotiatedAuthType) { |
| 6048 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 6049 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6050 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 6051 | break; |
| 6052 | case eCSR_AUTH_TYPE_WPA: |
| 6053 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6054 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 6055 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6056 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6057 | case eCSR_AUTH_TYPE_FT_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6058 | case eCSR_AUTH_TYPE_RSN: |
| 6059 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6060 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 6061 | break; |
| 6062 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 6063 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6064 | break; |
| 6065 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 6066 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 6067 | break; |
| 6068 | case eCSR_AUTH_TYPE_UNKNOWN: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6069 | hdd_info("called with unknown auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6070 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6071 | break; |
| 6072 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 6073 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6074 | break; |
| 6075 | case eCSR_AUTH_TYPE_WPA_PSK: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6076 | hdd_info("called with WPA PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6077 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6078 | return -EIO; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6079 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6080 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6081 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 6082 | #ifdef WLAN_FEATURE_11W |
| 6083 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 6084 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 6085 | #endif |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6086 | hdd_info("called with RSN PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6087 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6088 | return -EIO; |
| 6089 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6090 | hdd_err("called with unknown auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6091 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6092 | return -EIO; |
| 6093 | } |
| 6094 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) { |
| 6095 | switch (pRoamProfile->negotiatedUCEncryptionType) { |
| 6096 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6097 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6098 | break; |
| 6099 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6100 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6101 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6102 | break; |
| 6103 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6104 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6105 | break; |
| 6106 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6107 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6108 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6109 | break; |
| 6110 | case eCSR_ENCRYPT_TYPE_AES: |
| 6111 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6112 | break; |
| 6113 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6114 | hdd_notice("called with unknown auth type %d", |
| 6115 | pRoamProfile->negotiatedUCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6116 | return -EIO; |
| 6117 | } |
| 6118 | } |
| 6119 | |
| 6120 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) { |
| 6121 | switch (pRoamProfile->negotiatedMCEncryptionType) { |
| 6122 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6123 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6124 | break; |
| 6125 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6126 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6127 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6128 | break; |
| 6129 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6130 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6131 | break; |
| 6132 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6133 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6134 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6135 | break; |
| 6136 | case eCSR_ENCRYPT_TYPE_AES: |
| 6137 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6138 | break; |
| 6139 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6140 | hdd_info("called with unknown auth type %d", |
| 6141 | pRoamProfile->negotiatedMCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6142 | return -EIO; |
| 6143 | } |
| 6144 | } |
| 6145 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6146 | hdd_info("called with auth type %d", |
| 6147 | pRoamProfile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6148 | EXIT(); |
| 6149 | return 0; |
| 6150 | } |
| 6151 | |
| 6152 | /** |
| 6153 | * iw_get_auth() - get auth callback function |
| 6154 | * @dev: Pointer to the net device. |
| 6155 | * @info: Pointer to the iw_request_info. |
| 6156 | * @wrqu: Pointer to the iwreq_data. |
| 6157 | * @extra: Pointer to the data. |
| 6158 | * |
| 6159 | * Return: 0 for success, error number on failure. |
| 6160 | */ |
| 6161 | int iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6162 | union iwreq_data *wrqu, char *extra) |
| 6163 | { |
| 6164 | int ret; |
| 6165 | |
| 6166 | cds_ssr_protect(__func__); |
| 6167 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 6168 | cds_ssr_unprotect(__func__); |
| 6169 | |
| 6170 | return ret; |
| 6171 | } |
| 6172 | |
| 6173 | /** |
| 6174 | * __iw_set_ap_address() - set ap address |
| 6175 | * @dev: pointer to the net device |
| 6176 | * @info: pointer to the iw request info |
| 6177 | * @wrqu: pointer to iwreq_data |
| 6178 | * @extra: pointer to the data |
| 6179 | * |
| 6180 | * This function updates the HDD global station context connection info |
| 6181 | * BSSID with the MAC address received from the wpa_supplicant. |
| 6182 | * |
| 6183 | * Return: 0 on success, error number otherwise |
| 6184 | */ |
| 6185 | static int __iw_set_ap_address(struct net_device *dev, |
| 6186 | struct iw_request_info *info, |
| 6187 | union iwreq_data *wrqu, char *extra) |
| 6188 | { |
| 6189 | |
| 6190 | hdd_adapter_t *adapter; |
| 6191 | hdd_context_t *hdd_ctx; |
| 6192 | hdd_station_ctx_t *pHddStaCtx = |
| 6193 | WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 6194 | uint8_t *pMacAddress = NULL; |
| 6195 | int ret; |
| 6196 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6197 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6198 | |
| 6199 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6200 | |
| 6201 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6202 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6203 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6204 | return ret; |
| 6205 | |
| 6206 | pMacAddress = (uint8_t *) wrqu->ap_addr.sa_data; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6207 | hdd_info(" " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMacAddress)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6208 | qdf_mem_copy(pHddStaCtx->conn_info.bssId.bytes, pMacAddress, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6209 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6210 | EXIT(); |
| 6211 | |
| 6212 | return 0; |
| 6213 | } |
| 6214 | |
| 6215 | /** |
| 6216 | * iw_set_ap_address() - set ap addresses callback function |
| 6217 | * @dev: Pointer to the net device. |
| 6218 | * @info: Pointer to the iw_request_info. |
| 6219 | * @wrqu: Pointer to the iwreq_data. |
| 6220 | * @extra: Pointer to the data. |
| 6221 | * |
| 6222 | * Return: 0 for success, error number on failure. |
| 6223 | */ |
| 6224 | int iw_set_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6225 | union iwreq_data *wrqu, char *extra) |
| 6226 | { |
| 6227 | int ret; |
| 6228 | |
| 6229 | cds_ssr_protect(__func__); |
| 6230 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 6231 | cds_ssr_unprotect(__func__); |
| 6232 | |
| 6233 | return ret; |
| 6234 | } |
| 6235 | |
| 6236 | /** |
| 6237 | * __iw_get_ap_address() - get ap address |
| 6238 | * @dev: pointer to the net device |
| 6239 | * @info: pointer to the iw request info |
| 6240 | * @wrqu: pointer to iwreq_data |
| 6241 | * @extra: pointer to the data |
| 6242 | * |
| 6243 | * This function returns currently associated BSSID. |
| 6244 | * |
| 6245 | * Return: 0 on success, error number otherwise |
| 6246 | */ |
| 6247 | static int __iw_get_ap_address(struct net_device *dev, |
| 6248 | struct iw_request_info *info, |
| 6249 | union iwreq_data *wrqu, char *extra) |
| 6250 | { |
| 6251 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6252 | hdd_context_t *hdd_ctx; |
| 6253 | hdd_station_ctx_t *pHddStaCtx = |
| 6254 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6255 | int ret; |
| 6256 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6257 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6258 | |
| 6259 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6260 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6261 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6262 | return ret; |
| 6263 | |
| 6264 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated || |
| 6265 | eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6266 | qdf_mem_copy(wrqu->ap_addr.sa_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6267 | pHddStaCtx->conn_info.bssId.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6268 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6269 | } else { |
| 6270 | memset(wrqu->ap_addr.sa_data, 0, sizeof(wrqu->ap_addr.sa_data)); |
| 6271 | } |
| 6272 | EXIT(); |
| 6273 | return 0; |
| 6274 | } |
| 6275 | |
| 6276 | /** |
| 6277 | * iw_get_ap_address() - get ap addresses callback function |
| 6278 | * @dev: Pointer to the net device. |
| 6279 | * @info: Pointer to the iw_request_info. |
| 6280 | * @wrqu: Pointer to the iwreq_data. |
| 6281 | * @extra: Pointer to the data. |
| 6282 | * |
| 6283 | * Return: 0 for success, error number on failure. |
| 6284 | */ |
| 6285 | int iw_get_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6286 | union iwreq_data *wrqu, char *extra) |
| 6287 | { |
| 6288 | int ret; |
| 6289 | |
| 6290 | cds_ssr_protect(__func__); |
| 6291 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 6292 | cds_ssr_unprotect(__func__); |
| 6293 | |
| 6294 | return ret; |
| 6295 | } |