Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 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 Johnson | af772ed | 2017-08-28 11:40:36 -0700 | [diff] [blame] | 35 | struct hdd_context; |
| 36 | |
Kabilan Kannan | 6ca9848 | 2017-02-14 13:26:15 -0800 | [diff] [blame] | 37 | /** |
| 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 | */ |
| 42 | enum tdls_concerned_external_events { |
| 43 | P2P_ROC_START, |
| 44 | P2P_ROC_END, |
| 45 | }; |
| 46 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | #ifdef FEATURE_WLAN_TDLS |
| 48 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 49 | /* 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 Shah | 2b946fa | 2016-10-19 17:05:09 +0530 | [diff] [blame] | 53 | /** |
Jeff Johnson | a0ce102 | 2017-10-01 20:09:16 -0700 | [diff] [blame] | 54 | * struct hdd_tdls_config_params - tdls config params |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 55 | * |
| 56 | * @tdls: tdls |
| 57 | * @tx_period_t: tx period |
| 58 | * @tx_packet_n: tx packets number |
| 59 | * @discovery_tries_n: discovery tries |
Kabilan Kannan | 36090ce | 2016-05-03 19:28:44 -0700 | [diff] [blame] | 60 | * @idle_timeout_t: idle traffic time out value |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 61 | * @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 Johnson | a0ce102 | 2017-10-01 20:09:16 -0700 | [diff] [blame] | 66 | struct hdd_tdls_config_params { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 67 | uint32_t tdls; |
| 68 | uint32_t tx_period_t; |
| 69 | uint32_t tx_packet_n; |
| 70 | uint32_t discovery_tries_n; |
Kabilan Kannan | 36090ce | 2016-05-03 19:28:44 -0700 | [diff] [blame] | 71 | uint32_t idle_timeout_t; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 72 | uint32_t idle_packet_n; |
| 73 | int32_t rssi_trigger_threshold; |
| 74 | int32_t rssi_teardown_threshold; |
| 75 | int32_t rssi_delta; |
Jeff Johnson | a0ce102 | 2017-10-01 20:09:16 -0700 | [diff] [blame] | 76 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 77 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 78 | typedef int (*cfg80211_exttdls_callback)(const uint8_t *mac, |
Masti, Narayanraddi | c4a7ab8 | 2015-11-25 15:41:10 +0530 | [diff] [blame] | 79 | uint32_t opclass, |
| 80 | uint32_t channel, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 81 | uint32_t state, |
| 82 | int32_t reason, void *ctx); |
| 83 | |
| 84 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 85 | * 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 Kannan | ca670be | 2015-11-23 01:56:12 -0800 | [diff] [blame] | 100 | * @teardown_notification_ms: tdls teardown notification interval |
Kabilan Kannan | 421714b | 2015-11-23 04:44:59 -0800 | [diff] [blame] | 101 | * @tdls_peer_kickout_threshold: tdls packets threshold |
| 102 | * for peer kickout operation |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 103 | */ |
| 104 | typedef 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 Kannan | ca670be | 2015-11-23 01:56:12 -0800 | [diff] [blame] | 118 | uint32_t teardown_notification_ms; |
Kabilan Kannan | 421714b | 2015-11-23 04:44:59 -0800 | [diff] [blame] | 119 | uint32_t tdls_peer_kickout_threshold; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 120 | } tdlsInfo_t; |
| 121 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 122 | int wlan_hdd_tdls_set_params(struct net_device *dev, |
Jeff Johnson | a0ce102 | 2017-10-01 20:09:16 -0700 | [diff] [blame] | 123 | struct hdd_tdls_config_params *config); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 124 | |
Jeff Johnson | 6bff894 | 2017-10-02 13:22:18 -0700 | [diff] [blame] | 125 | int wlan_hdd_tdls_get_all_peers(struct hdd_adapter *adapter, char *buf, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 126 | int buflen); |
| 127 | |
Jeff Johnson | 6bff894 | 2017-10-02 13:22:18 -0700 | [diff] [blame] | 128 | int wlan_hdd_tdls_extctrl_deconfig_peer(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 129 | const uint8_t *peer); |
Jeff Johnson | 6bff894 | 2017-10-02 13:22:18 -0700 | [diff] [blame] | 130 | int wlan_hdd_tdls_extctrl_config_peer(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 131 | 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 Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 137 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 138 | int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 139 | struct wireless_dev *wdev, |
| 140 | const void *data, |
| 141 | int data_len); |
| 142 | |
| 143 | int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 144 | struct wireless_dev *wdev, |
| 145 | const void *data, |
| 146 | int data_len); |
| 147 | |
| 148 | int 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)) |
| 154 | int 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 |
| 159 | int 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 |
| 166 | int 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)) |
| 173 | int 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)) |
| 180 | int 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)) |
| 186 | int 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 |
| 192 | int 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 Johnson | af772ed | 2017-08-28 11:40:36 -0700 | [diff] [blame] | 200 | int hdd_set_tdls_offchannel(struct hdd_context *hdd_ctx, int offchannel); |
Jeff Johnson | ae9adc8 | 2017-10-03 11:22:31 -0700 | [diff] [blame^] | 201 | int hdd_set_tdls_secoffchanneloffset(struct hdd_context *hdd_ctx, |
| 202 | int offchanoffset); |
Jeff Johnson | 327b9d4 | 2017-08-29 14:20:07 -0700 | [diff] [blame] | 203 | int hdd_set_tdls_offchannelmode(struct hdd_adapter *adapter, int offchanmode); |
Jeff Johnson | af772ed | 2017-08-28 11:40:36 -0700 | [diff] [blame] | 204 | int hdd_set_tdls_scan_type(struct hdd_context *hdd_ctx, int val); |
Jeff Johnson | af772ed | 2017-08-28 11:40:36 -0700 | [diff] [blame] | 205 | int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx, |
Jeff Johnson | 327b9d4 | 2017-08-29 14:20:07 -0700 | [diff] [blame] | 206 | struct hdd_adapter *adapter, |
Archana Ramachandran | 2ad7de2 | 2016-04-22 16:53:25 -0700 | [diff] [blame] | 207 | uint32_t mode); |
Archana Ramachandran | d5d2e92 | 2016-04-20 16:57:35 -0700 | [diff] [blame] | 208 | |
Kabilan Kannan | d053aaf | 2016-10-26 02:06:14 -0700 | [diff] [blame] | 209 | /** |
| 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 | */ |
| 218 | int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy, |
| 219 | struct wireless_dev *wdev, |
| 220 | const void *data, |
| 221 | int data_len); |
| 222 | |
Frank Liu | d4b2fa0 | 2017-03-29 11:46:48 +0800 | [diff] [blame] | 223 | QDF_STATUS hdd_tdls_register_tdls_peer(void *userdata, uint32_t vdev_id, |
| 224 | const uint8_t *mac, uint16_t sta_id, |
| 225 | uint8_t ucastsig, uint8_t qos); |
| 226 | |
| 227 | QDF_STATUS hdd_tdls_deregister_tdl_peer(void *userdata, |
| 228 | uint32_t vdev_id, uint8_t sta_id); |
| 229 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 230 | #else |
Archana Ramachandran | d5d2e92 | 2016-04-20 16:57:35 -0700 | [diff] [blame] | 231 | |
Jeff Johnson | af772ed | 2017-08-28 11:40:36 -0700 | [diff] [blame] | 232 | static inline int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx, |
Jeff Johnson | 327b9d4 | 2017-08-29 14:20:07 -0700 | [diff] [blame] | 233 | struct hdd_adapter *adapter, |
Archana Ramachandran | 2ad7de2 | 2016-04-22 16:53:25 -0700 | [diff] [blame] | 234 | uint32_t mode) |
Archana Ramachandran | d5d2e92 | 2016-04-20 16:57:35 -0700 | [diff] [blame] | 235 | { |
| 236 | return 0; |
| 237 | } |
Kabilan Kannan | d053aaf | 2016-10-26 02:06:14 -0700 | [diff] [blame] | 238 | |
| 239 | static 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 Shah | 61c10d9 | 2016-10-19 19:29:15 +0530 | [diff] [blame] | 247 | static inline void |
Jeff Johnson | af772ed | 2017-08-28 11:40:36 -0700 | [diff] [blame] | 248 | hdd_tdls_notify_p2p_roc(struct hdd_context *hdd_ctx, |
Kabilan Kannan | 6ca9848 | 2017-02-14 13:26:15 -0800 | [diff] [blame] | 249 | enum tdls_concerned_external_events event) |
Nitesh Shah | 61c10d9 | 2016-10-19 19:29:15 +0530 | [diff] [blame] | 250 | { |
| 251 | } |
Frank Liu | d4b2fa0 | 2017-03-29 11:46:48 +0800 | [diff] [blame] | 252 | |
| 253 | static QDF_STATUS hdd_tdls_register_tdls_peer(void *userdata, |
| 254 | uint32_t vdev_id, |
| 255 | const uint8_t *mac, |
| 256 | uint16_t sta_id, |
| 257 | uint8_t ucastsig, |
| 258 | uint8_t qos) |
| 259 | { |
| 260 | } |
| 261 | |
| 262 | static QDF_STATUS hdd_tdls_deregister_tdl_peer(void *userdata, |
| 263 | uint32_t vdev_id, uint8_t sta_id) |
| 264 | |
| 265 | { |
| 266 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 267 | #endif /* End of FEATURE_WLAN_TDLS */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 268 | #endif /* __HDD_TDLS_H */ |