blob: 7dda53a8330b1ad5be6f3942a6def8ec45711a7f [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
47typedef struct
48{
Chilam Ng01120412013-02-19 18:32:21 -080049 tANI_U32 tdls;
Chilam NG571c65a2013-01-19 12:27:36 +053050 tANI_U32 tx_period_t;
51 tANI_U32 tx_packet_n;
52 tANI_U32 discovery_period_t;
53 tANI_U32 discovery_tries_n;
Chilam Ng01120412013-02-19 18:32:21 -080054 tANI_U32 idle_timeout_t;
55 tANI_U32 idle_packet_n;
Chilam NG571c65a2013-01-19 12:27:36 +053056 tANI_U32 rssi_hysteresis;
Chilam Ng01120412013-02-19 18:32:21 -080057 tANI_S32 rssi_trigger_threshold;
58 tANI_S32 rssi_teardown_threshold;
Chilam NG571c65a2013-01-19 12:27:36 +053059} tdls_config_params_t;
60
61typedef enum {
Chilam Ng01120412013-02-19 18:32:21 -080062 eTDLS_SUPPORT_DISABLED = 0,
63 eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY,
64 eTDLS_SUPPORT_ENABLED,
65} eTDLSSupportMode;
66
Gopichand Nakkala901e8922013-03-04 23:45:58 -080067typedef enum eTDLSCapType{
Chilam NG571c65a2013-01-19 12:27:36 +053068 eTDLS_CAP_NOT_SUPPORTED = -1,
69 eTDLS_CAP_UNKNOWN = 0,
70 eTDLS_CAP_SUPPORTED = 1,
Gopichand Nakkala901e8922013-03-04 23:45:58 -080071} tTDLSCapType;
Chilam NG571c65a2013-01-19 12:27:36 +053072
Gopichand Nakkala901e8922013-03-04 23:45:58 -080073typedef enum eTDLSLinkStatus {
74 eTDLS_LINK_IDLE = 0,
75 eTDLS_LINK_DISCOVERING,
76 eTDLS_LINK_CONNECTING,
77 eTDLS_LINK_CONNECTED,
78} tTDLSLinkStatus;
Chilam NG571c65a2013-01-19 12:27:36 +053079
80typedef struct {
81 tANI_U16 period;
82 tANI_U16 bytes;
83} tdls_tx_tput_config_t;
84
85typedef struct {
86 tANI_U16 period;
87 tANI_U16 tries;
88} tdls_discovery_config_t;
89
90typedef struct {
91 tANI_U16 timeout;
92} tdls_rx_idle_config_t;
93
94typedef struct {
95 tANI_U16 rssi_thres;
96} tdls_rssi_config_t;
97
Hoonki Lee387663d2013-02-05 18:08:43 -080098typedef struct {
Gopichand Nakkala4327a152013-03-04 23:22:42 -080099 struct list_head peer_list[256];
100 hdd_adapter_t *pAdapter;
101 vos_timer_t peerDiscoverTimer;
102 vos_timer_t peerUpdateTimer;
103 tdls_config_params_t threshold_config;
104 tANI_S32 discovery_peer_cnt;
105 tANI_S8 ap_rssi;
106} tdlsCtx_t;
107
108typedef struct {
Hoonki Lee387663d2013-02-05 18:08:43 -0800109 struct list_head node;
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800110 tdlsCtx_t *pHddTdlsCtx;
Hoonki Lee387663d2013-02-05 18:08:43 -0800111 tSirMacAddr peerMac;
112 tANI_U16 staId ;
113 tANI_S8 rssi;
Gopichand Nakkala901e8922013-03-04 23:45:58 -0800114 tTDLSCapType tdls_support;
115 tTDLSLinkStatus link_status;
Hoonki Lee11f7dda2013-02-14 16:55:44 -0800116 tANI_U8 signature;
Hoonki Leea34dd892013-02-05 22:56:02 -0800117 tANI_U8 is_responder;
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800118 tANI_U8 discovery_processed;
Hoonki Lee387663d2013-02-05 18:08:43 -0800119 tANI_U16 discovery_attempt;
120 tANI_U16 tx_pkt;
121 tANI_U16 rx_pkt;
122 vos_timer_t peerIdleTimer;
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800123 tANI_U8 isTDLSInProgress;
Hoonki Lee387663d2013-02-05 18:08:43 -0800124} hddTdlsPeer_t;
125
Hoonki Lee387663d2013-02-05 18:08:43 -0800126typedef struct {
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800127 /* Session ID */
128 tANI_U8 sessionId;
129 /*TDLS peer station id */
130 v_U8_t staId;
131 /* TDLS peer mac Address */
132 v_MACADDR_t peerMac;
133} tdlsConnInfo_t;
Chilam NG571c65a2013-01-19 12:27:36 +0530134
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800135int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter);
Chilam NG571c65a2013-01-19 12:27:36 +0530136
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800137void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter);
Chilam NG571c65a2013-01-19 12:27:36 +0530138
Hoonki Lee387663d2013-02-05 18:08:43 -0800139void wlan_hdd_tdls_extract_da(struct sk_buff *skb, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530140
Hoonki Lee387663d2013-02-05 18:08:43 -0800141void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, u8 *mac);
Chilam Ng1279e232013-01-25 15:06:52 -0800142
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800143int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter, u8 *mac, u8 tx);
Chilam NG571c65a2013-01-19 12:27:36 +0530144
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800145int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, u8 *mac, u8 staId);
Chilam NG571c65a2013-01-19 12:27:36 +0530146
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800147hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530148
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800149hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter, u8 *mac);
Hoonki Lee387663d2013-02-05 18:08:43 -0800150
151void wlan_hdd_tdls_set_link_status(hddTdlsPeer_t *curr_peer, int status);
Chilam NG571c65a2013-01-19 12:27:36 +0530152
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800153int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530154
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800155int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, u8 *mac, tANI_S8 rxRssi);
Chilam NG571c65a2013-01-19 12:27:36 +0530156
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800157int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 responder);
Hoonki Leea34dd892013-02-05 22:56:02 -0800158
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800159int wlan_hdd_tdls_get_responder(hdd_adapter_t *pAdapter, u8 *mac);
Hoonki Leea34dd892013-02-05 22:56:02 -0800160
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800161int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 uSignature);
Hoonki Lee11f7dda2013-02-14 16:55:44 -0800162
Chilam Ng01120412013-02-19 18:32:21 -0800163int wlan_hdd_tdls_set_params(struct net_device *dev, tdls_config_params_t *config);
Chilam NG571c65a2013-01-19 12:27:36 +0530164
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800165int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, u8 *mac);
Hoonki Lee387663d2013-02-05 18:08:43 -0800166
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800167tANI_U16 wlan_hdd_tdlsConnectedPeers(hdd_adapter_t *pAdapter);
Lee Hoonkic1262f22013-01-24 21:59:00 -0800168
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800169int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf, int buflen);
Chilam Ng16a2a1c2013-01-29 01:27:29 -0800170
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800171void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter);
172
173void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter);
174
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800175void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter, tANI_U32 statusCode);
176
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800177void wlan_hdd_tdls_increment_peer_count(hdd_adapter_t *pAdapter);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800178
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800179void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800180
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800181void wlan_hdd_tdls_check_bmps(hdd_adapter_t *pAdapter);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800182
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800183void wlan_hdd_tdls_set_connection_progress(hdd_adapter_t *pAdapter, u8* mac, u8 isProgress);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800184
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800185u8 wlan_hdd_tdls_is_progress(hdd_adapter_t *pAdapter, u8* mac, u8 skip_self);
Hoonki Lee387663d2013-02-05 18:08:43 -0800186
Kiran V1ccee932012-12-12 14:49:46 -0800187#endif // __HDD_TDSL_H