Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1 | /* |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013 Qualcomm Atheros, Inc. |
| 3 | * All Rights Reserved. |
| 4 | * Qualcomm Atheros Confidential and Proprietary. |
Gopichand Nakkala | 0c1331e | 2013-01-07 22:49:07 -0800 | [diff] [blame] | 5 | */ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 6 | /**======================================================================== |
| 7 | |
| 8 | \file wlan_hdd_tdls.c |
| 9 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 10 | \brief WLAN Host Device Driver implementation for TDLS |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 11 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 12 | ========================================================================*/ |
| 13 | |
| 14 | #include <wlan_hdd_includes.h> |
| 15 | #include <wlan_hdd_hostapd.h> |
| 16 | #include <net/cfg80211.h> |
| 17 | #include <linux/netdevice.h> |
| 18 | #include <linux/skbuff.h> |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 19 | #include <linux/list.h> |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 20 | #include <linux/etherdevice.h> |
| 21 | #include <net/ieee80211_radiotap.h> |
| 22 | #include "wlan_hdd_tdls.h" |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 23 | #include "wlan_hdd_cfg80211.h" |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 24 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 25 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 26 | static tANI_S32 wlan_hdd_get_tdls_discovery_peer_cnt(tdlsCtx_t *pHddTdlsCtx); |
| 27 | static tANI_S32 wlan_hdd_tdls_peer_reset_discovery_processed(tdlsCtx_t *pHddTdlsCtx); |
| 28 | static void wlan_hdd_tdls_timers_destroy(tdlsCtx_t *pHddTdlsCtx); |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 29 | static void wlan_hdd_tdls_peer_timers_destroy(tdlsCtx_t *pHddTdlsCtx); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 30 | int wpa_tdls_is_allowed_force_peer(tdlsCtx_t *pHddTdlsCtx, u8 *mac); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 31 | #ifdef CONFIG_TDLS_IMPLICIT |
| 32 | static void wlan_hdd_tdls_pre_setup(struct work_struct *work); |
| 33 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 34 | |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 35 | #ifndef WLAN_FEATURE_TDLS_DEBUG |
| 36 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_INFO |
| 37 | #else |
| 38 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_WARN |
| 39 | #endif |
| 40 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 41 | static u8 wlan_hdd_tdls_hash_key (u8 *mac) |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 42 | { |
| 43 | int i; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 44 | u8 key = 0; |
| 45 | |
| 46 | for (i = 0; i < 6; i++) |
| 47 | key ^= mac[i]; |
| 48 | |
| 49 | return key; |
| 50 | } |
| 51 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 52 | #ifdef CONFIG_TDLS_IMPLICIT |
| 53 | static void wlan_hdd_tdls_pre_setup_init_work(tdlsCtx_t * pHddTdlsCtx, |
| 54 | hddTdlsPeer_t *curr_candidate) |
| 55 | { |
| 56 | if (TDLS_CTX_MAGIC != pHddTdlsCtx->magic) |
| 57 | { |
| 58 | pHddTdlsCtx->curr_candidate = curr_candidate; |
| 59 | pHddTdlsCtx->magic = TDLS_CTX_MAGIC; |
| 60 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 61 | schedule_work(&pHddTdlsCtx->implicit_setup); |
| 62 | } |
| 63 | } |
| 64 | #endif |
| 65 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 66 | static v_VOID_t wlan_hdd_tdls_start_peer_discover_timer(tdlsCtx_t *pHddTdlsCtx, |
| 67 | tANI_BOOLEAN mutexLock, |
| 68 | v_U32_t discoveryExpiry) |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 69 | { |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 70 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 71 | hdd_context_t *pHddCtx; |
| 72 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 73 | if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) ) |
| 74 | { |
| 75 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 76 | FL(" pHddTdlsCtx or pAdapter points to NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 77 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 78 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 79 | |
| 80 | pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter ); |
| 81 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 82 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 83 | { |
| 84 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 85 | FL("pHddCtx is not valid")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 86 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 87 | } |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 88 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 89 | if ( mutexLock ) |
| 90 | { |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 91 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 92 | { |
| 93 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 94 | FL("unable to lock list")); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 95 | return; |
| 96 | } |
| 97 | } |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 98 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 99 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pHddTdlsCtx->pAdapter); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 100 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 101 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 102 | &pHddTdlsCtx->peerDiscoverTimer, |
| 103 | discoveryExpiry); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 104 | #endif |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 105 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "beacon rssi: %d", |
| 106 | pHddTdlsCtx->ap_rssi); |
| 107 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 108 | if ( mutexLock ) |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 109 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 110 | |
| 111 | return; |
| 112 | } |
| 113 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 114 | #ifdef TDLS_USE_SEPARATE_DISCOVERY_TIMER |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 115 | static v_VOID_t wlan_hdd_tdls_discover_peer_cb( v_PVOID_t userData ) |
| 116 | { |
| 117 | int i; |
| 118 | struct list_head *head; |
| 119 | struct list_head *pos; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 120 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 121 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 122 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 123 | tdlsCtx_t *pHddTdlsCtx = (tdlsCtx_t *)userData; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 124 | int discover_req_sent = 0; |
| 125 | v_U32_t discover_expiry = TDLS_SUB_DISCOVERY_PERIOD; |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 126 | tANI_BOOLEAN doMutexLock = eANI_BOOLEAN_TRUE; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 127 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 128 | if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) ) |
| 129 | { |
| 130 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 131 | FL(" pHddTdlsCtx or pAdapter points to NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 132 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 133 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 134 | |
| 135 | pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter ); |
| 136 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 137 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 138 | { |
| 139 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 140 | FL("pHddCtx is not valid")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 141 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 142 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 143 | |
| 144 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 145 | { |
| 146 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 147 | FL("unable to lock list")); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 148 | return; |
| 149 | } |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 150 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 151 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pHddTdlsCtx->pAdapter); |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 152 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 153 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ", __func__); |
| 154 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 155 | if (0 == pHddTdlsCtx->discovery_peer_cnt) |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 156 | pHddTdlsCtx->discovery_peer_cnt = wlan_hdd_get_tdls_discovery_peer_cnt(pHddTdlsCtx); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 157 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 158 | for (i = 0; i < 256; i++) { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 159 | head = &pHddTdlsCtx->peer_list[i]; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 160 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 161 | list_for_each (pos, head) { |
| 162 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 163 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 164 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 165 | "%d " MAC_ADDRESS_STR " %d %d, %d %d %d %d", i, |
| 166 | MAC_ADDR_ARRAY(curr_peer->peerMac), |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 167 | curr_peer->discovery_processed, |
| 168 | discover_req_sent, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 169 | curr_peer->tdls_support, |
| 170 | curr_peer->link_status, |
| 171 | curr_peer->discovery_attempt, |
| 172 | pHddTdlsCtx->threshold_config.discovery_tries_n); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 173 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 174 | if (discover_req_sent < TDLS_MAX_DISCOVER_REQS_PER_TIMER) { |
| 175 | if (!curr_peer->discovery_processed) { |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 176 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 177 | curr_peer->discovery_processed = 1; |
| 178 | discover_req_sent++; |
| 179 | pHddTdlsCtx->discovery_peer_cnt--; |
| 180 | |
| 181 | if ((eTDLS_CAP_UNKNOWN == curr_peer->tdls_support) && |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 182 | (eTDLS_LINK_IDLE == curr_peer->link_status) && |
Gopichand Nakkala | b88f677 | 2013-02-27 18:12:56 -0800 | [diff] [blame] | 183 | (curr_peer->tx_pkt >= |
| 184 | pHddTdlsCtx->threshold_config.tx_packet_n)) { |
Gopichand Nakkala | 273d5a0 | 2013-02-19 15:15:09 -0800 | [diff] [blame] | 185 | |
| 186 | if (curr_peer->discovery_attempt < |
| 187 | pHddTdlsCtx->threshold_config.discovery_tries_n) { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 188 | sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter), |
| 189 | pHddTdlsCtx->pAdapter->sessionId, |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 190 | curr_peer->peerMac, |
| 191 | WLAN_TDLS_DISCOVERY_REQUEST, |
| 192 | 1, 0, NULL, 0, 0); |
Gopichand Nakkala | 273d5a0 | 2013-02-19 15:15:09 -0800 | [diff] [blame] | 193 | curr_peer->discovery_attempt++; |
| 194 | } |
| 195 | else |
| 196 | { |
| 197 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 198 | "%s: Maximum Discovery retries reached", __func__); |
| 199 | curr_peer->tdls_support = eTDLS_CAP_NOT_SUPPORTED; |
| 200 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 201 | |
| 202 | } |
| 203 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 204 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 205 | else |
| 206 | goto exit_loop; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 207 | } |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 208 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 209 | exit_loop: |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 210 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 211 | if (0 != pHddTdlsCtx->discovery_peer_cnt) { |
| 212 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 213 | "discovery_peer_cnt is %d , Starting SUB_DISCOVERY_TIMER", |
| 214 | pHddTdlsCtx->discovery_peer_cnt); |
| 215 | discover_expiry = TDLS_SUB_DISCOVERY_PERIOD; |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 216 | doMutexLock = eANI_BOOLEAN_FALSE; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 217 | goto done; |
| 218 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 219 | discover_expiry = pHddTdlsCtx->threshold_config.discovery_period_t; |
| 220 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 221 | wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 222 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 223 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 224 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 225 | /* Commenting out the following function as it was introducing |
| 226 | * a race condition when pHddTdlsCtx is deleted. Also , this |
| 227 | * function is consuming more time in the timer callback. |
| 228 | * RSSI based trigger needs to revisit this part of the code. |
| 229 | */ |
| 230 | |
| 231 | /* |
| 232 | * wlan_hdd_get_rssi(pAdapter, &pHddTdlsCtx->ap_rssi); |
| 233 | */ |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 234 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 235 | done: |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 236 | wlan_hdd_tdls_start_peer_discover_timer(pHddTdlsCtx, doMutexLock, discover_expiry); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 237 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 238 | if ( !doMutexLock ) |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 239 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 240 | return; |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 241 | } |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 242 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 243 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 244 | 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] | 245 | { |
| 246 | int i; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 247 | struct list_head *head; |
| 248 | struct list_head *pos; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 249 | hddTdlsPeer_t *curr_peer; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 250 | tdlsCtx_t *pHddTdlsCtx = (tdlsCtx_t *)userData; |
| 251 | hdd_context_t *pHddCtx; |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 252 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 253 | if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) ) |
| 254 | { |
| 255 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 256 | FL(" pHddTdlsCtx or pAdapter points to NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 257 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 258 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 259 | |
| 260 | pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter ); |
| 261 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 262 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 263 | { |
| 264 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 265 | FL("pHddCtx is not valid")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 266 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 267 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 268 | |
| 269 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 270 | { |
| 271 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 272 | FL("unable to lock list")); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 273 | return; |
| 274 | } |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 275 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 276 | for (i = 0; i < 256; i++) { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 277 | head = &pHddTdlsCtx->peer_list[i]; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 278 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 279 | list_for_each (pos, head) { |
| 280 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 281 | |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 282 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 283 | "%s: " MAC_ADDRESS_STR " link_status %d" |
| 284 | " tdls_support %d", __func__, MAC_ADDR_ARRAY(curr_peer->peerMac), |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 285 | curr_peer->link_status, curr_peer->tdls_support); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 286 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 287 | if (eTDLS_CAP_SUPPORTED == curr_peer->tdls_support) { |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 288 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 289 | "tx %d, rx %d (thr.pkt %d/idle %d), rssi %d (thr.trig %d/hys %d/tear %d)", |
| 290 | curr_peer->tx_pkt, curr_peer->rx_pkt, |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 291 | pHddTdlsCtx->threshold_config.tx_packet_n, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 292 | pHddTdlsCtx->threshold_config.idle_packet_n, |
| 293 | curr_peer->rssi, |
| 294 | pHddTdlsCtx->threshold_config.rssi_trigger_threshold, |
| 295 | pHddTdlsCtx->threshold_config.rssi_hysteresis, |
| 296 | pHddTdlsCtx->threshold_config.rssi_teardown_threshold); |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 297 | |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 298 | if ((eTDLS_LINK_IDLE == curr_peer->link_status) || |
| 299 | (eTDLS_LINK_DISCOVERING == curr_peer->link_status)){ |
Sunil Dutt | 961ecbd | 2013-11-28 20:04:07 +0530 | [diff] [blame] | 300 | |
| 301 | if (pHddCtx->cfg_ini->fTDLSExternalControl && |
| 302 | (FALSE == curr_peer->isForcedPeer)) { |
| 303 | continue; |
| 304 | } |
| 305 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 306 | if (curr_peer->tx_pkt >= |
| 307 | pHddTdlsCtx->threshold_config.tx_packet_n) { |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 308 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 309 | if (HDD_MAX_NUM_TDLS_STA > wlan_hdd_tdlsConnectedPeers(pHddTdlsCtx->pAdapter)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 310 | { |
| 311 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 312 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "Tput trigger TDLS pre-setup"); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 313 | #ifdef CONFIG_TDLS_IMPLICIT |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 314 | wlan_hdd_tdls_pre_setup_init_work(pHddTdlsCtx, curr_peer); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 315 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 316 | } |
| 317 | else |
| 318 | { |
| 319 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 320 | "%s: Maximum peer connected already! %d", |
| 321 | __func__, wlan_hdd_tdlsConnectedPeers(pHddTdlsCtx->pAdapter) ); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 322 | } |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 323 | goto next_peer; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 324 | } |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 325 | } |
| 326 | else if (eTDLS_LINK_CONNECTED == curr_peer->link_status) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 327 | if ((tANI_S32)curr_peer->rssi < |
| 328 | (tANI_S32)pHddTdlsCtx->threshold_config.rssi_teardown_threshold) { |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 329 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 330 | VOS_TRACE( VOS_MODULE_ID_HDD, |
| 331 | VOS_TRACE_LEVEL_WARN, |
| 332 | "Tear down - low RSSI: " MAC_ADDRESS_STR "!", |
| 333 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
| 334 | #ifdef CONFIG_TDLS_IMPLICIT |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 335 | wlan_hdd_tdls_indicate_teardown(pHddTdlsCtx->pAdapter, |
| 336 | curr_peer, |
| 337 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 338 | #endif |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 339 | goto next_peer; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 340 | } |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 341 | |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 342 | /* Only teardown based on non zero idle packet threshold, to address a use |
| 343 | * case where this threshold does not get consider for TEAR DOWN. |
| 344 | */ |
| 345 | |
| 346 | if (( 0 != pHddTdlsCtx->threshold_config.idle_packet_n ) && |
| 347 | ((curr_peer->tx_pkt < |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 348 | pHddTdlsCtx->threshold_config.idle_packet_n) && |
| 349 | (curr_peer->rx_pkt < |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 350 | pHddTdlsCtx->threshold_config.idle_packet_n))) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 351 | if (VOS_TIMER_STATE_RUNNING != |
| 352 | vos_timer_getCurrentState(&curr_peer->peerIdleTimer)) { |
| 353 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 354 | "Tx/Rx Idle timer start: " MAC_ADDRESS_STR "!", |
| 355 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 356 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 357 | &curr_peer->peerIdleTimer, |
| 358 | pHddTdlsCtx->threshold_config.idle_timeout_t); |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 359 | } |
| 360 | } else { |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 361 | if (VOS_TIMER_STATE_RUNNING == |
| 362 | vos_timer_getCurrentState(&curr_peer->peerIdleTimer)) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 363 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 364 | "Tx/Rx Idle timer stop: " MAC_ADDRESS_STR "!", |
| 365 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
| 366 | vos_timer_stop( &curr_peer->peerIdleTimer); |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 367 | } |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 368 | } |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 369 | |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 370 | // if (curr_peer->rssi < |
| 371 | // (pHddTdlsCtx->threshold_config.rssi_hysteresis + |
| 372 | // pHddTdlsCtx->ap_rssi)) { |
| 373 | // |
| 374 | //#ifdef CONFIG_TDLS_IMPLICIT |
| 375 | // cfg80211_tdls_oper_request(pHddTdlsCtx->dev, |
| 376 | // curr_peer->peerMac, |
| 377 | // NL80211_TDLS_TEARDOWN, FALSE, |
| 378 | // GFP_KERNEL); |
| 379 | //#endif |
| 380 | // } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 381 | } |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 382 | } else if (eTDLS_CAP_UNKNOWN == curr_peer->tdls_support) { |
Sunil Dutt | 961ecbd | 2013-11-28 20:04:07 +0530 | [diff] [blame] | 383 | |
| 384 | if (pHddCtx->cfg_ini->fTDLSExternalControl && |
| 385 | (FALSE == curr_peer->isForcedPeer)) { |
| 386 | continue; |
| 387 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 388 | if (!TDLS_IS_CONNECTED(curr_peer)) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 389 | if (curr_peer->tx_pkt >= |
| 390 | pHddTdlsCtx->threshold_config.tx_packet_n) { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 391 | |
Gopichand Nakkala | 062bcbd | 2013-03-29 18:14:47 -0700 | [diff] [blame] | 392 | if (curr_peer->discovery_attempt++ < |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 393 | pHddTdlsCtx->threshold_config.discovery_tries_n) { |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 394 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "TDLS UNKNOWN discover "); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 395 | #ifdef CONFIG_TDLS_IMPLICIT |
| 396 | wlan_hdd_tdls_pre_setup_init_work(pHddTdlsCtx, curr_peer); |
| 397 | #endif |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 398 | } |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 399 | else |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 400 | { |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 401 | curr_peer->tdls_support = eTDLS_CAP_NOT_SUPPORTED; |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 402 | curr_peer->link_status = eTDLS_LINK_IDLE; |
| 403 | } |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 404 | } |
| 405 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 406 | } |
| 407 | |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 408 | next_peer: |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 409 | curr_peer->tx_pkt = 0; |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 410 | curr_peer->rx_pkt = 0; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 411 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 412 | } |
| 413 | |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 414 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 415 | &pHddTdlsCtx->peerUpdateTimer, |
| 416 | pHddTdlsCtx->threshold_config.tx_period_t); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 417 | mutex_unlock(&pHddCtx->tdls_lock); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 418 | } |
| 419 | |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 420 | static v_VOID_t wlan_hdd_tdls_idle_cb( v_PVOID_t userData ) |
| 421 | { |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 422 | #ifdef CONFIG_TDLS_IMPLICIT |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 423 | hddTdlsPeer_t *curr_peer = (hddTdlsPeer_t *)userData; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 424 | tdlsCtx_t *pHddTdlsCtx; |
| 425 | hdd_context_t *pHddCtx; |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 426 | |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 427 | if (NULL == curr_peer) |
| 428 | { |
| 429 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 430 | FL("Invalid tdls idle timer expired")); |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 431 | return; |
| 432 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 433 | pHddTdlsCtx = curr_peer->pHddTdlsCtx; |
| 434 | |
| 435 | if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) ) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 436 | { |
| 437 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 438 | FL(" pHddTdlsCtx or pAdapter points to NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 439 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 440 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 441 | |
| 442 | pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter ); |
| 443 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 444 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 445 | { |
| 446 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 447 | FL("pHddCtx is not valid")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 448 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 449 | } |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 450 | |
| 451 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 452 | "%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] | 453 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac), |
| 454 | curr_peer->tx_pkt, |
| 455 | curr_peer->rx_pkt, |
| 456 | curr_peer->pHddTdlsCtx->threshold_config.idle_packet_n); |
| 457 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 458 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 459 | { |
| 460 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 461 | FL("unable to lock list")); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 462 | return; |
| 463 | } |
Hoonki Lee | 5a4b217 | 2013-01-29 01:45:53 -0800 | [diff] [blame] | 464 | |
Rajesh Chauhan | 1ace600 | 2013-04-18 18:08:21 -0700 | [diff] [blame] | 465 | /* Check tx/rx statistics on this tdls link for recent activities and |
| 466 | * then decide whether to tear down the link or keep it. |
| 467 | */ |
| 468 | 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)) |
| 469 | { |
| 470 | /* this tdls link got back to normal, so keep it */ |
| 471 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 472 | "%s: tdls link to " MAC_ADDRESS_STR " back to normal, will stay", |
| 473 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac)); |
| 474 | } |
| 475 | else |
| 476 | { |
| 477 | /* this tdls link needs to get torn down */ |
| 478 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 479 | "%s: trigger tdls link to " MAC_ADDRESS_STR " down", |
| 480 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac)); |
| 481 | |
| 482 | wlan_hdd_tdls_indicate_teardown(curr_peer->pHddTdlsCtx->pAdapter, |
| 483 | curr_peer, |
| 484 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 485 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 486 | mutex_unlock(&pHddCtx->tdls_lock); |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 487 | #endif |
| 488 | } |
| 489 | |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 490 | static v_VOID_t wlan_hdd_tdls_discovery_timeout_peer_cb(v_PVOID_t userData) |
| 491 | { |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 492 | int i; |
| 493 | struct list_head *head; |
| 494 | hddTdlsPeer_t *tmp; |
| 495 | struct list_head *pos, *q; |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 496 | tdlsCtx_t *pHddTdlsCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 497 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 498 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 499 | pHddTdlsCtx = (tdlsCtx_t *)userData; |
| 500 | |
| 501 | if ((NULL == pHddTdlsCtx) || (NULL == pHddTdlsCtx->pAdapter) ) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 502 | { |
| 503 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 504 | FL(" pHddTdlsCtx or pAdapter points to NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 505 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 506 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 507 | |
| 508 | pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter ); |
| 509 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 510 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 511 | { |
| 512 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 513 | FL("pHddCtx is not valid")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 514 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 515 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 516 | |
| 517 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 518 | { |
| 519 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 520 | FL("unable to lock list")); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 521 | return ; |
| 522 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 523 | |
| 524 | for (i = 0; i < 256; i++) { |
| 525 | head = &pHddTdlsCtx->peer_list[i]; |
| 526 | list_for_each_safe (pos, q, head) { |
| 527 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
| 528 | if (eTDLS_LINK_DISCOVERING == tmp->link_status) |
| 529 | { |
| 530 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 531 | "%s: " MAC_ADDRESS_STR " to idle state", __func__, |
| 532 | MAC_ADDR_ARRAY(tmp->peerMac)); |
| 533 | tmp->link_status = eTDLS_LINK_IDLE; |
| 534 | } |
| 535 | } |
| 536 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 537 | |
| 538 | pHddTdlsCtx->discovery_sent_cnt = 0; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 539 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 540 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 541 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 542 | |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 543 | wlan_hdd_tdls_check_bmps(pHddTdlsCtx->pAdapter); |
| 544 | |
| 545 | return; |
| 546 | } |
| 547 | |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 548 | static v_VOID_t wlan_hdd_tdls_initiator_wait_cb( v_PVOID_t userData ) |
| 549 | { |
| 550 | hddTdlsPeer_t *curr_peer = (hddTdlsPeer_t *)userData; |
| 551 | tdlsCtx_t *pHddTdlsCtx; |
| 552 | |
| 553 | if ( NULL == curr_peer ) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 554 | { |
| 555 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 556 | FL("curr_peer is NULL")); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 557 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 558 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 559 | |
| 560 | pHddTdlsCtx = curr_peer->pHddTdlsCtx; |
| 561 | |
| 562 | if ( NULL == pHddTdlsCtx ) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 563 | { |
| 564 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 565 | FL("pHddTdlsCtx is NULL")); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 566 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 567 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 568 | |
| 569 | WLANTL_ResumeDataTx( (WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter))->pvosContext, |
| 570 | (v_U8_t *)&curr_peer->staId); |
| 571 | } |
| 572 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 573 | static void wlan_hdd_tdls_free_list(tdlsCtx_t *pHddTdlsCtx) |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 574 | { |
| 575 | int i; |
| 576 | struct list_head *head; |
| 577 | hddTdlsPeer_t *tmp; |
| 578 | struct list_head *pos, *q; |
| 579 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 580 | if (NULL == pHddTdlsCtx) |
| 581 | { |
| 582 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 583 | FL("pHddTdlsCtx is NULL")); |
| 584 | return; |
| 585 | } |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 586 | |
| 587 | for (i = 0; i < 256; i++) { |
| 588 | head = &pHddTdlsCtx->peer_list[i]; |
| 589 | list_for_each_safe (pos, q, head) { |
| 590 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
| 591 | list_del(pos); |
| 592 | vos_mem_free(tmp); |
Srinivas Girigowda | 8d2348f | 2013-12-12 12:14:15 -0800 | [diff] [blame] | 593 | tmp = NULL; |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 594 | } |
| 595 | } |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 596 | } |
| 597 | |
Sameer Thalappil | bee426e | 2013-10-30 10:30:30 -0700 | [diff] [blame] | 598 | static void wlan_hdd_tdls_schedule_scan(struct work_struct *work) |
| 599 | { |
| 600 | tdls_scan_context_t *scan_ctx = |
| 601 | container_of(work, tdls_scan_context_t, tdls_scan_work.work); |
| 602 | |
| 603 | if (NULL == scan_ctx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 604 | { |
| 605 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 606 | FL("scan_ctx is NULL")); |
Sameer Thalappil | bee426e | 2013-10-30 10:30:30 -0700 | [diff] [blame] | 607 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 608 | } |
Sameer Thalappil | bee426e | 2013-10-30 10:30:30 -0700 | [diff] [blame] | 609 | |
| 610 | if (unlikely(TDLS_CTX_MAGIC != scan_ctx->magic)) |
| 611 | return; |
| 612 | |
| 613 | scan_ctx->attempt++; |
| 614 | |
| 615 | wlan_hdd_cfg80211_scan(scan_ctx->wiphy, |
| 616 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 617 | scan_ctx->dev, |
| 618 | #endif |
| 619 | scan_ctx->scan_request); |
| 620 | } |
| 621 | |
| 622 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 623 | int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter) |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 624 | { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 625 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 626 | tdlsCtx_t *pHddTdlsCtx; |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 627 | int i; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 628 | v_U8_t staIdx; |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 629 | |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 630 | if (NULL == pHddCtx) |
| 631 | return -1; |
| 632 | |
| 633 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 634 | { |
| 635 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 636 | "%s: unable to lock list", __func__); |
| 637 | return -1; |
| 638 | } |
| 639 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 640 | if ((FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport) || |
| 641 | (FALSE == sme_IsFeatureSupportedByFW(TDLS))) |
| 642 | { |
| 643 | pHddCtx->tdls_mode = eTDLS_SUPPORT_NOT_ENABLED; |
| 644 | pAdapter->sessionCtx.station.pHddTdlsCtx = NULL; |
| 645 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s TDLS not enabled (%d) or FW doesn't support (%d)!", |
| 646 | __func__, pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 647 | sme_IsFeatureSupportedByFW(TDLS)); |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 648 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 649 | return 0; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 650 | } |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 651 | /* TDLS is supported only in STA / P2P Client modes, |
| 652 | * hence the check for TDLS support in a specific Device mode. |
| 653 | * Do not return a failure rather do not continue further |
| 654 | * with the initialization as tdls_init would be called |
| 655 | * during the open adapter for a p2p interface at which point |
| 656 | * the device mode would be a P2P_DEVICE. The point here is to |
| 657 | * continue initialization for STA / P2P Client modes. |
| 658 | * TDLS exit also check for the device mode for clean up hence |
| 659 | * there is no issue even if success is returned. |
| 660 | */ |
| 661 | if (0 == WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter)) |
| 662 | { |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 663 | mutex_unlock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 664 | return 0; |
| 665 | } |
| 666 | /* Check for the valid pHddTdlsCtx. If valid do not further |
| 667 | * allocate the memory, rather continue with the initialization. |
| 668 | * If tdls_initialization would get reinvoked without tdls_exit |
| 669 | * getting invoked (SSR) there is no point to further proceed |
| 670 | * with the memory allocations. |
| 671 | */ |
| 672 | if (NULL == pAdapter->sessionCtx.station.pHddTdlsCtx) |
| 673 | { |
| 674 | pHddTdlsCtx = vos_mem_malloc(sizeof(tdlsCtx_t)); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 675 | |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 676 | if (NULL == pHddTdlsCtx) { |
| 677 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s malloc failed!", __func__); |
| 678 | pAdapter->sessionCtx.station.pHddTdlsCtx = NULL; |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 679 | mutex_unlock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 680 | return -1; |
| 681 | } |
| 682 | /* initialize TDLS pAdater context */ |
| 683 | vos_mem_zero(pHddTdlsCtx, sizeof(tdlsCtx_t)); |
| 684 | #ifdef TDLS_USE_SEPARATE_DISCOVERY_TIMER |
| 685 | vos_timer_init(&pHddTdlsCtx->peerDiscoverTimer, |
| 686 | VOS_TIMER_TYPE_SW, |
| 687 | wlan_hdd_tdls_discover_peer_cb, |
| 688 | pHddTdlsCtx); |
| 689 | #endif |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 690 | |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 691 | vos_timer_init(&pHddTdlsCtx->peerUpdateTimer, |
| 692 | VOS_TIMER_TYPE_SW, |
| 693 | wlan_hdd_tdls_update_peer_cb, |
| 694 | pHddTdlsCtx); |
| 695 | vos_timer_init(&pHddTdlsCtx->peerDiscoveryTimeoutTimer, |
| 696 | VOS_TIMER_TYPE_SW, |
| 697 | wlan_hdd_tdls_discovery_timeout_peer_cb, |
| 698 | pHddTdlsCtx); |
| 699 | |
| 700 | pAdapter->sessionCtx.station.pHddTdlsCtx = pHddTdlsCtx; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 701 | } |
| 702 | |
Madan Mohan Koyyalamudi | 8174692 | 2013-07-17 14:38:51 +0530 | [diff] [blame] | 703 | pHddTdlsCtx = pAdapter->sessionCtx.station.pHddTdlsCtx; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 704 | |
| 705 | /* initialize TDLS global context */ |
| 706 | pHddCtx->connected_peer_count = 0; |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 707 | sme_SetTdlsPowerSaveProhibited(WLAN_HDD_GET_HAL_CTX(pAdapter), 0); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 708 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 709 | pHddCtx->tdls_scan_ctxt.magic = 0; |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 710 | pHddCtx->tdls_scan_ctxt.attempt = 0; |
| 711 | pHddCtx->tdls_scan_ctxt.reject = 0; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 712 | pHddCtx->tdls_scan_ctxt.scan_request = NULL; |
| 713 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 714 | for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
| 715 | { |
| 716 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 717 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
| 718 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
| 719 | sizeof(v_MACADDR_t)) ; |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 720 | } |
| 721 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 722 | pHddTdlsCtx->pAdapter = pAdapter; |
| 723 | |
| 724 | for (i = 0; i < 256; i++) |
| 725 | { |
| 726 | INIT_LIST_HEAD(&pHddTdlsCtx->peer_list[i]); |
| 727 | } |
| 728 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 729 | pHddTdlsCtx->curr_candidate = NULL; |
| 730 | pHddTdlsCtx->magic = 0; |
| 731 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 732 | /* remember configuration even if it is not used right now. it could be used later */ |
| 733 | pHddTdlsCtx->threshold_config.tx_period_t = pHddCtx->cfg_ini->fTDLSTxStatsPeriod; |
| 734 | pHddTdlsCtx->threshold_config.tx_packet_n = pHddCtx->cfg_ini->fTDLSTxPacketThreshold; |
| 735 | pHddTdlsCtx->threshold_config.discovery_period_t = pHddCtx->cfg_ini->fTDLSDiscoveryPeriod; |
| 736 | pHddTdlsCtx->threshold_config.discovery_tries_n = pHddCtx->cfg_ini->fTDLSMaxDiscoveryAttempt; |
| 737 | pHddTdlsCtx->threshold_config.idle_timeout_t = pHddCtx->cfg_ini->fTDLSIdleTimeout; |
| 738 | pHddTdlsCtx->threshold_config.idle_packet_n = pHddCtx->cfg_ini->fTDLSIdlePacketThreshold; |
| 739 | pHddTdlsCtx->threshold_config.rssi_hysteresis = pHddCtx->cfg_ini->fTDLSRSSIHysteresis; |
| 740 | pHddTdlsCtx->threshold_config.rssi_trigger_threshold = pHddCtx->cfg_ini->fTDLSRSSITriggerThreshold; |
| 741 | pHddTdlsCtx->threshold_config.rssi_teardown_threshold = pHddCtx->cfg_ini->fTDLSRSSITeardownThreshold; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 742 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 743 | if (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 744 | { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 745 | pHddCtx->tdls_mode = eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY; |
Hoonki Lee | bf870f3 | 2013-01-19 15:53:30 +0530 | [diff] [blame] | 746 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s TDLS Implicit trigger not enabled!", __func__); |
Hoonki Lee | bf870f3 | 2013-01-19 15:53:30 +0530 | [diff] [blame] | 747 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 748 | else |
| 749 | { |
| 750 | pHddCtx->tdls_mode = eTDLS_SUPPORT_ENABLED; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 751 | } |
Sameer Thalappil | bee426e | 2013-10-30 10:30:30 -0700 | [diff] [blame] | 752 | INIT_WORK(&pHddTdlsCtx->implicit_setup, wlan_hdd_tdls_pre_setup); |
| 753 | INIT_DELAYED_WORK(&pHddCtx->tdls_scan_ctxt.tdls_scan_work, wlan_hdd_tdls_schedule_scan); |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 754 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 755 | |
| 756 | return 0; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 757 | } |
| 758 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 759 | void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 760 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 761 | tdlsCtx_t *pHddTdlsCtx; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 762 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 763 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 764 | /* |
| 765 | * NOTE: The Callers of this function should ensure to acquire the |
| 766 | * tdls_lock to avoid any concurrent access to the Adapter. |
| 767 | */ |
| 768 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 769 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 770 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 771 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 772 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 773 | FL("pHddCtx is not valid")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 774 | return; |
| 775 | } |
| 776 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 777 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 778 | if (NULL == pHddTdlsCtx) |
| 779 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 780 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 781 | FL("pHddTdlsCtx is NULL")); |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 782 | return; |
| 783 | } |
Sameer Thalappil | bee426e | 2013-10-30 10:30:30 -0700 | [diff] [blame] | 784 | #ifdef WLAN_OPEN_SOURCE |
| 785 | cancel_work_sync(&pHddTdlsCtx->implicit_setup); |
| 786 | cancel_delayed_work_sync(&pHddCtx->tdls_scan_ctxt.tdls_scan_work); |
| 787 | #endif |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 788 | |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 789 | /* must stop timer here before freeing peer list, because peerIdleTimer is |
| 790 | part of peer list structure. */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 791 | wlan_hdd_tdls_timers_destroy(pHddTdlsCtx); |
| 792 | wlan_hdd_tdls_free_list(pHddTdlsCtx); |
Chilam Ng | a75d8b6 | 2013-01-29 01:35:59 -0800 | [diff] [blame] | 793 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 794 | wlan_hdd_tdls_free_scan_request(&pHddCtx->tdls_scan_ctxt); |
| 795 | |
Chilam Ng | a75d8b6 | 2013-01-29 01:35:59 -0800 | [diff] [blame] | 796 | vos_mem_free(pHddTdlsCtx); |
| 797 | pHddTdlsCtx = NULL; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 798 | } |
| 799 | |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 800 | /* stop all monitoring timers per Adapter */ |
| 801 | static void wlan_hdd_tdls_monitor_timers_stop(tdlsCtx_t *pHddTdlsCtx) |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 802 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 803 | #ifdef TDLS_USE_SEPARATE_DISCOVERY_TIMER |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 804 | vos_timer_stop(&pHddTdlsCtx->peerDiscoverTimer); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 805 | #endif |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 806 | vos_timer_stop(&pHddTdlsCtx->peerUpdateTimer); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 807 | vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer); |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 808 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 809 | |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 810 | /* stop all per peer timers */ |
| 811 | static void wlan_hdd_tdls_peer_timers_stop(tdlsCtx_t *pHddTdlsCtx) |
| 812 | { |
| 813 | int i; |
| 814 | struct list_head *head; |
| 815 | struct list_head *pos; |
| 816 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 817 | for (i = 0; i < 256; i++) |
| 818 | { |
| 819 | head = &pHddTdlsCtx->peer_list[i]; |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 820 | list_for_each (pos, head) { |
| 821 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 822 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 823 | "%s: " MAC_ADDRESS_STR " -> stop idle timer", |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 824 | __func__, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 825 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 826 | vos_timer_stop ( &curr_peer->peerIdleTimer ); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 827 | vos_timer_stop( &curr_peer->initiatorWaitTimeoutTimer ); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 828 | } |
| 829 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 830 | } |
| 831 | |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 832 | /* stop all the tdls timers running */ |
| 833 | static void wlan_hdd_tdls_timers_stop(tdlsCtx_t *pHddTdlsCtx) |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 834 | { |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 835 | wlan_hdd_tdls_monitor_timers_stop(pHddTdlsCtx); |
| 836 | wlan_hdd_tdls_peer_timers_stop(pHddTdlsCtx); |
| 837 | } |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 838 | |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 839 | static void wlan_hdd_tdls_monitor_timers_destroy(tdlsCtx_t *pHddTdlsCtx) |
| 840 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 841 | #ifdef TDLS_USE_SEPARATE_DISCOVERY_TIMER |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 842 | vos_timer_stop(&pHddTdlsCtx->peerDiscoverTimer); |
| 843 | vos_timer_destroy(&pHddTdlsCtx->peerDiscoverTimer); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 844 | #endif |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 845 | vos_timer_stop(&pHddTdlsCtx->peerUpdateTimer); |
| 846 | vos_timer_destroy(&pHddTdlsCtx->peerUpdateTimer); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 847 | vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer); |
| 848 | vos_timer_destroy(&pHddTdlsCtx->peerDiscoveryTimeoutTimer); |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 849 | } |
| 850 | /*Free all the timers related to the TDLS peer */ |
| 851 | static void wlan_hdd_tdls_peer_timers_destroy(tdlsCtx_t *pHddTdlsCtx) |
| 852 | { |
| 853 | int i; |
| 854 | struct list_head *head; |
| 855 | struct list_head *pos; |
| 856 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 857 | for (i = 0; i < 256; i++) |
| 858 | { |
| 859 | head = &pHddTdlsCtx->peer_list[i]; |
| 860 | |
| 861 | list_for_each (pos, head) { |
| 862 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
| 863 | |
| 864 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 865 | "%s: " MAC_ADDRESS_STR " -> destroy idle timer", |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 866 | __func__, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 867 | MAC_ADDR_ARRAY(curr_peer->peerMac)); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 868 | vos_timer_stop ( &curr_peer->peerIdleTimer ); |
| 869 | vos_timer_destroy ( &curr_peer->peerIdleTimer ); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 870 | vos_timer_stop(&curr_peer->initiatorWaitTimeoutTimer); |
| 871 | vos_timer_destroy(&curr_peer->initiatorWaitTimeoutTimer); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 872 | } |
| 873 | } |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 874 | |
| 875 | } |
| 876 | |
| 877 | /* destroy all the tdls timers running */ |
| 878 | static void wlan_hdd_tdls_timers_destroy(tdlsCtx_t *pHddTdlsCtx) |
| 879 | { |
| 880 | wlan_hdd_tdls_monitor_timers_destroy(pHddTdlsCtx); |
| 881 | wlan_hdd_tdls_peer_timers_destroy(pHddTdlsCtx); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 882 | } |
| 883 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 884 | /* if mac address exist, return pointer |
| 885 | if mac address doesn't exist, create a list and add, return pointer |
| 886 | return NULL if fails to get new mac address |
| 887 | */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 888 | hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter, u8 *mac) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 889 | { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 890 | struct list_head *head; |
| 891 | hddTdlsPeer_t *peer; |
| 892 | u8 key; |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 893 | tdlsCtx_t *pHddTdlsCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 894 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 895 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 896 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 897 | { |
| 898 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 899 | FL("pHddCtx is not valid")); |
| 900 | return 0; |
| 901 | } |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 902 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 903 | /* if already there, just update */ |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 904 | peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 905 | if (peer != NULL) |
| 906 | { |
| 907 | return peer; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 908 | } |
| 909 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 910 | /* not found, allocate and add the list */ |
| 911 | peer = vos_mem_malloc(sizeof(hddTdlsPeer_t)); |
| 912 | if (NULL == peer) { |
| 913 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s peer malloc failed!", __func__); |
| 914 | return NULL; |
| 915 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 916 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 917 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 918 | { |
| 919 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 920 | FL("unable to lock list")); |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 921 | vos_mem_free(peer); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 922 | return NULL; |
| 923 | } |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 924 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 925 | |
| 926 | if (NULL == pHddTdlsCtx) |
| 927 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 928 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 929 | FL("pHddTdlsCtx is NULL")); |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 930 | vos_mem_free(peer); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 931 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 932 | return NULL; |
| 933 | } |
| 934 | |
| 935 | key = wlan_hdd_tdls_hash_key(mac); |
| 936 | head = &pHddTdlsCtx->peer_list[key]; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 937 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 938 | vos_mem_zero(peer, sizeof(hddTdlsPeer_t)); |
| 939 | vos_mem_copy(peer->peerMac, mac, sizeof(peer->peerMac)); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 940 | peer->pHddTdlsCtx = pHddTdlsCtx; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 941 | |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 942 | vos_timer_init(&peer->peerIdleTimer, |
| 943 | VOS_TIMER_TYPE_SW, |
| 944 | wlan_hdd_tdls_idle_cb, |
| 945 | peer); |
| 946 | |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 947 | vos_timer_init(&peer->initiatorWaitTimeoutTimer, |
| 948 | VOS_TIMER_TYPE_SW, |
| 949 | wlan_hdd_tdls_initiator_wait_cb, |
| 950 | peer); |
| 951 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 952 | list_add_tail(&peer->node, head); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 953 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 954 | |
| 955 | return peer; |
| 956 | } |
| 957 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 958 | int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 959 | u8* mac, |
| 960 | tTDLSCapType cap) |
| 961 | { |
| 962 | hddTdlsPeer_t *curr_peer; |
| 963 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 964 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 965 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 966 | { |
| 967 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 968 | "%s: curr_peer is NULL", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 969 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 970 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 971 | |
| 972 | curr_peer->tdls_support = cap; |
| 973 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 974 | return 0; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 975 | } |
| 976 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 977 | void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer, tTDLSLinkStatus status) |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 978 | { |
| 979 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 980 | { |
| 981 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 982 | "%s: curr_peer is NULL", __func__); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 983 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 984 | } |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 985 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 986 | 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] | 987 | MAC_ADDR_ARRAY(curr_peer->peerMac), status); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 988 | |
| 989 | curr_peer->link_status = status; |
| 990 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 991 | } |
| 992 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 993 | void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter, |
| 994 | u8* mac, |
| 995 | tTDLSLinkStatus linkStatus) |
| 996 | { |
| 997 | hddTdlsPeer_t *curr_peer; |
| 998 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 999 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1000 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1001 | { |
| 1002 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1003 | "%s: curr_peer is NULL", __func__); |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1004 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1005 | } |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1006 | |
| 1007 | curr_peer->link_status= linkStatus; |
| 1008 | |
| 1009 | return; |
| 1010 | } |
| 1011 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1012 | 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] | 1013 | { |
| 1014 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1015 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1016 | hdd_context_t *pHddCtx; |
| 1017 | |
| 1018 | if ( NULL == pHddTdlsCtx ) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1019 | { |
| 1020 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1021 | FL("pHddTdlsCtx is NULL")); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1022 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1023 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1024 | |
| 1025 | pHddCtx = WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter); |
| 1026 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1027 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1028 | { |
| 1029 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1030 | FL("pHddCtx is not valid")); |
| 1031 | return 0; |
| 1032 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1033 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1034 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1035 | |
| 1036 | if (NULL == curr_peer) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1037 | { |
| 1038 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1039 | FL("curr_peer is NULL")); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1040 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1041 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1042 | |
| 1043 | if (pHddTdlsCtx->discovery_sent_cnt) |
| 1044 | pHddTdlsCtx->discovery_sent_cnt--; |
| 1045 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1046 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 1047 | { |
| 1048 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1049 | FL("unable to lock list")); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1050 | return -1; |
| 1051 | } |
| 1052 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1053 | wlan_hdd_tdls_check_power_save_prohibited(pAdapter); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1054 | |
| 1055 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1056 | if (0 == pHddTdlsCtx->discovery_sent_cnt) |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1057 | { |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1058 | vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1059 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1060 | |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 1061 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1062 | "Discovery(%u) Response from " MAC_ADDRESS_STR " link_status %d", |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1063 | pHddTdlsCtx->discovery_sent_cnt, MAC_ADDR_ARRAY(curr_peer->peerMac), |
| 1064 | curr_peer->link_status); |
| 1065 | |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1066 | if (eTDLS_LINK_DISCOVERING == curr_peer->link_status) |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 1067 | { |
Shailender Karmuchi | 13c0d08 | 2013-03-26 14:41:39 -0700 | [diff] [blame] | 1068 | /* Since we are here, it means Throughput threshold is alredy met. Make sure RSSI |
| 1069 | threshold is also met before setting up TDLS link*/ |
| 1070 | if ((tANI_S32) curr_peer->rssi > (tANI_S32) pHddTdlsCtx->threshold_config.rssi_trigger_threshold) |
| 1071 | { |
| 1072 | curr_peer->link_status = eTDLS_LINK_DISCOVERED; |
| 1073 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 1074 | "Rssi Threshold met: "MAC_ADDRESS_STR" rssi = %d threshold= %d" , |
| 1075 | MAC_ADDR_ARRAY(curr_peer->peerMac), curr_peer->rssi, |
| 1076 | pHddTdlsCtx->threshold_config.rssi_trigger_threshold); |
| 1077 | cfg80211_tdls_oper_request(pAdapter->dev, curr_peer->peerMac, NL80211_TDLS_SETUP, FALSE, GFP_KERNEL); |
| 1078 | } |
| 1079 | else |
| 1080 | { |
| 1081 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 1082 | "Rssi Threshold not met: "MAC_ADDRESS_STR" rssi = %d threshold = %d ", |
| 1083 | MAC_ADDR_ARRAY(curr_peer->peerMac), curr_peer->rssi, |
| 1084 | pHddTdlsCtx->threshold_config.rssi_trigger_threshold); |
| 1085 | curr_peer->link_status = eTDLS_LINK_IDLE; |
| 1086 | } |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 1087 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1088 | else |
| 1089 | { |
| 1090 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 1091 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1092 | |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 1093 | curr_peer->tdls_support = eTDLS_CAP_SUPPORTED; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1094 | return 0; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1095 | } |
| 1096 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1097 | int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter, |
| 1098 | u8 *mac, |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame^] | 1099 | tCsrStaParams *StaParams, |
| 1100 | tANI_BOOLEAN isBufSta, |
| 1101 | tANI_BOOLEAN isOffChannelSupported) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1102 | { |
| 1103 | hddTdlsPeer_t *curr_peer; |
| 1104 | |
| 1105 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
| 1106 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1107 | { |
| 1108 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1109 | "%s: curr_peer is NULL", __func__); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1110 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1111 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1112 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame^] | 1113 | curr_peer->uapsdQueues = StaParams->uapsd_queues; |
| 1114 | curr_peer->maxSp = StaParams->max_sp; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1115 | curr_peer->isBufSta = isBufSta; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame^] | 1116 | curr_peer->isOffChannelSupported = isOffChannelSupported; |
| 1117 | |
| 1118 | vos_mem_copy(curr_peer->supported_channels, |
| 1119 | StaParams->supported_channels, |
| 1120 | StaParams->supported_channels_len); |
| 1121 | |
| 1122 | curr_peer->supported_channels_len = |
| 1123 | StaParams->supported_channels_len; |
| 1124 | |
| 1125 | vos_mem_copy(curr_peer->supported_oper_classes, |
| 1126 | StaParams->supported_oper_classes, |
| 1127 | StaParams->supported_oper_classes_len); |
| 1128 | |
| 1129 | curr_peer->supported_oper_classes_len = |
| 1130 | StaParams->supported_oper_classes_len; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1131 | return 0; |
| 1132 | } |
| 1133 | |
| 1134 | int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter, u8 *mac, |
| 1135 | tCsrTdlsLinkEstablishParams* tdlsLinkEstablishParams) |
| 1136 | { |
| 1137 | hddTdlsPeer_t *curr_peer; |
| 1138 | |
| 1139 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
| 1140 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1141 | { |
| 1142 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1143 | "%s: curr_peer is NULL", __func__); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1144 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1145 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1146 | |
| 1147 | tdlsLinkEstablishParams->isResponder = curr_peer->is_responder; |
| 1148 | tdlsLinkEstablishParams->uapsdQueues = curr_peer->uapsdQueues; |
| 1149 | tdlsLinkEstablishParams->maxSp = curr_peer->maxSp; |
| 1150 | tdlsLinkEstablishParams->isBufSta = curr_peer->isBufSta; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame^] | 1151 | tdlsLinkEstablishParams->isOffChannelSupported = |
| 1152 | curr_peer->isOffChannelSupported; |
| 1153 | |
| 1154 | vos_mem_copy(tdlsLinkEstablishParams->supportedChannels, |
| 1155 | curr_peer->supported_channels, |
| 1156 | curr_peer->supported_channels_len); |
| 1157 | |
| 1158 | tdlsLinkEstablishParams->supportedChannelsLen = |
| 1159 | curr_peer->supported_channels_len; |
| 1160 | |
| 1161 | vos_mem_copy(tdlsLinkEstablishParams->supportedOperClasses, |
| 1162 | curr_peer->supported_oper_classes, |
| 1163 | curr_peer->supported_oper_classes_len); |
| 1164 | |
| 1165 | tdlsLinkEstablishParams->supportedOperClassesLen = |
| 1166 | curr_peer->supported_oper_classes_len; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1167 | return 0; |
| 1168 | } |
| 1169 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1170 | int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, u8 *mac, tANI_S8 rxRssi) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1171 | { |
| 1172 | hddTdlsPeer_t *curr_peer; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1173 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1174 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1175 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1176 | { |
| 1177 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1178 | "%s: curr_peer is NULL", __func__); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1179 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1180 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1181 | |
| 1182 | curr_peer->rssi = rxRssi; |
| 1183 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1184 | return 0; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1185 | } |
| 1186 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1187 | int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 responder) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1188 | { |
| 1189 | hddTdlsPeer_t *curr_peer; |
| 1190 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1191 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1192 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1193 | { |
| 1194 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1195 | "%s: curr_peer is NULL", __func__); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1196 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1197 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1198 | |
| 1199 | curr_peer->is_responder = responder; |
| 1200 | |
| 1201 | return 0; |
| 1202 | } |
| 1203 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1204 | int wlan_hdd_tdls_get_responder(hdd_adapter_t *pAdapter, u8 *mac) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1205 | { |
| 1206 | hddTdlsPeer_t *curr_peer; |
| 1207 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1208 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1209 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1210 | { |
| 1211 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1212 | "%s: curr_peer is NULL", __func__); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1213 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1214 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1215 | |
| 1216 | return (curr_peer->is_responder); |
| 1217 | } |
| 1218 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1219 | int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 uSignature) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1220 | { |
| 1221 | hddTdlsPeer_t *curr_peer; |
| 1222 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1223 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1224 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1225 | { |
| 1226 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1227 | "%s: curr_peer is NULL", __func__); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1228 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1229 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1230 | |
| 1231 | curr_peer->signature = uSignature; |
| 1232 | |
| 1233 | return 0; |
| 1234 | } |
| 1235 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1236 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1237 | void wlan_hdd_tdls_extract_da(struct sk_buff *skb, u8 *mac) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1238 | { |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1239 | memcpy(mac, skb->data, 6); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1240 | } |
| 1241 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1242 | void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, u8 *mac) |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 1243 | { |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 1244 | memcpy(mac, skb->data+6, 6); |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 1245 | } |
| 1246 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1247 | int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter, u8 *mac, u8 tx) |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1248 | { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1249 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1250 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1251 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1252 | if (eTDLS_SUPPORT_ENABLED != pHddCtx->tdls_mode) |
| 1253 | return -1; |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 1254 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1255 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1256 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1257 | { |
| 1258 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1259 | "%s: curr_peer is NULL", __func__); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1260 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1261 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1262 | |
Chilam Ng | 1279e23 | 2013-01-25 15:06:52 -0800 | [diff] [blame] | 1263 | if (tx) |
| 1264 | curr_peer->tx_pkt++; |
| 1265 | else |
| 1266 | curr_peer->rx_pkt++; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1267 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1268 | return 0; |
| 1269 | } |
| 1270 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1271 | static int wlan_hdd_tdls_check_config(tdls_config_params_t *config) |
| 1272 | { |
| 1273 | if (config->tdls > 2) |
| 1274 | { |
| 1275 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 1st argument %d. <0...2>", __func__, config->tdls); |
| 1276 | return -1; |
| 1277 | } |
| 1278 | if (config->tx_period_t < CFG_TDLS_TX_STATS_PERIOD_MIN || |
| 1279 | config->tx_period_t > CFG_TDLS_TX_STATS_PERIOD_MAX) |
| 1280 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1281 | 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] | 1282 | CFG_TDLS_TX_STATS_PERIOD_MIN, CFG_TDLS_TX_STATS_PERIOD_MAX); |
| 1283 | return -1; |
| 1284 | } |
| 1285 | if (config->tx_packet_n < CFG_TDLS_TX_PACKET_THRESHOLD_MIN || |
| 1286 | config->tx_packet_n > CFG_TDLS_TX_PACKET_THRESHOLD_MAX) |
| 1287 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1288 | 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] | 1289 | CFG_TDLS_TX_PACKET_THRESHOLD_MIN, CFG_TDLS_TX_PACKET_THRESHOLD_MAX); |
| 1290 | return -1; |
| 1291 | } |
| 1292 | if (config->discovery_period_t < CFG_TDLS_DISCOVERY_PERIOD_MIN || |
| 1293 | config->discovery_period_t > CFG_TDLS_DISCOVERY_PERIOD_MAX) |
| 1294 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 1295 | 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] | 1296 | CFG_TDLS_DISCOVERY_PERIOD_MIN, CFG_TDLS_DISCOVERY_PERIOD_MAX); |
| 1297 | return -1; |
| 1298 | } |
| 1299 | if (config->discovery_tries_n < CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN || |
| 1300 | config->discovery_tries_n > CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MAX) |
| 1301 | { |
| 1302 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 5th argument %d. <%d...%d>", __func__, config->discovery_tries_n, |
| 1303 | CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN, CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MAX); |
| 1304 | return -1; |
| 1305 | } |
| 1306 | if (config->idle_timeout_t < CFG_TDLS_IDLE_TIMEOUT_MIN || |
| 1307 | config->idle_timeout_t > CFG_TDLS_IDLE_TIMEOUT_MAX) |
| 1308 | { |
| 1309 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 6th argument %d. <%d...%d>", __func__, config->idle_timeout_t, |
| 1310 | CFG_TDLS_IDLE_TIMEOUT_MIN, CFG_TDLS_IDLE_TIMEOUT_MAX); |
| 1311 | return -1; |
| 1312 | } |
| 1313 | if (config->idle_packet_n < CFG_TDLS_IDLE_PACKET_THRESHOLD_MIN || |
| 1314 | config->idle_packet_n > CFG_TDLS_IDLE_PACKET_THRESHOLD_MAX) |
| 1315 | { |
| 1316 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 7th argument %d. <%d...%d>", __func__, config->idle_packet_n, |
| 1317 | CFG_TDLS_IDLE_PACKET_THRESHOLD_MIN, CFG_TDLS_IDLE_PACKET_THRESHOLD_MAX); |
| 1318 | return -1; |
| 1319 | } |
| 1320 | if (config->rssi_hysteresis < CFG_TDLS_RSSI_HYSTERESIS_MIN || |
| 1321 | config->rssi_hysteresis > CFG_TDLS_RSSI_HYSTERESIS_MAX) |
| 1322 | { |
| 1323 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 8th argument %d. <%d...%d>", __func__, config->rssi_hysteresis, |
| 1324 | CFG_TDLS_RSSI_HYSTERESIS_MIN, CFG_TDLS_RSSI_HYSTERESIS_MAX); |
| 1325 | return -1; |
| 1326 | } |
| 1327 | if (config->rssi_trigger_threshold < CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MIN || |
| 1328 | config->rssi_trigger_threshold > CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MAX) |
| 1329 | { |
| 1330 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 9th argument %d. <%d...%d>", __func__, config->rssi_trigger_threshold, |
| 1331 | CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MIN, CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MAX); |
| 1332 | return -1; |
| 1333 | } |
| 1334 | if (config->rssi_teardown_threshold < CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MIN || |
| 1335 | config->rssi_teardown_threshold > CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MAX) |
| 1336 | { |
| 1337 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s invalid 10th argument %d. <%d...%d>", __func__, config->rssi_teardown_threshold, |
| 1338 | CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MIN, CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MAX); |
| 1339 | return -1; |
| 1340 | } |
| 1341 | return 0; |
| 1342 | } |
| 1343 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1344 | 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] | 1345 | { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1346 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1347 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1348 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1349 | eTDLSSupportMode req_tdls_mode; |
Hoonki Lee | bfee034 | 2013-01-21 16:43:45 -0800 | [diff] [blame] | 1350 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1351 | if (NULL == pHddTdlsCtx) |
| 1352 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1353 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS not enabled!")); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1354 | return -1; |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1355 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1356 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1357 | if (wlan_hdd_tdls_check_config(config) != 0) |
| 1358 | { |
| 1359 | return -1; |
| 1360 | } |
| 1361 | |
| 1362 | /* config->tdls is mapped to 0->1, 1->2, 2->3 */ |
| 1363 | req_tdls_mode = config->tdls + 1; |
| 1364 | if (pHddCtx->tdls_mode == req_tdls_mode) |
| 1365 | { |
| 1366 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s already in mode %d", __func__, config->tdls); |
| 1367 | return -1; |
| 1368 | } |
| 1369 | |
| 1370 | /* copy the configuration only when given tdls mode is implicit trigger enable */ |
| 1371 | if (eTDLS_SUPPORT_ENABLED == req_tdls_mode) |
| 1372 | { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1373 | memcpy(&pHddTdlsCtx->threshold_config, config, sizeof(tdls_config_params_t)); |
| 1374 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1375 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1376 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1377 | "iw set tdls params: %d %d %d %d %d %d %d %d %d %d", |
| 1378 | config->tdls, |
| 1379 | config->tx_period_t, |
| 1380 | config->tx_packet_n, |
| 1381 | config->discovery_period_t, |
| 1382 | config->discovery_tries_n, |
| 1383 | config->idle_timeout_t, |
| 1384 | config->idle_packet_n, |
| 1385 | config->rssi_hysteresis, |
| 1386 | config->rssi_trigger_threshold, |
| 1387 | config->rssi_teardown_threshold); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1388 | |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 1389 | wlan_hdd_tdls_set_mode(pHddCtx, req_tdls_mode, TRUE); |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1390 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1391 | return 0; |
| 1392 | } |
| 1393 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1394 | int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, u8 *mac, u8 staId) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1395 | { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1396 | hddTdlsPeer_t *curr_peer; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1397 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1398 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1399 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1400 | { |
| 1401 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1402 | "%s: curr_peer is NULL", __func__); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1403 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1404 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1405 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1406 | curr_peer->staId = staId; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1407 | |
| 1408 | return 0; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1409 | } |
| 1410 | |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 1411 | int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter, u8 *mac, |
| 1412 | tANI_BOOLEAN forcePeer) |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 1413 | { |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 1414 | hddTdlsPeer_t *curr_peer; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 1415 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1416 | |
| 1417 | if ((NULL == pHddCtx)) return -1; |
| 1418 | |
| 1419 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 1420 | { |
| 1421 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1422 | "%s: unable to lock list", __func__); |
| 1423 | return -1; |
| 1424 | } |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 1425 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
| 1426 | if (curr_peer == NULL) |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 1427 | goto error; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 1428 | curr_peer->isForcedPeer = forcePeer; |
Naresh Jayaram | ca7bc3a | 2014-02-04 23:03:04 +0530 | [diff] [blame] | 1429 | |
| 1430 | mutex_unlock(&pHddCtx->tdls_lock); |
| 1431 | return 0; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 1432 | error: |
| 1433 | mutex_unlock(&pHddCtx->tdls_lock); |
| 1434 | return -1; |
| 1435 | } |
| 1436 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1437 | /* if peerMac is found, then it returns pointer to hddTdlsPeer_t |
| 1438 | otherwise, it returns NULL |
| 1439 | */ |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1440 | hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter, u8 *mac, |
| 1441 | tANI_BOOLEAN mutexLock) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1442 | { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1443 | u8 key; |
| 1444 | struct list_head *pos; |
| 1445 | struct list_head *head; |
| 1446 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1447 | tdlsCtx_t *pHddTdlsCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1448 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1449 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1450 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1451 | { |
| 1452 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1453 | FL("pHddCtx is not valid")); |
| 1454 | return 0; |
| 1455 | } |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1456 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1457 | if ( mutexLock ) |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1458 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1459 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 1460 | { |
| 1461 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1462 | FL("unable to lock list")); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1463 | return NULL; |
| 1464 | } |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1465 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1466 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1467 | if (NULL == pHddTdlsCtx) |
| 1468 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1469 | if ( mutexLock ) |
| 1470 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1471 | return NULL; |
| 1472 | } |
| 1473 | |
| 1474 | key = wlan_hdd_tdls_hash_key(mac); |
| 1475 | |
| 1476 | head = &pHddTdlsCtx->peer_list[key]; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1477 | |
| 1478 | list_for_each(pos, head) { |
| 1479 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
| 1480 | if (!memcmp(mac, curr_peer->peerMac, 6)) { |
| 1481 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1482 | "findTdlsPeer: found staId %d", curr_peer->staId); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1483 | if ( mutexLock ) |
| 1484 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1485 | return curr_peer; |
| 1486 | } |
| 1487 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1488 | if ( mutexLock ) |
| 1489 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1490 | return NULL; |
| 1491 | } |
| 1492 | |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1493 | hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx, u8 *mac) |
| 1494 | { |
| 1495 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 1496 | hdd_adapter_t *pAdapter = NULL; |
| 1497 | tdlsCtx_t *pHddTdlsCtx = NULL; |
| 1498 | hddTdlsPeer_t *curr_peer= NULL; |
| 1499 | VOS_STATUS status = 0; |
| 1500 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1501 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 1502 | { |
| 1503 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1504 | FL("unable to lock list")); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1505 | return NULL; |
| 1506 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1507 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 1508 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 1509 | { |
| 1510 | pAdapter = pAdapterNode->pAdapter; |
| 1511 | |
| 1512 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 1513 | if (NULL != pHddTdlsCtx) |
| 1514 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1515 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1516 | if (curr_peer) |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1517 | { |
| 1518 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1519 | return curr_peer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1520 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1521 | } |
| 1522 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 1523 | pAdapterNode = pNext; |
| 1524 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1525 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 1526 | return curr_peer; |
| 1527 | } |
| 1528 | |
| 1529 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1530 | int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, u8 *mac) |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1531 | { |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1532 | hdd_context_t *pHddCtx; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1533 | hddTdlsPeer_t *curr_peer; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1534 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1535 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 1536 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1537 | curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1538 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1539 | { |
| 1540 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1541 | "%s: curr_peer is NULL", __func__); |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1542 | return -1; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1543 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 1544 | |
Gopichand Nakkala | 901e892 | 2013-03-04 23:45:58 -0800 | [diff] [blame] | 1545 | curr_peer->link_status = eTDLS_LINK_IDLE; |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 1546 | curr_peer->staId = 0; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1547 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1548 | if(eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode) { |
Chilam Ng | a75d8b6 | 2013-01-29 01:35:59 -0800 | [diff] [blame] | 1549 | vos_timer_stop( &curr_peer->peerIdleTimer ); |
Chilam Ng | a75d8b6 | 2013-01-29 01:35:59 -0800 | [diff] [blame] | 1550 | } |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1551 | return 0; |
Hoonki Lee | cdd8e96 | 2013-01-20 00:45:46 -0800 | [diff] [blame] | 1552 | } |
| 1553 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 1554 | /* Caller has to take the lock before calling this function */ |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1555 | static void wlan_tdd_tdls_reset_tx_rx(tdlsCtx_t *pHddTdlsCtx) |
| 1556 | { |
| 1557 | int i; |
| 1558 | struct list_head *head; |
| 1559 | hddTdlsPeer_t *tmp; |
| 1560 | struct list_head *pos, *q; |
| 1561 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1562 | for (i = 0; i < 256; i++) { |
| 1563 | head = &pHddTdlsCtx->peer_list[i]; |
| 1564 | list_for_each_safe (pos, q, head) { |
| 1565 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
| 1566 | tmp->tx_pkt = 0; |
| 1567 | tmp->rx_pkt = 0; |
| 1568 | } |
| 1569 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1570 | |
| 1571 | return ; |
| 1572 | } |
| 1573 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 1574 | /* Caller has to take the lock before calling this function */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1575 | 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] | 1576 | { |
| 1577 | int i; |
| 1578 | struct list_head *head; |
| 1579 | hddTdlsPeer_t *tmp; |
| 1580 | struct list_head *pos, *q; |
| 1581 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1582 | pHddTdlsCtx->discovery_peer_cnt = 0; |
| 1583 | |
| 1584 | for (i = 0; i < 256; i++) { |
| 1585 | head = &pHddTdlsCtx->peer_list[i]; |
| 1586 | list_for_each_safe (pos, q, head) { |
| 1587 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
| 1588 | tmp->discovery_processed = 0; |
| 1589 | } |
| 1590 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1591 | |
| 1592 | return 0; |
| 1593 | } |
| 1594 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1595 | 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] | 1596 | { |
| 1597 | int i; |
| 1598 | struct list_head *head; |
| 1599 | struct list_head *pos, *q; |
| 1600 | int discovery_peer_cnt=0; |
| 1601 | hddTdlsPeer_t *tmp; |
| 1602 | |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1603 | /* |
| 1604 | * This function expects the callers to acquire the Mutex. |
| 1605 | */ |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1606 | |
| 1607 | for (i = 0; i < 256; i++) { |
| 1608 | head = &pHddTdlsCtx->peer_list[i]; |
| 1609 | list_for_each_safe (pos, q, head) { |
| 1610 | tmp = list_entry(pos, hddTdlsPeer_t, node); |
| 1611 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1612 | "%s, %d, " MAC_ADDRESS_STR, __func__, i, |
| 1613 | MAC_ADDR_ARRAY(tmp->peerMac)); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1614 | discovery_peer_cnt++; |
| 1615 | } |
| 1616 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1617 | return discovery_peer_cnt; |
| 1618 | } |
| 1619 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1620 | tANI_U16 wlan_hdd_tdlsConnectedPeers(hdd_adapter_t *pAdapter) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 1621 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1622 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1623 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1624 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1625 | { |
| 1626 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1627 | FL("pHddCtx is not valid")); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1628 | return 0; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1629 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 1630 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1631 | return pHddCtx->connected_peer_count; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 1632 | } |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1633 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1634 | 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] | 1635 | { |
| 1636 | int i; |
| 1637 | int len, init_len; |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1638 | struct list_head *head; |
| 1639 | struct list_head *pos; |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1640 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1641 | tdlsCtx_t *pHddTdlsCtx; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1642 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1643 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1644 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1645 | { |
| 1646 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1647 | FL("pHddCtx is not valid")); |
| 1648 | return 0; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1649 | } |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1650 | |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1651 | init_len = buflen; |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 1652 | len = scnprintf(buf, buflen, "\n%-18s%-3s%-4s%-3s%-5s\n", |
| 1653 | "MAC", "Id", "cap", "up", "RSSI"); |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1654 | buf += len; |
| 1655 | buflen -= len; |
| 1656 | /* 1234567890123456789012345678901234567 */ |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 1657 | len = scnprintf(buf, buflen, "---------------------------------\n"); |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1658 | buf += len; |
| 1659 | buflen -= len; |
| 1660 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1661 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1662 | { |
| 1663 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1664 | FL("unable to lock list")); |
Gopichand Nakkala | 91b0926 | 2013-02-10 14:27:02 -0800 | [diff] [blame] | 1665 | return init_len-buflen; |
| 1666 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1667 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1668 | if (NULL == pHddTdlsCtx) { |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1669 | mutex_unlock(&pHddCtx->tdls_lock); |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 1670 | len = scnprintf(buf, buflen, "TDLS not enabled\n"); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1671 | return len; |
| 1672 | } |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1673 | for (i = 0; i < 256; i++) { |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1674 | head = &pHddTdlsCtx->peer_list[i]; |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1675 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1676 | list_for_each(pos, head) { |
| 1677 | curr_peer= list_entry (pos, hddTdlsPeer_t, node); |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1678 | |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1679 | if (buflen < 32+1) |
| 1680 | break; |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 1681 | len = scnprintf(buf, buflen, |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 1682 | MAC_ADDRESS_STR"%3d%4s%3s%5d\n", |
| 1683 | MAC_ADDR_ARRAY(curr_peer->peerMac), |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1684 | curr_peer->staId, |
| 1685 | (curr_peer->tdls_support == eTDLS_CAP_SUPPORTED) ? "Y":"N", |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 1686 | TDLS_IS_CONNECTED(curr_peer) ? "Y":"N", |
Hoonki Lee | 387663d | 2013-02-05 18:08:43 -0800 | [diff] [blame] | 1687 | curr_peer->rssi); |
| 1688 | buf += len; |
| 1689 | buflen -= len; |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1690 | } |
| 1691 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1692 | mutex_unlock(&pHddCtx->tdls_lock); |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 1693 | return init_len-buflen; |
| 1694 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1695 | |
| 1696 | void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter) |
| 1697 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1698 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1699 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 9d76a9b | 2013-02-28 15:38:37 -0800 | [diff] [blame] | 1700 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1701 | if ((NULL == pHddCtx) || (NULL == pHddTdlsCtx)) |
| 1702 | { |
| 1703 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1704 | FL(" pHddCtx or pHddTdlsCtx points to NULL")); |
| 1705 | return; |
| 1706 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1707 | |
| 1708 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 1709 | { |
| 1710 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1711 | FL("unable to lock list")); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 1712 | return; |
| 1713 | } |
| 1714 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1715 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 1716 | "%s, update %d discover %d", __func__, |
| 1717 | pHddTdlsCtx->threshold_config.tx_period_t, |
| 1718 | pHddTdlsCtx->threshold_config.discovery_period_t); |
| 1719 | |
Gopichand Nakkala | 9d76a9b | 2013-02-28 15:38:37 -0800 | [diff] [blame] | 1720 | if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode) |
| 1721 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1722 | wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1723 | pHddTdlsCtx->discovery_sent_cnt = 0; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1724 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1725 | |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1726 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 1727 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 1728 | &pHddTdlsCtx->peerDiscoverTimer, |
| 1729 | pHddTdlsCtx->threshold_config.discovery_period_t); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1730 | #endif |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 1731 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 1732 | &pHddTdlsCtx->peerUpdateTimer, |
| 1733 | pHddTdlsCtx->threshold_config.tx_period_t); |
Gopichand Nakkala | 9d76a9b | 2013-02-28 15:38:37 -0800 | [diff] [blame] | 1734 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1735 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1736 | |
| 1737 | } |
| 1738 | |
| 1739 | void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter) |
| 1740 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1741 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1742 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1743 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1744 | if ((NULL == pHddCtx) || (NULL == pHddTdlsCtx)) |
| 1745 | { |
| 1746 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1747 | FL(" pHddCtx or pHddTdlsCtx points to NULL")); |
| 1748 | return; |
| 1749 | } |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1750 | |
| 1751 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"%s", __func__); |
| 1752 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1753 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1754 | { |
| 1755 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1756 | FL("unable to lock list")); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1757 | return; |
| 1758 | } |
| 1759 | if (NULL == pHddTdlsCtx) |
| 1760 | { |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1761 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1762 | FL("pHddTdlsCtx is NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1763 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1764 | return; |
| 1765 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1766 | pHddTdlsCtx->discovery_sent_cnt = 0; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1767 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1768 | |
Madan Mohan Koyyalamudi | 693275b | 2013-07-22 19:14:09 +0530 | [diff] [blame] | 1769 | wlan_hdd_tdls_monitor_timers_stop(pHddTdlsCtx); |
| 1770 | wlan_hdd_tdls_peer_timers_destroy(pHddTdlsCtx); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1771 | wlan_hdd_tdls_free_list(pHddTdlsCtx); |
Gopichand Nakkala | eb69b60 | 2013-02-27 11:40:31 -0800 | [diff] [blame] | 1772 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1773 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1774 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1775 | |
| 1776 | void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter, tANI_U32 statusCode) |
| 1777 | { |
| 1778 | pAdapter->mgmtTxCompletionStatus = statusCode; |
| 1779 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"%s: Mgmt TX Completion %d", |
| 1780 | __func__, statusCode); |
| 1781 | complete(&pAdapter->tdls_mgmt_comp); |
| 1782 | } |
| 1783 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1784 | void wlan_hdd_tdls_increment_peer_count(hdd_adapter_t *pAdapter) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1785 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1786 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1787 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1788 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1789 | { |
| 1790 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1791 | FL("pHddCtx is not valid")); |
| 1792 | return; |
| 1793 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1794 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1795 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 1796 | { |
| 1797 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1798 | FL("unable to lock list")); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1799 | return; |
| 1800 | } |
| 1801 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1802 | pHddCtx->connected_peer_count++; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1803 | wlan_hdd_tdls_check_power_save_prohibited(pAdapter); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1804 | |
| 1805 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: %d", |
| 1806 | __func__, pHddCtx->connected_peer_count); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1807 | |
| 1808 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1809 | } |
| 1810 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1811 | void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1812 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1813 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1814 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1815 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 1816 | { |
| 1817 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1818 | FL("pHddCtx is not valid")); |
| 1819 | return; |
| 1820 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1821 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1822 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 1823 | { |
| 1824 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1825 | FL("unable to lock list")); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1826 | return; |
| 1827 | } |
| 1828 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1829 | if (pHddCtx->connected_peer_count) |
| 1830 | pHddCtx->connected_peer_count--; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1831 | wlan_hdd_tdls_check_power_save_prohibited(pAdapter); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1832 | |
| 1833 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: %d", |
| 1834 | __func__, pHddCtx->connected_peer_count); |
| 1835 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1836 | mutex_unlock(&pHddCtx->tdls_lock); |
| 1837 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1838 | } |
| 1839 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1840 | void wlan_hdd_tdls_check_bmps(hdd_adapter_t *pAdapter) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1841 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1842 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1843 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 1844 | hddTdlsPeer_t *curr_peer; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1845 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1846 | if ((NULL == pHddCtx) || (NULL == pHddTdlsCtx)) |
| 1847 | { |
| 1848 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1849 | FL(" pHddCtx or pHddTdlsCtx points to NULL")); |
| 1850 | return; |
| 1851 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1852 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1853 | curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 1854 | if (NULL != curr_peer) |
| 1855 | { |
| 1856 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 1857 | "%s: tdls in progress. Dont check for BMPS " MAC_ADDRESS_STR, |
| 1858 | __func__, MAC_ADDR_ARRAY (curr_peer->peerMac)); |
| 1859 | return; |
| 1860 | } |
| 1861 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 1862 | if ((TDLS_CTX_MAGIC != pHddCtx->tdls_scan_ctxt.magic) && |
| 1863 | (0 == pHddCtx->connected_peer_count) && |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1864 | (0 == pHddTdlsCtx->discovery_sent_cnt)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1865 | { |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1866 | if (FALSE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 1867 | { |
| 1868 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1869 | "%s: No TDLS peer connected/discovery sent. Enable BMPS", |
| 1870 | __func__); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1871 | hdd_enable_bmps_imps(pHddCtx); |
| 1872 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1873 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1874 | else |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1875 | { |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1876 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 1877 | { |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1878 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 1879 | "%s: TDLS peer connected. Disable BMPS", __func__); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1880 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 1881 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1882 | } |
| 1883 | return; |
| 1884 | } |
| 1885 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1886 | u8 wlan_hdd_tdls_is_peer_progress(hdd_adapter_t *pAdapter, u8 *mac) |
| 1887 | { |
| 1888 | hddTdlsPeer_t *curr_peer; |
| 1889 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1890 | curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1891 | if (curr_peer == NULL) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1892 | { |
| 1893 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1894 | "%s: curr_peer is NULL", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1895 | return 0; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1896 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1897 | |
| 1898 | return (eTDLS_LINK_CONNECTING == curr_peer->link_status); |
| 1899 | } |
| 1900 | |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 1901 | /* return pointer to hddTdlsPeer_t if TDLS is ongoing. Otherwise return NULL. |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1902 | * mac - if NULL check for all the peer list, otherwise, skip this mac when skip_self is TRUE |
| 1903 | * skip_self - if TRUE, skip this mac. otherwise, check all the peer list. if |
| 1904 | mac is NULL, this argument is ignored, and check for all the peer list. |
| 1905 | */ |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1906 | static hddTdlsPeer_t *wlan_hdd_tdls_find_progress_peer(hdd_adapter_t *pAdapter, u8 *mac, u8 skip_self) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1907 | { |
| 1908 | int i; |
| 1909 | struct list_head *head; |
| 1910 | hddTdlsPeer_t *curr_peer; |
| 1911 | struct list_head *pos; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1912 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);; |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1913 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1914 | if (NULL == pHddTdlsCtx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1915 | { |
| 1916 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1917 | FL("pHddTdlsCtx is NULL")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1918 | return NULL; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 1919 | } |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 1920 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1921 | for (i = 0; i < 256; i++) { |
| 1922 | head = &pHddTdlsCtx->peer_list[i]; |
| 1923 | list_for_each(pos, head) { |
| 1924 | curr_peer = list_entry (pos, hddTdlsPeer_t, node); |
| 1925 | if (skip_self && mac && !memcmp(mac, curr_peer->peerMac, 6)) { |
| 1926 | continue; |
| 1927 | } |
| 1928 | else |
| 1929 | { |
Gopichand Nakkala | 8b00c63 | 2013-03-08 19:47:52 -0800 | [diff] [blame] | 1930 | if (eTDLS_LINK_CONNECTING == curr_peer->link_status) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1931 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 1932 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1933 | "%s:" MAC_ADDRESS_STR " eTDLS_LINK_CONNECTING", |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 1934 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac)); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 1935 | return curr_peer; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1936 | } |
| 1937 | } |
| 1938 | } |
| 1939 | } |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 1940 | return NULL; |
| 1941 | } |
| 1942 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1943 | hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx, u8 *mac, u8 skip_self) |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 1944 | { |
| 1945 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 1946 | hdd_adapter_t *pAdapter = NULL; |
| 1947 | tdlsCtx_t *pHddTdlsCtx = NULL; |
| 1948 | hddTdlsPeer_t *curr_peer= NULL; |
| 1949 | VOS_STATUS status = 0; |
| 1950 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1951 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 1952 | { |
| 1953 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1954 | "%s: unable to lock list", __func__); |
| 1955 | return NULL; |
| 1956 | } |
| 1957 | |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 1958 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 1959 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 1960 | { |
| 1961 | pAdapter = pAdapterNode->pAdapter; |
| 1962 | |
| 1963 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 1964 | if (NULL != pHddTdlsCtx) |
| 1965 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1966 | curr_peer = wlan_hdd_tdls_find_progress_peer(pAdapter, mac, skip_self); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 1967 | if (curr_peer) |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1968 | { |
| 1969 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 1970 | return curr_peer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1971 | } |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 1972 | } |
| 1973 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 1974 | pAdapterNode = pNext; |
| 1975 | } |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 1976 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 1977 | return NULL; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1978 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1979 | |
| 1980 | static void wlan_hdd_tdls_implicit_disable(tdlsCtx_t *pHddTdlsCtx) |
| 1981 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1982 | wlan_hdd_tdls_timers_stop(pHddTdlsCtx); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1983 | } |
| 1984 | |
| 1985 | static void wlan_hdd_tdls_implicit_enable(tdlsCtx_t *pHddTdlsCtx) |
| 1986 | { |
| 1987 | wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1988 | pHddTdlsCtx->discovery_sent_cnt = 0; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1989 | wlan_tdd_tdls_reset_tx_rx(pHddTdlsCtx); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 1990 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 1991 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 1992 | |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1993 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 1994 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 1995 | &pHddTdlsCtx->peerDiscoverTimer, |
| 1996 | pHddTdlsCtx->threshold_config.discovery_period_t); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 1997 | #endif |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 1998 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 1999 | &pHddTdlsCtx->peerUpdateTimer, |
| 2000 | pHddTdlsCtx->threshold_config.tx_period_t); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2001 | } |
| 2002 | |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 2003 | void wlan_hdd_tdls_set_mode(hdd_context_t *pHddCtx, |
| 2004 | eTDLSSupportMode tdls_mode, |
| 2005 | v_BOOL_t bUpdateLast) |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2006 | { |
| 2007 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 2008 | VOS_STATUS status; |
| 2009 | hdd_adapter_t *pAdapter; |
| 2010 | tdlsCtx_t *pHddTdlsCtx; |
| 2011 | |
| 2012 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"%s mode %d", __func__, (int)tdls_mode); |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2013 | |
| 2014 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2015 | { |
| 2016 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2017 | FL("pHddCtx is not valid")); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2018 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2019 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2020 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2021 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 2022 | { |
| 2023 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2024 | "%s: unable to lock list", __func__); |
| 2025 | return; |
| 2026 | } |
| 2027 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2028 | if (pHddCtx->tdls_mode == tdls_mode) |
| 2029 | { |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 2030 | hddLog(TDLS_LOG_LEVEL, "%s already in mode %d", __func__, (int)tdls_mode); |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2031 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2032 | return; |
| 2033 | } |
| 2034 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2035 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 2036 | |
| 2037 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 2038 | { |
| 2039 | pAdapter = pAdapterNode->pAdapter; |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2040 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2041 | if (NULL != pHddTdlsCtx) |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2042 | { |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2043 | if(eTDLS_SUPPORT_ENABLED == tdls_mode) |
| 2044 | wlan_hdd_tdls_implicit_enable(pHddTdlsCtx); |
| 2045 | else if((eTDLS_SUPPORT_DISABLED == tdls_mode) || |
| 2046 | (eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == tdls_mode)) |
| 2047 | wlan_hdd_tdls_implicit_disable(pHddTdlsCtx); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2048 | } |
| 2049 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 2050 | pAdapterNode = pNext; |
| 2051 | } |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 2052 | if(bUpdateLast) |
| 2053 | { |
| 2054 | pHddCtx->tdls_mode_last = tdls_mode; |
| 2055 | } |
| 2056 | else |
| 2057 | { |
| 2058 | pHddCtx->tdls_mode_last = pHddCtx->tdls_mode; |
| 2059 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2060 | pHddCtx->tdls_mode = tdls_mode; |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 2061 | |
Madan Mohan Koyyalamudi | 263cec1 | 2013-10-07 10:57:50 +0530 | [diff] [blame] | 2062 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 2063 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2064 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2065 | static void wlan_hdd_tdls_pre_setup(struct work_struct *work) |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2066 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2067 | tdlsCtx_t *pHddTdlsCtx = |
| 2068 | container_of(work, tdlsCtx_t, implicit_setup); |
| 2069 | hdd_context_t *pHddCtx; |
| 2070 | hddTdlsPeer_t *curr_peer; |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2071 | hddTdlsPeer_t *temp_peer; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2072 | int status; |
| 2073 | |
| 2074 | if (NULL == pHddTdlsCtx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2075 | { |
| 2076 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2077 | FL("pHddTdlsCtx is NULL")); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2078 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2079 | } |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2080 | |
| 2081 | if (unlikely(TDLS_CTX_MAGIC != pHddTdlsCtx->magic)) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2082 | { |
| 2083 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2084 | "%s: tdls magic no missmatch %u", __func__, pHddTdlsCtx->magic); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2085 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2086 | } |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2087 | |
| 2088 | pHddCtx = WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2089 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2090 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2091 | { |
| 2092 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2093 | FL("pHddCtx is not valid")); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2094 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2095 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2096 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2097 | curr_peer = pHddTdlsCtx->curr_candidate; |
| 2098 | |
| 2099 | if (NULL == curr_peer) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2100 | { |
| 2101 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2102 | FL("curr_peer is NULL")); |
| 2103 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2104 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2105 | } |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2106 | |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2107 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter))) |
| 2108 | { |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2109 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"%s: Disable BMPS", __func__); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2110 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 2111 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2112 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2113 | temp_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2114 | if (NULL != temp_peer) |
| 2115 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2116 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: " MAC_ADDRESS_STR " ongoing. pre_setup ignored", |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2117 | __func__, MAC_ADDR_ARRAY(temp_peer->peerMac)); |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2118 | goto done; |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2119 | } |
| 2120 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2121 | if (eTDLS_CAP_UNKNOWN != curr_peer->tdls_support) |
| 2122 | curr_peer->link_status = eTDLS_LINK_DISCOVERING; |
| 2123 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2124 | status = wlan_hdd_cfg80211_send_tdls_discover_req(pHddTdlsCtx->pAdapter->wdev.wiphy, |
| 2125 | pHddTdlsCtx->pAdapter->dev, |
| 2126 | curr_peer->peerMac); |
| 2127 | |
| 2128 | if (0 != status) |
| 2129 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2130 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: " MAC_ADDRESS_STR " discovery could not sent", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2131 | __func__, MAC_ADDR_ARRAY(curr_peer->peerMac)); |
| 2132 | if (eTDLS_CAP_UNKNOWN != curr_peer->tdls_support) |
| 2133 | curr_peer->link_status = eTDLS_LINK_IDLE; |
| 2134 | goto done; |
| 2135 | } |
| 2136 | |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2137 | pHddTdlsCtx->discovery_sent_cnt++; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2138 | |
| 2139 | if (mutex_lock_interruptible(&pHddCtx->tdls_lock)) |
| 2140 | { |
| 2141 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2142 | "%s: unable to lock list", __func__); |
| 2143 | return; |
| 2144 | } |
| 2145 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2146 | wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2147 | |
| 2148 | mutex_unlock(&pHddCtx->tdls_lock); |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2149 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: discovery count %u timeout %u msec", |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2150 | __func__, pHddTdlsCtx->discovery_sent_cnt, |
| 2151 | pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE); |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2152 | |
| 2153 | wlan_hdd_tdls_timer_restart(pHddTdlsCtx->pAdapter, |
| 2154 | &pHddTdlsCtx->peerDiscoveryTimeoutTimer, |
| 2155 | pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE); |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2156 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 2157 | done: |
| 2158 | pHddTdlsCtx->curr_candidate = NULL; |
| 2159 | pHddTdlsCtx->magic = 0; |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 2160 | return; |
| 2161 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2162 | |
| 2163 | tANI_U32 wlan_hdd_tdls_discovery_sent_cnt(hdd_context_t *pHddCtx) |
| 2164 | { |
| 2165 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 2166 | hdd_adapter_t *pAdapter = NULL; |
| 2167 | tdlsCtx_t *pHddTdlsCtx = NULL; |
| 2168 | VOS_STATUS status = 0; |
| 2169 | tANI_U32 count = 0; |
| 2170 | |
| 2171 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 2172 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 2173 | { |
| 2174 | pAdapter = pAdapterNode->pAdapter; |
| 2175 | |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2176 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2177 | if (NULL != pHddTdlsCtx) |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2178 | { |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2179 | count = count + pHddTdlsCtx->discovery_sent_cnt; |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2180 | } |
| 2181 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 2182 | pAdapterNode = pNext; |
| 2183 | } |
| 2184 | return count; |
| 2185 | } |
| 2186 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 2187 | void wlan_hdd_tdls_check_power_save_prohibited(hdd_adapter_t *pAdapter) |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2188 | { |
| 2189 | tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 2190 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2191 | |
| 2192 | if ((NULL == pHddTdlsCtx) || (NULL == pHddCtx)) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2193 | { |
| 2194 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2195 | FL(" pHddCtx or pHddTdlsCtx points to NULL")); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2196 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2197 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 2198 | |
| 2199 | if ((0 == pHddCtx->connected_peer_count) && |
| 2200 | (0 == wlan_hdd_tdls_discovery_sent_cnt(pHddCtx))) |
| 2201 | { |
| 2202 | sme_SetTdlsPowerSaveProhibited(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter), 0); |
| 2203 | return; |
| 2204 | } |
| 2205 | sme_SetTdlsPowerSaveProhibited(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter), 1); |
| 2206 | return; |
| 2207 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2208 | |
| 2209 | void wlan_hdd_tdls_free_scan_request (tdls_scan_context_t *tdls_scan_ctx) |
| 2210 | { |
| 2211 | if (NULL == tdls_scan_ctx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2212 | { |
| 2213 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2214 | FL("tdls_scan_ctx is NULL")); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2215 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2216 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2217 | |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2218 | tdls_scan_ctx->attempt = 0; |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2219 | tdls_scan_ctx->reject = 0; |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2220 | tdls_scan_ctx->magic = 0; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2221 | tdls_scan_ctx->scan_request = NULL; |
| 2222 | return; |
| 2223 | } |
| 2224 | |
| 2225 | int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx, |
| 2226 | struct wiphy *wiphy, |
| 2227 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2228 | struct net_device *dev, |
| 2229 | #endif |
| 2230 | struct cfg80211_scan_request *request) |
| 2231 | { |
| 2232 | tdls_scan_context_t *scan_ctx; |
| 2233 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2234 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2235 | { |
| 2236 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2237 | FL("pHddCtx is not valid")); |
| 2238 | return 0; |
| 2239 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2240 | |
| 2241 | scan_ctx = &pHddCtx->tdls_scan_ctxt; |
| 2242 | |
| 2243 | scan_ctx->wiphy = wiphy; |
| 2244 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2245 | scan_ctx->dev = dev; |
| 2246 | #endif |
| 2247 | |
| 2248 | scan_ctx->scan_request = request; |
| 2249 | return 0; |
| 2250 | } |
| 2251 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2252 | static void wlan_hdd_tdls_scan_init_work(hdd_context_t *pHddCtx, |
| 2253 | struct wiphy *wiphy, |
| 2254 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2255 | struct net_device *dev, |
| 2256 | #endif |
| 2257 | struct cfg80211_scan_request *request, |
| 2258 | unsigned long delay) |
| 2259 | { |
| 2260 | if (TDLS_CTX_MAGIC != pHddCtx->tdls_scan_ctxt.magic) |
| 2261 | { |
| 2262 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2263 | wlan_hdd_tdls_copy_scan_context(pHddCtx, wiphy, dev, request); |
| 2264 | #else |
| 2265 | wlan_hdd_tdls_copy_scan_context(pHddCtx, wiphy, request); |
| 2266 | #endif |
| 2267 | pHddCtx->tdls_scan_ctxt.attempt = 0; |
| 2268 | pHddCtx->tdls_scan_ctxt.magic = TDLS_CTX_MAGIC; |
| 2269 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2270 | schedule_delayed_work(&pHddCtx->tdls_scan_ctxt.tdls_scan_work, delay); |
| 2271 | } |
| 2272 | |
| 2273 | /* return negative = caller should stop and return error code immediately |
| 2274 | return 0 = caller should stop and return success immediately |
| 2275 | return 1 = caller can continue to scan |
| 2276 | */ |
| 2277 | int wlan_hdd_tdls_scan_callback (hdd_adapter_t *pAdapter, |
| 2278 | struct wiphy *wiphy, |
| 2279 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2280 | struct net_device *dev, |
| 2281 | #endif |
| 2282 | struct cfg80211_scan_request *request) |
| 2283 | { |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2284 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2285 | u16 connectedTdlsPeers; |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2286 | hddTdlsPeer_t *curr_peer; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2287 | unsigned long delay; |
| 2288 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2289 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2290 | { |
| 2291 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2292 | FL("pHddCtx is not valid")); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2293 | return 0; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2294 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2295 | |
| 2296 | /* if tdls is not enabled, then continue scan */ |
| 2297 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
| 2298 | return 1; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 2299 | curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0); |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2300 | if (NULL != curr_peer) |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2301 | { |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2302 | if (pHddCtx->tdls_scan_ctxt.reject++ >= TDLS_MAX_SCAN_REJECT) |
| 2303 | { |
| 2304 | pHddCtx->tdls_scan_ctxt.reject = 0; |
| 2305 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2306 | "%s: " MAC_ADDRESS_STR ". scan rejected %d. force it to idle", |
| 2307 | __func__, MAC_ADDR_ARRAY (curr_peer->peerMac), pHddCtx->tdls_scan_ctxt.reject); |
| 2308 | |
| 2309 | wlan_hdd_tdls_set_peer_link_status (curr_peer, eTDLS_LINK_IDLE); |
| 2310 | return 1; |
| 2311 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2312 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Hoonki Lee | fb8df67 | 2013-04-10 18:20:34 -0700 | [diff] [blame] | 2313 | "%s: tdls in progress. scan rejected %d", |
| 2314 | __func__, pHddCtx->tdls_scan_ctxt.reject); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2315 | return -EBUSY; |
| 2316 | } |
| 2317 | |
| 2318 | /* tdls teardown is ongoing */ |
| 2319 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 2320 | { |
| 2321 | connectedTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 2322 | if (connectedTdlsPeers && (pHddCtx->tdls_scan_ctxt.attempt < TDLS_MAX_SCAN_SCHEDULE)) |
| 2323 | { |
| 2324 | delay = (unsigned long)(TDLS_DELAY_SCAN_PER_CONNECTION*connectedTdlsPeers); |
| 2325 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2326 | "%s: tdls disabled, but still connected_peers %d attempt %d. schedule scan %lu msec", |
| 2327 | __func__, connectedTdlsPeers, pHddCtx->tdls_scan_ctxt.attempt, delay); |
| 2328 | |
| 2329 | wlan_hdd_tdls_scan_init_work (pHddCtx, wiphy, |
| 2330 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2331 | dev, |
| 2332 | #endif |
| 2333 | request, |
| 2334 | msecs_to_jiffies(delay)); |
| 2335 | /* scan should not continue */ |
| 2336 | return 0; |
| 2337 | } |
| 2338 | /* no connected peer or max retry reached, scan continue */ |
| 2339 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2340 | "%s: tdls disabled. connected_peers %d attempt %d. scan allowed", |
| 2341 | __func__, connectedTdlsPeers, pHddCtx->tdls_scan_ctxt.attempt); |
| 2342 | return 1; |
| 2343 | } |
| 2344 | /* while tdls is up, first time scan */ |
| 2345 | else if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode || |
| 2346 | eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode) |
| 2347 | { |
| 2348 | /* disable implicit trigger logic & tdls operatoin */ |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 2349 | wlan_hdd_tdls_set_mode(pHddCtx, eTDLS_SUPPORT_DISABLED, FALSE); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2350 | /* indicate the teardown all connected to peer */ |
| 2351 | connectedTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 2352 | if (connectedTdlsPeers) |
| 2353 | { |
| 2354 | tANI_U8 staIdx; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2355 | hddTdlsPeer_t *curr_peer; |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2356 | |
| 2357 | for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
| 2358 | { |
| 2359 | if (pHddCtx->tdlsConnInfo[staIdx].staId) |
| 2360 | { |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 2361 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2362 | ("%s: indicate TDLS teadown (staId %d)"), __func__, pHddCtx->tdlsConnInfo[staIdx].staId) ; |
| 2363 | |
| 2364 | #ifdef CONFIG_TDLS_IMPLICIT |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 2365 | curr_peer = wlan_hdd_tdls_find_all_peer(pHddCtx, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes); |
| 2366 | if(curr_peer) |
| 2367 | 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] | 2368 | #endif |
| 2369 | } |
| 2370 | } |
| 2371 | /* schedule scan */ |
| 2372 | delay = (unsigned long)(TDLS_DELAY_SCAN_PER_CONNECTION*connectedTdlsPeers); |
| 2373 | |
| 2374 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2375 | "%s: tdls enabled (mode %d), connected_peers %d. schedule scan %lu msec", |
| 2376 | __func__, pHddCtx->tdls_mode, wlan_hdd_tdlsConnectedPeers(pAdapter), |
| 2377 | delay); |
| 2378 | |
| 2379 | wlan_hdd_tdls_scan_init_work (pHddCtx, wiphy, |
| 2380 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 2381 | dev, |
| 2382 | #endif |
| 2383 | request, |
| 2384 | msecs_to_jiffies(delay)); |
| 2385 | /* scan should not continue */ |
| 2386 | return 0; |
| 2387 | } |
| 2388 | /* no connected peer, scan continue */ |
| 2389 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 2390 | "%s: tdls_mode %d, and no tdls connection. scan allowed", |
| 2391 | __func__, pHddCtx->tdls_mode); |
| 2392 | } |
| 2393 | return 1; |
| 2394 | } |
| 2395 | |
| 2396 | void wlan_hdd_tdls_scan_done_callback(hdd_adapter_t *pAdapter) |
| 2397 | { |
| 2398 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2399 | |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2400 | if(0 != (wlan_hdd_validate_context(pHddCtx))) |
| 2401 | { |
| 2402 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2403 | FL("pHddCtx is not valid")); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2404 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2405 | } |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2406 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 2407 | |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2408 | /* free allocated memory at scan time */ |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2409 | wlan_hdd_tdls_free_scan_request (&pHddCtx->tdls_scan_ctxt); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2410 | |
| 2411 | /* if tdls was enabled before scan, re-enable tdls mode */ |
| 2412 | if(eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode_last || |
| 2413 | eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode_last) |
| 2414 | { |
Gopichand Nakkala | 4ddf019 | 2013-03-27 13:41:20 -0700 | [diff] [blame] | 2415 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2416 | ("%s: revert tdls mode %d"), __func__, pHddCtx->tdls_mode_last); |
| 2417 | |
Gopichand Nakkala | dcbcf4e | 2013-03-23 14:32:39 -0700 | [diff] [blame] | 2418 | wlan_hdd_tdls_set_mode(pHddCtx, pHddCtx->tdls_mode_last, FALSE); |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 2419 | } |
| 2420 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 2421 | } |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2422 | |
| 2423 | void wlan_hdd_tdls_timer_restart(hdd_adapter_t *pAdapter, |
| 2424 | vos_timer_t *timer, |
| 2425 | v_U32_t expirationTime) |
| 2426 | { |
| 2427 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2428 | |
| 2429 | if (NULL == pHddStaCtx) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2430 | { |
| 2431 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2432 | FL("pHddStaCtx is NULL")); |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2433 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2434 | } |
Gopichand Nakkala | 3046fc9 | 2013-03-23 13:56:43 -0700 | [diff] [blame] | 2435 | |
| 2436 | /* Check whether driver load unload is in progress */ |
| 2437 | if(vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL)) |
| 2438 | { |
| 2439 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2440 | "%s: Driver load/unload is in progress.", __func__); |
| 2441 | return; |
| 2442 | } |
| 2443 | |
| 2444 | if (hdd_connIsConnected(pHddStaCtx)) |
| 2445 | { |
| 2446 | vos_timer_stop(timer); |
| 2447 | vos_timer_start(timer, expirationTime); |
| 2448 | } |
| 2449 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2450 | void wlan_hdd_tdls_indicate_teardown(hdd_adapter_t *pAdapter, |
| 2451 | hddTdlsPeer_t *curr_peer, |
| 2452 | tANI_U16 reason) |
| 2453 | { |
| 2454 | if (NULL == pAdapter || NULL == curr_peer) |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2455 | { |
| 2456 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2457 | FL("parameters passed are invalid")); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2458 | return; |
c_hpothu | 7f63e88 | 2013-10-02 19:13:35 +0530 | [diff] [blame] | 2459 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 2460 | |
| 2461 | if (eTDLS_LINK_CONNECTED != curr_peer->link_status) |
| 2462 | return; |
| 2463 | |
| 2464 | wlan_hdd_tdls_set_peer_link_status(curr_peer, eTDLS_LINK_TEARING); |
| 2465 | cfg80211_tdls_oper_request(pAdapter->dev, |
| 2466 | curr_peer->peerMac, |
| 2467 | NL80211_TDLS_TEARDOWN, |
| 2468 | reason, |
| 2469 | GFP_KERNEL); |
| 2470 | } |