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