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