xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_setup.h (revision 22f89679c1f1aeaf62e34eaee8c5ca99467bd241)
1 /* Copyright (c) 2021-2022 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_get_soc_list() - API to get the list of SOCs participating in MLO
50  * @soc_list: list where ML participating SOCs need to be populated
51  * @grp_id: ID of the required mlo group
52  * @tot_socs: Total number of socs, for which soc list is allocated
53  * @curr: Flag to get the current psoc list or actual psoc list
54  *
55  * Return: None
56  */
57 void mlo_get_soc_list(struct wlan_objmgr_psoc **soc_list, uint8_t grp_id,
58 		      uint8_t tot_socs, enum MLO_SOC_LIST curr);
59 
60 /**
61  * mlo_setup_update_soc_id_list() - API to update the list of SOCs ids
62  *                                  participating in that MLO group
63  * @grp_id: ID of the required mlo group
64  * @soc_list: soc ids part of that MLO group
65  *
66  * Return: None
67  */
68 void mlo_setup_update_soc_id_list(uint8_t grp_id, uint8_t *soc_id_list);
69 
70 /**
71  * mlo_psoc_get_grp_id() - API to get the MLO group id of the SoC
72  * @psoc: Required psoc pointer
73  * @grp_id: MLO Group id will be stored in here
74  *
75  * Return: bool: if valid group id true, else false
76  */
77 bool mlo_psoc_get_grp_id(struct wlan_objmgr_psoc *psoc, uint8_t *grp_id);
78 
79 /**
80  * mlo_cleanup_asserted_soc_setup_info() - API to cleanup the mlo setup info of
81  * asserted soc
82  * @psoc: Soc to be cleaned up
83  * @grp_id: ID of the required mlo group
84  *
85  * Return: None
86  */
87 void mlo_cleanup_asserted_soc_setup_info(struct wlan_objmgr_psoc *psoc,
88 					 uint8_t grp_id);
89 
90 /**
91  * mlo_setup_update_total_socs() - API to update total socs for mlo
92  * @grp_id: ID of the required mlo group
93  * @tot_socs: Total socs
94  *
95  * Return: None.
96  */
97 void mlo_setup_update_total_socs(uint8_t grp_id, uint8_t tot_socs);
98 
99 /**
100  * mlo_setup_get_total_socs() - API to get total socs for mlo group
101  * @grp_id: ID of the required mlo group
102  *
103  * Return: uint8_t, Number of total socs
104  */
105 uint8_t mlo_setup_get_total_socs(uint8_t grp_id);
106 
107 /**
108  * mlo_setup_update_num_links() - API to update num links in soc for mlo
109  * @soc_id: soc object of SoC corresponding to num_link
110  * @grp_id: ID of the required mlo group
111  * @num_links: Number of links in that soc
112  *
113  * Return: None.
114  */
115 void mlo_setup_update_num_links(struct wlan_objmgr_psoc *psoc,
116 				uint8_t grp_id,
117 				uint8_t num_links);
118 
119 /**
120  * mlo_setup_update_soc_ready() - API to notify when FW init done
121  * @psoc: soc object of SoC ready
122  * @grp_id: ID of the required mlo group
123  *
124  * Return: None.
125  */
126 void mlo_setup_update_soc_ready(struct wlan_objmgr_psoc *psoc, uint8_t grp_id);
127 
128 /**
129  * mlo_setup_link_ready() - API to notify link ready
130  * @pdev: Pointer to pdev object
131  * @grp_id: ID of the required mlo group
132  *
133  * Return: None.
134  */
135 void mlo_setup_link_ready(struct wlan_objmgr_pdev *pdev, uint8_t grp_id);
136 
137 /**
138  * mlo_link_setup_complete() - API to notify setup complete
139  * @pdev: Pointer to pdev object
140  * @grp_id: ID of the required mlo group
141  *
142  * Return: None.
143  */
144 void mlo_link_setup_complete(struct wlan_objmgr_pdev *pdev, uint8_t grp_id);
145 
146 /**
147  * mlo_link_teardown_complete() - API to notify teardown complete
148  * @pdev: Pointer to pdev object
149  * @grp_id: ID of the required mlo group
150  *
151  * Return: None.
152  */
153 void mlo_link_teardown_complete(struct wlan_objmgr_pdev *pdev, uint8_t grp_id);
154 
155 /**
156  * mlo_setup_update_soc_down() - API to check and clear all links and bring
157  *                               back to initial state for the particular soc
158  *
159  * @psoc: Pointer to psoc object
160  * @grp_id: ID of the required mlo group
161  *
162  * Return: None.
163  */
164 void mlo_setup_update_soc_down(struct wlan_objmgr_psoc *psoc, uint8_t grp_id);
165 
166 /**
167  * mlo_link_teardown_link() - API to trigger teardown
168  * @psoc: Pointer to psoc object
169  * @grp_id: ID of the required mlo group
170  * @reason: Reason code for MLO tear down
171  *
172  * Return: QDF_STATUS - success / failure.
173  */
174 QDF_STATUS mlo_link_teardown_link(struct wlan_objmgr_psoc *psoc,
175 				  uint8_t grp_id,
176 				  uint32_t reason);
177 
178 /**
179  * mlo_vdevs_check_single_soc() - API to check all the vaps in vdev list
180  *                                belong to single soc or not
181  * @wlan_vdev_list: List of all vdevs to check
182  * @vdev_count: Number of vdevs in the list
183  *
184  * Return: bool: True if belongs to single soc else false
185  */
186 bool mlo_vdevs_check_single_soc(struct wlan_objmgr_vdev **wlan_vdev_list,
187 				uint8_t vdev_count);
188 
189 /**
190  * mlo_check_all_pdev_state() - API to check all the pdev of the soc
191  *                              are on the same expected state.
192  *
193  * @psoc: Pointer to psoc object
194  * @grp_id: ID of the required mlo group
195  * @state: Expected link state to be verified
196  *
197  * Return: QDF_STATUS: QDF_STATUS_SUCCESS if all belongs to same state
198  */
199 QDF_STATUS mlo_check_all_pdev_state(struct wlan_objmgr_psoc *psoc,
200 				    uint8_t grp_id,
201 				    enum MLO_LINK_STATE state);
202 #else
203 static inline void mlo_setup_init(uint8_t total_grp)
204 {
205 }
206 
207 static inline void mlo_setup_deinit(void)
208 {
209 }
210 
211 static inline bool
212 mlo_vdevs_check_single_soc(struct wlan_objmgr_vdev **wlan_vdev_list,
213 			   uint8_t vdev_count)
214 {
215 	return true;
216 }
217 
218 static inline
219 QDF_STATUS mlo_check_all_pdev_state(struct wlan_objmgr_psoc *psoc,
220 				    uint32_t state)
221 {
222 	return QDF_STATUS_SUCCESS;
223 }
224 
225 static inline
226 bool mlo_psoc_get_grp_id(struct wlan_objmgr_psoc *psoc, uint8_t *grp_id)
227 {
228 	return 0;
229 }
230 #endif /* WLAN_MLO_MULTI_CHIP */
231 #endif /* _WLAN_MLO_MGR_SETUP_H_ */
232