blob: b252d8bba9302cd00f5e3f5f5539abce83947a04 [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/**
Nitesh Shah2b946fa2016-10-19 17:05:09 +053073 * enum tdls_disable_source - TDLS disable sources
74 * @HDD_SET_TDLS_MODE_SOURCE_USER: disable from user
75 * @HDD_SET_TDLS_MODE_SOURCE_SCAN: disable during scan
76 * @HDD_SET_TDLS_MODE_SOURCE_OFFCHANNEL: disable during offchannel
77 * @HDD_SET_TDLS_MODE_SOURCE_BTC: disable during bluetooth
78 * @HDD_SET_TDLS_MODE_SOURCE_P2P: disable during p2p
79 */
80enum tdls_disable_source {
81 HDD_SET_TDLS_MODE_SOURCE_USER = 0,
82 HDD_SET_TDLS_MODE_SOURCE_SCAN,
83 HDD_SET_TDLS_MODE_SOURCE_OFFCHANNEL,
84 HDD_SET_TDLS_MODE_SOURCE_BTC,
85 HDD_SET_TDLS_MODE_SOURCE_P2P,
86};
87
88/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080089 * struct tdls_config_params_t - tdls config params
90 *
91 * @tdls: tdls
92 * @tx_period_t: tx period
93 * @tx_packet_n: tx packets number
94 * @discovery_tries_n: discovery tries
Kabilan Kannan36090ce2016-05-03 19:28:44 -070095 * @idle_timeout_t: idle traffic time out value
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080096 * @idle_packet_n: idle packet number
97 * @rssi_trigger_threshold: rssi trigger threshold
98 * @rssi_teardown_threshold: rssi tear down threshold
99 * @rssi_delta: rssi delta
100 */
101typedef struct {
102 uint32_t tdls;
103 uint32_t tx_period_t;
104 uint32_t tx_packet_n;
105 uint32_t discovery_tries_n;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700106 uint32_t idle_timeout_t;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800107 uint32_t idle_packet_n;
108 int32_t rssi_trigger_threshold;
109 int32_t rssi_teardown_threshold;
110 int32_t rssi_delta;
111} tdls_config_params_t;
112
113/**
114 * struct tdls_scan_context_t - tdls scan context
115 *
116 * @wiphy: pointer to wiphy structure
117 * @dev: pointer to netdev
118 * @scan_request: scan request
119 * @magic: magic
120 * @attempt: attempt
121 * @reject: reject
122 * @tdls_scan_work: delayed tdls scan work
123 */
124typedef struct {
125 struct wiphy *wiphy;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800126 struct cfg80211_scan_request *scan_request;
127 int magic;
128 int attempt;
129 int reject;
130 struct delayed_work tdls_scan_work;
131} tdls_scan_context_t;
132
133/**
134 * enum eTDLSSupportMode - tdls support mode
135 *
136 * @eTDLS_SUPPORT_NOT_ENABLED: tdls support not enabled
137 * @eTDLS_SUPPORT_DISABLED: suppress implicit trigger and not
138 * respond to the peer
139 * @eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY: suppress implicit trigger,
140 * but respond to the peer
141 * @eTDLS_SUPPORT_ENABLED: implicit trigger
Kabilan Kannan421714b2015-11-23 04:44:59 -0800142 * @eTDLS_SUPPORT_EXTERNAL_CONTROL: External control means implicit
143 * trigger but only to a peer mac configured by user space.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800144 */
145typedef enum {
146 eTDLS_SUPPORT_NOT_ENABLED = 0,
147 eTDLS_SUPPORT_DISABLED,
148 eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY,
149 eTDLS_SUPPORT_ENABLED,
Kabilan Kannan421714b2015-11-23 04:44:59 -0800150 eTDLS_SUPPORT_EXTERNAL_CONTROL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800151} eTDLSSupportMode;
152
153/**
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700154 * enum tdls_spatial_streams - TDLS spatial streams
155 * @TDLS_NSS_1x1_MODE: TDLS tx/rx spatial streams = 1
156 * @TDLS_NSS_2x2_MODE: TDLS tx/rx spatial streams = 2
157 */
158enum tdls_spatial_streams {
159 TDLS_NSS_1x1_MODE = 0,
160 TDLS_NSS_2x2_MODE = 0xff,
161};
162
163/**
Kabilan Kannanff89f742016-08-15 18:14:10 -0700164 * enum tdls_nss_transition_type - TDLS NSS transition states
165 * @TDLS_NSS_TRANSITION_UNKNOWN: default state
166 * @TDLS_NSS_TRANSITION_2x2_to_1x1: transition from 2x2 to 1x1 stream
167 * @TDLS_NSS_TRANSITION_1x1_to_2x2: transition from 1x1 to 2x2 stream
168 */
169enum tdls_nss_transition_type {
170 TDLS_NSS_TRANSITION_UNKNOWN = 0,
171 TDLS_NSS_TRANSITION_2x2_to_1x1,
172 TDLS_NSS_TRANSITION_1x1_to_2x2,
173};
174
175/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800176 * enum tTDLSCapType - tdls capability type
177 *
178 * @eTDLS_CAP_NOT_SUPPORTED: tdls not supported
179 * @eTDLS_CAP_UNKNOWN: unknown capability
180 * @eTDLS_CAP_SUPPORTED: tdls capability supported
181 */
182typedef enum eTDLSCapType {
183 eTDLS_CAP_NOT_SUPPORTED = -1,
184 eTDLS_CAP_UNKNOWN = 0,
185 eTDLS_CAP_SUPPORTED = 1,
186} tTDLSCapType;
187
188/**
189 * enum tTDLSLinkStatus - tdls link status
190 *
191 * @eTDLS_LINK_IDLE: tdls link idle
192 * @eTDLS_LINK_DISCOVERING: tdls link discovering
193 * @eTDLS_LINK_DISCOVERED: tdls link discovered
194 * @eTDLS_LINK_CONNECTING: tdls link connecting
195 * @eTDLS_LINK_CONNECTED: tdls link connected
196 * @eTDLS_LINK_TEARING: tdls link tearing
197 */
198typedef enum eTDLSLinkStatus {
199 eTDLS_LINK_IDLE = 0,
200 eTDLS_LINK_DISCOVERING,
201 eTDLS_LINK_DISCOVERED,
202 eTDLS_LINK_CONNECTING,
203 eTDLS_LINK_CONNECTED,
204 eTDLS_LINK_TEARING,
205} tTDLSLinkStatus;
206
207/**
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530208 * enum tdls_teardown_reason - Reason for TDLS teardown
209 * @eTDLS_TEARDOWN_EXT_CTRL: Reason ext ctrl.
210 * @eTDLS_TEARDOWN_CONCURRENCY: Reason concurrency.
211 * @eTDLS_TEARDOWN_RSSI_THRESHOLD: Reason rssi threshold.
212 * @eTDLS_TEARDOWN_TXRX_THRESHOLD: Reason txrx threshold.
213 * @eTDLS_TEARDOWN_BTCOEX: Reason BTCOEX.
214 * @eTDLS_TEARDOWN_SCAN: Reason scan.
215 * @eTDLS_TEARDOWN_BSS_DISCONNECT: Reason bss disconnected.
216 * @eTDLS_TEARDOWN_ANTENNA_SWITCH: Disconnected due to antenna switch
217 *
218 * Reason to indicate in diag event of tdls teardown.
219 */
220enum tdls_teardown_reason {
221 eTDLS_TEARDOWN_EXT_CTRL,
222 eTDLS_TEARDOWN_CONCURRENCY,
223 eTDLS_TEARDOWN_RSSI_THRESHOLD,
224 eTDLS_TEARDOWN_TXRX_THRESHOLD,
225 eTDLS_TEARDOWN_BTCOEX,
226 eTDLS_TEARDOWN_SCAN,
227 eTDLS_TEARDOWN_BSS_DISCONNECT,
228 eTDLS_TEARDOWN_ANTENNA_SWITCH,
229};
230
231/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800232 * enum tTDLSLinkReason - tdls link reason
233 *
234 * @eTDLS_LINK_SUCCESS: Success
235 * @eTDLS_LINK_UNSPECIFIED: Unspecified reason
236 * @eTDLS_LINK_NOT_SUPPORTED: Remote side doesn't support TDLS
237 * @eTDLS_LINK_UNSUPPORTED_BAND: Remote side doesn't support this band
238 * @eTDLS_LINK_NOT_BENEFICIAL: Going to AP is better than direct
239 * @eTDLS_LINK_DROPPED_BY_REMOTE: Remote side doesn't want it anymore
240 */
241typedef enum {
242 eTDLS_LINK_SUCCESS,
243 eTDLS_LINK_UNSPECIFIED = -1,
244 eTDLS_LINK_NOT_SUPPORTED = -2,
245 eTDLS_LINK_UNSUPPORTED_BAND = -3,
246 eTDLS_LINK_NOT_BENEFICIAL = -4,
247 eTDLS_LINK_DROPPED_BY_REMOTE = -5
248} tTDLSLinkReason;
249
250/**
251 * struct tdls_req_params_t - tdls request parameters
252 *
253 * @channel: channel hint, in channel number (NOT frequency)
254 * @global_operating_class: operating class to use
255 * @max_latency_ms: max latency that can be tolerated by apps
256 * @min_bandwidth_kbps: bandwidth required by apps, in kilo bits per second
257 */
258typedef struct {
259 int channel;
260 int global_operating_class;
261 int max_latency_ms;
262 int min_bandwidth_kbps;
263} tdls_req_params_t;
264
265/**
266 * enum tdls_state_t - tdls state
267 *
268 * @QCA_WIFI_HAL_TDLS_DISABLED: TDLS is not enabled, or is disabled now
269 * @QCA_WIFI_HAL_TDLS_ENABLED: TDLS is enabled, but not yet tried
270 * @QCA_WIFI_HAL_TDLS_ESTABLISHED: Direct link is established
271 * @QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL: Direct link established using MCC
272 * @QCA_WIFI_HAL_TDLS_DROPPED: Direct link was established, but is now dropped
273 * @QCA_WIFI_HAL_TDLS_FAILED: Direct link failed
274 */
275typedef enum {
276 QCA_WIFI_HAL_TDLS_DISABLED = 1,
277 QCA_WIFI_HAL_TDLS_ENABLED,
278 QCA_WIFI_HAL_TDLS_ESTABLISHED,
279 QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL,
280 QCA_WIFI_HAL_TDLS_DROPPED,
281 QCA_WIFI_HAL_TDLS_FAILED
282} tdls_state_t;
283
284typedef int (*cfg80211_exttdls_callback)(const uint8_t *mac,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530285 uint32_t opclass,
286 uint32_t channel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800287 uint32_t state,
288 int32_t reason, void *ctx);
289
290/**
291 * struct tdls_tx_tput_config_t - tdls tx throughput config
292 *
293 * @period: period
294 * @bytes: bytes
295 */
296typedef struct {
297 uint16_t period;
298 uint16_t bytes;
299} tdls_tx_tput_config_t;
300
301/**
302 * struct tdls_discovery_config_t - tdls discovery config
303 *
304 * @period: period
305 * @tries: number of tries
306 */
307typedef struct {
308 uint16_t period;
309 uint16_t tries;
310} tdls_discovery_config_t;
311
312/**
313 * struct tdls_rx_idle_config_t - tdls rx idle config
314 *
315 * @timeout: timeout
316 */
317typedef struct {
318 uint16_t timeout;
319} tdls_rx_idle_config_t;
320
321/**
322 * struct tdls_rssi_config_t - tdls rssi config
323 *
324 * @rssi_thres: rssi_thres
325 */
326typedef struct {
327 uint16_t rssi_thres;
328} tdls_rssi_config_t;
329
330struct _hddTdlsPeer_t;
331
332/**
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700333 * struct tdls_ct_mac_table - connection tracker peer mac address table
334 * @mac_address: peer mac address
335 * @tx_packet_cnt: number of tx pkts
336 * @rx_packet_cnt: number of rx pkts
337 * @peer_timestamp_ms: time stamp of latest peer traffic
338 */
339struct tdls_ct_mac_table {
340 struct qdf_mac_addr mac_address;
341 uint32_t tx_packet_cnt;
342 uint32_t rx_packet_cnt;
343 uint32_t peer_timestamp_ms;
344};
Kabilan Kannan163fd0b2016-06-08 15:21:51 -0700345
346/**
347 * struct tdls_set_state_db - set state command data base
348 * @set_state_cnt: tdls set state count
349 * @vdev_id: vdev id of last set state command
350 */
351struct tdls_set_state_info {
352 uint8_t set_state_cnt;
353 uint8_t vdev_id;
354};
355
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700356/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800357 * struct tdlsCtx_t - tdls context
358 *
359 * @peer_list: peer list
360 * @pAdapter: pointer to adapter
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700361 * @peer_update_timer: connection tracker timer
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800362 * @peerDiscoverTimer: peer discovery timer
363 * @peerDiscoveryTimeoutTimer: peer discovery timeout timer
364 * @threshold_config: threshold config
365 * @discovery_peer_cnt: discovery peer count
366 * @discovery_sent_cnt: discovery sent count
367 * @ap_rssi: ap rssi
368 * @curr_candidate: current candidate
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700369 * @ct_peer_mac_table: linear mac address table for counting the packets
370 * @valid_mac_entries: number of valid mac entry in @ct_peer_mac_table
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800371 * @magic: magic
372 *
373 */
374typedef struct {
375 struct list_head peer_list[TDLS_PEER_LIST_SIZE];
376 hdd_adapter_t *pAdapter;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700377 qdf_mc_timer_t peer_update_timer;
Anurag Chouhan210db072016-02-22 18:42:15 +0530378 qdf_mc_timer_t peerDiscoveryTimeoutTimer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800379 tdls_config_params_t threshold_config;
380 int32_t discovery_peer_cnt;
381 uint32_t discovery_sent_cnt;
382 int8_t ap_rssi;
383 struct _hddTdlsPeer_t *curr_candidate;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700384 struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE];
385 uint8_t valid_mac_entries;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800386 uint32_t magic;
387} tdlsCtx_t;
388
389/**
390 * struct hddTdlsPeer_t - tdls peer data
391 *
392 * @node: node
393 * @pHddTdlsCtx: pointer to tdls context
394 * @peerMac: peer mac address
395 * @staId: station identifier
396 * @rssi: rssi
397 * @tdls_support: tdls support
398 * @link_status: tdls link status
399 * @signature: signature
400 * @is_responder: is responder
401 * @discovery_processed: discovery processed flag
402 * @discovery_attempt: discovery attempt
403 * @tx_pkt: tx packet
404 * @rx_pkt: rx packet
405 * @uapsdQueues: uapsd queues
406 * @maxSp: max sp
407 * @isBufSta: is buffer sta
408 * @isOffChannelSupported: is offchannel supported flag
409 * @supported_channels_len: supported channels length
410 * @supported_channels: supported channels
411 * @supported_oper_classes_len: supported operation classes length
412 * @supported_oper_classes: supported operation classes
413 * @isForcedPeer: is forced peer
414 * @op_class_for_pref_off_chan: op class for preferred off channel
415 * @pref_off_chan_num: preferred off channel number
416 * @op_class_for_pref_off_chan_is_set: op class for preferred off channel set
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700417 * @peer_idle_timer: time to check idle traffic in tdls peers
418 * @is_peer_idle_timer_initialised: Flag to check idle timer init
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700419 * @spatial_streams: Number of TX/RX spatial streams for TDLS
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800420 * @reason: reason
421 * @state_change_notification: state change notification
Agrawal Ashishd3f22f62016-09-04 13:46:15 +0530422 * @qos: QOS capability of TDLS link
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800423 */
424typedef struct _hddTdlsPeer_t {
425 struct list_head node;
426 tdlsCtx_t *pHddTdlsCtx;
427 tSirMacAddr peerMac;
428 uint16_t staId;
429 int8_t rssi;
430 tTDLSCapType tdls_support;
431 tTDLSLinkStatus link_status;
432 uint8_t signature;
433 uint8_t is_responder;
434 uint8_t discovery_processed;
435 uint16_t discovery_attempt;
436 uint16_t tx_pkt;
437 uint16_t rx_pkt;
438 uint8_t uapsdQueues;
439 uint8_t maxSp;
440 uint8_t isBufSta;
441 uint8_t isOffChannelSupported;
442 uint8_t supported_channels_len;
443 uint8_t supported_channels[SIR_MAC_MAX_SUPP_CHANNELS];
444 uint8_t supported_oper_classes_len;
Naveen Rawat3b6068c2016-04-14 19:01:06 -0700445 uint8_t supported_oper_classes[CDS_MAX_SUPP_OPER_CLASSES];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800446 bool isForcedPeer;
447 uint8_t op_class_for_pref_off_chan;
448 uint8_t pref_off_chan_num;
449 uint8_t op_class_for_pref_off_chan_is_set;
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700450 qdf_mc_timer_t peer_idle_timer;
451 bool is_peer_idle_timer_initialised;
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700452 uint8_t spatial_streams;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800453 tTDLSLinkReason reason;
454 cfg80211_exttdls_callback state_change_notification;
Agrawal Ashishd3f22f62016-09-04 13:46:15 +0530455 uint8_t qos;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800456} hddTdlsPeer_t;
457
458/**
459 * struct tdlsConnInfo_t - tdls connection info
460 *
461 * @sessionId: Session ID
462 * @staId: TDLS peer station id
463 * @peerMac: peer mac address
464 */
465typedef struct {
466 uint8_t sessionId;
467 uint8_t staId;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530468 struct qdf_mac_addr peerMac;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800469} tdlsConnInfo_t;
470
471/**
472 * struct tdlsInfo_t - tdls info
473 *
474 * @vdev_id: vdev id
475 * @tdls_state: tdls state
476 * @notification_interval_ms: notification interval in ms
477 * @tx_discovery_threshold: tx discovery threshold
478 * @tx_teardown_threshold: tx teardown threshold
479 * @rssi_teardown_threshold: rx teardown threshold
480 * @rssi_delta: rssi delta
481 * @tdls_options: tdls options
482 * @peer_traffic_ind_window: peer traffic indication window
483 * @peer_traffic_response_timeout: peer traffic response timeout
484 * @puapsd_mask: puapsd mask
485 * @puapsd_inactivity_time: puapsd inactivity time
486 * @puapsd_rx_frame_threshold: puapsd rx frame threshold
Kabilan Kannanca670be2015-11-23 01:56:12 -0800487 * @teardown_notification_ms: tdls teardown notification interval
Kabilan Kannan421714b2015-11-23 04:44:59 -0800488 * @tdls_peer_kickout_threshold: tdls packets threshold
489 * for peer kickout operation
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800490 */
491typedef struct {
492 uint32_t vdev_id;
493 uint32_t tdls_state;
494 uint32_t notification_interval_ms;
495 uint32_t tx_discovery_threshold;
496 uint32_t tx_teardown_threshold;
497 int32_t rssi_teardown_threshold;
498 int32_t rssi_delta;
499 uint32_t tdls_options;
500 uint32_t peer_traffic_ind_window;
501 uint32_t peer_traffic_response_timeout;
502 uint32_t puapsd_mask;
503 uint32_t puapsd_inactivity_time;
504 uint32_t puapsd_rx_frame_threshold;
Kabilan Kannanca670be2015-11-23 01:56:12 -0800505 uint32_t teardown_notification_ms;
Kabilan Kannan421714b2015-11-23 04:44:59 -0800506 uint32_t tdls_peer_kickout_threshold;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800507} tdlsInfo_t;
508
509int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter);
510
511void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter);
512
513void wlan_hdd_tdls_extract_da(struct sk_buff *skb, uint8_t *mac);
514
515void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, uint8_t *mac);
516
517int wlan_hdd_tdls_increment_pkt_count(hdd_adapter_t *pAdapter,
518 const uint8_t *mac, uint8_t tx);
519
520int wlan_hdd_tdls_set_sta_id(hdd_adapter_t *pAdapter, const uint8_t *mac,
521 uint8_t staId);
522
523hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter,
524 const uint8_t *mac, bool mutexLock);
525
526hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(hdd_context_t *pHddCtx,
527 const uint8_t *mac);
528
529int wlan_hdd_tdls_get_link_establish_params(hdd_adapter_t *pAdapter,
530 const uint8_t *mac,
531 tCsrTdlsLinkEstablishParams *
532 tdlsLinkEstablishParams);
533hddTdlsPeer_t *wlan_hdd_tdls_get_peer(hdd_adapter_t *pAdapter,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700534 const uint8_t *mac,
535 bool need_mutex_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800536
537int wlan_hdd_tdls_set_cap(hdd_adapter_t *pAdapter, const uint8_t *mac,
538 tTDLSCapType cap);
539
540void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer,
541 tTDLSLinkStatus status,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700542 tTDLSLinkReason reason,
543 bool lock_needed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800544void wlan_hdd_tdls_set_link_status(hdd_adapter_t *pAdapter,
545 const uint8_t *mac,
546 tTDLSLinkStatus linkStatus,
547 tTDLSLinkReason reason);
548
549int wlan_hdd_tdls_recv_discovery_resp(hdd_adapter_t *pAdapter,
550 const uint8_t *mac);
551
552int wlan_hdd_tdls_set_peer_caps(hdd_adapter_t *pAdapter,
553 const uint8_t *mac,
554 tCsrStaParams *StaParams,
Nitesh Shah99934ac2016-09-05 15:54:08 +0530555 bool isBufSta, bool isOffChannelSupported,
556 bool is_qos_wmm_sta);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800557
558int wlan_hdd_tdls_set_rssi(hdd_adapter_t *pAdapter, const uint8_t *mac,
559 int8_t rxRssi);
560
561int wlan_hdd_tdls_set_responder(hdd_adapter_t *pAdapter, const uint8_t *mac,
562 uint8_t responder);
563
564int wlan_hdd_tdls_set_signature(hdd_adapter_t *pAdapter, const uint8_t *mac,
565 uint8_t uSignature);
566
567int wlan_hdd_tdls_set_params(struct net_device *dev,
568 tdls_config_params_t *config);
569
570int wlan_hdd_tdls_reset_peer(hdd_adapter_t *pAdapter, const uint8_t *mac);
571
572uint16_t wlan_hdd_tdls_connected_peers(hdd_adapter_t *pAdapter);
573
574int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf,
575 int buflen);
576
577void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter);
578
579void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter);
580
581void wlan_hdd_tdls_mgmt_completion_callback(hdd_adapter_t *pAdapter,
582 uint32_t statusCode);
583
Jeff Johnson414e9f32016-10-05 15:46:19 -0700584void wlan_hdd_tdls_increment_peer_count(hdd_adapter_t *pAdapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800585
586void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter);
587
588hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx,
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700589 const uint8_t *mac, uint8_t skip_self,
590 bool need_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800591
592int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
593 struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800594 struct cfg80211_scan_request *request);
595
596int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800597 struct cfg80211_scan_request *request);
598
599void wlan_hdd_tdls_scan_done_callback(hdd_adapter_t *pAdapter);
600
601void wlan_hdd_tdls_timer_restart(hdd_adapter_t *pAdapter,
Anurag Chouhan210db072016-02-22 18:42:15 +0530602 qdf_mc_timer_t *timer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800603 uint32_t expirationTime);
604void wlan_hdd_tdls_indicate_teardown(hdd_adapter_t *pAdapter,
605 hddTdlsPeer_t *curr_peer,
606 uint16_t reason);
607
Nitesh Shah983e8f52016-11-25 12:36:29 +0530608void wlan_hdd_tdls_implicit_send_discovery_request(tdlsCtx_t *hdd_tdls_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800609
610int wlan_hdd_tdls_set_extctrl_param(hdd_adapter_t *pAdapter,
611 const uint8_t *mac,
612 uint32_t chan,
613 uint32_t max_latency,
614 uint32_t op_class, uint32_t min_bandwidth);
615int wlan_hdd_tdls_set_force_peer(hdd_adapter_t *pAdapter, const uint8_t *mac,
616 bool forcePeer);
617
Kabilan Kannan421714b2015-11-23 04:44:59 -0800618int wlan_hdd_tdls_update_peer_mac(hdd_adapter_t *adapter,
619 const uint8_t *mac,
620 uint32_t peer_state);
621
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800622int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter,
623 const uint8_t *peer);
624int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter,
625 const uint8_t *peer,
626 cfg80211_exttdls_callback callback,
627 uint32_t chan,
628 uint32_t max_latency,
629 uint32_t op_class,
630 uint32_t min_bandwidth);
631int wlan_hdd_tdls_get_status(hdd_adapter_t *pAdapter,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530632 const uint8_t *mac, uint32_t *opclass,
633 uint32_t *channel, uint32_t *state,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800634 int32_t *reason);
635void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +0530636 uint32_t *state, int32_t *reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800637int wlan_hdd_set_callback(hddTdlsPeer_t *curr_peer,
638 cfg80211_exttdls_callback callback);
639void wlan_hdd_update_tdls_info(hdd_adapter_t *adapter, bool tdls_prohibited,
640 bool tdls_chan_swit_prohibited);
641
642int wlan_hdd_tdls_add_station(struct wiphy *wiphy,
643 struct net_device *dev, const uint8_t *mac,
644 bool update, tCsrStaParams *StaParams);
645
646int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
647 struct wireless_dev *wdev,
648 const void *data,
649 int data_len);
650
651int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
652 struct wireless_dev *wdev,
653 const void *data,
654 int data_len);
655
656int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
657 struct wireless_dev *wdev,
658 const void *data,
659 int data_len);
660
661#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
662int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
663 struct net_device *dev,
664 const uint8_t *peer,
665 enum nl80211_tdls_operation oper);
666#else
667int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
668 struct net_device *dev,
669 uint8_t *peer,
670 enum nl80211_tdls_operation oper);
671#endif
672
673#ifdef TDLS_MGMT_VERSION2
674int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
675 struct net_device *dev, u8 *peer,
676 u8 action_code, u8 dialog_token,
677 u16 status_code, u32 peer_capability,
678 const u8 *buf, size_t len);
679#else
680#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
681int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
682 struct net_device *dev, const uint8_t *peer,
683 uint8_t action_code, uint8_t dialog_token,
684 uint16_t status_code, uint32_t peer_capability,
685 bool initiator, const uint8_t *buf,
686 size_t len);
687#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
688int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
689 struct net_device *dev, const uint8_t *peer,
690 uint8_t action_code, uint8_t dialog_token,
691 uint16_t status_code, uint32_t peer_capability,
692 const uint8_t *buf, size_t len);
693#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
694int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
695 struct net_device *dev, uint8_t *peer,
696 uint8_t action_code, uint8_t dialog_token,
697 uint16_t status_code, uint32_t peer_capability,
698 const uint8_t *buf, size_t len);
699#else
700int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
701 struct net_device *dev, uint8_t *peer,
702 uint8_t action_code, uint8_t dialog_token,
703 uint16_t status_code, const uint8_t *buf,
704 size_t len);
705#endif
706#endif
707
708void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
709 hdd_context_t *hddctx);
710void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx);
711
712hddTdlsPeer_t *wlan_hdd_tdls_find_first_connected_peer(hdd_adapter_t *adapter);
713int hdd_set_tdls_offchannel(hdd_context_t *hdd_ctx, int offchannel);
714int hdd_set_tdls_secoffchanneloffset(hdd_context_t *hdd_ctx, int offchanoffset);
715int hdd_set_tdls_offchannelmode(hdd_adapter_t *adapter, int offchanmode);
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700716void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
717 struct sk_buff *skb);
718void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
719 struct sk_buff *skb);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800720int hdd_set_tdls_scan_type(hdd_context_t *hdd_ctx, int val);
Prashanth Bhatta527fd752016-04-28 12:35:23 -0700721void hdd_tdls_context_init(hdd_context_t *hdd_ctx);
722void hdd_tdls_context_destroy(hdd_context_t *hdd_ctx);
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700723int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700724 hdd_adapter_t *adapter,
725 uint32_t mode);
Kabilan Kannan32eb5022016-10-04 12:24:50 -0700726/**
727 * wlan_hdd_tdls_notify_connect() - Update tdls state for every
728 * connect event.
729 * @adapter: hdd adapter
730 * @csr_roam_info: csr information
731 *
732 * After every connect event in the system, check whether TDLS
733 * can be enabled in the system. If TDLS can be enabled, update the
734 * TDLS state as needed.
735 *
736 * Return: None
737 */
738void wlan_hdd_tdls_notify_connect(hdd_adapter_t *adapter,
739 tCsrRoamInfo *csr_roam_info);
Kabilan Kannan163fd0b2016-06-08 15:21:51 -0700740
Kabilan Kannan32eb5022016-10-04 12:24:50 -0700741/**
742 * wlan_hdd_tdls_notify_disconnect() - Update tdls state for every
743 * disconnect event.
744 * @adapter: hdd adapter
745 *
746 * After every disconnect event in the system, check whether TDLS
747 * can be disabled/enabled in the system and update the
748 * TDLS state as needed.
749 *
750 * Return: None
751 */
752void wlan_hdd_tdls_notify_disconnect(hdd_adapter_t *adapter);
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700753
Kabilan Kannand053aaf2016-10-26 02:06:14 -0700754/**
755 * wlan_hdd_cfg80211_configure_tdls_mode() - configure tdls mode
756 * @wiphy: pointer to wireless wiphy structure.
757 * @wdev: pointer to wireless_dev structure.
758 * @data: Pointer to the data to be passed via vendor interface
759 * @data_len:Length of the data to be passed
760 *
761 * Return: Return the Success or Failure code.
762 */
763int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy,
764 struct wireless_dev *wdev,
765 const void *data,
766 int data_len);
767
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800768#else
769static inline void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter,
770 hdd_context_t *hddctx)
771{
772}
773static inline void
774wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx)
775{
776}
777static inline void wlan_hdd_tdls_exit(hdd_adapter_t *adapter)
778{
779}
Kabilan Kannan36090ce2016-05-03 19:28:44 -0700780static inline void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
781 struct sk_buff *skb)
782{
783}
784static inline void wlan_hdd_tdls_update_rx_pkt_cnt(hdd_adapter_t *adapter,
785 struct sk_buff *skb)
786{
787}
Prashanth Bhatta527fd752016-04-28 12:35:23 -0700788static inline void hdd_tdls_context_init(hdd_context_t *hdd_ctx) { }
789static inline void hdd_tdls_context_destroy(hdd_context_t *hdd_ctx) { }
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700790
791static inline int wlan_hdd_tdls_antenna_switch(hdd_context_t *hdd_ctx,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700792 hdd_adapter_t *adapter,
793 uint32_t mode)
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700794{
795 return 0;
796}
Kabilan Kannan163fd0b2016-06-08 15:21:51 -0700797static inline void wlan_hdd_update_tdls_info(hdd_adapter_t *adapter,
798 bool tdls_prohibited,
799 bool tdls_chan_swit_prohibited)
800{
801}
Kabilan Kannan32eb5022016-10-04 12:24:50 -0700802static inline void wlan_hdd_tdls_notify_connect(hdd_adapter_t *adapter,
803 tCsrRoamInfo *csr_roam_info)
804{
805}
806static inline void wlan_hdd_tdls_notify_disconnect(hdd_adapter_t *adapter)
807{
808}
Kabilan Kannand053aaf2016-10-26 02:06:14 -0700809
810static inline int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy,
811 struct wireless_dev *wdev,
812 const void *data,
813 int data_len)
814{
815 return 0;
816}
817
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800818#endif /* End of FEATURE_WLAN_TDLS */
819
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530820#ifdef FEATURE_WLAN_DIAG_SUPPORT
821void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
822 uint8_t *peer_mac);
Abhishek Singh74bcb0a2016-04-27 12:30:48 +0530823void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
824 uint8_t is_off_chan_supported,
825 uint8_t is_off_chan_configured,
826 uint8_t is_off_chan_established);
Abhishek Singhaf1d0c92016-04-27 13:46:59 +0530827void hdd_wlan_block_scan_by_tdls_event(void);
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530828#else
829static inline
830void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
831 uint8_t *peer_mac) {}
Abhishek Singh74bcb0a2016-04-27 12:30:48 +0530832static inline
833void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac,
834 uint8_t is_off_chan_supported,
835 uint8_t is_off_chan_configured,
836 uint8_t is_off_chan_established) {}
Abhishek Singhaf1d0c92016-04-27 13:46:59 +0530837static inline void hdd_wlan_block_scan_by_tdls_event(void) {}
Abhishek Singh4ef5fe02016-04-27 12:21:24 +0530838#endif /* FEATURE_WLAN_DIAG_SUPPORT */
839
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800840#endif /* __HDD_TDLS_H */