blob: 45ce039ab6488d86d32ab4c084b23b90f14231f5 [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 Nakkala75e7b282013-03-15 18:37:13 -070047#define TDLS_DISCOVERY_TIMEOUT 1000
48
Chilam NG571c65a2013-01-19 12:27:36 +053049typedef struct
50{
Chilam Ng01120412013-02-19 18:32:21 -080051 tANI_U32 tdls;
Chilam NG571c65a2013-01-19 12:27:36 +053052 tANI_U32 tx_period_t;
53 tANI_U32 tx_packet_n;
54 tANI_U32 discovery_period_t;
55 tANI_U32 discovery_tries_n;
Chilam Ng01120412013-02-19 18:32:21 -080056 tANI_U32 idle_timeout_t;
57 tANI_U32 idle_packet_n;
Chilam NG571c65a2013-01-19 12:27:36 +053058 tANI_U32 rssi_hysteresis;
Chilam Ng01120412013-02-19 18:32:21 -080059 tANI_S32 rssi_trigger_threshold;
60 tANI_S32 rssi_teardown_threshold;
Chilam NG571c65a2013-01-19 12:27:36 +053061} tdls_config_params_t;
62
63typedef enum {
Hoonki Lee27511902013-03-14 18:19:06 -070064 eTDLS_SUPPORT_NOT_ENABLED = 0,
65 eTDLS_SUPPORT_DISABLED, /* suppress implicit trigger and not respond to the peer */
66 eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY, /* suppress implicit trigger, but respond to the peer */
67 eTDLS_SUPPORT_ENABLED, /* implicit trigger */
Chilam Ng01120412013-02-19 18:32:21 -080068} eTDLSSupportMode;
69
Gopichand Nakkala901e8922013-03-04 23:45:58 -080070typedef enum eTDLSCapType{
Chilam NG571c65a2013-01-19 12:27:36 +053071 eTDLS_CAP_NOT_SUPPORTED = -1,
72 eTDLS_CAP_UNKNOWN = 0,
73 eTDLS_CAP_SUPPORTED = 1,
Gopichand Nakkala901e8922013-03-04 23:45:58 -080074} tTDLSCapType;
Chilam NG571c65a2013-01-19 12:27:36 +053075
Gopichand Nakkala901e8922013-03-04 23:45:58 -080076typedef enum eTDLSLinkStatus {
77 eTDLS_LINK_IDLE = 0,
78 eTDLS_LINK_DISCOVERING,
Gopichand Nakkala05922802013-03-14 12:23:19 -070079 eTDLS_LINK_DISCOVERED,
Gopichand Nakkala901e8922013-03-04 23:45:58 -080080 eTDLS_LINK_CONNECTING,
81 eTDLS_LINK_CONNECTED,
82} tTDLSLinkStatus;
Chilam NG571c65a2013-01-19 12:27:36 +053083
84typedef struct {
85 tANI_U16 period;
86 tANI_U16 bytes;
87} tdls_tx_tput_config_t;
88
89typedef struct {
90 tANI_U16 period;
91 tANI_U16 tries;
92} tdls_discovery_config_t;
93
94typedef struct {
95 tANI_U16 timeout;
96} tdls_rx_idle_config_t;
97
98typedef struct {
99 tANI_U16 rssi_thres;
100} tdls_rssi_config_t;
101
Hoonki Lee387663d2013-02-05 18:08:43 -0800102typedef struct {
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800103 struct list_head peer_list[256];
104 hdd_adapter_t *pAdapter;
105 vos_timer_t peerDiscoverTimer;
106 vos_timer_t peerUpdateTimer;
Gopichand Nakkala75e7b282013-03-15 18:37:13 -0700107 vos_timer_t peerDiscoveryTimeoutTimer;
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800108 tdls_config_params_t threshold_config;
109 tANI_S32 discovery_peer_cnt;
Gopichand Nakkala75e7b282013-03-15 18:37:13 -0700110 tANI_U32 discovery_sent_cnt;
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800111 tANI_S8 ap_rssi;
112} tdlsCtx_t;
113
114typedef struct {
Hoonki Lee387663d2013-02-05 18:08:43 -0800115 struct list_head node;
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800116 tdlsCtx_t *pHddTdlsCtx;
Hoonki Lee387663d2013-02-05 18:08:43 -0800117 tSirMacAddr peerMac;
118 tANI_U16 staId ;
119 tANI_S8 rssi;
Gopichand Nakkala901e8922013-03-04 23:45:58 -0800120 tTDLSCapType tdls_support;
121 tTDLSLinkStatus link_status;
Hoonki Lee11f7dda2013-02-14 16:55:44 -0800122 tANI_U8 signature;
Hoonki Leea34dd892013-02-05 22:56:02 -0800123 tANI_U8 is_responder;
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800124 tANI_U8 discovery_processed;
Hoonki Lee387663d2013-02-05 18:08:43 -0800125 tANI_U16 discovery_attempt;
126 tANI_U16 tx_pkt;
127 tANI_U16 rx_pkt;
128 vos_timer_t peerIdleTimer;
129} hddTdlsPeer_t;
130
Hoonki Lee387663d2013-02-05 18:08:43 -0800131typedef struct {
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800132 /* Session ID */
133 tANI_U8 sessionId;
134 /*TDLS peer station id */
135 v_U8_t staId;
136 /* TDLS peer mac Address */
137 v_MACADDR_t peerMac;
138} tdlsConnInfo_t;
Chilam NG571c65a2013-01-19 12:27:36 +0530139
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800140int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter);
Chilam NG571c65a2013-01-19 12:27:36 +0530141
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800142void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter);
Chilam NG571c65a2013-01-19 12:27:36 +0530143
Hoonki Lee387663d2013-02-05 18:08:43 -0800144void wlan_hdd_tdls_extract_da(struct sk_buff *skb, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530145
Hoonki Lee387663d2013-02-05 18:08:43 -0800146void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, u8 *mac);
Chilam Ng1279e232013-01-25 15:06:52 -0800147
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800148int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter, u8 *mac, u8 tx);
Chilam NG571c65a2013-01-19 12:27:36 +0530149
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800150int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, u8 *mac, u8 staId);
Chilam NG571c65a2013-01-19 12:27:36 +0530151
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800152hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530153
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800154hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter, u8 *mac);
Hoonki Lee387663d2013-02-05 18:08:43 -0800155
Hoonki Lee27511902013-03-14 18:19:06 -0700156void wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, u8* mac, tTDLSCapType cap);
157
Gopichand Nakkala8b00c632013-03-08 19:47:52 -0800158void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer, tTDLSLinkStatus status);
159
160void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter, u8* mac, tTDLSLinkStatus status);
Chilam NG571c65a2013-01-19 12:27:36 +0530161
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800162int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530163
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800164int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, u8 *mac, tANI_S8 rxRssi);
Chilam NG571c65a2013-01-19 12:27:36 +0530165
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800166int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 responder);
Hoonki Leea34dd892013-02-05 22:56:02 -0800167
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800168int wlan_hdd_tdls_get_responder(hdd_adapter_t *pAdapter, u8 *mac);
Hoonki Leea34dd892013-02-05 22:56:02 -0800169
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800170int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, u8 *mac, tANI_U8 uSignature);
Hoonki Lee11f7dda2013-02-14 16:55:44 -0800171
Chilam Ng01120412013-02-19 18:32:21 -0800172int wlan_hdd_tdls_set_params(struct net_device *dev, tdls_config_params_t *config);
Chilam NG571c65a2013-01-19 12:27:36 +0530173
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800174int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, u8 *mac);
Hoonki Lee387663d2013-02-05 18:08:43 -0800175
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800176tANI_U16 wlan_hdd_tdlsConnectedPeers(hdd_adapter_t *pAdapter);
Lee Hoonkic1262f22013-01-24 21:59:00 -0800177
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800178int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf, int buflen);
Chilam Ng16a2a1c2013-01-29 01:27:29 -0800179
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800180void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter);
181
182void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter);
183
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800184void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter, tANI_U32 statusCode);
185
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800186void wlan_hdd_tdls_increment_peer_count(hdd_adapter_t *pAdapter);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800187
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800188void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800189
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800190void wlan_hdd_tdls_check_bmps(hdd_adapter_t *pAdapter);
Gopichand Nakkalab977a972013-02-18 19:15:09 -0800191
Gopichand Nakkala4327a152013-03-04 23:22:42 -0800192u8 wlan_hdd_tdls_is_progress(hdd_adapter_t *pAdapter, u8* mac, u8 skip_self);
Hoonki Lee387663d2013-02-05 18:08:43 -0800193
Hoonki Lee27511902013-03-14 18:19:06 -0700194void wlan_hdd_tdls_set_mode(hdd_context_t *pHddCtx, eTDLSSupportMode tdls_mode);
195
Gopichand Nakkala75e7b282013-03-15 18:37:13 -0700196void wlan_hdd_tdls_pre_setup(tdlsCtx_t *pHddTdlsCtx, hddTdlsPeer_t *curr_peer);
197
Kiran V1ccee932012-12-12 14:49:46 -0800198#endif // __HDD_TDSL_H