1 /*
2  * Copyright (c) 2020, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /*
19  * DOC: contains tdls link teardown declarations
20  */
21  #ifndef _WLAN_TDLS_API_H_
22  #define _WLAN_TDLS_API_H_
23 
24 #include "wlan_objmgr_psoc_obj.h"
25 #include "wlan_objmgr_pdev_obj.h"
26 #include "wlan_objmgr_vdev_obj.h"
27 
28 #ifdef FEATURE_WLAN_TDLS
29 #ifdef WLAN_FEATURE_11BE_MLO
30 /**
31  * wlan_tdls_is_fw_11be_mlo_capable() - Get TDLS 11be mlo capab
32  * @psoc: psoc context
33  *
34  * Return: True if 11be mlo capable
35  */
36 bool wlan_tdls_is_fw_11be_mlo_capable(struct wlan_objmgr_psoc *psoc);
37 #else
38 static inline
wlan_tdls_is_fw_11be_mlo_capable(struct wlan_objmgr_psoc * psoc)39 bool wlan_tdls_is_fw_11be_mlo_capable(struct wlan_objmgr_psoc *psoc)
40 {
41 	return false;
42 }
43 #endif
44 #ifdef FEATURE_SET
45 /**
46  * wlan_tdls_get_features_info() - Get tdls features info
47  * @psoc: psoc context
48  * @tdls_feature_set: TDLS feature set info structure
49  *
50  * Return: None
51  */
52 
53 void wlan_tdls_get_features_info(struct wlan_objmgr_psoc *psoc,
54 				 struct wlan_tdls_features *tdls_feature_set);
55 #endif
56 
57 /**
58  * wlan_tdls_teardown_links() - notify TDLS module to teardown all TDLS links
59  * @psoc: psoc object
60  *
61  * Return: QDF_STATUS
62  */
63 QDF_STATUS wlan_tdls_teardown_links(struct wlan_objmgr_psoc *psoc);
64 
65 /**
66  * wlan_tdls_check_and_teardown_links_sync() - teardown all the TDLS links
67  * @psoc: psoc object
68  * @vdev: Vdev object pointer
69  *
70  * Return: None
71  */
72 void wlan_tdls_check_and_teardown_links_sync(struct wlan_objmgr_psoc *psoc,
73 					     struct wlan_objmgr_vdev *vdev);
74 
75 /**
76  * wlan_tdls_notify_sta_disconnect() - notify sta disconnect
77  * @vdev_id: pointer to soc object
78  * @lfr_roam: indicate, whether disconnect due to lfr roam
79  * @user_disconnect: disconnect from user space
80  * @vdev: vdev object manager
81  *
82  * Notify sta disconnect event to TDLS component
83  *
84  * Return: QDF_STATUS
85  */
86 void wlan_tdls_notify_sta_disconnect(uint8_t vdev_id,
87 				     bool lfr_roam, bool user_disconnect,
88 				     struct wlan_objmgr_vdev *vdev);
89 
90 /**
91  * wlan_tdls_notify_sta_connect() - notify sta connect to TDLS
92  * @vdev_id: pointer to soc object
93  * @tdls_chan_swit_prohibited: indicates channel switch capability
94  * @tdls_prohibited: indicates tdls allowed or not
95  * @vdev: vdev object manager
96  *
97  * Notify sta connect event to TDLS component
98  *
99  * Return: None
100  */
101 void
102 wlan_tdls_notify_sta_connect(uint8_t vdev_id,
103 			     bool tdls_chan_swit_prohibited,
104 			     bool tdls_prohibited,
105 			     struct wlan_objmgr_vdev *vdev);
106 
107 /**
108  * wlan_is_tdls_session_present() - Get TDLS session status
109  * @vdev: vdev pointer
110  *
111  * Return: QDF_STATUS_SUCCESS if success; other value if failed
112  */
113 QDF_STATUS
114 wlan_is_tdls_session_present(struct wlan_objmgr_vdev *vdev);
115 
116 /**
117  * wlan_tdls_update_tx_pkt_cnt() - update tx pkt count
118  * @vdev: tdls vdev object
119  * @mac_addr: peer mac address
120  *
121  * Return: None
122  */
123 void wlan_tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
124 				 struct qdf_mac_addr *mac_addr);
125 
126 /**
127  * wlan_tdls_update_rx_pkt_cnt() - update rx pkt count
128  * @vdev: tdls vdev object
129  * @mac_addr: peer mac address
130  * @dest_mac_addr: dest mac address
131  *
132  * Return: None
133  */
134 void wlan_tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
135 				 struct qdf_mac_addr *mac_addr,
136 				 struct qdf_mac_addr *dest_mac_addr);
137 /**
138  * wlan_tdls_notify_start_bss_failure() - Notify TDLS module on start bss
139  * failure
140  * @psoc: Pointer to PSOC object
141  *
142  * Return: None
143  */
144 void wlan_tdls_notify_start_bss_failure(struct wlan_objmgr_psoc *psoc);
145 
146 /**
147  * wlan_tdls_notify_start_bss() - Notify TDLS module on start bss
148  * @psoc: Pointer to PSOC object
149  * @vdev: Vdev object pointer
150  *
151  * Return: None
152  */
153 void wlan_tdls_notify_start_bss(struct wlan_objmgr_psoc *psoc,
154 				struct wlan_objmgr_vdev *vdev);
155 
156 #ifdef WLAN_FEATURE_TDLS_CONCURRENCIES
157 /**
158  * wlan_tdls_notify_channel_switch_complete() - Notify TDLS module about the
159  * channel switch completion
160  * @psoc: Pointer to PSOC object
161  * @vdev_id: vdev id
162  *
163  * Return: None
164  */
165 void wlan_tdls_notify_channel_switch_complete(struct wlan_objmgr_psoc *psoc,
166 					      uint8_t vdev_id);
167 
168 /**
169  * wlan_tdls_notify_channel_switch_start() - Process channel switch start
170  * for SAP/P2P GO vdev. For STA vdev, TDLS teardown happens, so explicit
171  * disable off channel is not required.
172  * @psoc: Pointer to PSOC object
173  * @vdev: Pointer to current vdev on which CSA is triggered
174  *
175  * Return: None
176  */
177 void wlan_tdls_notify_channel_switch_start(struct wlan_objmgr_psoc *psoc,
178 					   struct wlan_objmgr_vdev *vdev);
179 
180 /**
181  * wlan_tdls_handle_p2p_client_connect() - Handle P2P Client connect start
182  * @psoc: Pointer to PSOC object
183  * @vdev: Pointer to P2P client vdev
184  *
185  * Return: None
186  */
187 void wlan_tdls_handle_p2p_client_connect(struct wlan_objmgr_psoc *psoc,
188 					 struct wlan_objmgr_vdev *vdev);
189 #else
190 static inline
wlan_tdls_notify_channel_switch_complete(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)191 void wlan_tdls_notify_channel_switch_complete(struct wlan_objmgr_psoc *psoc,
192 					      uint8_t vdev_id)
193 {}
194 
195 static inline
wlan_tdls_notify_channel_switch_start(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev)196 void wlan_tdls_notify_channel_switch_start(struct wlan_objmgr_psoc *psoc,
197 					   struct wlan_objmgr_vdev *vdev)
198 {}
199 
200 static inline
wlan_tdls_handle_p2p_client_connect(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev)201 void wlan_tdls_handle_p2p_client_connect(struct wlan_objmgr_psoc *psoc,
202 					 struct wlan_objmgr_vdev *vdev)
203 {}
204 #endif /* WLAN_FEATURE_TDLS_CONCURRENCIES */
205 
206 /**
207  * wlan_tdls_increment_discovery_attempts() - Increment TDLS peer discovery
208  * attempts
209  * @psoc: Pointer to PSOC object
210  * @vdev_id: Vdev id
211  * @peer_addr: Peer mac address
212  *
213  * Return: None
214  */
215 void wlan_tdls_increment_discovery_attempts(struct wlan_objmgr_psoc *psoc,
216 					    uint8_t vdev_id,
217 					    uint8_t *peer_addr);
218 #else
219 
220 #ifdef FEATURE_SET
221 static inline
wlan_tdls_get_features_info(struct wlan_objmgr_psoc * psoc,struct wlan_tdls_features * tdls_feature_set)222 void wlan_tdls_get_features_info(struct wlan_objmgr_psoc *psoc,
223 				 struct wlan_tdls_features *tdls_feature_set)
224 {
225 }
226 #endif
227 
228 static inline
wlan_tdls_is_fw_11be_mlo_capable(struct wlan_objmgr_psoc * psoc)229 bool wlan_tdls_is_fw_11be_mlo_capable(struct wlan_objmgr_psoc *psoc)
230 {
231 	return false;
232 }
233 
wlan_tdls_teardown_links(struct wlan_objmgr_psoc * psoc)234 static inline QDF_STATUS wlan_tdls_teardown_links(struct wlan_objmgr_psoc *psoc)
235 {
236 	return QDF_STATUS_SUCCESS;
237 }
238 
239 static inline void
wlan_tdls_check_and_teardown_links_sync(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev)240 wlan_tdls_check_and_teardown_links_sync(struct wlan_objmgr_psoc *psoc,
241 					struct wlan_objmgr_vdev *vdev)
242 {}
243 
244 static inline
wlan_tdls_notify_sta_disconnect(uint8_t vdev_id,bool lfr_roam,bool user_disconnect,struct wlan_objmgr_vdev * vdev)245 void wlan_tdls_notify_sta_disconnect(uint8_t vdev_id,
246 				     bool lfr_roam, bool user_disconnect,
247 				     struct wlan_objmgr_vdev *vdev)
248 {}
249 
250 static inline void
wlan_tdls_notify_sta_connect(uint8_t vdev_id,bool tdls_chan_swit_prohibited,bool tdls_prohibited,struct wlan_objmgr_vdev * vdev)251 wlan_tdls_notify_sta_connect(uint8_t vdev_id,
252 			     bool tdls_chan_swit_prohibited,
253 			     bool tdls_prohibited,
254 			     struct wlan_objmgr_vdev *vdev) {}
255 
256 static inline void
wlan_tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr * mac_addr)257 wlan_tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
258 			    struct qdf_mac_addr *mac_addr)
259 {
260 }
261 
262 static inline
wlan_tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr * mac_addr,struct qdf_mac_addr * dest_mac_addr)263 void wlan_tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
264 				 struct qdf_mac_addr *mac_addr,
265 				 struct qdf_mac_addr *dest_mac_addr)
266 {
267 }
268 
269 static inline
wlan_tdls_notify_start_bss(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev)270 void wlan_tdls_notify_start_bss(struct wlan_objmgr_psoc *psoc,
271 				struct wlan_objmgr_vdev *vdev)
272 {}
273 
274 static inline
wlan_tdls_notify_channel_switch_complete(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)275 void wlan_tdls_notify_channel_switch_complete(struct wlan_objmgr_psoc *psoc,
276 					      uint8_t vdev_id)
277 {}
278 
279 static inline
wlan_tdls_notify_channel_switch_start(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev)280 void wlan_tdls_notify_channel_switch_start(struct wlan_objmgr_psoc *psoc,
281 					   struct wlan_objmgr_vdev *vdev)
282 {}
283 
284 static inline
wlan_tdls_handle_p2p_client_connect(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev)285 void wlan_tdls_handle_p2p_client_connect(struct wlan_objmgr_psoc *psoc,
286 					 struct wlan_objmgr_vdev *vdev)
287 {}
288 
289 static inline
wlan_tdls_notify_start_bss_failure(struct wlan_objmgr_psoc * psoc)290 void wlan_tdls_notify_start_bss_failure(struct wlan_objmgr_psoc *psoc)
291 {}
292 
293 static inline
wlan_tdls_increment_discovery_attempts(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint8_t * peer_addr)294 void wlan_tdls_increment_discovery_attempts(struct wlan_objmgr_psoc *psoc,
295 					    uint8_t vdev_id,
296 					    uint8_t *peer_addr)
297 {}
298 #endif
299 #endif
300