blob: 49726a9939b817999df137cc35f7b34821210427 [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 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#ifndef __HDD_TDLS_H
20#define __HDD_TDLS_H
21/**
22 * DOC: wlan_hdd_tdls.h
23 * WLAN Host Device Driver TDLS include file
24 */
25
Jeff Johnsonaf772ed2017-08-28 11:40:36 -070026struct hdd_context;
27
Kabilan Kannan6ca98482017-02-14 13:26:15 -080028/**
29 * enum tdls_concerned_external_events - External events that affect TDLS
30 * @P2P_ROC_START: P2P remain on channel starts
31 * @P2P_ROC_END: P2P remain on channel ends
32 */
33enum tdls_concerned_external_events {
34 P2P_ROC_START,
35 P2P_ROC_END,
36};
37
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038#ifdef FEATURE_WLAN_TDLS
39
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080040/* Bit mask flag for tdls_option to FW */
41#define ENA_TDLS_OFFCHAN (1 << 0) /* TDLS Off Channel support */
42#define ENA_TDLS_BUFFER_STA (1 << 1) /* TDLS Buffer STA support */
43#define ENA_TDLS_SLEEP_STA (1 << 2) /* TDLS Sleep STA support */
Nitesh Shah2b946fa2016-10-19 17:05:09 +053044/**
Jeff Johnsona0ce1022017-10-01 20:09:16 -070045 * struct hdd_tdls_config_params - tdls config params
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080046 *
47 * @tdls: tdls
48 * @tx_period_t: tx period
49 * @tx_packet_n: tx packets number
50 * @discovery_tries_n: discovery tries
Kabilan Kannan36090ce2016-05-03 19:28:44 -070051 * @idle_timeout_t: idle traffic time out value
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080052 * @idle_packet_n: idle packet number
53 * @rssi_trigger_threshold: rssi trigger threshold
54 * @rssi_teardown_threshold: rssi tear down threshold
55 * @rssi_delta: rssi delta
56 */
Jeff Johnsona0ce1022017-10-01 20:09:16 -070057struct hdd_tdls_config_params {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080058 uint32_t tdls;
59 uint32_t tx_period_t;
60 uint32_t tx_packet_n;
61 uint32_t discovery_tries_n;
Kabilan Kannan36090ce2016-05-03 19:28:44 -070062 uint32_t idle_timeout_t;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080063 uint32_t idle_packet_n;
64 int32_t rssi_trigger_threshold;
65 int32_t rssi_teardown_threshold;
66 int32_t rssi_delta;
Jeff Johnsona0ce1022017-10-01 20:09:16 -070067};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080068
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080069typedef int (*cfg80211_exttdls_callback)(const uint8_t *mac,
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +053070 uint32_t opclass,
71 uint32_t channel,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072 uint32_t state,
73 int32_t reason, void *ctx);
74
75/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080076 * struct tdlsInfo_t - tdls info
77 *
78 * @vdev_id: vdev id
79 * @tdls_state: tdls state
80 * @notification_interval_ms: notification interval in ms
81 * @tx_discovery_threshold: tx discovery threshold
82 * @tx_teardown_threshold: tx teardown threshold
83 * @rssi_teardown_threshold: rx teardown threshold
84 * @rssi_delta: rssi delta
85 * @tdls_options: tdls options
86 * @peer_traffic_ind_window: peer traffic indication window
87 * @peer_traffic_response_timeout: peer traffic response timeout
88 * @puapsd_mask: puapsd mask
89 * @puapsd_inactivity_time: puapsd inactivity time
90 * @puapsd_rx_frame_threshold: puapsd rx frame threshold
Kabilan Kannanca670be2015-11-23 01:56:12 -080091 * @teardown_notification_ms: tdls teardown notification interval
Kabilan Kannan421714b2015-11-23 04:44:59 -080092 * @tdls_peer_kickout_threshold: tdls packets threshold
93 * for peer kickout operation
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080094 */
95typedef struct {
96 uint32_t vdev_id;
97 uint32_t tdls_state;
98 uint32_t notification_interval_ms;
99 uint32_t tx_discovery_threshold;
100 uint32_t tx_teardown_threshold;
101 int32_t rssi_teardown_threshold;
102 int32_t rssi_delta;
103 uint32_t tdls_options;
104 uint32_t peer_traffic_ind_window;
105 uint32_t peer_traffic_response_timeout;
106 uint32_t puapsd_mask;
107 uint32_t puapsd_inactivity_time;
108 uint32_t puapsd_rx_frame_threshold;
Kabilan Kannanca670be2015-11-23 01:56:12 -0800109 uint32_t teardown_notification_ms;
Kabilan Kannan421714b2015-11-23 04:44:59 -0800110 uint32_t tdls_peer_kickout_threshold;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800111} tdlsInfo_t;
112
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800113int wlan_hdd_tdls_set_params(struct net_device *dev,
Jeff Johnsona0ce1022017-10-01 20:09:16 -0700114 struct hdd_tdls_config_params *config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800115
Jeff Johnson6bff8942017-10-02 13:22:18 -0700116int wlan_hdd_tdls_get_all_peers(struct hdd_adapter *adapter, char *buf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800117 int buflen);
118
Jeff Johnson6bff8942017-10-02 13:22:18 -0700119int wlan_hdd_tdls_extctrl_deconfig_peer(struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800120 const uint8_t *peer);
Jeff Johnson6bff8942017-10-02 13:22:18 -0700121int wlan_hdd_tdls_extctrl_config_peer(struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122 const uint8_t *peer,
123 cfg80211_exttdls_callback callback,
124 uint32_t chan,
125 uint32_t max_latency,
126 uint32_t op_class,
127 uint32_t min_bandwidth);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800128
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800129int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy,
130 struct wireless_dev *wdev,
131 const void *data,
132 int data_len);
133
134int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy,
135 struct wireless_dev *wdev,
136 const void *data,
137 int data_len);
138
139int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy,
140 struct wireless_dev *wdev,
141 const void *data,
142 int data_len);
143
144#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
145int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
146 struct net_device *dev,
147 const uint8_t *peer,
148 enum nl80211_tdls_operation oper);
149#else
150int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy,
151 struct net_device *dev,
152 uint8_t *peer,
153 enum nl80211_tdls_operation oper);
154#endif
155
156#ifdef TDLS_MGMT_VERSION2
157int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
158 struct net_device *dev, u8 *peer,
159 u8 action_code, u8 dialog_token,
160 u16 status_code, u32 peer_capability,
161 const u8 *buf, size_t len);
162#else
163#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0))
164int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
165 struct net_device *dev, const uint8_t *peer,
166 uint8_t action_code, uint8_t dialog_token,
167 uint16_t status_code, uint32_t peer_capability,
168 bool initiator, const uint8_t *buf,
169 size_t len);
170#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
171int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
172 struct net_device *dev, const uint8_t *peer,
173 uint8_t action_code, uint8_t dialog_token,
174 uint16_t status_code, uint32_t peer_capability,
175 const uint8_t *buf, size_t len);
176#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
177int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
178 struct net_device *dev, uint8_t *peer,
179 uint8_t action_code, uint8_t dialog_token,
180 uint16_t status_code, uint32_t peer_capability,
181 const uint8_t *buf, size_t len);
182#else
183int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
184 struct net_device *dev, uint8_t *peer,
185 uint8_t action_code, uint8_t dialog_token,
186 uint16_t status_code, const uint8_t *buf,
187 size_t len);
188#endif
189#endif
190
Bala Venkatesh113a9e62018-08-30 15:19:02 +0530191/**
192 * hdd_set_tdls_offchannel() - set tdls off-channel number
193 * @hdd_ctx: Pointer to the HDD context
194 * @adapter: Pointer to the HDD adapter
195 * @offchannel: tdls off-channel number
196 *
197 * This function sets tdls off-channel number
198 *
199 * Return: 0 on success; negative errno otherwise
200 */
201int hdd_set_tdls_offchannel(struct hdd_context *hdd_ctx,
202 struct hdd_adapter *adapter,
203 int offchannel);
204
205/**
206 * hdd_set_tdls_secoffchanneloffset() - set secondary tdls off-channel offset
207 * @hdd_ctx: Pointer to the HDD context
208 * @adapter: Pointer to the HDD adapter
209 * @offchanoffset: tdls off-channel offset
210 *
211 * This function sets secondary tdls off-channel offset
212 *
213 * Return: 0 on success; negative errno otherwise
214 */
Jeff Johnsonae9adc82017-10-03 11:22:31 -0700215int hdd_set_tdls_secoffchanneloffset(struct hdd_context *hdd_ctx,
Bala Venkatesh113a9e62018-08-30 15:19:02 +0530216 struct hdd_adapter *adapter,
Jeff Johnsonae9adc82017-10-03 11:22:31 -0700217 int offchanoffset);
Bala Venkatesh113a9e62018-08-30 15:19:02 +0530218
219/**
220 * hdd_set_tdls_offchannelmode() - set tdls off-channel mode
221 * @hdd_ctx: Pointer to the HDD context
222 * @adapter: Pointer to the HDD adapter
223 * @offchanmode: tdls off-channel mode
224 * 1-Enable Channel Switch
225 * 2-Disable Channel Switch
226 *
227 * This function sets tdls off-channel mode
228 *
229 * Return: 0 on success; negative errno otherwise
230 */
231int hdd_set_tdls_offchannelmode(struct hdd_context *hdd_ctx,
232 struct hdd_adapter *adapter,
233 int offchanmode);
Jeff Johnsonaf772ed2017-08-28 11:40:36 -0700234int hdd_set_tdls_scan_type(struct hdd_context *hdd_ctx, int val);
Jeff Johnsonaf772ed2017-08-28 11:40:36 -0700235int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx,
Jeff Johnson327b9d42017-08-29 14:20:07 -0700236 struct hdd_adapter *adapter,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700237 uint32_t mode);
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700238
Kabilan Kannand053aaf2016-10-26 02:06:14 -0700239/**
240 * wlan_hdd_cfg80211_configure_tdls_mode() - configure tdls mode
241 * @wiphy: pointer to wireless wiphy structure.
242 * @wdev: pointer to wireless_dev structure.
243 * @data: Pointer to the data to be passed via vendor interface
244 * @data_len:Length of the data to be passed
245 *
246 * Return: Return the Success or Failure code.
247 */
248int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy,
249 struct wireless_dev *wdev,
250 const void *data,
251 int data_len);
252
Jeff Johnson1d40f5b2018-03-02 08:35:53 -0800253QDF_STATUS hdd_tdls_register_peer(void *userdata, uint32_t vdev_id,
254 const uint8_t *mac, uint16_t sta_id,
255 uint8_t qos);
Frank Liud4b2fa02017-03-29 11:46:48 +0800256
Jeff Johnson1d40f5b2018-03-02 08:35:53 -0800257QDF_STATUS hdd_tdls_deregister_peer(void *userdata, uint32_t vdev_id,
258 uint8_t sta_id);
Frank Liud4b2fa02017-03-29 11:46:48 +0800259
jiad7b8a5e02018-11-26 16:37:57 +0800260/**
261 * hdd_init_tdls_config() - initialize tdls config
262 * @tdls_cfg: pointer to tdls_start_params structure
263 *
264 * Return: none
265 */
266void hdd_init_tdls_config(struct tdls_start_params *tdls_cfg);
267
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800268#else
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700269
Jeff Johnsonaf772ed2017-08-28 11:40:36 -0700270static inline int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx,
Jeff Johnson327b9d42017-08-29 14:20:07 -0700271 struct hdd_adapter *adapter,
Archana Ramachandran2ad7de22016-04-22 16:53:25 -0700272 uint32_t mode)
Archana Ramachandrand5d2e922016-04-20 16:57:35 -0700273{
274 return 0;
275}
Kabilan Kannand053aaf2016-10-26 02:06:14 -0700276
277static inline int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy,
278 struct wireless_dev *wdev,
279 const void *data,
280 int data_len)
281{
282 return 0;
283}
284
Nitesh Shah61c10d92016-10-19 19:29:15 +0530285static inline void
Jeff Johnsonaf772ed2017-08-28 11:40:36 -0700286hdd_tdls_notify_p2p_roc(struct hdd_context *hdd_ctx,
Kabilan Kannan6ca98482017-02-14 13:26:15 -0800287 enum tdls_concerned_external_events event)
Nitesh Shah61c10d92016-10-19 19:29:15 +0530288{
289}
Frank Liud4b2fa02017-03-29 11:46:48 +0800290
Jeff Johnson1d40f5b2018-03-02 08:35:53 -0800291static inline
292QDF_STATUS hdd_tdls_register_peer(void *userdata, uint32_t vdev_id,
293 const uint8_t *mac, uint16_t sta_id,
jiad7b8a5e02018-11-26 16:37:57 +0800294 uint8_t qos)
Frank Liud4b2fa02017-03-29 11:46:48 +0800295{
jiad7b8a5e02018-11-26 16:37:57 +0800296 return QDF_STATUS_SUCCESS;
Frank Liud4b2fa02017-03-29 11:46:48 +0800297}
298
Jeff Johnson1d40f5b2018-03-02 08:35:53 -0800299static inline
300QDF_STATUS hdd_tdls_deregister_peer(void *userdata, uint32_t vdev_id,
301 uint8_t sta_id)
Frank Liud4b2fa02017-03-29 11:46:48 +0800302{
jiad7b8a5e02018-11-26 16:37:57 +0800303 return QDF_STATUS_SUCCESS;
Frank Liud4b2fa02017-03-29 11:46:48 +0800304}
jiad7b8a5e02018-11-26 16:37:57 +0800305
306static inline void hdd_init_tdls_config(struct tdls_start_params *tdls_cfg)
307{
308}
309
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800310#endif /* End of FEATURE_WLAN_TDLS */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800311#endif /* __HDD_TDLS_H */