xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/serialization/inc/wlan_serialization_api.h (revision f28396d060cff5c6519f883cb28ae0116ce479f1)
1 /*
2  * Copyright (c) 2017-2020 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: wlan_serialization_api.h
21  * This file provides prototypes of the routines needed for the
22  * external components to utilize the services provided by the
23  * serialization component.
24  */
25 
26 /* Include files */
27 #ifndef __WLAN_SERIALIZATION_API_H
28 #define __WLAN_SERIALIZATION_API_H
29 
30 #include <qdf_status.h>
31 #include <wlan_objmgr_cmn.h>
32 
33 /* Preprocessor Definitions and Constants */
34 
35 /**
36  * enum ser_queue_reason- reason for changes to serialization queue
37  * @: SER_REQUEST: queue updated for serialization request
38  * @: SER_REMOVE : queue updated for serialization remove request
39  * @: SER_CANCEL : queue updated for serialization cancel request
40  * @: SER_TIMEOUT : queue updated for command timeout
41  * @: SER_ACTIVATION_FAILED : queue updated since command activation failed
42  * @: SER_PENDING_TO_ACTIVE : queue updated for pending to active movement
43  */
44 enum ser_queue_reason {
45 	SER_REQUEST,
46 	SER_REMOVE,
47 	SER_CANCEL,
48 	SER_TIMEOUT,
49 	SER_ACTIVATION_FAILED,
50 	SER_PENDING_TO_ACTIVE,
51 	SER_QUEUE_ACTION_MAX,
52 };
53 
54 /*
55  * struct wlan_serialization_queued_cmd_info member queue_type specifies the
56  * below values to cancel the commands in these queues. Setting both the
57  * bits will cancel the commands in both the queues.
58  */
59 #define WLAN_SERIALIZATION_ACTIVE_QUEUE  0x1
60 #define WLAN_SERIALIZATION_PENDING_QUEUE 0x2
61 
62 /**
63  * enum wlan_serialization_cb_reason - reason for calling the callback
64  * @WLAN_SERIALIZATION_REASON_ACTIVATE_CMD: activate the cmd by sending it to FW
65  * @WLAN_SERIALIZATION_REASON_CANCEL_CMD: Cancel the cmd in the pending list
66  * @WLAN_SERIALIZATION_REASON_RELEASE_MEM_CMD:cmd execution complete. Release
67  *                                           the memory allocated while
68  *                                           building the command
69  * @WLAN_SER_CB_ACTIVE_CMD_TIMEOUT: active cmd has been timeout.
70  */
71 enum wlan_serialization_cb_reason {
72 	WLAN_SER_CB_ACTIVATE_CMD,
73 	WLAN_SER_CB_CANCEL_CMD,
74 	WLAN_SER_CB_RELEASE_MEM_CMD,
75 	WLAN_SER_CB_ACTIVE_CMD_TIMEOUT,
76 };
77 
78 /**
79  * struct wlan_serialization_scan_info - Information needed for scan cmd
80  * @is_cac_in_progress: boolean to check the cac status
81  * @is_tdls_in_progress: boolean to check the tdls status
82  * @is_mlme_op_in_progress: boolean to check the mlme op status
83  *
84  * This information is needed for scan command from other components
85  * to apply the rules and check whether the cmd is allowed or not
86  */
87 struct wlan_serialization_scan_info {
88 	bool is_cac_in_progress;
89 	bool is_tdls_in_progress;
90 	bool is_mlme_op_in_progress;
91 };
92 
93 /**
94  * union wlan_serialization_rules_info - union of all rules info structures
95  * @scan_info: information needed to apply rules on scan command
96  */
97 union wlan_serialization_rules_info {
98 	struct wlan_serialization_scan_info scan_info;
99 };
100 
101 struct wlan_serialization_command;
102 
103 /**
104  * wlan_serialization_cmd_callback() - Callback registered by the component
105  * @wlan_cmd: Command passed by the component for serialization
106  * @reason: Reason code for which the callback is being called
107  *
108  * Reason specifies the reason for which the callback is being called. callback
109  * should return success or failure based up on overall success of callback.
110  * if callback returns failure then serialization will remove the command from
111  * active queue and proceed for next pending command.
112  *
113  * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
114  */
115 typedef QDF_STATUS
116 (*wlan_serialization_cmd_callback)(struct wlan_serialization_command *wlan_cmd,
117 				   enum wlan_serialization_cb_reason reason);
118 
119 /**
120  * wlan_serialization_comp_info_cb() - callback to fill the rules information
121  * @vdev: VDEV object for which the command has been received
122  * @comp_info: Information filled by the component
123  *
124  * This callback is registered dynamically by the component with the
125  * serialization component. Serialization component invokes the callback
126  * while applying the rules for a particular command and the component
127  * fills in the required information to apply the rules
128  *
129  * Return: None
130  */
131 typedef void (*wlan_serialization_comp_info_cb)(struct wlan_objmgr_vdev *vdev,
132 		union wlan_serialization_rules_info *comp_info);
133 
134 /**
135  * wlan_serialization_apply_rules_cb() - callback per command to apply rules
136  * @comp_info: information needed to apply the rules
137  *
138  * The rules are applied using this callback and decided whether to
139  * allow or deny the command
140  *
141  * Return: true, if rules are successful and cmd can be queued
142  *         false, if rules failed and cmd should not be queued
143  */
144 typedef bool (*wlan_serialization_apply_rules_cb)(
145 		union wlan_serialization_rules_info *comp_info,
146 		uint8_t comp_id);
147 
148 /**
149  * wlan_ser_umac_cmd_cb() - callback to validate umac_cmd
150  * @umac_cmd: umac data associated with the serialization cmd
151  *
152  * This callback can be called at run time for a command in active queue to
153  * fetch the required information from the umac cmd data stored in serialization
154  * command buffer.
155  *
156  * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
157  */
158 typedef QDF_STATUS (*wlan_ser_umac_cmd_cb)(void *umac_cmd);
159 
160 /**
161  * enum wlan_umac_cmd_id - Command Type
162  * @WLAN_SER_CMD_SCAN: Scan command
163  * @WLAN_SER_CMD_NONSCAN: Non-scan command
164  * @WLAN_SER_CMD_HDD_ISSUE_REASSOC_SAME_AP: HDD Reassoc cmd
165  * @WLAN_SER_CMD_SME_ISSUE_REASSOC_SAME_AP: SME Reassoc cmd
166  * @WLAN_SER_CMD_SME_ISSUE_DISASSOC_FOR_HANDOFF: SME Disassoc cmd
167  * @WLAN_SER_CMD_SME_ISSUE_ASSOC_TO_SIMILAR_AP: SME Assoc cmd
168  * @WLAN_SER_CMD_FORCE_IBSS_LEAVE: IBSS leave AP cmd
169  * @WLAN_SER_CMD_SME_ISSUE_FT_REASSOC: SME reassoc cmd
170  * @WLAN_SER_CMD_FORCE_DISASSOC_STA: Force diassoc for STA vap
171  * @WLAN_SER_CMD_FORCE_DEAUTH_STA: Force deauth for STA vap
172  * @WLAN_SER_CMD_PERFORM_PRE_AUTH: Pre auth ops cmd
173  * @WLAN_SER_CMD_WM_STATUS_CHANGE: WM status modification cmd
174  * @WLAN_SER_CMD_NDP_INIT_REQ: NDP init request cmd
175  * @WLAN_SER_CMD_NDP_RESP_REQ: NDP response to request cmd
176  * @WLAN_SER_CMD_NDP_DATA_END_INIT_REQ: NDP data end init request
177  * @WLAN_SER_CMD_NDP_END_ALL_REQ: NDP close all request
178  * @WLAN_SER_CMD_ADDTS: ADD Ts cmd
179  * @WLAN_SER_CMD_DELTS: Del Ts cmd
180  * @WLAN_SER_CMD_TDLS_SEND_MGMT: TDLS mgmt send cmd
181  * @WLAN_SER_CMD_TDLS_ADD_PEER: TDLS cmd to add peer
182  * @WLAN_SER_CMD_TDLS_DEL_PEER: TDLS cmd to del peer
183  * @WLAN_SER_CMD_SET_HW_MODE: Cmd to set hardware mode change
184  * @WLAN_SER_CMD_NSS_UPDATE: Cmd to update NSS config
185  * @WLAN_SER_CMD_SET_DUAL_MAC_CONFIG: Cmd to set dual mac
186  * @WLAN_SER_CMD_SET_ANTENNA_MODE: Set antenna mode
187  * @WLAN_SER_CMD_VDEV_DELETE: Cmd to del vdev
188  * @WLAN_SER_CMD_VDEV_START_BSS: Cmd to start a AP VDEV
189  * @WLAN_SER_CMD_VDEV_STOP_BSS: Cmd to stop a AP VDEV
190  * @WLAN_SER_CMD_VDEV_CONNECT: Cmd to start a STA VDEV
191  * @WLAN_SER_CMD_VDEV_DISCONNECT: Cmd to stop a STA VDEV
192  * @WLAN_SER_CMD_VDEV_RESTART: Cmd to restart a VDEV
193  * @WLAN_SER_CMD_PDEV_RESTART: Cmd to restart all VDEVs of a PDEV
194  * @WLAN_SER_CMD_PDEV_CSA_RESTART: Cmd to CSA restart all AP VDEVs of a PDEV
195  */
196 enum wlan_serialization_cmd_type {
197 	/* all scan command before non-scan */
198 	WLAN_SER_CMD_SCAN,
199 	/* all non-scan command below */
200 	WLAN_SER_CMD_NONSCAN,
201 	WLAN_SER_CMD_HDD_ISSUE_REASSOC_SAME_AP,
202 	WLAN_SER_CMD_SME_ISSUE_REASSOC_SAME_AP,
203 	WLAN_SER_CMD_SME_ISSUE_DISASSOC_FOR_HANDOFF,
204 	WLAN_SER_CMD_SME_ISSUE_ASSOC_TO_SIMILAR_AP,
205 	WLAN_SER_CMD_FORCE_IBSS_LEAVE,
206 	WLAN_SER_CMD_SME_ISSUE_FT_REASSOC,
207 	WLAN_SER_CMD_FORCE_DISASSOC_STA,
208 	WLAN_SER_CMD_FORCE_DEAUTH_STA,
209 	WLAN_SER_CMD_PERFORM_PRE_AUTH,
210 	WLAN_SER_CMD_WM_STATUS_CHANGE,
211 	WLAN_SER_CMD_NDP_INIT_REQ,
212 	WLAN_SER_CMD_NDP_RESP_REQ,
213 	WLAN_SER_CMD_NDP_DATA_END_INIT_REQ,
214 	WLAN_SER_CMD_NDP_END_ALL_REQ,
215 	WLAN_SER_CMD_ADDTS,
216 	WLAN_SER_CMD_DELTS,
217 	WLAN_SER_CMD_TDLS_SEND_MGMT,
218 	WLAN_SER_CMD_TDLS_ADD_PEER,
219 	WLAN_SER_CMD_TDLS_DEL_PEER,
220 	WLAN_SER_CMD_SET_HW_MODE,
221 	WLAN_SER_CMD_NSS_UPDATE,
222 	WLAN_SER_CMD_SET_DUAL_MAC_CONFIG,
223 	WLAN_SER_CMD_SET_ANTENNA_MODE,
224 	WLAN_SER_CMD_VDEV_DELETE,
225 	WLAN_SER_CMD_VDEV_START_BSS,
226 	WLAN_SER_CMD_VDEV_STOP_BSS,
227 	WLAN_SER_CMD_VDEV_CONNECT,
228 	WLAN_SER_CMD_VDEV_DISCONNECT,
229 	WLAN_SER_CMD_VDEV_RESTART,
230 	WLAN_SER_CMD_PDEV_RESTART,
231 	WLAN_SER_CMD_PDEV_CSA_RESTART,
232 	WLAN_SER_CMD_MAX
233 };
234 
235 /**
236  * enum wlan_serialization_cancel_type - Type of commands to be cancelled
237  * @WLAN_SER_CANCEL_SINGLE_SCAN: Cancel a single scan with a given ID
238  * @WLAN_SER_CANCEL_PDEV_SCANS: Cancel all the scans on a given pdev
239  * @WLAN_SER_CANCEL_VDEV_SCANS: Cancel all the scans on given vdev
240  * @WLAN_SER_CANCEL_PDEV_NON_SCAN_CMD: Cancel all non scans on a given pdev
241  * @WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD: Cancel all non scans on a given vdev
242  * @WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD_TYPE: Cancel all non scans on a given vdev
243  * and matching cmd type
244  * @WLAN_SER_CANCEL_VDEV_NON_SCAN_NB_CMD: Cancel all non-blocking,
245  * non-scan commands of a given vdev
246  * @WLAN_SER_CANCEL_NON_SCAN_CMD: Cancel the given non scan command
247  */
248 enum wlan_serialization_cancel_type {
249 	WLAN_SER_CANCEL_SINGLE_SCAN,
250 	WLAN_SER_CANCEL_PDEV_SCANS,
251 	WLAN_SER_CANCEL_VDEV_SCANS,
252 	WLAN_SER_CANCEL_PDEV_NON_SCAN_CMD,
253 	WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD,
254 	WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD_TYPE,
255 	WLAN_SER_CANCEL_VDEV_NON_SCAN_NB_CMD,
256 	WLAN_SER_CANCEL_NON_SCAN_CMD,
257 	WLAN_SER_CANCEL_MAX,
258 };
259 
260 /**
261  * enum wlan_serialization_status - Return status of cmd serialization request
262  * @WLAN_SER_CMD_PENDING: Command is put into the pending queue
263  * @WLAN_SER_CMD_ACTIVE: Command is activated and put in active queue
264  * @WLAN_SER_CMD_DENIED_RULES_FAILED: Command denied as the rules fail
265  * @WLAN_SER_CMD_DENIED_LIST_FULL: Command denied as the pending list is full
266  * @WLAN_SER_CMD_QUEUE_DISABLED: Command denied as the queue is disabled
267  * @WLAN_SER_CMD_ALREADY_EXISTS: Command already exists in the queue
268  * @WLAN_SER_CMD_DENIED_UNSPECIFIED: Command denied due to unknown reason
269  */
270 enum wlan_serialization_status {
271 	WLAN_SER_CMD_PENDING,
272 	WLAN_SER_CMD_ACTIVE,
273 	WLAN_SER_CMD_DENIED_RULES_FAILED,
274 	WLAN_SER_CMD_DENIED_LIST_FULL,
275 	WLAN_SER_CMD_QUEUE_DISABLED,
276 	WLAN_SER_CMD_ALREADY_EXISTS,
277 	WLAN_SER_CMD_DENIED_UNSPECIFIED,
278 };
279 
280 /**
281  * enum wlan_serialization_cmd_status - Return status for a cancel request
282  * @WLAN_SER_CMD_IN_PENDING_LIST: Command cancelled from pending list
283  * @WLAN_SER_CMD_IN_ACTIVE_LIST: Command cancelled from active list
284  * @WLAN_SER_CMDS_IN_ALL_LISTS: Command cancelled from all lists
285  * @WLAN_SER_CMD_NOT_FOUND: Specified command to be cancelled
286  *                                    not found in the lists
287  */
288 enum wlan_serialization_cmd_status {
289 	WLAN_SER_CMD_IN_PENDING_LIST,
290 	WLAN_SER_CMD_IN_ACTIVE_LIST,
291 	WLAN_SER_CMDS_IN_ALL_LISTS,
292 	WLAN_SER_CMD_MARKED_FOR_ACTIVATION,
293 	WLAN_SER_CMD_NOT_FOUND,
294 };
295 
296 /**
297  * enum wlan_ser_cmd_attr - Serialization cmd attribute
298  * @WLAN_SER_CMD_ATTR_NONE - No attribuate associated
299  * @WLAN_SER_CMD_ATTR_BLOCK - Blocking attribute
300  * @WLAN_SER_CMD_ATTR_NONBLOCK - Non-blocking attribute
301  */
302 enum wlan_ser_cmd_attr {
303 	WLAN_SER_CMD_ATTR_NONE,
304 	WLAN_SER_CMD_ATTR_BLOCK,
305 	WLAN_SER_CMD_ATTR_NONBLOCK,
306 };
307 
308 /**
309  * struct wlan_serialization_command - Command to be serialized
310  * @wlan_serialization_cmd_type: Type of command
311  * @cmd_id: Command Identifier
312  * @cmd_cb: Command callback
313  * @source: component ID of the source of the command
314  * @is_high_priority: Normal/High Priority at which the cmd has to be queued
315  * @is_blocking: Is the command blocking
316  * @queue_disable: Should the command disable the queues
317  * @activation_reason: reason the activation cb was called
318  * @cmd_timeout_cb: Command timeout callback
319  * @cmd_timeout_duration: Timeout duration in milliseconds
320  * @vdev: VDEV object associated to the command
321  * @umac_cmd: Actual command that needs to be sent to WMI/firmware
322  *
323  * Note: Unnamed union has been used in this structure, so that in future if
324  * somebody wants to add pdev or psoc structure then that person can add without
325  * modifying existing code.
326  */
327 struct wlan_serialization_command {
328 	enum wlan_serialization_cmd_type cmd_type;
329 	uint32_t cmd_id;
330 	wlan_serialization_cmd_callback cmd_cb;
331 	enum wlan_umac_comp_id source;
332 	uint8_t is_high_priority:1,
333 		is_blocking:1,
334 		queue_disable:1,
335 		activation_reason:3;
336 	uint32_t cmd_timeout_duration;
337 	union {
338 		struct wlan_objmgr_vdev *vdev;
339 	};
340 	void *umac_cmd;
341 };
342 
343 /**
344  * struct wlan_serialization_queued_cmd_info  - cmd that has to be cancelled
345  * @requestor: component ID of the source requesting this action
346  * @cmd_type: Command type
347  * @cmd_id: Command ID
348  * @req_type: Commands that need to be cancelled
349  * @vdev: VDEV object associated to the command
350  * @queue_type: Queues from which the command to be cancelled
351  */
352 struct wlan_serialization_queued_cmd_info {
353 	enum wlan_umac_comp_id requestor;
354 	enum wlan_serialization_cmd_type cmd_type;
355 	uint32_t cmd_id;
356 	enum wlan_serialization_cancel_type req_type;
357 	union {
358 		struct wlan_objmgr_vdev *vdev;
359 	};
360 	uint8_t queue_type;
361 };
362 
363 /**
364  * wlan_serialization_cancel_request() - Request to cancel a command
365  * @req: Request information
366  *
367  * This API is used by external components to cancel a command
368  * that is either in the pending or active queue. Based on the
369  * req_type, it is decided whether to use pdev or vdev
370  * object. For all non-scan commands, it will be pdev.
371  *
372  * Return: Status specifying the removal of a command from a certain queue
373  */
374 enum wlan_serialization_cmd_status
375 wlan_serialization_cancel_request(
376 		struct wlan_serialization_queued_cmd_info *req);
377 
378 /**
379  * wlan_serialization_remove_cmd() - Request to release a command
380  * @cmd: Command information
381  *
382  * This API is used to release a command sitting in the active
383  * queue upon successful completion of the command
384  *
385  * Return: None
386  */
387 void wlan_serialization_remove_cmd(
388 		struct wlan_serialization_queued_cmd_info *cmd);
389 
390 /**
391  * wlan_serialization_update_timer() -Update timer for an active command
392  * @cmd: Command information
393  *
394  * Return: Status of the timer update
395  */
396 QDF_STATUS
397 wlan_serialization_update_timer(struct wlan_serialization_command *cmd);
398 
399 /**
400  * wlan_serialization_request() - Request to serialize a command
401  * @cmd: Command information
402  *
403  * Return: Status of the serialization request
404  */
405 enum wlan_serialization_status
406 wlan_serialization_request(struct wlan_serialization_command *cmd);
407 
408 /**
409  * wlan_serialization_register_comp_info_cb() - Register component's info cb
410  * @psoc: PSOC object information
411  * @comp_id: Component ID
412  * @cmd_type: Command Type
413  * @cb: Callback
414  *
415  * This is called from component during its initialization.It initializes
416  * callback handler for given comp_id/cmd_id in a 2-D array.
417  *
418  * Return: QDF Status
419  */
420 QDF_STATUS
421 wlan_serialization_register_comp_info_cb(
422 		struct wlan_objmgr_psoc *psoc,
423 		enum wlan_umac_comp_id comp_id,
424 		enum wlan_serialization_cmd_type cmd_type,
425 		wlan_serialization_comp_info_cb cb);
426 
427 /**
428  * wlan_serialization_deregister_comp_info_cb() - Deregister component's info
429  *						callback
430  * @psoc: PSOC object information
431  * @comp_id: Component ID
432  * @cmd_type: Command Type
433  *
434  * This routine is called from other component during its de-initialization.
435  *
436  * Return: QDF Status
437  */
438 QDF_STATUS
439 wlan_serialization_deregister_comp_info_cb(
440 		struct wlan_objmgr_psoc *psoc,
441 		enum wlan_umac_comp_id comp_id,
442 		enum wlan_serialization_cmd_type cmd_type);
443 
444 /**
445  * wlan_serialization_register_apply_rules_cb() - Register component's rules
446  *						callback
447  * @psoc: PSOC object information
448  * @cmd_type: Command Type
449  * @cb: Callback
450  *
451  * This is called from component during its initialization.It initializes
452  * callback handler for given cmd_type in a 1-D array.
453  *
454  * Return: QDF Status
455  */
456 QDF_STATUS
457 wlan_serialization_register_apply_rules_cb(
458 		struct wlan_objmgr_psoc *psoc,
459 		enum wlan_serialization_cmd_type cmd_type,
460 		wlan_serialization_apply_rules_cb apply_rules_cb);
461 
462 /**
463  * wlan_serialization_deregister_apply_rules_cb() - Deregister component's rules
464  *						callback
465  * @psoc: PSOC object information
466  * @cmd_type: Command Type
467  *
468  * This routine is called from other component during its de-initialization.
469  *
470  * Return: QDF Status
471  */
472 QDF_STATUS
473 wlan_serialization_deregister_apply_rules_cb(
474 		struct wlan_objmgr_psoc *psoc,
475 		enum wlan_serialization_cmd_type cmd_type);
476 
477 /**
478  * @wlan_serialization_init() - Serialization component initialization routine
479  *
480  * Return - QDF Status
481  */
482 QDF_STATUS wlan_serialization_init(void);
483 
484 /**
485  * @wlan_serialization_deinit() - Serialization component de-init routine
486  *
487  * Return - QDF Status
488  */
489 QDF_STATUS wlan_serialization_deinit(void);
490 
491 /**
492  * @wlan_serialization_psoc_enable() - Serialization component enable routine
493  *
494  * Return - QDF Status
495  */
496 QDF_STATUS wlan_serialization_psoc_enable(struct wlan_objmgr_psoc *psoc);
497 
498 /**
499  * @wlan_serialization_psoc_disable() - Serialization component disable routine
500  *
501  * Return - QDF Status
502  */
503 QDF_STATUS wlan_serialization_psoc_disable(struct wlan_objmgr_psoc *psoc);
504 
505 /**
506  * wlan_serialization_vdev_scan_status() - Return the status of the vdev scan
507  * @vdev: VDEV Object
508  *
509  * Return: Status of the scans for the corresponding vdev
510  */
511 enum wlan_serialization_cmd_status
512 wlan_serialization_vdev_scan_status(struct wlan_objmgr_vdev *vdev);
513 
514 /**
515  * wlan_serialization_pdev_scan_status() - Return the status of the pdev scan
516  * @pdev: PDEV Object
517  *
518  * Return: Status of the scans for the corresponding pdev
519  */
520 enum wlan_serialization_cmd_status
521 wlan_serialization_pdev_scan_status(struct wlan_objmgr_pdev *pdev);
522 
523 /**
524  * wlan_serialization_non_scan_cmd_status() - Return status of pdev non-scan cmd
525  * @pdev: PDEV Object
526  * @cmd_id: ID of the command for which the status has to be checked
527  *
528  * Return: Status of the command for the corresponding pdev
529  */
530 enum wlan_serialization_cmd_status
531 wlan_serialization_non_scan_cmd_status(struct wlan_objmgr_pdev *pdev,
532 				       enum wlan_serialization_cmd_type cmd_id);
533 
534 /**
535  * wlan_serialization_is_cmd_present_in_pending_queue() - Return if the command
536  *				is already present in pending queue
537  * @cmd: pointer to serialization command to check
538  *
539  * This API will check if command is present in pending queue. If present
540  * then return true, so use know that it is duplicated command
541  *
542  * Return: true or false
543  */
544 bool wlan_serialization_is_cmd_present_in_pending_queue(
545 		struct wlan_objmgr_psoc *psoc,
546 		struct wlan_serialization_command *cmd);
547 /**
548  * wlan_serialization_is_cmd_present_in_active_queue() - Return if the command
549  *			is already present in active queue
550  * @cmd: pointer to serialization command to check
551  *
552  * This API will check if command is present in active queue. If present
553  * then return true, so use know that it is duplicated command
554  *
555  * Return: true or false
556  */
557 bool wlan_serialization_is_cmd_present_in_active_queue(
558 		struct wlan_objmgr_psoc *psoc,
559 		struct wlan_serialization_command *cmd);
560 
561 /**
562  * wlan_serialization_get_scan_cmd_using_scan_id() - Return command which
563  *					matches vdev_id and scan_id
564  * @psoc: pointer to soc
565  * @vdev_id: vdev id to pull vdev object
566  * @scan_id: scan id to match
567  * @is_scan_cmd_from_active_queue: to indicate active or pending queue
568  *
569  * This API fetches vdev/pdev object based on vdev_id, loops through scan
570  * command queue and find the command which matches scan id as well as vdev
571  * object.
572  *
573  * Return: pointer to serialization command
574  */
575 struct wlan_serialization_command*
576 wlan_serialization_get_scan_cmd_using_scan_id(
577 		struct wlan_objmgr_psoc *psoc,
578 		uint8_t vdev_id, uint16_t scan_id,
579 		uint8_t is_scan_cmd_from_active_queue);
580 /**
581  * wlan_serialization_get_active_cmd() - Return active umac command which
582  *  matches vdev and cmd type
583  * @psoc: pointer to soc
584  * @vdev_id: vdev id to pull vdev object
585  * @cmd_type: cmd type to match
586  *
587  * This API fetches vdev/pdev object based on vdev_id, loops through active
588  * command queue and find the active command which matches cmd_type as well
589  * as vdev object.
590  *
591  * Return: Pointer to umac command. NULL is returned if active command of given
592  *  type is not found.
593  */
594 void *wlan_serialization_get_active_cmd(
595 		struct wlan_objmgr_psoc *psoc,
596 		uint8_t vdev_id,
597 		enum wlan_serialization_cmd_type cmd_type);
598 
599 /**
600  * wlan_serialization_get_vdev_active_cmd_type() - Return cmd type of the
601  *  active command for the given vdev
602  * @vdev: vdev object
603  *
604  * This API fetches command type of the command in the vdev active queue
605  *
606  * Return: command type of the command in the vdev active queue
607  */
608 
609 enum wlan_serialization_cmd_type
610 wlan_serialization_get_vdev_active_cmd_type(struct wlan_objmgr_vdev *vdev);
611 
612 /**
613  * wlan_ser_get_cmd_activation_status() - Return active command status
614  * @vdev: vdev object
615  *
616  * This API fetches active command state in the vdev active queue
617  *
618  * Return: success if CMD_MARKED_FOR_ACTIVATION bit is set, else fail
619  */
620 
621 QDF_STATUS
622 wlan_ser_get_cmd_activation_status(struct wlan_objmgr_vdev *vdev);
623 
624 /**
625  * wlan_ser_is_vdev_queue_enabled() - Return vdev queue status
626  * @vdev: vdev object
627  *
628  * This API return vdev queue enable status
629  *
630  * Return: true if vdev queue is enabled
631  */
632 bool wlan_ser_is_vdev_queue_enabled(struct wlan_objmgr_vdev *vdev);
633 
634 /**
635  * wlan_ser_validate_umac_cmd() - validate umac cmd data
636  * @vdev: objmgr vdev pointer
637  * @cmd_type: cmd type to match
638  * @umac_cmd_cb: Callback to be called to validate the data
639  *
640  * This API returns the validation status of the umac cmd cb.
641  * The umac_cmd_cb callback is called with serialization lock held, and hence
642  * only atomic operations are allowed in the callback.
643  *
644  * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
645  */
646 QDF_STATUS
647 wlan_ser_validate_umac_cmd(struct wlan_objmgr_vdev *vdev,
648 			   enum wlan_serialization_cmd_type cmd_type,
649 			   wlan_ser_umac_cmd_cb umac_cmd_cb);
650 
651 /**
652  * wlan_serialization_purge_all_pdev_cmd() - purge all command for given pdev
653  * @pdev: objmgr pdev pointer
654  *
655  * Return: void
656  */
657 void wlan_serialization_purge_all_pdev_cmd(struct wlan_objmgr_pdev *pdev);
658 
659 /**
660  * wlan_serialization_purge_all_cmd() - purge all command for psoc
661  * @psoc: objmgr psoc pointer
662  *
663  * Return: void
664  */
665 void wlan_serialization_purge_all_cmd(struct wlan_objmgr_psoc *psoc);
666 
667 /**
668  * wlan_serialization_purge_all_pending_cmd_by_vdev_id() - Purge all pending
669  * scan and non scan commands for vdev id
670  * @pdev: pointer to pdev
671  * @vdev_id: vdev_id variable
672  *
673  * Return: none
674  */
675 void wlan_serialization_purge_all_pending_cmd_by_vdev_id(
676 					struct wlan_objmgr_pdev *pdev,
677 					uint8_t vdev_id);
678 
679 /**
680  * wlan_serialization_purge_all_scan_cmd_by_vdev_id() - Purge all pending/active
681  * scan commands for vdev id
682  * @pdev: pointer to pdev
683  * @vdev_id: vdev_id variable
684  *
685  * Return: none
686  */
687 void wlan_serialization_purge_all_scan_cmd_by_vdev_id(
688 					struct wlan_objmgr_pdev *pdev,
689 					uint8_t vdev_id);
690 
691 /**
692  * wlan_ser_vdev_queue_disable -Disable vdev specific serialization queue
693  * @vdev: Vdev Object
694  *
695  * This function disables the serialization for the vdev queue
696  *
697  * Return: QDF_STATUS
698  */
699 QDF_STATUS wlan_ser_vdev_queue_disable(struct wlan_objmgr_vdev *vdev);
700 #endif
701