blob: 907e42e6e74ab43b2621761cda06d9d216a33257 [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/**
Kabilan Kannanff89f742016-08-15 18:14:10 -0700148 * enum tdls_nss_transition_type - TDLS NSS transition states
149 * @TDLS_NSS_TRANSITION_UNKNOWN: default state
150 * @TDLS_NSS_TRANSITION_2x2_to_1x1: transition from 2x2 to 1x1 stream
151 * @TDLS_NSS_TRANSITION_1x1_to_2x2: transition from 1x1 to 2x2 stream
152 */
153enum tdls_nss_transition_type {
154 TDLS_NSS_TRANSITION_UNKNOWN = 0,
155 TDLS_NSS_TRANSITION_2x2_to_1x1,
156 TDLS_NSS_TRANSITION_1x1_to_2x2,
157};
158
159/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800160 * enum tTDLSCapType - tdls capability type
161 *
162 * @eTDLS_CAP_NOT_SUPPORTED: tdls not supported
163 * @eTDLS_CAP_UNKNOWN: unknown capability
164 * @eTDLS_CAP_SUPPORTED: tdls capability supported
165 */
166typedef enum eTDLSCapType {
167 eTDLS_CAP_NOT_SUPPORTED = -1,
168 eTDLS_CAP_UNKNOWN = 0,
169 eTDLS_CAP_SUPPORTED = 1,
170} tTDLSCapType;
171
172/**
173 * enum tTDLSLinkStatus - tdls link status
174 *
175 * @eTDLS_LINK_IDLE: tdls link idle
176 * @eTDLS_LINK_DISCOVERING: tdls link discovering
177 * @eTDLS_LINK_DISCOVERED: tdls link discovered
178 * @eTDLS_LINK_CONNECTING: tdls link connecting
179 * @eTDLS_LINK_CONNECTED: tdls link connected
180 * @eTDLS_LINK_TEARING: tdls link tearing
181 */
182typedef enum eTDLSLinkStatus {
183 eTDLS_LINK_IDLE = 0,
184 eTDLS_LINK_DISCOVERING,
185 eTDLS_LINK_DISCOVERED,
186 eTDLS_LINK_CONNECTING,
187 eTDLS_LINK_CONNECTED,
188 eTDLS_LINK_TEARING,
189} tTDLSLinkStatus;
190
191/**
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530192 * enum tdls_teardown_reason - Reason for TDLS teardown
193 * @eTDLS_TEARDOWN_EXT_CTRL: Reason ext ctrl.
194 * @eTDLS_TEARDOWN_CONCURRENCY: Reason concurrency.
195 * @eTDLS_TEARDOWN_RSSI_THRESHOLD: Reason rssi threshold.
196 * @eTDLS_TEARDOWN_TXRX_THRESHOLD: Reason txrx threshold.
197 * @eTDLS_TEARDOWN_BTCOEX: Reason BTCOEX.
198 * @eTDLS_TEARDOWN_SCAN: Reason scan.
199 * @eTDLS_TEARDOWN_BSS_DISCONNECT: Reason bss disconnected.
200 * @eTDLS_TEARDOWN_ANTENNA_SWITCH: Disconnected due to antenna switch
201 *
202 * Reason to indicate in diag event of tdls teardown.
203 */
204enum tdls_teardown_reason {
205 eTDLS_TEARDOWN_EXT_CTRL,
206 eTDLS_TEARDOWN_CONCURRENCY,
207 eTDLS_TEARDOWN_RSSI_THRESHOLD,
208 eTDLS_TEARDOWN_TXRX_THRESHOLD,
209 eTDLS_TEARDOWN_BTCOEX,
210 eTDLS_TEARDOWN_SCAN,
211 eTDLS_TEARDOWN_BSS_DISCONNECT,
212 eTDLS_TEARDOWN_ANTENNA_SWITCH,
213};
214
215/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800216 * enum tTDLSLinkReason - tdls link reason
217 *
218 * @eTDLS_LINK_SUCCESS: Success
219 * @eTDLS_LINK_UNSPECIFIED: Unspecified reason
220 * @eTDLS_LINK_NOT_SUPPORTED: Remote side doesn't support TDLS
221 * @eTDLS_LINK_UNSUPPORTED_BAND: Remote side doesn't support this band
222 * @eTDLS_LINK_NOT_BENEFICIAL: Going to AP is better than direct
223 * @eTDLS_LINK_DROPPED_BY_REMOTE: Remote side doesn't want it anymore
224 */
225typedef enum {
226 eTDLS_LINK_SUCCESS,
227 eTDLS_LINK_UNSPECIFIED = -1,
228 eTDLS_LINK_NOT_SUPPORTED = -2,
229 eTDLS_LINK_UNSUPPORTED_BAND = -3,
230 eTDLS_LINK_NOT_BENEFICIAL = -4,
231 eTDLS_LINK_DROPPED_BY_REMOTE = -5
232} tTDLSLinkReason;
233
234/**
235 * struct tdls_req_params_t - tdls request parameters
236 *
237 * @channel: channel hint, in channel number (NOT frequency)
238 * @global_operating_class: operating class to use
239 * @max_latency_ms: max latency that can be tolerated by apps
240 * @min_bandwidth_kbps: bandwidth required by apps, in kilo bits per second
241 */
242typedef struct {
243 int channel;
244 int global_operating_class;
245 int max_latency_ms;
246 int min_bandwidth_kbps;
247} tdls_req_params_t;
248
249/**
250 * enum tdls_state_t - tdls state
251 *
252 * @QCA_WIFI_HAL_TDLS_DISABLED: TDLS is not enabled, or is disabled now
253 * @QCA_WIFI_HAL_TDLS_ENABLED: TDLS is enabled, but not yet tried
254 * @QCA_WIFI_HAL_TDLS_ESTABLISHED: Direct link is established
255 * @QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL: Direct link established using MCC
256 * @QCA_WIFI_HAL_TDLS_DROPPED: Direct link was established, but is now dropped
257 * @QCA_WIFI_HAL_TDLS_FAILED: Direct link failed
258 */
259typedef enum {
260 QCA_WIFI_HAL_TDLS_DISABLED = 1,
261 QCA_WIFI_HAL_TDLS_ENABLED,
262 QCA_WIFI_HAL_TDLS_ESTABLISHED,
263 QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL,
264 QCA_WIFI_HAL_TDLS_DROPPED,
265 QCA_WIFI_HAL_TDLS_FAILED
266} tdls_state_t;
267
268typedef int (*cfg80211_exttdls_callback)(const uint8_t *mac,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530269 uint32_t opclass,
270 uint32_t channel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800271 uint32_t state,
272 int32_t reason, void *ctx);
273
274/**
275 * struct tdls_tx_tput_config_t - tdls tx throughput config
276 *
277 * @period: period
278 * @bytes: bytes
279 */
280typedef struct {
281 uint16_t period;
282 uint16_t bytes;
283} tdls_tx_tput_config_t;
284
285/**
286 * struct tdls_discovery_config_t - tdls discovery config
287 *
288 * @period: period
289 * @tries: number of tries
290 */
291typedef struct {
292 uint16_t period;
293 uint16_t tries;
294} tdls_discovery_config_t;
295
296/**
297 * struct tdls_rx_idle_config_t - tdls rx idle config
298 *
299 * @timeout: timeout
300 */
301typedef struct {
302 uint16_t timeout;
303} tdls_rx_idle_config_t;
304
305/**
306 * struct tdls_rssi_config_t - tdls rssi config
307 *
308 * @rssi_thres: rssi_thres
309 */
310typedef struct {
311 uint16_t rssi_thres;
312} tdls_rssi_config_t;
313
314struct _hddTdlsPeer_t;
315
316/**
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700317 * struct tdls_ct_mac_table - connection tracker peer mac address table
318 * @mac_address: peer mac address
319 * @tx_packet_cnt: number of tx pkts
320 * @rx_packet_cnt: number of rx pkts
321 * @peer_timestamp_ms: time stamp of latest peer traffic
322 */
323struct tdls_ct_mac_table {
324 struct qdf_mac_addr mac_address;
325 uint32_t tx_packet_cnt;
326 uint32_t rx_packet_cnt;
327 uint32_t peer_timestamp_ms;
328};
Kabilan Kannan163fd0b2016-06-08 15:21:51 -0700329
330/**
331 * struct tdls_set_state_db - set state command data base
332 * @set_state_cnt: tdls set state count
333 * @vdev_id: vdev id of last set state command
334 */
335struct tdls_set_state_info {
336 uint8_t set_state_cnt;
337 uint8_t vdev_id;
338};
339
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700340/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800341 * struct tdlsCtx_t - tdls context
342 *
343 * @peer_list: peer list
344 * @pAdapter: pointer to adapter
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700345 * @peer_update_timer: connection tracker timer
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800346 * @peerDiscoverTimer: peer discovery timer
347 * @peerDiscoveryTimeoutTimer: peer discovery timeout timer
348 * @threshold_config: threshold config
349 * @discovery_peer_cnt: discovery peer count
350 * @discovery_sent_cnt: discovery sent count
351 * @ap_rssi: ap rssi
352 * @curr_candidate: current candidate
353 * @implicit_setup: implicit setup work queue
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700354 * @ct_peer_mac_table: linear mac address table for counting the packets
355 * @valid_mac_entries: number of valid mac entry in @ct_peer_mac_table
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800356 * @magic: magic
357 *
358 */
359typedef struct {
360 struct list_head peer_list[TDLS_PEER_LIST_SIZE];
361 hdd_adapter_t *pAdapter;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700362 qdf_mc_timer_t peer_update_timer;
Anurag Chouhan210db072016-02-22 18:42:15 +0530363 qdf_mc_timer_t peerDiscoveryTimeoutTimer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800364 tdls_config_params_t threshold_config;
365 int32_t discovery_peer_cnt;
366 uint32_t discovery_sent_cnt;
367 int8_t ap_rssi;
368 struct _hddTdlsPeer_t *curr_candidate;
369 struct work_struct implicit_setup;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700370 struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE];
371 uint8_t valid_mac_entries;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800372 uint32_t magic;
373} tdlsCtx_t;
374
375/**
376 * struct hddTdlsPeer_t - tdls peer data
377 *
378 * @node: node
379 * @pHddTdlsCtx: pointer to tdls context
380 * @peerMac: peer mac address
381 * @staId: station identifier
382 * @rssi: rssi
383 * @tdls_support: tdls support
384 * @link_status: tdls link status
385 * @signature: signature
386 * @is_responder: is responder
387 * @discovery_processed: discovery processed flag
388 * @discovery_attempt: discovery attempt
389 * @tx_pkt: tx packet
390 * @rx_pkt: rx packet
391 * @uapsdQueues: uapsd queues
392 * @maxSp: max sp
393 * @isBufSta: is buffer sta
394 * @isOffChannelSupported: is offchannel supported flag
395 * @supported_channels_len: supported channels length
396 * @supported_channels: supported channels
397 * @supported_oper_classes_len: supported operation classes length
398 * @supported_oper_classes: supported operation classes
399 * @isForcedPeer: is forced peer
400 * @op_class_for_pref_off_chan: op class for preferred off channel
401 * @pref_off_chan_num: preferred off channel number
402 * @op_class_for_pref_off_chan_is_set: op class for preferred off channel set
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700403 * @peer_idle_timer: time to check idle traffic in tdls peers
404 * @is_peer_idle_timer_initialised: Flag to check idle timer init
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700405 * @spatial_streams: Number of TX/RX spatial streams for TDLS
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800406 * @reason: reason
407 * @state_change_notification: state change notification
Agrawal Ashishd3f22f62016-09-04 13:46:15 +0530408 * @qos: QOS capability of TDLS link
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800409 */
410typedef struct _hddTdlsPeer_t {
411 struct list_head node;
412 tdlsCtx_t *pHddTdlsCtx;
413 tSirMacAddr peerMac;
414 uint16_t staId;
415 int8_t rssi;
416 tTDLSCapType tdls_support;
417 tTDLSLinkStatus link_status;
418 uint8_t signature;
419 uint8_t is_responder;
420 uint8_t discovery_processed;
421 uint16_t discovery_attempt;
422 uint16_t tx_pkt;
423 uint16_t rx_pkt;
424 uint8_t uapsdQueues;
425 uint8_t maxSp;
426 uint8_t isBufSta;
427 uint8_t isOffChannelSupported;
428 uint8_t supported_channels_len;
429 uint8_t supported_channels[SIR_MAC_MAX_SUPP_CHANNELS];
430 uint8_t supported_oper_classes_len;
Naveen Rawat3b6068c2016-04-14 19:01:06 -0700431 uint8_t supported_oper_classes[CDS_MAX_SUPP_OPER_CLASSES];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800432 bool isForcedPeer;
433 uint8_t op_class_for_pref_off_chan;
434 uint8_t pref_off_chan_num;
435 uint8_t op_class_for_pref_off_chan_is_set;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700436 qdf_mc_timer_t peer_idle_timer;
437 bool is_peer_idle_timer_initialised;
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700438 uint8_t spatial_streams;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800439 tTDLSLinkReason reason;
440 cfg80211_exttdls_callback state_change_notification;
Agrawal Ashishd3f22f62016-09-04 13:46:15 +0530441 uint8_t qos;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800442} hddTdlsPeer_t;
443
444/**
445 * struct tdlsConnInfo_t - tdls connection info
446 *
447 * @sessionId: Session ID
448 * @staId: TDLS peer station id
449 * @peerMac: peer mac address
450 */
451typedef struct {
452 uint8_t sessionId;
453 uint8_t staId;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530454 struct qdf_mac_addr peerMac;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800455} tdlsConnInfo_t;
456
457/**
458 * struct tdlsInfo_t - tdls info
459 *
460 * @vdev_id: vdev id
461 * @tdls_state: tdls state
462 * @notification_interval_ms: notification interval in ms
463 * @tx_discovery_threshold: tx discovery threshold
464 * @tx_teardown_threshold: tx teardown threshold
465 * @rssi_teardown_threshold: rx teardown threshold
466 * @rssi_delta: rssi delta
467 * @tdls_options: tdls options
468 * @peer_traffic_ind_window: peer traffic indication window
469 * @peer_traffic_response_timeout: peer traffic response timeout
470 * @puapsd_mask: puapsd mask
471 * @puapsd_inactivity_time: puapsd inactivity time
472 * @puapsd_rx_frame_threshold: puapsd rx frame threshold
Kabilan Kannanca670be2015-11-23 01:56:12 -0800473 * @teardown_notification_ms: tdls teardown notification interval
Kabilan Kannan421714b2015-11-23 04:44:59 -0800474 * @tdls_peer_kickout_threshold: tdls packets threshold
475 * for peer kickout operation
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800476 */
477typedef struct {
478 uint32_t vdev_id;
479 uint32_t tdls_state;
480 uint32_t notification_interval_ms;
481 uint32_t tx_discovery_threshold;
482 uint32_t tx_teardown_threshold;
483 int32_t rssi_teardown_threshold;
484 int32_t rssi_delta;
485 uint32_t tdls_options;
486 uint32_t peer_traffic_ind_window;
487 uint32_t peer_traffic_response_timeout;
488 uint32_t puapsd_mask;
489 uint32_t puapsd_inactivity_time;
490 uint32_t puapsd_rx_frame_threshold;
Kabilan Kannanca670be2015-11-23 01:56:12 -0800491 uint32_t teardown_notification_ms;
Kabilan Kannan421714b2015-11-23 04:44:59 -0800492 uint32_t tdls_peer_kickout_threshold;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800493} tdlsInfo_t;
494
495int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter);
496
497void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter);
498
499void wlan_hdd_tdls_extract_da(struct sk_buff *skb, uint8_t *mac);
500
501void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, uint8_t *mac);
502
503int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter,
504 const uint8_t *mac, uint8_t tx);
505
506int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, const uint8_t *mac,
507 uint8_t staId);
508
509hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter,
510 const uint8_t *mac, bool mutexLock);
511
512hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx,
513 const uint8_t *mac);
514
515int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter,
516 const uint8_t *mac,
517 tCsrTdlsLinkEstablishParams *
518 tdlsLinkEstablishParams);
519hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700520 const uint8_t *mac,
521 bool need_mutex_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800522
523int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, const uint8_t *mac,
524 tTDLSCapType cap);
525
526void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer,
527 tTDLSLinkStatus status,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700528 tTDLSLinkReason reason,
529 bool lock_needed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800530void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter,
531 const uint8_t *mac,
532 tTDLSLinkStatus linkStatus,
533 tTDLSLinkReason reason);
534
535int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter,
536 const uint8_t *mac);
537
538int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter,
539 const uint8_t *mac,
540 tCsrStaParams *StaParams,
Nitesh Shah99934ac2016-09-05 15:54:08 +0530541 bool isBufSta, bool isOffChannelSupported,
542 bool is_qos_wmm_sta);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800543
544int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, const uint8_t *mac,
545 int8_t rxRssi);
546
547int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, const uint8_t *mac,
548 uint8_t responder);
549
550int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, const uint8_t *mac,
551 uint8_t uSignature);
552
553int wlan_hdd_tdls_set_params(struct net_device *dev,
554 tdls_config_params_t *config);
555
556int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, const uint8_t *mac);
557
558uint16_t wlan_hdd_tdls_connected_peers(hdd_adapter_t *pAdapter);
559
560int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf,
561 int buflen);
562
563void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter);
564
565void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter);
566
567void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter,
568 uint32_t statusCode);
569
Jeff Johnson414e9f32016-10-05 15:46:19 -0700570void wlan_hdd_tdls_increment_peer_count(hdd_adapter_t *pAdapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800571
572void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter);
573
574hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700575 const uint8_t *mac, uint8_t skip_self,
576 bool need_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800577
578int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
579 struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800580 struct cfg80211_scan_request *request);
581
582int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800583 struct cfg80211_scan_request *request);
584
585void wlan_hdd_tdls_scan_done_callback(hdd_adapter_t *pAdapter);
586
587void wlan_hdd_tdls_timer_restart(hdd_adapter_t *pAdapter,
Anurag Chouhan210db072016-02-22 18:42:15 +0530588 qdf_mc_timer_t *timer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800589 uint32_t expirationTime);
590void wlan_hdd_tdls_indicate_teardown(hdd_adapter_t *pAdapter,
591 hddTdlsPeer_t *curr_peer,
592 uint16_t reason);
593
594void wlan_hdd_tdls_pre_setup_init_work(tdlsCtx_t *pHddTdlsCtx,
595 hddTdlsPeer_t *curr_candidate);
596
597int wlan_hdd_tdls_set_extctrl_param(hdd_adapter_t *pAdapter,
598 const uint8_t *mac,
599 uint32_t chan,
600 uint32_t max_latency,
601 uint32_t op_class, uint32_t min_bandwidth);
602int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter, const uint8_t *mac,
603 bool forcePeer);
604
Kabilan Kannan421714b2015-11-23 04:44:59 -0800605int wlan_hdd_tdls_update_peer_mac(hdd_adapter_t *adapter,
606 const uint8_t *mac,
607 uint32_t peer_state);
608
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800609int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter,
610 const uint8_t *peer);
611int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter,
612 const uint8_t *peer,
613 cfg80211_exttdls_callback callback,
614 uint32_t chan,
615 uint32_t max_latency,
616 uint32_t op_class,
617 uint32_t min_bandwidth);
618int wlan_hdd_tdls_get_status(hdd_adapter_t *pAdapter,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530619 const uint8_t *mac, uint32_t *opclass,
620 uint32_t *channel, uint32_t *state,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800621 int32_t *reason);
622void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530623 uint32_t *state, int32_t *reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800624int wlan_hdd_set_callback(hddTdlsPeer_t *curr_peer,
625 cfg80211_exttdls_callback callback);
626void wlan_hdd_update_tdls_info(hdd_adapter_t *adapter, bool tdls_prohibited,
627 bool tdls_chan_swit_prohibited);
628
629int wlan_hdd_tdls_add_station(struct wiphy *wiphy,
630 struct net_device *dev, const uint8_t *mac,
631 bool update, tCsrStaParams *StaParams);
632
633int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
634 struct wireless_dev *wdev,
635 const void *data,
636 int data_len);
637
638int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
639 struct wireless_dev *wdev,
640 const void *data,
641 int data_len);
642
643int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
644 struct wireless_dev *wdev,
645 const void *data,
646 int data_len);
647
648#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
649int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
650 struct net_device *dev,
651 const uint8_t *peer,
652 enum nl80211_tdls_operation oper);
653#else
654int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
655 struct net_device *dev,
656 uint8_t *peer,
657 enum nl80211_tdls_operation oper);
658#endif
659
660#ifdef TDLS_MGMT_VERSION2
661int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
662 struct net_device *dev, u8 *peer,
663 u8 action_code, u8 dialog_token,
664 u16 status_code, u32 peer_capability,
665 const u8 *buf, size_t len);
666#else
667#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
668int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
669 struct net_device *dev, const uint8_t *peer,
670 uint8_t action_code, uint8_t dialog_token,
671 uint16_t status_code, uint32_t peer_capability,
672 bool initiator, const uint8_t *buf,
673 size_t len);
674#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
675int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
676 struct net_device *dev, const uint8_t *peer,
677 uint8_t action_code, uint8_t dialog_token,
678 uint16_t status_code, uint32_t peer_capability,
679 const uint8_t *buf, size_t len);
680#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
681int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
682 struct net_device *dev, uint8_t *peer,
683 uint8_t action_code, uint8_t dialog_token,
684 uint16_t status_code, uint32_t peer_capability,
685 const uint8_t *buf, size_t len);
686#else
687int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
688 struct net_device *dev, uint8_t *peer,
689 uint8_t action_code, uint8_t dialog_token,
690 uint16_t status_code, const uint8_t *buf,
691 size_t len);
692#endif
693#endif
694
695void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
696 hdd_context_t *hddctx);
697void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx);
698
699hddTdlsPeer_t *wlan_hdd_tdls_find_first_connected_peer(hdd_adapter_t *adapter);
700int hdd_set_tdls_offchannel(hdd_context_t *hdd_ctx, int offchannel);
701int hdd_set_tdls_secoffchanneloffset(hdd_context_t *hdd_ctx, int offchanoffset);
702int hdd_set_tdls_offchannelmode(hdd_adapter_t *adapter, int offchanmode);
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700703void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
704 struct sk_buff *skb);
705void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
706 struct sk_buff *skb);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800707int hdd_set_tdls_scan_type(hdd_context_t *hdd_ctx, int val);
Prashanth Bhatta527fd752016-04-28 12:35:23 -0700708void hdd_tdls_context_init(hdd_context_t *hdd_ctx);
709void hdd_tdls_context_destroy(hdd_context_t *hdd_ctx);
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700710int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700711 hdd_adapter_t *adapter,
712 uint32_t mode);
Kabilan Kannan32eb5022016-10-04 12:24:50 -0700713/**
714 * wlan_hdd_tdls_notify_connect() - Update tdls state for every
715 * connect event.
716 * @adapter: hdd adapter
717 * @csr_roam_info: csr information
718 *
719 * After every connect event in the system, check whether TDLS
720 * can be enabled in the system. If TDLS can be enabled, update the
721 * TDLS state as needed.
722 *
723 * Return: None
724 */
725void wlan_hdd_tdls_notify_connect(hdd_adapter_t *adapter,
726 tCsrRoamInfo *csr_roam_info);
Kabilan Kannan163fd0b2016-06-08 15:21:51 -0700727
Kabilan Kannan32eb5022016-10-04 12:24:50 -0700728/**
729 * wlan_hdd_tdls_notify_disconnect() - Update tdls state for every
730 * disconnect event.
731 * @adapter: hdd adapter
732 *
733 * After every disconnect event in the system, check whether TDLS
734 * can be disabled/enabled in the system and update the
735 * TDLS state as needed.
736 *
737 * Return: None
738 */
739void wlan_hdd_tdls_notify_disconnect(hdd_adapter_t *adapter);
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700740
Kabilan Kannand053aaf2016-10-26 02:06:14 -0700741/**
742 * wlan_hdd_cfg80211_configure_tdls_mode() - configure tdls mode
743 * @wiphy: pointer to wireless wiphy structure.
744 * @wdev: pointer to wireless_dev structure.
745 * @data: Pointer to the data to be passed via vendor interface
746 * @data_len:Length of the data to be passed
747 *
748 * Return: Return the Success or Failure code.
749 */
750int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy,
751 struct wireless_dev *wdev,
752 const void *data,
753 int data_len);
754
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800755#else
756static inline void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
757 hdd_context_t *hddctx)
758{
759}
760static inline void
761wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx)
762{
763}
764static inline void wlan_hdd_tdls_exit(hdd_adapter_t *adapter)
765{
766}
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700767static inline void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
768 struct sk_buff *skb)
769{
770}
771static inline void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
772 struct sk_buff *skb)
773{
774}
Prashanth Bhatta527fd752016-04-28 12:35:23 -0700775static inline void hdd_tdls_context_init(hdd_context_t *hdd_ctx) { }
776static inline void hdd_tdls_context_destroy(hdd_context_t *hdd_ctx) { }
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700777
778static inline int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700779 hdd_adapter_t *adapter,
780 uint32_t mode)
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700781{
782 return 0;
783}
Kabilan Kannan163fd0b2016-06-08 15:21:51 -0700784static inline void wlan_hdd_update_tdls_info(hdd_adapter_t *adapter,
785 bool tdls_prohibited,
786 bool tdls_chan_swit_prohibited)
787{
788}
Kabilan Kannan32eb5022016-10-04 12:24:50 -0700789static inline void wlan_hdd_tdls_notify_connect(hdd_adapter_t *adapter,
790 tCsrRoamInfo *csr_roam_info)
791{
792}
793static inline void wlan_hdd_tdls_notify_disconnect(hdd_adapter_t *adapter)
794{
795}
Kabilan Kannand053aaf2016-10-26 02:06:14 -0700796
797static inline int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy,
798 struct wireless_dev *wdev,
799 const void *data,
800 int data_len)
801{
802 return 0;
803}
804
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800805#endif /* End of FEATURE_WLAN_TDLS */
806
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530807#ifdef FEATURE_WLAN_DIAG_SUPPORT
808void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
809 uint8_t *peer_mac);
Abhishek Singh74bcb0a2016-04-27 12:30:48 +0530810void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
811 uint8_t is_off_chan_supported,
812 uint8_t is_off_chan_configured,
813 uint8_t is_off_chan_established);
Abhishek Singhaf1d0c92016-04-27 13:46:59 +0530814void hdd_wlan_block_scan_by_tdls_event(void);
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530815#else
816static inline
817void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
818 uint8_t *peer_mac) {}
Abhishek Singh74bcb0a2016-04-27 12:30:48 +0530819static inline
820void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
821 uint8_t is_off_chan_supported,
822 uint8_t is_off_chan_configured,
823 uint8_t is_off_chan_established) {}
Abhishek Singhaf1d0c92016-04-27 13:46:59 +0530824static inline void hdd_wlan_block_scan_by_tdls_event(void) {}
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530825#endif /* FEATURE_WLAN_DIAG_SUPPORT */
826
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800827#endif /* __HDD_TDLS_H */