xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/core/src/reg_host_11d.h (revision ad85c389289a03e320cd08dea21861f9857892fc)
1 /*
2  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: Defines host 11d scan utility functions
21  */
22 #ifndef _REG_HOST_11D_H_
23 #define _REG_HOST_11D_H_
24 
25 #ifdef HOST_11D_SCAN
26 /**
27  * reg_11d_host_scan() - Start/stop 11d scan
28  * @soc_reg: soc regulatory context
29  *
30  * This function gets called upon 11d scan enable/disable changed.
31  *
32  * Return: QDF_STATUS_SUCCESS - in case of success
33  */
34 QDF_STATUS reg_11d_host_scan(struct wlan_regulatory_psoc_priv_obj *soc_reg);
35 
36 /**
37  * reg_11d_host_scan_init() - Init 11d host scan resource
38  * @psoc: soc context
39  *
40  * This function gets called during pdev create notification callback to
41  * init the 11d scan related resource.
42  *
43  * Return: QDF_STATUS_SUCCESS - in case of success
44  */
45 QDF_STATUS reg_11d_host_scan_init(struct wlan_objmgr_psoc *psoc);
46 
47 /**
48  * reg_11d_host_scan_deinit() - Deinit 11d host scan resource
49  * @psoc: soc context
50  *
51  * This function gets called during pdev destroy notification callback to
52  * deinit the 11d scan related resource.
53  *
54  * Return: QDF_STATUS_SUCCESS - in case of success
55  */
56 QDF_STATUS reg_11d_host_scan_deinit(struct wlan_objmgr_psoc *psoc);
57 
58 /**
59  * reg_run_11d_state_machine() - 11d state machine function.
60  * @psoc: soc context
61  */
62 void reg_run_11d_state_machine(struct wlan_objmgr_psoc *psoc);
63 
64 /**
65  * reg_set_11d_country() - Set the 11d regulatory country
66  * @pdev: pdev device for country information
67  * @country: country value
68  *
69  * Return: QDF_STATUS
70  */
71 QDF_STATUS reg_set_11d_country(struct wlan_objmgr_pdev *pdev, uint8_t *country);
72 
73 /**
74  * reg_is_11d_scan_inprogress() - Check 11d scan is supported
75  * @psoc: psoc ptr
76  *
77  * Return: true if 11d scan supported, else false.
78  */
79 bool reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc);
80 
81 /**
82  * reg_save_new_11d_country() - Save the 11d new country
83  * @psoc: psoc for country information
84  * @country: country value
85  *
86  * Return: QDF_STATUS
87  */
88 QDF_STATUS reg_save_new_11d_country(struct wlan_objmgr_psoc *psoc,
89 				    uint8_t *country);
90 
91 /**
92  * reg_is_11d_offloaded() - whether 11d offloaded supported or not
93  * @psoc: psoc ptr
94  *
95  * Return: bool
96  */
97 bool reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc);
98 
99 /**
100  * reg_11d_enabled_on_host() - know whether 11d enabled on host
101  * @psoc: psoc ptr
102  *
103  * Return: bool
104  */
105 bool reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc);
106 
107 /**
108  * reg_11d_vdev_created_update() - vdev obj create callback
109  * @vdev: vdev pointer
110  *
111  * updates 11d state when a vdev is created.
112  *
113  * Return: Success or Failure
114  */
115 QDF_STATUS reg_11d_vdev_created_update(struct wlan_objmgr_vdev *vdev);
116 
117 /**
118  * reg_11d_vdev_delete_update() - update 11d state upon vdev delete
119  * @vdev: vdev pointer
120  *
121  * Return: Success or Failure
122  */
123 QDF_STATUS reg_11d_vdev_delete_update(struct wlan_objmgr_vdev *vdev);
124 
125 /**
126  * reg_set_11d_offloaded() - Set 11d offloaded flag
127  * @psoc: psoc ptr
128  * @val: 11d offloaded value
129  *
130  * Return: QDF_STATUS
131  */
132 QDF_STATUS reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc, bool val);
133 #else
134 
135 static inline QDF_STATUS reg_11d_host_scan(
136 	struct wlan_regulatory_psoc_priv_obj *soc_reg)
137 {
138 	return QDF_STATUS_SUCCESS;
139 }
140 
141 static inline QDF_STATUS reg_11d_host_scan_init(struct wlan_objmgr_psoc *psoc)
142 {
143 	return QDF_STATUS_SUCCESS;
144 }
145 
146 static inline QDF_STATUS reg_11d_host_scan_deinit(struct wlan_objmgr_psoc *psoc)
147 {
148 	return QDF_STATUS_SUCCESS;
149 }
150 
151 static inline void reg_run_11d_state_machine(struct wlan_objmgr_psoc *psoc)
152 {
153 }
154 
155 static inline QDF_STATUS reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
156 					     uint8_t *country)
157 {
158 	return QDF_STATUS_SUCCESS;
159 }
160 
161 static inline bool reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc)
162 {
163 	return false;
164 }
165 
166 static inline QDF_STATUS reg_save_new_11d_country(struct wlan_objmgr_psoc *psoc,
167 						  uint8_t *country)
168 {
169 	return QDF_STATUS_SUCCESS;
170 }
171 
172 static inline bool reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc)
173 {
174 	return false;
175 }
176 
177 static inline bool reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc)
178 {
179 	return false;
180 }
181 
182 static inline QDF_STATUS reg_11d_vdev_delete_update(
183 		struct wlan_objmgr_vdev *vdev)
184 {
185 	return QDF_STATUS_SUCCESS;
186 }
187 
188 static inline QDF_STATUS reg_11d_vdev_created_update(
189 		struct wlan_objmgr_vdev *vdev)
190 {
191 	return QDF_STATUS_SUCCESS;
192 }
193 
194 static inline QDF_STATUS reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc,
195 					       bool val)
196 {
197 	return QDF_STATUS_SUCCESS;
198 }
199 #endif
200 #endif
201