blob: 2a9672065d849fa39ec0b00fa2016a044e1329ff [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnson1d40f5b2018-03-02 08:35:53 -08002 * Copyright (c) 2012-2018 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
Jeff Johnsonaf772ed2017-08-28 11:40:36 -070035struct hdd_context;
36
Kabilan Kannan6ca98482017-02-14 13:26:15 -080037/**
38 * enum tdls_concerned_external_events - External events that affect TDLS
39 * @P2P_ROC_START: P2P remain on channel starts
40 * @P2P_ROC_END: P2P remain on channel ends
41 */
42enum tdls_concerned_external_events {
43 P2P_ROC_START,
44 P2P_ROC_END,
45};
46
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080047#ifdef FEATURE_WLAN_TDLS
48
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080049/* Bit mask flag for tdls_option to FW */
50#define ENA_TDLS_OFFCHAN (1 << 0) /* TDLS Off Channel support */
51#define ENA_TDLS_BUFFER_STA (1 << 1) /* TDLS Buffer STA support */
52#define ENA_TDLS_SLEEP_STA (1 << 2) /* TDLS Sleep STA support */
Nitesh Shah2b946fa2016-10-19 17:05:09 +053053/**
Jeff Johnsona0ce1022017-10-01 20:09:16 -070054 * struct hdd_tdls_config_params - tdls config params
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055 *
56 * @tdls: tdls
57 * @tx_period_t: tx period
58 * @tx_packet_n: tx packets number
59 * @discovery_tries_n: discovery tries
Kabilan Kannan36090ce2016-05-03 19:28:44 -070060 * @idle_timeout_t: idle traffic time out value
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080061 * @idle_packet_n: idle packet number
62 * @rssi_trigger_threshold: rssi trigger threshold
63 * @rssi_teardown_threshold: rssi tear down threshold
64 * @rssi_delta: rssi delta
65 */
Jeff Johnsona0ce1022017-10-01 20:09:16 -070066struct hdd_tdls_config_params {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080067 uint32_t tdls;
68 uint32_t tx_period_t;
69 uint32_t tx_packet_n;
70 uint32_t discovery_tries_n;
Kabilan Kannan36090ce2016-05-03 19:28:44 -070071 uint32_t idle_timeout_t;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072 uint32_t idle_packet_n;
73 int32_t rssi_trigger_threshold;
74 int32_t rssi_teardown_threshold;
75 int32_t rssi_delta;
Jeff Johnsona0ce1022017-10-01 20:09:16 -070076};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080077
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080078typedef int (*cfg80211_exttdls_callback)(const uint8_t *mac,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +053079 uint32_t opclass,
80 uint32_t channel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080081 uint32_t state,
82 int32_t reason, void *ctx);
83
84/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080085 * struct tdlsInfo_t - tdls info
86 *
87 * @vdev_id: vdev id
88 * @tdls_state: tdls state
89 * @notification_interval_ms: notification interval in ms
90 * @tx_discovery_threshold: tx discovery threshold
91 * @tx_teardown_threshold: tx teardown threshold
92 * @rssi_teardown_threshold: rx teardown threshold
93 * @rssi_delta: rssi delta
94 * @tdls_options: tdls options
95 * @peer_traffic_ind_window: peer traffic indication window
96 * @peer_traffic_response_timeout: peer traffic response timeout
97 * @puapsd_mask: puapsd mask
98 * @puapsd_inactivity_time: puapsd inactivity time
99 * @puapsd_rx_frame_threshold: puapsd rx frame threshold
Kabilan Kannanca670be2015-11-23 01:56:12 -0800100 * @teardown_notification_ms: tdls teardown notification interval
Kabilan Kannan421714b2015-11-23 04:44:59 -0800101 * @tdls_peer_kickout_threshold: tdls packets threshold
102 * for peer kickout operation
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800103 */
104typedef struct {
105 uint32_t vdev_id;
106 uint32_t tdls_state;
107 uint32_t notification_interval_ms;
108 uint32_t tx_discovery_threshold;
109 uint32_t tx_teardown_threshold;
110 int32_t rssi_teardown_threshold;
111 int32_t rssi_delta;
112 uint32_t tdls_options;
113 uint32_t peer_traffic_ind_window;
114 uint32_t peer_traffic_response_timeout;
115 uint32_t puapsd_mask;
116 uint32_t puapsd_inactivity_time;
117 uint32_t puapsd_rx_frame_threshold;
Kabilan Kannanca670be2015-11-23 01:56:12 -0800118 uint32_t teardown_notification_ms;
Kabilan Kannan421714b2015-11-23 04:44:59 -0800119 uint32_t tdls_peer_kickout_threshold;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800120} tdlsInfo_t;
121
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122int wlan_hdd_tdls_set_params(struct net_device *dev,
Jeff Johnsona0ce1022017-10-01 20:09:16 -0700123 struct hdd_tdls_config_params *config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800124
Jeff Johnson6bff8942017-10-02 13:22:18 -0700125int wlan_hdd_tdls_get_all_peers(struct hdd_adapter *adapter, char *buf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800126 int buflen);
127
Jeff Johnson6bff8942017-10-02 13:22:18 -0700128int wlan_hdd_tdls_extctrl_deconfig_peer(struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800129 const uint8_t *peer);
Jeff Johnson6bff8942017-10-02 13:22:18 -0700130int wlan_hdd_tdls_extctrl_config_peer(struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800131 const uint8_t *peer,
132 cfg80211_exttdls_callback callback,
133 uint32_t chan,
134 uint32_t max_latency,
135 uint32_t op_class,
136 uint32_t min_bandwidth);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800137
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800138int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
139 struct wireless_dev *wdev,
140 const void *data,
141 int data_len);
142
143int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
144 struct wireless_dev *wdev,
145 const void *data,
146 int data_len);
147
148int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
149 struct wireless_dev *wdev,
150 const void *data,
151 int data_len);
152
153#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
154int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
155 struct net_device *dev,
156 const uint8_t *peer,
157 enum nl80211_tdls_operation oper);
158#else
159int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
160 struct net_device *dev,
161 uint8_t *peer,
162 enum nl80211_tdls_operation oper);
163#endif
164
165#ifdef TDLS_MGMT_VERSION2
166int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
167 struct net_device *dev, u8 *peer,
168 u8 action_code, u8 dialog_token,
169 u16 status_code, u32 peer_capability,
170 const u8 *buf, size_t len);
171#else
172#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
173int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
174 struct net_device *dev, const uint8_t *peer,
175 uint8_t action_code, uint8_t dialog_token,
176 uint16_t status_code, uint32_t peer_capability,
177 bool initiator, const uint8_t *buf,
178 size_t len);
179#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
180int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
181 struct net_device *dev, const uint8_t *peer,
182 uint8_t action_code, uint8_t dialog_token,
183 uint16_t status_code, uint32_t peer_capability,
184 const uint8_t *buf, size_t len);
185#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
186int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
187 struct net_device *dev, uint8_t *peer,
188 uint8_t action_code, uint8_t dialog_token,
189 uint16_t status_code, uint32_t peer_capability,
190 const uint8_t *buf, size_t len);
191#else
192int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
193 struct net_device *dev, uint8_t *peer,
194 uint8_t action_code, uint8_t dialog_token,
195 uint16_t status_code, const uint8_t *buf,
196 size_t len);
197#endif
198#endif
199
Jeff Johnsonaf772ed2017-08-28 11:40:36 -0700200int hdd_set_tdls_offchannel(struct hdd_context *hdd_ctx, int offchannel);
Jeff Johnsonae9adc82017-10-03 11:22:31 -0700201int hdd_set_tdls_secoffchanneloffset(struct hdd_context *hdd_ctx,
202 int offchanoffset);
Jeff Johnson327b9d42017-08-29 14:20:07 -0700203int hdd_set_tdls_offchannelmode(struct hdd_adapter *adapter, int offchanmode);
Jeff Johnsonaf772ed2017-08-28 11:40:36 -0700204int hdd_set_tdls_scan_type(struct hdd_context *hdd_ctx, int val);
Jeff Johnsonaf772ed2017-08-28 11:40:36 -0700205int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx,
Jeff Johnson327b9d42017-08-29 14:20:07 -0700206 struct hdd_adapter *adapter,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700207 uint32_t mode);
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700208
Kabilan Kannand053aaf2016-10-26 02:06:14 -0700209/**
210 * wlan_hdd_cfg80211_configure_tdls_mode() - configure tdls mode
211 * @wiphy: pointer to wireless wiphy structure.
212 * @wdev: pointer to wireless_dev structure.
213 * @data: Pointer to the data to be passed via vendor interface
214 * @data_len:Length of the data to be passed
215 *
216 * Return: Return the Success or Failure code.
217 */
218int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy,
219 struct wireless_dev *wdev,
220 const void *data,
221 int data_len);
222
Jeff Johnson1d40f5b2018-03-02 08:35:53 -0800223QDF_STATUS hdd_tdls_register_peer(void *userdata, uint32_t vdev_id,
224 const uint8_t *mac, uint16_t sta_id,
225 uint8_t qos);
Frank Liud4b2fa02017-03-29 11:46:48 +0800226
Jeff Johnson1d40f5b2018-03-02 08:35:53 -0800227QDF_STATUS hdd_tdls_deregister_peer(void *userdata, uint32_t vdev_id,
228 uint8_t sta_id);
Frank Liud4b2fa02017-03-29 11:46:48 +0800229
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800230#else
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700231
Jeff Johnsonaf772ed2017-08-28 11:40:36 -0700232static inline int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx,
Jeff Johnson327b9d42017-08-29 14:20:07 -0700233 struct hdd_adapter *adapter,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700234 uint32_t mode)
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700235{
236 return 0;
237}
Kabilan Kannand053aaf2016-10-26 02:06:14 -0700238
239static inline int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy,
240 struct wireless_dev *wdev,
241 const void *data,
242 int data_len)
243{
244 return 0;
245}
246
Nitesh Shah61c10d92016-10-19 19:29:15 +0530247static inline void
Jeff Johnsonaf772ed2017-08-28 11:40:36 -0700248hdd_tdls_notify_p2p_roc(struct hdd_context *hdd_ctx,
Kabilan Kannan6ca98482017-02-14 13:26:15 -0800249 enum tdls_concerned_external_events event)
Nitesh Shah61c10d92016-10-19 19:29:15 +0530250{
251}
Frank Liud4b2fa02017-03-29 11:46:48 +0800252
Jeff Johnson1d40f5b2018-03-02 08:35:53 -0800253static inline
254QDF_STATUS hdd_tdls_register_peer(void *userdata, uint32_t vdev_id,
255 const uint8_t *mac, uint16_t sta_id,
256 uint8_t qos);
Frank Liud4b2fa02017-03-29 11:46:48 +0800257{
258}
259
Jeff Johnson1d40f5b2018-03-02 08:35:53 -0800260static inline
261QDF_STATUS hdd_tdls_deregister_peer(void *userdata, uint32_t vdev_id,
262 uint8_t sta_id)
Frank Liud4b2fa02017-03-29 11:46:48 +0800263{
264}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800265#endif /* End of FEATURE_WLAN_TDLS */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800266#endif /* __HDD_TDLS_H */