xref: /wlan-driver/qcacld-3.0/components/denylist_mgr/dispatcher/inc/wlan_dlm_ucfg_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 /**
20  * DOC: declare UCFG APIs exposed by the denylist manager component
21  */
22 
23 #ifndef _WLAN_DLM_UCFG_H_
24 #define _WLAN_DLM_UCFG_H_
25 
26 #include "qdf_types.h"
27 #include "wlan_objmgr_psoc_obj.h"
28 #include <wlan_dlm_public_struct.h>
29 
30 #ifdef FEATURE_DENYLIST_MGR
31 
32 /**
33  * ucfg_dlm_init() - initialize denylist mgr context
34  *
35  * This function initializes the denylist mgr context
36  *
37  * Return: QDF_STATUS_SUCCESS - in case of success else return error
38  */
39 QDF_STATUS ucfg_dlm_init(void);
40 
41 /**
42  * ucfg_dlm_deinit() - De initialize denylist mgr context
43  *
44  * This function De initializes denylist mgr context
45  *
46  * Return: QDF_STATUS_SUCCESS - in case of success else return error
47  */
48 QDF_STATUS ucfg_dlm_deinit(void);
49 
50 /**
51  * ucfg_dlm_psoc_set_suspended() - API to set denylist mgr state suspended
52  * @psoc: pointer to psoc object
53  * @state: state to be set
54  *
55  * This function sets denylist mgr state to suspended
56  *
57  * Return: QDF_STATUS_SUCCESS - in case of success else return error
58  */
59 QDF_STATUS ucfg_dlm_psoc_set_suspended(struct wlan_objmgr_psoc *psoc,
60 				       bool state);
61 
62 /**
63  * ucfg_dlm_psoc_get_suspended() - API to get denylist mgr state suspended
64  * @psoc: pointer to psoc object
65  * @state: pointer to get suspend state of denylist manager
66  *
67  * Return: QDF_STATUS_SUCCESS - in case of success else return error
68  */
69 QDF_STATUS ucfg_dlm_psoc_get_suspended(struct wlan_objmgr_psoc *psoc,
70 				       bool *state);
71 
72 /**
73  * ucfg_dlm_psoc_open() - API to initialize the cfg when psoc is initialized.
74  * @psoc: psoc object
75  *
76  * This function initializes the config of denylist mgr.
77  *
78  * Return: QDF_STATUS_SUCCESS - in case of success else return error
79  */
80 QDF_STATUS ucfg_dlm_psoc_open(struct wlan_objmgr_psoc *psoc);
81 
82 /**
83  * ucfg_dlm_psoc_close() - API to deinit the dlm when psoc is deinitialized.
84  * @psoc: psoc object
85  *
86  * This function deinits the dlm psoc object.
87  *
88  * Return: QDF_STATUS_SUCCESS - in case of success else return error
89  */
90 QDF_STATUS ucfg_dlm_psoc_close(struct wlan_objmgr_psoc *psoc);
91 
92 /**
93  * ucfg_dlm_add_userspace_deny_list() - Clear already existing userspace BSSID,
94  * and add the new ones to denylist manager.
95  * @pdev: pdev object
96  * @bssid_deny_list: BSSIDs to be denylisted by userspace.
97  * @num_of_bssid: num of bssids to be denylisted.
98  *
99  * This API clear already existing userspace BSSID, and add the new ones to
100  * denylist manager
101  *
102  * Return: QDF_STATUS_SUCCESS - in case of success else return error.
103  */
104 QDF_STATUS
105 ucfg_dlm_add_userspace_deny_list(struct wlan_objmgr_pdev *pdev,
106 				 struct qdf_mac_addr *bssid_deny_list,
107 				 uint8_t num_of_bssid);
108 
109 /**
110  * ucfg_dlm_dump_deny_list_ap() - get denylisted bssid.
111  * @pdev: pdev object
112  *
113  * This API dumps denylist ap
114  *
115  * Return: None
116  */
117 void ucfg_dlm_dump_deny_list_ap(struct wlan_objmgr_pdev *pdev);
118 
119 /**
120  * ucfg_dlm_update_bssid_connect_params() - Inform the DLM about connect or
121  * disconnect with the current AP.
122  * @pdev: pdev object
123  * @bssid: BSSID of the AP
124  * @con_state: Connection state (connected/disconnected)
125  *
126  * This API will inform the DLM about the state with the AP so that if the AP
127  * is selected, and the connection went through, and the connection did not
128  * face any data stall till the bad bssid reset timer, DLM can remove the
129  * AP from the reject ap list maintained by it.
130  *
131  * Return: None
132  */
133 void
134 ucfg_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
135 				     struct qdf_mac_addr bssid,
136 				     enum dlm_connection_state con_state);
137 
138 /**
139  * ucfg_dlm_add_bssid_to_reject_list() - Add BSSID to the specific reject list.
140  * @pdev: Pdev object
141  * @ap_info: Ap info params such as BSSID, and the type of rejection to be done
142  *
143  * This API will add the BSSID to the reject AP list maintained by the denylist
144  * manager.
145  *
146  * Return: QDF_STATUS_SUCCESS - in case of success else return error.
147  */
148 QDF_STATUS
149 ucfg_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
150 				  struct reject_ap_info *ap_info);
151 
152 /**
153  * ucfg_dlm_wifi_off() - Inform the denylist manager about wifi off
154  * @pdev: Pdev object
155  *
156  * This API will inform the denylist manager that the user has turned wifi off
157  * from the UI, and the denylist manager can take action based upon this.
158  *
159  * Return: None
160  */
161 void
162 ucfg_dlm_wifi_off(struct wlan_objmgr_pdev *pdev);
163 
164 #else
165 static inline
ucfg_dlm_init(void)166 QDF_STATUS ucfg_dlm_init(void)
167 {
168 	return QDF_STATUS_SUCCESS;
169 }
170 
171 static inline
ucfg_dlm_deinit(void)172 QDF_STATUS ucfg_dlm_deinit(void)
173 {
174 	return QDF_STATUS_SUCCESS;
175 }
176 
177 static inline
ucfg_dlm_psoc_open(struct wlan_objmgr_psoc * psoc)178 QDF_STATUS ucfg_dlm_psoc_open(struct wlan_objmgr_psoc *psoc)
179 {
180 	return QDF_STATUS_SUCCESS;
181 }
182 
183 static inline
ucfg_dlm_psoc_close(struct wlan_objmgr_psoc * psoc)184 QDF_STATUS ucfg_dlm_psoc_close(struct wlan_objmgr_psoc *psoc)
185 {
186 	return QDF_STATUS_SUCCESS;
187 }
188 
189 static inline
ucfg_dlm_dump_deny_list_ap(struct wlan_objmgr_pdev * pdev)190 void ucfg_dlm_dump_deny_list_ap(struct wlan_objmgr_pdev *pdev)
191 {}
192 
193 static inline
194 QDF_STATUS
ucfg_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev * pdev,struct reject_ap_info * ap_info)195 ucfg_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
196 				  struct reject_ap_info *ap_info)
197 {
198 	return QDF_STATUS_SUCCESS;
199 }
200 
201 static inline QDF_STATUS
ucfg_dlm_add_userspace_deny_list(struct wlan_objmgr_pdev * pdev,struct qdf_mac_addr * bssid_deny_list,uint8_t num_of_bssid)202 ucfg_dlm_add_userspace_deny_list(struct wlan_objmgr_pdev *pdev,
203 				 struct qdf_mac_addr *bssid_deny_list,
204 				 uint8_t num_of_bssid)
205 {
206 	return QDF_STATUS_SUCCESS;
207 }
208 
209 static inline void
ucfg_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev * pdev,struct qdf_mac_addr bssid,enum dlm_connection_state con_state)210 ucfg_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
211 				     struct qdf_mac_addr bssid,
212 				     enum dlm_connection_state con_state)
213 {
214 }
215 
216 static inline
ucfg_dlm_wifi_off(struct wlan_objmgr_pdev * pdev)217 void ucfg_dlm_wifi_off(struct wlan_objmgr_pdev *pdev)
218 {
219 }
220 
221 #endif
222 #endif /* _WLAN_DLM_UCFG_H_ */
223