blob: 04059cba745d4c739c6484798a8f64e95429fe5a [file] [log] [blame]
Gopichand Nakkalabd9fa2d2013-01-08 13:16:22 -08001/*
2 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
Kiran V1ccee932012-12-12 14:49:46 -080021#ifndef __HDD_TDSL_H
22#define __HDD_TDSL_H
23/**===========================================================================
24
25\file wlan_hdd_tdls.h
26
27\brief Linux HDD TDLS include file
Gopichand Nakkala0c1331e2013-01-07 22:49:07 -080028
Kiran V1ccee932012-12-12 14:49:46 -080029==========================================================================*/
30
Chilam NG571c65a2013-01-19 12:27:36 +053031#define MAX_NUM_TDLS_PEER 3
Kiran V1ccee932012-12-12 14:49:46 -080032
Gopichand Nakkalac3694582013-02-13 20:51:22 -080033#define TDLS_SUB_DISCOVERY_PERIOD 100
34
35#define TDLS_MAX_DISCOVER_REQS_PER_TIMER 1
Kiran V1ccee932012-12-12 14:49:46 -080036
Chilam NG571c65a2013-01-19 12:27:36 +053037#define TDLS_DISCOVERY_PERIOD 3600000
Kiran V1ccee932012-12-12 14:49:46 -080038
Chilam NG571c65a2013-01-19 12:27:36 +053039#define TDLS_TX_STATS_PERIOD 3600000
40
41#define TDLS_IMPLICIT_TRIGGER_PKT_THRESHOLD 100
42
43#define TDLS_RX_IDLE_TIMEOUT 5000
44
45#define TDLS_RSSI_TRIGGER_HYSTERESIS 50
46
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070047/* before UpdateTimer expires, we want to timeout discovery response.
48should not be more than 2000 */
49#define TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE 1000
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070050
Hoonki Lee93e67ff2013-03-19 15:49:25 -070051#define TDLS_CTX_MAGIC 0x54444c53 // "TDLS"
52
53#define TDLS_MAX_SCAN_SCHEDULE 10
54#define TDLS_DELAY_SCAN_PER_CONNECTION 100
55
Chilam NG571c65a2013-01-19 12:27:36 +053056typedef struct
57{
Chilam Ng01120412013-02-19 18:32:21 -080058 tANI_U32 tdls;
Chilam NG571c65a2013-01-19 12:27:36 +053059 tANI_U32 tx_period_t;
60 tANI_U32 tx_packet_n;
61 tANI_U32 discovery_period_t;
62 tANI_U32 discovery_tries_n;
Chilam Ng01120412013-02-19 18:32:21 -080063 tANI_U32 idle_timeout_t;
64 tANI_U32 idle_packet_n;
Chilam NG571c65a2013-01-19 12:27:36 +053065 tANI_U32 rssi_hysteresis;
Chilam Ng01120412013-02-19 18:32:21 -080066 tANI_S32 rssi_trigger_threshold;
67 tANI_S32 rssi_teardown_threshold;
Chilam NG571c65a2013-01-19 12:27:36 +053068} tdls_config_params_t;
69
Hoonki Lee93e67ff2013-03-19 15:49:25 -070070typedef struct
71{
72 struct wiphy *wiphy;
73#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
74 struct net_device *dev;
75#endif
76 struct cfg80211_scan_request *scan_request;
77 int magic;
78 int attempt;
79 struct delayed_work tdls_scan_work;
80} tdls_scan_context_t;
81
Chilam NG571c65a2013-01-19 12:27:36 +053082typedef enum {
Hoonki Lee27511902013-03-14 18:19:06 -070083 eTDLS_SUPPORT_NOT_ENABLED = 0,
84 eTDLS_SUPPORT_DISABLED, /* suppress implicit trigger and not respond to the peer */
85 eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY, /* suppress implicit trigger, but respond to the peer */
86 eTDLS_SUPPORT_ENABLED, /* implicit trigger */
Chilam Ng01120412013-02-19 18:32:21 -080087} eTDLSSupportMode;
88
Gopichand Nakkala901e8922013-03-04 23:45:58 -080089typedef enum eTDLSCapType{
Chilam NG571c65a2013-01-19 12:27:36 +053090 eTDLS_CAP_NOT_SUPPORTED = -1,
91 eTDLS_CAP_UNKNOWN = 0,
92 eTDLS_CAP_SUPPORTED = 1,
Gopichand Nakkala901e8922013-03-04 23:45:58 -080093} tTDLSCapType;
Chilam NG571c65a2013-01-19 12:27:36 +053094
Gopichand Nakkala901e8922013-03-04 23:45:58 -080095typedef enum eTDLSLinkStatus {
96 eTDLS_LINK_IDLE = 0,
97 eTDLS_LINK_DISCOVERING,
Gopichand Nakkala05922802013-03-14 12:23:19 -070098 eTDLS_LINK_DISCOVERED,
Gopichand Nakkala901e8922013-03-04 23:45:58 -080099 eTDLS_LINK_CONNECTING,
100 eTDLS_LINK_CONNECTED,
101} tTDLSLinkStatus;
Chilam NG571c65a2013-01-19 12:27:36 +0530102
103typedef struct {
104 tANI_U16 period;
105 tANI_U16 bytes;
106} tdls_tx_tput_config_t;
107
108typedef struct {
109 tANI_U16 period;
110 tANI_U16 tries;
111} tdls_discovery_config_t;
112
113typedef struct {
114 tANI_U16 timeout;
115} tdls_rx_idle_config_t;
116
117typedef struct {
118 tANI_U16 rssi_thres;
119} tdls_rssi_config_t;
120
Hoonki Lee387663d2013-02-05 18:08:43 -0800121typedef struct {
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800122 struct list_head peer_list[256];
123 hdd_adapter_t *pAdapter;
124 vos_timer_t peerDiscoverTimer;
125 vos_timer_t peerUpdateTimer;
Gopichand Nakkala75e7b282013-03-15 18:37:13 -0700126 vos_timer_t peerDiscoveryTimeoutTimer;
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800127 tdls_config_params_t threshold_config;
128 tANI_S32 discovery_peer_cnt;
Gopichand Nakkala75e7b282013-03-15 18:37:13 -0700129 tANI_U32 discovery_sent_cnt;
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800130 tANI_S8 ap_rssi;
131} tdlsCtx_t;
132
133typedef struct {
Hoonki Lee387663d2013-02-05 18:08:43 -0800134 struct list_head node;
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800135 tdlsCtx_t *pHddTdlsCtx;
Hoonki Lee387663d2013-02-05 18:08:43 -0800136 tSirMacAddr peerMac;
137 tANI_U16 staId ;
138 tANI_S8 rssi;
Gopichand Nakkala901e8922013-03-04 23:45:58 -0800139 tTDLSCapType tdls_support;
140 tTDLSLinkStatus link_status;
Hoonki Lee11f7dda2013-02-14 16:55:44 -0800141 tANI_U8 signature;
Hoonki Leea34dd892013-02-05 22:56:02 -0800142 tANI_U8 is_responder;
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800143 tANI_U8 discovery_processed;
Hoonki Lee387663d2013-02-05 18:08:43 -0800144 tANI_U16 discovery_attempt;
145 tANI_U16 tx_pkt;
146 tANI_U16 rx_pkt;
147 vos_timer_t peerIdleTimer;
148} hddTdlsPeer_t;
149
Hoonki Lee387663d2013-02-05 18:08:43 -0800150typedef struct {
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800151 /* Session ID */
152 tANI_U8 sessionId;
153 /*TDLS peer station id */
154 v_U8_t staId;
155 /* TDLS peer mac Address */
156 v_MACADDR_t peerMac;
157} tdlsConnInfo_t;
Chilam NG571c65a2013-01-19 12:27:36 +0530158
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800159int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter);
Chilam NG571c65a2013-01-19 12:27:36 +0530160
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800161void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter);
Chilam NG571c65a2013-01-19 12:27:36 +0530162
Hoonki Lee387663d2013-02-05 18:08:43 -0800163void wlan_hdd_tdls_extract_da(struct sk_buff *skb, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530164
Hoonki Lee387663d2013-02-05 18:08:43 -0800165void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, u8 *mac);
Chilam Ng1279e232013-01-25 15:06:52 -0800166
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800167int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter, u8 *mac, u8 tx);
Chilam NG571c65a2013-01-19 12:27:36 +0530168
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800169int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, u8 *mac, u8 staId);
Chilam NG571c65a2013-01-19 12:27:36 +0530170
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800171hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530172
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800173hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter, u8 *mac);
Hoonki Lee387663d2013-02-05 18:08:43 -0800174
Gopichand Nakkala34d1b062013-03-19 15:28:33 -0700175int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, u8* mac, tTDLSCapType cap);
Hoonki Lee27511902013-03-14 18:19:06 -0700176
Gopichand Nakkala8b00c632013-03-08 19:47:52 -0800177void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer, tTDLSLinkStatus status);
178
179void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter, u8* mac, tTDLSLinkStatus status);
Chilam NG571c65a2013-01-19 12:27:36 +0530180
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800181int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530182
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800183int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, u8 *mac, tANI_S8 rxRssi);
Chilam NG571c65a2013-01-19 12:27:36 +0530184
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800185int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 responder);
Hoonki Leea34dd892013-02-05 22:56:02 -0800186
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800187int wlan_hdd_tdls_get_responder(hdd_adapter_t *pAdapter, u8 *mac);
Hoonki Leea34dd892013-02-05 22:56:02 -0800188
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800189int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 uSignature);
Hoonki Lee11f7dda2013-02-14 16:55:44 -0800190
Chilam Ng01120412013-02-19 18:32:21 -0800191int wlan_hdd_tdls_set_params(struct net_device *dev, tdls_config_params_t *config);
Chilam NG571c65a2013-01-19 12:27:36 +0530192
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800193int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, u8 *mac);
Hoonki Lee387663d2013-02-05 18:08:43 -0800194
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800195tANI_U16 wlan_hdd_tdlsConnectedPeers(hdd_adapter_t *pAdapter);
Lee Hoonkic1262f22013-01-24 21:59:00 -0800196
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800197int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf, int buflen);
Chilam Ng16a2a1c2013-01-29 01:27:29 -0800198
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800199void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter);
200
201void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter);
202
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800203void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter, tANI_U32 statusCode);
204
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800205void wlan_hdd_tdls_increment_peer_count(hdd_adapter_t *pAdapter);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800206
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800207void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800208
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800209void wlan_hdd_tdls_check_bmps(hdd_adapter_t *pAdapter);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800210
Gopichand Nakkala34d1b062013-03-19 15:28:33 -0700211u8 wlan_hdd_tdls_is_peer_progress(hdd_adapter_t *pAdapter, u8 *mac);
212
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800213u8 wlan_hdd_tdls_is_progress(hdd_adapter_t *pAdapter, u8* mac, u8 skip_self);
Hoonki Lee387663d2013-02-05 18:08:43 -0800214
Gopichand Nakkaladcbcf4e2013-03-23 14:32:39 -0700215void wlan_hdd_tdls_set_mode(hdd_context_t *pHddCtx,
216 eTDLSSupportMode tdls_mode,
217 v_BOOL_t bUpdateLast);
Hoonki Lee27511902013-03-14 18:19:06 -0700218
Gopichand Nakkala75e7b282013-03-15 18:37:13 -0700219void wlan_hdd_tdls_pre_setup(tdlsCtx_t *pHddTdlsCtx, hddTdlsPeer_t *curr_peer);
220
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -0700221tANI_U32 wlan_hdd_tdls_discovery_sent_cnt(hdd_context_t *pHddCtx);
222
Gopichand Nakkala34d1b062013-03-19 15:28:33 -0700223void wlan_hdd_tdls_check_power_save_prohibited(hdd_adapter_t *pAdapter);
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -0700224
Hoonki Lee93e67ff2013-03-19 15:49:25 -0700225void wlan_hdd_tdls_free_scan_request (tdls_scan_context_t *tdls_scan_ctx);
226
227int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
228 struct wiphy *wiphy,
229#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
230 struct net_device *dev,
231#endif
232 struct cfg80211_scan_request *request);
233
234int wlan_hdd_tdls_scan_callback (hdd_adapter_t *pAdapter,
235 struct wiphy *wiphy,
236#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
237 struct net_device *dev,
238#endif
239 struct cfg80211_scan_request *request);
240
241void wlan_hdd_tdls_scan_done_callback(hdd_adapter_t *pAdapter);
242
Gopichand Nakkala3046fc92013-03-23 13:56:43 -0700243void wlan_hdd_tdls_timer_restart(hdd_adapter_t *pAdapter,
244 vos_timer_t *timer,
245 v_U32_t expirationTime);
246
Kiran V1ccee932012-12-12 14:49:46 -0800247#endif // __HDD_TDSL_H