1 /*
2  * Copyright (c) 2017-2021 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
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_public_structs.h
22  *
23  * TDLS public structure definitions
24  */
25 
26 #ifndef _WLAN_TDLS_STRUCTS_H_
27 #define _WLAN_TDLS_STRUCTS_H_
28 #include <qdf_timer.h>
29 #include <qdf_list.h>
30 #include <qdf_mc_timer.h>
31 #include <wlan_cmn.h>
32 #include <wlan_cmn_ieee80211.h>
33 #ifdef FEATURE_RUNTIME_PM
34 #include <wlan_pmo_common_public_struct.h>
35 #endif
36 
37 #define WLAN_TDLS_STA_MAX_NUM                        8
38 #define WLAN_TDLS_STA_P_UAPSD_OFFCHAN_MAX_NUM        1
39 #define WLAN_TDLS_PEER_LIST_SIZE                     16
40 #define WLAN_TDLS_CT_TABLE_SIZE                      8
41 #define WLAN_TDLS_PEER_SUB_LIST_SIZE                 10
42 #define WLAN_MAC_MAX_EXTN_CAP                        8
43 #define WLAN_MAC_MAX_SUPP_CHANNELS                   100
44 #define WLAN_MAC_WMI_MAX_SUPP_CHANNELS               128
45 #define WLAN_MAX_SUPP_OPER_CLASSES                   32
46 #define WLAN_MAC_MAX_SUPP_RATES                      32
47 #define WLAN_CHANNEL_14                              14
48 
49 /* Enable TDLS off-channel switch */
50 #define ENABLE_CHANSWITCH                            1
51 
52 /*
53  * Passive(peer requested) responder mode off-channel switch.
54  * If peer initiates off channel request, that will be honored in
55  * this mode
56  */
57 #define DISABLE_CHANSWITCH                           2
58 
59 /*
60  * Disable TDLS off-channel operation completely.
61  * Peer initiated requests will also be discarded.
62  */
63 #define DISABLE_ACTIVE_CHANSWITCH                    3
64 
65 #define WLAN_TDLS_PREFERRED_OFF_CHANNEL_NUM_MIN      1
66 #define WLAN_TDLS_PREFERRED_OFF_CHANNEL_NUM_MAX      165
67 #define WLAN_TDLS_PREFERRED_OFF_CHANNEL_NUM_DEF      36
68 #define WLAN_TDLS_PREFERRED_OFF_CHANNEL_FRQ_DEF     5180
69 #define WLAN_TDLS_MAX_CONCURRENT_VDEV_SUPPORTED      3
70 
71 #define AC_PRIORITY_NUM                 4
72 
73 /* Default tdls serialize timeout is set to 4 (peer delete) + 1 secs */
74 #ifdef FEATURE_RUNTIME_PM
75 /* Add extra PMO_RESUME_TIMEOUT for runtime PM resume timeout */
76 #define TDLS_DELETE_PEER_CMD_TIMEOUT (4000 + 1000 + PMO_RESUME_TIMEOUT)
77 #else
78 #define TDLS_DELETE_PEER_CMD_TIMEOUT (4000 + 1000)
79 #endif
80 
81 /** Maximum time(ms) to wait for tdls del sta to complete **/
82 #define WAIT_TIME_TDLS_DEL_STA  (TDLS_DELETE_PEER_CMD_TIMEOUT + 1000)
83 
84 #define TDLS_DEFAULT_SERIALIZE_CMD_TIMEOUT (4000)
85 
86 /** Maximum time(ms) to wait for tdls add sta to complete **/
87 #define WAIT_TIME_TDLS_ADD_STA  (TDLS_DEFAULT_SERIALIZE_CMD_TIMEOUT + 1000)
88 
89 /** Maximum time(ms) to wait for Link Establish Req to complete **/
90 #define WAIT_TIME_TDLS_LINK_ESTABLISH_REQ      1500
91 
92 /** Maximum time(ms) to wait for tdls mgmt to complete **/
93 #define WAIT_TIME_FOR_TDLS_MGMT         3000
94 
95 /** Maximum time(ms) to wait for tdls mgmt to complete **/
96 #define WAIT_TIME_FOR_TDLS_USER_CMD     11000
97 
98 /** Maximum waittime for TDLS teardown links **/
99 #define WAIT_TIME_FOR_TDLS_TEARDOWN_LINKS 10000
100 
101 /** Maximum waittime for TDLS antenna switch **/
102 #define WAIT_TIME_FOR_TDLS_ANTENNA_SWITCH 1000
103 
104 #define TDLS_TEARDOWN_PEER_UNREACHABLE   25
105 #define TDLS_TEARDOWN_PEER_UNSPEC_REASON 26
106 
107 #define INVALID_TDLS_PEER_INDEX 0xFF
108 
109 #ifdef WLAN_FEATURE_11AX
110 #define MIN_TDLS_HE_CAP_LEN 17
111 #define MAX_TDLS_HE_CAP_LEN 29
112 #endif
113 
114 /**
115  * enum tdls_add_oper - add peer type
116  * @TDLS_OPER_NONE: none
117  * @TDLS_OPER_ADD: add new peer
118  * @TDLS_OPER_UPDATE: used to update peer
119  */
120 enum tdls_add_oper {
121 	TDLS_OPER_NONE,
122 	TDLS_OPER_ADD,
123 	TDLS_OPER_UPDATE
124 };
125 
126 /**
127  * enum tdls_conc_cap - tdls concurrency support
128  * @TDLS_SUPPORTED_ONLY_ON_STA: only support sta tdls
129  * @TDLS_SUPPORTED_ONLY_ON_P2P_CLIENT: only support p2p client tdls
130  */
131 enum tdls_conc_cap {
132 	TDLS_SUPPORTED_ONLY_ON_STA = 0,
133 	TDLS_SUPPORTED_ONLY_ON_P2P_CLIENT,
134 };
135 
136 /**
137  * enum tdls_peer_capab - tdls capability type
138  * @TDLS_CAP_NOT_SUPPORTED: tdls not supported
139  * @TDLS_CAP_UNKNOWN: unknown capability
140  * @TDLS_CAP_SUPPORTED: tdls capability supported
141  */
142 enum tdls_peer_capab {
143 	TDLS_CAP_NOT_SUPPORTED = -1,
144 	TDLS_CAP_UNKNOWN       = 0,
145 	TDLS_CAP_SUPPORTED     = 1,
146 };
147 
148 /**
149  * enum tdls_peer_state - tdls peer state
150  * @TDLS_PEER_STATE_PEERING: tdls connection in progress
151  * @TDLS_PEER_STATE_CONNECTED: tdls peer is connected
152  * @TDLS_PEER_STATE_TEARDOWN: tdls peer is tear down
153  * @TDLS_PEER_ADD_MAC_ADDR: add peer mac into connection table
154  * @TDLS_PEER_REMOVE_MAC_ADDR: remove peer mac from connection table
155  */
156 enum tdls_peer_state {
157 	TDLS_PEER_STATE_PEERING,
158 	TDLS_PEER_STATE_CONNECTED,
159 	TDLS_PEER_STATE_TEARDOWN,
160 	TDLS_PEER_ADD_MAC_ADDR,
161 	TDLS_PEER_REMOVE_MAC_ADDR
162 };
163 
164 /**
165  * enum tdls_link_state - tdls link state
166  * @TDLS_LINK_IDLE: tdls link idle
167  * @TDLS_LINK_DISCOVERING: tdls link discovering
168  * @TDLS_LINK_DISCOVERED: tdls link discovered
169  * @TDLS_LINK_CONNECTING: tdls link connecting
170  * @TDLS_LINK_CONNECTED: tdls link connected
171  * @TDLS_LINK_TEARING: tdls link tearing
172  */
173 enum tdls_link_state {
174 	TDLS_LINK_IDLE = 0,
175 	TDLS_LINK_DISCOVERING,
176 	TDLS_LINK_DISCOVERED,
177 	TDLS_LINK_CONNECTING,
178 	TDLS_LINK_CONNECTED,
179 	TDLS_LINK_TEARING,
180 };
181 
182 /**
183  * enum tdls_link_state_reason - tdls link reason
184  * @TDLS_LINK_SUCCESS: Success
185  * @TDLS_LINK_UNSPECIFIED: Unspecified reason
186  * @TDLS_LINK_NOT_SUPPORTED: Remote side doesn't support TDLS
187  * @TDLS_LINK_UNSUPPORTED_BAND: Remote side doesn't support this band
188  * @TDLS_LINK_NOT_BENEFICIAL: Going to AP is better than direct
189  * @TDLS_LINK_DROPPED_BY_REMOTE: Remote side doesn't want it anymore
190  */
191 enum tdls_link_state_reason {
192 	TDLS_LINK_SUCCESS,
193 	TDLS_LINK_UNSPECIFIED         = -1,
194 	TDLS_LINK_NOT_SUPPORTED       = -2,
195 	TDLS_LINK_UNSUPPORTED_BAND    = -3,
196 	TDLS_LINK_NOT_BENEFICIAL      = -4,
197 	TDLS_LINK_DROPPED_BY_REMOTE   = -5,
198 };
199 
200 /**
201  * enum tdls_feature_mode - TDLS support mode
202  * @TDLS_SUPPORT_DISABLED: Disabled in ini or FW
203  * @TDLS_SUPPORT_SUSPENDED: TDLS supported by ini and FW, but disabled
204  *            temporarily due to off-channel operations or due to other reasons
205  * @TDLS_SUPPORT_EXP_TRIG_ONLY: Explicit trigger mode
206  * @TDLS_SUPPORT_IMP_MODE: Implicit mode
207  * @TDLS_SUPPORT_EXT_CONTROL: External control mode
208  */
209 enum tdls_feature_mode {
210 	TDLS_SUPPORT_DISABLED = 0,
211 	TDLS_SUPPORT_SUSPENDED,
212 	TDLS_SUPPORT_EXP_TRIG_ONLY,
213 	TDLS_SUPPORT_IMP_MODE,
214 	TDLS_SUPPORT_EXT_CONTROL,
215 };
216 
217 /**
218  * enum tdls_command_type - TDLS command type
219  * @TDLS_CMD_TX_ACTION: send tdls action frame
220  * @TDLS_CMD_ADD_STA: add tdls peer
221  * @TDLS_CMD_CHANGE_STA: change tdls peer
222  * @TDLS_CMD_ENABLE_LINK: enable tdls link
223  * @TDLS_CMD_DISABLE_LINK: disable tdls link
224  * @TDLS_CMD_CONFIG_FORCE_PEER: config external peer
225  * @TDLS_CMD_REMOVE_FORCE_PEER: remove external peer
226  * @TDLS_CMD_STATS_UPDATE: update tdls stats
227  * @TDLS_CMD_CONFIG_UPDATE: config tdls
228  * @TDLS_CMD_SCAN_DONE: scon done event
229  * @TDLS_CMD_SET_RESPONDER: responder event
230  * @TDLS_NOTIFY_STA_CONNECTION: notify sta connection
231  * @TDLS_NOTIFY_STA_DISCONNECTION: notify sta disconnection
232  * @TDLS_CMD_SET_TDLS_MODE: set the tdls mode
233  * @TDLS_CMD_SESSION_INCREMENT: notify session increment
234  * @TDLS_CMD_SESSION_DECREMENT: notify session decrement
235  * @TDLS_CMD_TEARDOWN_LINKS: notify teardown
236  * @TDLS_NOTIFY_RESET_ADAPTERS: notify adapter reset
237  * @TDLS_CMD_GET_ALL_PEERS: get all the tdls peers from the list
238  * @TDLS_CMD_ANTENNA_SWITCH: dynamic tdls antenna switch
239  * @TDLS_CMD_SET_OFFCHANNEL: tdls offchannel
240  * @TDLS_CMD_SET_OFFCHANMODE: tdls offchannel mode
241  * @TDLS_CMD_SET_SECOFFCHANOFFSET: tdls secondary offchannel offset
242  * @TDLS_DELETE_ALL_PEERS_INDICATION: tdls delete all peers indication
243  * @TDLS_CMD_START_BSS: SAP start indication to tdls module
244  * @TDLS_CMD_SET_LINK_UNFORCE: tdls to unforce link for MLO case
245  */
246 enum tdls_command_type {
247 	TDLS_CMD_TX_ACTION = 1,
248 	TDLS_CMD_ADD_STA,
249 	TDLS_CMD_CHANGE_STA,
250 	TDLS_CMD_ENABLE_LINK,
251 	TDLS_CMD_DISABLE_LINK,
252 	TDLS_CMD_CONFIG_FORCE_PEER,
253 	TDLS_CMD_REMOVE_FORCE_PEER,
254 	TDLS_CMD_STATS_UPDATE,
255 	TDLS_CMD_CONFIG_UPDATE,
256 	TDLS_CMD_SCAN_DONE,
257 	TDLS_CMD_SET_RESPONDER,
258 	TDLS_NOTIFY_STA_CONNECTION,
259 	TDLS_NOTIFY_STA_DISCONNECTION,
260 	TDLS_CMD_SET_TDLS_MODE,
261 	TDLS_CMD_SESSION_INCREMENT,
262 	TDLS_CMD_SESSION_DECREMENT,
263 	TDLS_CMD_TEARDOWN_LINKS,
264 	TDLS_NOTIFY_RESET_ADAPTERS,
265 	TDLS_CMD_GET_ALL_PEERS,
266 	TDLS_CMD_ANTENNA_SWITCH,
267 	TDLS_CMD_SET_OFFCHANNEL,
268 	TDLS_CMD_SET_OFFCHANMODE,
269 	TDLS_CMD_SET_SECOFFCHANOFFSET,
270 	TDLS_DELETE_ALL_PEERS_INDICATION,
271 	TDLS_CMD_START_BSS,
272 	TDLS_CMD_SET_LINK_UNFORCE
273 };
274 
275 /**
276  * enum tdls_event_type - TDLS event type
277  * @TDLS_EVENT_VDEV_STATE_CHANGE: umac connect/disconnect event
278  * @TDLS_EVENT_MGMT_TX_ACK_CNF: tx tdls frame ack event
279  * @TDLS_EVENT_RX_MGMT: rx discovery response frame
280  * @TDLS_EVENT_ADD_PEER: add peer or update peer
281  * @TDLS_EVENT_DEL_PEER: delete peer
282  * @TDLS_EVENT_DISCOVERY_REQ: discovery request
283  * @TDLS_EVENT_TEARDOWN_REQ: teardown request
284  * @TDLS_EVENT_SETUP_REQ: setup request
285  * @TDLS_EVENT_TEARDOWN_LINKS_DONE: teardown completion event
286  * @TDLS_EVENT_USER_CMD: tdls user command
287  * @TDLS_EVENT_ANTENNA_SWITCH: antenna switch event
288  */
289 enum tdls_event_type {
290 	TDLS_EVENT_VDEV_STATE_CHANGE = 0,
291 	TDLS_EVENT_MGMT_TX_ACK_CNF,
292 	TDLS_EVENT_RX_MGMT,
293 	TDLS_EVENT_ADD_PEER,
294 	TDLS_EVENT_DEL_PEER,
295 	TDLS_EVENT_DISCOVERY_REQ,
296 	TDLS_EVENT_TEARDOWN_REQ,
297 	TDLS_EVENT_SETUP_REQ,
298 	TDLS_EVENT_TEARDOWN_LINKS_DONE,
299 	TDLS_EVENT_USER_CMD,
300 	TDLS_EVENT_ANTENNA_SWITCH,
301 };
302 
303 /**
304  * enum tdls_state_t - tdls state
305  * @QCA_WIFI_HAL_TDLS_S_DISABLED: TDLS is not enabled, or is disabled now
306  * @QCA_WIFI_HAL_TDLS_S_ENABLED: TDLS is enabled, but not yet tried
307  * @QCA_WIFI_HAL_TDLS_S_ESTABLISHED: Direct link is established
308  * @QCA_WIFI_HAL_TDLS_S_ESTABLISHED_OFF_CHANNEL: Direct link established using
309  *                                               MCC
310  * @QCA_WIFI_HAL_TDLS_S_DROPPED: Direct link was established, but is now dropped
311  * @QCA_WIFI_HAL_TDLS_S_FAILED: Direct link failed
312  */
313 enum tdls_state_t {
314 	QCA_WIFI_HAL_TDLS_S_DISABLED = 1,
315 	QCA_WIFI_HAL_TDLS_S_ENABLED,
316 	QCA_WIFI_HAL_TDLS_S_ESTABLISHED,
317 	QCA_WIFI_HAL_TDLS_S_ESTABLISHED_OFF_CHANNEL,
318 	QCA_WIFI_HAL_TDLS_S_DROPPED,
319 	QCA_WIFI_HAL_TDLS_S_FAILED,
320 };
321 
322 /**
323  * enum tdls_off_chan_mode - mode for WMI_TDLS_SET_OFFCHAN_MODE_CMDID
324  * @TDLS_ENABLE_OFFCHANNEL: enable off channel
325  * @TDLS_DISABLE_OFFCHANNEL: disable off channel
326  */
327 enum tdls_off_chan_mode {
328 	TDLS_ENABLE_OFFCHANNEL,
329 	TDLS_DISABLE_OFFCHANNEL
330 };
331 
332 /**
333  * enum tdls_event_msg_type - TDLS event message type
334  * @TDLS_SHOULD_DISCOVER: should do discover for peer (based on tx bytes per
335  * second > tx_discover threshold)
336  * @TDLS_SHOULD_TEARDOWN: recommend teardown the link for peer due to tx bytes
337  * per second below tx_teardown_threshold
338  * @TDLS_PEER_DISCONNECTED: tdls peer disconnected
339  * @TDLS_CONNECTION_TRACKER_NOTIFY: TDLS/BT role change notification for
340  * connection tracker
341  */
342 enum tdls_event_msg_type {
343 	TDLS_SHOULD_DISCOVER = 0,
344 	TDLS_SHOULD_TEARDOWN,
345 	TDLS_PEER_DISCONNECTED,
346 	TDLS_CONNECTION_TRACKER_NOTIFY
347 };
348 
349 /**
350  * enum tdls_event_reason - TDLS event reason
351  * @TDLS_TEARDOWN_TX: tdls teardown recommended due to low transmits
352  * @TDLS_TEARDOWN_RSSI: tdls link tear down recommended due to poor RSSI
353  * @TDLS_TEARDOWN_SCAN: tdls link tear down recommended due to offchannel scan
354  * @TDLS_TEARDOWN_PTR_TIMEOUT: tdls peer disconnected due to PTR timeout
355  * @TDLS_TEARDOWN_BAD_PTR: tdls peer disconnected due wrong PTR format
356  * @TDLS_TEARDOWN_NO_RSP: tdls peer not responding
357  * @TDLS_DISCONNECTED_PEER_DELETE: tdls peer disconnected due to peer deletion
358  * @TDLS_PEER_ENTER_BUF_STA: tdls entered buffer STA role, TDLS connection
359  * tracker needs to handle this
360  * @TDLS_PEER_EXIT_BUF_STA: tdls exited buffer STA role, TDLS connection tracker
361  * needs to handle this
362  * @TDLS_ENTER_BT_BUSY: BT entered busy mode, TDLS connection tracker needs to
363  * handle this
364  * @TDLS_EXIT_BT_BUSY: BT exited busy mode, TDLS connection tracker needs to
365  * handle this
366  * @TDLS_SCAN_STARTED: TDLS module received a scan start event, TDLS connection
367  * tracker needs to handle this
368  * @TDLS_SCAN_COMPLETED: TDLS module received a scan complete event, TDLS
369  * connection tracker needs to handle this
370  */
371 enum tdls_event_reason {
372 	TDLS_TEARDOWN_TX,
373 	TDLS_TEARDOWN_RSSI,
374 	TDLS_TEARDOWN_SCAN,
375 	TDLS_TEARDOWN_PTR_TIMEOUT,
376 	TDLS_TEARDOWN_BAD_PTR,
377 	TDLS_TEARDOWN_NO_RSP,
378 	TDLS_DISCONNECTED_PEER_DELETE,
379 	TDLS_PEER_ENTER_BUF_STA,
380 	TDLS_PEER_EXIT_BUF_STA,
381 	TDLS_ENTER_BT_BUSY,
382 	TDLS_EXIT_BT_BUSY,
383 	TDLS_SCAN_STARTED,
384 	TDLS_SCAN_COMPLETED,
385 };
386 
387 /**
388  * enum tdls_disable_sources - TDLS disable sources
389  * @TDLS_SET_MODE_SOURCE_USER: disable from user
390  * @TDLS_SET_MODE_SOURCE_SCAN: disable during scan
391  * @TDLS_SET_MODE_SOURCE_OFFCHANNEL: disable during offchannel
392  * @TDLS_SET_MODE_SOURCE_BTC: disable during bluetooth
393  * @TDLS_SET_MODE_SOURCE_P2P: disable during p2p
394  */
395 enum tdls_disable_sources {
396 	TDLS_SET_MODE_SOURCE_USER = 0,
397 	TDLS_SET_MODE_SOURCE_SCAN,
398 	TDLS_SET_MODE_SOURCE_OFFCHANNEL,
399 	TDLS_SET_MODE_SOURCE_BTC,
400 	TDLS_SET_MODE_SOURCE_P2P,
401 };
402 
403 /**
404  * struct tdls_osif_indication - tdls indication to os if layer
405  * @vdev: vdev object
406  * @reason: used with teardown indication
407  * @peer_mac: MAC address of the TDLS peer
408  * @status: operation status
409  */
410 struct tdls_osif_indication {
411 	struct wlan_objmgr_vdev *vdev;
412 	uint16_t reason;
413 	uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
414 	QDF_STATUS status;
415 };
416 
417 /**
418  * struct tx_frame - tx frame
419  * @buf: frame buffer
420  * @buf_len: buffer length
421  * @tx_timer: tx send timer
422  */
423 struct tx_frame {
424 	uint8_t *buf;
425 	size_t buf_len;
426 	qdf_timer_t tx_timer;
427 };
428 
429 enum tdls_configured_external_control {
430 	TDLS_STRICT_EXTERNAL_CONTROL = 1,
431 	TDLS_LIBERAL_EXTERNAL_CONTROL = 2,
432 };
433 
434 /**
435  * enum tdls_feature_bit
436  * @TDLS_FEATURE_OFF_CHANNEL: tdls off channel
437  * @TDLS_FEATURE_WMM: tdls wmm
438  * @TDLS_FEATURE_BUFFER_STA: tdls buffer sta
439  * @TDLS_FEATURE_SLEEP_STA: tdls sleep sta feature
440  * @TDLS_FEATURE_SCAN: tdls scan
441  * @TDLS_FEATURE_ENABLE: tdls enabled
442  * @TDLS_FEAUTRE_IMPLICIT_TRIGGER: tdls implicit trigger
443  * @TDLS_FEATURE_EXTERNAL_CONTROL: enforce strict tdls external control
444  * @TDLS_FEATURE_LIBERAL_EXTERNAL_CONTROL: liberal external tdls control
445  */
446 enum tdls_feature_bit {
447 	TDLS_FEATURE_OFF_CHANNEL,
448 	TDLS_FEATURE_WMM,
449 	TDLS_FEATURE_BUFFER_STA,
450 	TDLS_FEATURE_SLEEP_STA,
451 	TDLS_FEATURE_SCAN,
452 	TDLS_FEATURE_ENABLE,
453 	TDLS_FEAUTRE_IMPLICIT_TRIGGER,
454 	TDLS_FEATURE_EXTERNAL_CONTROL,
455 	TDLS_FEATURE_LIBERAL_EXTERNAL_CONTROL,
456 };
457 
458 #define TDLS_IS_OFF_CHANNEL_ENABLED(flags) \
459 	CHECK_BIT(flags, TDLS_FEATURE_OFF_CHANNEL)
460 #define TDLS_IS_WMM_ENABLED(flags) \
461 	CHECK_BIT(flags, TDLS_FEATURE_WMM)
462 #define TDLS_IS_BUFFER_STA_ENABLED(flags) \
463 	CHECK_BIT(flags, TDLS_FEATURE_BUFFER_STA)
464 #define TDLS_IS_SLEEP_STA_ENABLED(flags) \
465 	CHECK_BIT(flags, TDLS_FEATURE_SLEEP_STA)
466 #define TDLS_IS_SCAN_ENABLED(flags) \
467 	CHECK_BIT(flags, TDLS_FEATURE_SCAN)
468 #define TDLS_IS_ENABLED(flags) \
469 	CHECK_BIT(flags, TDLS_FEATURE_ENABLE)
470 #define TDLS_IS_IMPLICIT_TRIG_ENABLED(flags) \
471 	CHECK_BIT(flags, TDLS_FEAUTRE_IMPLICIT_TRIGGER)
472 #define TDLS_IS_EXTERNAL_CONTROL_ENABLED(flags) \
473 	CHECK_BIT(flags, TDLS_FEATURE_EXTERNAL_CONTROL)
474 #define TDLS_IS_LIBERAL_EXTERNAL_CONTROL_ENABLED(flags) \
475 	CHECK_BIT(flags, TDLS_FEATURE_LIBERAL_EXTERNAL_CONTROL)
476 
477 /**
478  * struct tdls_user_config - TDLS user configuration
479  * @tdls_tx_states_period: tdls tx states period
480  * @tdls_tx_pkt_threshold: tdls tx packets threshold
481  * @tdls_rx_pkt_threshold: tdls rx packets threshold
482  * @tdls_max_discovery_attempt: tdls discovery max times
483  * @tdls_idle_timeout: tdls idle timeout
484  * @tdls_idle_pkt_threshold: tdls idle packets threshold
485  * @tdls_rssi_trigger_threshold: tdls rssi trigger threshold
486  * @tdls_rssi_teardown_threshold: tdls rssi tear down threshold
487  * @tdls_rssi_delta: tdls rssi delta
488  * @tdls_uapsd_mask: tdls uapsd mask
489  * @tdls_uapsd_inactivity_time: tdls uapsd inactivity time
490  * @tdls_uapsd_pti_window: tdls peer traffic indication window
491  * @tdls_uapsd_ptr_timeout: tdls peer response timeout
492  * @tdls_feature_flags: tdls feature flags
493  * @tdls_pre_off_chan_num: tdls off channel number
494  * @tdls_pre_off_chan_freq_6g: tdls pref off channel freq for 6g band
495  * @tdls_pre_off_chan_bw: tdls off channel bandwidth
496  * @tdls_peer_kickout_threshold: sta kickout threshold for tdls peer
497  * @tdls_discovery_wake_timeout: tdls discovery wake timeout
498  * @delayed_trig_framint: delayed trigger frame interval
499  * @tdls_vdev_nss_2g: tdls NSS setting for 2G band
500  * @tdls_vdev_nss_5g: tdls NSS setting for 5G band
501  * @tdls_buffer_sta_enable: tdls buffer station enable
502  * @tdls_off_chan_enable: tdls off channel enable
503  * @tdls_off_chan_enable_orig: original tdls off channel enable
504  * @tdls_wmm_mode_enable: tdls wmm mode enable
505  * @tdls_external_control: tdls external control enable
506  * @tdls_implicit_trigger_enable: tdls implicit trigger enable
507  * @tdls_scan_enable: tdls scan enable
508  * @tdls_sleep_sta_enable: tdls sleep sta enable
509  * @tdls_support_enable: tdls support enable
510  * @tdls_link_id: mlo link id
511  */
512 struct tdls_user_config {
513 	uint32_t tdls_tx_states_period;
514 	uint32_t tdls_tx_pkt_threshold;
515 	uint32_t tdls_rx_pkt_threshold;
516 	uint32_t tdls_max_discovery_attempt;
517 	uint32_t tdls_idle_timeout;
518 	uint32_t tdls_idle_pkt_threshold;
519 	int32_t tdls_rssi_trigger_threshold;
520 	int32_t tdls_rssi_teardown_threshold;
521 	uint32_t tdls_rssi_delta;
522 	uint32_t tdls_uapsd_mask;
523 	uint32_t tdls_uapsd_inactivity_time;
524 	uint32_t tdls_uapsd_pti_window;
525 	uint32_t tdls_uapsd_ptr_timeout;
526 	uint32_t tdls_feature_flags;
527 	uint32_t tdls_pre_off_chan_num;
528 	uint32_t tdls_pre_off_chan_freq_6g;
529 	uint32_t tdls_pre_off_chan_bw;
530 	uint32_t tdls_peer_kickout_threshold;
531 	uint32_t tdls_discovery_wake_timeout;
532 	uint32_t delayed_trig_framint;
533 	uint8_t tdls_vdev_nss_2g;
534 	uint8_t tdls_vdev_nss_5g;
535 	bool tdls_buffer_sta_enable;
536 	bool tdls_off_chan_enable;
537 	bool tdls_off_chan_enable_orig;
538 	bool tdls_wmm_mode_enable;
539 	uint8_t tdls_external_control;
540 	bool tdls_implicit_trigger_enable;
541 	bool tdls_scan_enable;
542 	bool tdls_sleep_sta_enable;
543 	bool tdls_support_enable;
544 	int tdls_link_id;
545 };
546 
547 /**
548  * struct tdls_config_params - tdls configure paramets
549  * @tdls: tdls support mode
550  * @tx_period_t: tdls tx stats period
551  * @tx_packet_n: tdls tx packets number threshold
552  * @discovery_tries_n: tdls max discovery attempt count
553  * @idle_timeout_t: tdls idle time timeout
554  * @idle_packet_n: tdls idle pkt threshold
555  * @rssi_trigger_threshold: tdls rssi trigger threshold, checked before setup
556  * @rssi_teardown_threshold: tdls rssi teardown threshold
557  * @rssi_delta: rssi delta
558  */
559 struct tdls_config_params {
560 	uint32_t tdls;
561 	uint32_t tx_period_t;
562 	uint32_t tx_packet_n;
563 	uint32_t discovery_tries_n;
564 	uint32_t idle_timeout_t;
565 	uint32_t idle_packet_n;
566 	int32_t rssi_trigger_threshold;
567 	int32_t rssi_teardown_threshold;
568 	int32_t rssi_delta;
569 };
570 
571 /**
572  * struct tdls_tx_cnf: tdls tx ack
573  * @vdev_id: vdev id
574  * @action_cookie: frame cookie
575  * @buf: frame buf
576  * @buf_len: buffer length
577  * @status: tx send status
578  */
579 struct tdls_tx_cnf {
580 	int vdev_id;
581 	uint64_t action_cookie;
582 	void *buf;
583 	size_t buf_len;
584 	int status;
585 };
586 
587 /**
588  * struct tdls_rx_mgmt_frame - rx mgmt frame structure
589  * @frame_len: frame length
590  * @rx_freq: rx freq
591  * @vdev_id: vdev id
592  * @frm_type: frame type
593  * @rx_rssi: rx rssi
594  * @buf: buffer address
595  */
596 struct tdls_rx_mgmt_frame {
597 	uint32_t frame_len;
598 	uint32_t rx_freq;
599 	uint32_t vdev_id;
600 	uint32_t frm_type;
601 	uint32_t rx_rssi;
602 	QDF_FLEX_ARRAY(uint8_t, buf);
603 };
604 
605 /**
606  * typedef tdls_rx_callback() - Callback for rx mgmt frame
607  * @user_data: user data associated to this rx mgmt frame.
608  * @rx_frame: RX mgmt frame
609  *
610  * This callback will be used to give rx frames to hdd.
611  *
612  * Return: None
613  */
614 typedef void (*tdls_rx_callback)(void *user_data,
615 	struct tdls_rx_mgmt_frame *rx_frame);
616 
617 /**
618  * typedef tdls_wmm_check() - Callback for wmm info
619  * @vdev_id: ID of the vdev to check
620  *
621  * This callback will be used to check wmm information
622  *
623  * Return: true or false
624  */
625 typedef bool (*tdls_wmm_check)(uint8_t vdev_id);
626 
627 
628 /* This callback is used to report state change of peer to wpa_supplicant */
629 typedef int (*tdls_state_change_callback)(const uint8_t *mac,
630 					  uint32_t opclass,
631 					  uint32_t channel,
632 					  uint32_t state,
633 					  int32_t reason, void *ctx);
634 
635 /* This callback is used to report events to os_if layer */
636 typedef void (*tdls_evt_callback) (void *data,
637 				   enum tdls_event_type ev_type,
638 				   struct tdls_osif_indication *event);
639 
640 /* This callback is used to register TDLS peer with the datapath */
641 typedef QDF_STATUS (*tdls_register_peer_callback)(void *userdata,
642 						  uint32_t vdev_id,
643 						  const uint8_t *mac,
644 						  uint8_t qos);
645 
646 /* This callback is used to deregister TDLS peer from the datapath */
647 typedef QDF_STATUS
648 (*tdls_deregister_peer_callback)(void *userdata,
649 				 uint32_t vdev_id,
650 				 struct qdf_mac_addr *peer_mac);
651 
652 /* This callback is used to update datapath vdev flags */
653 typedef QDF_STATUS
654 (*tdls_dp_vdev_update_flags_callback)(void *cbk_data,
655 				      uint8_t vdev_id,
656 				      uint32_t vdev_param,
657 				      bool is_link_up);
658 
659 /* This callback is to release vdev ref for tdls offchan param related msg */
660 typedef void (*tdls_offchan_parms_callback)(struct wlan_objmgr_vdev *vdev);
661 
662 /**
663  * typedef tdls_vdev_init_cb() - Callback for initializing the tdls private
664  *                               structure
665  * @vdev: vdev object
666  *
667  * This callback will be used to create the vdev private object and store
668  * in os_priv.
669  *
670  * Return: QDF_STATUS
671  */
672 typedef QDF_STATUS (*tdls_vdev_init_cb)(struct wlan_objmgr_vdev *vdev);
673 
674 /**
675  * typedef tdls_vdev_deinit_cb() - Callback for deinitializing the tdls
676  *                                 private structure
677  * @vdev: vdev object
678  *
679  * This callback will be used to destroy the vdev private object.
680  *
681  * Return: None
682  */
683 typedef void (*tdls_vdev_deinit_cb)(struct wlan_objmgr_vdev *vdev);
684 
685 /**
686  * struct tdls_osif_cb - Callbacks for updating osif params.
687  * @tdls_osif_conn_update: Update osif params when TDLS peer is connected
688  * @tdls_osif_disconn_update: Update osif params when TDLS peer is disconnected
689  *
690  * These callbacks will be used for updating osif params.
691  */
692 struct tdls_osif_cb {
693 	void (*tdls_osif_conn_update)(struct wlan_objmgr_vdev *vdev);
694 	void (*tdls_osif_disconn_update)(struct wlan_objmgr_vdev *vdev);
695 };
696 
697 /**
698  * struct tdls_start_params - tdls start params
699  * @config: tdls user config
700  * @tdls_send_mgmt_req: pass eWNI_SME_TDLS_SEND_MGMT_REQ value
701  * @tdls_add_sta_req: pass eWNI_SME_TDLS_ADD_STA_REQ value
702  * @tdls_del_sta_req: pass eWNI_SME_TDLS_DEL_STA_REQ value
703  * @tdls_update_peer_state: pass WMA_UPDATE_TDLS_PEER_STATE value
704  * @tdls_del_all_peers: pass eWNI_SME_DEL_ALL_TDLS_PEERS
705  * @tdls_update_dp_vdev_flags: pass CDP_UPDATE_TDLS_FLAGS
706  * @tdls_rx_cb: TDLS RX callback
707  * @tdls_rx_cb_data: TDLS RX callback context
708  * @tdls_wmm_cb: TDLS WMM check callback
709  * @tdls_wmm_cb_data: TDLS WMM check callback context
710  * @tdls_event_cb: tdls event callback
711  * @tdls_evt_cb_data: tdls event data
712  * @tdls_peer_context: userdata for register/deregister TDLS peer
713  * @tdls_reg_peer: register tdls peer with datapath
714  * @tdls_dp_vdev_update: update vdev flags in datapath
715  * @tdls_osif_init_cb: callback to initialize the tdls priv
716  * @tdls_osif_deinit_cb: callback to deinitialize the tdls priv
717  * @tdls_osif_update_cb: callback to update osif params
718  */
719 struct tdls_start_params {
720 	struct tdls_user_config config;
721 	uint16_t tdls_send_mgmt_req;
722 	uint16_t tdls_add_sta_req;
723 	uint16_t tdls_del_sta_req;
724 	uint16_t tdls_update_peer_state;
725 	uint16_t tdls_del_all_peers;
726 	uint32_t tdls_update_dp_vdev_flags;
727 	tdls_rx_callback tdls_rx_cb;
728 	void *tdls_rx_cb_data;
729 	tdls_wmm_check tdls_wmm_cb;
730 	void *tdls_wmm_cb_data;
731 	tdls_evt_callback tdls_event_cb;
732 	void *tdls_evt_cb_data;
733 	void *tdls_peer_context;
734 	tdls_register_peer_callback tdls_reg_peer;
735 	tdls_dp_vdev_update_flags_callback tdls_dp_vdev_update;
736 	tdls_vdev_init_cb tdls_osif_init_cb;
737 	tdls_vdev_deinit_cb tdls_osif_deinit_cb;
738 	struct tdls_osif_cb tdls_osif_update_cb;
739 };
740 
741 /**
742  * struct tdls_add_peer_params - add peer request parameter
743  * @peer_addr: peer mac addr
744  * @peer_type: peer type
745  * @vdev_id: vdev id
746  */
747 struct tdls_add_peer_params {
748 	uint8_t peer_addr[QDF_MAC_ADDR_SIZE];
749 	uint32_t peer_type;
750 	uint32_t vdev_id;
751 };
752 
753 /**
754  * struct tdls_add_peer_request - peer add request
755  * @vdev: vdev
756  * @add_peer_req: add peer request parameters
757  */
758 struct tdls_add_peer_request {
759 	struct wlan_objmgr_vdev *vdev;
760 	struct tdls_add_peer_params add_peer_req;
761 };
762 
763 /**
764  * struct tdls_del_peer_params - delete peer request parameter
765  * @peer_addr: peer mac addr
766  * @peer_type: peer type
767  * @vdev_id: vdev id
768  */
769 struct tdls_del_peer_params {
770 	const uint8_t *peer_addr;
771 	uint32_t peer_type;
772 	uint32_t vdev_id;
773 };
774 
775 /**
776  * struct tdls_del_peer_request - peer delete request
777  * @vdev: vdev
778  * @del_peer_req: delete peer request parameters
779  */
780 struct tdls_del_peer_request {
781 	struct wlan_objmgr_vdev *vdev;
782 	struct tdls_del_peer_params del_peer_req;
783 };
784 
785 /**
786  * struct vhtmcsinfo - VHT MCS information
787  * @rx_mcs_map: RX MCS map 2 bits for each stream, total 8 streams
788  * @rx_highest: Indicates highest long GI VHT PPDU data rate
789  *      STA can receive. Rate expressed in units of 1 Mbps.
790  *      If this field is 0 this value should not be used to
791  *      consider the highest RX data rate supported.
792  * @tx_mcs_map: TX MCS map 2 bits for each stream, total 8 streams
793  * @tx_highest: Indicates highest long GI VHT PPDU data rate
794  *      STA can transmit. Rate expressed in units of 1 Mbps.
795  *      If this field is 0 this value should not be used to
796  *      consider the highest TX data rate supported.
797  */
798 struct vhtmcsinfo {
799 	uint16_t rx_mcs_map;
800 	uint16_t rx_highest;
801 	uint16_t tx_mcs_map;
802 	uint16_t tx_highest;
803 };
804 
805 /**
806  * struct vhtcap - VHT capabilities
807  *
808  * This structure is the "VHT capabilities element" as
809  * described in 802.11ac D3.0 8.4.2.160
810  * @vht_capinfo: VHT capability info
811  * @supp_mcs: VHT MCS supported rates
812  */
813 struct vhtcap {
814 	uint32_t vht_capinfo;
815 	struct vhtmcsinfo supp_mcs;
816 };
817 
818 #ifdef WLAN_FEATURE_11AX
819 /**
820  * struct hecap - HE capabilities
821  *
822  * This structure is the "HE capabilities element" as
823  * described in 802.11ax D4.0 section 9.4.2.232.3
824  * @mac_cap_info: MAC capability info
825  * @phycap_info: Phy Capability info
826  * @he_cap_mcs_info: HE capabilities MCS information
827  */
828 struct hecap {
829 	uint8_t mac_cap_info[6];
830 	uint8_t phycap_info[11];
831 	struct {
832 		uint16_t rx_he_mcs_map_lt_80;
833 		uint16_t tx_he_mcs_map_lt_80;
834 		uint16_t rx_he_mcs_map_160;
835 		uint16_t tx_he_mcs_map_160;
836 		uint16_t rx_he_mcs_map_80_80;
837 		uint16_t tx_he_mcs_map_80_80;
838 	} he_cap_mcs_info;
839 } qdf_packed;
840 
841 struct hecap_6ghz {
842 	/* Minimum MPDU Start Spacing B0..B2
843 	 * Maximum A-MPDU Length Exponent B3..B5
844 	 * Maximum MPDU Length B6..B7 */
845 	uint8_t a_mpdu_params; /* B0..B7 */
846 	uint8_t info; /* B8..B15 */
847 };
848 #endif
849 
850 #ifdef WLAN_FEATURE_11BE
851 /**
852  * struct ehtcapfixed - EHT capabilities fixed data
853  * @mac_cap_info: MAC capabilities
854  * @phy_cap_info: PHY capabilities
855  */
856 struct ehtcapfixed {
857 	uint8_t mac_cap_info[2];
858 	uint8_t phy_cap_info[9];
859 };
860 
861 /**
862  * struct ehtcap - EHT capabilities
863  * @eht_cap_fixed: fixed parts, see &ehtcapfixed
864  * @optional: optional parts
865  */
866 struct ehtcap {
867 	struct ehtcapfixed eht_cap_fixed;
868 	uint8_t optional[];
869 } qdf_packed;
870 #endif
871 
872 struct tdls_update_peer_params {
873 	uint8_t peer_addr[QDF_MAC_ADDR_SIZE];
874 	uint32_t peer_type;
875 	uint32_t vdev_id;
876 	uint16_t capability;
877 	uint8_t extn_capability[WLAN_MAC_MAX_EXTN_CAP];
878 	uint8_t supported_rates_len;
879 	uint8_t supported_rates[WLAN_MAC_MAX_SUPP_RATES];
880 	uint8_t htcap_present;
881 	struct htcap_cmn_ie ht_cap;
882 	uint8_t vhtcap_present;
883 	struct vhtcap vht_cap;
884 #ifdef WLAN_FEATURE_11AX
885 	uint8_t he_cap_len;
886 	struct hecap he_cap;
887 	struct hecap_6ghz he_6ghz_cap;
888 #endif
889 #ifdef WLAN_FEATURE_11BE
890 	uint8_t ehtcap_present;
891 	uint8_t eht_cap_len;
892 	struct ehtcap eht_cap;
893 #endif
894 	uint8_t uapsd_queues;
895 	uint8_t max_sp;
896 	uint8_t supported_channels_len;
897 	qdf_freq_t supported_chan_freq[WLAN_MAC_MAX_SUPP_CHANNELS];
898 	uint8_t supported_oper_classes_len;
899 	uint8_t supported_oper_classes[WLAN_MAX_SUPP_OPER_CLASSES];
900 	bool is_qos_wmm_sta;
901 	bool is_pmf;
902 };
903 
904 struct tdls_update_peer_request {
905 	struct wlan_objmgr_vdev *vdev;
906 	struct tdls_update_peer_params update_peer_req;
907 };
908 
909 /**
910  * struct tdls_oper_request - tdls operation request
911  * @vdev: vdev object
912  * @peer_addr: MAC address of the TDLS peer
913  */
914 struct tdls_oper_request {
915 	struct wlan_objmgr_vdev *vdev;
916 	uint8_t peer_addr[QDF_MAC_ADDR_SIZE];
917 };
918 
919 /**
920  * struct tdls_oper_config_force_peer_request - tdls enable force peer request
921  * @vdev: vdev object
922  * @peer_addr: MAC address of the TDLS peer
923  * @chan: channel
924  * @ch_freq: ch_freq
925  * @max_latency: maximum latency
926  * @op_class: operation class
927  * @min_bandwidth: minimal bandwidth
928  * @callback: state change callback
929  */
930 struct tdls_oper_config_force_peer_request {
931 	struct wlan_objmgr_vdev *vdev;
932 	uint8_t peer_addr[QDF_MAC_ADDR_SIZE];
933 	uint32_t chan;
934 	qdf_freq_t ch_freq;
935 	uint32_t max_latency;
936 	uint32_t op_class;
937 	uint32_t min_bandwidth;
938 	tdls_state_change_callback callback;
939 };
940 
941 /**
942  * struct tdls_info - tdls info
943  *
944  * @vdev_id: vdev id
945  * @tdls_state: tdls state
946  * @notification_interval_ms: notification interval in ms
947  * @tx_discovery_threshold: tx discovery threshold
948  * @tx_teardown_threshold: tx teardown threshold
949  * @rssi_teardown_threshold: rx teardown threshold
950  * @rssi_delta: rssi delta
951  * @tdls_options: tdls options
952  * @peer_traffic_ind_window: peer traffic indication window
953  * @peer_traffic_response_timeout: peer traffic response timeout
954  * @puapsd_mask: puapsd mask
955  * @puapsd_inactivity_time: puapsd inactivity time
956  * @puapsd_rx_frame_threshold: puapsd rx frame threshold
957  * @teardown_notification_ms: tdls teardown notification interval
958  * @tdls_peer_kickout_threshold: tdls packets threshold
959  *    for peer kickout operation
960  * @tdls_discovery_wake_timeout: tdls discovery wake timeout
961  */
962 struct tdls_info {
963 	uint32_t vdev_id;
964 	uint32_t tdls_state;
965 	uint32_t notification_interval_ms;
966 	uint32_t tx_discovery_threshold;
967 	uint32_t tx_teardown_threshold;
968 	int32_t rssi_teardown_threshold;
969 	int32_t rssi_delta;
970 	uint32_t tdls_options;
971 	uint32_t peer_traffic_ind_window;
972 	uint32_t peer_traffic_response_timeout;
973 	uint32_t puapsd_mask;
974 	uint32_t puapsd_inactivity_time;
975 	uint32_t puapsd_rx_frame_threshold;
976 	uint32_t teardown_notification_ms;
977 	uint32_t tdls_peer_kickout_threshold;
978 	uint32_t tdls_discovery_wake_timeout;
979 };
980 
981 /**
982  * struct tdls_ch_params - channel parameters
983  * @ch_freq: Channel frequency
984  * @pwr: power level
985  * @dfs_set: is dfs supported or not
986  * @half_rate: is the channel operating at 10MHz
987  * @quarter_rate: is the channel operating at 5MHz
988  */
989 struct tdls_ch_params {
990 	qdf_freq_t ch_freq;
991 	uint8_t pwr;
992 	bool dfs_set;
993 	bool half_rate;
994 	bool quarter_rate;
995 };
996 
997 /**
998  * struct tdls_peer_params - TDLS peer capabilities parameters
999  * @is_peer_responder: is peer responder or not
1000  * @peer_uapsd_queue: peer uapsd queue
1001  * @peer_max_sp: peer max SP value
1002  * @peer_buff_sta_support: peer buffer sta supported or not
1003  * @peer_off_chan_support: peer offchannel support
1004  * @peer_curr_operclass: peer current operating class
1005  * @self_curr_operclass: self current operating class
1006  * @peer_chanlen: peer channel length
1007  * @peer_chan: peer channel list
1008  * @peer_oper_classlen: peer operating class length
1009  * @peer_oper_class: peer operating class
1010  * @pref_off_channum: preferred offchannel number
1011  * @pref_off_chan_bandwidth: peer offchannel bandwidth
1012  * @opclass_for_prefoffchan: operating class for offchannel
1013  * @pref_offchan_freq: preferred offchannel frequency
1014  */
1015 struct tdls_peer_params {
1016 	uint8_t is_peer_responder;
1017 	uint8_t peer_uapsd_queue;
1018 	uint8_t peer_max_sp;
1019 	uint8_t peer_buff_sta_support;
1020 	uint8_t peer_off_chan_support;
1021 	uint8_t peer_curr_operclass;
1022 	uint8_t self_curr_operclass;
1023 	uint8_t peer_chanlen;
1024 	struct tdls_ch_params peer_chan[WLAN_MAC_WMI_MAX_SUPP_CHANNELS];
1025 	uint8_t peer_oper_classlen;
1026 	uint8_t peer_oper_class[WLAN_MAX_SUPP_OPER_CLASSES];
1027 	uint8_t pref_off_channum;
1028 	uint8_t pref_off_chan_bandwidth;
1029 	uint8_t opclass_for_prefoffchan;
1030 	uint32_t pref_offchan_freq;
1031 };
1032 
1033 /**
1034  * struct tdls_peer_update_state - TDLS peer state parameters
1035  * @vdev_id: vdev id
1036  * @peer_macaddr: peer mac address
1037  * @peer_state: peer state
1038  * @peer_cap: peer capabality
1039  * @resp_reqd: response needed
1040  */
1041 struct tdls_peer_update_state {
1042 	uint32_t vdev_id;
1043 	uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE];
1044 	uint32_t peer_state;
1045 	struct tdls_peer_params peer_cap;
1046 	bool resp_reqd;
1047 };
1048 
1049 /**
1050  * struct tdls_channel_switch_params - channel switch parameter structure
1051  * @vdev_id: vdev ID
1052  * @peer_mac_addr: Peer mac address
1053  * @tdls_off_ch_bw_offset: Target off-channel bandwidth offset
1054  * @tdls_off_ch: Target Off Channel
1055  * @tdls_sw_mode: Switch mode
1056  * @oper_class: Operating class for target channel
1057  * @is_responder: Responder or initiator
1058  * @tdls_off_chan_freq: Target Off Channel frequency
1059  * @num_off_channels: Number of channels allowed for off channel operation
1060  * @allowed_off_channels: Channel list allowed for off channels
1061  */
1062 struct tdls_channel_switch_params {
1063 	uint32_t    vdev_id;
1064 	uint8_t     peer_mac_addr[QDF_MAC_ADDR_SIZE];
1065 	uint8_t    tdls_off_ch_bw_offset;
1066 	uint8_t     tdls_off_ch;
1067 	uint8_t     tdls_sw_mode;
1068 	uint8_t     oper_class;
1069 	uint8_t     is_responder;
1070 	uint32_t    tdls_off_chan_freq;
1071 	uint16_t    num_off_channels;
1072 	struct tdls_ch_params allowed_off_channels[WLAN_MAC_WMI_MAX_SUPP_CHANNELS];
1073 };
1074 
1075 /**
1076  * enum uapsd_access_cat - U-APSD Access Categories
1077  * @UAPSD_AC_BE: best effort
1078  * @UAPSD_AC_BK: back ground
1079  * @UAPSD_AC_VI: video
1080  * @UAPSD_AC_VO: voice
1081  */
1082 enum uapsd_access_cat {
1083 	UAPSD_AC_BE,
1084 	UAPSD_AC_BK,
1085 	UAPSD_AC_VI,
1086 	UAPSD_AC_VO
1087 };
1088 
1089 /**
1090  * enum tspec_dir_type - TSPEC Direction type
1091  * @TX_DIR: uplink
1092  * @RX_DIR: downlink
1093  * @BI_DIR: bidirectional
1094  */
1095 enum tspec_dir_type {
1096 	TX_DIR = 0,
1097 	RX_DIR = 1,
1098 	BI_DIR = 2,
1099 };
1100 
1101 /**
1102  * struct tdls_event_info - firmware tdls event
1103  * @vdev_id: vdev id
1104  * @peermac: peer mac address
1105  * @message_type: message type
1106  * @peer_reason: reason
1107  */
1108 struct tdls_event_info {
1109 	uint8_t vdev_id;
1110 	struct qdf_mac_addr peermac;
1111 	uint16_t message_type;
1112 	uint32_t peer_reason;
1113 };
1114 
1115 /**
1116  * struct tdls_event_notify - tdls event notify
1117  * @vdev: vdev object
1118  * @event: tdls event
1119  */
1120 struct tdls_event_notify {
1121 	struct wlan_objmgr_vdev *vdev;
1122 	struct tdls_event_info event;
1123 };
1124 
1125 /**
1126  * struct tdls_send_mgmt - tdls send management frame
1127  * @peer_mac: peer's mac address
1128  * @frame_type: Type of TDLS mgmt frame to be sent
1129  * @dialog: dialog token used in the frame.
1130  * @status_code: status to be included in the frame
1131  * @responder: Tdls request type
1132  * @peer_capability: peer cpabilities
1133  * @len: length of additional Ies
1134  * @buf: additional IEs to be included
1135  */
1136 struct tdls_send_mgmt {
1137 	struct qdf_mac_addr peer_mac;
1138 	uint8_t frame_type;
1139 	uint8_t dialog;
1140 	uint16_t status_code;
1141 	uint8_t responder;
1142 	uint32_t peer_capability;
1143 	uint8_t len;
1144 	/* Variable length, do not add anything after this */
1145 	uint8_t buf[];
1146 };
1147 
1148 /**
1149  * struct tdls_validate_action_req - tdls validate mgmt request
1150  * @action_code: action code
1151  * @peer_mac: peer mac address
1152  * @dialog_token: dialog code
1153  * @status_code: status code to add
1154  * @len: len of the frame
1155  * @responder: whether to respond or not
1156  */
1157 struct tdls_validate_action_req {
1158 	uint8_t action_code;
1159 	uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
1160 	uint8_t dialog_token;
1161 	uint8_t status_code;
1162 	size_t len;
1163 	int responder;
1164 };
1165 
1166 /**
1167  * struct tdls_get_all_peers - get all peers from the list
1168  * @vdev: vdev object
1169  * @buf: output string buffer to hold the peer info
1170  * @buf_len: the size of output string buffer
1171  */
1172 struct tdls_get_all_peers {
1173 	struct wlan_objmgr_vdev *vdev;
1174 	char *buf;
1175 	int buf_len;
1176 };
1177 
1178 /**
1179  * struct tdls_action_frame_request - tdls send mgmt request
1180  * @vdev: vdev object
1181  * @chk_frame: This struct used to validate mgmt frame
1182  * @session_id: session id
1183  * @link_id: link id
1184  * @vdev_id: vdev id
1185  * @cmd_buf: cmd buffer
1186  * @len: length of the frame
1187  * @use_default_ac: access category
1188  * @link_active: whether link active command send successfully
1189  * @tdls_mgmt: tdls management
1190  */
1191 struct tdls_action_frame_request {
1192 	struct wlan_objmgr_vdev *vdev;
1193 	struct tdls_validate_action_req chk_frame;
1194 	uint8_t session_id;
1195 	uint8_t link_id;
1196 	uint8_t vdev_id;
1197 	const uint8_t *cmd_buf;
1198 	uint8_t len;
1199 	bool use_default_ac;
1200 	bool link_active;
1201 	/* Variable length, do not add anything after this */
1202 	struct tdls_send_mgmt tdls_mgmt;
1203 };
1204 
1205 /**
1206  * struct tdls_set_responder_req - tdls set responder in peer
1207  * @vdev: vdev object
1208  * @peer_mac: peer mac address
1209  * @responder: whether to respond or not
1210  */
1211 struct tdls_set_responder_req {
1212 	struct wlan_objmgr_vdev *vdev;
1213 	uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
1214 	uint8_t responder;
1215 };
1216 
1217 /**
1218  * struct tdls_sta_notify_params - STA connection notify info
1219  * @vdev: vdev object
1220  * @tdls_prohibited: peer mac addr
1221  * @tdls_chan_swit_prohibited: peer type
1222  * @lfr_roam: is trigger due to lfr
1223  * @user_disconnect: should userspace be notified of disconnect
1224  * @session_id: session id
1225  */
1226 struct tdls_sta_notify_params {
1227 	struct wlan_objmgr_vdev *vdev;
1228 	bool tdls_prohibited;
1229 	bool tdls_chan_swit_prohibited;
1230 	bool lfr_roam;
1231 	bool user_disconnect;
1232 	uint8_t session_id;
1233 };
1234 
1235 /**
1236  * struct tdls_delete_all_peers_params - TDLS set mode params
1237  * @vdev: vdev object
1238  */
1239 struct tdls_delete_all_peers_params {
1240 	struct wlan_objmgr_vdev *vdev;
1241 };
1242 
1243 /**
1244  * struct tdls_set_mode_params - TDLS set mode params
1245  * @vdev: vdev object
1246  * @tdls_mode: tdls mode to set
1247  * @update_last: inform to update last tdls mode
1248  * @source: mode change requester
1249  */
1250 struct tdls_set_mode_params {
1251 	struct wlan_objmgr_vdev *vdev;
1252 	enum tdls_feature_mode tdls_mode;
1253 	bool update_last;
1254 	enum tdls_disable_sources source;
1255 };
1256 
1257 /**
1258  * struct tdls_del_all_tdls_peers - delete all tdls peers
1259  * @msg_type: type of message
1260  * @msg_len: length of message
1261  * @bssid: bssid of peer device
1262  */
1263 struct tdls_del_all_tdls_peers {
1264 	uint16_t msg_type;
1265 	uint16_t msg_len;
1266 	struct qdf_mac_addr bssid;
1267 };
1268 
1269 /**
1270  * struct tdls_antenna_switch_request - TDLS antenna switch request
1271  * @vdev: vdev object
1272  * @mode: antenna mode, 1x1 or 2x2
1273  */
1274 struct tdls_antenna_switch_request {
1275 	struct wlan_objmgr_vdev *vdev;
1276 	uint32_t mode;
1277 };
1278 
1279 /**
1280  * struct tdls_set_offchannel - TDLS set offchannel
1281  * @vdev: vdev object
1282  * @offchannel: Updated tdls offchannel value.
1283  * @callback: callback to release vdev ref.
1284  */
1285 struct tdls_set_offchannel {
1286 	struct wlan_objmgr_vdev *vdev;
1287 	uint16_t offchannel;
1288 	tdls_offchan_parms_callback callback;
1289 };
1290 
1291 /**
1292  * struct tdls_set_offchanmode - TDLS set offchannel mode
1293  * @vdev: vdev object
1294  * @offchan_mode: Updated tdls offchannel mode value.
1295  * @callback: callback to release vdev ref.
1296  */
1297 struct tdls_set_offchanmode {
1298 	struct wlan_objmgr_vdev *vdev;
1299 	uint8_t offchan_mode;
1300 	tdls_offchan_parms_callback callback;
1301 };
1302 
1303 /**
1304  * struct tdls_set_secoffchanneloffset - TDLS set secondary offchannel offset
1305  * @vdev: vdev object
1306  * @offchan_offset: Offchan offset value.
1307  * @callback: callback to release vdev ref.
1308  */
1309 struct tdls_set_secoffchanneloffset {
1310 	struct wlan_objmgr_vdev *vdev;
1311 	int offchan_offset;
1312 	tdls_offchan_parms_callback callback;
1313 };
1314 
1315 /**
1316  * enum legacy_result_code - defined to comply with tSirResultCodes, need refine
1317  *                           when mlme converged.
1318  * @legacy_result_success: success
1319  * @legacy_result_max: max result value
1320  */
1321 enum legacy_result_code {
1322 	legacy_result_success,
1323 	legacy_result_max = 0x7FFFFFFF
1324 };
1325 
1326 /**
1327  * struct tdls_send_mgmt_rsp - TDLS Response struct PE --> TDLS module
1328  * @vdev_id: vdev id
1329  * @status_code: status code as tSirResultCodes
1330  * @psoc: soc object
1331  */
1332 struct tdls_send_mgmt_rsp {
1333 	uint8_t vdev_id;
1334 	enum legacy_result_code status_code;
1335 	struct wlan_objmgr_psoc *psoc;
1336 };
1337 
1338 /**
1339  * struct tdls_mgmt_tx_completion_ind - TDLS TX completion PE --> TDLS module
1340  * @vdev_id: vdev_id
1341  * @tx_complete_status: tx complete status
1342  * @psoc: soc object
1343  */
1344 struct tdls_mgmt_tx_completion_ind {
1345 	uint8_t vdev_id;
1346 	uint32_t tx_complete_status;
1347 	struct wlan_objmgr_psoc *psoc;
1348 };
1349 
1350 /**
1351  * struct tdls_add_sta_rsp - TDLS Response struct PE --> TDLS module
1352  * @status_code: status code as tSirResultCodes
1353  * @peermac: MAC address of the TDLS peer
1354  * @session_id: session id
1355  * @sta_type: sta type
1356  * @tdls_oper: add peer type
1357  * @psoc: soc object
1358  */
1359 struct tdls_add_sta_rsp {
1360 	QDF_STATUS status_code;
1361 	struct qdf_mac_addr peermac;
1362 	uint8_t session_id;
1363 	uint16_t sta_type;
1364 	enum tdls_add_oper tdls_oper;
1365 	struct wlan_objmgr_psoc *psoc;
1366 };
1367 
1368 /**
1369  * struct tdls_del_sta_rsp - TDLS Response struct PE --> TDLS module
1370  * @session_id: session id
1371  * @status_code: status code as tSirResultCodes
1372  * @peermac: MAC address of the TDLS peer
1373  * @psoc: soc object
1374  */
1375 struct tdls_del_sta_rsp {
1376 	uint8_t session_id;
1377 	QDF_STATUS status_code;
1378 	struct qdf_mac_addr peermac;
1379 	struct wlan_objmgr_psoc *psoc;
1380 };
1381 
1382 /**
1383  * struct tdls_send_mgmt_request - tdls management request
1384  * @message_type: type of pe message
1385  * @length: length of the frame.
1386  * @session_id: session id
1387  * @req_type: type of action frame
1388  * @dialog: dialog token used in the frame.
1389  * @status_code: status to be included in the frame.
1390  * @responder: tdls request type
1391  * @peer_capability: peer capability information
1392  * @bssid: bssid
1393  * @peer_mac: mac address of the peer
1394  * @ac: Access Category to use
1395  * @add_ie: additional ie's to be included
1396  */
1397 struct tdls_send_mgmt_request {
1398 	uint16_t message_type;
1399 	uint16_t length;
1400 	uint8_t session_id;
1401 	uint8_t req_type;
1402 	uint8_t dialog;
1403 	uint16_t status_code;
1404 	uint8_t responder;
1405 	uint32_t peer_capability;
1406 	struct qdf_mac_addr bssid;
1407 	struct qdf_mac_addr peer_mac;
1408 	enum wifi_traffic_ac ac;
1409 	/* Variable length. Dont add any field after this. */
1410 	QDF_FLEX_ARRAY(uint8_t, add_ie);
1411 };
1412 
1413 /**
1414  * struct tdls_add_sta_req - TDLS request struct TDLS module --> PE
1415  * @message_type: eWNI_SME_TDLS_ADD_STA_REQ
1416  * @length: message length
1417  * @session_id: session id
1418  * @transaction_id: transaction id for cmd
1419  * @bssid: bssid
1420  * @tdls_oper: add peer type
1421  * @peermac: MAC address for TDLS peer
1422  * @capability: mac capability as sSirMacCapabilityInfo
1423  * @extn_capability: extent capability
1424  * @supported_rates_length: rates length
1425  * @supported_rates: supported rates
1426  * @htcap_present: ht capability present
1427  * @ht_cap: ht capability
1428  * @vhtcap_present: vht capability present
1429  * @vht_cap: vht capability
1430  * @he_cap_len: he capability length
1431  * @he_cap: he capability
1432  * @he_6ghz_cap: HE 6 GHz capability
1433  * @ehtcap_present: eht capability present
1434  * @eht_cap_len: eht capability length
1435  * @eht_cap: eht capability
1436  * @uapsd_queues: uapsd queue as sSirMacQosInfoStation
1437  * @max_sp: maximum service period
1438  * @is_pmf: is PMF active
1439  */
1440 struct tdls_add_sta_req {
1441 	uint16_t message_type;
1442 	uint16_t length;
1443 	uint8_t session_id;
1444 	uint16_t transaction_id;
1445 	struct qdf_mac_addr bssid;
1446 	enum tdls_add_oper tdls_oper;
1447 	struct qdf_mac_addr peermac;
1448 	uint16_t capability;
1449 	uint8_t extn_capability[WLAN_MAC_MAX_EXTN_CAP];
1450 	uint8_t supported_rates_length;
1451 	uint8_t supported_rates[WLAN_MAC_MAX_SUPP_RATES];
1452 	uint8_t htcap_present;
1453 	struct htcap_cmn_ie ht_cap;
1454 	uint8_t vhtcap_present;
1455 	struct vhtcap vht_cap;
1456 #ifdef WLAN_FEATURE_11AX
1457 	uint8_t he_cap_len;
1458 	struct hecap he_cap;
1459 	struct hecap_6ghz he_6ghz_cap;
1460 #endif
1461 #ifdef WLAN_FEATURE_11BE
1462 	uint8_t ehtcap_present;
1463 	uint8_t eht_cap_len;
1464 	struct ehtcap eht_cap;
1465 #endif
1466 	uint8_t uapsd_queues;
1467 	uint8_t max_sp;
1468 	bool is_pmf;
1469 };
1470 
1471 /**
1472  * struct tdls_del_sta_req - TDLS Request struct TDLS module --> PE
1473  * @message_type: message type eWNI_SME_TDLS_DEL_STA_REQ
1474  * @length: message length
1475  * @session_id: session id
1476  * @transaction_id: transaction id for cmd
1477  * @bssid: bssid
1478  * @peermac: MAC address of the TDLS peer
1479  */
1480 struct tdls_del_sta_req {
1481 	uint16_t message_type;
1482 	uint16_t length;
1483 	uint8_t session_id;
1484 	uint16_t transaction_id;
1485 	struct qdf_mac_addr bssid;
1486 	struct qdf_mac_addr peermac;
1487 };
1488 
1489 /**
1490  * struct tdls_link_teardown - TDLS link teardown struct
1491  * @psoc: soc object
1492  */
1493 struct tdls_link_teardown {
1494 	struct wlan_objmgr_psoc *psoc;
1495 };
1496 
1497 #ifdef FEATURE_SET
1498 /**
1499  * struct wlan_tdls_features - TDLS feature set struct
1500  * @enable_tdls: enable/disable tdls
1501  * @enable_tdls_offchannel: enable/disable tdls offchannel
1502  * @max_tdls_peers: Max tdls Peers
1503  * @enable_tdls_capability_enhance: enable tdls capability enhance
1504  */
1505 struct wlan_tdls_features {
1506 	bool enable_tdls;
1507 	bool enable_tdls_offchannel;
1508 	uint8_t max_tdls_peers;
1509 	bool enable_tdls_capability_enhance;
1510 };
1511 #endif
1512 #endif
1513