xref: /wlan-driver/qcacld-3.0/components/umac/mlme/mlo_mgr/inc/wlan_t2lm_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /*
18  * DOC: contains TID to Link mapping related functionality
19  */
20 #ifndef _WLAN_T2LM_API_H_
21 #define _WLAN_T2LM_API_H_
22 
23 #include "lim_types.h"
24 #include "lim_utils.h"
25 #include "lim_send_sme_rsp_messages.h"
26 #include "parser_api.h"
27 #include "lim_send_messages.h"
28 
29 /* T2LM IE Length =
30  * Size of header (2 bytes) +
31  * Length (1 bytes) + t2lm mapping control (2 bytes) +
32  * mapping switch time (2 bytes) + expected duration (3 bytes) +
33  * link mapping of tids (16 bytes)
34  */
35 #define T2LM_IE_ACTION_FRAME_MAX_LEN 26
36 
37 /**
38  * struct t2lm_event_data - TID to Link mapping event data
39  * @status: qdf status used to indicate if t2lm action frame status
40  * @data: event data
41  */
42 struct t2lm_event_data {
43 	QDF_STATUS status;
44 	void *data;
45 };
46 
47 /**
48  * enum wlan_t2lm_evt: T2LM manager events
49  * @WLAN_T2LM_EV_ACTION_FRAME_RX_REQ:Handle T2LM request frame received from AP
50  * @WLAN_T2LM_EV_ACTION_FRAME_TX_RESP:Handle T2LM response frame sent to AP
51  * @WLAN_T2LM_EV_ACTION_FRAME_TX_REQ:Handle T2LM request frame sent by STA
52  * @WLAN_T2LM_EV_ACTION_FRAME_RX_RESP:Handle T2LM response frame received from AP
53  * @WLAN_T2LM_EV_ACTION_FRAME_RX_TEARDOWN:Handle received teardown frame event
54  * @WLAN_T2LM_EV_ACTION_FRAME_TX_TEARDOWN:Handle sending teardown frame event
55  * @WLAN_T2LM_EV_ACTION_FRAME_MAX: Maximum T2LM action frame event value
56  */
57 enum wlan_t2lm_evt {
58 	WLAN_T2LM_EV_ACTION_FRAME_RX_REQ = 0,
59 	WLAN_T2LM_EV_ACTION_FRAME_TX_RESP = 1,
60 	WLAN_T2LM_EV_ACTION_FRAME_TX_REQ = 2,
61 	WLAN_T2LM_EV_ACTION_FRAME_RX_RESP = 3,
62 	WLAN_T2LM_EV_ACTION_FRAME_RX_TEARDOWN = 4,
63 	WLAN_T2LM_EV_ACTION_FRAME_TX_TEARDOWN = 5,
64 	WLAN_T2LM_EV_ACTION_FRAME_MAX = 6,
65 };
66 
67 #ifdef WLAN_FEATURE_11BE_MLO
68 /**
69  * t2lm_deliver_event - Handler to deliver T2LM event
70  * @vdev: vdev pointer
71  * @peer: pointer to peer
72  * @event: T2LM event
73  * @event_data: T2LM event data pointer
74  * @frame_len: Received T2LM Frame length
75  * @dialog_token: Dialog token
76  *
77  * This api will be called from lim  layers, to process T2LM event
78  *
79  * Return: qdf_status
80  */
81 QDF_STATUS t2lm_deliver_event(struct wlan_objmgr_vdev *vdev,
82 			      struct wlan_objmgr_peer *peer,
83 			      enum wlan_t2lm_evt event,
84 			      void *event_data,
85 			      uint32_t frame_len,
86 			      uint8_t *dialog_token);
87 
88 /**
89  * t2lm_handle_rx_req - Handler for parsing T2LM action frame
90  * @vdev: vdev pointer
91  * @peer: pointer to peer
92  * @event_data: T2LM event data pointer
93  * @frame_len: Received Frame length
94  * @token: Dialog token
95  *
96  * This api will be called from lim  layers, after T2LM action frame
97  * is received, the api will parse the T2LM request frame.
98  *
99  * Return: qdf_status
100  */
101 QDF_STATUS t2lm_handle_rx_req(struct wlan_objmgr_vdev *vdev,
102 			      struct wlan_objmgr_peer *peer,
103 			      void *event_data, uint32_t frame_len,
104 			      uint8_t *token);
105 
106 /**
107  * t2lm_handle_tx_resp - Handler for populating T2LM action frame
108  * @vdev: vdev pointer
109  * @event_data: T2LM event data pointer
110  * @token: Dialog token
111  *
112  * This api will be called to populate T2LM response action frame.
113  *
114  * Return: qdf_status
115  */
116 QDF_STATUS t2lm_handle_tx_resp(struct wlan_objmgr_vdev *vdev,
117 			       void *event_data, uint8_t *token);
118 
119 /**
120  * t2lm_handle_tx_req - Handler for populating T2LM action frame
121  * @vdev: vdev pointer
122  * @peer: pointer to peer
123  * @event_data: T2LM event data pointer
124  * @token: Dialog token
125  *
126  * This api will be called to populate T2LM request action frame.
127  *
128  * Return: qdf_status
129  */
130 QDF_STATUS t2lm_handle_tx_req(struct wlan_objmgr_vdev *vdev,
131 		   struct wlan_objmgr_peer *peer,
132 		   void *event_data, uint8_t *token);
133 
134 /**
135  * t2lm_handle_rx_resp - Handler for parsing T2LM action frame
136  * @vdev: vdev pointer
137  * @peer: peer pointer
138  * @event_data: T2LM event data pointer
139  * @frame_len: Frame length
140  * @token: Dialog token
141  *
142  * This api will be called to parsing T2LM response action frame.
143  *
144  * Return: qdf_status
145  */
146 QDF_STATUS t2lm_handle_rx_resp(struct wlan_objmgr_vdev *vdev,
147 			       struct wlan_objmgr_peer *peer,
148 			       void *event_data, uint32_t frame_len,
149 			       uint8_t *token);
150 
151 /**
152  * t2lm_handle_rx_teardown - Handler for parsing T2LM action frame
153  * @vdev: vdev pointer
154  * @peer: peer pointer
155  * @event_data: T2LM event data pointer
156  *
157  * This api will be called to parsing T2LM teardown action frame.
158  *
159  * Return: qdf_status
160  */
161 QDF_STATUS t2lm_handle_rx_teardown(struct wlan_objmgr_vdev *vdev,
162 				   struct wlan_objmgr_peer *peer,
163 				   void *event_data);
164 
165 /**
166  * t2lm_handle_tx_teardown - Handler for populating T2LM action frame
167  * @vdev: vdev pointer
168  * @event_data: T2LM event data pointer
169  *
170  * This api will be called to populate T2LM teardown action frame.
171  *
172  * Return: qdf_status
173  */
174 QDF_STATUS t2lm_handle_tx_teardown(struct wlan_objmgr_vdev *vdev,
175 				   void *event_data);
176 
177 /**
178  * wlan_t2lm_validate_candidate - Validate candidate based on T2LM IE
179  * @cm_ctx: connection manager context pointer
180  * @scan_entry: scan entry pointer
181  *
182  * This api will be called to validate candidate based on T2LM IE received
183  * in beacon or probe response
184  *
185  * Return: qdf_status
186  */
187 
188 QDF_STATUS
189 wlan_t2lm_validate_candidate(struct cnx_mgr *cm_ctx,
190 			     struct scan_cache_entry *scan_entry);
191 /**
192  * wlan_t2lm_deliver_event() - TID-to-link-mapping event handler
193  * @vdev: vdev object
194  * @peer: pointer to peer
195  * @event: T2LM event
196  * @event_data: T2LM event data
197  * @frame_len: received T2LM frame len
198  * @dialog_token: Dialog token
199  *
200  * Return: QDF_STATUS
201  */
202 QDF_STATUS wlan_t2lm_deliver_event(struct wlan_objmgr_vdev *vdev,
203 				   struct wlan_objmgr_peer *peer,
204 				   enum wlan_t2lm_evt event,
205 				   void *event_data,
206 				   uint32_t frame_len,
207 				   uint8_t *dialog_token);
208 
209 /**
210  * wlan_t2lm_clear_ongoing_negotiation - Clear ongoing
211  * negotiation peer level TID-to-link-mapping.
212  * @peer: pointer to peer
213  *
214  * Return: none
215  */
216 void
217 wlan_t2lm_clear_ongoing_negotiation(struct wlan_objmgr_peer *peer);
218 
219 /**
220  * wlan_t2lm_clear_peer_negotiation - Clear previously
221  * negotiated peer level TID-to-link-mapping.
222  * @peer: pointer to peer
223  *
224  * Return: none
225  */
226 void
227 wlan_t2lm_clear_peer_negotiation(struct wlan_objmgr_peer *peer);
228 
229 /**
230  * wlan_t2lm_clear_all_tid_mapping - Clear all tid mapping
231  * @vdev: pointer to vdev
232  *
233  * This api will clear peer level and beacon t2lm mapping.
234  * Return: none
235  */
236 void
237 wlan_t2lm_clear_all_tid_mapping(struct wlan_objmgr_vdev *vdev);
238 
239 /**
240  * wlan_populate_link_disable_t2lm_frame - Populate link disable t2lm frame
241  * @vdev: pointer to vdev
242  * @params: link disable params
243  *
244  * Return: none
245  */
246 QDF_STATUS
247 wlan_populate_link_disable_t2lm_frame(struct wlan_objmgr_vdev *vdev,
248 				      struct mlo_link_disable_request_evt_params *params);
249 
250 /**
251  * wlan_update_t2lm_mapping - Update t2lm mapping to fw
252  * @vdev: pointer to vdev
253  * @rx_t2lm: received t2lm mapping from beacon
254  * @tsf: timing sync function value
255  *
256  * Return: qdf status
257  */
258 QDF_STATUS wlan_update_t2lm_mapping(
259 		struct wlan_objmgr_vdev *vdev,
260 		struct wlan_t2lm_context *rx_t2lm,
261 		uint64_t tsf);
262 
263 /**
264  * wlan_t2lm_init_default_mapping - Initialize t2lm to default mapping
265  * @t2lm_ctx: t2lm ctx stored in ml dev ctx
266  *
267  * Return: qdf status
268  */
269 QDF_STATUS
270 wlan_t2lm_init_default_mapping(struct wlan_t2lm_context *t2lm_ctx);
271 
272 #else
273 static inline QDF_STATUS
wlan_t2lm_init_default_mapping(struct wlan_t2lm_context * t2lm_ctx)274 wlan_t2lm_init_default_mapping(struct wlan_t2lm_context *t2lm_ctx)
275 {
276 	return QDF_STATUS_E_NOSUPPORT;
277 }
278 
wlan_update_t2lm_mapping(struct wlan_objmgr_vdev * vdev,struct wlan_t2lm_context * rx_t2lm,uint64_t tsf)279 static inline QDF_STATUS wlan_update_t2lm_mapping(
280 		struct wlan_objmgr_vdev *vdev,
281 		struct wlan_t2lm_context *rx_t2lm,
282 		uint64_t tsf)
283 {
284 	return QDF_STATUS_E_NOSUPPORT;
285 }
286 
287 static inline QDF_STATUS
wlan_populate_link_disable_t2lm_frame(struct wlan_objmgr_vdev * vdev,struct mlo_link_disable_request_evt_params * params)288 wlan_populate_link_disable_t2lm_frame(struct wlan_objmgr_vdev *vdev,
289 				      struct mlo_link_disable_request_evt_params *params)
290 {
291 	return QDF_STATUS_E_NOSUPPORT;
292 }
293 
294 static inline QDF_STATUS
t2lm_handle_rx_req(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer,void * event_data,uint32_t frame_len,uint8_t * token)295 t2lm_handle_rx_req(struct wlan_objmgr_vdev *vdev,
296 		   struct wlan_objmgr_peer *peer,
297 		   void *event_data, uint32_t frame_len, uint8_t *token)
298 {
299 	return QDF_STATUS_E_NOSUPPORT;
300 }
301 
302 static inline QDF_STATUS
t2lm_handle_tx_resp(struct wlan_objmgr_vdev * vdev,void * event_data,uint8_t * token)303 t2lm_handle_tx_resp(struct wlan_objmgr_vdev *vdev,
304 		    void *event_data, uint8_t *token)
305 {
306 	return QDF_STATUS_E_NOSUPPORT;
307 }
308 
309 static inline QDF_STATUS
t2lm_handle_tx_req(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer,void * event_data,uint8_t * token)310 t2lm_handle_tx_req(struct wlan_objmgr_vdev *vdev,
311 		   struct wlan_objmgr_peer *peer,
312 		   void *event_data, uint8_t *token)
313 {
314 	return QDF_STATUS_E_NOSUPPORT;
315 }
316 
317 static inline QDF_STATUS
t2lm_handle_rx_resp(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer,void * event_data,uint32_t frame_len,uint8_t * token)318 t2lm_handle_rx_resp(struct wlan_objmgr_vdev *vdev,
319 		    struct wlan_objmgr_peer *peer,
320 		    void *event_data, uint32_t frame_len, uint8_t *token)
321 {
322 	return QDF_STATUS_E_NOSUPPORT;
323 }
324 
325 static inline QDF_STATUS
t2lm_handle_rx_teardown(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer,void * event_data)326 t2lm_handle_rx_teardown(struct wlan_objmgr_vdev *vdev,
327 			struct wlan_objmgr_peer *peer,
328 			void *event_data)
329 {
330 	return QDF_STATUS_E_NOSUPPORT;
331 }
332 
333 static inline QDF_STATUS
t2lm_handle_tx_teardown(struct wlan_objmgr_vdev * vdev,void * event_data)334 t2lm_handle_tx_teardown(struct wlan_objmgr_vdev *vdev,
335 			void *event_data)
336 {
337 	return QDF_STATUS_E_NOSUPPORT;
338 }
339 
340 static inline QDF_STATUS
wlan_t2lm_validate_candidate(struct cnx_mgr * cm_ctx,struct scan_cache_entry * scan_entry)341 wlan_t2lm_validate_candidate(struct cnx_mgr *cm_ctx,
342 			     struct scan_cache_entry *scan_entry)
343 {
344 	return QDF_STATUS_E_NOSUPPORT;
345 }
346 
347 static inline void
wlan_t2lm_clear_ongoing_negotiation(struct wlan_objmgr_peer * peer)348 wlan_t2lm_clear_ongoing_negotiation(struct wlan_objmgr_peer *peer)
349 {}
350 
351 static inline void
wlan_t2lm_clear_peer_negotiation(struct wlan_objmgr_peer * peer)352 wlan_t2lm_clear_peer_negotiation(struct wlan_objmgr_peer *peer)
353 {}
354 
355 static inline void
wlan_t2lm_clear_all_tid_mapping(struct wlan_objmgr_vdev * vdev)356 wlan_t2lm_clear_all_tid_mapping(struct wlan_objmgr_vdev *vdev)
357 {}
358 
359 static inline
wlan_t2lm_deliver_event(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer,enum wlan_t2lm_evt event,void * event_data,uint32_t frame_len,uint8_t * dialog_token)360 QDF_STATUS wlan_t2lm_deliver_event(struct wlan_objmgr_vdev *vdev,
361 				   struct wlan_objmgr_peer *peer,
362 				   enum wlan_t2lm_evt event,
363 				   void *event_data,
364 				   uint32_t frame_len,
365 				   uint8_t *dialog_token)
366 {
367 	return QDF_STATUS_E_NOSUPPORT;
368 }
369 #endif
370 #endif
371