1 /* 2 * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * DOC: wlan_tdls_ct.h 22 * 23 * TDLS connection tracker declarations 24 */ 25 26 #ifndef _WLAN_TDLS_CT_H_ 27 #define _WLAN_TDLS_CT_H_ 28 29 /* 30 * Before UpdateTimer expires, we want to timeout discovery response 31 * should not be more than 2000. 32 */ 33 #define TDLS_DISCOVERY_TIMEOUT_ERE_UPDATE 1000 34 35 #define TDLS_PREFERRED_OFF_CHANNEL_NUM_MIN 1 36 #define TDLS_PREFERRED_OFF_CHANNEL_NUM_MAX 165 37 #define TDLS_PREFERRED_OFF_CHANNEL_NUM_DEFAULT 36 38 39 /** 40 * tdls_implicit_enable() - enable implicit tdls triggering 41 * @tdls_vdev: TDLS vdev 42 * 43 * Return: Void 44 */ 45 void tdls_implicit_enable(struct tdls_vdev_priv_obj *tdls_vdev); 46 47 /** 48 * tdls_update_rx_pkt_cnt() - Update rx packet count 49 * @vdev: vdev object manager 50 * @mac_addr: mac address of the data 51 * @dest_mac_addr: dest mac address of the data 52 * 53 * Increase the rx packet count, if the sender is not bssid and the packet is 54 * not broadcast and multicast packet 55 * 56 * This sampling information will be used in TDLS connection tracker 57 * 58 * This function expected to be called in an atomic context so blocking APIs 59 * not allowed 60 * 61 * Return: None 62 */ 63 void tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev *vdev, 64 struct qdf_mac_addr *mac_addr, 65 struct qdf_mac_addr *dest_mac_addr); 66 67 /** 68 * tdls_update_tx_pkt_cnt() - update tx packet 69 * @vdev: vdev object 70 * @mac_addr: mac address of the data 71 * 72 * Increase the tx packet count, if the sender is not bssid and the packet is 73 * not broadcast and multicast packet 74 * 75 * This sampling information will be used in TDLS connection tracker 76 * 77 * This function expected to be called in an atomic context so blocking APIs 78 * not allowed 79 * 80 * Return: None 81 */ 82 void tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev, 83 struct qdf_mac_addr *mac_addr); 84 85 /** 86 * tdls_implicit_send_discovery_request() - send discovery request 87 * @tdls_vdev_obj: tdls vdev object 88 * 89 * Return: None 90 */ 91 void tdls_implicit_send_discovery_request( 92 struct tdls_vdev_priv_obj *tdls_vdev_obj); 93 94 /** 95 * tdls_recv_discovery_resp() - handling of tdls discovery response 96 * @tdls_vdev: tdls vdev object 97 * @mac: mac address of peer from which the response was received 98 * 99 * Return: 0 for success or negative errno otherwise 100 */ 101 int tdls_recv_discovery_resp(struct tdls_vdev_priv_obj *tdls_vdev, 102 const uint8_t *mac); 103 104 /** 105 * tdls_indicate_teardown() - indicate teardown to upper layer 106 * @tdls_vdev: tdls vdev object 107 * @curr_peer: teardown peer 108 * @reason: teardown reason 109 * 110 * Return: Void 111 */ 112 void tdls_indicate_teardown(struct tdls_vdev_priv_obj *tdls_vdev, 113 struct tdls_peer *curr_peer, 114 uint16_t reason); 115 116 /** 117 * tdls_ct_handler() - TDLS connection tracker handler 118 * @user_data: user data from timer 119 * 120 * tdls connection tracker timer starts, when the STA connected to AP 121 * and it's scan the traffic between two STA peers and make TDLS 122 * connection and teardown, based on the traffic threshold 123 * 124 * Return: None 125 */ 126 void tdls_ct_handler(void *user_data); 127 128 /** 129 * tdls_ct_idle_handler() - Check tdls idle traffic 130 * @user_data: data from tdls idle timer 131 * 132 * Function to check the tdls idle traffic and make a decision about 133 * tdls teardown 134 * 135 * Return: None 136 */ 137 void tdls_ct_idle_handler(void *user_data); 138 139 /** 140 * tdls_discovery_timeout_peer_cb() - tdls discovery timeout callback 141 * @user_data: tdls vdev 142 * 143 * Return: None 144 */ 145 void tdls_discovery_timeout_peer_cb(void *user_data); 146 147 /** 148 * tdls_implicit_disable() - disable implicit tdls triggering 149 * @tdls_vdev: TDLS vdev context 150 * 151 * Return: Void 152 */ 153 void tdls_implicit_disable(struct tdls_vdev_priv_obj *tdls_vdev); 154 155 /** 156 * tdls_is_vdev_authenticated() - check the vdev authentication state 157 * @vdev: vdev object 158 * 159 * Return: true or false 160 */ 161 bool tdls_is_vdev_authenticated(struct wlan_objmgr_vdev *vdev); 162 163 /** 164 * tdls_teardown_connections() - teardown and delete all the tdls peers 165 * @tdls_teardown: tdls teardown struct 166 * 167 * Return: true or false 168 */ 169 void tdls_teardown_connections(struct tdls_link_teardown *tdls_teardown); 170 171 /** 172 * tdls_disable_offchan_and_teardown_links - Disable offchannel 173 * and teardown TDLS links 174 * @vdev: vdev object 175 * 176 * Return: None 177 */ 178 void tdls_disable_offchan_and_teardown_links( 179 struct wlan_objmgr_vdev *vdev); 180 181 /** 182 * tdls_delete_all_tdls_peers() - send request to delete tdls peers 183 * @vdev: vdev object 184 * @tdls_soc: tdls soc object 185 * 186 * This function sends request to lim to delete tdls peers 187 * 188 * Return: QDF_STATUS 189 */ 190 QDF_STATUS tdls_delete_all_tdls_peers(struct wlan_objmgr_vdev *vdev, 191 struct tdls_soc_priv_obj *tdls_soc); 192 193 /** 194 * tdls_set_tdls_offchannel() - set tdls off-channel number 195 * @tdls_soc: tdls soc object 196 * @offchannel: tdls off-channel number 197 * 198 * This function sets tdls off-channel number 199 * 200 * Return: 0 on success; negative errno otherwise 201 */ 202 int tdls_set_tdls_offchannel(struct tdls_soc_priv_obj *tdls_soc, 203 int offchannel); 204 205 /** 206 * tdls_set_tdls_offchannelmode() - set tdls off-channel mode 207 * @vdev: vdev object 208 * @offchanmode: tdls off-channel mode 209 * 210 * This function sets tdls off-channel mode 211 * 212 * Return: 0 on success; negative errno otherwise 213 */ 214 215 int tdls_set_tdls_offchannelmode(struct wlan_objmgr_vdev *vdev, 216 int offchanmode); 217 218 /** 219 * tdls_set_tdls_secoffchanneloffset() - set secondary tdls off-channel offset 220 * @tdls_soc: tdls soc object 221 * @offchanoffset: tdls off-channel offset 222 * 223 * This function sets secondary tdls off-channel offset 224 * 225 * Return: 0 on success; negative errno otherwise 226 */ 227 228 int tdls_set_tdls_secoffchanneloffset(struct tdls_soc_priv_obj *tdls_soc, 229 int offchanoffset); 230 231 #endif 232