xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.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 any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: Define VDEV MLME public APIs
19  */
20 
21 #ifndef _WLAN_VDEV_MLME_API_H_
22 #define _WLAN_VDEV_MLME_API_H_
23 
24 /**
25  * wlan_vdev_mlme_get_cmpt_obj - Returns MLME component object
26  *
27  * Retrieves MLME component object from VDEV object
28  *
29  * Return: comp handle on SUCCESS
30  *         NULL, if it fails to retrieve
31  */
32 struct vdev_mlme_obj *wlan_vdev_mlme_get_cmpt_obj(
33 						struct wlan_objmgr_vdev *vdev);
34 /**
35  * wlan_vdev_mlme_get_ext_hdl - Returns legacy handle
36  *
37  * Retrieves legacy handle from vdev mlme component object
38  *
39  * Return: legacy handle on SUCCESS
40  *         NULL, if it fails to retrieve
41  */
42 void *wlan_vdev_mlme_get_ext_hdl(struct wlan_objmgr_vdev *vdev);
43 
44 #ifdef CMN_VDEV_MLME_SM_ENABLE
45 /**
46  * wlan_vdev_mlme_sm_deliver_evt() - Delivers event to VDEV MLME SM
47  * @vdev: Object manager VDEV object
48  * @event: MLME event
49  * @event_data_len: data size
50  * @event_data: event data
51  *
52  * API to dispatch event to VDEV MLME SM with lock acquired
53  *
54  * Return: SUCCESS: on handling event
55  *         FAILURE: on ignoring the event
56  */
57 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt(struct wlan_objmgr_vdev *vdev,
58 					 enum wlan_vdev_sm_evt event,
59 					 uint16_t event_data_len,
60 					 void *event_data);
61 
62 /**
63  * wlan_vdev_mlme_sm_deliver_evt_sync() - Delivers event to VDEV MLME SM sync
64  * @vdev: Object manager VDEV object
65  * @event: MLME event
66  * @event_data_len: data size
67  * @event_data: event data
68  *
69  * API to dispatch event to VDEV MLME SM with lock acquired
70  *
71  * Return: SUCCESS: on handling event
72  *         FAILURE: on ignoring the event
73  */
74 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt_sync(struct wlan_objmgr_vdev *vdev,
75 					      enum wlan_vdev_sm_evt event,
76 					      uint16_t event_data_len,
77 					      void *event_data);
78 
79 #ifdef SM_ENG_HIST_ENABLE
80 /**
81  * wlan_vdev_mlme_sm_history_print() - Prints SM history
82  * @vdev: Object manager VDEV object
83  *
84  * API to print SM history
85  *
86  * Return: void
87  */
88 void wlan_vdev_mlme_sm_history_print(struct wlan_objmgr_vdev *vdev);
89 
90 #endif
91 
92 /**
93  * wlan_vdev_allow_connect_n_tx() - Checks whether VDEV is in operational state
94  * @vdev: Object manager VDEV object
95  *
96  * API to checks the VDEV MLME SM state to allow tx or connections
97  *
98  * Return: SUCCESS: to allow tx or connection
99  *         FAILURE: otherwise failure
100  */
101 QDF_STATUS wlan_vdev_allow_connect_n_tx(struct wlan_objmgr_vdev *vdev);
102 
103 /**
104  * wlan_vdev_mlme_is_active() - Checks whether VDEV is in active state
105  * @vdev: Object manager VDEV object
106  *
107  * API to checks the VDEV MLME SM state to check channel is configured in FW
108  *
109  * Return: SUCCESS: valid channel is configured
110  *         FAILURE: otherwise failure
111  */
112 QDF_STATUS wlan_vdev_mlme_is_active(struct wlan_objmgr_vdev *vdev);
113 
114 /**
115  * wlan_vdev_chan_config_valid() - Checks whether VDEV chan config valid
116  * @vdev: Object manager VDEV object
117  *
118  * API to checks the VDEV MLME SM state to check channel is configured in Host
119  *
120  * Return: SUCCESS: valid channel is configured
121  *         FAILURE: otherwise failure
122  */
123 QDF_STATUS wlan_vdev_chan_config_valid(struct wlan_objmgr_vdev *vdev);
124 
125 /**
126  * wlan_vdev_mlme_is_csa_restart() - Checks whether VDEV MLME SM is in CSA
127  * @vdev: Object manager VDEV object
128  *
129  * API to checks the VDEV MLME SM state for CSA_RESTART substate
130  *
131  * Return: SUCCESS: if it is in CSA_RESTART sub state
132  *         FAILURE: otherwise failure
133  */
134 QDF_STATUS wlan_vdev_mlme_is_csa_restart(struct wlan_objmgr_vdev *vdev);
135 
136 /**
137  * wlan_vdev_is_going_down() - Checks whether VDEV is being brought down
138  * @vdev: Object manager VDEV object
139  *
140  * API to checks the VDEV MLME SM state to check VDEV is being brought down
141  *
142  * Return: SUCCESS: valid channel is configured
143  *         FAILURE: otherwise failure
144  */
145 QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev);
146 
147 /**
148  * wlan_vdev_is_restart_progress() - Checks VDEV restart is in progress
149  * @vdev: Object manager VDEV object
150  *
151  * API to check whether restarts is in progress
152  *
153  * Return: SUCCESS: if restart is in progress
154  *         FAILURE: otherwise failure
155  */
156 QDF_STATUS wlan_vdev_is_restart_progress(struct wlan_objmgr_vdev *vdev);
157 
158 /**
159  * wlan_vdev_is_dfs_cac_wait() - Checks VDEV is in cac wait state
160  * @vdev: Object manager VDEV object
161  *
162  * API to check whether state is cac wait state
163  *
164  * Return: SUCCESS: if state is cac wait state
165  *         FAILURE: otherwise failure
166  */
167 QDF_STATUS wlan_vdev_is_dfs_cac_wait(struct wlan_objmgr_vdev *vdev);
168 
169 /**
170  * wlan_vdev_mlme_cmd_lock - Acquire lock for command queuing atomicity
171  *
172  * API to take VDEV MLME command lock
173  *
174  * Return: void
175  */
176 void wlan_vdev_mlme_cmd_lock(struct wlan_objmgr_vdev *vdev);
177 
178 /**
179  * wlan_vdev_mlme_cmd_unlock - Release lock for command queuing atomicity
180  *
181  * API to release VDEV MLME command lock
182  *
183  * Return: void
184  */
185 void wlan_vdev_mlme_cmd_unlock(struct wlan_objmgr_vdev *vdev);
186 
187 /**
188  * wlan_vdev_mlme_is_scan_allowed() - Checks whether scan is allowed
189  * @vdev: Object manager VDEV object
190  *
191  * API to checks the VDEV MLME SM state to check scan is allowed
192  *
193  * Return: SUCCESS: if scan is allowed
194  *         FAILURE: otherwise failure
195  */
196 QDF_STATUS wlan_vdev_mlme_is_scan_allowed(struct wlan_objmgr_vdev *vdev);
197 #endif
198 #endif
199