1 /* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
2 *
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 */
15
16 /**
17 * DOC: contains MLO manager public file containing setup/teardown functionality
18 */
19
20 #ifndef _WLAN_MLO_MGR_SETUP_H_
21 #define _WLAN_MLO_MGR_SETUP_H_
22 #ifdef WLAN_MLO_MULTI_CHIP
23
24 /**
25 * mlo_setup_init() - API to init setup info events
26 * @total_grp: Total number of MLO groups
27 *
28 * Return: None
29 */
30 void mlo_setup_init(uint8_t total_grp);
31
32 /**
33 * mlo_setup_deinit() - API to deinit setup info events
34 *
35 * Return: None
36 */
37 void mlo_setup_deinit(void);
38
39 /**
40 * mlo_is_ml_soc() - API to check if psoc belongs to ML group
41 * @psoc: Soc to be checked.
42 * @grp_id: ID of the required mlo group
43 *
44 * Return: true if psoc found in ml soc_list, or else return false
45 */
46 bool mlo_is_ml_soc(struct wlan_objmgr_psoc *psoc, uint8_t grp_id);
47
48 /**
49 * mlo_check_start_stop_inprogress() - API to set ML group
50 * start or stop in progress bit and return last value
51 * @grp_id: ID of the required mlo group to be checked
52 *
53 * Return: true if mlo group is in start/stop, or else return false
54 */
55 bool mlo_check_start_stop_inprogress(uint8_t grp_id);
56
57 /**
58 * mlo_clear_start_stop_inprogress() - API to clear the value of ML group
59 * start or stop in progress bit
60 * @grp_id: ID of the required mlo group to be set
61 *
62 * Return: none
63 */
64 void mlo_clear_start_stop_inprogress(uint8_t grp_id);
65
66 /**
67 * mlo_get_soc_list() - API to get the list of SOCs participating in MLO
68 * @soc_list: list where ML participating SOCs need to be populated
69 * @grp_id: ID of the required mlo group
70 * @tot_socs: Total number of socs, for which soc list is allocated
71 * @curr: Flag to get the current psoc list or actual psoc list
72 *
73 * Return: None
74 */
75 void mlo_get_soc_list(struct wlan_objmgr_psoc **soc_list, uint8_t grp_id,
76 uint8_t tot_socs, enum MLO_SOC_LIST curr);
77
78 /**
79 * mlo_setup_update_soc_id_list() - API to update the list of SOCs ids
80 * participating in that MLO group
81 * @grp_id: ID of the required mlo group
82 * @soc_id_list: soc ids part of that MLO group
83 *
84 * Return: None
85 */
86 void mlo_setup_update_soc_id_list(uint8_t grp_id, uint8_t *soc_id_list);
87
88 /**
89 * mlo_psoc_get_grp_id() - API to get the MLO group id of the SoC
90 * @psoc: Required psoc pointer
91 * @grp_id: MLO Group id will be stored in here
92 *
93 * Return: bool: if valid group id true, else false
94 */
95 bool mlo_psoc_get_grp_id(struct wlan_objmgr_psoc *psoc, uint8_t *grp_id);
96
97 /**
98 * mlo_cleanup_asserted_soc_setup_info() - API to cleanup the mlo setup info of
99 * asserted soc
100 * @psoc: Soc to be cleaned up
101 * @grp_id: ID of the required mlo group
102 *
103 * Return: None
104 */
105 void mlo_cleanup_asserted_soc_setup_info(struct wlan_objmgr_psoc *psoc,
106 uint8_t grp_id);
107
108 /**
109 * mlo_setup_update_total_socs() - API to update total socs for mlo
110 * @grp_id: ID of the required mlo group
111 * @tot_socs: Total socs
112 *
113 * Return: None.
114 */
115 void mlo_setup_update_total_socs(uint8_t grp_id, uint8_t tot_socs);
116
117 /**
118 * mlo_setup_get_total_socs() - API to get total socs for mlo group
119 * @grp_id: ID of the required mlo group
120 *
121 * Return: uint8_t, Number of total socs
122 */
123 uint8_t mlo_setup_get_total_socs(uint8_t grp_id);
124
125 /**
126 * mlo_setup_update_num_links() - API to update num links in soc for mlo
127 * @psoc: soc object of SoC corresponding to num_link
128 * @grp_id: ID of the required mlo group
129 * @num_links: Number of links in that soc
130 *
131 * Return: None.
132 */
133 void mlo_setup_update_num_links(struct wlan_objmgr_psoc *psoc,
134 uint8_t grp_id,
135 uint8_t num_links);
136
137 /**
138 * mlo_setup_update_chip_info() - API to update mlo chip info
139 * @psoc: soc to be checked
140 * @chip_id: chip_id to update the info about
141 * @adj_chip_id: adjacent chip ID's
142 *
143 * Return: None.
144 */
145 void mlo_setup_update_chip_info(struct wlan_objmgr_psoc *psoc, uint8_t chip_id,
146 uint8_t *adj_chip_id);
147
148 /**
149 * mlo_chip_adjacent() - API to return if two chips are adjacent
150 * @psoc_id_1: Psoc id 1
151 * @psoc_id_2: Psoc id 2
152 * @is_adjacent: Are the above 2 psocs adjacent or not
153 * Return: QDF_STATUS: success / failure.
154 */
155 QDF_STATUS mlo_chip_adjacent(uint8_t psoc_id_1, uint8_t psoc_id_2,
156 uint8_t *is_adjacent);
157
158 /**
159 * mlo_setup_update_soc_ready() - API to notify when FW init done
160 * @psoc: soc object of SoC ready
161 * @grp_id: ID of the required mlo group
162 *
163 * Return: None.
164 */
165 void mlo_setup_update_soc_ready(struct wlan_objmgr_psoc *psoc, uint8_t grp_id);
166
167 /**
168 * mlo_setup_link_ready() - API to notify link ready
169 * @pdev: Pointer to pdev object
170 * @grp_id: ID of the required mlo group
171 *
172 * Return: None.
173 */
174 void mlo_setup_link_ready(struct wlan_objmgr_pdev *pdev, uint8_t grp_id);
175
176 /**
177 * mlo_link_setup_complete() - API to notify setup complete
178 * @pdev: Pointer to pdev object
179 * @grp_id: ID of the required mlo group
180 *
181 * Return: None.
182 */
183 void mlo_link_setup_complete(struct wlan_objmgr_pdev *pdev, uint8_t grp_id);
184
185 /**
186 * mlo_link_teardown_complete() - API to notify teardown complete
187 * @pdev: Pointer to pdev object
188 * @grp_id: ID of the required mlo group
189 *
190 * Return: None.
191 */
192 void mlo_link_teardown_complete(struct wlan_objmgr_pdev *pdev, uint8_t grp_id);
193
194 /**
195 * mlo_setup_update_soc_down() - API to check and clear all links and bring
196 * back to initial state for the particular soc
197 *
198 * @psoc: Pointer to psoc object
199 * @grp_id: ID of the required mlo group
200 *
201 * Return: None.
202 */
203 void mlo_setup_update_soc_down(struct wlan_objmgr_psoc *psoc, uint8_t grp_id);
204
205 /**
206 * mlo_link_teardown_link() - API to trigger teardown
207 * @psoc: Pointer to psoc object
208 * @grp_id: ID of the required mlo group
209 * @reason: Reason code for MLO tear down
210 *
211 * Return: QDF_STATUS - success / failure.
212 */
213 QDF_STATUS mlo_link_teardown_link(struct wlan_objmgr_psoc *psoc,
214 uint8_t grp_id,
215 uint32_t reason);
216
217 /**
218 * mlo_vdevs_check_single_soc() - API to check all the vaps in vdev list
219 * belong to single soc or not
220 * @wlan_vdev_list: List of all vdevs to check
221 * @vdev_count: Number of vdevs in the list
222 *
223 * Return: bool: True if belongs to single soc else false
224 */
225 bool mlo_vdevs_check_single_soc(struct wlan_objmgr_vdev **wlan_vdev_list,
226 uint8_t vdev_count);
227
228 /**
229 * mlo_check_all_pdev_state() - API to check all the pdev of the soc
230 * are on the same expected state.
231 *
232 * @psoc: Pointer to psoc object
233 * @grp_id: ID of the required mlo group
234 * @state: Expected link state to be verified
235 *
236 * Return: QDF_STATUS: QDF_STATUS_SUCCESS if all belongs to same state
237 */
238 QDF_STATUS mlo_check_all_pdev_state(struct wlan_objmgr_psoc *psoc,
239 uint8_t grp_id,
240 enum MLO_LINK_STATE state);
241
242 /**
243 * mlo_update_wsi_stats_info_support() - API to update WSI stats info
244 * support
245 * @psoc: Pointer to psoc object
246 * @wsi_stats_info_support: Indicates WSI stats info is to be enabled or not
247 *
248 * Return: None
249 */
250 void mlo_update_wsi_stats_info_support(struct wlan_objmgr_psoc *psoc,
251 bool wsi_stats_info_support);
252
253 /**
254 * mlo_get_wsi_stats_info_support() - API to get whether WSI stats info
255 * support
256 * @psoc: Pointer to psoc object
257 *
258 * Return: 1 enable
259 * 0 disable
260 */
261 uint8_t mlo_get_wsi_stats_info_support(struct wlan_objmgr_psoc *psoc);
262
263 /**
264 * mlo_update_tsf_sync_support() - API to update TSF sync support per MLO
265 * group.
266 *
267 * @psoc: Pointer to psoc object
268 * @tsf_sync_enab: Indicates TSF sync is to be enabled or not
269 *
270 * Return: None
271 */
272 void mlo_update_tsf_sync_support(struct wlan_objmgr_psoc *psoc,
273 bool tsf_sync_enab);
274
275 /**
276 * mlo_pdev_derive_bridge_link_pdevs() - API to get the list of pdevs
277 * for creating bridge vdevs.
278 *
279 * @pdev: pdev of the mlo group
280 * @pdev_list: list where pdevs for creating bridge vdevs need to be populated
281 *
282 * Return: true if success otherwise false.
283 */
284 bool mlo_pdev_derive_bridge_link_pdevs(struct wlan_objmgr_pdev *pdev,
285 struct wlan_objmgr_pdev **pdev_list);
286 #else
mlo_setup_init(uint8_t total_grp)287 static inline void mlo_setup_init(uint8_t total_grp)
288 {
289 }
290
mlo_setup_deinit(void)291 static inline void mlo_setup_deinit(void)
292 {
293 }
294
295 static inline bool
mlo_vdevs_check_single_soc(struct wlan_objmgr_vdev ** wlan_vdev_list,uint8_t vdev_count)296 mlo_vdevs_check_single_soc(struct wlan_objmgr_vdev **wlan_vdev_list,
297 uint8_t vdev_count)
298 {
299 return true;
300 }
301
302 static inline
mlo_check_all_pdev_state(struct wlan_objmgr_psoc * psoc,uint32_t state)303 QDF_STATUS mlo_check_all_pdev_state(struct wlan_objmgr_psoc *psoc,
304 uint32_t state)
305 {
306 return QDF_STATUS_SUCCESS;
307 }
308
309 static inline
mlo_psoc_get_grp_id(struct wlan_objmgr_psoc * psoc,uint8_t * grp_id)310 bool mlo_psoc_get_grp_id(struct wlan_objmgr_psoc *psoc, uint8_t *grp_id)
311 {
312 return 0;
313 }
314
315 static inline
init_deinit_pdev_wsi_stats_info_support(struct wlan_objmgr_psoc * psoc,bool wsi_stats_info_support)316 void init_deinit_pdev_wsi_stats_info_support(struct wlan_objmgr_psoc *psoc,
317 bool wsi_stats_info_support)
318 {
319 }
320
321 static inline
mlo_update_tsf_sync_support(struct wlan_objmgr_psoc * psoc,bool tsf_sync_enab)322 void mlo_update_tsf_sync_support(struct wlan_objmgr_psoc *psoc,
323 bool tsf_sync_enab)
324 {
325 }
326 #endif /* WLAN_MLO_MULTI_CHIP */
327 #endif /* _WLAN_MLO_MGR_SETUP_H_ */
328