xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/serialization/inc/wlan_serialization_api.h (revision 8cfe6b10058a04cafb17eed051f2ddf11bee8931)
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_MAX: Max enumeration
203  */
204 enum wlan_serialization_cmd_type {
205 	/* all scan command before non-scan */
206 	WLAN_SER_CMD_SCAN,
207 	/* all non-scan command below */
208 	WLAN_SER_CMD_NONSCAN,
209 	WLAN_SER_CMD_FORCE_DISASSOC_STA,
210 	WLAN_SER_CMD_FORCE_DEAUTH_STA,
211 	WLAN_SER_CMD_PERFORM_PRE_AUTH,
212 	WLAN_SER_CMD_WM_STATUS_CHANGE,
213 	WLAN_SER_CMD_NDP_INIT_REQ,
214 	WLAN_SER_CMD_NDP_RESP_REQ,
215 	WLAN_SER_CMD_NDP_DATA_END_INIT_REQ,
216 	WLAN_SER_CMD_NDP_END_ALL_REQ,
217 	WLAN_SER_CMD_ADDTS,
218 	WLAN_SER_CMD_DELTS,
219 	WLAN_SER_CMD_TDLS_SEND_MGMT,
220 	WLAN_SER_CMD_TDLS_ADD_PEER,
221 	WLAN_SER_CMD_TDLS_DEL_PEER,
222 	WLAN_SER_CMD_SET_HW_MODE,
223 	WLAN_SER_CMD_NSS_UPDATE,
224 	WLAN_SER_CMD_SET_DUAL_MAC_CONFIG,
225 	WLAN_SER_CMD_SET_ANTENNA_MODE,
226 	WLAN_SER_CMD_VDEV_DELETE,
227 	WLAN_SER_CMD_VDEV_START_BSS,
228 	WLAN_SER_CMD_VDEV_STOP_BSS,
229 	WLAN_SER_CMD_VDEV_CONNECT,
230 	WLAN_SER_CMD_VDEV_DISCONNECT,
231 	WLAN_SER_CMD_VDEV_RESTART,
232 	WLAN_SER_CMD_PDEV_RESTART,
233 	WLAN_SER_CMD_PDEV_CSA_RESTART,
234 	WLAN_SER_CMD_VDEV_ROAM,
235 	WLAN_SER_CMD_SET_MLO_LINK,
236 	WLAN_SER_CMD_MAX
237 };
238 
239 /**
240  * enum wlan_serialization_cancel_type - Type of commands to be cancelled
241  * @WLAN_SER_CANCEL_SINGLE_SCAN: Cancel a single scan with a given ID
242  * @WLAN_SER_CANCEL_PDEV_SCANS: Cancel all the scans on a given pdev
243  * @WLAN_SER_CANCEL_VDEV_SCANS: Cancel all the scans on given vdev
244  * @WLAN_SER_CANCEL_VDEV_HOST_SCANS: Cancel all host scans on given vdev
245  * @WLAN_SER_CANCEL_PDEV_NON_SCAN_CMD: Cancel all non scans on a given pdev
246  * @WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD: Cancel all non scans on a given vdev
247  * @WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD_TYPE: Cancel all non scans on a given vdev
248  * and matching cmd type
249  * @WLAN_SER_CANCEL_VDEV_NON_SCAN_NB_CMD: Cancel all non-blocking,
250  * non-scan commands of a given vdev
251  * @WLAN_SER_CANCEL_NON_SCAN_CMD: Cancel the given non scan command
252  * @WLAN_SER_CANCEL_MAX: Max enumeration
253  */
254 enum wlan_serialization_cancel_type {
255 	WLAN_SER_CANCEL_SINGLE_SCAN,
256 	WLAN_SER_CANCEL_PDEV_SCANS,
257 	WLAN_SER_CANCEL_VDEV_SCANS,
258 	WLAN_SER_CANCEL_VDEV_HOST_SCANS,
259 	WLAN_SER_CANCEL_PDEV_NON_SCAN_CMD,
260 	WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD,
261 	WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD_TYPE,
262 	WLAN_SER_CANCEL_VDEV_NON_SCAN_NB_CMD,
263 	WLAN_SER_CANCEL_NON_SCAN_CMD,
264 	WLAN_SER_CANCEL_MAX,
265 };
266 
267 /**
268  * enum wlan_serialization_status - Return status of cmd serialization request
269  * @WLAN_SER_CMD_PENDING: Command is put into the pending queue
270  * @WLAN_SER_CMD_ACTIVE: Command is activated and put in active queue
271  * @WLAN_SER_CMD_DENIED_RULES_FAILED: Command denied as the rules fail
272  * @WLAN_SER_CMD_DENIED_LIST_FULL: Command denied as the pending list is full
273  * @WLAN_SER_CMD_QUEUE_DISABLED: Command denied as the queue is disabled
274  * @WLAN_SER_CMD_ALREADY_EXISTS: Command already exists in the queue
275  * @WLAN_SER_CMD_DENIED_UNSPECIFIED: Command denied due to unknown reason
276  */
277 enum wlan_serialization_status {
278 	WLAN_SER_CMD_PENDING,
279 	WLAN_SER_CMD_ACTIVE,
280 	WLAN_SER_CMD_DENIED_RULES_FAILED,
281 	WLAN_SER_CMD_DENIED_LIST_FULL,
282 	WLAN_SER_CMD_QUEUE_DISABLED,
283 	WLAN_SER_CMD_ALREADY_EXISTS,
284 	WLAN_SER_CMD_DENIED_UNSPECIFIED,
285 };
286 
287 /**
288  * enum wlan_serialization_cmd_status - Return status for a cancel request
289  * @WLAN_SER_CMD_IN_PENDING_LIST: Command cancelled from pending list
290  * @WLAN_SER_CMD_IN_ACTIVE_LIST: Command cancelled from active list
291  * @WLAN_SER_CMDS_IN_ALL_LISTS: Command cancelled from all lists
292  * @WLAN_SER_CMD_MARKED_FOR_ACTIVATION:
293  * @WLAN_SER_CMD_NOT_FOUND: Specified command to be cancelled
294  *                                    not found in the lists
295  */
296 enum wlan_serialization_cmd_status {
297 	WLAN_SER_CMD_IN_PENDING_LIST,
298 	WLAN_SER_CMD_IN_ACTIVE_LIST,
299 	WLAN_SER_CMDS_IN_ALL_LISTS,
300 	WLAN_SER_CMD_MARKED_FOR_ACTIVATION,
301 	WLAN_SER_CMD_NOT_FOUND,
302 };
303 
304 /**
305  * enum wlan_ser_cmd_attr - Serialization cmd attribute
306  * @WLAN_SER_CMD_ATTR_NONE: No attribuate associated
307  * @WLAN_SER_CMD_ATTR_BLOCK: Blocking attribute
308  * @WLAN_SER_CMD_ATTR_NONBLOCK: Non-blocking attribute
309  */
310 enum wlan_ser_cmd_attr {
311 	WLAN_SER_CMD_ATTR_NONE,
312 	WLAN_SER_CMD_ATTR_BLOCK,
313 	WLAN_SER_CMD_ATTR_NONBLOCK,
314 };
315 
316 /**
317  * struct wlan_serialization_command - Command to be serialized
318  * @cmd_type: Type of command
319  * @cmd_id: Command Identifier
320  * @cmd_cb: Command callback
321  * @source: component ID of the source of the command
322  * @is_high_priority: Normal/High Priority at which the cmd has to be queued
323  * @is_blocking: Is the command blocking
324  * @queue_disable: Should the command disable the queues
325  * @activation_reason: reason the activation cb was called
326  * @cmd_timeout_cb: Command timeout callback
327  * @cmd_timeout_duration: Timeout duration in milliseconds
328  * @vdev: VDEV object associated to the command
329  * @umac_cmd: Actual command that needs to be sent to WMI/firmware
330  *
331  * Note: Unnamed union has been used in this structure, so that in future if
332  * somebody wants to add pdev or psoc structure then that person can add without
333  * modifying existing code.
334  */
335 struct wlan_serialization_command {
336 	enum wlan_serialization_cmd_type cmd_type;
337 	uint32_t cmd_id;
338 	wlan_serialization_cmd_callback cmd_cb;
339 	enum wlan_umac_comp_id source;
340 	uint8_t is_high_priority:1,
341 		is_blocking:1,
342 		queue_disable:1,
343 		activation_reason:3;
344 	uint32_t cmd_timeout_duration;
345 	union {
346 		struct wlan_objmgr_vdev *vdev;
347 	};
348 	void *umac_cmd;
349 };
350 
351 /**
352  * struct wlan_serialization_queued_cmd_info  - cmd that has to be cancelled
353  * @requestor: component ID of the source requesting this action
354  * @cmd_type: Command type
355  * @cmd_id: Command ID
356  * @req_type: Commands that need to be cancelled
357  * @vdev: VDEV object associated to the command
358  * @queue_type: Queues from which the command to be cancelled
359  */
360 struct wlan_serialization_queued_cmd_info {
361 	enum wlan_umac_comp_id requestor;
362 	enum wlan_serialization_cmd_type cmd_type;
363 	uint32_t cmd_id;
364 	enum wlan_serialization_cancel_type req_type;
365 	union {
366 		struct wlan_objmgr_vdev *vdev;
367 	};
368 	uint8_t queue_type;
369 };
370 
371 /**
372  * wlan_serialization_cancel_request() - Request to cancel a command
373  * @req: Request information
374  *
375  * This API is used by external components to cancel a command
376  * that is either in the pending or active queue. Based on the
377  * req_type, it is decided whether to use pdev or vdev
378  * object. For all non-scan commands, it will be pdev.
379  *
380  * Return: Status specifying the removal of a command from a certain queue
381  */
382 enum wlan_serialization_cmd_status
383 wlan_serialization_cancel_request(
384 		struct wlan_serialization_queued_cmd_info *req);
385 
386 /**
387  * wlan_serialization_remove_cmd() - Request to release a command
388  * @cmd: Command information
389  *
390  * This API is used to release a command sitting in the active
391  * queue upon successful completion of the command
392  *
393  * Return: None
394  */
395 void wlan_serialization_remove_cmd(
396 		struct wlan_serialization_queued_cmd_info *cmd);
397 
398 /**
399  * wlan_serialization_update_timer() -Update timer for an active command
400  * @cmd: Command information
401  *
402  * Return: Status of the timer update
403  */
404 QDF_STATUS
405 wlan_serialization_update_timer(struct wlan_serialization_command *cmd);
406 
407 /**
408  * wlan_serialization_request() - Request to serialize a command
409  * @cmd: Command information
410  *
411  * Return: Status of the serialization request
412  */
413 enum wlan_serialization_status
414 wlan_serialization_request(struct wlan_serialization_command *cmd);
415 
416 /**
417  * wlan_serialization_register_comp_info_cb() - Register component's info cb
418  * @psoc: PSOC object information
419  * @comp_id: Component ID
420  * @cmd_type: Command Type
421  * @cb: Callback
422  *
423  * This is called from component during its initialization.It initializes
424  * callback handler for given comp_id/cmd_id in a 2-D array.
425  *
426  * Return: QDF Status
427  */
428 QDF_STATUS
429 wlan_serialization_register_comp_info_cb(
430 		struct wlan_objmgr_psoc *psoc,
431 		enum wlan_umac_comp_id comp_id,
432 		enum wlan_serialization_cmd_type cmd_type,
433 		wlan_serialization_comp_info_cb cb);
434 
435 /**
436  * wlan_serialization_deregister_comp_info_cb() - Deregister component's info
437  *						callback
438  * @psoc: PSOC object information
439  * @comp_id: Component ID
440  * @cmd_type: Command Type
441  *
442  * This routine is called from other component during its de-initialization.
443  *
444  * Return: QDF Status
445  */
446 QDF_STATUS
447 wlan_serialization_deregister_comp_info_cb(
448 		struct wlan_objmgr_psoc *psoc,
449 		enum wlan_umac_comp_id comp_id,
450 		enum wlan_serialization_cmd_type cmd_type);
451 
452 /**
453  * wlan_serialization_register_apply_rules_cb() - Register component's rules
454  *						callback
455  * @psoc: PSOC object information
456  * @cmd_type: Command Type
457  * @apply_rules_cb: Callback
458  *
459  * This is called from component during its initialization.It initializes
460  * callback handler for given cmd_type in a 1-D array.
461  *
462  * Return: QDF Status
463  */
464 QDF_STATUS
465 wlan_serialization_register_apply_rules_cb(
466 		struct wlan_objmgr_psoc *psoc,
467 		enum wlan_serialization_cmd_type cmd_type,
468 		wlan_serialization_apply_rules_cb apply_rules_cb);
469 
470 /**
471  * wlan_serialization_deregister_apply_rules_cb() - Deregister component's rules
472  *						callback
473  * @psoc: PSOC object information
474  * @cmd_type: Command Type
475  *
476  * This routine is called from other component during its de-initialization.
477  *
478  * Return: QDF Status
479  */
480 QDF_STATUS
481 wlan_serialization_deregister_apply_rules_cb(
482 		struct wlan_objmgr_psoc *psoc,
483 		enum wlan_serialization_cmd_type cmd_type);
484 
485 /**
486  * wlan_serialization_init() - Serialization component initialization routine
487  *
488  * Return - QDF Status
489  */
490 QDF_STATUS wlan_serialization_init(void);
491 
492 /**
493  * wlan_serialization_deinit() - Serialization component de-init routine
494  *
495  * Return - QDF Status
496  */
497 QDF_STATUS wlan_serialization_deinit(void);
498 
499 /**
500  * wlan_serialization_psoc_enable() - Serialization component enable routine
501  * @psoc: pointer to psoc
502  *
503  * Return - QDF Status
504  */
505 QDF_STATUS wlan_serialization_psoc_enable(struct wlan_objmgr_psoc *psoc);
506 
507 /**
508  * wlan_serialization_psoc_disable() - Serialization component disable routine
509  * @psoc: pointer to psoc
510  *
511  * Return - QDF Status
512  */
513 QDF_STATUS wlan_serialization_psoc_disable(struct wlan_objmgr_psoc *psoc);
514 
515 /**
516  * wlan_serialization_vdev_scan_status() - Return the status of the vdev scan
517  * @vdev: VDEV Object
518  *
519  * Return: Status of the scans for the corresponding vdev
520  */
521 enum wlan_serialization_cmd_status
522 wlan_serialization_vdev_scan_status(struct wlan_objmgr_vdev *vdev);
523 
524 /**
525  * wlan_serialization_pdev_scan_status() - Return the status of the pdev scan
526  * @pdev: PDEV Object
527  *
528  * Return: Status of the scans for the corresponding pdev
529  */
530 enum wlan_serialization_cmd_status
531 wlan_serialization_pdev_scan_status(struct wlan_objmgr_pdev *pdev);
532 
533 /**
534  * wlan_serialization_is_cmd_present_in_pending_queue() - Return if the command
535  *				is already present in pending queue
536  * @psoc: pointer to psoc
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 /**
549  * wlan_ser_is_non_scan_cmd_type_in_vdev_queue() - check if a non scan cmd
550  * type is present in pending vdev queue, without checking the cmd id
551  * @vdev: vdev on which cmd need to be check
552  * @cmd_type: command type to check
553  *
554  * Return: true or false
555  */
556 bool wlan_ser_is_non_scan_cmd_type_in_vdev_queue(struct wlan_objmgr_vdev *vdev,
557 				enum wlan_serialization_cmd_type cmd_type);
558 
559 /**
560  * wlan_serialization_is_cmd_present_in_active_queue() - Return if the command
561  *			is already present in active queue
562  * @psoc: pointer to psoc
563  * @cmd: pointer to serialization command to check
564  *
565  * This API will check if command is present in active queue. If present
566  * then return true, so use know that it is duplicated command
567  *
568  * Return: true or false
569  */
570 bool wlan_serialization_is_cmd_present_in_active_queue(
571 		struct wlan_objmgr_psoc *psoc,
572 		struct wlan_serialization_command *cmd);
573 
574 /**
575  * wlan_serialization_get_scan_cmd_using_scan_id() - Return command which
576  *					matches vdev_id and scan_id
577  * @psoc: pointer to soc
578  * @vdev_id: vdev id to pull vdev object
579  * @scan_id: scan id to match
580  * @is_scan_cmd_from_active_queue: to indicate active or pending queue
581  *
582  * This API fetches vdev/pdev object based on vdev_id, loops through scan
583  * command queue and find the command which matches scan id as well as vdev
584  * object.
585  *
586  * Return: pointer to serialization command
587  */
588 struct wlan_serialization_command*
589 wlan_serialization_get_scan_cmd_using_scan_id(
590 		struct wlan_objmgr_psoc *psoc,
591 		uint8_t vdev_id, uint16_t scan_id,
592 		uint8_t is_scan_cmd_from_active_queue);
593 
594 /**
595  * wlan_serialization_get_active_cmd() - Return active umac command which
596  *  matches vdev and cmd type
597  * @psoc: pointer to soc
598  * @vdev_id: vdev id to pull vdev object
599  * @cmd_type: cmd type to match
600  *
601  * This API fetches vdev/pdev object based on vdev_id, loops through active
602  * command queue and find the active command which matches cmd_type as well
603  * as vdev object.
604  *
605  * Return: Pointer to umac command. NULL is returned if active command of given
606  *  type is not found.
607  */
608 void *wlan_serialization_get_active_cmd(
609 		struct wlan_objmgr_psoc *psoc,
610 		uint8_t vdev_id,
611 		enum wlan_serialization_cmd_type cmd_type);
612 
613 /**
614  * wlan_serialization_get_vdev_active_cmd_type() - Return cmd type of the
615  *  active command for the given vdev
616  * @vdev: vdev object
617  *
618  * This API fetches command type of the command in the vdev active queue
619  *
620  * Return: command type of the command in the vdev active queue
621  */
622 
623 enum wlan_serialization_cmd_type
624 wlan_serialization_get_vdev_active_cmd_type(struct wlan_objmgr_vdev *vdev);
625 
626 /**
627  * wlan_ser_get_cmd_activation_status() - Return active command status
628  * @vdev: vdev object
629  *
630  * This API fetches active command state in the vdev active queue
631  *
632  * Return: success if CMD_MARKED_FOR_ACTIVATION bit is set, else fail
633  */
634 
635 QDF_STATUS
636 wlan_ser_get_cmd_activation_status(struct wlan_objmgr_vdev *vdev);
637 
638 /**
639  * wlan_ser_is_vdev_queue_enabled() - Return vdev queue status
640  * @vdev: vdev object
641  *
642  * This API return vdev queue enable status
643  *
644  * Return: true if vdev queue is enabled
645  */
646 bool wlan_ser_is_vdev_queue_enabled(struct wlan_objmgr_vdev *vdev);
647 
648 /**
649  * wlan_ser_validate_umac_cmd() - validate umac cmd data
650  * @vdev: objmgr vdev pointer
651  * @cmd_type: cmd type to match
652  * @umac_cmd_cb: Callback to be called to validate the data
653  *
654  * This API returns the validation status of the umac cmd cb.
655  * The umac_cmd_cb callback is called with serialization lock held, and hence
656  * only atomic operations are allowed in the callback.
657  *
658  * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
659  */
660 QDF_STATUS
661 wlan_ser_validate_umac_cmd(struct wlan_objmgr_vdev *vdev,
662 			   enum wlan_serialization_cmd_type cmd_type,
663 			   wlan_ser_umac_cmd_cb umac_cmd_cb);
664 
665 /**
666  * wlan_serialization_purge_all_pdev_cmd() - purge all command for given pdev
667  * @pdev: objmgr pdev pointer
668  *
669  * Return: void
670  */
671 void wlan_serialization_purge_all_pdev_cmd(struct wlan_objmgr_pdev *pdev);
672 
673 /**
674  * wlan_serialization_purge_all_cmd() - purge all command for psoc
675  * @psoc: objmgr psoc pointer
676  *
677  * Return: void
678  */
679 void wlan_serialization_purge_all_cmd(struct wlan_objmgr_psoc *psoc);
680 
681 /**
682  * wlan_serialization_purge_all_pending_cmd_by_vdev_id() - Purge all pending
683  * scan and non scan commands for vdev id
684  * @pdev: pointer to pdev
685  * @vdev_id: vdev_id variable
686  *
687  * Return: none
688  */
689 void wlan_serialization_purge_all_pending_cmd_by_vdev_id(
690 					struct wlan_objmgr_pdev *pdev,
691 					uint8_t vdev_id);
692 
693 /**
694  * wlan_serialization_purge_all_cmd_by_vdev_id() - Purge all scan and non scan
695  * commands for vdev id
696  * @pdev: pointer to pdev
697  * @vdev_id: vdev_id variable
698  *
699  * Return: none
700  */
701 void wlan_serialization_purge_all_cmd_by_vdev_id(struct wlan_objmgr_pdev *pdev,
702 						 uint8_t vdev_id);
703 
704 /**
705  * wlan_serialization_purge_all_scan_cmd_by_vdev_id() - Purge all pending/active
706  * scan commands for vdev id
707  * @pdev: pointer to pdev
708  * @vdev_id: vdev_id variable
709  *
710  * Return: none
711  */
712 void wlan_serialization_purge_all_scan_cmd_by_vdev_id(
713 					struct wlan_objmgr_pdev *pdev,
714 					uint8_t vdev_id);
715 
716 /**
717  * wlan_ser_vdev_queue_disable -Disable vdev specific serialization queue
718  * @vdev: Vdev Object
719  *
720  * This function disables the serialization for the vdev queue
721  *
722  * Return: QDF_STATUS
723  */
724 QDF_STATUS wlan_ser_vdev_queue_disable(struct wlan_objmgr_vdev *vdev);
725 
726 /**
727  * wlan_get_vdev_status() - API to check vdev scan status
728  * @vdev: vdev object
729  *
730  * Return: enum scm_scan_status
731  */
732 enum scm_scan_status
733 wlan_get_vdev_status(struct wlan_objmgr_vdev *vdev);
734 
735 /**
736  * wlan_get_pdev_status() - API to check pdev scan status
737  * @pdev: pdev object
738  *
739  * Return: enum scm_scan_status
740  */
741 enum scm_scan_status
742 wlan_get_pdev_status(struct wlan_objmgr_pdev *pdev);
743 
744 /**
745  * wlan_serialization_is_blocking_non_scan_cmd_waiting() - find if any
746  *			blocking cmd in active or pending queue
747  * @pdev: Objmgr pdev
748  *
749  * This API will be called to find out if any blocking cmd is present in
750  * active or pending queue
751  *
752  * Return: true or false
753  */
754 bool
755 wlan_serialization_is_blocking_non_scan_cmd_waiting(
756 				struct wlan_objmgr_pdev *pdev);
757 #endif
758