xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_sta.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 STA functionality
19  */
20 #ifndef _WLAN_MLO_MGR_STA_H_
21 #define _WLAN_MLO_MGR_STA_H_
22 
23 #include <wlan_mlo_mgr_public_structs.h>
24 #include <wlan_cm_ucfg_api.h>
25 #include <wlan_objmgr_vdev_obj.h>
26 #ifdef WLAN_FEATURE_11BE_MLO
27 /**
28  * mlo_connect - Start the connection process
29  *
30  * @vdev: pointer to vdev
31  * @req: connection request
32  *
33  * Return: QDF_STATUS
34  */
35 QDF_STATUS mlo_connect(struct wlan_objmgr_vdev *vdev,
36 		       struct wlan_cm_connect_req *req);
37 
38 /**
39  * mlo_sta_link_connect_notify - Called by connection manager to notify the
40  * STA link connect is complete
41  *
42  * @vdev: pointer to vdev
43  * @mlo_ie: MLO information element
44  *
45  * Connection manager will notify the MLO manager when the link has started
46  * and MLO manager will start the subsequent connections, if necessary
47  *
48  * Return: none
49  */
50 void
51 mlo_sta_link_connect_notify(struct wlan_objmgr_vdev *vdev,
52 			    struct wlan_cm_connect_resp *rsp);
53 
54 /**
55  * mlo_disconnect - Start the disconnection process
56  *
57  * @vdev: pointer to vdev
58  * @source: source of the request (can be connect or disconnect request)
59  * @reason_code: reason for disconnect
60  * @bssid: BSSID
61  *
62  * Return: QDF_STATUS
63  */
64 QDF_STATUS mlo_disconnect(struct wlan_objmgr_vdev *vdev,
65 			  enum wlan_cm_source source,
66 			  enum wlan_reason_code reason_code,
67 			  struct qdf_mac_addr *bssid);
68 
69 /**
70  * mlo_sync_disconnect - Start the sync disconnection process
71  *
72  * @vdev: pointer to vdev
73  * @source: source of the request (can be connect or disconnect request)
74  * @reason_code: reason for disconnect
75  * @bssid: BSSID
76  *
77  * Return: QDF_STATUS
78  */
79 QDF_STATUS mlo_sync_disconnect(struct wlan_objmgr_vdev *vdev,
80 			       enum wlan_cm_source source,
81 			       enum wlan_reason_code reason_code,
82 			       struct qdf_mac_addr *bssid);
83 
84 /**
85  * mlo_sta_link_disconn_notify - Notifies that STA link disconnect completion
86  *
87  * @vdev: pointer to vdev
88  * @resp: disconnect resp
89  *
90  * Return: none
91  */
92 void mlo_sta_link_disconn_notify(struct wlan_objmgr_vdev *vdev,
93 				 struct wlan_cm_discon_rsp *resp);
94 
95 /**
96  * mlo_is_mld_sta - Check if MLD associated with the vdev is a station
97  *
98  * @vdev: pointer to vdev
99  *
100  * Return: true if MLD is a station, false otherwise
101  */
102 bool mlo_is_mld_sta(struct wlan_objmgr_vdev *vdev);
103 
104 #ifndef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
105 /**
106  * ucfg_mlo_is_mld_connected - Check whether MLD is connected
107  *
108  * @vdev: pointer to vdev
109  *
110  * Return: true if mld is connected, false otherwise
111  */
112 bool ucfg_mlo_is_mld_connected(struct wlan_objmgr_vdev *vdev);
113 
114 /**
115  * ucfg_mlo_is_mld_disconnected - Check whether MLD is disconnected
116  *
117  * @vdev: pointer to vdev
118  *
119  * Return: true if mld is disconnected, false otherwise
120  */
121 bool ucfg_mlo_is_mld_disconnected(struct wlan_objmgr_vdev *vdev);
122 #endif
123 
124 /*
125  * ucfg_mlo_get_assoc_link_vdev - API to get assoc link vdev
126  *
127  * @mlo_dev_ctx: mlo dev ctx
128  *
129  * Return: MLD assoc link vdev
130  */
131 struct wlan_objmgr_vdev *
132 ucfg_mlo_get_assoc_link_vdev(struct wlan_objmgr_vdev *vdev);
133 
134 /*
135  * API to have operation on ml vdevs
136  */
137 typedef void (*mlo_vdev_op_handler)(struct wlan_objmgr_vdev *vdev,
138 				    void *arg);
139 
140 #ifndef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
141 /*
142  * mlo_iterate_connected_vdev_list: Iterate on connected ML links
143  *
144  * @vdev: vdev object
145  * @handler: the handler will be called for each object in ML list
146  * @arg: argumet to be passed to handler
147  *
148  * Return: none
149  */
150 void mlo_iterate_connected_vdev_list(struct wlan_objmgr_vdev *vdev,
151 				     mlo_vdev_op_handler handler,
152 				     void *arg);
153 
154 /*
155  * mlo_update_connect_req_links: update connect req links index
156  *
157  * @vdev: vdev object
158  * @value: set/clear the bit
159  *
160  * Return: none
161  */
162 void
163 mlo_update_connect_req_links(struct wlan_objmgr_vdev *vdev, uint8_t value);
164 
165 /*
166  * mlo_clear_connect_req_links: clear connect req links bitmap
167  *
168  * @vdev: vdev object
169  *
170  * Return: none
171  */
172 void mlo_clear_connect_req_links_bmap(struct wlan_objmgr_vdev *vdev);
173 
174 /*
175  * mlo_update_connected_links: update connected links index
176  *
177  * @vdev: vdev object
178  * @value: set/clear the bit
179  *
180  * Return: none
181  */
182 void
183 mlo_update_connected_links(struct wlan_objmgr_vdev *vdev, uint8_t value);
184 
185 /*
186  * mlo_clear_connected_links: clear connected links bitmap
187  *
188  * @vdev: vdev object
189  *
190  * Return: none
191  */
192 void mlo_clear_connected_links_bmap(struct wlan_objmgr_vdev *vdev);
193 
194 /*
195  * mlo_get_ml_vdev_by_mac: get ml vdev from mac
196  *
197  * @vdev: vdev object
198  * @macaddr: mac of vdev to be returned
199  *
200  * Return: vdev object if found else NULL
201  */
202 struct wlan_objmgr_vdev *
203 mlo_get_ml_vdev_by_mac(struct wlan_objmgr_vdev *vdev,
204 		       struct qdf_mac_addr *macaddr);
205 #endif
206 
207 /*
208  * mlo_get_chan_freq_by_bssid - Get channel freq by bssid
209  *
210  * @pdev: pdev pointer
211  * @bssid: link mac address
212  *
213  * Return: chan frequency
214  */
215 qdf_freq_t
216 mlo_get_chan_freq_by_bssid(struct wlan_objmgr_pdev *pdev,
217 			   struct qdf_mac_addr *bssid);
218 
219 /**
220  * mlo_get_assoc_rsp - Get Assoc response from mlo manager
221  *
222  * @vdev: vdev obj mgr
223  * @assoc_rsp_frame: association response frame ptr
224  *
225  * Return: none
226  */
227 void mlo_get_assoc_rsp(struct wlan_objmgr_vdev *vdev,
228 		       struct element_info **assoc_rsp_frame);
229 #else
230 static inline
231 QDF_STATUS mlo_connect(struct wlan_objmgr_vdev *vdev,
232 		       struct wlan_cm_connect_req *req)
233 {
234 	return wlan_cm_start_connect(vdev, req);
235 }
236 
237 static inline
238 void mlo_sta_link_connect_notify(struct wlan_objmgr_vdev *vdev,
239 				 struct wlan_cm_connect_resp *rsp)
240 { }
241 
242 static inline
243 QDF_STATUS mlo_disconnect(struct wlan_objmgr_vdev *vdev,
244 			  enum wlan_cm_source source,
245 			  enum wlan_reason_code reason_code,
246 			  struct qdf_mac_addr *bssid)
247 {
248 	QDF_STATUS status;
249 
250 	status = wlan_cm_disconnect(vdev, source,
251 				    reason_code,
252 				    bssid);
253 	return status;
254 }
255 
256 static inline
257 QDF_STATUS mlo_sync_disconnect(struct wlan_objmgr_vdev *vdev,
258 			       enum wlan_cm_source source,
259 			       enum wlan_reason_code reason_code,
260 			       struct qdf_mac_addr *bssid)
261 {
262 	return wlan_cm_disconnect_sync(vdev, CM_OSIF_DISCONNECT,
263 				       reason_code);
264 }
265 
266 static inline
267 void mlo_sta_link_disconn_notify(struct wlan_objmgr_vdev *vdev,
268 				 struct wlan_cm_discon_rsp *resp)
269 { }
270 
271 #ifndef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
272 static inline
273 bool ucfg_mlo_is_mld_connected(struct wlan_objmgr_vdev *vdev)
274 {
275 	return true;
276 }
277 
278 static inline
279 bool ucfg_mlo_is_mld_disconnected(struct wlan_objmgr_vdev *vdev)
280 {
281 	return true;
282 }
283 #endif
284 
285 static inline
286 bool mlo_is_mld_sta(struct wlan_objmgr_vdev *vdev)
287 {
288 	return false;
289 }
290 
291 static inline
292 struct wlan_objmgr_vdev *
293 ucfg_mlo_get_assoc_link_vdev(struct wlan_objmgr_vdev *vdev)
294 {
295 	return vdev;
296 }
297 
298 static inline void
299 mlo_update_connect_req_links(struct wlan_objmgr_vdev *vdev, uint8_t value)
300 { }
301 
302 static inline void
303 mlo_update_connected_links(struct wlan_objmgr_vdev *vdev, uint8_t value)
304 { }
305 
306 static inline void
307 mlo_clear_connect_req_links_bmap(struct wlan_objmgr_vdev *vdev)
308 { }
309 
310 static inline void
311 mlo_clear_connected_links_bmap(struct wlan_objmgr_vdev *vdev)
312 { }
313 
314 static inline struct wlan_objmgr_vdev *
315 mlo_get_ml_vdev_by_mac(struct wlan_objmgr_vdev *vdev,
316 		       struct qdf_mac_addr *macaddr)
317 {
318 	return vdev;
319 }
320 
321 static inline qdf_freq_t
322 mlo_get_chan_freq_by_bssid(struct wlan_objmgr_pdev *pdev,
323 			   struct qdf_mac_addr *bssid)
324 {
325 	return 0;
326 }
327 
328 static inline void
329 mlo_get_assoc_rsp(struct wlan_objmgr_vdev *vdev,
330 		  struct element_info **assoc_rsp_frame)
331 {
332 }
333 #endif
334 #endif
335