blob: f17857d3e42d796667b387e8797f9e3e82d36a61 [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/**
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700138 * enum tdls_spatial_streams - TDLS spatial streams
139 * @TDLS_NSS_1x1_MODE: TDLS tx/rx spatial streams = 1
140 * @TDLS_NSS_2x2_MODE: TDLS tx/rx spatial streams = 2
141 */
142enum tdls_spatial_streams {
143 TDLS_NSS_1x1_MODE = 0,
144 TDLS_NSS_2x2_MODE = 0xff,
145};
146
147/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800148 * enum tTDLSCapType - tdls capability type
149 *
150 * @eTDLS_CAP_NOT_SUPPORTED: tdls not supported
151 * @eTDLS_CAP_UNKNOWN: unknown capability
152 * @eTDLS_CAP_SUPPORTED: tdls capability supported
153 */
154typedef enum eTDLSCapType {
155 eTDLS_CAP_NOT_SUPPORTED = -1,
156 eTDLS_CAP_UNKNOWN = 0,
157 eTDLS_CAP_SUPPORTED = 1,
158} tTDLSCapType;
159
160/**
161 * enum tTDLSLinkStatus - tdls link status
162 *
163 * @eTDLS_LINK_IDLE: tdls link idle
164 * @eTDLS_LINK_DISCOVERING: tdls link discovering
165 * @eTDLS_LINK_DISCOVERED: tdls link discovered
166 * @eTDLS_LINK_CONNECTING: tdls link connecting
167 * @eTDLS_LINK_CONNECTED: tdls link connected
168 * @eTDLS_LINK_TEARING: tdls link tearing
169 */
170typedef enum eTDLSLinkStatus {
171 eTDLS_LINK_IDLE = 0,
172 eTDLS_LINK_DISCOVERING,
173 eTDLS_LINK_DISCOVERED,
174 eTDLS_LINK_CONNECTING,
175 eTDLS_LINK_CONNECTED,
176 eTDLS_LINK_TEARING,
177} tTDLSLinkStatus;
178
179/**
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530180 * enum tdls_teardown_reason - Reason for TDLS teardown
181 * @eTDLS_TEARDOWN_EXT_CTRL: Reason ext ctrl.
182 * @eTDLS_TEARDOWN_CONCURRENCY: Reason concurrency.
183 * @eTDLS_TEARDOWN_RSSI_THRESHOLD: Reason rssi threshold.
184 * @eTDLS_TEARDOWN_TXRX_THRESHOLD: Reason txrx threshold.
185 * @eTDLS_TEARDOWN_BTCOEX: Reason BTCOEX.
186 * @eTDLS_TEARDOWN_SCAN: Reason scan.
187 * @eTDLS_TEARDOWN_BSS_DISCONNECT: Reason bss disconnected.
188 * @eTDLS_TEARDOWN_ANTENNA_SWITCH: Disconnected due to antenna switch
189 *
190 * Reason to indicate in diag event of tdls teardown.
191 */
192enum tdls_teardown_reason {
193 eTDLS_TEARDOWN_EXT_CTRL,
194 eTDLS_TEARDOWN_CONCURRENCY,
195 eTDLS_TEARDOWN_RSSI_THRESHOLD,
196 eTDLS_TEARDOWN_TXRX_THRESHOLD,
197 eTDLS_TEARDOWN_BTCOEX,
198 eTDLS_TEARDOWN_SCAN,
199 eTDLS_TEARDOWN_BSS_DISCONNECT,
200 eTDLS_TEARDOWN_ANTENNA_SWITCH,
201};
202
203/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800204 * enum tTDLSLinkReason - tdls link reason
205 *
206 * @eTDLS_LINK_SUCCESS: Success
207 * @eTDLS_LINK_UNSPECIFIED: Unspecified reason
208 * @eTDLS_LINK_NOT_SUPPORTED: Remote side doesn't support TDLS
209 * @eTDLS_LINK_UNSUPPORTED_BAND: Remote side doesn't support this band
210 * @eTDLS_LINK_NOT_BENEFICIAL: Going to AP is better than direct
211 * @eTDLS_LINK_DROPPED_BY_REMOTE: Remote side doesn't want it anymore
212 */
213typedef enum {
214 eTDLS_LINK_SUCCESS,
215 eTDLS_LINK_UNSPECIFIED = -1,
216 eTDLS_LINK_NOT_SUPPORTED = -2,
217 eTDLS_LINK_UNSUPPORTED_BAND = -3,
218 eTDLS_LINK_NOT_BENEFICIAL = -4,
219 eTDLS_LINK_DROPPED_BY_REMOTE = -5
220} tTDLSLinkReason;
221
222/**
223 * struct tdls_req_params_t - tdls request parameters
224 *
225 * @channel: channel hint, in channel number (NOT frequency)
226 * @global_operating_class: operating class to use
227 * @max_latency_ms: max latency that can be tolerated by apps
228 * @min_bandwidth_kbps: bandwidth required by apps, in kilo bits per second
229 */
230typedef struct {
231 int channel;
232 int global_operating_class;
233 int max_latency_ms;
234 int min_bandwidth_kbps;
235} tdls_req_params_t;
236
237/**
238 * enum tdls_state_t - tdls state
239 *
240 * @QCA_WIFI_HAL_TDLS_DISABLED: TDLS is not enabled, or is disabled now
241 * @QCA_WIFI_HAL_TDLS_ENABLED: TDLS is enabled, but not yet tried
242 * @QCA_WIFI_HAL_TDLS_ESTABLISHED: Direct link is established
243 * @QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL: Direct link established using MCC
244 * @QCA_WIFI_HAL_TDLS_DROPPED: Direct link was established, but is now dropped
245 * @QCA_WIFI_HAL_TDLS_FAILED: Direct link failed
246 */
247typedef enum {
248 QCA_WIFI_HAL_TDLS_DISABLED = 1,
249 QCA_WIFI_HAL_TDLS_ENABLED,
250 QCA_WIFI_HAL_TDLS_ESTABLISHED,
251 QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL,
252 QCA_WIFI_HAL_TDLS_DROPPED,
253 QCA_WIFI_HAL_TDLS_FAILED
254} tdls_state_t;
255
256typedef int (*cfg80211_exttdls_callback)(const uint8_t *mac,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530257 uint32_t opclass,
258 uint32_t channel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800259 uint32_t state,
260 int32_t reason, void *ctx);
261
262/**
263 * struct tdls_tx_tput_config_t - tdls tx throughput config
264 *
265 * @period: period
266 * @bytes: bytes
267 */
268typedef struct {
269 uint16_t period;
270 uint16_t bytes;
271} tdls_tx_tput_config_t;
272
273/**
274 * struct tdls_discovery_config_t - tdls discovery config
275 *
276 * @period: period
277 * @tries: number of tries
278 */
279typedef struct {
280 uint16_t period;
281 uint16_t tries;
282} tdls_discovery_config_t;
283
284/**
285 * struct tdls_rx_idle_config_t - tdls rx idle config
286 *
287 * @timeout: timeout
288 */
289typedef struct {
290 uint16_t timeout;
291} tdls_rx_idle_config_t;
292
293/**
294 * struct tdls_rssi_config_t - tdls rssi config
295 *
296 * @rssi_thres: rssi_thres
297 */
298typedef struct {
299 uint16_t rssi_thres;
300} tdls_rssi_config_t;
301
302struct _hddTdlsPeer_t;
303
304/**
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700305 * struct tdls_ct_mac_table - connection tracker peer mac address table
306 * @mac_address: peer mac address
307 * @tx_packet_cnt: number of tx pkts
308 * @rx_packet_cnt: number of rx pkts
309 * @peer_timestamp_ms: time stamp of latest peer traffic
310 */
311struct tdls_ct_mac_table {
312 struct qdf_mac_addr mac_address;
313 uint32_t tx_packet_cnt;
314 uint32_t rx_packet_cnt;
315 uint32_t peer_timestamp_ms;
316};
317/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800318 * struct tdlsCtx_t - tdls context
319 *
320 * @peer_list: peer list
321 * @pAdapter: pointer to adapter
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700322 * @peer_update_timer: connection tracker timer
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800323 * @peerDiscoverTimer: peer discovery timer
324 * @peerDiscoveryTimeoutTimer: peer discovery timeout timer
325 * @threshold_config: threshold config
326 * @discovery_peer_cnt: discovery peer count
327 * @discovery_sent_cnt: discovery sent count
328 * @ap_rssi: ap rssi
329 * @curr_candidate: current candidate
330 * @implicit_setup: implicit setup work queue
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700331 * @ct_peer_mac_table: linear mac address table for counting the packets
332 * @valid_mac_entries: number of valid mac entry in @ct_peer_mac_table
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800333 * @magic: magic
334 *
335 */
336typedef struct {
337 struct list_head peer_list[TDLS_PEER_LIST_SIZE];
338 hdd_adapter_t *pAdapter;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700339 qdf_mc_timer_t peer_update_timer;
Anurag Chouhan210db072016-02-22 18:42:15 +0530340 qdf_mc_timer_t peerDiscoveryTimeoutTimer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800341 tdls_config_params_t threshold_config;
342 int32_t discovery_peer_cnt;
343 uint32_t discovery_sent_cnt;
344 int8_t ap_rssi;
345 struct _hddTdlsPeer_t *curr_candidate;
346 struct work_struct implicit_setup;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700347 struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE];
348 uint8_t valid_mac_entries;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800349 uint32_t magic;
350} tdlsCtx_t;
351
352/**
353 * struct hddTdlsPeer_t - tdls peer data
354 *
355 * @node: node
356 * @pHddTdlsCtx: pointer to tdls context
357 * @peerMac: peer mac address
358 * @staId: station identifier
359 * @rssi: rssi
360 * @tdls_support: tdls support
361 * @link_status: tdls link status
362 * @signature: signature
363 * @is_responder: is responder
364 * @discovery_processed: discovery processed flag
365 * @discovery_attempt: discovery attempt
366 * @tx_pkt: tx packet
367 * @rx_pkt: rx packet
368 * @uapsdQueues: uapsd queues
369 * @maxSp: max sp
370 * @isBufSta: is buffer sta
371 * @isOffChannelSupported: is offchannel supported flag
372 * @supported_channels_len: supported channels length
373 * @supported_channels: supported channels
374 * @supported_oper_classes_len: supported operation classes length
375 * @supported_oper_classes: supported operation classes
376 * @isForcedPeer: is forced peer
377 * @op_class_for_pref_off_chan: op class for preferred off channel
378 * @pref_off_chan_num: preferred off channel number
379 * @op_class_for_pref_off_chan_is_set: op class for preferred off channel set
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700380 * @peer_idle_timer: time to check idle traffic in tdls peers
381 * @is_peer_idle_timer_initialised: Flag to check idle timer init
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700382 * @spatial_streams: Number of TX/RX spatial streams for TDLS
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800383 * @reason: reason
384 * @state_change_notification: state change notification
385 */
386typedef struct _hddTdlsPeer_t {
387 struct list_head node;
388 tdlsCtx_t *pHddTdlsCtx;
389 tSirMacAddr peerMac;
390 uint16_t staId;
391 int8_t rssi;
392 tTDLSCapType tdls_support;
393 tTDLSLinkStatus link_status;
394 uint8_t signature;
395 uint8_t is_responder;
396 uint8_t discovery_processed;
397 uint16_t discovery_attempt;
398 uint16_t tx_pkt;
399 uint16_t rx_pkt;
400 uint8_t uapsdQueues;
401 uint8_t maxSp;
402 uint8_t isBufSta;
403 uint8_t isOffChannelSupported;
404 uint8_t supported_channels_len;
405 uint8_t supported_channels[SIR_MAC_MAX_SUPP_CHANNELS];
406 uint8_t supported_oper_classes_len;
Naveen Rawat3b6068c2016-04-14 19:01:06 -0700407 uint8_t supported_oper_classes[CDS_MAX_SUPP_OPER_CLASSES];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800408 bool isForcedPeer;
409 uint8_t op_class_for_pref_off_chan;
410 uint8_t pref_off_chan_num;
411 uint8_t op_class_for_pref_off_chan_is_set;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700412 qdf_mc_timer_t peer_idle_timer;
413 bool is_peer_idle_timer_initialised;
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700414 uint8_t spatial_streams;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800415 tTDLSLinkReason reason;
416 cfg80211_exttdls_callback state_change_notification;
417} hddTdlsPeer_t;
418
419/**
420 * struct tdlsConnInfo_t - tdls connection info
421 *
422 * @sessionId: Session ID
423 * @staId: TDLS peer station id
424 * @peerMac: peer mac address
425 */
426typedef struct {
427 uint8_t sessionId;
428 uint8_t staId;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530429 struct qdf_mac_addr peerMac;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800430} tdlsConnInfo_t;
431
432/**
433 * struct tdlsInfo_t - tdls info
434 *
435 * @vdev_id: vdev id
436 * @tdls_state: tdls state
437 * @notification_interval_ms: notification interval in ms
438 * @tx_discovery_threshold: tx discovery threshold
439 * @tx_teardown_threshold: tx teardown threshold
440 * @rssi_teardown_threshold: rx teardown threshold
441 * @rssi_delta: rssi delta
442 * @tdls_options: tdls options
443 * @peer_traffic_ind_window: peer traffic indication window
444 * @peer_traffic_response_timeout: peer traffic response timeout
445 * @puapsd_mask: puapsd mask
446 * @puapsd_inactivity_time: puapsd inactivity time
447 * @puapsd_rx_frame_threshold: puapsd rx frame threshold
Kabilan Kannanca670be2015-11-23 01:56:12 -0800448 * @teardown_notification_ms: tdls teardown notification interval
Kabilan Kannan421714b2015-11-23 04:44:59 -0800449 * @tdls_peer_kickout_threshold: tdls packets threshold
450 * for peer kickout operation
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800451 */
452typedef struct {
453 uint32_t vdev_id;
454 uint32_t tdls_state;
455 uint32_t notification_interval_ms;
456 uint32_t tx_discovery_threshold;
457 uint32_t tx_teardown_threshold;
458 int32_t rssi_teardown_threshold;
459 int32_t rssi_delta;
460 uint32_t tdls_options;
461 uint32_t peer_traffic_ind_window;
462 uint32_t peer_traffic_response_timeout;
463 uint32_t puapsd_mask;
464 uint32_t puapsd_inactivity_time;
465 uint32_t puapsd_rx_frame_threshold;
Kabilan Kannanca670be2015-11-23 01:56:12 -0800466 uint32_t teardown_notification_ms;
Kabilan Kannan421714b2015-11-23 04:44:59 -0800467 uint32_t tdls_peer_kickout_threshold;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800468} tdlsInfo_t;
469
470int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter);
471
472void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter);
473
474void wlan_hdd_tdls_extract_da(struct sk_buff *skb, uint8_t *mac);
475
476void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, uint8_t *mac);
477
478int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter,
479 const uint8_t *mac, uint8_t tx);
480
481int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, const uint8_t *mac,
482 uint8_t staId);
483
484hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter,
485 const uint8_t *mac, bool mutexLock);
486
487hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx,
488 const uint8_t *mac);
489
490int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter,
491 const uint8_t *mac,
492 tCsrTdlsLinkEstablishParams *
493 tdlsLinkEstablishParams);
494hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700495 const uint8_t *mac,
496 bool need_mutex_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800497
498int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, const uint8_t *mac,
499 tTDLSCapType cap);
500
501void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer,
502 tTDLSLinkStatus status,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700503 tTDLSLinkReason reason,
504 bool lock_needed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800505void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter,
506 const uint8_t *mac,
507 tTDLSLinkStatus linkStatus,
508 tTDLSLinkReason reason);
509
510int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter,
511 const uint8_t *mac);
512
513int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter,
514 const uint8_t *mac,
515 tCsrStaParams *StaParams,
516 bool isBufSta, bool isOffChannelSupported);
517
518int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, const uint8_t *mac,
519 int8_t rxRssi);
520
521int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, const uint8_t *mac,
522 uint8_t responder);
523
524int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, const uint8_t *mac,
525 uint8_t uSignature);
526
527int wlan_hdd_tdls_set_params(struct net_device *dev,
528 tdls_config_params_t *config);
529
530int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, const uint8_t *mac);
531
532uint16_t wlan_hdd_tdls_connected_peers(hdd_adapter_t *pAdapter);
533
534int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf,
535 int buflen);
536
537void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter);
538
539void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter);
540
541void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter,
542 uint32_t statusCode);
543
544void wlan_hdd_tdls_tncrement_peer_count(hdd_adapter_t *pAdapter);
545
546void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter);
547
548hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700549 const uint8_t *mac, uint8_t skip_self,
550 bool need_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800551
552int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
553 struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800554 struct cfg80211_scan_request *request);
555
556int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800557 struct cfg80211_scan_request *request);
558
559void wlan_hdd_tdls_scan_done_callback(hdd_adapter_t *pAdapter);
560
561void wlan_hdd_tdls_timer_restart(hdd_adapter_t *pAdapter,
Anurag Chouhan210db072016-02-22 18:42:15 +0530562 qdf_mc_timer_t *timer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800563 uint32_t expirationTime);
564void wlan_hdd_tdls_indicate_teardown(hdd_adapter_t *pAdapter,
565 hddTdlsPeer_t *curr_peer,
566 uint16_t reason);
567
568void wlan_hdd_tdls_pre_setup_init_work(tdlsCtx_t *pHddTdlsCtx,
569 hddTdlsPeer_t *curr_candidate);
570
571int wlan_hdd_tdls_set_extctrl_param(hdd_adapter_t *pAdapter,
572 const uint8_t *mac,
573 uint32_t chan,
574 uint32_t max_latency,
575 uint32_t op_class, uint32_t min_bandwidth);
576int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter, const uint8_t *mac,
577 bool forcePeer);
578
Kabilan Kannan421714b2015-11-23 04:44:59 -0800579int wlan_hdd_tdls_update_peer_mac(hdd_adapter_t *adapter,
580 const uint8_t *mac,
581 uint32_t peer_state);
582
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800583int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter,
584 const uint8_t *peer);
585int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter,
586 const uint8_t *peer,
587 cfg80211_exttdls_callback callback,
588 uint32_t chan,
589 uint32_t max_latency,
590 uint32_t op_class,
591 uint32_t min_bandwidth);
592int wlan_hdd_tdls_get_status(hdd_adapter_t *pAdapter,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530593 const uint8_t *mac, uint32_t *opclass,
594 uint32_t *channel, uint32_t *state,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800595 int32_t *reason);
596void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530597 uint32_t *state, int32_t *reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800598int wlan_hdd_set_callback(hddTdlsPeer_t *curr_peer,
599 cfg80211_exttdls_callback callback);
600void wlan_hdd_update_tdls_info(hdd_adapter_t *adapter, bool tdls_prohibited,
601 bool tdls_chan_swit_prohibited);
602
603int wlan_hdd_tdls_add_station(struct wiphy *wiphy,
604 struct net_device *dev, const uint8_t *mac,
605 bool update, tCsrStaParams *StaParams);
606
607int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
608 struct wireless_dev *wdev,
609 const void *data,
610 int data_len);
611
612int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
613 struct wireless_dev *wdev,
614 const void *data,
615 int data_len);
616
617int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
618 struct wireless_dev *wdev,
619 const void *data,
620 int data_len);
621
622#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
623int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
624 struct net_device *dev,
625 const uint8_t *peer,
626 enum nl80211_tdls_operation oper);
627#else
628int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
629 struct net_device *dev,
630 uint8_t *peer,
631 enum nl80211_tdls_operation oper);
632#endif
633
634#ifdef TDLS_MGMT_VERSION2
635int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
636 struct net_device *dev, u8 *peer,
637 u8 action_code, u8 dialog_token,
638 u16 status_code, u32 peer_capability,
639 const u8 *buf, size_t len);
640#else
641#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
642int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
643 struct net_device *dev, const uint8_t *peer,
644 uint8_t action_code, uint8_t dialog_token,
645 uint16_t status_code, uint32_t peer_capability,
646 bool initiator, const uint8_t *buf,
647 size_t len);
648#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
649int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
650 struct net_device *dev, const uint8_t *peer,
651 uint8_t action_code, uint8_t dialog_token,
652 uint16_t status_code, uint32_t peer_capability,
653 const uint8_t *buf, size_t len);
654#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
655int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
656 struct net_device *dev, uint8_t *peer,
657 uint8_t action_code, uint8_t dialog_token,
658 uint16_t status_code, uint32_t peer_capability,
659 const uint8_t *buf, size_t len);
660#else
661int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
662 struct net_device *dev, uint8_t *peer,
663 uint8_t action_code, uint8_t dialog_token,
664 uint16_t status_code, const uint8_t *buf,
665 size_t len);
666#endif
667#endif
668
669void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
670 hdd_context_t *hddctx);
671void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx);
672
673hddTdlsPeer_t *wlan_hdd_tdls_find_first_connected_peer(hdd_adapter_t *adapter);
674int hdd_set_tdls_offchannel(hdd_context_t *hdd_ctx, int offchannel);
675int hdd_set_tdls_secoffchanneloffset(hdd_context_t *hdd_ctx, int offchanoffset);
676int hdd_set_tdls_offchannelmode(hdd_adapter_t *adapter, int offchanmode);
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700677void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
678 struct sk_buff *skb);
679void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
680 struct sk_buff *skb);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800681int hdd_set_tdls_scan_type(hdd_context_t *hdd_ctx, int val);
Prashanth Bhatta527fd752016-04-28 12:35:23 -0700682void hdd_tdls_context_init(hdd_context_t *hdd_ctx);
683void hdd_tdls_context_destroy(hdd_context_t *hdd_ctx);
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700684int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700685 hdd_adapter_t *adapter,
686 uint32_t mode);
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700687
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800688#else
689static inline void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
690 hdd_context_t *hddctx)
691{
692}
693static inline void
694wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx)
695{
696}
697static inline void wlan_hdd_tdls_exit(hdd_adapter_t *adapter)
698{
699}
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700700static inline void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
701 struct sk_buff *skb)
702{
703}
704static inline void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
705 struct sk_buff *skb)
706{
707}
Prashanth Bhatta527fd752016-04-28 12:35:23 -0700708static inline void hdd_tdls_context_init(hdd_context_t *hdd_ctx) { }
709static inline void hdd_tdls_context_destroy(hdd_context_t *hdd_ctx) { }
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700710
711static inline int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700712 hdd_adapter_t *adapter,
713 uint32_t mode)
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700714{
715 return 0;
716}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800717#endif /* End of FEATURE_WLAN_TDLS */
718
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530719#ifdef FEATURE_WLAN_DIAG_SUPPORT
720void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
721 uint8_t *peer_mac);
Abhishek Singh74bcb0a2016-04-27 12:30:48 +0530722void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
723 uint8_t is_off_chan_supported,
724 uint8_t is_off_chan_configured,
725 uint8_t is_off_chan_established);
Abhishek Singhaf1d0c92016-04-27 13:46:59 +0530726void hdd_wlan_block_scan_by_tdls_event(void);
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530727#else
728static inline
729void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
730 uint8_t *peer_mac) {}
Abhishek Singh74bcb0a2016-04-27 12:30:48 +0530731static inline
732void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
733 uint8_t is_off_chan_supported,
734 uint8_t is_off_chan_configured,
735 uint8_t is_off_chan_established) {}
Abhishek Singhaf1d0c92016-04-27 13:46:59 +0530736static inline void hdd_wlan_block_scan_by_tdls_event(void) {}
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530737#endif /* FEATURE_WLAN_DIAG_SUPPORT */
738
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800739#endif /* __HDD_TDLS_H */