xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/serialization/inc/wlan_serialization_api.h (revision 503663c6daafffe652fa360bde17243568cd6d2a)
1 /*
2  * Copyright (c) 2017-2019 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  */
195 enum wlan_serialization_cmd_type {
196 	/* all scan command before non-scan */
197 	WLAN_SER_CMD_SCAN,
198 	/* all non-scan command below */
199 	WLAN_SER_CMD_NONSCAN,
200 	WLAN_SER_CMD_HDD_ISSUE_REASSOC_SAME_AP,
201 	WLAN_SER_CMD_SME_ISSUE_REASSOC_SAME_AP,
202 	WLAN_SER_CMD_SME_ISSUE_DISASSOC_FOR_HANDOFF,
203 	WLAN_SER_CMD_SME_ISSUE_ASSOC_TO_SIMILAR_AP,
204 	WLAN_SER_CMD_FORCE_IBSS_LEAVE,
205 	WLAN_SER_CMD_SME_ISSUE_FT_REASSOC,
206 	WLAN_SER_CMD_FORCE_DISASSOC_STA,
207 	WLAN_SER_CMD_FORCE_DEAUTH_STA,
208 	WLAN_SER_CMD_PERFORM_PRE_AUTH,
209 	WLAN_SER_CMD_WM_STATUS_CHANGE,
210 	WLAN_SER_CMD_NDP_INIT_REQ,
211 	WLAN_SER_CMD_NDP_RESP_REQ,
212 	WLAN_SER_CMD_NDP_DATA_END_INIT_REQ,
213 	WLAN_SER_CMD_NDP_END_ALL_REQ,
214 	WLAN_SER_CMD_ADDTS,
215 	WLAN_SER_CMD_DELTS,
216 	WLAN_SER_CMD_TDLS_SEND_MGMT,
217 	WLAN_SER_CMD_TDLS_ADD_PEER,
218 	WLAN_SER_CMD_TDLS_DEL_PEER,
219 	WLAN_SER_CMD_SET_HW_MODE,
220 	WLAN_SER_CMD_NSS_UPDATE,
221 	WLAN_SER_CMD_SET_DUAL_MAC_CONFIG,
222 	WLAN_SER_CMD_SET_ANTENNA_MODE,
223 	WLAN_SER_CMD_VDEV_DELETE,
224 	WLAN_SER_CMD_VDEV_START_BSS,
225 	WLAN_SER_CMD_VDEV_STOP_BSS,
226 	WLAN_SER_CMD_VDEV_CONNECT,
227 	WLAN_SER_CMD_VDEV_DISCONNECT,
228 	WLAN_SER_CMD_VDEV_RESTART,
229 	WLAN_SER_CMD_PDEV_RESTART,
230 	WLAN_SER_CMD_MAX
231 };
232 
233 /**
234  * enum wlan_serialization_cancel_type - Type of commands to be cancelled
235  * @WLAN_SER_CANCEL_SINGLE_SCAN: Cancel a single scan with a given ID
236  * @WLAN_SER_CANCEL_PDEV_SCANS: Cancel all the scans on a given pdev
237  * @WLAN_SER_CANCEL_VDEV_SCANS: Cancel all the 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_PDEV_NON_SCAN_CMD,
251 	WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD,
252 	WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD_TYPE,
253 	WLAN_SER_CANCEL_VDEV_NON_SCAN_NB_CMD,
254 	WLAN_SER_CANCEL_NON_SCAN_CMD,
255 	WLAN_SER_CANCEL_MAX,
256 };
257 
258 /**
259  * enum wlan_serialization_status - Return status of cmd serialization request
260  * @WLAN_SER_CMD_PENDING: Command is put into the pending queue
261  * @WLAN_SER_CMD_ACTIVE: Command is activated and put in active queue
262  * @WLAN_SER_CMD_DENIED_RULES_FAILED: Command denied as the rules fail
263  * @WLAN_SER_CMD_DENIED_LIST_FULL: Command denied as the pending list is full
264  * @WLAN_SER_CMD_QUEUE_DISABLED: Command denied as the queue is disabled
265  * @WLAN_SER_CMD_ALREADY_EXISTS: Command already exists in the queue
266  * @WLAN_SER_CMD_DENIED_UNSPECIFIED: Command denied due to unknown reason
267  */
268 enum wlan_serialization_status {
269 	WLAN_SER_CMD_PENDING,
270 	WLAN_SER_CMD_ACTIVE,
271 	WLAN_SER_CMD_DENIED_RULES_FAILED,
272 	WLAN_SER_CMD_DENIED_LIST_FULL,
273 	WLAN_SER_CMD_QUEUE_DISABLED,
274 	WLAN_SER_CMD_ALREADY_EXISTS,
275 	WLAN_SER_CMD_DENIED_UNSPECIFIED,
276 };
277 
278 /**
279  * enum wlan_serialization_cmd_status - Return status for a cancel request
280  * @WLAN_SER_CMD_IN_PENDING_LIST: Command cancelled from pending list
281  * @WLAN_SER_CMD_IN_ACTIVE_LIST: Command cancelled from active list
282  * @WLAN_SER_CMDS_IN_ALL_LISTS: Command cancelled from all lists
283  * @WLAN_SER_CMD_NOT_FOUND: Specified command to be cancelled
284  *                                    not found in the lists
285  */
286 enum wlan_serialization_cmd_status {
287 	WLAN_SER_CMD_IN_PENDING_LIST,
288 	WLAN_SER_CMD_IN_ACTIVE_LIST,
289 	WLAN_SER_CMDS_IN_ALL_LISTS,
290 	WLAN_SER_CMD_MARKED_FOR_ACTIVATION,
291 	WLAN_SER_CMD_NOT_FOUND,
292 };
293 
294 /**
295  * enum wlan_ser_cmd_attr - Serialization cmd attribute
296  * @WLAN_SER_CMD_ATTR_NONE - No attribuate associated
297  * @WLAN_SER_CMD_ATTR_BLOCK - Blocking attribute
298  * @WLAN_SER_CMD_ATTR_NONBLOCK - Non-blocking attribute
299  */
300 enum wlan_ser_cmd_attr {
301 	WLAN_SER_CMD_ATTR_NONE,
302 	WLAN_SER_CMD_ATTR_BLOCK,
303 	WLAN_SER_CMD_ATTR_NONBLOCK,
304 };
305 
306 /**
307  * struct wlan_serialization_command - Command to be serialized
308  * @wlan_serialization_cmd_type: Type of command
309  * @cmd_id: Command Identifier
310  * @cmd_cb: Command callback
311  * @source: component ID of the source of the command
312  * @is_high_priority: Normal/High Priority at which the cmd has to be queued
313  * @is_blocking: Is the command blocking
314  * @queue_disable: Should the command disable the queues
315  * @activation_reason: reason the activation cb was called
316  * @cmd_timeout_cb: Command timeout callback
317  * @cmd_timeout_duration: Timeout duration in milliseconds
318  * @vdev: VDEV object associated to the command
319  * @umac_cmd: Actual command that needs to be sent to WMI/firmware
320  *
321  * Note: Unnamed union has been used in this structure, so that in future if
322  * somebody wants to add pdev or psoc structure then that person can add without
323  * modifying existing code.
324  */
325 struct wlan_serialization_command {
326 	enum wlan_serialization_cmd_type cmd_type;
327 	uint32_t cmd_id;
328 	wlan_serialization_cmd_callback cmd_cb;
329 	enum wlan_umac_comp_id source;
330 	uint8_t is_high_priority:1,
331 		is_blocking:1,
332 		queue_disable:1,
333 		activation_reason:3;
334 	uint32_t cmd_timeout_duration;
335 	union {
336 		struct wlan_objmgr_vdev *vdev;
337 	};
338 	void *umac_cmd;
339 };
340 
341 /**
342  * struct wlan_serialization_queued_cmd_info  - cmd that has to be cancelled
343  * @requestor: component ID of the source requesting this action
344  * @cmd_type: Command type
345  * @cmd_id: Command ID
346  * @req_type: Commands that need to be cancelled
347  * @vdev: VDEV object associated to the command
348  * @queue_type: Queues from which the command to be cancelled
349  */
350 struct wlan_serialization_queued_cmd_info {
351 	enum wlan_umac_comp_id requestor;
352 	enum wlan_serialization_cmd_type cmd_type;
353 	uint32_t cmd_id;
354 	enum wlan_serialization_cancel_type req_type;
355 	union {
356 		struct wlan_objmgr_vdev *vdev;
357 	};
358 	uint8_t queue_type;
359 };
360 
361 /**
362  * wlan_serialization_cancel_request() - Request to cancel a command
363  * @req: Request information
364  *
365  * This API is used by external components to cancel a command
366  * that is either in the pending or active queue. Based on the
367  * req_type, it is decided whether to use pdev or vdev
368  * object. For all non-scan commands, it will be pdev.
369  *
370  * Return: Status specifying the removal of a command from a certain queue
371  */
372 enum wlan_serialization_cmd_status
373 wlan_serialization_cancel_request(
374 		struct wlan_serialization_queued_cmd_info *req);
375 
376 /**
377  * wlan_serialization_remove_cmd() - Request to release a command
378  * @cmd: Command information
379  *
380  * This API is used to release a command sitting in the active
381  * queue upon successful completion of the command
382  *
383  * Return: None
384  */
385 void wlan_serialization_remove_cmd(
386 		struct wlan_serialization_queued_cmd_info *cmd);
387 
388 /**
389  * wlan_serialization_flush_cmd() - Request to flush command
390  * @cmd: Command information
391  *
392  * This API is used to flush a cmd sitting in the queue. It
393  * simply flushes the cmd from the queue and does not call
394  * any callbacks in between. If the request is for active
395  * queue, and if the active queue becomes empty upon flush,
396  * then it will pick the next pending cmd and put in the active
397  * queue before returning.
398  *
399  * Return: None
400  */
401 void wlan_serialization_flush_cmd(
402 		struct wlan_serialization_queued_cmd_info *cmd);
403 
404 /**
405  * wlan_serialization_update_timer() -Update timer for an active command
406  * @cmd: Command information
407  *
408  * Return: Status of the timer update
409  */
410 QDF_STATUS
411 wlan_serialization_update_timer(struct wlan_serialization_command *cmd);
412 
413 /**
414  * wlan_serialization_request() - Request to serialize a command
415  * @cmd: Command information
416  *
417  * Return: Status of the serialization request
418  */
419 enum wlan_serialization_status
420 wlan_serialization_request(struct wlan_serialization_command *cmd);
421 
422 /**
423  * wlan_serialization_register_comp_info_cb() - Register component's info cb
424  * @psoc: PSOC object information
425  * @comp_id: Component ID
426  * @cmd_type: Command Type
427  * @cb: Callback
428  *
429  * This is called from component during its initialization.It initializes
430  * callback handler for given comp_id/cmd_id in a 2-D array.
431  *
432  * Return: QDF Status
433  */
434 QDF_STATUS
435 wlan_serialization_register_comp_info_cb(
436 		struct wlan_objmgr_psoc *psoc,
437 		enum wlan_umac_comp_id comp_id,
438 		enum wlan_serialization_cmd_type cmd_type,
439 		wlan_serialization_comp_info_cb cb);
440 
441 /**
442  * wlan_serialization_deregister_comp_info_cb() - Deregister component's info
443  *						callback
444  * @psoc: PSOC object information
445  * @comp_id: Component ID
446  * @cmd_type: Command Type
447  *
448  * This routine is called from other component during its de-initialization.
449  *
450  * Return: QDF Status
451  */
452 QDF_STATUS
453 wlan_serialization_deregister_comp_info_cb(
454 		struct wlan_objmgr_psoc *psoc,
455 		enum wlan_umac_comp_id comp_id,
456 		enum wlan_serialization_cmd_type cmd_type);
457 
458 /**
459  * wlan_serialization_register_apply_rules_cb() - Register component's rules
460  *						callback
461  * @psoc: PSOC object information
462  * @cmd_type: Command Type
463  * @cb: Callback
464  *
465  * This is called from component during its initialization.It initializes
466  * callback handler for given cmd_type in a 1-D array.
467  *
468  * Return: QDF Status
469  */
470 QDF_STATUS
471 wlan_serialization_register_apply_rules_cb(
472 		struct wlan_objmgr_psoc *psoc,
473 		enum wlan_serialization_cmd_type cmd_type,
474 		wlan_serialization_apply_rules_cb apply_rules_cb);
475 
476 /**
477  * wlan_serialization_deregister_apply_rules_cb() - Deregister component's rules
478  *						callback
479  * @psoc: PSOC object information
480  * @cmd_type: Command Type
481  *
482  * This routine is called from other component during its de-initialization.
483  *
484  * Return: QDF Status
485  */
486 QDF_STATUS
487 wlan_serialization_deregister_apply_rules_cb(
488 		struct wlan_objmgr_psoc *psoc,
489 		enum wlan_serialization_cmd_type cmd_type);
490 
491 /**
492  * @wlan_serialization_init() - Serialization component initialization routine
493  *
494  * Return - QDF Status
495  */
496 QDF_STATUS wlan_serialization_init(void);
497 
498 /**
499  * @wlan_serialization_deinit() - Serialization component de-init routine
500  *
501  * Return - QDF Status
502  */
503 QDF_STATUS wlan_serialization_deinit(void);
504 
505 /**
506  * @wlan_serialization_psoc_enable() - Serialization component enable routine
507  *
508  * Return - QDF Status
509  */
510 QDF_STATUS wlan_serialization_psoc_enable(struct wlan_objmgr_psoc *psoc);
511 
512 /**
513  * @wlan_serialization_psoc_disable() - Serialization component disable routine
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_non_scan_cmd_status() - Return status of pdev non-scan cmd
539  * @pdev: PDEV Object
540  * @cmd_id: ID of the command for which the status has to be checked
541  *
542  * Return: Status of the command for the corresponding pdev
543  */
544 enum wlan_serialization_cmd_status
545 wlan_serialization_non_scan_cmd_status(struct wlan_objmgr_pdev *pdev,
546 				       enum wlan_serialization_cmd_type cmd_id);
547 
548 /**
549  * wlan_serialization_is_cmd_present_in_pending_queue() - Return if the command
550  *				is already present in pending queue
551  * @cmd: pointer to serialization command to check
552  *
553  * This API will check if command is present in pending queue. If present
554  * then return true, so use know that it is duplicated command
555  *
556  * Return: true or false
557  */
558 bool wlan_serialization_is_cmd_present_in_pending_queue(
559 		struct wlan_objmgr_psoc *psoc,
560 		struct wlan_serialization_command *cmd);
561 /**
562  * wlan_serialization_is_cmd_present_in_active_queue() - Return if the command
563  *			is already present in active queue
564  * @cmd: pointer to serialization command to check
565  *
566  * This API will check if command is present in active queue. If present
567  * then return true, so use know that it is duplicated command
568  *
569  * Return: true or false
570  */
571 bool wlan_serialization_is_cmd_present_in_active_queue(
572 		struct wlan_objmgr_psoc *psoc,
573 		struct wlan_serialization_command *cmd);
574 
575 /**
576  * wlan_serialization_get_scan_cmd_using_scan_id() - Return command which
577  *					matches vdev_id and scan_id
578  * @psoc: pointer to soc
579  * @vdev_id: vdev id to pull vdev object
580  * @scan_id: scan id to match
581  * @is_scan_cmd_from_active_queue: to indicate active or pending queue
582  *
583  * This API fetches vdev/pdev object based on vdev_id, loops through scan
584  * command queue and find the command which matches scan id as well as vdev
585  * object.
586  *
587  * Return: pointer to serialization command
588  */
589 struct wlan_serialization_command*
590 wlan_serialization_get_scan_cmd_using_scan_id(
591 		struct wlan_objmgr_psoc *psoc,
592 		uint8_t vdev_id, uint16_t scan_id,
593 		uint8_t is_scan_cmd_from_active_queue);
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_scan_cmd_by_vdev_id() - Purge all pending/active
695  * scan 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_scan_cmd_by_vdev_id(
702 					struct wlan_objmgr_pdev *pdev,
703 					uint8_t vdev_id);
704 
705 /**
706  * wlan_ser_vdev_queue_disable -Disable vdev specific serialization queue
707  * @vdev: Vdev Object
708  *
709  * This function disables the serialization for the vdev queue
710  *
711  * Return: QDF_STATUS
712  */
713 QDF_STATUS wlan_ser_vdev_queue_disable(struct wlan_objmgr_vdev *vdev);
714 #endif
715