blob: 3b917762e621983018f3562884e3d4065dd8d794 [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{
49 tANI_U32 tx_period_t;
50 tANI_U32 tx_packet_n;
51 tANI_U32 discovery_period_t;
52 tANI_U32 discovery_tries_n;
53 tANI_U32 rx_timeout_t;
54 tANI_U32 rssi_hysteresis;
55} tdls_config_params_t;
56
57typedef enum {
58 eTDLS_CAP_NOT_SUPPORTED = -1,
59 eTDLS_CAP_UNKNOWN = 0,
60 eTDLS_CAP_SUPPORTED = 1,
61} eTDLSCapType;
62
63typedef enum {
64 eTDLS_LINK_NOT_CONNECTED = 0,
65 eTDLS_LINK_CONNECTED = 1,
66} eTDLSLinkStatus;
67
68typedef struct {
69 tANI_U16 period;
70 tANI_U16 bytes;
71} tdls_tx_tput_config_t;
72
73typedef struct {
74 tANI_U16 period;
75 tANI_U16 tries;
76} tdls_discovery_config_t;
77
78typedef struct {
79 tANI_U16 timeout;
80} tdls_rx_idle_config_t;
81
82typedef struct {
83 tANI_U16 rssi_thres;
84} tdls_rssi_config_t;
85
Hoonki Lee387663d2013-02-05 18:08:43 -080086typedef struct {
87 struct list_head node;
88 tSirMacAddr peerMac;
89 tANI_U16 staId ;
90 tANI_S8 rssi;
91 tANI_S8 tdls_support;
92 tANI_S8 link_status;
Hoonki Leea34dd892013-02-05 22:56:02 -080093 tANI_U8 is_responder;
Gopichand Nakkalac3694582013-02-13 20:51:22 -080094 tANI_U8 discovery_processed;
Hoonki Lee387663d2013-02-05 18:08:43 -080095 tANI_U16 discovery_attempt;
96 tANI_U16 tx_pkt;
97 tANI_U16 rx_pkt;
98 vos_timer_t peerIdleTimer;
99} hddTdlsPeer_t;
100
101
102typedef struct {
103 struct list_head peer_list[256];
104 struct mutex lock;
105 struct net_device *dev;
106 vos_timer_t peerDiscoverTimer;
107 vos_timer_t peerUpdateTimer;
108 tdls_config_params_t threshold_config;
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800109 tANI_S32 discovery_peer_cnt;
Hoonki Lee387663d2013-02-05 18:08:43 -0800110 tANI_S8 ap_rssi;
111} tdlsCtx_t;
Chilam NG571c65a2013-01-19 12:27:36 +0530112
113int wlan_hdd_tdls_init(struct net_device *dev);
114
115void wlan_hdd_tdls_exit(void);
116
Gopichand Nakkala91b09262013-02-10 14:27:02 -0800117void wlan_hdd_tdls_timers_stop(void);
118
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800119void wlan_hdd_tdls_timers_destroy(void);
120
Hoonki Lee387663d2013-02-05 18:08:43 -0800121void wlan_hdd_tdls_extract_da(struct sk_buff *skb, u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530122
Hoonki Lee387663d2013-02-05 18:08:43 -0800123void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, u8 *mac);
Chilam Ng1279e232013-01-25 15:06:52 -0800124
Hoonki Lee387663d2013-02-05 18:08:43 -0800125int wlan_hdd_tdls_increment_pkt_count(u8 *mac, u8 tx);
Chilam NG571c65a2013-01-19 12:27:36 +0530126
Hoonki Lee387663d2013-02-05 18:08:43 -0800127int wlan_hdd_tdls_set_sta_id(u8 *mac, u8 staId);
Chilam NG571c65a2013-01-19 12:27:36 +0530128
Hoonki Lee387663d2013-02-05 18:08:43 -0800129hddTdlsPeer_t *wlan_hdd_tdls_find_peer(u8 *mac);
Chilam NG571c65a2013-01-19 12:27:36 +0530130
Hoonki Lee387663d2013-02-05 18:08:43 -0800131hddTdlsPeer_t *wlan_hdd_tdls_get_peer(u8 *mac);
132
133void wlan_hdd_tdls_set_link_status(hddTdlsPeer_t *curr_peer, int status);
Chilam NG571c65a2013-01-19 12:27:36 +0530134
135int wlan_hdd_tdls_set_cap(u8 *mac, int cap);
136
137int wlan_hdd_tdls_set_rssi(u8 *mac, tANI_S8 rxRssi);
138
Hoonki Leea34dd892013-02-05 22:56:02 -0800139int wlan_hdd_tdls_set_responder(u8 *mac, tANI_U8 responder);
140
141int wlan_hdd_tdls_get_responder(u8 *mac);
142
Chilam NG571c65a2013-01-19 12:27:36 +0530143int wlan_hdd_tdls_set_params(tdls_config_params_t *config);
144
Hoonki Lee387663d2013-02-05 18:08:43 -0800145int wlan_hdd_tdls_reset_peer(u8 *mac);
146
Lee Hoonkic1262f22013-01-24 21:59:00 -0800147u8 wlan_hdd_tdlsConnectedPeers(void);
148
Chilam Ng16a2a1c2013-01-29 01:27:29 -0800149int wlan_hdd_tdls_get_all_peers(char *buf, int buflen);
150
Gopichand Nakkalac3694582013-02-13 20:51:22 -0800151void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter);
152
153void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter);
154
Hoonki Lee387663d2013-02-05 18:08:43 -0800155
Kiran V1ccee932012-12-12 14:49:46 -0800156#endif // __HDD_TDSL_H