xref: /wlan-driver/qcacld-3.0/components/tdls/core/src/wlan_tdls_main.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 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_main.h
22  *
23  * TDLS core function declaration
24  */
25 
26 #if !defined(_WLAN_TDLS_MAIN_H_)
27 #define _WLAN_TDLS_MAIN_H_
28 
29 #include <qdf_trace.h>
30 #include <qdf_list.h>
31 #include <wlan_objmgr_psoc_obj.h>
32 #include <wlan_objmgr_pdev_obj.h>
33 #include <wlan_objmgr_vdev_obj.h>
34 #include <wlan_objmgr_peer_obj.h>
35 #include <wlan_tdls_public_structs.h>
36 #include <scheduler_api.h>
37 #include "wlan_serialization_api.h"
38 #include <wlan_utility.h>
39 
40 
41 /* Bit mask flag for tdls_option to FW */
42 #define ENA_TDLS_OFFCHAN      (1 << 0)  /* TDLS Off Channel support */
43 #define ENA_TDLS_BUFFER_STA   (1 << 1)  /* TDLS Buffer STA support */
44 #define ENA_TDLS_SLEEP_STA    (1 << 2)  /* TDLS Sleep STA support */
45 
46 #define BW_20_OFFSET_BIT   0
47 #define BW_40_OFFSET_BIT   1
48 #define BW_80_OFFSET_BIT   2
49 #define BW_160_OFFSET_BIT  3
50 
51 #define TDLS_SEC_OFFCHAN_OFFSET_0        0
52 #define TDLS_SEC_OFFCHAN_OFFSET_40PLUS   40
53 #define TDLS_SEC_OFFCHAN_OFFSET_40MINUS  (-40)
54 #define TDLS_SEC_OFFCHAN_OFFSET_80       80
55 #define TDLS_SEC_OFFCHAN_OFFSET_160      160
56 /*
57  * Before UpdateTimer expires, we want to timeout discovery response
58  * should not be more than 2000.
59  */
60 #define TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE     1000
61 #define TDLS_SCAN_REJECT_MAX            5
62 #define TDLS_MAX_CONNECTED_PEERS_TO_ALLOW_SCAN   1
63 
64 #define tdls_debug(params...) \
65 	QDF_TRACE_DEBUG(QDF_MODULE_ID_TDLS, params)
66 #define tdls_debug_rl(params...) \
67 	QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_TDLS, params)
68 
69 #define tdls_notice(params...) \
70 	QDF_TRACE_INFO(QDF_MODULE_ID_TDLS, params)
71 #define tdls_warn(params...) \
72 	QDF_TRACE_WARN(QDF_MODULE_ID_TDLS, params)
73 #define tdls_err(params...) \
74 	QDF_TRACE_ERROR(QDF_MODULE_ID_TDLS, params)
75 #define tdls_alert(params...) \
76 	QDF_TRACE_FATAL(QDF_MODULE_ID_TDLS, params)
77 
78 #define tdls_nofl_debug(params...) \
79 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_TDLS, params)
80 #define tdls_nofl_notice(params...) \
81 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_TDLS, params)
82 #define tdls_nofl_warn(params...) \
83 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_TDLS, params)
84 #define tdls_nofl_err(params...) \
85 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_TDLS, params)
86 #define tdls_nofl_alert(params...) \
87 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_TDLS, params)
88 
89 #define TDLS_IS_LINK_CONNECTED(peer)  \
90 	((TDLS_LINK_CONNECTED == (peer)->link_status) || \
91 	 (TDLS_LINK_TEARING == (peer)->link_status))
92 
93 #define SET_BIT(value, mask) ((value) |= (1 << (mask)))
94 #define CLEAR_BIT(value, mask) ((value) &= ~(1 << (mask)))
95 #define CHECK_BIT(value, mask) ((value) & (1 << (mask)))
96 /**
97  * struct tdls_conn_info - TDLS connection record
98  * @session_id: session id
99  * @valid_entry: valid entry(set to true upon peer create resp from firmware)
100  * @peer_mac: peer address
101  * @index: index to store array offset.
102  */
103 struct tdls_conn_info {
104 	uint8_t session_id;
105 	bool valid_entry;
106 	uint8_t index;
107 	struct qdf_mac_addr peer_mac;
108 };
109 
110 /**
111  * enum tdls_nss_transition_state - TDLS NSS transition states
112  * @TDLS_NSS_TRANSITION_S_UNKNOWN: default state
113  * @TDLS_NSS_TRANSITION_S_2x2_to_1x1: transition from 2x2 to 1x1 stream
114  * @TDLS_NSS_TRANSITION_S_1x1_to_2x2: transition from 1x1 to 2x2 stream
115  */
116 enum tdls_nss_transition_state {
117 	TDLS_NSS_TRANSITION_S_UNKNOWN = 0,
118 	TDLS_NSS_TRANSITION_S_2x2_to_1x1,
119 	TDLS_NSS_TRANSITION_S_1x1_to_2x2,
120 };
121 
122 /**
123  * struct tdls_conn_tracker_mac_table - connection tracker peer table
124  * @mac_address: peer mac address
125  * @tx_packet_cnt: number of tx pkts
126  * @rx_packet_cnt: number of rx pkts
127  * @peer_timestamp_ms: time stamp of latest peer traffic
128  */
129 struct tdls_conn_tracker_mac_table {
130 	struct qdf_mac_addr mac_address;
131 	uint32_t tx_packet_cnt;
132 	uint32_t rx_packet_cnt;
133 	uint32_t peer_timestamp_ms;
134 };
135 
136 /**
137  * struct tdls_set_state_info - vdev id state info
138  * @vdev_id: vdev id of last set state command
139  */
140 struct tdls_set_state_info {
141 	uint8_t vdev_id;
142 };
143 
144 /**
145  * struct tdls_soc_priv_obj - tdls soc private context
146  * @soc: objmgr psoc
147  * @tdls_current_mode: current tdls mode
148  * @tdls_last_mode: last tdls mode
149  * @scan_reject_count: number of times scan rejected due to TDLS
150  * @tdls_source_bitmap: bit map to set/reset TDLS by different sources
151  * @tdls_conn_info: this tdls_conn_info can be removed and we can use peer type
152  *                of peer object to get the active tdls peers
153  * @tdls_configs: tdls user configure
154  * @max_num_tdls_sta: maximum TDLS station number allowed upon runtime condition
155  * @connected_peer_count: tdls peer connected count
156  * @tdls_off_channel: tdls off channel number
157  * @tdls_channel_offset: tdls channel offset
158  * @tdls_fw_off_chan_mode: tdls fw off channel mode
159  * @enable_tdls_connection_tracker: enable tdls connection tracker
160  * @tdls_external_peer_count: external tdls peer count
161  * @tdls_nss_switch_in_progress: tdls antenna switch in progress
162  * @tdls_nss_teardown_complete: tdls tear down complete
163  * @tdls_nss_transition_mode: tdls nss transition mode
164  * @tdls_teardown_peers_cnt: tdls tear down peer count
165  * @set_state_info: set tdls state info
166  * @tdls_rx_cb: TDLS RX callback
167  * @tdls_rx_cb_data: TDLS RX callback context
168  * @tdls_wmm_cb: TDLS WMM check callback
169  * @tdls_wmm_cb_data: TDLS WMM check callback context
170  * @tdls_event_cb: tdls event callback
171  * @tdls_evt_cb_data: tdls event user data
172  * @tdls_peer_context: userdata for register/deregister TDLS peer
173  * @tdls_reg_peer: register tdls peer with datapath
174  * @tdls_dp_vdev_update: notify datapath of vdev updates
175  * @tx_q_ack: queue for tx frames waiting for ack
176  * @tdls_con_cap: tdls concurrency support
177  * @tdls_send_mgmt_req: store eWNI_SME_TDLS_SEND_MGMT_REQ value
178  * @tdls_add_sta_req: store eWNI_SME_TDLS_ADD_STA_REQ value
179  * @tdls_del_sta_req: store eWNI_SME_TDLS_DEL_STA_REQ value
180  * @tdls_update_peer_state: store WMA_UPDATE_TDLS_PEER_STATE value
181  * @tdls_del_all_peers:store eWNI_SME_DEL_ALL_TDLS_PEERS
182  * @tdls_update_dp_vdev_flags: store CDP_UPDATE_TDLS_FLAGS
183  * @tdls_idle_peer_data: provide information about idle peer
184  * @tdls_ct_spinlock: connection tracker spin lock
185  * @is_prevent_suspend: prevent suspend or not
186  * @is_drv_supported: platform supports drv or not, enable/disable tdls wow
187  * based on this flag.
188  * @wake_lock: wake lock
189  * @runtime_lock: runtime lock
190  * @fw_tdls_mlo_capable: is fw tdls mlo capable
191  * @tdls_osif_init_cb: Callback to initialize the tdls private
192  * @tdls_osif_deinit_cb: Callback to deinitialize the tdls private
193  * @tdls_osif_update_cb: Callback for updating osif params
194  * @fw_tdls_11ax_capability: bool for tdls 11ax fw capability
195  * @fw_tdls_6g_capability: bool for tdls 6g fw capability
196  * @bss_sta_power: bss sta power
197  * @bss_sta_power_type: bss sta power type
198  * @timer_cnt: used for mlo tdls to monitor discovery response
199  * @fw_tdls_wideband_capability: bool for tdls wideband fw capability
200  * @is_user_tdls_enable: bool to check whether TDLS enable through userspace
201  */
202 struct tdls_soc_priv_obj {
203 	struct wlan_objmgr_psoc *soc;
204 	enum tdls_feature_mode tdls_current_mode;
205 	enum tdls_feature_mode tdls_last_mode;
206 	int scan_reject_count;
207 	unsigned long tdls_source_bitmap;
208 	struct tdls_conn_info tdls_conn_info[WLAN_TDLS_STA_MAX_NUM];
209 	struct tdls_user_config tdls_configs;
210 	uint16_t max_num_tdls_sta;
211 	uint16_t connected_peer_count;
212 	uint8_t tdls_off_channel;
213 	uint16_t tdls_channel_offset;
214 	int32_t tdls_fw_off_chan_mode;
215 	bool enable_tdls_connection_tracker;
216 	uint8_t tdls_external_peer_count;
217 	bool tdls_nss_switch_in_progress;
218 	bool tdls_nss_teardown_complete;
219 	enum tdls_nss_transition_state tdls_nss_transition_mode;
220 	int32_t tdls_teardown_peers_cnt;
221 	struct tdls_set_state_info set_state_info;
222 	tdls_rx_callback tdls_rx_cb;
223 	void *tdls_rx_cb_data;
224 	tdls_wmm_check tdls_wmm_cb;
225 	void *tdls_wmm_cb_data;
226 	tdls_evt_callback tdls_event_cb;
227 	void *tdls_evt_cb_data;
228 	void *tdls_peer_context;
229 	tdls_register_peer_callback tdls_reg_peer;
230 	tdls_dp_vdev_update_flags_callback tdls_dp_vdev_update;
231 	qdf_list_t tx_q_ack;
232 	enum tdls_conc_cap tdls_con_cap;
233 	uint16_t tdls_send_mgmt_req;
234 	uint16_t tdls_add_sta_req;
235 	uint16_t tdls_del_sta_req;
236 	uint16_t tdls_update_peer_state;
237 	uint16_t tdls_del_all_peers;
238 	uint32_t tdls_update_dp_vdev_flags;
239 	qdf_spinlock_t tdls_ct_spinlock;
240 #ifdef TDLS_WOW_ENABLED
241 	bool is_prevent_suspend;
242 	bool is_drv_supported;
243 	qdf_wake_lock_t wake_lock;
244 	qdf_runtime_lock_t runtime_lock;
245 #endif
246 #ifdef WLAN_FEATURE_11BE_MLO
247 	bool fw_tdls_mlo_capable;
248 #endif
249 	tdls_vdev_init_cb tdls_osif_init_cb;
250 	tdls_vdev_deinit_cb tdls_osif_deinit_cb;
251 	struct tdls_osif_cb tdls_osif_update_cb;
252 #ifdef WLAN_FEATURE_11AX
253 	bool fw_tdls_11ax_capability;
254 	bool fw_tdls_6g_capability;
255 	uint8_t bss_sta_power;
256 	uint8_t bss_sta_power_type;
257 #endif
258 	qdf_atomic_t timer_cnt;
259 	bool fw_tdls_wideband_capability;
260 	bool is_user_tdls_enable;
261 };
262 
263 /**
264  * struct tdls_vdev_priv_obj - tdls private vdev object
265  * @vdev: vdev objmgr object
266  * @peer_list: tdls peer list on this vdev
267  * @peer_update_timer: connection tracker timer
268  * @peer_discovery_timer: peer discovery timer
269  * @threshold_config: threshold config
270  * @discovery_peer_cnt: discovery peer count
271  * @discovery_sent_cnt: discovery sent count
272  * @curr_candidate: current candidate
273  * @ct_peer_table: linear mac address table for counting the packets
274  * @valid_mac_entries: number of valid mac entry in @ct_peer_mac_table
275  * @rx_mgmt: the pointer of rx mgmt info
276  * @link_score: select tdls vdev per the score
277  * @magic: magic
278  * @session_id: vdev ID
279  * @tx_queue: tx frame queue
280  * @tdls_teardown_comp: tdls teardown completion
281  */
282 struct tdls_vdev_priv_obj {
283 	struct wlan_objmgr_vdev *vdev;
284 	qdf_list_t peer_list[WLAN_TDLS_PEER_LIST_SIZE];
285 	qdf_mc_timer_t peer_update_timer;
286 	qdf_mc_timer_t peer_discovery_timer;
287 	struct tdls_config_params threshold_config;
288 	int32_t discovery_peer_cnt;
289 	uint32_t discovery_sent_cnt;
290 	struct tdls_peer *curr_candidate;
291 	struct tdls_conn_tracker_mac_table
292 			ct_peer_table[WLAN_TDLS_CT_TABLE_SIZE];
293 	uint8_t valid_mac_entries;
294 	struct tdls_rx_mgmt_frame *rx_mgmt;
295 	uint32_t link_score;
296 	uint32_t magic;
297 	uint8_t session_id;
298 	qdf_list_t tx_queue;
299 	qdf_event_t tdls_teardown_comp;
300 };
301 
302 /**
303  * struct tdls_peer_mlme_info - tdls peer mlme info
304  **/
305 struct tdls_peer_mlme_info {
306 };
307 
308 /**
309  * struct tdls_peer - tdls peer data
310  * @node: node
311  * @vdev_priv: tdls vdev priv obj
312  * @peer_mac: peer mac address
313  * @valid_entry: entry valid or not (set to true when peer create resp is
314  *               received from FW)
315  * @rssi: rssi
316  * @tdls_support: tdls support
317  * @link_status: tdls link status
318  * @is_responder: is responder
319  * @discovery_processed: discovery processed
320  * @discovery_attempt: discovery attempt
321  * @tx_pkt: tx packet
322  * @rx_pkt: rx packet
323  * @uapsd_queues: uapsd queues
324  * @max_sp: max sp
325  * @buf_sta_capable: is buffer sta
326  * @off_channel_capable: is offchannel supported flag
327  * @supported_channels_len: supported channels length
328  * @supported_chan_freq: supported channel frequency
329  * @supported_oper_classes_len: supported operation classes length
330  * @supported_oper_classes: supported operation classes
331  * @is_forced_peer: is forced peer
332  * @op_class_for_pref_off_chan: op class for preferred off channel
333  * @pref_off_chan_freq: preferred off channel frequency
334  * @pref_off_chan_width: preferred off channel width
335  * @peer_idle_timer: time to check idle traffic in tdls peers
336  * @is_peer_idle_timer_initialised: Flag to check idle timer init
337  * @spatial_streams: Number of TX/RX spatial streams for TDLS
338  * @reason: reason
339  * @state_change_notification: state change notification
340  * @qos: QOS capability of TDLS link
341  * @tdls_info: MLME info
342  */
343 struct tdls_peer {
344 	qdf_list_node_t node;
345 	struct tdls_vdev_priv_obj *vdev_priv;
346 	struct qdf_mac_addr peer_mac;
347 	bool valid_entry;
348 	int8_t rssi;
349 	enum tdls_peer_capab tdls_support;
350 	enum tdls_link_state link_status;
351 	uint8_t is_responder;
352 	uint8_t discovery_processed;
353 	uint16_t discovery_attempt;
354 	uint16_t tx_pkt;
355 	uint16_t rx_pkt;
356 	uint8_t uapsd_queues;
357 	uint8_t max_sp;
358 	uint8_t buf_sta_capable;
359 	uint8_t off_channel_capable;
360 	uint8_t supported_channels_len;
361 	qdf_freq_t supported_chan_freq[WLAN_MAC_MAX_SUPP_CHANNELS];
362 	uint8_t supported_oper_classes_len;
363 	uint8_t supported_oper_classes[WLAN_MAX_SUPP_OPER_CLASSES];
364 	bool is_forced_peer;
365 	uint8_t op_class_for_pref_off_chan;
366 	qdf_freq_t pref_off_chan_freq;
367 	uint8_t pref_off_chan_width;
368 	qdf_mc_timer_t peer_idle_timer;
369 	bool is_peer_idle_timer_initialised;
370 	uint8_t spatial_streams;
371 	enum tdls_link_state_reason reason;
372 	tdls_state_change_callback state_change_notification;
373 	uint8_t qos;
374 	struct tdls_peer_mlme_info *tdls_info;
375 };
376 
377 /**
378  * struct tdls_os_if_event - TDLS os event info
379  * @type: type of event
380  * @info: pointer to event information
381  */
382 struct tdls_os_if_event {
383 	uint32_t type;
384 	void *info;
385 };
386 
387 /**
388  * enum tdls_os_if_notification - TDLS notification from OS IF
389  * @TDLS_NOTIFY_STA_SESSION_INCREMENT: sta session count incremented
390  * @TDLS_NOTIFY_STA_SESSION_DECREMENT: sta session count decremented
391  */
392 enum tdls_os_if_notification {
393 	TDLS_NOTIFY_STA_SESSION_INCREMENT,
394 	TDLS_NOTIFY_STA_SESSION_DECREMENT
395 };
396 /**
397  * wlan_vdev_get_tdls_soc_obj - private API to get tdls soc object from vdev
398  * @vdev: vdev object
399  *
400  * Return: tdls soc object
401  */
402 static inline struct tdls_soc_priv_obj *
wlan_vdev_get_tdls_soc_obj(struct wlan_objmgr_vdev * vdev)403 wlan_vdev_get_tdls_soc_obj(struct wlan_objmgr_vdev *vdev)
404 {
405 	struct wlan_objmgr_psoc *psoc;
406 	struct tdls_soc_priv_obj *soc_obj;
407 
408 	if (!vdev) {
409 		tdls_err("NULL vdev");
410 		return NULL;
411 	}
412 
413 	psoc = wlan_vdev_get_psoc(vdev);
414 	if (!psoc) {
415 		tdls_err("can't get psoc");
416 		return NULL;
417 	}
418 
419 	soc_obj = (struct tdls_soc_priv_obj *)
420 		wlan_objmgr_psoc_get_comp_private_obj(psoc,
421 						      WLAN_UMAC_COMP_TDLS);
422 
423 	return soc_obj;
424 }
425 
426 /**
427  * wlan_psoc_get_tdls_soc_obj - private API to get tdls soc object from psoc
428  * @psoc: psoc object
429  *
430  * Return: tdls soc object
431  */
432 static inline struct tdls_soc_priv_obj *
wlan_psoc_get_tdls_soc_obj(struct wlan_objmgr_psoc * psoc)433 wlan_psoc_get_tdls_soc_obj(struct wlan_objmgr_psoc *psoc)
434 {
435 	struct tdls_soc_priv_obj *soc_obj;
436 	if (!psoc) {
437 		tdls_err("NULL psoc");
438 		return NULL;
439 	}
440 	soc_obj = (struct tdls_soc_priv_obj *)
441 		wlan_objmgr_psoc_get_comp_private_obj(psoc,
442 						      WLAN_UMAC_COMP_TDLS);
443 
444 	return soc_obj;
445 }
446 
447 /**
448  * wlan_vdev_get_tdls_vdev_obj - private API to get tdls vdev object from vdev
449  * @vdev: vdev object
450  *
451  * Return: tdls vdev object
452  */
453 static inline struct tdls_vdev_priv_obj *
wlan_vdev_get_tdls_vdev_obj(struct wlan_objmgr_vdev * vdev)454 wlan_vdev_get_tdls_vdev_obj(struct wlan_objmgr_vdev *vdev)
455 {
456 	struct tdls_vdev_priv_obj *vdev_obj;
457 
458 	if (!vdev) {
459 		tdls_err("NULL vdev");
460 		return NULL;
461 	}
462 
463 	vdev_obj = (struct tdls_vdev_priv_obj *)
464 		wlan_objmgr_vdev_get_comp_private_obj(vdev,
465 						      WLAN_UMAC_COMP_TDLS);
466 
467 	return vdev_obj;
468 }
469 
470 /**
471  * tdls_set_link_status - tdls set link status
472  * @vdev: vdev object
473  * @mac: mac address of tdls peer
474  * @link_state: tdls link state
475  * @link_reason: reason
476  *
477  * Return: None
478  */
479 void tdls_set_link_status(struct tdls_vdev_priv_obj *vdev,
480 			  const uint8_t *mac,
481 			  enum tdls_link_state link_state,
482 			  enum tdls_link_state_reason link_reason);
483 /**
484  * tdls_psoc_obj_create_notification() - tdls psoc create notification handler
485  * @psoc: psoc object
486  * @arg_list: Argument list
487  *
488  * Return: QDF_STATUS
489  */
490 QDF_STATUS tdls_psoc_obj_create_notification(struct wlan_objmgr_psoc *psoc,
491 					     void *arg_list);
492 
493 /**
494  * tdls_psoc_obj_destroy_notification() - tdls psoc destroy notification handler
495  * @psoc: psoc object
496  * @arg_list: Argument list
497  *
498  * Return: QDF_STATUS
499  */
500 QDF_STATUS tdls_psoc_obj_destroy_notification(struct wlan_objmgr_psoc *psoc,
501 					      void *arg_list);
502 
503 /**
504  * tdls_vdev_obj_create_notification() - tdls vdev create notification handler
505  * @vdev: vdev object
506  * @arg_list: Argument list
507  *
508  * Return: QDF_STATUS
509  */
510 QDF_STATUS tdls_vdev_obj_create_notification(struct wlan_objmgr_vdev *vdev,
511 					     void *arg_list);
512 
513 /**
514  * tdls_vdev_obj_destroy_notification() - tdls vdev destroy notification handler
515  * @vdev: vdev object
516  * @arg_list: Argument list
517  *
518  * Return: QDF_STATUS
519  */
520 QDF_STATUS tdls_vdev_obj_destroy_notification(struct wlan_objmgr_vdev *vdev,
521 					      void *arg_list);
522 
523 /**
524  * tdls_process_cmd() - tdls main command process function
525  * @msg: scheduler msg
526  *
527  * Return: QDF_STATUS
528  */
529 QDF_STATUS tdls_process_cmd(struct scheduler_msg *msg);
530 
531 /**
532  * tdls_process_evt() - tdls main event process function
533  * @msg: scheduler msg
534  *
535  * Return: QDF_STATUS
536  */
537 QDF_STATUS tdls_process_evt(struct scheduler_msg *msg);
538 
539 /**
540  * tdls_timer_restart() - restart TDLS timer
541  * @vdev: VDEV object manager
542  * @timer: timer to restart
543  * @expiration_time: new expiration time to set for the timer
544  *
545  * Return: Void
546  */
547 void tdls_timer_restart(struct wlan_objmgr_vdev *vdev,
548 				 qdf_mc_timer_t *timer,
549 				 uint32_t expiration_time);
550 
551 /**
552  * tdls_timers_stop() - stop all the tdls timers running
553  * @tdls_vdev: TDLS vdev
554  *
555  * Return: none
556  */
557 void tdls_timers_stop(struct tdls_vdev_priv_obj *tdls_vdev);
558 
559 /**
560  * tdls_get_vdev_objects() - Get TDLS private objects
561  * @vdev: VDEV object manager
562  * @tdls_vdev_obj: tdls vdev object
563  * @tdls_soc_obj: tdls soc object
564  *
565  * Return: QDF_STATUS
566  */
567 QDF_STATUS tdls_get_vdev_objects(struct wlan_objmgr_vdev *vdev,
568 				   struct tdls_vdev_priv_obj **tdls_vdev_obj,
569 				   struct tdls_soc_priv_obj **tdls_soc_obj);
570 
571 /**
572  * tdls_set_ct_mode() - Set the tdls connection tracker mode
573  * @psoc: objmgr psoc object
574  * @vdev: Pointer to vdev object
575  *
576  * This routine is called to set the tdls connection tracker operation status
577  *
578  * Return: NONE
579  */
580 void tdls_set_ct_mode(struct wlan_objmgr_psoc *psoc,
581 		      struct wlan_objmgr_vdev *vdev);
582 
583 /**
584  * tdls_set_user_tdls_enable()- Set the tdls enable from userspace
585  * @vdev: Pointer to vdev object
586  * @is_user_tdls_enable: true if tdls is enable from userspace
587  *
588  * return: NONE
589  */
590 void tdls_set_user_tdls_enable(struct wlan_objmgr_vdev *vdev,
591 			       bool is_user_tdls_enable);
592 /**
593  * tdls_set_operation_mode() - set tdls operating mode
594  * @tdls_set_mode: tdls mode set params
595  *
596  * Return: QDF_STATUS
597  */
598 QDF_STATUS tdls_set_operation_mode(struct tdls_set_mode_params *tdls_set_mode);
599 
600 /**
601  * tdls_notify_sta_connect() - Update tdls state for every
602  * connect event.
603  * @notify: sta connect params
604  *
605  * After every connect event in the system, check whether TDLS
606  * can be enabled in the system. If TDLS can be enabled, update the
607  * TDLS state as needed.
608  *
609  * Return: QDF_STATUS
610  */
611 QDF_STATUS tdls_notify_sta_connect(struct tdls_sta_notify_params *notify);
612 
613 /**
614  * tdls_process_enable_for_vdev() - Enable TDLS in firmware and activate the
615  * connection tracker
616  * @vdev: Pointer to vdev object
617  *
618  * Return: void
619  */
620 void tdls_process_enable_for_vdev(struct wlan_objmgr_vdev *vdev);
621 
622 #ifdef WLAN_FEATURE_11BE_MLO
623 /**
624  * tdls_process_enable_disable_for_ml_vdev() - Enable TDLS in firmware & active
625  * connection tracker for all the ML vdevs belonging to same MLD as the
626  * given vdev
627  * @vdev: Pointer to vdev object
628  * @is_enable: Flag to indicate if operation is enable TDLS or disable TDLS
629  *
630  * Return: None
631  */
632 void tdls_process_enable_disable_for_ml_vdev(struct wlan_objmgr_vdev *vdev,
633 					     bool is_enable);
634 #else
635 static inline
tdls_process_enable_disable_for_ml_vdev(struct wlan_objmgr_vdev * vdev,bool is_enable)636 void tdls_process_enable_disable_for_ml_vdev(struct wlan_objmgr_vdev *vdev,
637 					     bool is_enable)
638 {}
639 #endif
640 
641 /**
642  * tdls_notify_sta_disconnect() - Update tdls state for every
643  * disconnect event.
644  * @notify: sta disconnect params
645  *
646  * After every disconnect event in the system, check whether TDLS
647  * can be disabled/enabled in the system and update the
648  * TDLS state as needed.
649  *
650  * Return: QDF_STATUS
651  */
652 QDF_STATUS tdls_notify_sta_disconnect(struct tdls_sta_notify_params *notify);
653 
654 /**
655  * tdls_notify_reset_adapter() - notify reset adapter
656  * @vdev: vdev object
657  *
658  * Notify TDLS about the adapter reset
659  *
660  * Return: None
661  */
662 void tdls_notify_reset_adapter(struct wlan_objmgr_vdev *vdev);
663 
664 /**
665  * tdls_peers_deleted_notification() - peer delete notification
666  * @psoc: soc object
667  * @vdev_id: vdev id
668  *
669  * Legacy lim layer will delete tdls peers for roaming and heart beat failures
670  * and notify the component about the delete event to update the tdls.
671  * state.
672  *
673  * Return: QDF_STATUS
674  */
675 QDF_STATUS tdls_peers_deleted_notification(struct wlan_objmgr_psoc *psoc,
676 					   uint8_t vdev_id);
677 
678 /**
679  * tdls_notify_decrement_session() - Notify the session decrement
680  * @psoc: psoc  object manager
681  *
682  * Policy manager notify TDLS about session decrement
683  *
684  * Return: None
685  */
686 void tdls_notify_decrement_session(struct wlan_objmgr_psoc *psoc);
687 
688 /**
689  * tdls_send_update_to_fw - update tdls status info
690  * @tdls_vdev_obj: tdls vdev private object.
691  * @tdls_soc_obj: TDLS soc private object
692  * @tdls_prohibited: indicates whether tdls is prohibited.
693  * @tdls_chan_swit_prohibited: indicates whether tdls channel switch
694  *                             is prohibited.
695  * @sta_connect_event: indicate sta connect or disconnect event
696  * @session_id: session id
697  *
698  * Normally an AP does not influence TDLS connection between STAs
699  * associated to it. But AP may set bits for TDLS Prohibited or
700  * TDLS Channel Switch Prohibited in Extended Capability IE in
701  * Assoc/Re-assoc response to STA. So after STA is connected to
702  * an AP, call this function to update TDLS status as per those
703  * bits set in Ext Cap IE in received Assoc/Re-assoc response
704  * from AP.
705  *
706  * Return: void
707  */
708 void tdls_send_update_to_fw(struct tdls_vdev_priv_obj *tdls_vdev_obj,
709 			    struct tdls_soc_priv_obj *tdls_soc_obj,
710 			    bool tdls_prohibited,
711 			    bool tdls_chan_swit_prohibited,
712 			    bool sta_connect_event,
713 			    uint8_t session_id);
714 
715 /**
716  * tdls_notify_increment_session() - Notify the session increment
717  * @psoc: psoc  object manager
718  *
719  * Policy manager notify TDLS about session increment
720  *
721  * Return: None
722  */
723 void tdls_notify_increment_session(struct wlan_objmgr_psoc *psoc);
724 
725 /**
726  * tdls_get_6g_pwr_for_power_type() - get power for a 6g freq for particular
727  *                                    power type
728  * @vdev: vdev object
729  * @freq: 6g freq
730  * @pwr_typ: power type
731  *
732  * Function that gets power for a 6g freq for particular power type
733  *
734  * Return: true or false
735  */
736 uint32_t tdls_get_6g_pwr_for_power_type(struct wlan_objmgr_vdev *vdev,
737 					qdf_freq_t freq,
738 					enum supported_6g_pwr_types pwr_typ);
739 
740 /**
741  * tdls_is_6g_freq_allowed() - check is tdls 6ghz allowed or not
742  * @vdev: vdev object
743  * @freq: 6g freq
744  *
745  * Function determines the whether TDLS on 6ghz is allowed in the system
746  *
747  * Return: true or false
748  */
749 bool tdls_is_6g_freq_allowed(struct wlan_objmgr_vdev *vdev, qdf_freq_t freq);
750 
751 /**
752  * tdls_check_is_user_tdls_enable() - Check is tdls enabled or not
753  * @tdls_soc_obj: TDLS soc object
754  *
755  * Return: true or false
756  */
757 bool tdls_check_is_user_tdls_enable(struct tdls_soc_priv_obj *tdls_soc_obj);
758 
759 /**
760  * tdls_check_is_tdls_allowed() - check is tdls allowed or not
761  * @vdev: vdev object
762  *
763  * Function determines the whether TDLS allowed in the system
764  *
765  * Return: true or false
766  */
767 bool tdls_check_is_tdls_allowed(struct wlan_objmgr_vdev *vdev);
768 
769 /**
770  * tdls_get_vdev() - Get tdls specific vdev object manager
771  * @psoc: wlan psoc object manager
772  * @dbg_id: debug id
773  *
774  * If TDLS possible, return the corresponding vdev
775  * to enable TDLS in the system.
776  *
777  * Return: vdev manager pointer or NULL.
778  */
779 struct wlan_objmgr_vdev *tdls_get_vdev(struct wlan_objmgr_psoc *psoc,
780 					  wlan_objmgr_ref_dbgid dbg_id);
781 
782 /**
783  * tdls_process_policy_mgr_notification() - process policy manager notification
784  * @psoc: soc object manager
785  *
786  * Return: QDF_STATUS
787  */
788 QDF_STATUS
789 tdls_process_policy_mgr_notification(struct wlan_objmgr_psoc *psoc);
790 
791 /**
792  * tdls_process_decrement_active_session() - process policy manager decrement
793  * sessions.
794  * @psoc: soc object manager
795  *
796  * Return: QDF_STATUS
797  */
798 QDF_STATUS
799 tdls_process_decrement_active_session(struct wlan_objmgr_psoc *psoc);
800 
801 /**
802  * wlan_tdls_get_mlo_vdev() - get mlo vdev for tdls
803  * @vdev: vdev object
804  * @index: index of vdev in mlo list
805  * @dbg_id: debug id
806  *
807  * Return: vdev pointer
808  */
809 struct wlan_objmgr_vdev *wlan_tdls_get_mlo_vdev(struct wlan_objmgr_vdev *vdev,
810 						uint8_t index,
811 						wlan_objmgr_ref_dbgid dbg_id);
812 
813 /**
814  * wlan_tdls_release_mlo_vdev() - release mlo vdev for tdls
815  * @vdev: vdev object
816  * @dbg_id: debug id
817  *
818  * Return: void
819  */
820 void wlan_tdls_release_mlo_vdev(struct wlan_objmgr_vdev *vdev,
821 				wlan_objmgr_ref_dbgid dbg_id);
822 
823 /**
824  * tdls_scan_complete_event_handler() - scan complete event handler for tdls
825  * @vdev: vdev object
826  * @event: scan event
827  * @arg: tdls soc object
828  *
829  * Return: None
830  */
831 void tdls_scan_complete_event_handler(struct wlan_objmgr_vdev *vdev,
832 			struct scan_event *event,
833 			void *arg);
834 
835 /**
836  * tdls_set_link_unforce() - set link unforce
837  * @vdev: vdev object
838  *
839  * Return: void
840  */
841 void tdls_set_link_unforce(struct wlan_objmgr_vdev *vdev);
842 
843 /**
844  * tdls_scan_callback() - callback for TDLS scan operation
845  * @tdls_soc: tdls soc pvt object
846  *
847  * Return: QDF_STATUS
848  */
849 QDF_STATUS tdls_scan_callback(struct tdls_soc_priv_obj *tdls_soc);
850 
851 /**
852  * tdls_scan_done_callback() - callback for tdls scan done event
853  * @tdls_soc: tdls soc object
854  *
855  * Return: Void
856  */
857 void tdls_scan_done_callback(struct tdls_soc_priv_obj *tdls_soc);
858 
859 /**
860  * tdls_scan_serialization_comp_info_cb() - callback for scan start
861  * @vdev: VDEV on which the scan command is being processed
862  * @comp_info: serialize rules info
863  * @cmd: the serialization command
864  *
865  * Return: Void
866  */
867 void tdls_scan_serialization_comp_info_cb(struct wlan_objmgr_vdev *vdev,
868 		union wlan_serialization_rules_info *comp_info,
869 		struct wlan_serialization_command *cmd);
870 /**
871  * tdls_check_and_indicate_delete_all_peers() - Check if delete all peers is
872  * allowed for the vdev based on current concurrency.
873  * @psoc: soc object
874  * @vdev_id: vdev id
875  *
876  * Notify tdls component to cleanup all peers based on current concurrency
877  * combination.
878  *
879  * Return: QDF_STATUS
880  */
881 QDF_STATUS
882 tdls_check_and_indicate_delete_all_peers(struct wlan_objmgr_psoc *psoc,
883 					 uint8_t vdev_id);
884 
885 /**
886  * tdls_get_opclass_from_bandwidth() - Return opclass for corresponding BW and
887  * channel.
888  * @vdev: Pointer to vdev
889  * @freq: Channel frequency.
890  * @bw_offset: Bandwidth offset.
891  * @reg_bw_offset: enum offset_t type bandwidth
892  *
893  * To return the opclas.
894  *
895  * Return: opclass
896  */
897 uint8_t tdls_get_opclass_from_bandwidth(struct wlan_objmgr_vdev *vdev,
898 					qdf_freq_t freq, uint8_t bw_offset,
899 					uint8_t *reg_bw_offset);
900 
901 #ifdef WLAN_FEATURE_TDLS_CONCURRENCIES
902 /**
903  * tdls_handle_start_bss() - Handle start BSS event to act on concurrent
904  * session offchannel mode
905  * @psoc: Pointer to PSOC object
906  *
907  * Return: None
908  */
909 QDF_STATUS tdls_handle_start_bss(struct wlan_objmgr_psoc *psoc);
910 
911 /**
912  * tdls_is_concurrency_allowed() - Is TDLS allowed with the current concurrency
913  * @psoc: Pointer to PSOC
914  *
915  * Return: True or False
916  */
917 bool tdls_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc);
918 #else
919 static inline
tdls_handle_start_bss(struct wlan_objmgr_psoc * psoc)920 QDF_STATUS tdls_handle_start_bss(struct wlan_objmgr_psoc *psoc)
921 {
922 	return QDF_STATUS_SUCCESS;
923 }
924 
925 static inline bool
tdls_is_concurrency_allowed(struct wlan_objmgr_psoc * psoc)926 tdls_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc)
927 {
928 	return false;
929 }
930 
931 #endif /* WLAN_FEATURE_TDLS_CONCURRENCIES */
932 #endif
933