1 /*
2 * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18 /**
19 * DOC: wlan_cm_ucfg_api.h
20 *
21 * This file maintains declarations of public ucfg apis
22 */
23
24 #ifndef __WLAN_CM_UCFG_API_H
25 #define __WLAN_CM_UCFG_API_H
26
27 #include <wlan_cm_api.h>
28
29 /**
30 * ucfg_cm_start_connect() - connect start request
31 * @vdev: vdev pointer
32 * @req: connect req
33 *
34 * Return: QDF_STATUS
35 */
36 QDF_STATUS ucfg_cm_start_connect(struct wlan_objmgr_vdev *vdev,
37 struct wlan_cm_connect_req *req);
38
39 /**
40 * ucfg_cm_start_disconnect() - disconnect start request
41 * @vdev: vdev pointer
42 * @req: disconnect req
43 *
44 * Return: QDF_STATUS
45 */
46 QDF_STATUS ucfg_cm_start_disconnect(struct wlan_objmgr_vdev *vdev,
47 struct wlan_cm_disconnect_req *req);
48
49 /**
50 * ucfg_cm_disconnect_sync() - disconnect request with wait till
51 * completed
52 * @vdev: vdev pointer
53 * @source: disconnect source
54 * @reason_code: disconnect reason
55 *
56 * Context: Only call for north bound disconnect req, if wait till complete
57 * is required, e.g. during vdev delete. Do not call from scheduler context.
58 *
59 * Return: QDF_STATUS
60 */
61 QDF_STATUS ucfg_cm_disconnect_sync(struct wlan_objmgr_vdev *vdev,
62 enum wlan_cm_source source,
63 enum wlan_reason_code reason_code);
64
65 /**
66 * ucfg_cm_is_vdev_connecting() - check if vdev is in conneting state
67 * @vdev: vdev pointer
68 *
69 * Return: bool
70 */
71 bool ucfg_cm_is_vdev_connecting(struct wlan_objmgr_vdev *vdev);
72
73 /**
74 * ucfg_cm_is_vdev_connected() - check if vdev is in conneted state
75 * @vdev: vdev pointer
76 *
77 * Return: bool
78 */
79 bool ucfg_cm_is_vdev_connected(struct wlan_objmgr_vdev *vdev);
80
81 /**
82 * ucfg_cm_is_vdev_active() - check if vdev is in active state ie conneted or
83 * roaming state
84 * @vdev: vdev pointer
85 *
86 * Return: bool
87 */
88 bool ucfg_cm_is_vdev_active(struct wlan_objmgr_vdev *vdev);
89
90 /**
91 * ucfg_cm_is_vdev_disconnecting() - check if vdev is in disconnecting state
92 * @vdev: vdev pointer
93 *
94 * Return: bool
95 */
96 bool ucfg_cm_is_vdev_disconnecting(struct wlan_objmgr_vdev *vdev);
97
98 /**
99 * ucfg_cm_is_vdev_disconnected() - check if vdev is disconnected/init state
100 * @vdev: vdev pointer
101 *
102 * Return: bool
103 */
104 bool ucfg_cm_is_vdev_disconnected(struct wlan_objmgr_vdev *vdev);
105
106 /**
107 * ucfg_cm_is_vdev_roaming() - check if vdev is in roaming state
108 * @vdev: vdev pointer
109 *
110 * Return: bool
111 */
112 bool ucfg_cm_is_vdev_roaming(struct wlan_objmgr_vdev *vdev);
113
114 /**
115 * ucfg_cm_free_wep_key_params() - free up connect request wep key params
116 * sub memory
117 * @req: connect req
118 *
119 * Return: void
120 */
121 void ucfg_cm_free_wep_key_params(struct wlan_cm_connect_req *req);
122
123 /**
124 * ucfg_cm_free_connect_req() - free up connect request and its sub memory.
125 * @req: connect req
126 *
127 * Return: void
128 */
129 void ucfg_cm_free_connect_req(struct wlan_cm_connect_req *req);
130
131 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
132 /**
133 * ucfg_cm_is_vdev_roam_started() - check if vdev is in roaming state and
134 * roam started sub stated
135 * @vdev: vdev pointer
136 *
137 * Return: bool
138 */
139 bool ucfg_cm_is_vdev_roam_started(struct wlan_objmgr_vdev *vdev);
140
141 /**
142 * ucfg_cm_is_vdev_roam_sync_inprogress() - check if vdev is in roaming state
143 * and roam sync substate
144 * @vdev: vdev pointer
145 *
146 * Return: bool
147 */
148 bool ucfg_cm_is_vdev_roam_sync_inprogress(struct wlan_objmgr_vdev *vdev);
149 #else
ucfg_cm_is_vdev_roam_started(struct wlan_objmgr_vdev * vdev)150 static inline bool ucfg_cm_is_vdev_roam_started(struct wlan_objmgr_vdev *vdev)
151 {
152 return false;
153 }
154
155 static inline
ucfg_cm_is_vdev_roam_sync_inprogress(struct wlan_objmgr_vdev * vdev)156 bool ucfg_cm_is_vdev_roam_sync_inprogress(struct wlan_objmgr_vdev *vdev)
157 {
158 return false;
159 }
160 #endif
161
162 #ifdef WLAN_FEATURE_HOST_ROAM
163 /**
164 * ucfg_cm_is_vdev_roam_preauth_state() - check if vdev is in roaming state and
165 * preauth is in progress
166 * @vdev: vdev pointer
167 *
168 * Return: bool
169 */
170 bool ucfg_cm_is_vdev_roam_preauth_state(struct wlan_objmgr_vdev *vdev);
171
172 /**
173 * ucfg_cm_is_vdev_roam_reassoc_state() - check if vdev is in roaming state
174 * and reassoc is in progress
175 * @vdev: vdev pointer
176 *
177 * Return: bool
178 */
179 bool ucfg_cm_is_vdev_roam_reassoc_state(struct wlan_objmgr_vdev *vdev);
180 #else
181 static inline
ucfg_cm_is_vdev_roam_preauth_state(struct wlan_objmgr_vdev * vdev)182 bool ucfg_cm_is_vdev_roam_preauth_state(struct wlan_objmgr_vdev *vdev)
183 {
184 return false;
185 }
186
187 static inline
ucfg_cm_is_vdev_roam_reassoc_state(struct wlan_objmgr_vdev * vdev)188 bool ucfg_cm_is_vdev_roam_reassoc_state(struct wlan_objmgr_vdev *vdev)
189 {
190 return false;
191 }
192 #endif
193
194 /**
195 * ucfg_cm_reason_code_to_str() - return string conversion of reason code
196 * @reason: reason code.
197 *
198 * This utility function helps log string conversion of reason code.
199 *
200 * Return: string conversion of reason code, if match found;
201 * "Unknown" otherwise.
202 */
203 static inline
ucfg_cm_reason_code_to_str(enum wlan_reason_code reason)204 const char *ucfg_cm_reason_code_to_str(enum wlan_reason_code reason)
205 {
206 return wlan_cm_reason_code_to_str(reason);
207 }
208
209 /**
210 * ucfg_cm_get_connected_band() - Get the connected band information
211 * @vdev: vdev to get the band for connected band
212 *
213 * Return: enum band_info
214 */
215 enum band_info ucfg_cm_get_connected_band(struct wlan_objmgr_vdev *vdev);
216
217 /**
218 * ucfg_cm_is_link_switch_disconnect_resp() - Check if the disconnect response
219 * is for link switch request.
220 * @resp: Connection manager disconnect response.
221 *
222 * Return: bool
223 */
224 bool ucfg_cm_is_link_switch_disconnect_resp(struct wlan_cm_discon_rsp *resp);
225
226 /**
227 * ucfg_cm_is_link_switch_connect_resp() - Check if the connect response if for
228 * link switch request.
229 * @resp: Connection manager connect response.
230 *
231 * Return: bool
232 */
233 bool ucfg_cm_is_link_switch_connect_resp(struct wlan_cm_connect_resp *resp);
234 #endif /* __WLAN_CM_UCFG_API_H */
235