blob: 4ad93bc93e2b0fa445bcd7f41f1b3fc2400e3993 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Anurag Chouhan6d760662016-02-20 16:05:43 +05302 * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
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 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#ifndef __HDD_TDLS_H
29#define __HDD_TDLS_H
30/**
31 * DOC: wlan_hdd_tdls.h
32 * WLAN Host Device Driver TDLS include file
33 */
34
35#ifdef FEATURE_WLAN_TDLS
36
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080037/*
38 * Before UpdateTimer expires, we want to timeout discovery response
39 * should not be more than 2000.
40 */
41#define TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE 1000
42
43#define TDLS_CTX_MAGIC 0x54444c53 /* "TDLS" */
44
45#define TDLS_MAX_SCAN_SCHEDULE 10
46#define TDLS_MAX_SCAN_REJECT 5
47#define TDLS_DELAY_SCAN_PER_CONNECTION 100
48#define TDLS_MAX_CONNECTED_PEERS_TO_ALLOW_SCAN 1
49
50#define TDLS_IS_CONNECTED(peer) \
51 ((eTDLS_LINK_CONNECTED == (peer)->link_status) || \
52 (eTDLS_LINK_TEARING == (peer)->link_status))
53
54/* Bit mask flag for tdls_option to FW */
55#define ENA_TDLS_OFFCHAN (1 << 0) /* TDLS Off Channel support */
56#define ENA_TDLS_BUFFER_STA (1 << 1) /* TDLS Buffer STA support */
57#define ENA_TDLS_SLEEP_STA (1 << 2) /* TDLS Sleep STA support */
58#define TDLS_SEC_OFFCHAN_OFFSET_0 0
59#define TDLS_SEC_OFFCHAN_OFFSET_40PLUS 40
60#define TDLS_SEC_OFFCHAN_OFFSET_40MINUS (-40)
61#define TDLS_SEC_OFFCHAN_OFFSET_80 80
62#define TDLS_SEC_OFFCHAN_OFFSET_160 160
63
64#define TDLS_PEER_LIST_SIZE 256
65
Kabilan Kannan36090ce2016-05-03 19:28:44 -070066#define TDLS_CT_MAC_AGE_OUT_TIME (30*60*1000) /* Age out time is 30 mins */
67
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080068#define EXTTDLS_EVENT_BUF_SIZE (4096)
69
Kabilan Kannan36090ce2016-05-03 19:28:44 -070070#define TDLS_CT_MAC_MAX_TABLE_SIZE 8
71
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072/**
73 * struct tdls_config_params_t - tdls config params
74 *
75 * @tdls: tdls
76 * @tx_period_t: tx period
77 * @tx_packet_n: tx packets number
78 * @discovery_tries_n: discovery tries
Kabilan Kannan36090ce2016-05-03 19:28:44 -070079 * @idle_timeout_t: idle traffic time out value
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080080 * @idle_packet_n: idle packet number
81 * @rssi_trigger_threshold: rssi trigger threshold
82 * @rssi_teardown_threshold: rssi tear down threshold
83 * @rssi_delta: rssi delta
84 */
85typedef struct {
86 uint32_t tdls;
87 uint32_t tx_period_t;
88 uint32_t tx_packet_n;
89 uint32_t discovery_tries_n;
Kabilan Kannan36090ce2016-05-03 19:28:44 -070090 uint32_t idle_timeout_t;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080091 uint32_t idle_packet_n;
92 int32_t rssi_trigger_threshold;
93 int32_t rssi_teardown_threshold;
94 int32_t rssi_delta;
95} tdls_config_params_t;
96
97/**
98 * struct tdls_scan_context_t - tdls scan context
99 *
100 * @wiphy: pointer to wiphy structure
101 * @dev: pointer to netdev
102 * @scan_request: scan request
103 * @magic: magic
104 * @attempt: attempt
105 * @reject: reject
106 * @tdls_scan_work: delayed tdls scan work
107 */
108typedef struct {
109 struct wiphy *wiphy;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800110 struct cfg80211_scan_request *scan_request;
111 int magic;
112 int attempt;
113 int reject;
114 struct delayed_work tdls_scan_work;
115} tdls_scan_context_t;
116
117/**
118 * enum eTDLSSupportMode - tdls support mode
119 *
120 * @eTDLS_SUPPORT_NOT_ENABLED: tdls support not enabled
121 * @eTDLS_SUPPORT_DISABLED: suppress implicit trigger and not
122 * respond to the peer
123 * @eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY: suppress implicit trigger,
124 * but respond to the peer
125 * @eTDLS_SUPPORT_ENABLED: implicit trigger
Kabilan Kannan421714b2015-11-23 04:44:59 -0800126 * @eTDLS_SUPPORT_EXTERNAL_CONTROL: External control means implicit
127 * trigger but only to a peer mac configured by user space.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800128 */
129typedef enum {
130 eTDLS_SUPPORT_NOT_ENABLED = 0,
131 eTDLS_SUPPORT_DISABLED,
132 eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY,
133 eTDLS_SUPPORT_ENABLED,
Kabilan Kannan421714b2015-11-23 04:44:59 -0800134 eTDLS_SUPPORT_EXTERNAL_CONTROL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800135} eTDLSSupportMode;
136
137/**
138 * enum tTDLSCapType - tdls capability type
139 *
140 * @eTDLS_CAP_NOT_SUPPORTED: tdls not supported
141 * @eTDLS_CAP_UNKNOWN: unknown capability
142 * @eTDLS_CAP_SUPPORTED: tdls capability supported
143 */
144typedef enum eTDLSCapType {
145 eTDLS_CAP_NOT_SUPPORTED = -1,
146 eTDLS_CAP_UNKNOWN = 0,
147 eTDLS_CAP_SUPPORTED = 1,
148} tTDLSCapType;
149
150/**
151 * enum tTDLSLinkStatus - tdls link status
152 *
153 * @eTDLS_LINK_IDLE: tdls link idle
154 * @eTDLS_LINK_DISCOVERING: tdls link discovering
155 * @eTDLS_LINK_DISCOVERED: tdls link discovered
156 * @eTDLS_LINK_CONNECTING: tdls link connecting
157 * @eTDLS_LINK_CONNECTED: tdls link connected
158 * @eTDLS_LINK_TEARING: tdls link tearing
159 */
160typedef enum eTDLSLinkStatus {
161 eTDLS_LINK_IDLE = 0,
162 eTDLS_LINK_DISCOVERING,
163 eTDLS_LINK_DISCOVERED,
164 eTDLS_LINK_CONNECTING,
165 eTDLS_LINK_CONNECTED,
166 eTDLS_LINK_TEARING,
167} tTDLSLinkStatus;
168
169/**
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530170 * enum tdls_teardown_reason - Reason for TDLS teardown
171 * @eTDLS_TEARDOWN_EXT_CTRL: Reason ext ctrl.
172 * @eTDLS_TEARDOWN_CONCURRENCY: Reason concurrency.
173 * @eTDLS_TEARDOWN_RSSI_THRESHOLD: Reason rssi threshold.
174 * @eTDLS_TEARDOWN_TXRX_THRESHOLD: Reason txrx threshold.
175 * @eTDLS_TEARDOWN_BTCOEX: Reason BTCOEX.
176 * @eTDLS_TEARDOWN_SCAN: Reason scan.
177 * @eTDLS_TEARDOWN_BSS_DISCONNECT: Reason bss disconnected.
178 * @eTDLS_TEARDOWN_ANTENNA_SWITCH: Disconnected due to antenna switch
179 *
180 * Reason to indicate in diag event of tdls teardown.
181 */
182enum tdls_teardown_reason {
183 eTDLS_TEARDOWN_EXT_CTRL,
184 eTDLS_TEARDOWN_CONCURRENCY,
185 eTDLS_TEARDOWN_RSSI_THRESHOLD,
186 eTDLS_TEARDOWN_TXRX_THRESHOLD,
187 eTDLS_TEARDOWN_BTCOEX,
188 eTDLS_TEARDOWN_SCAN,
189 eTDLS_TEARDOWN_BSS_DISCONNECT,
190 eTDLS_TEARDOWN_ANTENNA_SWITCH,
191};
192
193/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800194 * enum tTDLSLinkReason - tdls link reason
195 *
196 * @eTDLS_LINK_SUCCESS: Success
197 * @eTDLS_LINK_UNSPECIFIED: Unspecified reason
198 * @eTDLS_LINK_NOT_SUPPORTED: Remote side doesn't support TDLS
199 * @eTDLS_LINK_UNSUPPORTED_BAND: Remote side doesn't support this band
200 * @eTDLS_LINK_NOT_BENEFICIAL: Going to AP is better than direct
201 * @eTDLS_LINK_DROPPED_BY_REMOTE: Remote side doesn't want it anymore
202 */
203typedef enum {
204 eTDLS_LINK_SUCCESS,
205 eTDLS_LINK_UNSPECIFIED = -1,
206 eTDLS_LINK_NOT_SUPPORTED = -2,
207 eTDLS_LINK_UNSUPPORTED_BAND = -3,
208 eTDLS_LINK_NOT_BENEFICIAL = -4,
209 eTDLS_LINK_DROPPED_BY_REMOTE = -5
210} tTDLSLinkReason;
211
212/**
213 * struct tdls_req_params_t - tdls request parameters
214 *
215 * @channel: channel hint, in channel number (NOT frequency)
216 * @global_operating_class: operating class to use
217 * @max_latency_ms: max latency that can be tolerated by apps
218 * @min_bandwidth_kbps: bandwidth required by apps, in kilo bits per second
219 */
220typedef struct {
221 int channel;
222 int global_operating_class;
223 int max_latency_ms;
224 int min_bandwidth_kbps;
225} tdls_req_params_t;
226
227/**
228 * enum tdls_state_t - tdls state
229 *
230 * @QCA_WIFI_HAL_TDLS_DISABLED: TDLS is not enabled, or is disabled now
231 * @QCA_WIFI_HAL_TDLS_ENABLED: TDLS is enabled, but not yet tried
232 * @QCA_WIFI_HAL_TDLS_ESTABLISHED: Direct link is established
233 * @QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL: Direct link established using MCC
234 * @QCA_WIFI_HAL_TDLS_DROPPED: Direct link was established, but is now dropped
235 * @QCA_WIFI_HAL_TDLS_FAILED: Direct link failed
236 */
237typedef enum {
238 QCA_WIFI_HAL_TDLS_DISABLED = 1,
239 QCA_WIFI_HAL_TDLS_ENABLED,
240 QCA_WIFI_HAL_TDLS_ESTABLISHED,
241 QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL,
242 QCA_WIFI_HAL_TDLS_DROPPED,
243 QCA_WIFI_HAL_TDLS_FAILED
244} tdls_state_t;
245
246typedef int (*cfg80211_exttdls_callback)(const uint8_t *mac,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530247 uint32_t opclass,
248 uint32_t channel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800249 uint32_t state,
250 int32_t reason, void *ctx);
251
252/**
253 * struct tdls_tx_tput_config_t - tdls tx throughput config
254 *
255 * @period: period
256 * @bytes: bytes
257 */
258typedef struct {
259 uint16_t period;
260 uint16_t bytes;
261} tdls_tx_tput_config_t;
262
263/**
264 * struct tdls_discovery_config_t - tdls discovery config
265 *
266 * @period: period
267 * @tries: number of tries
268 */
269typedef struct {
270 uint16_t period;
271 uint16_t tries;
272} tdls_discovery_config_t;
273
274/**
275 * struct tdls_rx_idle_config_t - tdls rx idle config
276 *
277 * @timeout: timeout
278 */
279typedef struct {
280 uint16_t timeout;
281} tdls_rx_idle_config_t;
282
283/**
284 * struct tdls_rssi_config_t - tdls rssi config
285 *
286 * @rssi_thres: rssi_thres
287 */
288typedef struct {
289 uint16_t rssi_thres;
290} tdls_rssi_config_t;
291
292struct _hddTdlsPeer_t;
293
294/**
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700295 * struct tdls_ct_mac_table - connection tracker peer mac address table
296 * @mac_address: peer mac address
297 * @tx_packet_cnt: number of tx pkts
298 * @rx_packet_cnt: number of rx pkts
299 * @peer_timestamp_ms: time stamp of latest peer traffic
300 */
301struct tdls_ct_mac_table {
302 struct qdf_mac_addr mac_address;
303 uint32_t tx_packet_cnt;
304 uint32_t rx_packet_cnt;
305 uint32_t peer_timestamp_ms;
306};
307/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800308 * struct tdlsCtx_t - tdls context
309 *
310 * @peer_list: peer list
311 * @pAdapter: pointer to adapter
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700312 * @peer_update_timer: connection tracker timer
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800313 * @peerDiscoverTimer: peer discovery timer
314 * @peerDiscoveryTimeoutTimer: peer discovery timeout timer
315 * @threshold_config: threshold config
316 * @discovery_peer_cnt: discovery peer count
317 * @discovery_sent_cnt: discovery sent count
318 * @ap_rssi: ap rssi
319 * @curr_candidate: current candidate
320 * @implicit_setup: implicit setup work queue
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700321 * @ct_peer_mac_table: linear mac address table for counting the packets
322 * @valid_mac_entries: number of valid mac entry in @ct_peer_mac_table
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800323 * @magic: magic
324 *
325 */
326typedef struct {
327 struct list_head peer_list[TDLS_PEER_LIST_SIZE];
328 hdd_adapter_t *pAdapter;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700329 qdf_mc_timer_t peer_update_timer;
Anurag Chouhan210db072016-02-22 18:42:15 +0530330 qdf_mc_timer_t peerDiscoveryTimeoutTimer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800331 tdls_config_params_t threshold_config;
332 int32_t discovery_peer_cnt;
333 uint32_t discovery_sent_cnt;
334 int8_t ap_rssi;
335 struct _hddTdlsPeer_t *curr_candidate;
336 struct work_struct implicit_setup;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700337 struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE];
338 uint8_t valid_mac_entries;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800339 uint32_t magic;
340} tdlsCtx_t;
341
342/**
343 * struct hddTdlsPeer_t - tdls peer data
344 *
345 * @node: node
346 * @pHddTdlsCtx: pointer to tdls context
347 * @peerMac: peer mac address
348 * @staId: station identifier
349 * @rssi: rssi
350 * @tdls_support: tdls support
351 * @link_status: tdls link status
352 * @signature: signature
353 * @is_responder: is responder
354 * @discovery_processed: discovery processed flag
355 * @discovery_attempt: discovery attempt
356 * @tx_pkt: tx packet
357 * @rx_pkt: rx packet
358 * @uapsdQueues: uapsd queues
359 * @maxSp: max sp
360 * @isBufSta: is buffer sta
361 * @isOffChannelSupported: is offchannel supported flag
362 * @supported_channels_len: supported channels length
363 * @supported_channels: supported channels
364 * @supported_oper_classes_len: supported operation classes length
365 * @supported_oper_classes: supported operation classes
366 * @isForcedPeer: is forced peer
367 * @op_class_for_pref_off_chan: op class for preferred off channel
368 * @pref_off_chan_num: preferred off channel number
369 * @op_class_for_pref_off_chan_is_set: op class for preferred off channel set
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700370 * @peer_idle_timer: time to check idle traffic in tdls peers
371 * @is_peer_idle_timer_initialised: Flag to check idle timer init
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800372 * @reason: reason
373 * @state_change_notification: state change notification
374 */
375typedef struct _hddTdlsPeer_t {
376 struct list_head node;
377 tdlsCtx_t *pHddTdlsCtx;
378 tSirMacAddr peerMac;
379 uint16_t staId;
380 int8_t rssi;
381 tTDLSCapType tdls_support;
382 tTDLSLinkStatus link_status;
383 uint8_t signature;
384 uint8_t is_responder;
385 uint8_t discovery_processed;
386 uint16_t discovery_attempt;
387 uint16_t tx_pkt;
388 uint16_t rx_pkt;
389 uint8_t uapsdQueues;
390 uint8_t maxSp;
391 uint8_t isBufSta;
392 uint8_t isOffChannelSupported;
393 uint8_t supported_channels_len;
394 uint8_t supported_channels[SIR_MAC_MAX_SUPP_CHANNELS];
395 uint8_t supported_oper_classes_len;
Naveen Rawat3b6068c2016-04-14 19:01:06 -0700396 uint8_t supported_oper_classes[CDS_MAX_SUPP_OPER_CLASSES];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800397 bool isForcedPeer;
398 uint8_t op_class_for_pref_off_chan;
399 uint8_t pref_off_chan_num;
400 uint8_t op_class_for_pref_off_chan_is_set;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700401 qdf_mc_timer_t peer_idle_timer;
402 bool is_peer_idle_timer_initialised;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800403 tTDLSLinkReason reason;
404 cfg80211_exttdls_callback state_change_notification;
405} hddTdlsPeer_t;
406
407/**
408 * struct tdlsConnInfo_t - tdls connection info
409 *
410 * @sessionId: Session ID
411 * @staId: TDLS peer station id
412 * @peerMac: peer mac address
413 */
414typedef struct {
415 uint8_t sessionId;
416 uint8_t staId;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530417 struct qdf_mac_addr peerMac;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800418} tdlsConnInfo_t;
419
420/**
421 * struct tdlsInfo_t - tdls info
422 *
423 * @vdev_id: vdev id
424 * @tdls_state: tdls state
425 * @notification_interval_ms: notification interval in ms
426 * @tx_discovery_threshold: tx discovery threshold
427 * @tx_teardown_threshold: tx teardown threshold
428 * @rssi_teardown_threshold: rx teardown threshold
429 * @rssi_delta: rssi delta
430 * @tdls_options: tdls options
431 * @peer_traffic_ind_window: peer traffic indication window
432 * @peer_traffic_response_timeout: peer traffic response timeout
433 * @puapsd_mask: puapsd mask
434 * @puapsd_inactivity_time: puapsd inactivity time
435 * @puapsd_rx_frame_threshold: puapsd rx frame threshold
Kabilan Kannanca670be2015-11-23 01:56:12 -0800436 * @teardown_notification_ms: tdls teardown notification interval
Kabilan Kannan421714b2015-11-23 04:44:59 -0800437 * @tdls_peer_kickout_threshold: tdls packets threshold
438 * for peer kickout operation
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800439 */
440typedef struct {
441 uint32_t vdev_id;
442 uint32_t tdls_state;
443 uint32_t notification_interval_ms;
444 uint32_t tx_discovery_threshold;
445 uint32_t tx_teardown_threshold;
446 int32_t rssi_teardown_threshold;
447 int32_t rssi_delta;
448 uint32_t tdls_options;
449 uint32_t peer_traffic_ind_window;
450 uint32_t peer_traffic_response_timeout;
451 uint32_t puapsd_mask;
452 uint32_t puapsd_inactivity_time;
453 uint32_t puapsd_rx_frame_threshold;
Kabilan Kannanca670be2015-11-23 01:56:12 -0800454 uint32_t teardown_notification_ms;
Kabilan Kannan421714b2015-11-23 04:44:59 -0800455 uint32_t tdls_peer_kickout_threshold;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800456} tdlsInfo_t;
457
458int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter);
459
460void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter);
461
462void wlan_hdd_tdls_extract_da(struct sk_buff *skb, uint8_t *mac);
463
464void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, uint8_t *mac);
465
466int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter,
467 const uint8_t *mac, uint8_t tx);
468
469int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, const uint8_t *mac,
470 uint8_t staId);
471
472hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter,
473 const uint8_t *mac, bool mutexLock);
474
475hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx,
476 const uint8_t *mac);
477
478int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter,
479 const uint8_t *mac,
480 tCsrTdlsLinkEstablishParams *
481 tdlsLinkEstablishParams);
482hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700483 const uint8_t *mac,
484 bool need_mutex_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800485
486int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, const uint8_t *mac,
487 tTDLSCapType cap);
488
489void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer,
490 tTDLSLinkStatus status,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700491 tTDLSLinkReason reason,
492 bool lock_needed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800493void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter,
494 const uint8_t *mac,
495 tTDLSLinkStatus linkStatus,
496 tTDLSLinkReason reason);
497
498int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter,
499 const uint8_t *mac);
500
501int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter,
502 const uint8_t *mac,
503 tCsrStaParams *StaParams,
504 bool isBufSta, bool isOffChannelSupported);
505
506int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, const uint8_t *mac,
507 int8_t rxRssi);
508
509int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, const uint8_t *mac,
510 uint8_t responder);
511
512int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, const uint8_t *mac,
513 uint8_t uSignature);
514
515int wlan_hdd_tdls_set_params(struct net_device *dev,
516 tdls_config_params_t *config);
517
518int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, const uint8_t *mac);
519
520uint16_t wlan_hdd_tdls_connected_peers(hdd_adapter_t *pAdapter);
521
522int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf,
523 int buflen);
524
525void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter);
526
527void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter);
528
529void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter,
530 uint32_t statusCode);
531
532void wlan_hdd_tdls_tncrement_peer_count(hdd_adapter_t *pAdapter);
533
534void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter);
535
536hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700537 const uint8_t *mac, uint8_t skip_self,
538 bool need_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800539
540int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
541 struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800542 struct cfg80211_scan_request *request);
543
544int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800545 struct cfg80211_scan_request *request);
546
547void wlan_hdd_tdls_scan_done_callback(hdd_adapter_t *pAdapter);
548
549void wlan_hdd_tdls_timer_restart(hdd_adapter_t *pAdapter,
Anurag Chouhan210db072016-02-22 18:42:15 +0530550 qdf_mc_timer_t *timer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800551 uint32_t expirationTime);
552void wlan_hdd_tdls_indicate_teardown(hdd_adapter_t *pAdapter,
553 hddTdlsPeer_t *curr_peer,
554 uint16_t reason);
555
556void wlan_hdd_tdls_pre_setup_init_work(tdlsCtx_t *pHddTdlsCtx,
557 hddTdlsPeer_t *curr_candidate);
558
559int wlan_hdd_tdls_set_extctrl_param(hdd_adapter_t *pAdapter,
560 const uint8_t *mac,
561 uint32_t chan,
562 uint32_t max_latency,
563 uint32_t op_class, uint32_t min_bandwidth);
564int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter, const uint8_t *mac,
565 bool forcePeer);
566
Kabilan Kannan421714b2015-11-23 04:44:59 -0800567int wlan_hdd_tdls_update_peer_mac(hdd_adapter_t *adapter,
568 const uint8_t *mac,
569 uint32_t peer_state);
570
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800571int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter,
572 const uint8_t *peer);
573int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter,
574 const uint8_t *peer,
575 cfg80211_exttdls_callback callback,
576 uint32_t chan,
577 uint32_t max_latency,
578 uint32_t op_class,
579 uint32_t min_bandwidth);
580int wlan_hdd_tdls_get_status(hdd_adapter_t *pAdapter,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530581 const uint8_t *mac, uint32_t *opclass,
582 uint32_t *channel, uint32_t *state,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800583 int32_t *reason);
584void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530585 uint32_t *state, int32_t *reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800586int wlan_hdd_set_callback(hddTdlsPeer_t *curr_peer,
587 cfg80211_exttdls_callback callback);
588void wlan_hdd_update_tdls_info(hdd_adapter_t *adapter, bool tdls_prohibited,
589 bool tdls_chan_swit_prohibited);
590
591int wlan_hdd_tdls_add_station(struct wiphy *wiphy,
592 struct net_device *dev, const uint8_t *mac,
593 bool update, tCsrStaParams *StaParams);
594
595int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
596 struct wireless_dev *wdev,
597 const void *data,
598 int data_len);
599
600int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
601 struct wireless_dev *wdev,
602 const void *data,
603 int data_len);
604
605int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
606 struct wireless_dev *wdev,
607 const void *data,
608 int data_len);
609
610#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
611int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
612 struct net_device *dev,
613 const uint8_t *peer,
614 enum nl80211_tdls_operation oper);
615#else
616int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
617 struct net_device *dev,
618 uint8_t *peer,
619 enum nl80211_tdls_operation oper);
620#endif
621
622#ifdef TDLS_MGMT_VERSION2
623int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
624 struct net_device *dev, u8 *peer,
625 u8 action_code, u8 dialog_token,
626 u16 status_code, u32 peer_capability,
627 const u8 *buf, size_t len);
628#else
629#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
630int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
631 struct net_device *dev, const uint8_t *peer,
632 uint8_t action_code, uint8_t dialog_token,
633 uint16_t status_code, uint32_t peer_capability,
634 bool initiator, const uint8_t *buf,
635 size_t len);
636#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
637int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
638 struct net_device *dev, const uint8_t *peer,
639 uint8_t action_code, uint8_t dialog_token,
640 uint16_t status_code, uint32_t peer_capability,
641 const uint8_t *buf, size_t len);
642#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
643int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
644 struct net_device *dev, uint8_t *peer,
645 uint8_t action_code, uint8_t dialog_token,
646 uint16_t status_code, uint32_t peer_capability,
647 const uint8_t *buf, size_t len);
648#else
649int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
650 struct net_device *dev, uint8_t *peer,
651 uint8_t action_code, uint8_t dialog_token,
652 uint16_t status_code, const uint8_t *buf,
653 size_t len);
654#endif
655#endif
656
657void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
658 hdd_context_t *hddctx);
659void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx);
660
661hddTdlsPeer_t *wlan_hdd_tdls_find_first_connected_peer(hdd_adapter_t *adapter);
662int hdd_set_tdls_offchannel(hdd_context_t *hdd_ctx, int offchannel);
663int hdd_set_tdls_secoffchanneloffset(hdd_context_t *hdd_ctx, int offchanoffset);
664int hdd_set_tdls_offchannelmode(hdd_adapter_t *adapter, int offchanmode);
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700665void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
666 struct sk_buff *skb);
667void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
668 struct sk_buff *skb);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800669int hdd_set_tdls_scan_type(hdd_context_t *hdd_ctx, int val);
Prashanth Bhatta527fd752016-04-28 12:35:23 -0700670void hdd_tdls_context_init(hdd_context_t *hdd_ctx);
671void hdd_tdls_context_destroy(hdd_context_t *hdd_ctx);
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700672int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
673 hdd_adapter_t *adapter);
674
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800675#else
676static inline void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
677 hdd_context_t *hddctx)
678{
679}
680static inline void
681wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx)
682{
683}
684static inline void wlan_hdd_tdls_exit(hdd_adapter_t *adapter)
685{
686}
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700687static inline void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
688 struct sk_buff *skb)
689{
690}
691static inline void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
692 struct sk_buff *skb)
693{
694}
Prashanth Bhatta527fd752016-04-28 12:35:23 -0700695static inline void hdd_tdls_context_init(hdd_context_t *hdd_ctx) { }
696static inline void hdd_tdls_context_destroy(hdd_context_t *hdd_ctx) { }
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700697
698static inline int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
699 hdd_adapter_t *adapter)
700{
701 return 0;
702}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800703#endif /* End of FEATURE_WLAN_TDLS */
704
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530705#ifdef FEATURE_WLAN_DIAG_SUPPORT
706void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
707 uint8_t *peer_mac);
Abhishek Singh74bcb0a2016-04-27 12:30:48 +0530708void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
709 uint8_t is_off_chan_supported,
710 uint8_t is_off_chan_configured,
711 uint8_t is_off_chan_established);
Abhishek Singhaf1d0c92016-04-27 13:46:59 +0530712void hdd_wlan_block_scan_by_tdls_event(void);
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530713#else
714static inline
715void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
716 uint8_t *peer_mac) {}
Abhishek Singh74bcb0a2016-04-27 12:30:48 +0530717static inline
718void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
719 uint8_t is_off_chan_supported,
720 uint8_t is_off_chan_configured,
721 uint8_t is_off_chan_established) {}
Abhishek Singhaf1d0c92016-04-27 13:46:59 +0530722static inline void hdd_wlan_block_scan_by_tdls_event(void) {}
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530723#endif /* FEATURE_WLAN_DIAG_SUPPORT */
724
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800725#endif /* __HDD_TDLS_H */