xref: /wlan-driver/qcacld-3.0/os_if/tdls/inc/wlan_cfg80211_tdls.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name /**
21*5113495bSYour Name  * DOC: declares driver functions interfacing with linux kernel
22*5113495bSYour Name  */
23*5113495bSYour Name 
24*5113495bSYour Name #ifndef _WLAN_CFG80211_TDLS_H_
25*5113495bSYour Name #define _WLAN_CFG80211_TDLS_H_
26*5113495bSYour Name 
27*5113495bSYour Name #include <linux/version.h>
28*5113495bSYour Name #include <linux/netdevice.h>
29*5113495bSYour Name #include <linux/completion.h>
30*5113495bSYour Name #include <net/cfg80211.h>
31*5113495bSYour Name #include <qca_vendor.h>
32*5113495bSYour Name #include <wlan_tdls_public_structs.h>
33*5113495bSYour Name #include <qdf_list.h>
34*5113495bSYour Name #include <qdf_types.h>
35*5113495bSYour Name #include <wlan_hdd_main.h>
36*5113495bSYour Name #include <wlan_tdls_ucfg_api.h>
37*5113495bSYour Name 
38*5113495bSYour Name #ifdef FEATURE_WLAN_TDLS
39*5113495bSYour Name 
40*5113495bSYour Name #define TDLS_VDEV_MAGIC 0x54444c53       /* "TDLS" */
41*5113495bSYour Name 
42*5113495bSYour Name /**
43*5113495bSYour Name  * struct osif_tdls_vdev - OS tdls vdev private structure
44*5113495bSYour Name  * @tdls_add_peer_comp: Completion to add tdls peer
45*5113495bSYour Name  * @tdls_del_peer_comp: Completion to delete tdls peer
46*5113495bSYour Name  * @tdls_mgmt_comp: Completion to send tdls mgmt packets
47*5113495bSYour Name  * @tdls_link_establish_req_comp: Completion to establish link, sync to
48*5113495bSYour Name  * send establish params to firmware, not used today.
49*5113495bSYour Name  * @tdls_teardown_comp: Completion to teardown tdls peer
50*5113495bSYour Name  * @tdls_user_cmd_comp: tdls user command completion event
51*5113495bSYour Name  * @tdls_antenna_switch_comp: Completion to switch antenna
52*5113495bSYour Name  * @tdls_add_peer_status: Peer status after add peer
53*5113495bSYour Name  * @mgmt_tx_completion_status: Tdls mgmt frames TX completion status code
54*5113495bSYour Name  * @tdls_user_cmd_len: tdls user command written buffer length
55*5113495bSYour Name  * @tdls_antenna_switch_status: return status after antenna switch
56*5113495bSYour Name  * @tdls_user_cmd_in_progress: tdls user command progress status.
57*5113495bSYour Name  */
58*5113495bSYour Name struct osif_tdls_vdev {
59*5113495bSYour Name 	struct completion tdls_add_peer_comp;
60*5113495bSYour Name 	struct completion tdls_del_peer_comp;
61*5113495bSYour Name 	struct completion tdls_mgmt_comp;
62*5113495bSYour Name 	struct completion tdls_link_establish_req_comp;
63*5113495bSYour Name 	struct completion tdls_teardown_comp;
64*5113495bSYour Name 	struct completion tdls_user_cmd_comp;
65*5113495bSYour Name 	struct completion tdls_antenna_switch_comp;
66*5113495bSYour Name 	QDF_STATUS tdls_add_peer_status;
67*5113495bSYour Name 	uint32_t mgmt_tx_completion_status;
68*5113495bSYour Name 	uint32_t tdls_user_cmd_len;
69*5113495bSYour Name 	int tdls_antenna_switch_status;
70*5113495bSYour Name 	bool tdls_user_cmd_in_progress;
71*5113495bSYour Name };
72*5113495bSYour Name 
73*5113495bSYour Name /**
74*5113495bSYour Name  * enum qca_wlan_vendor_tdls_trigger_mode_vdev_map: Maps the user space TDLS
75*5113495bSYour Name  *	trigger mode in the host driver.
76*5113495bSYour Name  * @WLAN_VENDOR_TDLS_TRIGGER_MODE_EXPLICIT: TDLS Connection and
77*5113495bSYour Name  *	disconnection handled by user space.
78*5113495bSYour Name  * @WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT: TDLS connection and
79*5113495bSYour Name  *	disconnection controlled by host driver based on data traffic.
80*5113495bSYour Name  * @WLAN_VENDOR_TDLS_TRIGGER_MODE_EXTERNAL: TDLS connection and
81*5113495bSYour Name  *	disconnection jointly controlled by user space and host driver.
82*5113495bSYour Name  */
83*5113495bSYour Name enum qca_wlan_vendor_tdls_trigger_mode_vdev_map {
84*5113495bSYour Name 	WLAN_VENDOR_TDLS_TRIGGER_MODE_EXPLICIT =
85*5113495bSYour Name 		QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_EXPLICIT,
86*5113495bSYour Name 	WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT =
87*5113495bSYour Name 		QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT,
88*5113495bSYour Name 	WLAN_VENDOR_TDLS_TRIGGER_MODE_EXTERNAL =
89*5113495bSYour Name 		((QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_EXPLICIT |
90*5113495bSYour Name 		  QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT) << 1),
91*5113495bSYour Name };
92*5113495bSYour Name 
93*5113495bSYour Name /**
94*5113495bSYour Name  * wlan_cfg80211_tdls_osif_priv_init() - API to initialize tdls os private
95*5113495bSYour Name  * @vdev: vdev object
96*5113495bSYour Name  *
97*5113495bSYour Name  * API to initialize tdls os private
98*5113495bSYour Name  *
99*5113495bSYour Name  * Return: QDF_STATUS
100*5113495bSYour Name  */
101*5113495bSYour Name QDF_STATUS wlan_cfg80211_tdls_osif_priv_init(struct wlan_objmgr_vdev *vdev);
102*5113495bSYour Name 
103*5113495bSYour Name /**
104*5113495bSYour Name  * wlan_cfg80211_tdls_osif_priv_deinit() - API to deinitialize tdls os private
105*5113495bSYour Name  * @vdev: vdev object
106*5113495bSYour Name  *
107*5113495bSYour Name  * API to deinitialize tdls os private
108*5113495bSYour Name  *
109*5113495bSYour Name  * Return: None
110*5113495bSYour Name  */
111*5113495bSYour Name void wlan_cfg80211_tdls_osif_priv_deinit(struct wlan_objmgr_vdev *vdev);
112*5113495bSYour Name 
113*5113495bSYour Name /**
114*5113495bSYour Name  * wlan_cfg80211_tdls_add_peer_mlo() - process cfg80211 add TDLS peer request
115*5113495bSYour Name  * @adapter: adapter pointer
116*5113495bSYour Name  * @mac: MAC address for TDLS peer
117*5113495bSYour Name  * @link_id: link id
118*5113495bSYour Name  *
119*5113495bSYour Name  * Return: 0 for success; negative errno otherwise
120*5113495bSYour Name  */
121*5113495bSYour Name int wlan_cfg80211_tdls_add_peer_mlo(struct hdd_adapter *adapter,
122*5113495bSYour Name 				    const uint8_t *mac, uint8_t link_id);
123*5113495bSYour Name 
124*5113495bSYour Name /**
125*5113495bSYour Name  * wlan_cfg80211_tdls_update_peer() - process cfg80211 update TDLS peer request
126*5113495bSYour Name  * @vdev: vdev object
127*5113495bSYour Name  * @mac: MAC address for TDLS peer
128*5113495bSYour Name  * @params: Pointer to station parameters
129*5113495bSYour Name  *
130*5113495bSYour Name  * Return: 0 for success; negative errno otherwise
131*5113495bSYour Name  */
132*5113495bSYour Name int wlan_cfg80211_tdls_update_peer(struct wlan_objmgr_vdev *vdev,
133*5113495bSYour Name 				   const uint8_t *mac,
134*5113495bSYour Name 				   struct station_parameters *params);
135*5113495bSYour Name 
136*5113495bSYour Name /**
137*5113495bSYour Name  * wlan_cfg80211_tdls_configure_mode() - configure tdls mode
138*5113495bSYour Name  * @vdev: vdev obj manager
139*5113495bSYour Name  * @trigger_mode: tdls trgger mode
140*5113495bSYour Name  *
141*5113495bSYour Name  * Return: 0 for success; negative errno otherwise
142*5113495bSYour Name  */
143*5113495bSYour Name int wlan_cfg80211_tdls_configure_mode(struct wlan_objmgr_vdev *vdev,
144*5113495bSYour Name 						uint32_t trigger_mode);
145*5113495bSYour Name 
146*5113495bSYour Name /**
147*5113495bSYour Name  * wlan_cfg80211_tdls_oper() - process cfg80211 operation on an TDLS peer
148*5113495bSYour Name  * @vdev: vdev object
149*5113495bSYour Name  * @peer: MAC address of the TDLS peer
150*5113495bSYour Name  * @oper: cfg80211 TDLS operation
151*5113495bSYour Name  *
152*5113495bSYour Name  * Return: 0 on success; negative errno otherwise
153*5113495bSYour Name  */
154*5113495bSYour Name int wlan_cfg80211_tdls_oper(struct wlan_objmgr_vdev *vdev,
155*5113495bSYour Name 			    const uint8_t *peer,
156*5113495bSYour Name 			    enum nl80211_tdls_operation oper);
157*5113495bSYour Name 
158*5113495bSYour Name /**
159*5113495bSYour Name  * wlan_cfg80211_tdls_get_all_peers() - get all the TDLS peers from the list
160*5113495bSYour Name  * @vdev: vdev object
161*5113495bSYour Name  * @buf: output buffer
162*5113495bSYour Name  * @buflen: valid length of the output error
163*5113495bSYour Name  *
164*5113495bSYour Name  * Return: length of the output buffer
165*5113495bSYour Name  */
166*5113495bSYour Name int wlan_cfg80211_tdls_get_all_peers(struct wlan_objmgr_vdev *vdev,
167*5113495bSYour Name 				char *buf, int buflen);
168*5113495bSYour Name 
169*5113495bSYour Name /**
170*5113495bSYour Name  * wlan_cfg80211_tdls_is_fw_wideband_capable() - Check whether fw supports
171*5113495bSYour Name  *                                               wideband TDLS
172*5113495bSYour Name  * @vdev:     Pointer to vdev
173*5113495bSYour Name  *
174*5113495bSYour Name  * Return: true if fw supports wideband TDLS connection
175*5113495bSYour Name  */
176*5113495bSYour Name bool wlan_cfg80211_tdls_is_fw_wideband_capable(struct wlan_objmgr_vdev *vdev);
177*5113495bSYour Name 
178*5113495bSYour Name #ifdef WLAN_FEATURE_11AX
179*5113495bSYour Name /**
180*5113495bSYour Name  * wlan_cfg80211_tdls_is_fw_6ghz_capable() - Check whether fw supports 6 GHz
181*5113495bSYour Name  *                                           band TDLS
182*5113495bSYour Name  * @vdev:     Pointer to vdev
183*5113495bSYour Name  *
184*5113495bSYour Name  * Return: true if fw supports 6 GHz TDLS connection
185*5113495bSYour Name  */
186*5113495bSYour Name bool wlan_cfg80211_tdls_is_fw_6ghz_capable(struct wlan_objmgr_vdev *vdev);
187*5113495bSYour Name #endif
188*5113495bSYour Name 
189*5113495bSYour Name /**
190*5113495bSYour Name  * wlan_cfg80211_tdls_mgmt_mlo() - process TDLS management frames from
191*5113495bSYour Name  * the supplicant
192*5113495bSYour Name  * @adapter: adapter object
193*5113495bSYour Name  * @peer: MAC address of the TDLS peer
194*5113495bSYour Name  * @action_code: type of TDLS mgmt frame to be sent
195*5113495bSYour Name  * @dialog_token: dialog token used in the frame
196*5113495bSYour Name  * @status_code: status to be included in the frame
197*5113495bSYour Name  * @peer_capability: peer capability information
198*5113495bSYour Name  * @buf: additional IEs to be included
199*5113495bSYour Name  * @len: length of additional Ies
200*5113495bSYour Name  * @link_id: link id
201*5113495bSYour Name  *
202*5113495bSYour Name  * Return: 0 on success; negative errno otherwise
203*5113495bSYour Name  */
204*5113495bSYour Name int wlan_cfg80211_tdls_mgmt_mlo(struct hdd_adapter *adapter,
205*5113495bSYour Name 				const uint8_t *peer,
206*5113495bSYour Name 				uint8_t action_code, uint8_t dialog_token,
207*5113495bSYour Name 				uint16_t status_code, uint32_t peer_capability,
208*5113495bSYour Name 				const uint8_t *buf, size_t len, int link_id);
209*5113495bSYour Name 
210*5113495bSYour Name /**
211*5113495bSYour Name  * wlan_tdls_antenna_switch() - process TDLS antenna switch
212*5113495bSYour Name  * @vdev: vdev object
213*5113495bSYour Name  * @mode: antenna mode
214*5113495bSYour Name  *
215*5113495bSYour Name  * Return: 0 on success; -EAGAIN to retry
216*5113495bSYour Name  */
217*5113495bSYour Name int wlan_tdls_antenna_switch(struct wlan_objmgr_vdev *vdev, uint32_t mode);
218*5113495bSYour Name 
219*5113495bSYour Name /**
220*5113495bSYour Name  * wlan_cfg80211_tdls_event_callback() - callback for TDLS module
221*5113495bSYour Name  * @userdata: user data
222*5113495bSYour Name  * @type: request callback type
223*5113495bSYour Name  * @param: passed parameter
224*5113495bSYour Name  *
225*5113495bSYour Name  * This is used by TDLS to sync with os interface
226*5113495bSYour Name  *
227*5113495bSYour Name  * Return: None
228*5113495bSYour Name  */
229*5113495bSYour Name void wlan_cfg80211_tdls_event_callback(void *userdata,
230*5113495bSYour Name 				       enum tdls_event_type type,
231*5113495bSYour Name 				       struct tdls_osif_indication *param);
232*5113495bSYour Name 
233*5113495bSYour Name /**
234*5113495bSYour Name  * wlan_cfg80211_tdls_rx_callback() - Callback for rx mgmt frame
235*5113495bSYour Name  * @user_data: pointer to soc object
236*5113495bSYour Name  * @rx_frame: RX mgmt frame information
237*5113495bSYour Name  *
238*5113495bSYour Name  * This callback will be used to rx frames in os interface.
239*5113495bSYour Name  *
240*5113495bSYour Name  * Return: None
241*5113495bSYour Name  */
242*5113495bSYour Name void wlan_cfg80211_tdls_rx_callback(void *user_data,
243*5113495bSYour Name 	struct tdls_rx_mgmt_frame *rx_frame);
244*5113495bSYour Name 
245*5113495bSYour Name /**
246*5113495bSYour Name  * hdd_notify_tdls_reset_adapter() - notify reset adapter to TDLS
247*5113495bSYour Name  * @vdev: vdev object manager
248*5113495bSYour Name  *
249*5113495bSYour Name  * Notify hdd reset adapter to TDLS component
250*5113495bSYour Name  *
251*5113495bSYour Name  * Return: None
252*5113495bSYour Name  */
253*5113495bSYour Name void hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev *vdev);
254*5113495bSYour Name 
255*5113495bSYour Name #else /* FEATURE_WLAN_TDLS */
256*5113495bSYour Name static inline
wlan_cfg80211_tdls_osif_priv_init(struct wlan_objmgr_vdev * vdev)257*5113495bSYour Name QDF_STATUS wlan_cfg80211_tdls_osif_priv_init(struct wlan_objmgr_vdev *vdev)
258*5113495bSYour Name {
259*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
260*5113495bSYour Name }
261*5113495bSYour Name 
262*5113495bSYour Name static inline
wlan_cfg80211_tdls_osif_priv_deinit(struct wlan_objmgr_vdev * vdev)263*5113495bSYour Name void wlan_cfg80211_tdls_osif_priv_deinit(struct wlan_objmgr_vdev *vdev)
264*5113495bSYour Name {
265*5113495bSYour Name }
266*5113495bSYour Name 
267*5113495bSYour Name static inline void
hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev * vdev)268*5113495bSYour Name hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev *vdev)
269*5113495bSYour Name {
270*5113495bSYour Name }
271*5113495bSYour Name 
272*5113495bSYour Name static inline
wlan_cfg80211_tdls_configure_mode(struct wlan_objmgr_vdev * vdev,uint32_t trigger_mode)273*5113495bSYour Name int wlan_cfg80211_tdls_configure_mode(struct wlan_objmgr_vdev *vdev,
274*5113495bSYour Name 						uint32_t trigger_mode)
275*5113495bSYour Name {
276*5113495bSYour Name 	return 0;
277*5113495bSYour Name }
278*5113495bSYour Name #endif /* FEATURE_WLAN_TDLS */
279*5113495bSYour Name #endif /* _WLAN_CFG80211_TDLS_H_ */
280