Frank Liu | c3aad43 | 2017-03-13 21:30:21 +0800 | [diff] [blame] | 1 | /* |
Yeshwanth Sriram Guntuka | 4ac1584 | 2019-07-16 15:47:21 +0530 | [diff] [blame] | 2 | * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. |
Frank Liu | c3aad43 | 2017-03-13 21:30:21 +0800 | [diff] [blame] | 3 | * |
| 4 | * 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 | |
| 19 | /** |
| 20 | * DOC: wlan_tdls_peer.h |
| 21 | * |
| 22 | * TDLS peer function declaration |
| 23 | */ |
| 24 | |
| 25 | #if !defined(_WLAN_TDLS_PEER_H_) |
| 26 | #define _WLAN_TDLS_PEER_H_ |
| 27 | |
| 28 | /** |
| 29 | * struct tdls_search_peer_param - used to search TDLS peer |
| 30 | * @macaddr: MAC address of peer |
| 31 | * @peer: pointer to the found peer |
| 32 | */ |
| 33 | struct tdls_search_peer_param { |
| 34 | const uint8_t *macaddr; |
| 35 | struct tdls_peer *peer; |
| 36 | }; |
| 37 | |
| 38 | /** |
| 39 | * struct tdls_progress_param - used to search progress TDLS peer |
| 40 | * @skip_self: skip self peer |
| 41 | * @macaddr: MAC address of peer |
| 42 | * @peer: pointer to the found peer |
| 43 | */ |
| 44 | struct tdls_search_progress_param { |
| 45 | uint8_t skip_self; |
| 46 | const uint8_t *macaddr; |
| 47 | struct tdls_peer *peer; |
| 48 | }; |
| 49 | |
| 50 | /** |
| 51 | * tdls_get_peer() - find or add an TDLS peer in TDLS vdev object |
| 52 | * @vdev_obj: TDLS vdev object |
| 53 | * @macaddr: MAC address of peer |
| 54 | * |
| 55 | * Search the TDLS peer in the hash table and create a new one if not found. |
| 56 | * |
| 57 | * Return: Pointer to tdls_peer, NULL if failed. |
| 58 | */ |
| 59 | struct tdls_peer *tdls_get_peer(struct tdls_vdev_priv_obj *vdev_obj, |
| 60 | const uint8_t *macaddr); |
| 61 | |
| 62 | /** |
| 63 | * tdls_find_peer() - find TDLS peer in TDLS vdev object |
| 64 | * @vdev_obj: TDLS vdev object |
| 65 | * @macaddr: MAC address of peer |
| 66 | * |
| 67 | * This is in scheduler thread context, no lock required. |
| 68 | * |
| 69 | * Return: If peer is found, then it returns pointer to tdls_peer; |
| 70 | * otherwise, it returns NULL. |
| 71 | */ |
| 72 | struct tdls_peer *tdls_find_peer(struct tdls_vdev_priv_obj *vdev_obj, |
| 73 | const uint8_t *macaddr); |
| 74 | |
| 75 | /** |
| 76 | * tdls_find_all_peer() - find peer matching the input MACaddr in soc range |
| 77 | * @soc_obj: TDLS soc object |
| 78 | * @macaddr: MAC address of TDLS peer |
| 79 | * |
| 80 | * This is in scheduler thread context, no lock required. |
| 81 | * |
| 82 | * Return: TDLS peer if a matching is detected; NULL otherwise |
| 83 | */ |
| 84 | struct tdls_peer * |
| 85 | tdls_find_all_peer(struct tdls_soc_priv_obj *soc_obj, const uint8_t *macaddr); |
| 86 | |
| 87 | /** |
Kabilan Kannan | ce5880e | 2017-04-17 21:53:42 -0700 | [diff] [blame] | 88 | * tdls_find_all_peer() - find peer matching the input MACaddr in soc range |
| 89 | * @soc_obj: TDLS soc object |
| 90 | * @channel:channel number |
| 91 | * @bw_offset: offset to bandwidth |
| 92 | * |
| 93 | * This is in scheduler thread context, no lock required. |
| 94 | * |
| 95 | * Return: Operating class |
| 96 | */ |
| 97 | uint8_t tdls_find_opclass(struct wlan_objmgr_psoc *psoc, |
| 98 | uint8_t channel, |
| 99 | uint8_t bw_offset); |
| 100 | |
| 101 | /** |
Frank Liu | c3aad43 | 2017-03-13 21:30:21 +0800 | [diff] [blame] | 102 | * tdls_find_first_connected_peer() - find the 1st connected tdls peer from vdev |
| 103 | * @vdev_obj: tdls vdev object |
| 104 | * |
| 105 | * This function searches for the 1st connected TDLS peer |
| 106 | * |
| 107 | * Return: The 1st connected TDLS peer if found; NULL otherwise |
| 108 | */ |
| 109 | struct tdls_peer * |
| 110 | tdls_find_first_connected_peer(struct tdls_vdev_priv_obj *vdev_obj); |
| 111 | |
| 112 | /** |
| 113 | * tdls_is_progress() - find the peer with ongoing TDLS progress on present psoc |
| 114 | * @vdev_obj: TDLS vdev object |
| 115 | * @macaddr: MAC address of the peer |
| 116 | * @skip_self: if 1, skip checking self. If 0, search include self |
| 117 | * |
| 118 | * This is used in scheduler thread context, no lock required. |
| 119 | * |
| 120 | * Return: TDLS peer if found; NULL otherwise |
| 121 | */ |
| 122 | struct tdls_peer *tdls_is_progress(struct tdls_vdev_priv_obj *vdev_obj, |
| 123 | const uint8_t *macaddr, uint8_t skip_self); |
| 124 | |
| 125 | /** |
| 126 | * tdls_extract_peer_state_param() - extract peer update params from TDL peer |
| 127 | * @peer_param: output peer update params |
| 128 | * @peer: TDLS peer |
| 129 | * |
| 130 | * This is used when enable TDLS link |
| 131 | * |
| 132 | * Return: None. |
| 133 | */ |
| 134 | void tdls_extract_peer_state_param(struct tdls_peer_update_state *peer_param, |
| 135 | struct tdls_peer *peer); |
| 136 | |
| 137 | /** |
| 138 | * tdls_set_link_status() - set link statue for TDLS peer |
| 139 | * @peer: TDLS peer |
| 140 | * @link_state: link state |
| 141 | * @link_reason: reason with link status |
| 142 | * |
| 143 | * This is in scheduler thread context, no lock required. |
| 144 | * |
| 145 | * Return: None. |
| 146 | */ |
| 147 | void tdls_set_peer_link_status(struct tdls_peer *peer, |
| 148 | enum tdls_link_state link_state, |
| 149 | enum tdls_link_state_reason link_reason); |
| 150 | |
| 151 | /** |
| 152 | * tdls_set_peer_caps() - set capability for TDLS peer |
| 153 | * @vdev_obj: TDLS vdev object |
| 154 | * @macaddr: MAC address for the TDLS peer |
| 155 | * @req_info: parameters to update peer capability |
| 156 | * |
| 157 | * This is in scheduler thread context, no lock required. |
| 158 | * |
| 159 | * Return: None. |
| 160 | */ |
| 161 | void tdls_set_peer_caps(struct tdls_vdev_priv_obj *vdev_obj, |
| 162 | const uint8_t *macaddr, |
| 163 | struct tdls_update_peer_params *req_info); |
| 164 | |
| 165 | /** |
Yeshwanth Sriram Guntuka | 4ac1584 | 2019-07-16 15:47:21 +0530 | [diff] [blame] | 166 | * tdls_set_valid() - set station ID on a TDLS peer |
Frank Liu | c3aad43 | 2017-03-13 21:30:21 +0800 | [diff] [blame] | 167 | * @vdev_obj: TDLS vdev object |
| 168 | * @macaddr: MAC address of the TDLS peer |
Frank Liu | c3aad43 | 2017-03-13 21:30:21 +0800 | [diff] [blame] | 169 | * |
| 170 | * Return: QDF_STATUS_SUCCESS if success; other values if failed |
| 171 | */ |
Yeshwanth Sriram Guntuka | 4ac1584 | 2019-07-16 15:47:21 +0530 | [diff] [blame] | 172 | QDF_STATUS tdls_set_valid(struct tdls_vdev_priv_obj *vdev_obj, |
| 173 | const uint8_t *macaddr); |
Frank Liu | c3aad43 | 2017-03-13 21:30:21 +0800 | [diff] [blame] | 174 | |
| 175 | /** |
Frank Liu | c3aad43 | 2017-03-13 21:30:21 +0800 | [diff] [blame] | 176 | * tdls_set_force_peer() - set/clear is_forced_peer flag on peer |
| 177 | * @vdev_obj: TDLS vdev object |
| 178 | * @macaddr: MAC address of TDLS peer |
| 179 | * @forcepeer: value used to set is_forced_peer flag |
| 180 | * |
| 181 | * This is used in scheduler thread context, no lock required. |
| 182 | * |
| 183 | * Return: QDF_STATUS_SUCCESS if success; other values if failed |
| 184 | */ |
| 185 | QDF_STATUS tdls_set_force_peer(struct tdls_vdev_priv_obj *vdev_obj, |
| 186 | const uint8_t *macaddr, bool forcepeer); |
| 187 | |
| 188 | /** |
| 189 | * tdls_set_callback() - set state change callback on current TDLS peer |
| 190 | * @peer: TDLS peer |
| 191 | * @callback: state change callback |
| 192 | * |
| 193 | * This is used in scheduler thread context, no lock required. |
| 194 | * |
| 195 | * Return: QDF_STATUS_SUCCESS if success; other values if failed |
| 196 | */ |
| 197 | QDF_STATUS tdls_set_callback(struct tdls_peer *peer, |
| 198 | tdls_state_change_callback callback); |
| 199 | |
| 200 | /** |
| 201 | * tdls_set_extctrl_param() - set external control parameter on TDLS peer |
| 202 | * @peer: TDLS peer |
| 203 | * @chan: channel |
| 204 | * @max_latency: maximum latency |
| 205 | * @op_class: operation class |
| 206 | * @min_bandwidth: minimal bandwidth |
| 207 | * |
| 208 | * This is used in scheduler thread context, no lock required. |
| 209 | * |
| 210 | * Return: QDF_STATUS_SUCCESS if success; other values if failed |
| 211 | */ |
| 212 | QDF_STATUS tdls_set_extctrl_param(struct tdls_peer *peer, uint32_t chan, |
| 213 | uint32_t max_latency, uint32_t op_class, |
| 214 | uint32_t min_bandwidth); |
| 215 | |
| 216 | /** |
| 217 | * tdls_reset_peer() - reset TDLS peer identified by MAC address |
| 218 | * @vdev_obj: TDLS vdev object |
| 219 | * @mac: MAC address of the peer |
| 220 | * |
| 221 | * Return: QDF_STATUS_SUCCESS if success; other values if failed |
| 222 | */ |
| 223 | QDF_STATUS tdls_reset_peer(struct tdls_vdev_priv_obj *vdev_obj, |
| 224 | const uint8_t *mac); |
| 225 | |
| 226 | /** |
| 227 | * tdls_peer_idle_timers_destroy() - destroy peer idle timers |
| 228 | * @vdev_obj: TDLS vdev object |
| 229 | * |
| 230 | * Loop through the idle peer list and destroy their timers |
| 231 | * |
| 232 | * Return: None |
| 233 | */ |
| 234 | void tdls_peer_idle_timers_destroy(struct tdls_vdev_priv_obj *vdev_obj); |
| 235 | |
| 236 | /** |
| 237 | * tdls_free_peer_list() - free TDLS peer list |
| 238 | * @vdev_obj: TDLS vdev object |
| 239 | * |
| 240 | * Free all the tdls peers |
| 241 | * |
| 242 | * Return: None |
| 243 | */ |
| 244 | void tdls_free_peer_list(struct tdls_vdev_priv_obj *vdev_obj); |
| 245 | #endif |