xref: /wlan-driver/qca-wifi-host-cmn/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_ucfg_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012-2015, 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.c
20  *
21  * This file maintains definitaions public ucfg apis.
22  */
23 
24 #include <wlan_cm_ucfg_api.h>
25 #include "connection_mgr/core/src/wlan_cm_main_api.h"
26 #include <wlan_reg_services_api.h>
27 
ucfg_cm_start_connect(struct wlan_objmgr_vdev * vdev,struct wlan_cm_connect_req * req)28 QDF_STATUS ucfg_cm_start_connect(struct wlan_objmgr_vdev *vdev,
29 				 struct wlan_cm_connect_req *req)
30 {
31 	return cm_connect_start_req(vdev, req);
32 }
33 
ucfg_cm_start_disconnect(struct wlan_objmgr_vdev * vdev,struct wlan_cm_disconnect_req * req)34 QDF_STATUS ucfg_cm_start_disconnect(struct wlan_objmgr_vdev *vdev,
35 				    struct wlan_cm_disconnect_req *req)
36 {
37 	return cm_disconnect_start_req(vdev, req);
38 }
39 
ucfg_cm_disconnect_sync(struct wlan_objmgr_vdev * vdev,enum wlan_cm_source source,enum wlan_reason_code reason_code)40 QDF_STATUS ucfg_cm_disconnect_sync(struct wlan_objmgr_vdev *vdev,
41 				   enum wlan_cm_source source,
42 				   enum wlan_reason_code reason_code)
43 {
44 	return wlan_cm_disconnect_sync(vdev, source, reason_code);
45 }
46 
ucfg_cm_is_vdev_connecting(struct wlan_objmgr_vdev * vdev)47 bool ucfg_cm_is_vdev_connecting(struct wlan_objmgr_vdev *vdev)
48 {
49 	return cm_is_vdev_connecting(vdev);
50 }
51 
ucfg_cm_is_vdev_connected(struct wlan_objmgr_vdev * vdev)52 bool ucfg_cm_is_vdev_connected(struct wlan_objmgr_vdev *vdev)
53 {
54 	return cm_is_vdev_connected(vdev);
55 }
56 
ucfg_cm_is_vdev_active(struct wlan_objmgr_vdev * vdev)57 bool ucfg_cm_is_vdev_active(struct wlan_objmgr_vdev *vdev)
58 {
59 	return cm_is_vdev_active(vdev);
60 }
61 
ucfg_cm_is_vdev_disconnecting(struct wlan_objmgr_vdev * vdev)62 bool ucfg_cm_is_vdev_disconnecting(struct wlan_objmgr_vdev *vdev)
63 {
64 	return cm_is_vdev_disconnecting(vdev);
65 }
66 
ucfg_cm_is_vdev_disconnected(struct wlan_objmgr_vdev * vdev)67 bool ucfg_cm_is_vdev_disconnected(struct wlan_objmgr_vdev *vdev)
68 {
69 	return cm_is_vdev_disconnected(vdev);
70 }
71 
ucfg_cm_is_vdev_roaming(struct wlan_objmgr_vdev * vdev)72 bool ucfg_cm_is_vdev_roaming(struct wlan_objmgr_vdev *vdev)
73 {
74 	return cm_is_vdev_roaming(vdev);
75 }
76 
ucfg_cm_free_wep_key_params(struct wlan_cm_connect_req * req)77 void ucfg_cm_free_wep_key_params(struct wlan_cm_connect_req *req)
78 {
79 	cm_free_wep_key_params(req);
80 }
81 
ucfg_cm_free_connect_req(struct wlan_cm_connect_req * req)82 void ucfg_cm_free_connect_req(struct wlan_cm_connect_req *req)
83 {
84 	cm_free_connect_req(req);
85 }
86 
87 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
ucfg_cm_is_vdev_roam_started(struct wlan_objmgr_vdev * vdev)88 bool ucfg_cm_is_vdev_roam_started(struct wlan_objmgr_vdev *vdev)
89 {
90 	return cm_is_vdev_roam_started(vdev);
91 }
92 
ucfg_cm_is_vdev_roam_sync_inprogress(struct wlan_objmgr_vdev * vdev)93 bool ucfg_cm_is_vdev_roam_sync_inprogress(struct wlan_objmgr_vdev *vdev)
94 {
95 	return cm_is_vdev_roam_sync_inprogress(vdev);
96 }
97 #endif
98 
99 #ifdef WLAN_FEATURE_HOST_ROAM
ucfg_cm_is_vdev_roam_preauth_state(struct wlan_objmgr_vdev * vdev)100 bool ucfg_cm_is_vdev_roam_preauth_state(struct wlan_objmgr_vdev *vdev)
101 {
102 	return cm_is_vdev_roam_preauth_state(vdev);
103 }
104 
ucfg_cm_is_vdev_roam_reassoc_state(struct wlan_objmgr_vdev * vdev)105 bool ucfg_cm_is_vdev_roam_reassoc_state(struct wlan_objmgr_vdev *vdev)
106 {
107 	return cm_is_vdev_roam_reassoc_state(vdev);
108 }
109 #endif
110 
ucfg_cm_get_connected_band(struct wlan_objmgr_vdev * vdev)111 enum band_info ucfg_cm_get_connected_band(struct wlan_objmgr_vdev *vdev)
112 {
113 	struct wlan_channel *bss_chan;
114 	uint32_t sta_freq = 0;
115 
116 	if (cm_is_vdev_connected(vdev)) {
117 		bss_chan = wlan_vdev_mlme_get_bss_chan(vdev);
118 		sta_freq = bss_chan->ch_freq;
119 	}
120 
121 	if (wlan_reg_is_24ghz_ch_freq(sta_freq))
122 		return BAND_2G;
123 	else if (wlan_reg_is_5ghz_ch_freq(sta_freq) ||
124 		 wlan_reg_is_6ghz_chan_freq(sta_freq))
125 		/* BAND_5G covers 6 GHz frequencies as well */
126 		return BAND_5G;
127 	else	/* If station is not connected return as BAND_ALL */
128 		return BAND_ALL;
129 }
130 
ucfg_cm_is_link_switch_disconnect_resp(struct wlan_cm_discon_rsp * resp)131 bool ucfg_cm_is_link_switch_disconnect_resp(struct wlan_cm_discon_rsp *resp)
132 {
133 	return cm_is_link_switch_disconnect_resp(resp);
134 }
135 
ucfg_cm_is_link_switch_connect_resp(struct wlan_cm_connect_resp * resp)136 bool ucfg_cm_is_link_switch_connect_resp(struct wlan_cm_connect_resp *resp)
137 {
138 	return cm_is_link_switch_connect_resp(resp);
139 }
140