Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1 | /* |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
Gopichand Nakkala | 0c1331e | 2013-01-07 22:49:07 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 28 | /**======================================================================== |
| 29 | |
| 30 | \file wlan_hdd_tdls.c |
| 31 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 32 | \brief WLAN Host Device Driver implementation for TDLS |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 33 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 34 | ========================================================================*/ |
| 35 | |
| 36 | #include <wlan_hdd_includes.h> |
| 37 | #include <wlan_hdd_hostapd.h> |
| 38 | #include <net/cfg80211.h> |
| 39 | #include <linux/netdevice.h> |
| 40 | #include <linux/skbuff.h> |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 41 | #include <linux/list.h> |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 42 | #include <linux/etherdevice.h> |
| 43 | #include <net/ieee80211_radiotap.h> |
| 44 | #include "wlan_hdd_tdls.h" |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 45 | #include "wlan_hdd_cfg80211.h" |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 46 | #include "wlan_hdd_assoc.h" |
| 47 | #include "sme_Api.h" |
Mahesh A Saptasagar | 8b231b3 | 2014-08-11 11:58:15 +0530 | [diff] [blame] | 48 | #include "vos_sched.h" |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 49 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 50 | static tANI_S32 wlan_hdd_get_tdls_discovery_peer_cnt(tdlsCtx_t *pHddTdlsCtx); |
| 51 | static tANI_S32 wlan_hdd_tdls_peer_reset_discovery_processed(tdlsCtx_t *pHddTdlsCtx); |
| 52 | static void wlan_hdd_tdls_timers_destroy(tdlsCtx_t *pHddTdlsCtx); |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 53 | static void wlan_hdd_tdls_peer_timers_destroy(tdlsCtx_t *pHddTdlsCtx); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 54 | int wpa_tdls_is_allowed_force_peer(tdlsCtx_t *pHddTdlsCtx, u8 *mac); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 55 | #ifdef CONFIG_TDLS_IMPLICIT |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 56 | static void wlan_hdd_tdls_implicit_send_discovery_request(tdlsCtx_t *pHddTdlsCtx); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 57 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 58 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 59 | static u8 wlan_hdd_tdls_hash_key ( |
| 60 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 61 | const u8 *mac |
| 62 | #else |
| 63 | u8 *mac |
| 64 | #endif |
| 65 | ) |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 66 | { |
| 67 | int i; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 68 | u8 key = 0; |
| 69 | |
| 70 | for (i = 0; i < 6; i++) |
| 71 | key ^= mac[i]; |
| 72 | |
| 73 | return key; |
| 74 | } |
| 75 | |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 76 | /** |
| 77 | * wlan_hdd_tdls_disable_offchan_and_teardown_links - Disable offchannel |
| 78 | * and teardown TDLS links |
| 79 | * @hddCtx : pointer to hdd context |
| 80 | * |
| 81 | * Return: None |
| 82 | */ |
| 83 | void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx) |
| 84 | { |
| 85 | u16 connected_tdls_peers = 0; |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 86 | u8 staIdx; |
Masti, Narayanraddi | 471e938 | 2015-07-23 18:51:29 +0530 | [diff] [blame] | 87 | hddTdlsPeer_t *curr_peer = NULL; |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 88 | hdd_adapter_t *adapter = NULL; |
| 89 | |
| 90 | if (eTDLS_SUPPORT_NOT_ENABLED == hddctx->tdls_mode) { |
| 91 | hddLog(LOG1, FL("TDLS mode is disabled OR not enabled in FW")); |
| 92 | return ; |
| 93 | } |
| 94 | |
| 95 | adapter = hdd_get_adapter(hddctx, WLAN_HDD_INFRA_STATION); |
| 96 | |
| 97 | if (adapter == NULL) { |
| 98 | hddLog(LOGE, FL("Station Adapter Not Found")); |
Masti, Narayanraddi | 70e5b47 | 2015-08-04 12:54:16 +0530 | [diff] [blame] | 99 | goto done; |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | connected_tdls_peers = wlan_hdd_tdlsConnectedPeers(adapter); |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 103 | if (!connected_tdls_peers) { |
Masti, Narayanraddi | 70e5b47 | 2015-08-04 12:54:16 +0530 | [diff] [blame] | 104 | hddLog(LOG1, FL("No TDLS connected peers to delete TDLS peers")); |
| 105 | goto done; |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 106 | } |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 107 | |
Masti, Narayanraddi | 471e938 | 2015-07-23 18:51:29 +0530 | [diff] [blame] | 108 | /* TDLS is not supported in case of concurrency |
| 109 | * Disable TDLS Offchannel to avoid more than two concurrent channels. |
| 110 | */ |
| 111 | if (connected_tdls_peers == 1) { |
| 112 | curr_peer = wlan_hdd_tdls_get_connected_peer(adapter); |
| 113 | if (curr_peer && (curr_peer->isOffChannelConfigured == TRUE)) { |
| 114 | hddLog(LOG1, FL("%s: Concurrency detected, Disable " |
| 115 | "TDLS channel switch"), __func__); |
| 116 | curr_peer->isOffChannelEstablished = FALSE; |
| 117 | sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(adapter), |
| 118 | adapter->sessionId, |
| 119 | curr_peer->peerMac, |
| 120 | curr_peer->peerParams.channel, |
| 121 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 122 | TDLS_CHANNEL_SWITCH_DISABLE); |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 123 | } |
| 124 | } |
Masti, Narayanraddi | 471e938 | 2015-07-23 18:51:29 +0530 | [diff] [blame] | 125 | |
| 126 | /* Send Msg to PE for sending deauth and deleting all the TDLS peers */ |
| 127 | sme_DeleteAllTDLSPeers(hddctx->hHal, adapter->sessionId); |
| 128 | |
| 129 | /* As mentioned above TDLS is not supported in case of concurrency |
| 130 | * Find the connected peer and generate TDLS teardown indication to |
| 131 | * supplicant. |
| 132 | */ |
| 133 | for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) { |
| 134 | if (!hddctx->tdlsConnInfo[staIdx].staId) |
| 135 | continue; |
| 136 | |
| 137 | curr_peer = wlan_hdd_tdls_find_all_peer(hddctx, |
| 138 | hddctx->tdlsConnInfo[staIdx].peerMac.bytes); |
| 139 | |
| 140 | if (!curr_peer) |
| 141 | continue; |
| 142 | |
| 143 | /* Del Sta happened already as part of sme_DeleteAllTDLSPeers |
| 144 | * Hence clear hdd data structure. |
| 145 | */ |
| 146 | hdd_roamDeregisterTDLSSTA(adapter, |
| 147 | hddctx->tdlsConnInfo[staIdx].staId); |
| 148 | wlan_hdd_tdls_decrement_peer_count(adapter); |
| 149 | wlan_hdd_tdls_reset_peer(adapter, curr_peer->peerMac); |
| 150 | |
| 151 | hddctx->tdlsConnInfo[staIdx].staId = 0 ; |
| 152 | hddctx->tdlsConnInfo[staIdx].sessionId = 255; |
| 153 | vos_mem_zero(&hddctx->tdlsConnInfo[staIdx].peerMac, |
| 154 | sizeof(v_MACADDR_t)) ; |
| 155 | wlan_hdd_tdls_check_bmps(adapter); |
| 156 | |
| 157 | hddLog(LOG1, FL("indicate TDLS teardown (staId %d)"), |
| 158 | curr_peer->staId); |
| 159 | |
| 160 | /* Indicate teardown to supplicant */ |
| 161 | wlan_hdd_tdls_indicate_teardown( |
| 162 | curr_peer->pHddTdlsCtx->pAdapter, |
| 163 | curr_peer, |
| 164 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 165 | } |
| 166 | |
Masti, Narayanraddi | 70e5b47 | 2015-08-04 12:54:16 +0530 | [diff] [blame] | 167 | done: |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 168 | wlan_hdd_tdls_set_mode(hddctx, eTDLS_SUPPORT_DISABLED, FALSE); |
| 169 | hddLog(LOG1, FL("TDLS Support Disabled")); |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * hdd_tdls_notify_mode_change - Notify mode change |
| 174 | * @adapter: pointer to hdd adapter |
| 175 | * @hddCtx : pointer to hdd context |
| 176 | * |
| 177 | * Return: None |
| 178 | */ |
| 179 | void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter, hdd_context_t *hddctx) |
| 180 | { |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 181 | wlan_hdd_tdls_disable_offchan_and_teardown_links(hddctx); |
| 182 | } |
| 183 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 184 | static v_VOID_t wlan_hdd_tdls_start_peer_discover_timer(tdlsCtx_t *pHddTdlsCtx, |
| 185 | tANI_BOOLEAN mutexLock, |
| 186 | v_U32_t discoveryExpiry) |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 187 | { |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 188 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 189 | hdd_context_t *pHddCtx; |
| 190 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 191 | ENTER(); |
| 192 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 193 | if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) ) |
| 194 | { |
| 195 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 196 | FL(" pHddTdlsCtx or pAdapter points to NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 197 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 198 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 199 | |
| 200 | pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter ); |
| 201 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 202 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 203 | { |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 204 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 205 | } |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 206 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 207 | if ( mutexLock ) |
| 208 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 209 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 210 | } |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 211 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 212 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pHddTdlsCtx->pAdapter); |
Deepthi Gowri | 681c943 | 2015-05-14 11:51:11 +0530 | [diff] [blame] | 213 | |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 214 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "beacon rssi: %d", |
| 215 | pHddTdlsCtx->ap_rssi); |
| 216 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 217 | if ( mutexLock ) |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 218 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 219 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 220 | EXIT(); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 221 | return; |
| 222 | } |
| 223 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 224 | #ifdef TDLS_USE_SEPARATE_DISCOVERY_TIMER |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 225 | static v_VOID_t wlan_hdd_tdls_discover_peer_cb( v_PVOID_t userData ) |
| 226 | { |
| 227 | int i; |
| 228 | struct list_head *head; |
| 229 | struct list_head *pos; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 230 | hddTdlsPeer_t *curr_peer; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 231 | hdd_context_t *pHddCtx; |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 232 | tdlsCtx_t *pHddTdlsCtx; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 233 | int discover_req_sent = 0; |
| 234 | v_U32_t discover_expiry = TDLS_SUB_DISCOVERY_PERIOD; |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 235 | tANI_BOOLEAN doMutexLock = eANI_BOOLEAN_TRUE; |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 236 | v_CONTEXT_t pVosContext; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 237 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 238 | ENTER(); |
| 239 | |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 240 | pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL); |
| 241 | if (NULL == pVosContext) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 242 | { |
| 243 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 244 | FL("pVosContext points to NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 245 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 246 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 247 | |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 248 | pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); |
| 249 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
Sushant Kaushik | 15c4c52 | 2014-08-14 12:24:49 +0530 | [diff] [blame] | 250 | { |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 251 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 252 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 253 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 254 | mutex_lock(&pHddCtx->tdls_lock); |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 255 | pHddTdlsCtx = (tdlsCtx_t *)userData; |
| 256 | if (0 != (wlan_hdd_validate_tdls_context(pHddCtx, pHddTdlsCtx))) |
| 257 | { |
| 258 | mutex_unlock(&pHddCtx->tdls_lock); |
| 259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 260 | FL("Invalid pHddTdlsCtx context")); |
| 261 | return; |
| 262 | } |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 263 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 264 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ", __func__); |
| 265 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 266 | if (0 == pHddTdlsCtx->discovery_peer_cnt) |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 267 | pHddTdlsCtx->discovery_peer_cnt = wlan_hdd_get_tdls_discovery_peer_cnt(pHddTdlsCtx); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 268 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 269 | for (i = 0; i < 256; i++) { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 270 | head = &pHddTdlsCtx->peer_list[i]; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 271 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 272 | list_for_each (pos, head) { |
| 273 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 274 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 275 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 276 | "%d " MAC_ADDRESS_STR " %d %d, %d %d %d %d", i, |
| 277 | MAC_ADDR_ARRAY(curr_peer->peerMac), |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 278 | curr_peer->discovery_processed, |
| 279 | discover_req_sent, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 280 | curr_peer->tdls_support, |
| 281 | curr_peer->link_status, |
| 282 | curr_peer->discovery_attempt, |
| 283 | pHddTdlsCtx->threshold_config.discovery_tries_n); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 284 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 285 | if (discover_req_sent < TDLS_MAX_DISCOVER_REQS_PER_TIMER) { |
| 286 | if (!curr_peer->discovery_processed) { |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 287 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 288 | curr_peer->discovery_processed = 1; |
| 289 | discover_req_sent++; |
| 290 | pHddTdlsCtx->discovery_peer_cnt--; |
| 291 | |
| 292 | if ((eTDLS_CAP_UNKNOWN == curr_peer->tdls_support) && |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 293 | (eTDLS_LINK_IDLE == curr_peer->link_status) && |
Gopichand Nakkala | b88f677 | 2013-02-27 18:12:56 -0800 | [diff] [blame] | 294 | (curr_peer->tx_pkt >= |
| 295 | pHddTdlsCtx->threshold_config.tx_packet_n)) { |
Gopichand Nakkala | 273d5a0 | 2013-02-19 15:15:09 -0800 | [diff] [blame] | 296 | |
| 297 | if (curr_peer->discovery_attempt < |
| 298 | pHddTdlsCtx->threshold_config.discovery_tries_n) { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 299 | cfg80211_tdls_oper_request( |
| 300 | pHddTdlsCtx->pAdapter->dev, |
| 301 | curr_peer->peerMac, |
| 302 | NL80211_TDLS_DISCOVERY_REQ, |
| 303 | FALSE, |
| 304 | GFP_KERNEL); |
Gopichand Nakkala | 273d5a0 | 2013-02-19 15:15:09 -0800 | [diff] [blame] | 305 | curr_peer->discovery_attempt++; |
| 306 | } |
| 307 | else |
| 308 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 309 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Gopichand Nakkala | 273d5a0 | 2013-02-19 15:15:09 -0800 | [diff] [blame] | 310 | "%s: Maximum Discovery retries reached", __func__); |
| 311 | curr_peer->tdls_support = eTDLS_CAP_NOT_SUPPORTED; |
| 312 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 313 | |
| 314 | } |
| 315 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 316 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 317 | else |
| 318 | goto exit_loop; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 319 | } |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 320 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 321 | exit_loop: |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 322 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 323 | if (0 != pHddTdlsCtx->discovery_peer_cnt) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 324 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 325 | "discovery_peer_cnt is %d , Starting SUB_DISCOVERY_TIMER", |
| 326 | pHddTdlsCtx->discovery_peer_cnt); |
| 327 | discover_expiry = TDLS_SUB_DISCOVERY_PERIOD; |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 328 | doMutexLock = eANI_BOOLEAN_FALSE; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 329 | goto done; |
| 330 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 331 | discover_expiry = pHddTdlsCtx->threshold_config.discovery_period_t; |
| 332 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 333 | wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 334 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 335 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 336 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 337 | /* Commenting out the following function as it was introducing |
| 338 | * a race condition when pHddTdlsCtx is deleted. Also , this |
| 339 | * function is consuming more time in the timer callback. |
| 340 | * RSSI based trigger needs to revisit this part of the code. |
| 341 | */ |
| 342 | |
| 343 | /* |
| 344 | * wlan_hdd_get_rssi(pAdapter, &pHddTdlsCtx->ap_rssi); |
| 345 | */ |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 346 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 347 | done: |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 348 | wlan_hdd_tdls_start_peer_discover_timer(pHddTdlsCtx, doMutexLock, discover_expiry); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 349 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 350 | if ( !doMutexLock ) |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 351 | mutex_unlock(&pHddCtx->tdls_lock); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 352 | EXIT(); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 353 | return; |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 354 | } |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 355 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 356 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 357 | static v_VOID_t wlan_hdd_tdls_update_peer_cb( v_PVOID_t userData ) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 358 | { |
| 359 | int i; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 360 | struct list_head *head; |
| 361 | struct list_head *pos; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 362 | hddTdlsPeer_t *curr_peer; |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 363 | tdlsCtx_t *pHddTdlsCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 364 | hdd_context_t *pHddCtx; |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 365 | v_CONTEXT_t pVosContext; |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 366 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 367 | ENTER(); |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 368 | pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL); |
| 369 | if (NULL == pVosContext) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 370 | { |
| 371 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 372 | FL("pVosContext points to NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 373 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 374 | } |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 375 | pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); |
| 376 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
Sushant Kaushik | 15c4c52 | 2014-08-14 12:24:49 +0530 | [diff] [blame] | 377 | { |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 378 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 379 | } |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 380 | mutex_lock(&pHddCtx->tdls_lock); |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 381 | pHddTdlsCtx = (tdlsCtx_t *)userData; |
| 382 | if (0 != (wlan_hdd_validate_tdls_context(pHddCtx, pHddTdlsCtx))) |
| 383 | { |
| 384 | mutex_unlock(&pHddCtx->tdls_lock); |
| 385 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 386 | FL("Invalid pHddTdlsCtx context")); |
| 387 | return; |
| 388 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 389 | for (i = 0; i < 256; i++) { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 390 | head = &pHddTdlsCtx->peer_list[i]; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 391 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 392 | list_for_each (pos, head) { |
| 393 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 394 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 395 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 396 | "%s: " MAC_ADDRESS_STR " link_status %d" |
| 397 | " tdls_support %d", __func__, MAC_ADDR_ARRAY(curr_peer->peerMac), |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 398 | curr_peer->link_status, curr_peer->tdls_support); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 399 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 400 | if (eTDLS_CAP_SUPPORTED == curr_peer->tdls_support) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 401 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 402 | "tx %d, rx %d (thr.pkt %d/idle %d), rssi %d (thr.trig %d/hys %d/tear %d)", |
| 403 | curr_peer->tx_pkt, curr_peer->rx_pkt, |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 404 | pHddTdlsCtx->threshold_config.tx_packet_n, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 405 | pHddTdlsCtx->threshold_config.idle_packet_n, |
| 406 | curr_peer->rssi, |
| 407 | pHddTdlsCtx->threshold_config.rssi_trigger_threshold, |
| 408 | pHddTdlsCtx->threshold_config.rssi_hysteresis, |
| 409 | pHddTdlsCtx->threshold_config.rssi_teardown_threshold); |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 410 | |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 411 | if ((eTDLS_LINK_IDLE == curr_peer->link_status) || |
| 412 | (eTDLS_LINK_DISCOVERING == curr_peer->link_status)){ |
Sunil Dutt | 961ecbd | 2013-11-28 20:04:07 +0530 | [diff] [blame] | 413 | |
| 414 | if (pHddCtx->cfg_ini->fTDLSExternalControl && |
| 415 | (FALSE == curr_peer->isForcedPeer)) { |
Ganesh Kondabattini | 2d7b6a4 | 2015-09-01 18:45:18 +0530 | [diff] [blame^] | 416 | goto next_peer; |
Sunil Dutt | 961ecbd | 2013-11-28 20:04:07 +0530 | [diff] [blame] | 417 | } |
| 418 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 419 | if (curr_peer->tx_pkt >= |
| 420 | pHddTdlsCtx->threshold_config.tx_packet_n) { |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 421 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 422 | if (HDD_MAX_NUM_TDLS_STA > wlan_hdd_tdlsConnectedPeers(pHddTdlsCtx->pAdapter)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 423 | { |
| 424 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 425 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 426 | "Tput trigger TDLS pre-setup"); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 427 | #ifdef CONFIG_TDLS_IMPLICIT |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 428 | pHddTdlsCtx->curr_candidate = curr_peer; |
| 429 | wlan_hdd_tdls_implicit_send_discovery_request(pHddTdlsCtx); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 430 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 431 | } |
| 432 | else |
| 433 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 434 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 435 | "%s: Maximum peer connected already! %d", |
| 436 | __func__, wlan_hdd_tdlsConnectedPeers(pHddTdlsCtx->pAdapter) ); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 437 | } |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 438 | goto next_peer; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 439 | } |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 440 | } |
| 441 | else if (eTDLS_LINK_CONNECTED == curr_peer->link_status) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 442 | if ((tANI_S32)curr_peer->rssi < |
| 443 | (tANI_S32)pHddTdlsCtx->threshold_config.rssi_teardown_threshold) { |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 444 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 445 | VOS_TRACE( VOS_MODULE_ID_HDD, |
| 446 | VOS_TRACE_LEVEL_WARN, |
| 447 | "Tear down - low RSSI: " MAC_ADDRESS_STR "!", |
| 448 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
| 449 | #ifdef CONFIG_TDLS_IMPLICIT |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 450 | wlan_hdd_tdls_indicate_teardown(pHddTdlsCtx->pAdapter, |
| 451 | curr_peer, |
| 452 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 453 | #endif |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 454 | goto next_peer; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 455 | } |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 456 | |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 457 | /* Only teardown based on non zero idle packet threshold, to address a use |
| 458 | * case where this threshold does not get consider for TEAR DOWN. |
| 459 | */ |
| 460 | |
| 461 | if (( 0 != pHddTdlsCtx->threshold_config.idle_packet_n ) && |
| 462 | ((curr_peer->tx_pkt < |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 463 | pHddTdlsCtx->threshold_config.idle_packet_n) && |
| 464 | (curr_peer->rx_pkt < |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 465 | pHddTdlsCtx->threshold_config.idle_packet_n))) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 466 | if (VOS_TIMER_STATE_RUNNING != |
| 467 | vos_timer_getCurrentState(&curr_peer->peerIdleTimer)) { |
| 468 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 469 | "Tx/Rx Idle timer start: " MAC_ADDRESS_STR "!", |
| 470 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 471 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 472 | &curr_peer->peerIdleTimer, |
| 473 | pHddTdlsCtx->threshold_config.idle_timeout_t); |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 474 | } |
| 475 | } else { |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 476 | if (VOS_TIMER_STATE_RUNNING == |
| 477 | vos_timer_getCurrentState(&curr_peer->peerIdleTimer)) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 478 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 479 | "Tx/Rx Idle timer stop: " MAC_ADDRESS_STR "!", |
| 480 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
| 481 | vos_timer_stop( &curr_peer->peerIdleTimer); |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 482 | } |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 483 | } |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 484 | |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 485 | // if (curr_peer->rssi < |
| 486 | // (pHddTdlsCtx->threshold_config.rssi_hysteresis + |
| 487 | // pHddTdlsCtx->ap_rssi)) { |
| 488 | // |
| 489 | //#ifdef CONFIG_TDLS_IMPLICIT |
| 490 | // cfg80211_tdls_oper_request(pHddTdlsCtx->dev, |
| 491 | // curr_peer->peerMac, |
| 492 | // NL80211_TDLS_TEARDOWN, FALSE, |
| 493 | // GFP_KERNEL); |
| 494 | //#endif |
| 495 | // } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 496 | } |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 497 | } else if (eTDLS_CAP_UNKNOWN == curr_peer->tdls_support) { |
Sunil Dutt | 961ecbd | 2013-11-28 20:04:07 +0530 | [diff] [blame] | 498 | |
| 499 | if (pHddCtx->cfg_ini->fTDLSExternalControl && |
| 500 | (FALSE == curr_peer->isForcedPeer)) { |
Ganesh Kondabattini | 2d7b6a4 | 2015-09-01 18:45:18 +0530 | [diff] [blame^] | 501 | goto next_peer; |
Sunil Dutt | 961ecbd | 2013-11-28 20:04:07 +0530 | [diff] [blame] | 502 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 503 | if (!TDLS_IS_CONNECTED(curr_peer)) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 504 | if (curr_peer->tx_pkt >= |
| 505 | pHddTdlsCtx->threshold_config.tx_packet_n) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 506 | |
Sunil Dutt | b0d3924 | 2014-09-10 23:54:51 +0530 | [diff] [blame] | 507 | /* Ignore discovery attempt if External Control is enabled, that |
| 508 | * is, peer is forced. In that case, continue discovery attempt |
| 509 | * regardless attempt count |
| 510 | */ |
| 511 | if (curr_peer->isForcedPeer || curr_peer->discovery_attempt++ < |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 512 | pHddTdlsCtx->threshold_config.discovery_tries_n) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 513 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 514 | "TDLS UNKNOWN discover "); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 515 | #ifdef CONFIG_TDLS_IMPLICIT |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 516 | pHddTdlsCtx->curr_candidate = curr_peer; |
| 517 | wlan_hdd_tdls_implicit_send_discovery_request(pHddTdlsCtx); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 518 | #endif |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 519 | } |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 520 | else |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 521 | { |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 522 | curr_peer->tdls_support = eTDLS_CAP_NOT_SUPPORTED; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 523 | wlan_hdd_tdls_set_peer_link_status( |
| 524 | curr_peer, |
| 525 | eTDLS_LINK_IDLE, |
| 526 | eTDLS_LINK_NOT_SUPPORTED); |
| 527 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 528 | } |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 529 | } |
| 530 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 531 | } |
| 532 | |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 533 | next_peer: |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 534 | curr_peer->tx_pkt = 0; |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 535 | curr_peer->rx_pkt = 0; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 536 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 537 | } |
| 538 | |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 539 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 540 | &pHddTdlsCtx->peerUpdateTimer, |
| 541 | pHddTdlsCtx->threshold_config.tx_period_t); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 542 | mutex_unlock(&pHddCtx->tdls_lock); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 543 | EXIT(); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 544 | } |
| 545 | |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 546 | static v_VOID_t wlan_hdd_tdls_idle_cb( v_PVOID_t userData ) |
| 547 | { |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 548 | #ifdef CONFIG_TDLS_IMPLICIT |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 549 | hddTdlsPeer_t *curr_peer; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 550 | tdlsCtx_t *pHddTdlsCtx; |
| 551 | hdd_context_t *pHddCtx; |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 552 | v_CONTEXT_t pVosContext; |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 553 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 554 | ENTER(); |
| 555 | |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 556 | pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL); |
| 557 | if (NULL == pVosContext) |
| 558 | { |
| 559 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 560 | FL("pVosContext points to NULL")); |
| 561 | return; |
| 562 | } |
| 563 | pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); |
| 564 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 565 | { |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 566 | return; |
| 567 | } |
| 568 | |
| 569 | mutex_lock(&pHddCtx->tdls_lock); |
| 570 | |
| 571 | curr_peer = (hddTdlsPeer_t *)userData; |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 572 | if (NULL == curr_peer) |
| 573 | { |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 574 | mutex_unlock(&pHddCtx->tdls_lock); |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 575 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 576 | FL("Invalid tdls idle timer expired")); |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 577 | return; |
| 578 | } |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 579 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 580 | pHddTdlsCtx = curr_peer->pHddTdlsCtx; |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 581 | if (0 != (wlan_hdd_validate_tdls_context(pHddCtx, pHddTdlsCtx))) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 582 | { |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 583 | mutex_unlock(&pHddCtx->tdls_lock); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 584 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 585 | FL("Invalid pHddTdlsCtx context")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 586 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 587 | } |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 588 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 589 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 590 | "%s: Tx/Rx Idle " MAC_ADDRESS_STR " tx_pkt: %d, rx_pkt: %d, idle_packet_n: %d", |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 591 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac), |
| 592 | curr_peer->tx_pkt, |
| 593 | curr_peer->rx_pkt, |
| 594 | curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n); |
| 595 | |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 596 | /* Check tx/rx statistics on this tdls link for recent activities and |
| 597 | * then decide whether to tear down the link or keep it. |
| 598 | */ |
| 599 | if ((curr_peer->tx_pkt >= curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n) || (curr_peer->rx_pkt >= curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n)) |
| 600 | { |
| 601 | /* this tdls link got back to normal, so keep it */ |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 602 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 603 | "%s: tdls link to " MAC_ADDRESS_STR " back to normal, will stay", |
| 604 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac)); |
| 605 | } |
| 606 | else |
| 607 | { |
| 608 | /* this tdls link needs to get torn down */ |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 609 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 610 | "%s: trigger tdls link to " MAC_ADDRESS_STR " down", |
| 611 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac)); |
| 612 | |
| 613 | wlan_hdd_tdls_indicate_teardown(curr_peer->pHddTdlsCtx->pAdapter, |
| 614 | curr_peer, |
| 615 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 616 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 617 | mutex_unlock(&pHddCtx->tdls_lock); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 618 | EXIT(); |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 619 | #endif |
| 620 | } |
| 621 | |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 622 | static v_VOID_t wlan_hdd_tdls_discovery_timeout_peer_cb(v_PVOID_t userData) |
| 623 | { |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 624 | int i; |
| 625 | struct list_head *head; |
| 626 | hddTdlsPeer_t *tmp; |
| 627 | struct list_head *pos, *q; |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 628 | tdlsCtx_t *pHddTdlsCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 629 | hdd_context_t *pHddCtx; |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 630 | v_CONTEXT_t pVosContext; |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 631 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 632 | ENTER(); |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 633 | pVosContext = vos_get_global_context(VOS_MODULE_ID_HDD, NULL); |
| 634 | if (NULL == pVosContext) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 635 | { |
| 636 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 637 | FL("pVosContext points to NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 638 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 639 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 640 | |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 641 | pHddCtx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); |
| 642 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
Sushant Kaushik | 15c4c52 | 2014-08-14 12:24:49 +0530 | [diff] [blame] | 643 | { |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 644 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 645 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 646 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 647 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 648 | |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 649 | pHddTdlsCtx = (tdlsCtx_t *)userData; |
| 650 | if (0 != (wlan_hdd_validate_tdls_context(pHddCtx, pHddTdlsCtx))) |
| 651 | { |
| 652 | mutex_unlock(&pHddCtx->tdls_lock); |
| 653 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 654 | FL("Invalid pHddTdlsCtx context")); |
| 655 | return; |
| 656 | } |
| 657 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 658 | for (i = 0; i < 256; i++) { |
| 659 | head = &pHddTdlsCtx->peer_list[i]; |
| 660 | list_for_each_safe (pos, q, head) { |
| 661 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
| 662 | if (eTDLS_LINK_DISCOVERING == tmp->link_status) |
| 663 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 664 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 665 | "%s: " MAC_ADDRESS_STR " to idle state", __func__, |
| 666 | MAC_ADDR_ARRAY(tmp->peerMac)); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 667 | wlan_hdd_tdls_set_peer_link_status( |
| 668 | tmp, |
| 669 | eTDLS_LINK_IDLE, |
Atul Mittal | ad630e4 | 2014-10-07 19:19:14 +0530 | [diff] [blame] | 670 | eTDLS_LINK_NOT_SUPPORTED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 671 | } |
| 672 | } |
| 673 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 674 | |
| 675 | pHddTdlsCtx->discovery_sent_cnt = 0; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 676 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 677 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 678 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 679 | |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 680 | wlan_hdd_tdls_check_bmps(pHddTdlsCtx->pAdapter); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 681 | EXIT(); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 682 | return; |
| 683 | } |
| 684 | |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 685 | static v_VOID_t wlan_hdd_tdls_initiator_wait_cb( v_PVOID_t userData ) |
| 686 | { |
| 687 | hddTdlsPeer_t *curr_peer = (hddTdlsPeer_t *)userData; |
| 688 | tdlsCtx_t *pHddTdlsCtx; |
| 689 | |
Mahesh A Saptasagar | 4534e2b | 2015-03-05 20:45:41 +0530 | [diff] [blame] | 690 | ENTER(); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 691 | if ( NULL == curr_peer ) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 692 | { |
| 693 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 694 | FL("curr_peer is NULL")); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 695 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 696 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 697 | |
| 698 | pHddTdlsCtx = curr_peer->pHddTdlsCtx; |
| 699 | |
| 700 | if ( NULL == pHddTdlsCtx ) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 701 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 702 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 703 | FL("pHddTdlsCtx is NULL")); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 704 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 705 | } |
Mahesh A Saptasagar | 4534e2b | 2015-03-05 20:45:41 +0530 | [diff] [blame] | 706 | if (0 != (wlan_hdd_validate_context( |
| 707 | WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter)))) |
| 708 | { |
| 709 | return; |
| 710 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 711 | WLANTL_ResumeDataTx( (WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter))->pvosContext, |
| 712 | (v_U8_t *)&curr_peer->staId); |
Mahesh A Saptasagar | 4534e2b | 2015-03-05 20:45:41 +0530 | [diff] [blame] | 713 | EXIT(); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 714 | } |
| 715 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 716 | static void wlan_hdd_tdls_free_list(tdlsCtx_t *pHddTdlsCtx) |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 717 | { |
| 718 | int i; |
| 719 | struct list_head *head; |
| 720 | hddTdlsPeer_t *tmp; |
| 721 | struct list_head *pos, *q; |
| 722 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 723 | if (NULL == pHddTdlsCtx) |
| 724 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 725 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 726 | FL("pHddTdlsCtx is NULL")); |
| 727 | return; |
| 728 | } |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 729 | |
| 730 | for (i = 0; i < 256; i++) { |
| 731 | head = &pHddTdlsCtx->peer_list[i]; |
| 732 | list_for_each_safe (pos, q, head) { |
| 733 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
| 734 | list_del(pos); |
| 735 | vos_mem_free(tmp); |
Srinivas Girigowda | 8d2348f | 2013-12-12 12:14:15 -0800 | [diff] [blame] | 736 | tmp = NULL; |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 737 | } |
| 738 | } |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 739 | } |
| 740 | |
Sameer Thalappil | bee426e | 2013-10-30 10:30:30 -0700 | [diff] [blame] | 741 | static void wlan_hdd_tdls_schedule_scan(struct work_struct *work) |
| 742 | { |
| 743 | tdls_scan_context_t *scan_ctx = |
| 744 | container_of(work, tdls_scan_context_t, tdls_scan_work.work); |
| 745 | |
| 746 | if (NULL == scan_ctx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 747 | { |
| 748 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 749 | FL("scan_ctx is NULL")); |
Sameer Thalappil | bee426e | 2013-10-30 10:30:30 -0700 | [diff] [blame] | 750 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 751 | } |
Sameer Thalappil | bee426e | 2013-10-30 10:30:30 -0700 | [diff] [blame] | 752 | |
| 753 | if (unlikely(TDLS_CTX_MAGIC != scan_ctx->magic)) |
| 754 | return; |
| 755 | |
| 756 | scan_ctx->attempt++; |
| 757 | |
| 758 | wlan_hdd_cfg80211_scan(scan_ctx->wiphy, |
| 759 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 760 | scan_ctx->dev, |
| 761 | #endif |
| 762 | scan_ctx->scan_request); |
| 763 | } |
| 764 | |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 765 | void wlan_hdd_tdls_btCoex_cb(void *data, int indType) |
| 766 | { |
| 767 | hdd_adapter_t *pAdapter; |
| 768 | hdd_context_t *pHddCtx; |
| 769 | u16 connectedTdlsPeers; |
| 770 | tdlsCtx_t *pHddTdlsCtx; |
| 771 | hddTdlsPeer_t *currPeer; |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 772 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 773 | ENTER(); |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 774 | if ((NULL == data) || (indType < 0)) |
| 775 | { |
| 776 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 777 | FL("Invalid arguments")); |
| 778 | return; |
| 779 | } |
| 780 | |
| 781 | pHddCtx = (hdd_context_t *)data; |
| 782 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 783 | { |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 784 | return; |
| 785 | } |
| 786 | |
| 787 | /* if tdls is not enabled, then continue btCoex */ |
| 788 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
| 789 | { |
| 790 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 791 | FL("tdls is not enabled")); |
| 792 | return; |
| 793 | } |
| 794 | |
| 795 | /* get pAdapter context, do we need WLAN_HDD_P2P_CLIENT */ |
| 796 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 797 | if (NULL == pAdapter) |
| 798 | { |
| 799 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 800 | FL("pAdapter is not valid")); |
| 801 | return; |
| 802 | } |
| 803 | |
| 804 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 805 | if (NULL == pHddTdlsCtx) |
| 806 | { |
| 807 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 808 | FL("pHddTdlsCtx is not valid")); |
| 809 | return; |
| 810 | } |
| 811 | |
| 812 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 813 | "%s: BtCoex notification type %d", __func__, indType); |
| 814 | /* BtCoex notification type enabled, Disable TDLS */ |
| 815 | if (indType == SIR_COEX_IND_TYPE_TDLS_DISABLE) |
| 816 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 817 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 818 | FL("BtCoex notification, Disable TDLS")); |
| 819 | |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 820 | /* tdls is in progress */ |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 821 | currPeer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, TRUE); |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 822 | if (NULL != currPeer) |
| 823 | { |
| 824 | wlan_hdd_tdls_set_peer_link_status (currPeer, |
| 825 | eTDLS_LINK_IDLE, |
| 826 | eTDLS_LINK_UNSPECIFIED); |
| 827 | } |
| 828 | |
| 829 | /* while tdls is up */ |
| 830 | if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode || |
| 831 | eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode) |
| 832 | { |
| 833 | connectedTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 834 | /* disable implicit trigger logic & tdls operatoin */ |
| 835 | wlan_hdd_tdls_set_mode(pHddCtx, eTDLS_SUPPORT_DISABLED, FALSE); |
| 836 | pHddCtx->is_tdls_btc_enabled = FALSE; |
| 837 | |
| 838 | /* teardown the peers on the btcoex */ |
| 839 | if (connectedTdlsPeers) |
| 840 | { |
| 841 | tANI_U8 staIdx; |
| 842 | hddTdlsPeer_t *curr_peer; |
| 843 | |
| 844 | for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
| 845 | { |
| 846 | if (pHddCtx->tdlsConnInfo[staIdx].staId) |
| 847 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 848 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 849 | ("%s: indicate TDLS teardown (staId %d)"), |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 850 | __func__,pHddCtx->tdlsConnInfo[staIdx].staId); |
| 851 | |
| 852 | #ifdef CONFIG_TDLS_IMPLICIT |
| 853 | curr_peer = wlan_hdd_tdls_find_all_peer(pHddCtx, |
| 854 | pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes); |
| 855 | if(curr_peer) { |
| 856 | wlan_hdd_tdls_indicate_teardown( |
| 857 | curr_peer->pHddTdlsCtx->pAdapter, curr_peer, |
| 858 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 859 | } |
| 860 | #endif |
| 861 | } |
| 862 | } |
| 863 | } |
| 864 | } |
| 865 | } |
| 866 | /* BtCoex notification type enabled, Enable TDLS */ |
| 867 | else if (indType == SIR_COEX_IND_TYPE_TDLS_ENABLE) |
| 868 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 869 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 870 | FL("BtCoex notification, Enable TDLS")); |
| 871 | /* if tdls was enabled before btCoex, re-enable tdls mode */ |
| 872 | if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode_last || |
| 873 | eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode_last) |
| 874 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 875 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 876 | ("%s: revert tdls mode %d"), __func__, |
| 877 | pHddCtx->tdls_mode_last); |
| 878 | pHddCtx->is_tdls_btc_enabled = TRUE; |
| 879 | wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last, FALSE); |
| 880 | } |
| 881 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 882 | EXIT(); |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 883 | return; |
| 884 | } |
| 885 | |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 886 | /* initialize TDLS global context */ |
| 887 | void wlan_hdd_tdls_init(hdd_context_t *pHddCtx ) |
| 888 | { |
| 889 | v_U8_t staIdx; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 890 | eHalStatus status; |
Sameer Thalappil | bee426e | 2013-10-30 10:30:30 -0700 | [diff] [blame] | 891 | |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 892 | pHddCtx->connected_peer_count = 0; |
| 893 | |
| 894 | pHddCtx->tdls_scan_ctxt.magic = 0; |
| 895 | pHddCtx->tdls_scan_ctxt.attempt = 0; |
| 896 | pHddCtx->tdls_scan_ctxt.reject = 0; |
| 897 | pHddCtx->tdls_scan_ctxt.scan_request = NULL; |
| 898 | |
| 899 | for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
| 900 | { |
| 901 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 902 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
| 903 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
| 904 | sizeof(v_MACADDR_t)) ; |
| 905 | } |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 906 | pHddCtx->is_tdls_btc_enabled = TRUE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 907 | status = sme_RegisterBtCoexTDLSCallback(pHddCtx->hHal, |
| 908 | wlan_hdd_tdls_btCoex_cb); |
| 909 | if (status != eHAL_STATUS_SUCCESS) { |
| 910 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to register BT Coex TDLS callback")); |
| 911 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 912 | |
| 913 | if (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) |
| 914 | { |
| 915 | pHddCtx->tdls_mode = eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY; |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 916 | hddLog(VOS_TRACE_LEVEL_INFO, "%s TDLS Implicit trigger not enabled!", __func__); |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 917 | } |
| 918 | else |
| 919 | { |
| 920 | pHddCtx->tdls_mode = eTDLS_SUPPORT_ENABLED; |
| 921 | } |
| 922 | } |
| 923 | |
| 924 | int wlan_hdd_sta_tdls_init(hdd_adapter_t *pAdapter) |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 925 | { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 926 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 927 | tdlsCtx_t *pHddTdlsCtx; |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 928 | int i; |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 929 | if (NULL == pHddCtx) |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 930 | { |
| 931 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s pHddCtx is NULL", __func__); |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 932 | return -EINVAL; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 933 | } |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 934 | |
Mahesh A Saptasagar | f5b8eff | 2015-01-31 01:07:07 +0530 | [diff] [blame] | 935 | if (test_bit(TDLS_INIT_DONE, &pAdapter->event_flags)) |
| 936 | { |
| 937 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 938 | "%s: TDLS INIT DONE set to 1, no point in re-init", __func__); |
| 939 | return -EALREADY; |
Mahesh A Saptasagar | f5b8eff | 2015-01-31 01:07:07 +0530 | [diff] [blame] | 940 | } |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 941 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 942 | if ((FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport) || |
| 943 | (FALSE == sme_IsFeatureSupportedByFW(TDLS))) |
| 944 | { |
| 945 | pHddCtx->tdls_mode = eTDLS_SUPPORT_NOT_ENABLED; |
| 946 | pAdapter->sessionCtx.station.pHddTdlsCtx = NULL; |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 947 | hddLog(VOS_TRACE_LEVEL_INFO, "%s TDLS not enabled (%d) or FW doesn't support (%d)!", |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 948 | __func__, pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 949 | sme_IsFeatureSupportedByFW(TDLS)); |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 950 | return -EINVAL; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 951 | } |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 952 | /* TDLS is supported only in STA / P2P Client modes, |
| 953 | * hence the check for TDLS support in a specific Device mode. |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 954 | */ |
| 955 | if (0 == WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter)) |
| 956 | { |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 957 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s TDLS is not supported in mode : %d", __func__, pAdapter->device_mode); |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 958 | return -EINVAL; |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 959 | } |
| 960 | /* Check for the valid pHddTdlsCtx. If valid do not further |
| 961 | * allocate the memory, rather continue with the initialization. |
| 962 | * If tdls_initialization would get reinvoked without tdls_exit |
| 963 | * getting invoked (SSR) there is no point to further proceed |
| 964 | * with the memory allocations. |
| 965 | */ |
| 966 | if (NULL == pAdapter->sessionCtx.station.pHddTdlsCtx) |
| 967 | { |
| 968 | pHddTdlsCtx = vos_mem_malloc(sizeof(tdlsCtx_t)); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 969 | |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 970 | if (NULL == pHddTdlsCtx) { |
| 971 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s malloc failed!", __func__); |
| 972 | pAdapter->sessionCtx.station.pHddTdlsCtx = NULL; |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 973 | return -ENOMEM; |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 974 | } |
| 975 | /* initialize TDLS pAdater context */ |
| 976 | vos_mem_zero(pHddTdlsCtx, sizeof(tdlsCtx_t)); |
| 977 | #ifdef TDLS_USE_SEPARATE_DISCOVERY_TIMER |
| 978 | vos_timer_init(&pHddTdlsCtx->peerDiscoverTimer, |
| 979 | VOS_TIMER_TYPE_SW, |
| 980 | wlan_hdd_tdls_discover_peer_cb, |
| 981 | pHddTdlsCtx); |
| 982 | #endif |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 983 | |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 984 | vos_timer_init(&pHddTdlsCtx->peerUpdateTimer, |
| 985 | VOS_TIMER_TYPE_SW, |
| 986 | wlan_hdd_tdls_update_peer_cb, |
| 987 | pHddTdlsCtx); |
| 988 | vos_timer_init(&pHddTdlsCtx->peerDiscoveryTimeoutTimer, |
| 989 | VOS_TIMER_TYPE_SW, |
| 990 | wlan_hdd_tdls_discovery_timeout_peer_cb, |
| 991 | pHddTdlsCtx); |
| 992 | |
| 993 | pAdapter->sessionCtx.station.pHddTdlsCtx = pHddTdlsCtx; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 994 | } |
| 995 | |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 996 | pHddTdlsCtx = pAdapter->sessionCtx.station.pHddTdlsCtx; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 997 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 998 | sme_SetTdlsPowerSaveProhibited(WLAN_HDD_GET_HAL_CTX(pAdapter), 0); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 999 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1000 | pHddTdlsCtx->pAdapter = pAdapter; |
| 1001 | |
| 1002 | for (i = 0; i < 256; i++) |
| 1003 | { |
| 1004 | INIT_LIST_HEAD(&pHddTdlsCtx->peer_list[i]); |
| 1005 | } |
| 1006 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 1007 | pHddTdlsCtx->curr_candidate = NULL; |
| 1008 | pHddTdlsCtx->magic = 0; |
| 1009 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1010 | /* remember configuration even if it is not used right now. it could be used later */ |
| 1011 | pHddTdlsCtx->threshold_config.tx_period_t = pHddCtx->cfg_ini->fTDLSTxStatsPeriod; |
| 1012 | pHddTdlsCtx->threshold_config.tx_packet_n = pHddCtx->cfg_ini->fTDLSTxPacketThreshold; |
| 1013 | pHddTdlsCtx->threshold_config.discovery_period_t = pHddCtx->cfg_ini->fTDLSDiscoveryPeriod; |
| 1014 | pHddTdlsCtx->threshold_config.discovery_tries_n = pHddCtx->cfg_ini->fTDLSMaxDiscoveryAttempt; |
| 1015 | pHddTdlsCtx->threshold_config.idle_timeout_t = pHddCtx->cfg_ini->fTDLSIdleTimeout; |
| 1016 | pHddTdlsCtx->threshold_config.idle_packet_n = pHddCtx->cfg_ini->fTDLSIdlePacketThreshold; |
| 1017 | pHddTdlsCtx->threshold_config.rssi_hysteresis = pHddCtx->cfg_ini->fTDLSRSSIHysteresis; |
| 1018 | pHddTdlsCtx->threshold_config.rssi_trigger_threshold = pHddCtx->cfg_ini->fTDLSRSSITriggerThreshold; |
| 1019 | pHddTdlsCtx->threshold_config.rssi_teardown_threshold = pHddCtx->cfg_ini->fTDLSRSSITeardownThreshold; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1020 | |
Anand N Sunkad | dc63c79 | 2015-06-03 14:33:24 +0530 | [diff] [blame] | 1021 | vos_init_delayed_work(&pHddCtx->tdls_scan_ctxt.tdls_scan_work, |
| 1022 | wlan_hdd_tdls_schedule_scan); |
| 1023 | set_bit(TDLS_INIT_DONE, &pAdapter->event_flags); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1024 | |
| 1025 | return 0; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1026 | } |
| 1027 | |
Pradeep Reddy POTTETI | 2d4d5c4 | 2015-03-03 14:34:19 +0530 | [diff] [blame] | 1028 | void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter, tANI_BOOLEAN mutexLock) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1029 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1030 | tdlsCtx_t *pHddTdlsCtx; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 1031 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1032 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 1033 | if (!pAdapter) { |
| 1034 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 1035 | return; |
| 1036 | } |
| 1037 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1038 | /* |
| 1039 | * NOTE: The Callers of this function should ensure to acquire the |
Mahesh A Saptasagar | f5b8eff | 2015-01-31 01:07:07 +0530 | [diff] [blame] | 1040 | * tdls_lock to avoid any concurrent access to the Adapter and logp |
| 1041 | * protection has to be ensured. |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1042 | */ |
| 1043 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1044 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
Agarwal Ashish | 9ffa5b9 | 2014-11-18 21:07:02 +0530 | [diff] [blame] | 1045 | |
| 1046 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1047 | { |
Agarwal Ashish | 9ffa5b9 | 2014-11-18 21:07:02 +0530 | [diff] [blame] | 1048 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1049 | "%s: HDD context is Null", __func__); |
| 1050 | return ; |
| 1051 | } |
Mahesh A Saptasagar | f5b8eff | 2015-01-31 01:07:07 +0530 | [diff] [blame] | 1052 | if (!test_bit(TDLS_INIT_DONE, &pAdapter->event_flags)) |
Agarwal Ashish | 9ffa5b9 | 2014-11-18 21:07:02 +0530 | [diff] [blame] | 1053 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 1054 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Mahesh A Saptasagar | f5b8eff | 2015-01-31 01:07:07 +0530 | [diff] [blame] | 1055 | "%s: TDLS INIT DONE set to 0, no point in exit", __func__); |
| 1056 | return; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1057 | } |
Mahesh A Saptasagar | f5b8eff | 2015-01-31 01:07:07 +0530 | [diff] [blame] | 1058 | clear_bit(TDLS_INIT_DONE, &pAdapter->event_flags); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1059 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1060 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1061 | if (NULL == pHddTdlsCtx) |
| 1062 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 1063 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1064 | FL("pHddTdlsCtx is NULL")); |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 1065 | return; |
| 1066 | } |
Mahesh A Saptasagar | f5b8eff | 2015-01-31 01:07:07 +0530 | [diff] [blame] | 1067 | |
Anand N Sunkad | 860e5ea | 2015-03-30 14:41:51 +0530 | [diff] [blame] | 1068 | vos_flush_delayed_work(&pHddCtx->tdls_scan_ctxt.tdls_scan_work); |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 1069 | |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1070 | /* must stop timer here before freeing peer list, because peerIdleTimer is |
| 1071 | part of peer list structure. */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1072 | wlan_hdd_tdls_timers_destroy(pHddTdlsCtx); |
| 1073 | wlan_hdd_tdls_free_list(pHddTdlsCtx); |
Chilam Ng | a75d8b6 | 2013-01-29 01:35:59 -0800 | [diff] [blame] | 1074 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 1075 | wlan_hdd_tdls_free_scan_request(&pHddCtx->tdls_scan_ctxt); |
Sushant Kaushik | 15c4c52 | 2014-08-14 12:24:49 +0530 | [diff] [blame] | 1076 | pHddTdlsCtx->magic = 0; |
| 1077 | pHddTdlsCtx->pAdapter = NULL; |
Chilam Ng | a75d8b6 | 2013-01-29 01:35:59 -0800 | [diff] [blame] | 1078 | vos_mem_free(pHddTdlsCtx); |
Pradeep Reddy POTTETI | 59c90d6 | 2014-03-24 19:45:47 +0530 | [diff] [blame] | 1079 | pAdapter->sessionCtx.station.pHddTdlsCtx = NULL; |
Chilam Ng | a75d8b6 | 2013-01-29 01:35:59 -0800 | [diff] [blame] | 1080 | pHddTdlsCtx = NULL; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1081 | } |
| 1082 | |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 1083 | /* stop all monitoring timers per Adapter */ |
| 1084 | static void wlan_hdd_tdls_monitor_timers_stop(tdlsCtx_t *pHddTdlsCtx) |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1085 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 1086 | #ifdef TDLS_USE_SEPARATE_DISCOVERY_TIMER |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1087 | vos_timer_stop(&pHddTdlsCtx->peerDiscoverTimer); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 1088 | #endif |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1089 | vos_timer_stop(&pHddTdlsCtx->peerUpdateTimer); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1090 | vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer); |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 1091 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1092 | |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 1093 | /* stop all per peer timers */ |
| 1094 | static void wlan_hdd_tdls_peer_timers_stop(tdlsCtx_t *pHddTdlsCtx) |
| 1095 | { |
| 1096 | int i; |
| 1097 | struct list_head *head; |
| 1098 | struct list_head *pos; |
| 1099 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1100 | for (i = 0; i < 256; i++) |
| 1101 | { |
| 1102 | head = &pHddTdlsCtx->peer_list[i]; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1103 | list_for_each (pos, head) { |
| 1104 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 1105 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1106 | "%s: " MAC_ADDRESS_STR " -> stop idle timer", |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1107 | __func__, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1108 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1109 | vos_timer_stop ( &curr_peer->peerIdleTimer ); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 1110 | vos_timer_stop( &curr_peer->initiatorWaitTimeoutTimer ); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1111 | } |
| 1112 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1113 | } |
| 1114 | |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 1115 | /* stop all the tdls timers running */ |
| 1116 | static void wlan_hdd_tdls_timers_stop(tdlsCtx_t *pHddTdlsCtx) |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1117 | { |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 1118 | wlan_hdd_tdls_monitor_timers_stop(pHddTdlsCtx); |
| 1119 | wlan_hdd_tdls_peer_timers_stop(pHddTdlsCtx); |
| 1120 | } |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1121 | |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 1122 | static void wlan_hdd_tdls_monitor_timers_destroy(tdlsCtx_t *pHddTdlsCtx) |
| 1123 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 1124 | #ifdef TDLS_USE_SEPARATE_DISCOVERY_TIMER |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1125 | vos_timer_stop(&pHddTdlsCtx->peerDiscoverTimer); |
| 1126 | vos_timer_destroy(&pHddTdlsCtx->peerDiscoverTimer); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 1127 | #endif |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1128 | vos_timer_stop(&pHddTdlsCtx->peerUpdateTimer); |
| 1129 | vos_timer_destroy(&pHddTdlsCtx->peerUpdateTimer); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1130 | vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer); |
| 1131 | vos_timer_destroy(&pHddTdlsCtx->peerDiscoveryTimeoutTimer); |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 1132 | } |
| 1133 | /*Free all the timers related to the TDLS peer */ |
| 1134 | static void wlan_hdd_tdls_peer_timers_destroy(tdlsCtx_t *pHddTdlsCtx) |
| 1135 | { |
| 1136 | int i; |
| 1137 | struct list_head *head; |
| 1138 | struct list_head *pos; |
| 1139 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1140 | for (i = 0; i < 256; i++) |
| 1141 | { |
| 1142 | head = &pHddTdlsCtx->peer_list[i]; |
| 1143 | |
| 1144 | list_for_each (pos, head) { |
| 1145 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
| 1146 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 1147 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1148 | "%s: " MAC_ADDRESS_STR " -> destroy idle timer", |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1149 | __func__, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1150 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1151 | vos_timer_stop ( &curr_peer->peerIdleTimer ); |
| 1152 | vos_timer_destroy ( &curr_peer->peerIdleTimer ); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 1153 | vos_timer_stop(&curr_peer->initiatorWaitTimeoutTimer); |
| 1154 | vos_timer_destroy(&curr_peer->initiatorWaitTimeoutTimer); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1155 | } |
| 1156 | } |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 1157 | |
| 1158 | } |
| 1159 | |
| 1160 | /* destroy all the tdls timers running */ |
| 1161 | static void wlan_hdd_tdls_timers_destroy(tdlsCtx_t *pHddTdlsCtx) |
| 1162 | { |
| 1163 | wlan_hdd_tdls_monitor_timers_destroy(pHddTdlsCtx); |
| 1164 | wlan_hdd_tdls_peer_timers_destroy(pHddTdlsCtx); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1165 | } |
| 1166 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1167 | /* if mac address exist, return pointer |
| 1168 | if mac address doesn't exist, create a list and add, return pointer |
| 1169 | return NULL if fails to get new mac address |
| 1170 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 1171 | hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter, |
| 1172 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1173 | const u8 *mac |
| 1174 | #else |
| 1175 | u8 *mac |
| 1176 | #endif |
| 1177 | ) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1178 | { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1179 | struct list_head *head; |
| 1180 | hddTdlsPeer_t *peer; |
| 1181 | u8 key; |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 1182 | tdlsCtx_t *pHddTdlsCtx; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 1183 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1184 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 1185 | |
| 1186 | if (!pAdapter) { |
| 1187 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 1188 | return NULL; |
| 1189 | } |
| 1190 | |
| 1191 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1192 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1193 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1194 | return 0; |
| 1195 | } |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 1196 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1197 | /* if already there, just update */ |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1198 | peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1199 | if (peer != NULL) |
| 1200 | { |
| 1201 | return peer; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1202 | } |
| 1203 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1204 | /* not found, allocate and add the list */ |
| 1205 | peer = vos_mem_malloc(sizeof(hddTdlsPeer_t)); |
| 1206 | if (NULL == peer) { |
| 1207 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s peer malloc failed!", __func__); |
| 1208 | return NULL; |
| 1209 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1210 | |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 1211 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 1212 | |
| 1213 | if (NULL == pHddTdlsCtx) |
| 1214 | { |
| 1215 | vos_mem_free(peer); |
Hema Aparna Medicharla | 8bb6f78 | 2015-03-09 12:35:05 +0530 | [diff] [blame] | 1216 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1217 | FL("pHddTdlsCtx is NULL")); |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 1218 | return NULL; |
| 1219 | } |
| 1220 | |
| 1221 | key = wlan_hdd_tdls_hash_key(mac); |
| 1222 | head = &pHddTdlsCtx->peer_list[key]; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1223 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1224 | vos_mem_zero(peer, sizeof(hddTdlsPeer_t)); |
| 1225 | vos_mem_copy(peer->peerMac, mac, sizeof(peer->peerMac)); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1226 | peer->pHddTdlsCtx = pHddTdlsCtx; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1227 | |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1228 | vos_timer_init(&peer->peerIdleTimer, |
| 1229 | VOS_TIMER_TYPE_SW, |
| 1230 | wlan_hdd_tdls_idle_cb, |
| 1231 | peer); |
| 1232 | |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 1233 | vos_timer_init(&peer->initiatorWaitTimeoutTimer, |
| 1234 | VOS_TIMER_TYPE_SW, |
| 1235 | wlan_hdd_tdls_initiator_wait_cb, |
| 1236 | peer); |
| 1237 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1238 | list_add_tail(&peer->node, head); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1239 | |
| 1240 | return peer; |
| 1241 | } |
| 1242 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1243 | int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1244 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1245 | const u8* mac, |
| 1246 | #else |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1247 | u8* mac, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1248 | #endif |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1249 | tTDLSCapType cap) |
| 1250 | { |
| 1251 | hddTdlsPeer_t *curr_peer; |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1252 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1253 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1254 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1255 | return -EINVAL; |
| 1256 | |
| 1257 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1258 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1259 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1260 | { |
| 1261 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1262 | "%s: curr_peer is NULL", __func__); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1263 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1264 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1265 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1266 | |
| 1267 | curr_peer->tdls_support = cap; |
| 1268 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1269 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1270 | return 0; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1271 | } |
| 1272 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 1273 | void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer, |
| 1274 | tTDLSLinkStatus status, |
| 1275 | tTDLSLinkReason reason) |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1276 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 1277 | /*EXT TDLS*/ |
| 1278 | tANI_S32 state = 0; |
| 1279 | tANI_S32 res = 0; |
| 1280 | /*EXT TDLS*/ |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1281 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1282 | { |
| 1283 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1284 | "%s: curr_peer is NULL", __func__); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1285 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1286 | } |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1287 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1288 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls set peer " MAC_ADDRESS_STR " link status to %u", |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1289 | MAC_ADDR_ARRAY(curr_peer->peerMac), status); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1290 | |
| 1291 | curr_peer->link_status = status; |
| 1292 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 1293 | /*EXT TDLS*/ |
| 1294 | if (curr_peer->isForcedPeer && curr_peer->state_change_notification) |
| 1295 | { |
| 1296 | /*save the reason for any further query*/ |
| 1297 | curr_peer->reason = reason; |
| 1298 | wlan_hdd_tdls_get_wifi_hal_state(curr_peer, &state, &res); |
| 1299 | |
| 1300 | (curr_peer->state_change_notification)( |
| 1301 | curr_peer->peerMac, |
| 1302 | state, |
| 1303 | res, |
| 1304 | curr_peer->pHddTdlsCtx->pAdapter); |
| 1305 | |
| 1306 | } |
| 1307 | /*EXT TDLS*/ |
| 1308 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1309 | } |
| 1310 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1311 | void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 1312 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1313 | const u8 *mac, |
| 1314 | #else |
| 1315 | u8 *mac, |
| 1316 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 1317 | tTDLSLinkStatus linkStatus, |
| 1318 | tTDLSLinkReason reason) |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1319 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 1320 | |
| 1321 | /*EXT TDLS*/ |
| 1322 | tANI_S32 state = 0; |
| 1323 | tANI_S32 res = 0; |
| 1324 | /*EXT TDLS*/ |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1325 | hddTdlsPeer_t *curr_peer; |
| 1326 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1327 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1328 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1329 | { |
| 1330 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1331 | "%s: curr_peer is NULL", __func__); |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1332 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1333 | } |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1334 | |
| 1335 | curr_peer->link_status= linkStatus; |
| 1336 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 1337 | /*EXT TDLS*/ |
| 1338 | |
| 1339 | if (curr_peer->isForcedPeer && curr_peer->state_change_notification) |
| 1340 | { |
| 1341 | /*save the reason for any further query*/ |
| 1342 | curr_peer->reason = reason; |
| 1343 | wlan_hdd_tdls_get_wifi_hal_state(curr_peer, &state, &res); |
| 1344 | |
| 1345 | (*curr_peer->state_change_notification)(mac, |
| 1346 | state, |
| 1347 | res, |
| 1348 | curr_peer->pHddTdlsCtx->pAdapter); |
| 1349 | |
| 1350 | } |
| 1351 | /*EXT TDLS*/ |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1352 | return; |
| 1353 | } |
| 1354 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1355 | int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter, u8 *mac) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1356 | { |
| 1357 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1358 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1359 | hdd_context_t *pHddCtx; |
| 1360 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1361 | ENTER(); |
| 1362 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1363 | if ( NULL == pHddTdlsCtx ) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1364 | { |
| 1365 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 1366 | FL("pHddTdlsCtx is NULL device mode = %d"), pAdapter->device_mode); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1367 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1368 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1369 | |
| 1370 | pHddCtx = WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter); |
| 1371 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1372 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1373 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1374 | return 0; |
| 1375 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1376 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1377 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1378 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1379 | |
| 1380 | if (NULL == curr_peer) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1381 | { |
| 1382 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1383 | FL("curr_peer is NULL")); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1384 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1385 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1386 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1387 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1388 | |
| 1389 | if (pHddTdlsCtx->discovery_sent_cnt) |
| 1390 | pHddTdlsCtx->discovery_sent_cnt--; |
| 1391 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 1392 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1393 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1394 | wlan_hdd_tdls_check_power_save_prohibited(pAdapter); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1395 | |
| 1396 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1397 | if (0 == pHddTdlsCtx->discovery_sent_cnt) |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1398 | { |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1399 | vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1400 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1401 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 1402 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1403 | "Discovery(%u) Response from " MAC_ADDRESS_STR " link_status %d", |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1404 | pHddTdlsCtx->discovery_sent_cnt, MAC_ADDR_ARRAY(curr_peer->peerMac), |
| 1405 | curr_peer->link_status); |
| 1406 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1407 | if (eTDLS_LINK_DISCOVERING == curr_peer->link_status) |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 1408 | { |
Shailender Karmuchi | 13c0d08 | 2013-03-26 14:41:39 -0700 | [diff] [blame] | 1409 | /* Since we are here, it means Throughput threshold is alredy met. Make sure RSSI |
| 1410 | threshold is also met before setting up TDLS link*/ |
| 1411 | if ((tANI_S32) curr_peer->rssi > (tANI_S32) pHddTdlsCtx->threshold_config.rssi_trigger_threshold) |
| 1412 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 1413 | wlan_hdd_tdls_set_peer_link_status(curr_peer, |
| 1414 | eTDLS_LINK_DISCOVERED, |
| 1415 | eTDLS_LINK_SUCCESS); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 1416 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Shailender Karmuchi | 13c0d08 | 2013-03-26 14:41:39 -0700 | [diff] [blame] | 1417 | "Rssi Threshold met: "MAC_ADDRESS_STR" rssi = %d threshold= %d" , |
| 1418 | MAC_ADDR_ARRAY(curr_peer->peerMac), curr_peer->rssi, |
| 1419 | pHddTdlsCtx->threshold_config.rssi_trigger_threshold); |
| 1420 | cfg80211_tdls_oper_request(pAdapter->dev, curr_peer->peerMac, NL80211_TDLS_SETUP, FALSE, GFP_KERNEL); |
| 1421 | } |
| 1422 | else |
| 1423 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 1424 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Shailender Karmuchi | 13c0d08 | 2013-03-26 14:41:39 -0700 | [diff] [blame] | 1425 | "Rssi Threshold not met: "MAC_ADDRESS_STR" rssi = %d threshold = %d ", |
| 1426 | MAC_ADDR_ARRAY(curr_peer->peerMac), curr_peer->rssi, |
| 1427 | pHddTdlsCtx->threshold_config.rssi_trigger_threshold); |
Sunil Dutt | b0d3924 | 2014-09-10 23:54:51 +0530 | [diff] [blame] | 1428 | |
| 1429 | /* if RSSI threshold is not met then allow further discovery |
| 1430 | * attempts by decrementing count for the last attempt |
| 1431 | */ |
| 1432 | if (curr_peer->discovery_attempt) |
| 1433 | curr_peer->discovery_attempt--; |
| 1434 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 1435 | wlan_hdd_tdls_set_peer_link_status(curr_peer, |
| 1436 | eTDLS_LINK_IDLE, |
| 1437 | eTDLS_LINK_UNSPECIFIED); |
Shailender Karmuchi | 13c0d08 | 2013-03-26 14:41:39 -0700 | [diff] [blame] | 1438 | } |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 1439 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1440 | else |
| 1441 | { |
| 1442 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 1443 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1444 | |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 1445 | curr_peer->tdls_support = eTDLS_CAP_SUPPORTED; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1446 | EXIT(); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1447 | return 0; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1448 | } |
| 1449 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1450 | int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 1451 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1452 | const u8 *mac, |
| 1453 | #else |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1454 | u8 *mac, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 1455 | #endif |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 1456 | tCsrStaParams *StaParams, |
| 1457 | tANI_BOOLEAN isBufSta, |
| 1458 | tANI_BOOLEAN isOffChannelSupported) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1459 | { |
| 1460 | hddTdlsPeer_t *curr_peer; |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1461 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1462 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1463 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1464 | return -EINVAL; |
| 1465 | |
| 1466 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1467 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
| 1468 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1469 | { |
| 1470 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1471 | "%s: curr_peer is NULL", __func__); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1472 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1473 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1474 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1475 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 1476 | curr_peer->uapsdQueues = StaParams->uapsd_queues; |
| 1477 | curr_peer->maxSp = StaParams->max_sp; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1478 | curr_peer->isBufSta = isBufSta; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 1479 | curr_peer->isOffChannelSupported = isOffChannelSupported; |
| 1480 | |
| 1481 | vos_mem_copy(curr_peer->supported_channels, |
| 1482 | StaParams->supported_channels, |
| 1483 | StaParams->supported_channels_len); |
| 1484 | |
| 1485 | curr_peer->supported_channels_len = |
| 1486 | StaParams->supported_channels_len; |
| 1487 | |
| 1488 | vos_mem_copy(curr_peer->supported_oper_classes, |
| 1489 | StaParams->supported_oper_classes, |
| 1490 | StaParams->supported_oper_classes_len); |
| 1491 | |
| 1492 | curr_peer->supported_oper_classes_len = |
| 1493 | StaParams->supported_oper_classes_len; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 1494 | curr_peer->qos = StaParams->capability & CAPABILITIES_QOS_OFFSET; |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1495 | |
| 1496 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1497 | return 0; |
| 1498 | } |
| 1499 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1500 | int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter, |
| 1501 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1502 | const u8 *mac, |
| 1503 | #else |
| 1504 | u8 *mac, |
| 1505 | #endif |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1506 | tCsrTdlsLinkEstablishParams* tdlsLinkEstablishParams) |
| 1507 | { |
| 1508 | hddTdlsPeer_t *curr_peer; |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1509 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1510 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1511 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1512 | return -EINVAL; |
| 1513 | |
| 1514 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1515 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
| 1516 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1517 | { |
| 1518 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1519 | "%s: curr_peer is NULL", __func__); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1520 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1521 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1522 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1523 | |
| 1524 | tdlsLinkEstablishParams->isResponder = curr_peer->is_responder; |
| 1525 | tdlsLinkEstablishParams->uapsdQueues = curr_peer->uapsdQueues; |
| 1526 | tdlsLinkEstablishParams->maxSp = curr_peer->maxSp; |
| 1527 | tdlsLinkEstablishParams->isBufSta = curr_peer->isBufSta; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 1528 | tdlsLinkEstablishParams->isOffChannelSupported = |
| 1529 | curr_peer->isOffChannelSupported; |
| 1530 | |
| 1531 | vos_mem_copy(tdlsLinkEstablishParams->supportedChannels, |
| 1532 | curr_peer->supported_channels, |
| 1533 | curr_peer->supported_channels_len); |
| 1534 | |
| 1535 | tdlsLinkEstablishParams->supportedChannelsLen = |
| 1536 | curr_peer->supported_channels_len; |
| 1537 | |
| 1538 | vos_mem_copy(tdlsLinkEstablishParams->supportedOperClasses, |
| 1539 | curr_peer->supported_oper_classes, |
| 1540 | curr_peer->supported_oper_classes_len); |
| 1541 | |
| 1542 | tdlsLinkEstablishParams->supportedOperClassesLen = |
| 1543 | curr_peer->supported_oper_classes_len; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 1544 | tdlsLinkEstablishParams->qos = curr_peer->qos; |
| 1545 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1546 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1547 | return 0; |
| 1548 | } |
| 1549 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1550 | int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, |
| 1551 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1552 | const u8 *mac, |
| 1553 | #else |
| 1554 | u8 *mac, |
| 1555 | #endif |
| 1556 | tANI_S8 rxRssi) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1557 | { |
| 1558 | hddTdlsPeer_t *curr_peer; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1559 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1560 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1561 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1562 | { |
| 1563 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1564 | "%s: curr_peer is NULL", __func__); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1565 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1566 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1567 | |
| 1568 | curr_peer->rssi = rxRssi; |
| 1569 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1570 | return 0; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1571 | } |
| 1572 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1573 | int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, |
| 1574 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1575 | const u8 *mac, |
| 1576 | #else |
| 1577 | u8 *mac, |
| 1578 | #endif |
| 1579 | tANI_U8 responder) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1580 | { |
| 1581 | hddTdlsPeer_t *curr_peer; |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1582 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1583 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1584 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1585 | return -EINVAL; |
| 1586 | |
| 1587 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1588 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1589 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1590 | { |
| 1591 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1592 | "%s: curr_peer is NULL", __func__); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1593 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1594 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1595 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1596 | |
| 1597 | curr_peer->is_responder = responder; |
| 1598 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1599 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1600 | return 0; |
| 1601 | } |
| 1602 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1603 | int wlan_hdd_tdls_get_responder(hdd_adapter_t *pAdapter, u8 *mac) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1604 | { |
| 1605 | hddTdlsPeer_t *curr_peer; |
| 1606 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1607 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1608 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1609 | { |
| 1610 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1611 | "%s: curr_peer is NULL", __func__); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1612 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1613 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1614 | |
| 1615 | return (curr_peer->is_responder); |
| 1616 | } |
| 1617 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1618 | int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, |
| 1619 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1620 | const u8 *mac, |
| 1621 | #else |
| 1622 | u8 *mac, |
| 1623 | #endif |
| 1624 | tANI_U8 uSignature) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1625 | { |
| 1626 | hddTdlsPeer_t *curr_peer; |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1627 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1628 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1629 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1630 | return -EINVAL; |
| 1631 | |
| 1632 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1633 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1634 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1635 | { |
| 1636 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1637 | "%s: curr_peer is NULL", __func__); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1638 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1639 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1640 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1641 | |
| 1642 | curr_peer->signature = uSignature; |
| 1643 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1644 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1645 | return 0; |
| 1646 | } |
| 1647 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1648 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1649 | void wlan_hdd_tdls_extract_da(struct sk_buff *skb, u8 *mac) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1650 | { |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1651 | memcpy(mac, skb->data, 6); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1652 | } |
| 1653 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1654 | void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, u8 *mac) |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 1655 | { |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 1656 | memcpy(mac, skb->data+6, 6); |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 1657 | } |
| 1658 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1659 | int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter, |
| 1660 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1661 | const u8 *mac, |
| 1662 | #else |
| 1663 | u8 *mac, |
| 1664 | #endif |
| 1665 | u8 tx) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1666 | { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1667 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1668 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1669 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1670 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1671 | return -EINVAL; |
| 1672 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1673 | if (eTDLS_SUPPORT_ENABLED != pHddCtx->tdls_mode) |
| 1674 | return -1; |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 1675 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1676 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1677 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1678 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1679 | { |
c_hpothu | e21931b | 2014-09-08 14:02:14 +0530 | [diff] [blame] | 1680 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1681 | FL("curr_peer is NULL")); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1682 | mutex_unlock(&pHddCtx->tdls_lock); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1683 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1684 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1685 | |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 1686 | if (tx) |
| 1687 | curr_peer->tx_pkt++; |
| 1688 | else |
| 1689 | curr_peer->rx_pkt++; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1690 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1691 | mutex_unlock(&pHddCtx->tdls_lock); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1692 | return 0; |
| 1693 | } |
| 1694 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1695 | static int wlan_hdd_tdls_check_config(tdls_config_params_t *config) |
| 1696 | { |
| 1697 | if (config->tdls > 2) |
| 1698 | { |
| 1699 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 1st argument %d. <0...2>", __func__, config->tdls); |
| 1700 | return -1; |
| 1701 | } |
| 1702 | if (config->tx_period_t < CFG_TDLS_TX_STATS_PERIOD_MIN || |
| 1703 | config->tx_period_t > CFG_TDLS_TX_STATS_PERIOD_MAX) |
| 1704 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1705 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 2nd argument %d. <%d...%ld>", __func__, config->tx_period_t, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1706 | CFG_TDLS_TX_STATS_PERIOD_MIN, CFG_TDLS_TX_STATS_PERIOD_MAX); |
| 1707 | return -1; |
| 1708 | } |
| 1709 | if (config->tx_packet_n < CFG_TDLS_TX_PACKET_THRESHOLD_MIN || |
| 1710 | config->tx_packet_n > CFG_TDLS_TX_PACKET_THRESHOLD_MAX) |
| 1711 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1712 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 3rd argument %d. <%d...%ld>", __func__, config->tx_packet_n, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1713 | CFG_TDLS_TX_PACKET_THRESHOLD_MIN, CFG_TDLS_TX_PACKET_THRESHOLD_MAX); |
| 1714 | return -1; |
| 1715 | } |
| 1716 | if (config->discovery_period_t < CFG_TDLS_DISCOVERY_PERIOD_MIN || |
| 1717 | config->discovery_period_t > CFG_TDLS_DISCOVERY_PERIOD_MAX) |
| 1718 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1719 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 4th argument %d. <%d...%ld>", __func__, config->discovery_period_t, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1720 | CFG_TDLS_DISCOVERY_PERIOD_MIN, CFG_TDLS_DISCOVERY_PERIOD_MAX); |
| 1721 | return -1; |
| 1722 | } |
| 1723 | if (config->discovery_tries_n < CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN || |
| 1724 | config->discovery_tries_n > CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MAX) |
| 1725 | { |
| 1726 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 5th argument %d. <%d...%d>", __func__, config->discovery_tries_n, |
| 1727 | CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN, CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MAX); |
| 1728 | return -1; |
| 1729 | } |
| 1730 | if (config->idle_timeout_t < CFG_TDLS_IDLE_TIMEOUT_MIN || |
| 1731 | config->idle_timeout_t > CFG_TDLS_IDLE_TIMEOUT_MAX) |
| 1732 | { |
| 1733 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 6th argument %d. <%d...%d>", __func__, config->idle_timeout_t, |
| 1734 | CFG_TDLS_IDLE_TIMEOUT_MIN, CFG_TDLS_IDLE_TIMEOUT_MAX); |
| 1735 | return -1; |
| 1736 | } |
| 1737 | if (config->idle_packet_n < CFG_TDLS_IDLE_PACKET_THRESHOLD_MIN || |
| 1738 | config->idle_packet_n > CFG_TDLS_IDLE_PACKET_THRESHOLD_MAX) |
| 1739 | { |
| 1740 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 7th argument %d. <%d...%d>", __func__, config->idle_packet_n, |
| 1741 | CFG_TDLS_IDLE_PACKET_THRESHOLD_MIN, CFG_TDLS_IDLE_PACKET_THRESHOLD_MAX); |
| 1742 | return -1; |
| 1743 | } |
| 1744 | if (config->rssi_hysteresis < CFG_TDLS_RSSI_HYSTERESIS_MIN || |
| 1745 | config->rssi_hysteresis > CFG_TDLS_RSSI_HYSTERESIS_MAX) |
| 1746 | { |
| 1747 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 8th argument %d. <%d...%d>", __func__, config->rssi_hysteresis, |
| 1748 | CFG_TDLS_RSSI_HYSTERESIS_MIN, CFG_TDLS_RSSI_HYSTERESIS_MAX); |
| 1749 | return -1; |
| 1750 | } |
| 1751 | if (config->rssi_trigger_threshold < CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MIN || |
| 1752 | config->rssi_trigger_threshold > CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MAX) |
| 1753 | { |
| 1754 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 9th argument %d. <%d...%d>", __func__, config->rssi_trigger_threshold, |
| 1755 | CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MIN, CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MAX); |
| 1756 | return -1; |
| 1757 | } |
| 1758 | if (config->rssi_teardown_threshold < CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MIN || |
| 1759 | config->rssi_teardown_threshold > CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MAX) |
| 1760 | { |
| 1761 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 10th argument %d. <%d...%d>", __func__, config->rssi_teardown_threshold, |
| 1762 | CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MIN, CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MAX); |
| 1763 | return -1; |
| 1764 | } |
| 1765 | return 0; |
| 1766 | } |
| 1767 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1768 | int wlan_hdd_tdls_set_params(struct net_device *dev, tdls_config_params_t *config) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1769 | { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1770 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1771 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1772 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1773 | eTDLSSupportMode req_tdls_mode; |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 1774 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1775 | if (NULL == pHddTdlsCtx) |
| 1776 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1777 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS not enabled!")); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1778 | return -1; |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1779 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1780 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1781 | if (wlan_hdd_tdls_check_config(config) != 0) |
| 1782 | { |
| 1783 | return -1; |
| 1784 | } |
| 1785 | |
| 1786 | /* config->tdls is mapped to 0->1, 1->2, 2->3 */ |
| 1787 | req_tdls_mode = config->tdls + 1; |
| 1788 | if (pHddCtx->tdls_mode == req_tdls_mode) |
| 1789 | { |
| 1790 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s already in mode %d", __func__, config->tdls); |
| 1791 | return -1; |
| 1792 | } |
| 1793 | |
| 1794 | /* copy the configuration only when given tdls mode is implicit trigger enable */ |
| 1795 | if (eTDLS_SUPPORT_ENABLED == req_tdls_mode) |
| 1796 | { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1797 | memcpy(&pHddTdlsCtx->threshold_config, config, sizeof(tdls_config_params_t)); |
| 1798 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1799 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1800 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1801 | "iw set tdls params: %d %d %d %d %d %d %d %d %d %d", |
| 1802 | config->tdls, |
| 1803 | config->tx_period_t, |
| 1804 | config->tx_packet_n, |
| 1805 | config->discovery_period_t, |
| 1806 | config->discovery_tries_n, |
| 1807 | config->idle_timeout_t, |
| 1808 | config->idle_packet_n, |
| 1809 | config->rssi_hysteresis, |
| 1810 | config->rssi_trigger_threshold, |
| 1811 | config->rssi_teardown_threshold); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1812 | |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 1813 | wlan_hdd_tdls_set_mode(pHddCtx, req_tdls_mode, TRUE); |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1814 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1815 | return 0; |
| 1816 | } |
| 1817 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1818 | int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, |
| 1819 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1820 | const u8 *mac, |
| 1821 | #else |
| 1822 | u8 *mac, |
| 1823 | #endif |
| 1824 | u8 staId) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1825 | { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1826 | hddTdlsPeer_t *curr_peer; |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1827 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1828 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1829 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1830 | return -EINVAL; |
| 1831 | |
| 1832 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1833 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1834 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1835 | { |
| 1836 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1837 | "%s: curr_peer is NULL", __func__); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1838 | mutex_unlock(&pHddCtx->tdls_lock); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1839 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1840 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1841 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1842 | curr_peer->staId = staId; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1843 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1844 | mutex_unlock(&pHddCtx->tdls_lock); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1845 | return 0; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1846 | } |
| 1847 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1848 | int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter, |
| 1849 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1850 | const u8 *mac, |
| 1851 | #else |
| 1852 | u8 *mac, |
| 1853 | #endif |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 1854 | tANI_BOOLEAN forcePeer) |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 1855 | { |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 1856 | hddTdlsPeer_t *curr_peer; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 1857 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1858 | |
| 1859 | if ((NULL == pHddCtx)) return -1; |
| 1860 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 1861 | mutex_lock(&pHddCtx->tdls_lock); |
| 1862 | |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 1863 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
| 1864 | if (curr_peer == NULL) |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 1865 | goto error; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 1866 | curr_peer->isForcedPeer = forcePeer; |
Naresh Jayaram | ca7bc3a | 2014-02-04 23:03:04 +0530 | [diff] [blame] | 1867 | |
| 1868 | mutex_unlock(&pHddCtx->tdls_lock); |
| 1869 | return 0; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 1870 | error: |
| 1871 | mutex_unlock(&pHddCtx->tdls_lock); |
| 1872 | return -1; |
| 1873 | } |
| 1874 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1875 | /* if peerMac is found, then it returns pointer to hddTdlsPeer_t |
| 1876 | otherwise, it returns NULL |
| 1877 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 1878 | hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter, |
| 1879 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1880 | const u8 *mac, |
| 1881 | #else |
| 1882 | u8 *mac, |
| 1883 | #endif |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1884 | tANI_BOOLEAN mutexLock) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1885 | { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1886 | u8 key; |
| 1887 | struct list_head *pos; |
| 1888 | struct list_head *head; |
| 1889 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1890 | tdlsCtx_t *pHddTdlsCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1891 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1892 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1893 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1894 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1895 | return 0; |
| 1896 | } |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1897 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1898 | if ( mutexLock ) |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1899 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 1900 | mutex_lock(&pHddCtx->tdls_lock); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1901 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1902 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1903 | if (NULL == pHddTdlsCtx) |
| 1904 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1905 | if ( mutexLock ) |
| 1906 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1907 | return NULL; |
| 1908 | } |
| 1909 | |
| 1910 | key = wlan_hdd_tdls_hash_key(mac); |
| 1911 | |
| 1912 | head = &pHddTdlsCtx->peer_list[key]; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1913 | |
| 1914 | list_for_each(pos, head) { |
| 1915 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
| 1916 | if (!memcmp(mac, curr_peer->peerMac, 6)) { |
| 1917 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1918 | "findTdlsPeer: found staId %d", curr_peer->staId); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1919 | if ( mutexLock ) |
| 1920 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1921 | return curr_peer; |
| 1922 | } |
| 1923 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1924 | if ( mutexLock ) |
| 1925 | mutex_unlock(&pHddCtx->tdls_lock); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1926 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1927 | return NULL; |
| 1928 | } |
| 1929 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1930 | hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx, |
| 1931 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1932 | const u8 *mac |
| 1933 | #else |
| 1934 | u8 *mac |
| 1935 | #endif |
| 1936 | ) |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1937 | { |
| 1938 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 1939 | hdd_adapter_t *pAdapter = NULL; |
| 1940 | tdlsCtx_t *pHddTdlsCtx = NULL; |
| 1941 | hddTdlsPeer_t *curr_peer= NULL; |
| 1942 | VOS_STATUS status = 0; |
| 1943 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 1944 | mutex_lock(&pHddCtx->tdls_lock); |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1945 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 1946 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 1947 | { |
| 1948 | pAdapter = pAdapterNode->pAdapter; |
| 1949 | |
| 1950 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 1951 | if (NULL != pHddTdlsCtx) |
| 1952 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1953 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1954 | if (curr_peer) |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1955 | { |
| 1956 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1957 | return curr_peer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1958 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1959 | } |
| 1960 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 1961 | pAdapterNode = pNext; |
| 1962 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1963 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1964 | return curr_peer; |
| 1965 | } |
| 1966 | |
| 1967 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 1968 | int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, |
| 1969 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 1970 | const u8 *mac |
| 1971 | #else |
| 1972 | u8 *mac |
| 1973 | #endif |
| 1974 | ) |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1975 | { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1976 | hdd_context_t *pHddCtx; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1977 | hddTdlsPeer_t *curr_peer; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1978 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1979 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 1980 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1981 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1982 | return -EINVAL; |
| 1983 | |
| 1984 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1985 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1986 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1987 | { |
| 1988 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1989 | "%s: curr_peer is NULL", __func__); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 1990 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1991 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1992 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1993 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 1994 | wlan_hdd_tdls_set_peer_link_status(curr_peer, |
| 1995 | eTDLS_LINK_IDLE, |
| 1996 | eTDLS_LINK_UNSPECIFIED); |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 1997 | curr_peer->staId = 0; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1998 | |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 1999 | /* Throughput Monitor shall disable the split scan when |
| 2000 | * TDLS scan coexistance is disabled.At this point of time |
| 2001 | * since TDLS scan coexistance is not meeting the criteria |
| 2002 | * to be operational, explicitly make it false to enable |
| 2003 | * throughput monitor takes the control of split scan. |
| 2004 | */ |
| 2005 | if (pHddCtx->isTdlsScanCoexistence == TRUE) |
| 2006 | { |
| 2007 | pHddCtx->isTdlsScanCoexistence = FALSE; |
| 2008 | } |
| 2009 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 2010 | if(eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode) { |
Chilam Ng | a75d8b6 | 2013-01-29 01:35:59 -0800 | [diff] [blame] | 2011 | vos_timer_stop( &curr_peer->peerIdleTimer ); |
Chilam Ng | a75d8b6 | 2013-01-29 01:35:59 -0800 | [diff] [blame] | 2012 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 2013 | |
| 2014 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 2015 | return 0; |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 2016 | } |
| 2017 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 2018 | /* Caller has to take the lock before calling this function */ |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2019 | static void wlan_tdd_tdls_reset_tx_rx(tdlsCtx_t *pHddTdlsCtx) |
| 2020 | { |
| 2021 | int i; |
| 2022 | struct list_head *head; |
| 2023 | hddTdlsPeer_t *tmp; |
| 2024 | struct list_head *pos, *q; |
| 2025 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2026 | for (i = 0; i < 256; i++) { |
| 2027 | head = &pHddTdlsCtx->peer_list[i]; |
| 2028 | list_for_each_safe (pos, q, head) { |
| 2029 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
| 2030 | tmp->tx_pkt = 0; |
| 2031 | tmp->rx_pkt = 0; |
| 2032 | } |
| 2033 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2034 | |
| 2035 | return ; |
| 2036 | } |
| 2037 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 2038 | /* Caller has to take the lock before calling this function */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2039 | static tANI_S32 wlan_hdd_tdls_peer_reset_discovery_processed(tdlsCtx_t *pHddTdlsCtx) |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2040 | { |
| 2041 | int i; |
| 2042 | struct list_head *head; |
| 2043 | hddTdlsPeer_t *tmp; |
| 2044 | struct list_head *pos, *q; |
| 2045 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2046 | pHddTdlsCtx->discovery_peer_cnt = 0; |
| 2047 | |
| 2048 | for (i = 0; i < 256; i++) { |
| 2049 | head = &pHddTdlsCtx->peer_list[i]; |
| 2050 | list_for_each_safe (pos, q, head) { |
| 2051 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
| 2052 | tmp->discovery_processed = 0; |
| 2053 | } |
| 2054 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2055 | |
| 2056 | return 0; |
| 2057 | } |
| 2058 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2059 | static tANI_S32 wlan_hdd_get_tdls_discovery_peer_cnt(tdlsCtx_t *pHddTdlsCtx) |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2060 | { |
| 2061 | int i; |
| 2062 | struct list_head *head; |
| 2063 | struct list_head *pos, *q; |
| 2064 | int discovery_peer_cnt=0; |
| 2065 | hddTdlsPeer_t *tmp; |
| 2066 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 2067 | /* |
| 2068 | * This function expects the callers to acquire the Mutex. |
| 2069 | */ |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2070 | |
| 2071 | for (i = 0; i < 256; i++) { |
| 2072 | head = &pHddTdlsCtx->peer_list[i]; |
| 2073 | list_for_each_safe (pos, q, head) { |
| 2074 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2075 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 2076 | "%s, %d, " MAC_ADDRESS_STR, __func__, i, |
| 2077 | MAC_ADDR_ARRAY(tmp->peerMac)); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2078 | discovery_peer_cnt++; |
| 2079 | } |
| 2080 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2081 | return discovery_peer_cnt; |
| 2082 | } |
| 2083 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2084 | tANI_U16 wlan_hdd_tdlsConnectedPeers(hdd_adapter_t *pAdapter) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 2085 | { |
Hanumantha Reddy Pothula | da0fe36 | 2015-02-27 18:37:03 +0530 | [diff] [blame] | 2086 | hdd_context_t *pHddCtx = NULL; |
| 2087 | |
| 2088 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 2089 | { |
| 2090 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2091 | FL("invalid pAdapter: %p"), pAdapter); |
| 2092 | return 0; |
| 2093 | } |
| 2094 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2095 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2096 | ENTER(); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2097 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2098 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2099 | return 0; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2100 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2101 | EXIT(); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2102 | return pHddCtx->connected_peer_count; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 2103 | } |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2104 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 2105 | hddTdlsPeer_t *wlan_hdd_tdls_get_connected_peer(hdd_adapter_t *pAdapter) |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2106 | { |
| 2107 | int i; |
| 2108 | struct list_head *head; |
| 2109 | struct list_head *pos; |
| 2110 | hddTdlsPeer_t *curr_peer = NULL; |
| 2111 | tdlsCtx_t *pHddTdlsCtx; |
| 2112 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2113 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2114 | ENTER(); |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2115 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2116 | { |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2117 | return NULL; |
| 2118 | } |
| 2119 | |
| 2120 | mutex_lock(&pHddCtx->tdls_lock); |
| 2121 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2122 | if (NULL == pHddTdlsCtx) { |
| 2123 | mutex_unlock(&pHddCtx->tdls_lock); |
| 2124 | return NULL; |
| 2125 | } |
| 2126 | for (i = 0; i < 256; i++) { |
| 2127 | head = &pHddTdlsCtx->peer_list[i]; |
| 2128 | |
| 2129 | list_for_each(pos, head) { |
| 2130 | curr_peer= list_entry (pos, hddTdlsPeer_t, node); |
Pradeep Reddy POTTETI | 8a62313 | 2014-06-26 16:07:06 +0530 | [diff] [blame] | 2131 | if (curr_peer && (curr_peer->link_status == eTDLS_LINK_CONNECTED)) |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2132 | { |
| 2133 | mutex_unlock(&pHddCtx->tdls_lock); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2134 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | 8a62313 | 2014-06-26 16:07:06 +0530 | [diff] [blame] | 2135 | "%s: " MAC_ADDRESS_STR " eTDLS_LINK_CONNECTED", |
| 2136 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac)); |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2137 | return curr_peer; |
| 2138 | } |
| 2139 | } |
| 2140 | } |
| 2141 | mutex_unlock(&pHddCtx->tdls_lock); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2142 | |
| 2143 | EXIT(); |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2144 | return NULL; |
| 2145 | } |
| 2146 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2147 | int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf, int buflen) |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2148 | { |
| 2149 | int i; |
| 2150 | int len, init_len; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 2151 | struct list_head *head; |
| 2152 | struct list_head *pos; |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2153 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2154 | tdlsCtx_t *pHddTdlsCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2155 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2156 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2157 | ENTER(); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2158 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2159 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2160 | return 0; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2161 | } |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2162 | |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2163 | init_len = buflen; |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 2164 | len = scnprintf(buf, buflen, "\n%-18s%-3s%-4s%-3s%-5s\n", |
| 2165 | "MAC", "Id", "cap", "up", "RSSI"); |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2166 | buf += len; |
| 2167 | buflen -= len; |
| 2168 | /* 1234567890123456789012345678901234567 */ |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 2169 | len = scnprintf(buf, buflen, "---------------------------------\n"); |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2170 | buf += len; |
| 2171 | buflen -= len; |
| 2172 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 2173 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2174 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 2175 | if (NULL == pHddTdlsCtx) { |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2176 | mutex_unlock(&pHddCtx->tdls_lock); |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 2177 | len = scnprintf(buf, buflen, "TDLS not enabled\n"); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 2178 | return len; |
| 2179 | } |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2180 | for (i = 0; i < 256; i++) { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 2181 | head = &pHddTdlsCtx->peer_list[i]; |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2182 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 2183 | list_for_each(pos, head) { |
| 2184 | curr_peer= list_entry (pos, hddTdlsPeer_t, node); |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2185 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 2186 | if (buflen < 32+1) |
| 2187 | break; |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 2188 | len = scnprintf(buf, buflen, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 2189 | MAC_ADDRESS_STR"%3d%4s%3s%5d\n", |
| 2190 | MAC_ADDR_ARRAY(curr_peer->peerMac), |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 2191 | curr_peer->staId, |
| 2192 | (curr_peer->tdls_support == eTDLS_CAP_SUPPORTED) ? "Y":"N", |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2193 | TDLS_IS_CONNECTED(curr_peer) ? "Y":"N", |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 2194 | curr_peer->rssi); |
| 2195 | buf += len; |
| 2196 | buflen -= len; |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2197 | } |
| 2198 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2199 | mutex_unlock(&pHddCtx->tdls_lock); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2200 | |
| 2201 | EXIT(); |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 2202 | return init_len-buflen; |
| 2203 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2204 | |
| 2205 | void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter) |
| 2206 | { |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 2207 | tdlsCtx_t *pHddTdlsCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2208 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 9d76a9b | 2013-02-28 15:38:37 -0800 | [diff] [blame] | 2209 | |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 2210 | if ((NULL == pHddCtx)) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2211 | { |
Agarwal Ashish | bf98caf | 2014-03-25 13:29:11 +0530 | [diff] [blame] | 2212 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2213 | FL("pHddCtx or pHddTdlsCtx points to NULL")); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2214 | return; |
| 2215 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2216 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 2217 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 2218 | |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 2219 | if (0 != wlan_hdd_sta_tdls_init(pAdapter)) |
| 2220 | { |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 2221 | mutex_unlock(&pHddCtx->tdls_lock); |
Hema Aparna Medicharla | 8bb6f78 | 2015-03-09 12:35:05 +0530 | [diff] [blame] | 2222 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wlan_hdd_sta_tdls_init failed",__func__); |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 2223 | return; |
| 2224 | } |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 2225 | |
| 2226 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2227 | if ((NULL == pHddTdlsCtx)) |
| 2228 | { |
Hema Aparna Medicharla | 8bb6f78 | 2015-03-09 12:35:05 +0530 | [diff] [blame] | 2229 | mutex_unlock(&pHddCtx->tdls_lock); |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 2230 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2231 | FL("pHddCtx or pHddTdlsCtx points to NULL device mode = %d"), pAdapter->device_mode); |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 2232 | return; |
| 2233 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2234 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2235 | "%s, update %d discover %d", __func__, |
| 2236 | pHddTdlsCtx->threshold_config.tx_period_t, |
| 2237 | pHddTdlsCtx->threshold_config.discovery_period_t); |
| 2238 | |
Gopichand Nakkala | 9d76a9b | 2013-02-28 15:38:37 -0800 | [diff] [blame] | 2239 | if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode) |
| 2240 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2241 | wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2242 | pHddTdlsCtx->discovery_sent_cnt = 0; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2243 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2244 | |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2245 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 2246 | &pHddTdlsCtx->peerUpdateTimer, |
| 2247 | pHddTdlsCtx->threshold_config.tx_period_t); |
Gopichand Nakkala | 9d76a9b | 2013-02-28 15:38:37 -0800 | [diff] [blame] | 2248 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2249 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2250 | |
| 2251 | } |
| 2252 | |
| 2253 | void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter) |
| 2254 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2255 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2256 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2257 | |
Deepthi Gowri | bfd1713 | 2014-11-14 17:59:04 +0530 | [diff] [blame] | 2258 | if (NULL == pHddCtx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2259 | { |
| 2260 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Deepthi Gowri | bfd1713 | 2014-11-14 17:59:04 +0530 | [diff] [blame] | 2261 | FL(" pHddCtx points to NULL")); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2262 | return; |
| 2263 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2264 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2265 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s", __func__); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2266 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 2267 | if (NULL == pHddTdlsCtx) |
| 2268 | { |
Hema Aparna Medicharla | 8bb6f78 | 2015-03-09 12:35:05 +0530 | [diff] [blame] | 2269 | mutex_unlock(&pHddCtx->tdls_lock); |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 2270 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2271 | FL("pHddTdlsCtx is NULL")); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 2272 | return; |
| 2273 | } |
Masti, Narayanraddi | de96b99 | 2015-01-08 13:00:58 +0530 | [diff] [blame] | 2274 | |
Pradeep Reddy POTTETI | 2d4d5c4 | 2015-03-03 14:34:19 +0530 | [diff] [blame] | 2275 | mutex_lock(&pHddCtx->tdls_lock); |
Masti, Narayanraddi | de96b99 | 2015-01-08 13:00:58 +0530 | [diff] [blame] | 2276 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2277 | pHddTdlsCtx->discovery_sent_cnt = 0; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2278 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 2279 | |
Pradeep Reddy POTTETI | 2d4d5c4 | 2015-03-03 14:34:19 +0530 | [diff] [blame] | 2280 | wlan_hdd_tdls_exit(pAdapter, TRUE); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 2281 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2282 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 2283 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2284 | |
| 2285 | void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter, tANI_U32 statusCode) |
| 2286 | { |
| 2287 | pAdapter->mgmtTxCompletionStatus = statusCode; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2288 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2289 | "%s: Mgmt TX Completion %d",__func__, statusCode); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2290 | complete(&pAdapter->tdls_mgmt_comp); |
| 2291 | } |
| 2292 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2293 | void wlan_hdd_tdls_increment_peer_count(hdd_adapter_t *pAdapter) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2294 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2295 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2296 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2297 | ENTER(); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2298 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2299 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2300 | return; |
| 2301 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2302 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 2303 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2304 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2305 | pHddCtx->connected_peer_count++; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2306 | wlan_hdd_tdls_check_power_save_prohibited(pAdapter); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2307 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2308 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: %d", |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2309 | __func__, pHddCtx->connected_peer_count); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2310 | |
| 2311 | mutex_unlock(&pHddCtx->tdls_lock); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2312 | |
| 2313 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2314 | } |
| 2315 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2316 | void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2317 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2318 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2319 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2320 | ENTER(); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2321 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2322 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2323 | return; |
| 2324 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2325 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 2326 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2327 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2328 | if (pHddCtx->connected_peer_count) |
| 2329 | pHddCtx->connected_peer_count--; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2330 | wlan_hdd_tdls_check_power_save_prohibited(pAdapter); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2331 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2332 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: %d", |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2333 | __func__, pHddCtx->connected_peer_count); |
| 2334 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2335 | mutex_unlock(&pHddCtx->tdls_lock); |
| 2336 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2337 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2338 | } |
| 2339 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2340 | void wlan_hdd_tdls_check_bmps(hdd_adapter_t *pAdapter) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2341 | { |
Hanumantha Reddy Pothula | da0fe36 | 2015-02-27 18:37:03 +0530 | [diff] [blame] | 2342 | |
| 2343 | tdlsCtx_t *pHddTdlsCtx = NULL; |
| 2344 | hdd_context_t *pHddCtx = NULL; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 2345 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2346 | |
Hanumantha Reddy Pothula | da0fe36 | 2015-02-27 18:37:03 +0530 | [diff] [blame] | 2347 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 2348 | { |
| 2349 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2350 | FL("invalid pAdapter: %p"), pAdapter); |
| 2351 | return; |
| 2352 | } |
| 2353 | |
| 2354 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2355 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2356 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2357 | if ((NULL == pHddCtx) || (NULL == pHddTdlsCtx)) |
| 2358 | { |
Sushant Kaushik | 125ae69 | 2014-11-25 17:38:48 +0530 | [diff] [blame] | 2359 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2360 | FL(" pHddCtx or pHddTdlsCtx points to NULL")); |
| 2361 | return; |
| 2362 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2363 | |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2364 | curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, TRUE); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 2365 | if (NULL != curr_peer) |
| 2366 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2367 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 2368 | "%s: tdls in progress. Dont check for BMPS " MAC_ADDRESS_STR, |
| 2369 | __func__, MAC_ADDR_ARRAY (curr_peer->peerMac)); |
| 2370 | return; |
| 2371 | } |
| 2372 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2373 | if ((TDLS_CTX_MAGIC != pHddCtx->tdls_scan_ctxt.magic) && |
| 2374 | (0 == pHddCtx->connected_peer_count) && |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2375 | (0 == pHddTdlsCtx->discovery_sent_cnt)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2376 | { |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2377 | if (FALSE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 2378 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2379 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2380 | "%s: No TDLS peer connected/discovery sent. Enable BMPS", |
| 2381 | __func__); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2382 | hdd_enable_bmps_imps(pHddCtx); |
| 2383 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2384 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2385 | else |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2386 | { |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2387 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 2388 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2389 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2390 | "%s: TDLS peer connected. Disable BMPS", __func__); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2391 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 2392 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2393 | } |
| 2394 | return; |
| 2395 | } |
| 2396 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2397 | u8 wlan_hdd_tdls_is_peer_progress(hdd_adapter_t *pAdapter, u8 *mac) |
| 2398 | { |
| 2399 | hddTdlsPeer_t *curr_peer; |
| 2400 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2401 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2402 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2403 | { |
| 2404 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2405 | "%s: curr_peer is NULL", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2406 | return 0; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2407 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2408 | |
| 2409 | return (eTDLS_LINK_CONNECTING == curr_peer->link_status); |
| 2410 | } |
| 2411 | |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2412 | /* return pointer to hddTdlsPeer_t if TDLS is ongoing. Otherwise return NULL. |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2413 | * mac - if NULL check for all the peer list, otherwise, skip this mac when skip_self is TRUE |
| 2414 | * skip_self - if TRUE, skip this mac. otherwise, check all the peer list. if |
| 2415 | mac is NULL, this argument is ignored, and check for all the peer list. |
| 2416 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 2417 | static hddTdlsPeer_t *wlan_hdd_tdls_find_progress_peer(hdd_adapter_t *pAdapter, |
| 2418 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 2419 | const u8 *mac, |
| 2420 | #else |
| 2421 | u8 *mac, |
| 2422 | #endif |
| 2423 | u8 skip_self) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2424 | { |
| 2425 | int i; |
| 2426 | struct list_head *head; |
| 2427 | hddTdlsPeer_t *curr_peer; |
| 2428 | struct list_head *pos; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2429 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2430 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2431 | if (NULL == pHddTdlsCtx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2432 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 2433 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2434 | FL("pHddTdlsCtx is NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2435 | return NULL; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2436 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2437 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2438 | for (i = 0; i < 256; i++) { |
| 2439 | head = &pHddTdlsCtx->peer_list[i]; |
| 2440 | list_for_each(pos, head) { |
| 2441 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
| 2442 | if (skip_self && mac && !memcmp(mac, curr_peer->peerMac, 6)) { |
| 2443 | continue; |
| 2444 | } |
| 2445 | else |
| 2446 | { |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 2447 | if (eTDLS_LINK_CONNECTING == curr_peer->link_status) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2448 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2449 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2450 | "%s:" MAC_ADDRESS_STR " eTDLS_LINK_CONNECTING", |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 2451 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac)); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2452 | return curr_peer; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2453 | } |
| 2454 | } |
| 2455 | } |
| 2456 | } |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2457 | return NULL; |
| 2458 | } |
| 2459 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 2460 | hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx, |
| 2461 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 2462 | const u8 *mac, |
| 2463 | #else |
| 2464 | u8 *mac, |
| 2465 | #endif |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2466 | u8 skip_self, tANI_BOOLEAN mutexLock) |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2467 | { |
| 2468 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 2469 | hdd_adapter_t *pAdapter = NULL; |
| 2470 | tdlsCtx_t *pHddTdlsCtx = NULL; |
| 2471 | hddTdlsPeer_t *curr_peer= NULL; |
| 2472 | VOS_STATUS status = 0; |
| 2473 | |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2474 | if (mutexLock) |
| 2475 | { |
| 2476 | mutex_lock(&pHddCtx->tdls_lock); |
| 2477 | } |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2478 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 2479 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 2480 | { |
| 2481 | pAdapter = pAdapterNode->pAdapter; |
| 2482 | |
| 2483 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2484 | if (NULL != pHddTdlsCtx) |
| 2485 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2486 | curr_peer = wlan_hdd_tdls_find_progress_peer(pAdapter, mac, skip_self); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2487 | if (curr_peer) |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2488 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2489 | if (mutexLock) |
| 2490 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2491 | return curr_peer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2492 | } |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2493 | } |
| 2494 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 2495 | pAdapterNode = pNext; |
| 2496 | } |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2497 | if (mutexLock) |
| 2498 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2499 | return NULL; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2500 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2501 | |
| 2502 | static void wlan_hdd_tdls_implicit_disable(tdlsCtx_t *pHddTdlsCtx) |
| 2503 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2504 | wlan_hdd_tdls_timers_stop(pHddTdlsCtx); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2505 | } |
| 2506 | |
| 2507 | static void wlan_hdd_tdls_implicit_enable(tdlsCtx_t *pHddTdlsCtx) |
| 2508 | { |
| 2509 | wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2510 | pHddTdlsCtx->discovery_sent_cnt = 0; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2511 | wlan_tdd_tdls_reset_tx_rx(pHddTdlsCtx); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2512 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2513 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2514 | |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2515 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 2516 | &pHddTdlsCtx->peerUpdateTimer, |
| 2517 | pHddTdlsCtx->threshold_config.tx_period_t); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2518 | } |
| 2519 | |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 2520 | void wlan_hdd_tdls_set_mode(hdd_context_t *pHddCtx, |
| 2521 | eTDLSSupportMode tdls_mode, |
| 2522 | v_BOOL_t bUpdateLast) |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2523 | { |
| 2524 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 2525 | VOS_STATUS status; |
| 2526 | hdd_adapter_t *pAdapter; |
| 2527 | tdlsCtx_t *pHddTdlsCtx; |
| 2528 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2529 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2530 | "%s mode %d", __func__, (int)tdls_mode); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2531 | |
| 2532 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2533 | { |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2534 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2535 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2536 | |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 2537 | mutex_lock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 2538 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2539 | if (pHddCtx->tdls_mode == tdls_mode) |
| 2540 | { |
Hema Aparna Medicharla | 8bb6f78 | 2015-03-09 12:35:05 +0530 | [diff] [blame] | 2541 | mutex_unlock(&pHddCtx->tdls_lock); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2542 | hddLog(VOS_TRACE_LEVEL_INFO, "%s already in mode %d", __func__, |
| 2543 | (int)tdls_mode); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2544 | return; |
| 2545 | } |
| 2546 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2547 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 2548 | |
| 2549 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 2550 | { |
| 2551 | pAdapter = pAdapterNode->pAdapter; |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2552 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2553 | if (NULL != pHddTdlsCtx) |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2554 | { |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2555 | if(eTDLS_SUPPORT_ENABLED == tdls_mode) |
| 2556 | wlan_hdd_tdls_implicit_enable(pHddTdlsCtx); |
| 2557 | else if((eTDLS_SUPPORT_DISABLED == tdls_mode) || |
| 2558 | (eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == tdls_mode)) |
| 2559 | wlan_hdd_tdls_implicit_disable(pHddTdlsCtx); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2560 | } |
| 2561 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 2562 | pAdapterNode = pNext; |
| 2563 | } |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 2564 | if(bUpdateLast) |
| 2565 | { |
| 2566 | pHddCtx->tdls_mode_last = tdls_mode; |
| 2567 | } |
| 2568 | else |
| 2569 | { |
| 2570 | pHddCtx->tdls_mode_last = pHddCtx->tdls_mode; |
| 2571 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2572 | pHddCtx->tdls_mode = tdls_mode; |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 2573 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2574 | mutex_unlock(&pHddCtx->tdls_lock); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2575 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2576 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2577 | |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2578 | static |
| 2579 | void wlan_hdd_tdls_implicit_send_discovery_request(tdlsCtx_t * pHddTdlsCtx) |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2580 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2581 | hdd_context_t *pHddCtx = NULL; |
| 2582 | hddTdlsPeer_t *curr_peer = NULL, *temp_peer = NULL; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2583 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2584 | ENTER(); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2585 | if (NULL == pHddTdlsCtx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2586 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 2587 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2588 | FL("pHddTdlsCtx is NULL")); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2589 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2590 | } |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2591 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2592 | pHddCtx = WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2593 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2594 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2595 | { |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2596 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2597 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2598 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2599 | curr_peer = pHddTdlsCtx->curr_candidate; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2600 | if (NULL == curr_peer) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2601 | { |
| 2602 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2603 | FL("curr_peer is NULL")); |
| 2604 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2605 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2606 | } |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2607 | |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2608 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter))) |
| 2609 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2610 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2611 | "%s: Disable BMPS", __func__); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2612 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 2613 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2614 | |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2615 | /* This function is called in mutex_lock */ |
| 2616 | temp_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, FALSE); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2617 | if (NULL != temp_peer) |
| 2618 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2619 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2620 | "%s: " MAC_ADDRESS_STR " ongoing. pre_setup ignored", |
| 2621 | __func__, MAC_ADDR_ARRAY(temp_peer->peerMac)); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2622 | goto done; |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2623 | } |
| 2624 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2625 | if (eTDLS_CAP_UNKNOWN != curr_peer->tdls_support) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 2626 | wlan_hdd_tdls_set_peer_link_status(curr_peer, |
| 2627 | eTDLS_LINK_DISCOVERING, |
| 2628 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2629 | |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2630 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2631 | "%s: Implicit TDLS, Send Discovery request event", __func__); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2632 | |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2633 | cfg80211_tdls_oper_request(pHddTdlsCtx->pAdapter->dev, |
| 2634 | curr_peer->peerMac, |
| 2635 | NL80211_TDLS_DISCOVERY_REQ, |
| 2636 | FALSE, |
| 2637 | GFP_KERNEL); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2638 | pHddTdlsCtx->discovery_sent_cnt++; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2639 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2640 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2641 | |
Pradeep Reddy POTTETI | 219ced3 | 2014-11-14 16:33:57 +0530 | [diff] [blame] | 2642 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 2643 | &pHddTdlsCtx->peerDiscoveryTimeoutTimer, |
| 2644 | pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE); |
| 2645 | |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2646 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2647 | "%s: discovery count %u timeout %u msec", |
| 2648 | __func__, pHddTdlsCtx->discovery_sent_cnt, |
| 2649 | pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE); |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2650 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2651 | done: |
| 2652 | pHddTdlsCtx->curr_candidate = NULL; |
| 2653 | pHddTdlsCtx->magic = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2654 | EXIT(); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2655 | return; |
| 2656 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2657 | |
| 2658 | tANI_U32 wlan_hdd_tdls_discovery_sent_cnt(hdd_context_t *pHddCtx) |
| 2659 | { |
| 2660 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 2661 | hdd_adapter_t *pAdapter = NULL; |
| 2662 | tdlsCtx_t *pHddTdlsCtx = NULL; |
| 2663 | VOS_STATUS status = 0; |
| 2664 | tANI_U32 count = 0; |
| 2665 | |
| 2666 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 2667 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 2668 | { |
| 2669 | pAdapter = pAdapterNode->pAdapter; |
| 2670 | |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2671 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2672 | if (NULL != pHddTdlsCtx) |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2673 | { |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2674 | count = count + pHddTdlsCtx->discovery_sent_cnt; |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2675 | } |
| 2676 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 2677 | pAdapterNode = pNext; |
| 2678 | } |
| 2679 | return count; |
| 2680 | } |
| 2681 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2682 | void wlan_hdd_tdls_check_power_save_prohibited(hdd_adapter_t *pAdapter) |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2683 | { |
Hanumantha Reddy Pothula | da0fe36 | 2015-02-27 18:37:03 +0530 | [diff] [blame] | 2684 | tdlsCtx_t *pHddTdlsCtx = NULL; |
| 2685 | hdd_context_t *pHddCtx = NULL; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 2686 | |
Hanumantha Reddy Pothula | da0fe36 | 2015-02-27 18:37:03 +0530 | [diff] [blame] | 2687 | |
| 2688 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 2689 | { |
| 2690 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2691 | FL("invalid pAdapter: %p"), pAdapter); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 2692 | return; |
| 2693 | } |
| 2694 | |
| 2695 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2696 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2697 | |
| 2698 | if ((NULL == pHddTdlsCtx) || (NULL == pHddCtx)) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2699 | { |
| 2700 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2701 | FL(" pHddCtx or pHddTdlsCtx points to NULL")); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2702 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2703 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2704 | |
| 2705 | if ((0 == pHddCtx->connected_peer_count) && |
| 2706 | (0 == wlan_hdd_tdls_discovery_sent_cnt(pHddCtx))) |
| 2707 | { |
| 2708 | sme_SetTdlsPowerSaveProhibited(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter), 0); |
| 2709 | return; |
| 2710 | } |
| 2711 | sme_SetTdlsPowerSaveProhibited(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter), 1); |
| 2712 | return; |
| 2713 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2714 | |
| 2715 | void wlan_hdd_tdls_free_scan_request (tdls_scan_context_t *tdls_scan_ctx) |
| 2716 | { |
| 2717 | if (NULL == tdls_scan_ctx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2718 | { |
| 2719 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2720 | FL("tdls_scan_ctx is NULL")); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2721 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2722 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2723 | |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2724 | tdls_scan_ctx->attempt = 0; |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2725 | tdls_scan_ctx->reject = 0; |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2726 | tdls_scan_ctx->magic = 0; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2727 | tdls_scan_ctx->scan_request = NULL; |
| 2728 | return; |
| 2729 | } |
| 2730 | |
| 2731 | int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx, |
| 2732 | struct wiphy *wiphy, |
| 2733 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2734 | struct net_device *dev, |
| 2735 | #endif |
| 2736 | struct cfg80211_scan_request *request) |
| 2737 | { |
| 2738 | tdls_scan_context_t *scan_ctx; |
| 2739 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2740 | ENTER(); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2741 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2742 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2743 | return 0; |
| 2744 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2745 | |
| 2746 | scan_ctx = &pHddCtx->tdls_scan_ctxt; |
| 2747 | |
| 2748 | scan_ctx->wiphy = wiphy; |
| 2749 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2750 | scan_ctx->dev = dev; |
| 2751 | #endif |
| 2752 | |
| 2753 | scan_ctx->scan_request = request; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2754 | |
| 2755 | EXIT(); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2756 | return 0; |
| 2757 | } |
| 2758 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2759 | static void wlan_hdd_tdls_scan_init_work(hdd_context_t *pHddCtx, |
| 2760 | struct wiphy *wiphy, |
| 2761 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2762 | struct net_device *dev, |
| 2763 | #endif |
| 2764 | struct cfg80211_scan_request *request, |
| 2765 | unsigned long delay) |
| 2766 | { |
| 2767 | if (TDLS_CTX_MAGIC != pHddCtx->tdls_scan_ctxt.magic) |
| 2768 | { |
| 2769 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2770 | wlan_hdd_tdls_copy_scan_context(pHddCtx, wiphy, dev, request); |
| 2771 | #else |
| 2772 | wlan_hdd_tdls_copy_scan_context(pHddCtx, wiphy, request); |
| 2773 | #endif |
| 2774 | pHddCtx->tdls_scan_ctxt.attempt = 0; |
| 2775 | pHddCtx->tdls_scan_ctxt.magic = TDLS_CTX_MAGIC; |
| 2776 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2777 | schedule_delayed_work(&pHddCtx->tdls_scan_ctxt.tdls_scan_work, delay); |
| 2778 | } |
| 2779 | |
| 2780 | /* return negative = caller should stop and return error code immediately |
| 2781 | return 0 = caller should stop and return success immediately |
| 2782 | return 1 = caller can continue to scan |
| 2783 | */ |
| 2784 | int wlan_hdd_tdls_scan_callback (hdd_adapter_t *pAdapter, |
| 2785 | struct wiphy *wiphy, |
| 2786 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2787 | struct net_device *dev, |
| 2788 | #endif |
| 2789 | struct cfg80211_scan_request *request) |
| 2790 | { |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2791 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2792 | u16 connectedTdlsPeers; |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2793 | hddTdlsPeer_t *curr_peer, *connected_peer; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2794 | unsigned long delay; |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2795 | hdd_config_t *cfg_param = pHddCtx->cfg_ini; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2796 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2797 | ENTER(); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2798 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2799 | { |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2800 | return 0; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2801 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2802 | |
| 2803 | /* if tdls is not enabled, then continue scan */ |
Pradeep Reddy POTTETI | f0569d7 | 2014-12-13 16:54:03 +0530 | [diff] [blame] | 2804 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 2805 | (pHddCtx->is_tdls_btc_enabled == FALSE)) |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2806 | return 1; |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 2807 | curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, TRUE); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2808 | if (NULL != curr_peer) |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2809 | { |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2810 | if (pHddCtx->tdls_scan_ctxt.reject++ >= TDLS_MAX_SCAN_REJECT) |
| 2811 | { |
| 2812 | pHddCtx->tdls_scan_ctxt.reject = 0; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2813 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2814 | "%s: " MAC_ADDRESS_STR ". scan rejected %d. force it to idle", |
| 2815 | __func__, MAC_ADDR_ARRAY (curr_peer->peerMac), pHddCtx->tdls_scan_ctxt.reject); |
| 2816 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 2817 | wlan_hdd_tdls_set_peer_link_status (curr_peer, |
| 2818 | eTDLS_LINK_IDLE, |
| 2819 | eTDLS_LINK_UNSPECIFIED); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2820 | return 1; |
| 2821 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2822 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2823 | "%s: tdls in progress. scan rejected %d", |
| 2824 | __func__, pHddCtx->tdls_scan_ctxt.reject); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2825 | return -EBUSY; |
| 2826 | } |
| 2827 | |
| 2828 | /* tdls teardown is ongoing */ |
| 2829 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 2830 | { |
| 2831 | connectedTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 2832 | if (connectedTdlsPeers && (pHddCtx->tdls_scan_ctxt.attempt < TDLS_MAX_SCAN_SCHEDULE)) |
| 2833 | { |
| 2834 | delay = (unsigned long)(TDLS_DELAY_SCAN_PER_CONNECTION*connectedTdlsPeers); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2835 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2836 | "%s: tdls disabled, but still connected_peers %d attempt %d. schedule scan %lu msec", |
| 2837 | __func__, connectedTdlsPeers, pHddCtx->tdls_scan_ctxt.attempt, delay); |
| 2838 | |
| 2839 | wlan_hdd_tdls_scan_init_work (pHddCtx, wiphy, |
| 2840 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2841 | dev, |
| 2842 | #endif |
| 2843 | request, |
| 2844 | msecs_to_jiffies(delay)); |
| 2845 | /* scan should not continue */ |
| 2846 | return 0; |
| 2847 | } |
| 2848 | /* no connected peer or max retry reached, scan continue */ |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2849 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2850 | "%s: tdls disabled. connected_peers %d attempt %d. scan allowed", |
| 2851 | __func__, connectedTdlsPeers, pHddCtx->tdls_scan_ctxt.attempt); |
| 2852 | return 1; |
| 2853 | } |
Agarwal Ashish | ef54a18 | 2014-12-16 15:07:31 +0530 | [diff] [blame] | 2854 | |
| 2855 | /* if fEnableTDLSScan flag is 1 ; driverwill allow scan even if |
| 2856 | * peer station is not buffer STA capable |
| 2857 | * |
| 2858 | * RX: If there is any RX activity, device will lose RX packets, |
| 2859 | * as peer will not be aware that device is off channel. |
| 2860 | * TX: TX is stopped whenever device initiate scan. |
| 2861 | */ |
| 2862 | if (pHddCtx->cfg_ini->fEnableTDLSScan == 1) |
| 2863 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2864 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | ef54a18 | 2014-12-16 15:07:31 +0530 | [diff] [blame] | 2865 | FL("Allow SCAN in all TDLS cases")); |
| 2866 | return 1; |
| 2867 | } |
| 2868 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2869 | /* while tdls is up, first time scan */ |
| 2870 | else if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode || |
| 2871 | eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode) |
| 2872 | { |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2873 | connectedTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2874 | |
| 2875 | /* check the TDLS link and Scan coexistance Capability */ |
| 2876 | if ( (TRUE == pHddCtx->cfg_ini->fEnableTDLSScanCoexSupport) && |
| 2877 | (TRUE == sme_IsFeatureSupportedByFW(TDLS_SCAN_COEXISTENCE)) && |
| 2878 | (connectedTdlsPeers == 1) ) |
| 2879 | { |
| 2880 | /* get connected peer information */ |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 2881 | connected_peer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2882 | if (NULL == connected_peer) { |
| 2883 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2884 | "%s: Invalid connected_peer, Continue Scanning", __func__); |
| 2885 | /* scan should continue */ |
| 2886 | return 1; |
| 2887 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2888 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2889 | ("%s: TDLS Scan Co-exist supported connectedTdlsPeers =%d buffersta =%d"), |
| 2890 | __func__,connectedTdlsPeers,connected_peer->isBufSta); |
| 2891 | |
| 2892 | if (connected_peer->isBufSta) |
| 2893 | { |
| 2894 | pHddCtx->isTdlsScanCoexistence = TRUE; |
| 2895 | if ((cfg_param->dynSplitscan) && (!pHddCtx->issplitscan_enabled)) |
| 2896 | { |
| 2897 | pHddCtx->issplitscan_enabled = TRUE; |
| 2898 | sme_enable_disable_split_scan( |
| 2899 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2900 | cfg_param->nNumStaChanCombinedConc, |
| 2901 | cfg_param->nNumP2PChanCombinedConc); |
| 2902 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2903 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2904 | ("%s:%d TDLS Scan Co-exist supported splitscan_enabled =%d "), |
| 2905 | __func__, __LINE__, pHddCtx->issplitscan_enabled); |
| 2906 | return 1; |
| 2907 | } |
| 2908 | |
| 2909 | } |
| 2910 | else |
| 2911 | { |
| 2912 | /* Throughput Monitor shall disable the split scan when |
| 2913 | * TDLS scan coexistance is disabled.At this point of time |
| 2914 | * since TDLS scan coexistance is not meeting the criteria |
| 2915 | * to be operational, explicitly make it false to enable |
| 2916 | * throughput monitor takes the control of split scan. |
| 2917 | */ |
| 2918 | pHddCtx->isTdlsScanCoexistence = FALSE; |
| 2919 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2920 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2921 | ("%s: TDLS Scan Co-exist not supported connectedTdlsPeers =%d" |
| 2922 | " TDLSScanCoexSupport param =%d TDLS_SCAN_COEXISTENCE =%d"), |
| 2923 | __func__, connectedTdlsPeers, |
| 2924 | pHddCtx->cfg_ini->fEnableTDLSScanCoexSupport, |
| 2925 | sme_IsFeatureSupportedByFW(TDLS_SCAN_COEXISTENCE)); |
| 2926 | |
Atul Mittal | 5803b34 | 2014-09-04 15:31:19 +0530 | [diff] [blame] | 2927 | /* disable implicit trigger logic & tdls operatoin */ |
| 2928 | wlan_hdd_tdls_set_mode(pHddCtx, eTDLS_SUPPORT_DISABLED, FALSE); |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 2929 | /* fall back to the implementation of teardown the peers on the scan |
| 2930 | * when the number of connected peers are more than one. TDLS Scan |
| 2931 | * coexistance feature is exercised only when a single peer is |
| 2932 | * connected and the DUT shall not advertize the Buffer Sta capability, |
| 2933 | * so that the peer shall not go to the TDLS power save |
| 2934 | */ |
| 2935 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2936 | if (connectedTdlsPeers) |
| 2937 | { |
| 2938 | tANI_U8 staIdx; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2939 | hddTdlsPeer_t *curr_peer; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2940 | |
| 2941 | for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
| 2942 | { |
| 2943 | if (pHddCtx->tdlsConnInfo[staIdx].staId) |
| 2944 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2945 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2946 | ("%s: indicate TDLS teardown (staId %d)"), __func__, pHddCtx->tdlsConnInfo[staIdx].staId) ; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2947 | |
| 2948 | #ifdef CONFIG_TDLS_IMPLICIT |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2949 | curr_peer = wlan_hdd_tdls_find_all_peer(pHddCtx, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes); |
| 2950 | if(curr_peer) |
| 2951 | wlan_hdd_tdls_indicate_teardown(curr_peer->pHddTdlsCtx->pAdapter, curr_peer, eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2952 | #endif |
| 2953 | } |
| 2954 | } |
| 2955 | /* schedule scan */ |
| 2956 | delay = (unsigned long)(TDLS_DELAY_SCAN_PER_CONNECTION*connectedTdlsPeers); |
| 2957 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2958 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2959 | "%s: tdls enabled (mode %d), connected_peers %d. schedule scan %lu msec", |
| 2960 | __func__, pHddCtx->tdls_mode, wlan_hdd_tdlsConnectedPeers(pAdapter), |
| 2961 | delay); |
| 2962 | |
| 2963 | wlan_hdd_tdls_scan_init_work (pHddCtx, wiphy, |
| 2964 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2965 | dev, |
| 2966 | #endif |
| 2967 | request, |
| 2968 | msecs_to_jiffies(delay)); |
| 2969 | /* scan should not continue */ |
| 2970 | return 0; |
| 2971 | } |
| 2972 | /* no connected peer, scan continue */ |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 2973 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2974 | "%s: tdls_mode %d, and no tdls connection. scan allowed", |
| 2975 | __func__, pHddCtx->tdls_mode); |
| 2976 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2977 | EXIT(); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2978 | return 1; |
| 2979 | } |
| 2980 | |
| 2981 | void wlan_hdd_tdls_scan_done_callback(hdd_adapter_t *pAdapter) |
| 2982 | { |
| 2983 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2984 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2985 | ENTER(); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2986 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2987 | { |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2988 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2989 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2990 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 2991 | /* if tdls is not enabled or BtCoex is on then don't revert tdls mode */ |
| 2992 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 2993 | (pHddCtx->is_tdls_btc_enabled == FALSE)) { |
| 2994 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to revert: Mode=%d, BTC enabled=%d"), |
| 2995 | pHddCtx->tdls_mode, pHddCtx->is_tdls_btc_enabled); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 2996 | return; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 2997 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 2998 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2999 | /* free allocated memory at scan time */ |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 3000 | wlan_hdd_tdls_free_scan_request (&pHddCtx->tdls_scan_ctxt); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 3001 | |
| 3002 | /* if tdls was enabled before scan, re-enable tdls mode */ |
| 3003 | if(eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode_last || |
| 3004 | eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode_last) |
| 3005 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 3006 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 3007 | ("%s: revert tdls mode %d"), __func__, pHddCtx->tdls_mode_last); |
| 3008 | |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 3009 | wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last, FALSE); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 3010 | } |
| 3011 | wlan_hdd_tdls_check_bmps(pAdapter); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3012 | |
| 3013 | EXIT(); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 3014 | } |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 3015 | |
| 3016 | void wlan_hdd_tdls_timer_restart(hdd_adapter_t *pAdapter, |
| 3017 | vos_timer_t *timer, |
| 3018 | v_U32_t expirationTime) |
| 3019 | { |
| 3020 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3021 | |
| 3022 | if (NULL == pHddStaCtx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 3023 | { |
| 3024 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3025 | FL("pHddStaCtx is NULL")); |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 3026 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 3027 | } |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 3028 | |
| 3029 | /* Check whether driver load unload is in progress */ |
| 3030 | if(vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL)) |
| 3031 | { |
| 3032 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 3033 | "%s: Driver load/unload is in progress.", __func__); |
| 3034 | return; |
| 3035 | } |
| 3036 | |
| 3037 | if (hdd_connIsConnected(pHddStaCtx)) |
| 3038 | { |
| 3039 | vos_timer_stop(timer); |
| 3040 | vos_timer_start(timer, expirationTime); |
| 3041 | } |
| 3042 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3043 | void wlan_hdd_tdls_indicate_teardown(hdd_adapter_t *pAdapter, |
| 3044 | hddTdlsPeer_t *curr_peer, |
| 3045 | tANI_U16 reason) |
| 3046 | { |
Pradeep Reddy POTTETI | 8a62313 | 2014-06-26 16:07:06 +0530 | [diff] [blame] | 3047 | hdd_context_t *pHddCtx; |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 3048 | |
Hanumantha Reddy Pothula | da0fe36 | 2015-02-27 18:37:03 +0530 | [diff] [blame] | 3049 | if ((NULL == pAdapter || WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) || |
| 3050 | (NULL == curr_peer)) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 3051 | { |
| 3052 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3053 | FL("parameters passed are invalid")); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3054 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 3055 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3056 | |
Pradeep Reddy POTTETI | 8a62313 | 2014-06-26 16:07:06 +0530 | [diff] [blame] | 3057 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3058 | |
Masti, Narayanraddi | 9d27566 | 2015-08-26 13:15:12 +0530 | [diff] [blame] | 3059 | if ((eTDLS_LINK_CONNECTED != curr_peer->link_status) && |
| 3060 | (eTDLS_LINK_CONNECTING != curr_peer->link_status)) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3061 | return; |
| 3062 | |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 3063 | /* Throughput Monitor shall disable the split scan when |
| 3064 | * TDLS scan coexistance is disabled.At this point of time |
| 3065 | * since TDLS scan coexistance is not meeting the criteria |
| 3066 | * to be operational, explicitly make it false to enable |
| 3067 | * throughput monitor takes the control of split scan. |
| 3068 | */ |
Pradeep Reddy POTTETI | 8a62313 | 2014-06-26 16:07:06 +0530 | [diff] [blame] | 3069 | if (pHddCtx && (pHddCtx->isTdlsScanCoexistence == TRUE)) |
Pradeep Reddy POTTETI | edaeb5f | 2014-05-22 23:34:41 +0530 | [diff] [blame] | 3070 | { |
| 3071 | pHddCtx->isTdlsScanCoexistence = FALSE; |
| 3072 | } |
| 3073 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3074 | wlan_hdd_tdls_set_peer_link_status(curr_peer, |
| 3075 | eTDLS_LINK_TEARING, |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 3076 | eTDLS_LINK_UNSPECIFIED); |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 3077 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3078 | FL("Setting NL80211_TDLS_TEARDOWN, reason %d"), reason); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 3079 | cfg80211_tdls_oper_request(pAdapter->dev, |
| 3080 | curr_peer->peerMac, |
| 3081 | NL80211_TDLS_TEARDOWN, |
| 3082 | reason, |
| 3083 | GFP_KERNEL); |
| 3084 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3085 | |
| 3086 | |
| 3087 | /*EXT TDLS*/ |
| 3088 | int wlan_hdd_set_callback(hddTdlsPeer_t *curr_peer, |
| 3089 | cfg80211_exttdls_callback callback) |
| 3090 | { |
| 3091 | |
| 3092 | hdd_context_t *pHddCtx; |
| 3093 | hdd_adapter_t *pAdapter; |
| 3094 | |
| 3095 | if (!curr_peer) return -1; |
| 3096 | |
| 3097 | pAdapter = curr_peer->pHddTdlsCtx->pAdapter; |
| 3098 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3099 | if ((NULL == pHddCtx)) return -1; |
| 3100 | |
| 3101 | mutex_lock(&pHddCtx->tdls_lock); |
| 3102 | |
| 3103 | curr_peer->state_change_notification = callback; |
| 3104 | |
| 3105 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3106 | return 0; |
| 3107 | |
| 3108 | |
| 3109 | } |
| 3110 | |
| 3111 | void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer, |
| 3112 | tANI_S32 *state, |
| 3113 | tANI_S32 *reason) |
| 3114 | { |
| 3115 | *reason = curr_peer->reason; |
| 3116 | |
| 3117 | switch(curr_peer->link_status) |
| 3118 | { |
| 3119 | case eTDLS_LINK_IDLE: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3120 | case eTDLS_LINK_DISCOVERED: |
| 3121 | *state = WIFI_TDLS_ENABLED; |
| 3122 | break; |
Atul Mittal | ad630e4 | 2014-10-07 19:19:14 +0530 | [diff] [blame] | 3123 | case eTDLS_LINK_DISCOVERING: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3124 | case eTDLS_LINK_CONNECTING: |
| 3125 | *state = WIFI_TDLS_TRYING; |
| 3126 | break; |
| 3127 | case eTDLS_LINK_CONNECTED: |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 3128 | if (TRUE == curr_peer->isOffChannelEstablished) |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 3129 | { |
| 3130 | *state = WIFI_TDLS_ESTABLISHED_OFF_CHANNEL; |
| 3131 | } |
| 3132 | else |
| 3133 | { |
| 3134 | *state = WIFI_TDLS_ESTABLISHED; |
| 3135 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3136 | break; |
| 3137 | case eTDLS_LINK_TEARING: |
| 3138 | *state = WIFI_TDLS_DROPPED; |
| 3139 | break; |
| 3140 | } |
| 3141 | |
| 3142 | } |
| 3143 | |
| 3144 | int wlan_hdd_tdls_get_status(hdd_adapter_t *pAdapter, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 3145 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 3146 | const tANI_U8* mac, |
| 3147 | #else |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3148 | tANI_U8* mac, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 3149 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3150 | tANI_S32 *state, |
| 3151 | tANI_S32 *reason) |
| 3152 | { |
| 3153 | |
| 3154 | hddTdlsPeer_t *curr_peer; |
Atul Mittal | a75fced | 2014-10-06 13:59:07 +0530 | [diff] [blame] | 3155 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3156 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
| 3157 | if (curr_peer == NULL) |
| 3158 | { |
Atul Mittal | a75fced | 2014-10-06 13:59:07 +0530 | [diff] [blame] | 3159 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3160 | FL("curr_peer is NULL")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3161 | |
Atul Mittal | a75fced | 2014-10-06 13:59:07 +0530 | [diff] [blame] | 3162 | *state = WIFI_TDLS_DISABLED; |
| 3163 | *reason = eTDLS_LINK_UNSPECIFIED; |
| 3164 | } |
| 3165 | else |
| 3166 | { |
| 3167 | if (pHddCtx->cfg_ini->fTDLSExternalControl && |
| 3168 | (FALSE == curr_peer->isForcedPeer)) |
| 3169 | { |
| 3170 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3171 | FL("curr_peer is not Forced")); |
| 3172 | *state = WIFI_TDLS_DISABLED; |
| 3173 | *reason = eTDLS_LINK_UNSPECIFIED; |
| 3174 | } |
| 3175 | else |
| 3176 | { |
| 3177 | wlan_hdd_tdls_get_wifi_hal_state(curr_peer, state, reason); |
| 3178 | } |
| 3179 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3180 | return (0); |
| 3181 | } |
| 3182 | |
Agarwal Ashish | ef54a18 | 2014-12-16 15:07:31 +0530 | [diff] [blame] | 3183 | int hdd_set_tdls_scan_type(hdd_adapter_t *pAdapter, |
| 3184 | tANI_U8 *ptr) |
| 3185 | { |
| 3186 | int tdls_scan_type; |
Hema Aparna Medicharla | 26b9804 | 2015-01-21 15:02:01 +0530 | [diff] [blame] | 3187 | hdd_context_t *pHddCtx; |
Agarwal Ashish | ef54a18 | 2014-12-16 15:07:31 +0530 | [diff] [blame] | 3188 | if (NULL == pAdapter) |
| 3189 | { |
| 3190 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3191 | "%s: pAdapter is NULL", __func__); |
| 3192 | return -EINVAL; |
| 3193 | } |
Hema Aparna Medicharla | 26b9804 | 2015-01-21 15:02:01 +0530 | [diff] [blame] | 3194 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Agarwal Ashish | ef54a18 | 2014-12-16 15:07:31 +0530 | [diff] [blame] | 3195 | tdls_scan_type = ptr[9] - '0'; |
| 3196 | |
| 3197 | if (tdls_scan_type <= 2) |
| 3198 | { |
| 3199 | pHddCtx->cfg_ini->fEnableTDLSScan = tdls_scan_type; |
| 3200 | return 0; |
| 3201 | } |
| 3202 | else |
| 3203 | { |
| 3204 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3205 | " Wrong value is given for tdls_scan_type " |
| 3206 | " Making fEnableTDLSScan as 0 "); |
| 3207 | pHddCtx->cfg_ini->fEnableTDLSScan = 0; |
| 3208 | return -EINVAL; |
| 3209 | } |
| 3210 | } |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 3211 | int wlan_hdd_validate_tdls_context(hdd_context_t *pHddCtx, |
| 3212 | tdlsCtx_t *pHddTdlsCtx) |
| 3213 | { |
| 3214 | VOS_STATUS status; |
| 3215 | int found = 0; |
| 3216 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 3217 | hdd_adapter_t *pAdapter; |
Agarwal Ashish | ef54a18 | 2014-12-16 15:07:31 +0530 | [diff] [blame] | 3218 | |
Mahesh A Saptasagar | 170b508 | 2015-02-16 18:50:54 +0530 | [diff] [blame] | 3219 | if (NULL == pHddTdlsCtx) |
| 3220 | { |
| 3221 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3222 | FL("TDLS context is NULL")); |
| 3223 | return -EINVAL; |
| 3224 | } |
| 3225 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 3226 | while (NULL != pAdapterNode && VOS_STATUS_SUCCESS == status) |
| 3227 | { |
| 3228 | pAdapter = pAdapterNode->pAdapter; |
| 3229 | if (NULL != pAdapter) |
| 3230 | { |
| 3231 | if (pHddTdlsCtx == pAdapter->sessionCtx.station.pHddTdlsCtx && |
| 3232 | (NULL != pHddTdlsCtx->pAdapter) && |
| 3233 | (WLAN_HDD_ADAPTER_MAGIC == pHddTdlsCtx->pAdapter->magic)) |
| 3234 | { |
| 3235 | found = 1; |
| 3236 | break; |
| 3237 | } |
| 3238 | } |
| 3239 | status = hdd_get_next_adapter (pHddCtx, pAdapterNode, &pNext); |
| 3240 | pAdapterNode = pNext; |
| 3241 | } |
| 3242 | if (found == 1) |
| 3243 | { |
| 3244 | return 0; |
| 3245 | } |
| 3246 | else |
| 3247 | { |
| 3248 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3249 | FL("TDLS context doesnot belongs to valid adapter")); |
| 3250 | return -EINVAL; |
| 3251 | } |
| 3252 | } |
Ganesh Kondabattini | f3ba097 | 2015-08-07 15:58:04 +0530 | [diff] [blame] | 3253 | |
| 3254 | |
| 3255 | void wlan_hdd_tdls_update_rx_pkt_cnt_n_rssi(hdd_adapter_t *pAdapter, |
| 3256 | u8 *mac, v_S7_t rssiAvg) |
| 3257 | { |
| 3258 | hddTdlsPeer_t *curr_peer; |
| 3259 | hdd_context_t *pHddCtx = NULL; |
| 3260 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3261 | mutex_lock(&pHddCtx->tdls_lock); |
| 3262 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
| 3263 | if ((NULL != curr_peer) && |
| 3264 | (eTDLS_LINK_CONNECTED == curr_peer->link_status)) |
| 3265 | { |
| 3266 | curr_peer->rx_pkt++; |
| 3267 | curr_peer->rssi = rssiAvg; |
| 3268 | } |
| 3269 | mutex_unlock(&pHddCtx->tdls_lock); |
| 3270 | VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_INFO, |
| 3271 | "mac : " MAC_ADDRESS_STR "rssi is %d", |
| 3272 | MAC_ADDR_ARRAY(mac), rssiAvg); |
| 3273 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 3274 | |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 3275 | /** |
| 3276 | * wlan_hdd_tdls_reenable() - Re-Enable TDLS |
| 3277 | * @hddctx: pointer to hdd context |
| 3278 | * |
| 3279 | * Function re-enable's TDLS which might be disabled during concurrency |
| 3280 | * |
| 3281 | * Return: None |
| 3282 | */ |
| 3283 | void wlan_hdd_tdls_reenable(hdd_context_t *pHddCtx) |
| 3284 | { |
| 3285 | |
| 3286 | if ((TRUE != pHddCtx->cfg_ini->fEnableTDLSSupport) || |
| 3287 | (TRUE != sme_IsFeatureSupportedByFW(TDLS))) { |
| 3288 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3289 | FL("tdls support not enabled")); |
| 3290 | return; |
| 3291 | } |
| 3292 | |
| 3293 | /* if tdls is not enabled or BtCoex is on then don't revert tdls mode */ |
| 3294 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 3295 | (pHddCtx->is_tdls_btc_enabled == FALSE)) { |
| 3296 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3297 | FL("btc disable tdls so no need to enable: Mode=%d, BTC enabled=%d"), |
| 3298 | pHddCtx->tdls_mode, pHddCtx->is_tdls_btc_enabled); |
| 3299 | return; |
| 3300 | } |
| 3301 | |
| 3302 | if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode_last || |
| 3303 | eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == |
| 3304 | pHddCtx->tdls_mode_last) { |
| 3305 | /* Enable TDLS support Once P2P session ends since |
| 3306 | * upond detection of concurrency TDLS might be disabled |
| 3307 | */ |
| 3308 | hddLog(LOG1, FL("TDLS mode set to %d"), pHddCtx->tdls_mode_last); |
| 3309 | wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last, |
| 3310 | FALSE); |
| 3311 | } |
| 3312 | } |
| 3313 | /*EXT TDLS*/ |