xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_ap.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
1 /*
2  * Copyright (c) 2021, The Linux Foundation. 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 MLO manager public file containing AP functionality
19  */
20 #ifndef _WLAN_MLO_MGR_AP_H_
21 #define _WLAN_MLO_MGR_AP_H_
22 
23 #include <wlan_mlo_mgr_cmn.h>
24 #include <wlan_mlo_mgr_public_structs.h>
25 
26 /**
27  * mlo_ap_vdev_attach() - update vdev obj and vdev count to
28  *                         wlan_mlo_dev_context
29  * @vdev: vdev pointer
30  * @link_id: link id
31  * @vdev_count: number of vdev in the mlo
32  *
33  * Return: true if succeeds
34  */
35 bool mlo_ap_vdev_attach(struct wlan_objmgr_vdev *vdev,
36 			uint8_t link_id,
37 			uint16_t vdev_count);
38 
39 /**
40  * mlo_ap_get_vdev_list() - get mlo vdev list
41  * @vdev: vdev pointer
42  * @vdev_count: vdev count
43  * @wlan_vdev_list: vdev list
44  *
45  * Return: None
46  */
47 void mlo_ap_get_vdev_list(struct wlan_objmgr_vdev *vdev,
48 			  uint16_t *vdev_count,
49 			  struct wlan_objmgr_vdev **wlan_vdev_list);
50 
51 /**
52  * mlo_ap_link_sync_wait_notify() - notify the mlo manager, once vdev
53  *                                  enters WLAN_VDEV_SS_MLO_SYNC_WAIT
54  * @vdev: vdev pointer
55  *
56  * Return: None
57  */
58 void mlo_ap_link_sync_wait_notify(struct wlan_objmgr_vdev *vdev);
59 
60 /**
61  * mlo_ap_link_start_rsp_notify - Notify that the link start is completed
62  *
63  * @vdev: pointer to vdev
64  *
65  * Return: none
66  */
67 void mlo_ap_link_start_rsp_notify(struct wlan_objmgr_vdev *vdev);
68 
69 /**
70  * mlo_ap_vdev_detach() - notify the mlo manager to detach given vdev
71  * @vdev: vdev pointer
72  *
73  * Return: None
74  */
75 void mlo_ap_vdev_detach(struct wlan_objmgr_vdev *vdev);
76 
77 /**
78  * mlo_ap_link_down_cmpl_notify() - notify the mlo manager, once vdev
79  *                                  is down completely
80  * @vdev: vdev pointer
81  *
82  * Return: None
83  */
84 void mlo_ap_link_down_cmpl_notify(struct wlan_objmgr_vdev *vdev);
85 /**
86  * wlan_vdev_aid_mgr_init() - VDEV AID mgr init
87  * @max_aid: max AID
88  *
89  * This function is called as part of vdev/MLO DEV initialization.
90  * This will allocate aid mgr structure for a VDEV
91  *
92  * Return: aid_mgr
93  */
94 struct wlan_vdev_aid_mgr *wlan_vdev_aid_mgr_init(uint16_t max_aid);
95 
96 /**
97  * wlan_vdev_aid_mgr_free() - VDEV AID mgr free
98  * @aid_mgr: AID mgr
99  *
100  * This function frees the aid mgr of the VDEV
101  *
102  * Return: void
103  */
104 void wlan_vdev_aid_mgr_free(struct wlan_vdev_aid_mgr *aid_mgr);
105 
106 /**
107  * wlan_mlo_vdev_aid_mgr_init() - MLO AID mgr init
108  * @ml_dev: MLO DEV context
109  *
110  * This function allocate AID space for all associated VDEVs of MLD
111  *
112  * Return: SUCCESS if allocated successfully
113  */
114 QDF_STATUS wlan_mlo_vdev_aid_mgr_init(struct wlan_mlo_dev_context *ml_dev);
115 
116 /**
117  * wlan_mlo_vdev_aid_mgr_deinit() - MLO AID mgr free
118  * @ml_dev: MLO DEV context
119  *
120  * This function frees AID space for all associated VDEVs of MLD
121  *
122  * Return: void
123  */
124 void wlan_mlo_vdev_aid_mgr_deinit(struct wlan_mlo_dev_context *ml_dev);
125 
126 /**
127  * wlan_mlo_vdev_alloc_aid_mgr() - Allocate AID space for a VDEV
128  * @ml_dev: MLO DEV context
129  * @vdev: VDEV
130  *
131  * This function allocates AID space for an associated VDEV of MLD
132  *
133  * Return: SUCCESS if allocated successfully
134  */
135 QDF_STATUS wlan_mlo_vdev_alloc_aid_mgr(struct wlan_mlo_dev_context *ml_dev,
136 				       struct wlan_objmgr_vdev *vdev);
137 
138 /**
139  * wlan_mlo_vdev_free_aid_mgr() - Free AID space for a VDEV
140  * @ml_dev: MLO DEV context
141  * @vdev: VDEV
142  *
143  * This function frees AID space for an associated VDEV of MLD
144  *
145  * Return: SUCCESS if freed successfully
146  */
147 QDF_STATUS wlan_mlo_vdev_free_aid_mgr(struct wlan_mlo_dev_context *ml_dev,
148 				      struct wlan_objmgr_vdev *vdev);
149 
150 /**
151  * mlo_peer_allocate_aid() - Allocate AID for MLO peer
152  * @ml_dev: MLO DEV context
153  * @ml_peer: MLO peer object
154  *
155  * This function allocates AID for an MLO peer
156  *
157  * Return: SUCCESS if allocated successfully
158  */
159 QDF_STATUS mlo_peer_allocate_aid(
160 		struct wlan_mlo_dev_context *ml_dev,
161 		struct wlan_mlo_peer_context *ml_peer);
162 
163 /**
164  * mlo_get_aid() - Allocate AID for a associated station
165  * @vdev: VDEV
166  *
167  * This function allocates AID for an associated station of MLD
168  *
169  * Return: AID
170  */
171 uint16_t mlo_get_aid(struct wlan_objmgr_vdev *vdev);
172 
173 /**
174  * mlo_free_aid() - Frees AID for a station
175  * @vdev: VDEV
176  * @assoc_id: Assoc ID
177  *
178  * This function frees AID for an associated station of MLD
179  *
180  * Return: SUCCESS if freed
181  */
182 QDF_STATUS mlo_free_aid(struct wlan_objmgr_vdev *vdev, uint16_t assoc_id);
183 
184 /**
185  * mlme_get_aid() - Allocate AID for a non-MLD station
186  * @vdev: VDEV
187  *
188  * This function allocates AID for an associated NON-MLD station of MLD
189  *
190  * Return: AID
191  */
192 uint16_t mlme_get_aid(struct wlan_objmgr_vdev *vdev);
193 
194 /**
195  * wlan_mlo_peer_free_aid() - Free assoc id
196  * @ml_aid_mgr: MLO AID mgr
197  * @link_ix: Link index
198  * @assoc_id: Assoc id to be freed
199  *
200  * This function frees assoc id, resets bit in all bitmaps
201  *
202  * Return: SUCCESS,if it freed
203  */
204 QDF_STATUS wlan_mlo_peer_free_aid(
205 		struct wlan_ml_vdev_aid_mgr *ml_aid_mgr,
206 		uint8_t link_ix,
207 		uint16_t assoc_id);
208 
209 /**
210  * wlan_mlme_peer_free_aid() - Free link assoc id
211  * @vdev_aid_mgr: VDEV AID mgr
212  * @no_lock: lock needed for the operation
213  * @assoc_id: Assoc id to be freed
214  *
215  * This function frees assoc id of a specific VDEV
216  *
217  * Return: void
218  */
219 void wlan_mlme_peer_free_aid(
220 		struct wlan_vdev_aid_mgr *vdev_aid_mgr,
221 		bool no_lock, uint16_t assoc_id);
222 
223 /**
224  * mlo_peer_free_aid() - public API to free AID
225  * @ml_dev: MLO DEV context
226  * @ml_peer: MLO peer object
227  *
228  * This function invokes low level API to free assoc id
229  *
230  * Return: SUCCESS, if it freed
231  */
232 QDF_STATUS mlo_peer_free_aid(struct wlan_mlo_dev_context *ml_dev,
233 			     struct wlan_mlo_peer_context *ml_peer);
234 
235 /**
236  * mlme_free_aid() - public API to free link assoc id
237  * @vdev: VDEV object
238  * @assoc_id: Assoc id to be freed
239  *
240  * This function invokes low level API to free assoc id of a specific VDEV
241  *
242  * Return: void
243  */
244 void mlme_free_aid(struct wlan_objmgr_vdev *vdev, uint16_t assoc_id);
245 
246 /**
247  * mlo_ap_ml_peerid_alloc() - public API to allocate MLO peer id
248  *
249  * This function allocates MLO peer ID
250  *
251  * Return: mlo_peer_id on success,
252 	 MLO_INVALID_PEER_ID on failure
253  */
254 uint16_t mlo_ap_ml_peerid_alloc(void);
255 
256 /**
257  * mlo_ap_ml_peerid_free() - public API to free MLO peer id
258  * @ml_peer_id: ML peer id
259  *
260  * This function frees MLO peer ID
261  *
262  * Return: void
263  */
264 void mlo_ap_ml_peerid_free(uint16_t mlo_peer_id);
265 
266 #define ML_PRIMARY_UMAC_ID_INVAL 0xff
267 /**
268  * mlo_peer_assign_primary_umac() - Assign Primary UMAC
269  * @ml_peer: MLO peer object
270  * @peer_entry: Link peer entry
271  *
272  * This function assigns primary UMAC flag in peer entry
273  *
274  * Return: SUCCESS,if it allocated
275  */
276 void mlo_peer_assign_primary_umac(
277 		struct wlan_mlo_peer_context *ml_peer,
278 		struct wlan_mlo_link_peer_entry *peer_entry);
279 
280 /**
281  * mlo_peer_allocate_primary_umac() - Allocate Primary UMAC
282  * @ml_dev: MLO DEV context
283  * @ml_peer: MLO peer object
284  * @link_vdev: link vdev array
285  *
286  * This function allocates primary UMAC for a MLO peer
287  *
288  * Return: SUCCESS,if it allocated
289  */
290 QDF_STATUS mlo_peer_allocate_primary_umac(
291 		struct wlan_mlo_dev_context *ml_dev,
292 		struct wlan_mlo_peer_context *ml_peer,
293 		struct wlan_objmgr_vdev *link_vdevs[]);
294 
295 /**
296  * mlo_peer_free_primary_umac() - Free Primary UMAC
297  * @ml_dev: MLO DEV context
298  * @ml_peer: MLO peer object
299  *
300  * This function frees primary UMAC for a MLO peer
301  *
302  * Return: SUCCESS,if it is freed
303  */
304 QDF_STATUS mlo_peer_free_primary_umac(
305 		struct wlan_mlo_dev_context *ml_dev,
306 		struct wlan_mlo_peer_context *ml_peer);
307 
308 /**
309  * mlo_ap_vdev_quiet_set() - Set quiet bitmap for requested vdev
310  * @vdev: Pointer to object manager vdev
311  *
312  * Return: void
313  */
314 void mlo_ap_vdev_quiet_set(struct wlan_objmgr_vdev *vdev);
315 
316 /**
317  * mlo_ap_vdev_quiet_clear() - Clear quiet bitmap for requested vdev
318  * @vdev: Pointer to object manager vdev
319  *
320  * Return: void
321  */
322 void mlo_ap_vdev_quiet_clear(struct wlan_objmgr_vdev *vdev);
323 
324 /**
325  * mlo_ap_vdev_quiet_is_any_idx_set() - Check if any index is set in
326  * quiet bitmap
327  * @vdev: Pointer to object manager vdev
328  *
329  * Return: true, if any index is set, else false
330  */
331 bool mlo_ap_vdev_quiet_is_any_idx_set(struct wlan_objmgr_vdev *vdev);
332 #endif
333