xref: /wlan-driver/qcacld-3.0/core/hdd/src/wlan_hdd_cm_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2024 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_hdd_cm_api.h
20  *
21  * WLAN host device driver connect/disconnect functions declaration
22  */
23 
24 #ifndef __WLAN_HDD_CM_API_H
25 #define __WLAN_HDD_CM_API_H
26 
27 #include <net/cfg80211.h>
28 #include "wlan_cm_public_struct.h"
29 #include "osif_cm_util.h"
30 #include "wlan_cm_roam_ucfg_api.h"
31 
32 /**
33  * wlan_hdd_cm_connect() - cfg80211 connect api
34  * @wiphy: Pointer to wiphy
35  * @ndev: Pointer to network device
36  * @req: Pointer to cfg80211 connect request
37  *
38  * This function is used to issue connect request to connection manager
39  *
40  * Context: Any context.
41  * Return: 0 for success, non-zero for failure
42  */
43 int wlan_hdd_cm_connect(struct wiphy *wiphy,
44 			struct net_device *ndev,
45 			struct cfg80211_connect_params *req);
46 
47 /**
48  * wlan_hdd_cm_issue_disconnect() - initiate disconnect from osif
49  * @link_info: Link info pointer in HDD adapter
50  * @reason: Disconnect reason code
51  * @sync: true if wait for disconnect to complete is required. for the
52  *        supplicant initiated disconnect or during vdev delete/change interface
53  *        sync should be true.
54  *
55  * This function is used to issue disconnect request to connection manager
56  *
57  * Return: QDF_STATUS
58  */
59 QDF_STATUS
60 wlan_hdd_cm_issue_disconnect(struct wlan_hdd_link_info *link_info,
61 			     enum wlan_reason_code reason, bool sync);
62 
63 /**
64  * wlan_hdd_cm_disconnect() - cfg80211 disconnect api
65  * @wiphy: Pointer to wiphy
66  * @dev: Pointer to network device
67  * @reason: Disconnect reason code
68  *
69  * This function is used to issue disconnect request to connection manager
70  *
71  * Return: 0 for success, non-zero for failure
72  */
73 int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
74 			   struct net_device *dev, u16 reason);
75 
76 QDF_STATUS hdd_cm_disconnect_complete(struct wlan_objmgr_vdev *vdev,
77 				      struct wlan_cm_discon_rsp *rsp,
78 				      enum osif_cb_type type);
79 
80 QDF_STATUS hdd_cm_netif_queue_control(struct wlan_objmgr_vdev *vdev,
81 				      enum netif_action_type action,
82 				      enum netif_reason_type reason);
83 
84 #if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
85 /**
86  * hdd_cm_connect_active_notify() - Callback to HDD on  connection request
87  * becomes active.
88  * @vdev_id: VDEV ID on which connection became active.
89  *
90  * The callback to make sure connection related fields are properly set
91  * from HDD.
92  *
93  * Returns: void
94  */
95 void hdd_cm_connect_active_notify(uint8_t vdev_id);
96 #else
hdd_cm_connect_active_notify(uint8_t vdev_id)97 static inline void hdd_cm_connect_active_notify(uint8_t vdev_id)
98 {
99 }
100 #endif
101 QDF_STATUS hdd_cm_connect_complete(struct wlan_objmgr_vdev *vdev,
102 				   struct wlan_cm_connect_resp *rsp,
103 				   enum osif_cb_type type);
104 
105 /**
106  * hdd_cm_send_vdev_keys() - send vdev keys
107  * @vdev: Pointer to vdev
108  * @key_index: key index value
109  * @pairwise: pairwise boolean value
110  * @cipher_type: cipher type enum value
111  *
112  * This function is used to send vdev keys
113  *
114  * Context: Any context.
115  * Return: QDF_STATUS
116  */
117 QDF_STATUS hdd_cm_send_vdev_keys(struct wlan_objmgr_vdev *vdev,
118 				 u8 key_index, bool pairwise,
119 				 enum wlan_crypto_cipher_type cipher_type);
120 
121 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
122 /**
123  * hdd_cm_get_vendor_handoff_params() - to get vendor handoff params from fw
124  * @psoc: Pointer to psoc object
125  * @vendor_handoff_context: Pointer to vendor handoff event rsp
126  *
127  * Return: QDF_STATUS
128  */
129 QDF_STATUS
130 hdd_cm_get_vendor_handoff_params(struct wlan_objmgr_psoc *psoc,
131 				 void *vendor_handoff_context);
132 
133 /**
134  * hdd_cm_get_handoff_param() - send get vendor handoff param request to fw
135  * @psoc: psoc common object
136  * @vdev_id: vdev id
137  * @param_id: param id from enum vendor_control_roam_param
138  *
139  * Return: QDF_STATUS
140  */
141 QDF_STATUS hdd_cm_get_handoff_param(struct wlan_objmgr_psoc *psoc,
142 				    uint8_t vdev_id,
143 				    enum vendor_control_roam_param param_id);
144 #endif
145 
146 /**
147  * hdd_cm_napi_serialize_control() - NAPI serialize hdd cb
148  * @action: serialize or de-serialize NAPI activities
149  *
150  * This function is for napi serialize
151  *
152  * Return: qdf status
153  */
154 QDF_STATUS hdd_cm_napi_serialize_control(bool action);
155 
156 #ifdef WLAN_BOOST_CPU_FREQ_IN_ROAM
157 /**
158  * hdd_cm_perfd_set_cpufreq() - API to set CPU min freq
159  * @action: set or reset the CPU freq
160  *
161  * This function sets/resets the CPU min frequency
162  * by sending netlink msg to cnss-daemon, which will
163  * communicate to perf daemon to set/reset CPU freq.
164  *
165  * Return: qdf status
166  */
167 QDF_STATUS hdd_cm_perfd_set_cpufreq(bool action);
168 #else
169 static inline
hdd_cm_perfd_set_cpufreq(bool action)170 QDF_STATUS hdd_cm_perfd_set_cpufreq(bool action)
171 {
172 	return QDF_STATUS_SUCCESS;
173 }
174 #endif
175 
176 #ifdef WLAN_FEATURE_FILS_SK
177 /**
178  * hdd_cm_save_gtk() - save gtk api
179  * @vdev: Pointer to vdev
180  * @rsp: Pointer to connect rsp
181  *
182  * This function is used to save gtk in legacy mode
183  *
184  * Return: QDF_STATUS
185  */
186 QDF_STATUS hdd_cm_save_gtk(struct wlan_objmgr_vdev *vdev,
187 			   struct wlan_cm_connect_resp *rsp);
188 
189 /**
190  * hdd_cm_set_hlp_data() - api to set hlp data for dhcp
191  * @dev: pointer to net device
192  * @vdev: Pointer to vdev
193  * @rsp: Pointer to connect rsp
194  *
195  * This function is used to set hlp data for dhcp in legacy mode
196  *
197  * Return: QDF_STATUS
198  */
199 QDF_STATUS hdd_cm_set_hlp_data(struct net_device *dev,
200 			       struct wlan_objmgr_vdev *vdev,
201 			       struct wlan_cm_connect_resp *rsp);
202 #endif
203 
204 #ifdef WLAN_FEATURE_PREAUTH_ENABLE
205 /**
206  * hdd_cm_ft_preauth_complete() - send fast transition event
207  * @vdev: Pointer to vdev
208  * @rsp: Pointer to preauth rsp
209  *
210  * This function is used to send fast transition event in legacy mode
211  *
212  * Return: QDF_STATUS
213  */
214 QDF_STATUS hdd_cm_ft_preauth_complete(struct wlan_objmgr_vdev *vdev,
215 				      struct wlan_preauth_rsp *rsp);
216 
217 #ifdef FEATURE_WLAN_ESE
218 /**
219  * hdd_cm_cckm_preauth_complete() - send cckm preauth indication to
220  * the supplicant via wireless custom event
221  * @vdev: Pointer to vdev
222  * @rsp: Pointer to preauth rsp
223  *
224  * This function is used to send cckm preauth indication to
225  * the supplicant via wireless custom event in legacy mode
226  *
227  * Return: QDF_STATUS
228  */
229 QDF_STATUS hdd_cm_cckm_preauth_complete(struct wlan_objmgr_vdev *vdev,
230 					struct wlan_preauth_rsp *rsp);
231 #endif
232 #endif
233 
234 #ifdef WLAN_FEATURE_MSCS
235 /**
236  * reset_mscs_params() - Reset mscs parameters
237  * @link_info: pointer to link_info struct in adapter
238  *
239  * Reset mscs parameters whils disconnection
240  *
241  * Return: None
242  */
243 void reset_mscs_params(struct wlan_hdd_link_info *link_info);
244 #else
245 static inline
reset_mscs_params(struct wlan_hdd_link_info * link_info)246 void reset_mscs_params(struct wlan_hdd_link_info *link_info)
247 {
248 	return;
249 }
250 #endif
251 
252 /**
253  * hdd_handle_disassociation_event() - Handle disassociation event
254  * @link_info: Link info pointer in HDD adapter
255  * @peer_macaddr: Pointer to peer mac address
256  *
257  * Return: None
258  */
259 void hdd_handle_disassociation_event(struct wlan_hdd_link_info *link_info,
260 				     struct qdf_mac_addr *peer_macaddr);
261 
262 /**
263  * __hdd_cm_disconnect_handler_pre_user_update() - Handle disconnect indication
264  * before updating to user space
265  * @link_info: Link info pointer in HDD adapter
266  *
267  * Return: None
268  */
269 void
270 __hdd_cm_disconnect_handler_pre_user_update(struct wlan_hdd_link_info *link_info);
271 
272 /**
273  * __hdd_cm_disconnect_handler_post_user_update() - Handle disconnect indication
274  * after updating to user space
275  * @link_info: Link info pointer in HDD adapter
276  * @vdev: vdev ptr
277  * @source: Disconnect source
278  *
279  * Return: None
280  */
281 void
282 __hdd_cm_disconnect_handler_post_user_update(struct wlan_hdd_link_info *link_info,
283 					     struct wlan_objmgr_vdev *vdev,
284 					     enum wlan_cm_source source);
285 
286 /**
287  * hdd_cm_set_peer_authenticate() - set peer as authenticated
288  * @link_info: Link info pointer in HDD adapter
289  * @bssid: bssid of the connection
290  * @is_auth_required: is upper layer authenticatoin required
291  *
292  * Return: QDF_STATUS enumeration
293  */
294 void hdd_cm_set_peer_authenticate(struct wlan_hdd_link_info *link_info,
295 				  struct qdf_mac_addr *bssid,
296 				  bool is_auth_required);
297 
298 /**
299  * hdd_cm_update_rssi_snr_by_bssid() - update rsi and snr into adapter
300  * @link_info: Link info pointer in HDD adapter
301  *
302  * Return: None
303  */
304 void hdd_cm_update_rssi_snr_by_bssid(struct wlan_hdd_link_info *link_info);
305 
306 /**
307  *  hdd_cm_handle_assoc_event() - Send disassociation indication to oem
308  * app
309  * @vdev: Pointer to adapter
310  * @peer_mac: Pointer to peer mac address
311  *
312  * Return: None
313  */
314 void hdd_cm_handle_assoc_event(struct wlan_objmgr_vdev *vdev,
315 			       uint8_t *peer_mac);
316 
317 /**
318  * hdd_cm_netif_queue_enable() - Enable the network queue for a
319  *			      particular adapter.
320  * @adapter: pointer to the adapter structure
321  *
322  * This function schedules a work to update the netdev features
323  * and enable the network queue if the feature "disable checksum/tso
324  * for legacy connections" is enabled via INI. If not, it will
325  * retain the existing behavior by just enabling the network queues.
326  *
327  * Returns: none
328  */
329 void hdd_cm_netif_queue_enable(struct hdd_adapter *adapter);
330 
331 /**
332  * hdd_cm_clear_pmf_stats() - Clear pmf stats
333  * @adapter: pointer to the adapter structure
334  *
335  * Returns: None
336  */
337 void hdd_cm_clear_pmf_stats(struct hdd_adapter *adapter);
338 
339 /**
340  * hdd_cm_save_connect_status() - Save connect status
341  * @link_info: Link info pointer in HDD adapter
342  * @reason_code: IEE80211 wlan status code
343  *
344  * Returns: None
345  */
346 void hdd_cm_save_connect_status(struct wlan_hdd_link_info *link_info,
347 				uint32_t reason_code);
348 
349 /**
350  * hdd_cm_is_vdev_associated() - Checks if vdev is associated or not
351  * @link_info: pointer to the link info structure
352  *
353  * Returns: True if vdev is associated else false
354  */
355 bool hdd_cm_is_vdev_associated(struct wlan_hdd_link_info *link_info);
356 
357 /**
358  * hdd_cm_is_vdev_connected() - Checks if vdev is connected or not
359  * @link_info: pointer to the link_info structure
360  *
361  * Returns: True if vdev is connected else false
362  */
363 bool hdd_cm_is_vdev_connected(struct wlan_hdd_link_info *link_info);
364 
365 /**
366  * hdd_cm_is_connecting() - Function to check connection in progress
367  * @link_info: pointer to the link_info structure
368  *
369  * Return: true if connecting, false otherwise
370  */
371 bool hdd_cm_is_connecting(struct wlan_hdd_link_info *link_info);
372 
373 /**
374  * hdd_cm_is_disconnected() - Function to check if vdev is disconnected or not
375  * @link_info: pointer to the link_info structure
376  *
377  * Return: true if disconnected, false otherwise
378  */
379 bool hdd_cm_is_disconnected(struct wlan_hdd_link_info *link_info);
380 
381 /**
382  * hdd_cm_is_vdev_roaming() - Function to check roaming in progress
383  * @link_info: pointer to the link_info structure
384  *
385  * Return: true if roaming, false otherwise
386  */
387 bool hdd_cm_is_vdev_roaming(struct wlan_hdd_link_info *link_info);
388 
389 /**
390  * hdd_cm_get_scan_ie_params() - to get scan ie params
391  * @vdev: Pointer to vdev object
392  * @scan_ie: pointer to scan ie element struct
393  * @dot11mode_filter: Pointer to dot11mode_filter enum
394  *
395  * Return: QDF_STATUS
396  */
397 QDF_STATUS
398 hdd_cm_get_scan_ie_params(struct wlan_objmgr_vdev *vdev,
399 			  struct element_info *scan_ie,
400 			  enum dot11_mode_filter *dot11mode_filter);
401 
402 #ifdef WLAN_FEATURE_11BE_MLO
403 /**
404  * hdd_cm_save_connected_links_info() - Update connection info to station
405  * context.
406  * @self_mac: Self MAC address.
407  * @bssid: BSSID of link.
408  * @link_id: IEEE link id.
409  *
410  * It searches for link info pointer matching with @self_mac and updates
411  * the BSSID and link ID fields in station context's connection info.
412  * This will help to retrieve the link information using IEEE link ID or
413  * BSSID thereafter.
414  *
415  * Return: QDF_STATUS
416  */
417 QDF_STATUS hdd_cm_save_connected_links_info(struct qdf_mac_addr *self_mac,
418 					    struct qdf_mac_addr *bssid,
419 					    int32_t link_id);
420 
421 /**
422  * hdd_cm_set_ieee_link_id() - Set IEEE link ID in station context conn info.
423  * @link_info: Link info pointer in HDD adapter
424  * @link_id: IEEE link ID
425  *
426  * Sets IEEE link ID in connection info of @link_info's station context.
427  *
428  * Return: void
429  */
430 void
431 hdd_cm_set_ieee_link_id(struct wlan_hdd_link_info *link_info, uint8_t link_id);
432 
433 /**
434  * hdd_cm_clear_ieee_link_id() - Clear IEEE link ID in station context
435  * conn info.
436  * @link_info: Link info pointer in HDD adapter
437  *
438  * Clear IEEE link ID in connection info of @link_info's station context.
439  *
440  * Return: void
441  */
442 void hdd_cm_clear_ieee_link_id(struct wlan_hdd_link_info *link_info);
443 #else
444 static inline void
hdd_cm_set_ieee_link_id(struct wlan_hdd_link_info * link_info,uint8_t link_id)445 hdd_cm_set_ieee_link_id(struct wlan_hdd_link_info *link_info, uint8_t link_id)
446 {
447 }
448 
449 static inline void
hdd_cm_clear_ieee_link_id(struct wlan_hdd_link_info * link_info)450 hdd_cm_clear_ieee_link_id(struct wlan_hdd_link_info *link_info)
451 {
452 }
453 
454 static inline
hdd_cm_save_connected_links_info(struct qdf_mac_addr * self_mac,struct qdf_mac_addr * bssid,int32_t link_id)455 QDF_STATUS hdd_cm_save_connected_links_info(struct qdf_mac_addr *self_mac,
456 					    struct qdf_mac_addr *bssid,
457 					    int32_t link_id)
458 {
459 	return QDF_STATUS_SUCCESS;
460 }
461 #endif /* WLAN_FEATURE_11BE_MLO */
462 #endif /* __WLAN_HDD_CM_API_H */
463