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