xref: /wlan-driver/qcacld-3.0/components/denylist_mgr/dispatcher/inc/wlan_dlm_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 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 public APIs exposed by the denylist manager component
21  */
22 
23 #ifndef _WLAN_DLM_API_H_
24 #define _WLAN_DLM_API_H_
25 
26 #include "qdf_types.h"
27 #include "wlan_objmgr_pdev_obj.h"
28 #include <wlan_dlm_public_struct.h>
29 
30 #ifdef FEATURE_DENYLIST_MGR
31 #include "wlan_dlm_core.h"
32 
33 /**
34  * wlan_dlm_add_bssid_to_reject_list() - Add BSSID to the specific reject list.
35  * @pdev: Pdev object
36  * @ap_info: Ap info params such as BSSID, and the type of rejection to be done
37  *
38  * This API will add the BSSID to the reject AP list maintained by the denylist
39  * manager.
40  */
41 static inline QDF_STATUS
wlan_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev * pdev,struct reject_ap_info * ap_info)42 wlan_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
43 				  struct reject_ap_info *ap_info)
44 {
45 	return dlm_add_bssid_to_reject_list(pdev, ap_info);
46 }
47 
48 /**
49  * wlan_dlm_update_bssid_connect_params() - Inform the DLM about connect or
50  * disconnect with the current AP.
51  * @pdev: pdev object
52  * @bssid: BSSID of the AP
53  * @con_state: Connection state (connected/disconnected)
54  *
55  * This API will inform the DLM about the state with the AP so that if the AP
56  * is selected, and the connection went through, and the connection did not
57  * face any data stall till the bad bssid reset timer, DLM can remove the
58  * AP from the reject ap list maintained by it.
59  *
60  * Return: None
61  */
62 static inline void
wlan_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev * pdev,struct qdf_mac_addr bssid,enum dlm_connection_state con_state)63 wlan_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
64 				     struct qdf_mac_addr bssid,
65 				     enum dlm_connection_state con_state)
66 {
67 	return dlm_update_bssid_connect_params(pdev, bssid, con_state);
68 }
69 
70 /**
71  * wlan_dlm_get_bssid_reject_list() - Get the BSSIDs in reject list from DLM
72  * @pdev: pdev object
73  * @reject_list: reject list to be filled (passed by caller)
74  * @max_bssid_to_be_filled: num of bssids filled in reject list by DLM
75  * @reject_ap_type: reject ap type of the BSSIDs to be filled.
76  *
77  * This API is a wrapper to an API of denylist manager which will fill the
78  * reject ap list requested by caller of type given as argument reject_ap_type,
79  * and will return the number of BSSIDs filled.
80  *
81  * Return: Unsigned integer (number of BSSIDs filled by the denylist manager)
82  */
83 static inline uint8_t
wlan_dlm_get_bssid_reject_list(struct wlan_objmgr_pdev * pdev,struct reject_ap_config_params * reject_list,uint8_t max_bssid_to_be_filled,enum dlm_reject_ap_type reject_ap_type)84 wlan_dlm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev,
85 			       struct reject_ap_config_params *reject_list,
86 			       uint8_t max_bssid_to_be_filled,
87 			       enum dlm_reject_ap_type reject_ap_type)
88 {
89 	return dlm_get_bssid_reject_list(pdev, reject_list,
90 					 max_bssid_to_be_filled,
91 					 reject_ap_type);
92 }
93 
94 /**
95  * wlan_dlm_is_bssid_in_reject_list() - Check whether a BSSID is present in
96  * reject list or not
97  * @pdev: pdev object
98  * @bssid: bssid to check
99  *
100  * Return: true if BSSID is present in reject list
101  */
102 static inline bool
wlan_dlm_is_bssid_in_reject_list(struct wlan_objmgr_pdev * pdev,struct qdf_mac_addr * bssid)103 wlan_dlm_is_bssid_in_reject_list(struct wlan_objmgr_pdev *pdev,
104 				 struct qdf_mac_addr *bssid)
105 {
106 	return dlm_is_bssid_in_reject_list(pdev, bssid);
107 }
108 
109 /**
110  * wlan_dlm_dump_denylist_bssid() - dump the denylisted BSSIDs from DLM
111  * @pdev: pdev object
112  *
113  * Return: None
114  */
115 static inline void
wlan_dlm_dump_denylist_bssid(struct wlan_objmgr_pdev * pdev)116 wlan_dlm_dump_denylist_bssid(struct wlan_objmgr_pdev *pdev)
117 {
118 	return dlm_dump_denylist_bssid(pdev);
119 }
120 
121 /**
122  * wlan_dlm_get_rssi_denylist_threshold() - Get the RSSI denylist threshold
123  * @pdev: pdev object
124  *
125  * This API will get the rssi denylist threshold value configured via
126  * CFG_DENYLIST_RSSI_THRESHOLD.
127  *
128  * Return: int32_t (threshold value)
129  */
130 static inline int32_t
wlan_dlm_get_rssi_denylist_threshold(struct wlan_objmgr_pdev * pdev)131 wlan_dlm_get_rssi_denylist_threshold(struct wlan_objmgr_pdev *pdev)
132 {
133 	return dlm_get_rssi_denylist_threshold(pdev);
134 }
135 
136 #else
137 static inline bool
wlan_dlm_is_bssid_in_reject_list(struct wlan_objmgr_pdev * pdev,struct qdf_mac_addr * bssid)138 wlan_dlm_is_bssid_in_reject_list(struct wlan_objmgr_pdev *pdev,
139 				 struct qdf_mac_addr *bssid)
140 {
141 	return false;
142 }
143 
144 static inline QDF_STATUS
wlan_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev * pdev,struct reject_ap_info * ap_info)145 wlan_dlm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev,
146 				  struct reject_ap_info *ap_info)
147 {
148 	return QDF_STATUS_SUCCESS;
149 }
150 
151 static inline uint8_t
wlan_dlm_get_bssid_reject_list(struct wlan_objmgr_pdev * pdev,struct reject_ap_config_params * reject_list,uint8_t max_bssid_to_be_filled,enum dlm_reject_ap_type reject_ap_type)152 wlan_dlm_get_bssid_reject_list(struct wlan_objmgr_pdev *pdev,
153 			       struct reject_ap_config_params *reject_list,
154 			       uint8_t max_bssid_to_be_filled,
155 			       enum dlm_reject_ap_type reject_ap_type)
156 {
157 	return 0;
158 }
159 
160 static inline void
wlan_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev * pdev,struct qdf_mac_addr bssid,enum dlm_connection_state con_state)161 wlan_dlm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev,
162 				     struct qdf_mac_addr bssid,
163 				     enum dlm_connection_state con_state)
164 {
165 }
166 
167 static inline int32_t
wlan_dlm_get_rssi_denylist_threshold(struct wlan_objmgr_pdev * pdev)168 wlan_dlm_get_rssi_denylist_threshold(struct wlan_objmgr_pdev *pdev)
169 {
170 	return 0;
171 }
172 #endif
173 #endif
174