1 /*
2 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
3 * Copyright (c) 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 /**
21 * DOC: Add 11d utility functions
22 */
23
24 #ifdef TARGET_11D_SCAN
25 /**
26 * reg_run_11d_state_machine() - 11d state machine function.
27 * @psoc: soc context
28 */
29 void reg_run_11d_state_machine(struct wlan_objmgr_psoc *psoc);
30
31 /**
32 * reg_set_11d_country() - Set the 11d regulatory country
33 * @pdev: pdev device for country information
34 * @country: country value
35 *
36 * Return: QDF_STATUS
37 */
38 QDF_STATUS reg_set_11d_country(struct wlan_objmgr_pdev *pdev, uint8_t *country);
39
40 /**
41 * reg_is_11d_scan_inprogress() - Check 11d scan is supported
42 * @psoc: psoc ptr
43 *
44 * Return: true if 11d scan supported, else false.
45 */
46 bool reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc);
47
48 /**
49 * reg_save_new_11d_country() - Save the 11d new country
50 * @psoc: psoc for country information
51 * @country: country value
52 *
53 * Return: QDF_STATUS
54 */
55 QDF_STATUS reg_save_new_11d_country(struct wlan_objmgr_psoc *psoc,
56 uint8_t *country);
57
58 /**
59 * reg_is_11d_offloaded() - whether 11d offloaded supported or not
60 * @psoc: psoc ptr
61 *
62 * Return: bool
63 */
64 bool reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc);
65
66 /**
67 * reg_11d_enabled_on_host() - know whether 11d enabled on host
68 * @psoc: psoc ptr
69 *
70 * Return: bool
71 */
72 bool reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc);
73
74 /**
75 * reg_11d_vdev_created_update() - vdev obj create callback
76 * @vdev: vdev pointer
77 *
78 * updates 11d state when a vdev is created.
79 *
80 * Return: Success or Failure
81 */
82 QDF_STATUS reg_11d_vdev_created_update(struct wlan_objmgr_vdev *vdev);
83
84 /**
85 * reg_11d_vdev_delete_update() - update 11d state upon vdev delete
86 * @psoc: psoc pointer
87 * @op_mode: Operating mode of the deleted vdev
88 * @vdev_id: Vdev id of the deleted vdev
89 *
90 * Return: Success or Failure
91 */
92 QDF_STATUS reg_11d_vdev_delete_update(struct wlan_objmgr_psoc *psoc,
93 enum QDF_OPMODE op_mode,
94 uint32_t vdev_id);
95
96
97 /**
98 * reg_set_11d_offloaded() - Set 11d offloaded flag
99 * @psoc: psoc ptr
100 * @val: 11d offloaded value
101 *
102 * Return: QDF_STATUS
103 */
104 QDF_STATUS reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc, bool val);
105
106 #else
107
reg_run_11d_state_machine(struct wlan_objmgr_psoc * psoc)108 static inline void reg_run_11d_state_machine(struct wlan_objmgr_psoc *psoc)
109 {
110 }
111
reg_set_11d_country(struct wlan_objmgr_pdev * pdev,uint8_t * country)112 static inline QDF_STATUS reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
113 uint8_t *country)
114 {
115 return QDF_STATUS_SUCCESS;
116 }
117
reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc * psoc)118 static inline bool reg_is_11d_scan_inprogress(struct wlan_objmgr_psoc *psoc)
119 {
120 return false;
121 }
122
reg_save_new_11d_country(struct wlan_objmgr_psoc * psoc,uint8_t * country)123 static inline QDF_STATUS reg_save_new_11d_country(struct wlan_objmgr_psoc *psoc,
124 uint8_t *country)
125 {
126 return QDF_STATUS_SUCCESS;
127 }
128
reg_is_11d_offloaded(struct wlan_objmgr_psoc * psoc)129 static inline bool reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc)
130 {
131 return false;
132 }
133
reg_11d_enabled_on_host(struct wlan_objmgr_psoc * psoc)134 static inline bool reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc)
135 {
136 return false;
137 }
138
reg_11d_vdev_created_update(struct wlan_objmgr_vdev * vdev)139 static inline QDF_STATUS reg_11d_vdev_created_update(
140 struct wlan_objmgr_vdev *vdev)
141 {
142 return QDF_STATUS_SUCCESS;
143 }
144
reg_11d_vdev_delete_update(struct wlan_objmgr_psoc * psoc,enum QDF_OPMODE op_mode,uint32_t vdev_id)145 static inline QDF_STATUS reg_11d_vdev_delete_update(struct wlan_objmgr_psoc *psoc,
146 enum QDF_OPMODE op_mode,
147 uint32_t vdev_id)
148 {
149 return QDF_STATUS_SUCCESS;
150 }
151
reg_set_11d_offloaded(struct wlan_objmgr_psoc * psoc,bool val)152 static inline QDF_STATUS reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc,
153 bool val)
154 {
155 return QDF_STATUS_SUCCESS;
156 }
157 #endif
158