xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/serialization/inc/wlan_serialization_api.h (revision d63e03e207713f1d4d8a384c065ef4e076216f2e)
1 /*
2  * Copyright (c) 2017-2021 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 #include "wlan_scan_public_structs.h"
33 
34 /* Preprocessor Definitions and Constants */
35 
36 /**
37  * enum ser_queue_reason- reason for changes to serialization queue
38  * @: SER_REQUEST: queue updated for serialization request
39  * @: SER_REMOVE : queue updated for serialization remove request
40  * @: SER_CANCEL : queue updated for serialization cancel request
41  * @: SER_TIMEOUT : queue updated for command timeout
42  * @: SER_ACTIVATION_FAILED : queue updated since command activation failed
43  * @: SER_PENDING_TO_ACTIVE : queue updated for pending to active movement
44  */
45 enum ser_queue_reason {
46 	SER_REQUEST,
47 	SER_REMOVE,
48 	SER_CANCEL,
49 	SER_TIMEOUT,
50 	SER_ACTIVATION_FAILED,
51 	SER_PENDING_TO_ACTIVE,
52 	SER_QUEUE_ACTION_MAX,
53 };
54 
55 /*
56  * struct wlan_serialization_queued_cmd_info member queue_type specifies the
57  * below values to cancel the commands in these queues. Setting both the
58  * bits will cancel the commands in both the queues.
59  */
60 #define WLAN_SERIALIZATION_ACTIVE_QUEUE  0x1
61 #define WLAN_SERIALIZATION_PENDING_QUEUE 0x2
62 
63 /**
64  * enum wlan_serialization_cb_reason - reason for calling the callback
65  * @WLAN_SERIALIZATION_REASON_ACTIVATE_CMD: activate the cmd by sending it to FW
66  * @WLAN_SERIALIZATION_REASON_CANCEL_CMD: Cancel the cmd in the pending list
67  * @WLAN_SERIALIZATION_REASON_RELEASE_MEM_CMD:cmd execution complete. Release
68  *                                           the memory allocated while
69  *                                           building the command
70  * @WLAN_SER_CB_ACTIVE_CMD_TIMEOUT: active cmd has been timeout.
71  */
72 enum wlan_serialization_cb_reason {
73 	WLAN_SER_CB_ACTIVATE_CMD,
74 	WLAN_SER_CB_CANCEL_CMD,
75 	WLAN_SER_CB_RELEASE_MEM_CMD,
76 	WLAN_SER_CB_ACTIVE_CMD_TIMEOUT,
77 };
78 
79 /**
80  * struct wlan_serialization_scan_info - Information needed for scan cmd
81  * @is_cac_in_progress: boolean to check the cac status
82  * @is_tdls_in_progress: boolean to check the tdls status
83  * @is_mlme_op_in_progress: boolean to check the mlme op status
84  * @is_scan_for_connect: boolean to check if scan for connect
85  *
86  * This information is needed for scan command from other components
87  * to apply the rules and check whether the cmd is allowed or not
88  */
89 struct wlan_serialization_scan_info {
90 	bool is_cac_in_progress;
91 	bool is_tdls_in_progress;
92 	bool is_mlme_op_in_progress;
93 	bool is_scan_for_connect;
94 };
95 
96 /**
97  * union wlan_serialization_rules_info - union of all rules info structures
98  * @scan_info: information needed to apply rules on scan command
99  */
100 union wlan_serialization_rules_info {
101 	struct wlan_serialization_scan_info scan_info;
102 };
103 
104 struct wlan_serialization_command;
105 
106 /**
107  * wlan_serialization_cmd_callback() - Callback registered by the component
108  * @wlan_cmd: Command passed by the component for serialization
109  * @reason: Reason code for which the callback is being called
110  *
111  * Reason specifies the reason for which the callback is being called. callback
112  * should return success or failure based up on overall success of callback.
113  * if callback returns failure then serialization will remove the command from
114  * active queue and proceed for next pending command.
115  *
116  * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
117  */
118 typedef QDF_STATUS
119 (*wlan_serialization_cmd_callback)(struct wlan_serialization_command *wlan_cmd,
120 				   enum wlan_serialization_cb_reason reason);
121 
122 /**
123  * wlan_serialization_comp_info_cb() - callback to fill the rules information
124  * @vdev: VDEV object for which the command has been received
125  * @comp_info: Information filled by the component
126  *
127  * This callback is registered dynamically by the component with the
128  * serialization component. Serialization component invokes the callback
129  * while applying the rules for a particular command and the component
130  * fills in the required information to apply the rules
131  *
132  * Return: None
133  */
134 typedef void (*wlan_serialization_comp_info_cb)(struct wlan_objmgr_vdev *vdev,
135 		union wlan_serialization_rules_info *comp_info,
136 		struct wlan_serialization_command *cmd);
137 
138 /**
139  * wlan_serialization_apply_rules_cb() - callback per command to apply rules
140  * @comp_info: information needed to apply the rules
141  *
142  * The rules are applied using this callback and decided whether to
143  * allow or deny the command
144  *
145  * Return: true, if rules are successful and cmd can be queued
146  *         false, if rules failed and cmd should not be queued
147  */
148 typedef bool (*wlan_serialization_apply_rules_cb)(
149 		union wlan_serialization_rules_info *comp_info,
150 		uint8_t comp_id);
151 
152 /**
153  * wlan_ser_umac_cmd_cb() - callback to validate umac_cmd
154  * @umac_cmd: umac data associated with the serialization cmd
155  *
156  * This callback can be called at run time for a command in active queue to
157  * fetch the required information from the umac cmd data stored in serialization
158  * command buffer.
159  *
160  * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
161  */
162 typedef QDF_STATUS (*wlan_ser_umac_cmd_cb)(void *umac_cmd);
163 
164 /**
165  * enum wlan_umac_cmd_id - Command Type
166  * @WLAN_SER_CMD_SCAN: Scan command
167  * @WLAN_SER_CMD_NONSCAN: Non-scan command
168  * @WLAN_SER_CMD_FORCE_DISASSOC_STA: Force diassoc for STA vap
169  * @WLAN_SER_CMD_FORCE_DEAUTH_STA: Force deauth for STA vap
170  * @WLAN_SER_CMD_PERFORM_PRE_AUTH: Pre auth ops cmd
171  * @WLAN_SER_CMD_WM_STATUS_CHANGE: WM status modification cmd
172  * @WLAN_SER_CMD_NDP_INIT_REQ: NDP init request cmd
173  * @WLAN_SER_CMD_NDP_RESP_REQ: NDP response to request cmd
174  * @WLAN_SER_CMD_NDP_DATA_END_INIT_REQ: NDP data end init request
175  * @WLAN_SER_CMD_NDP_END_ALL_REQ: NDP close all request
176  * @WLAN_SER_CMD_ADDTS: ADD Ts cmd
177  * @WLAN_SER_CMD_DELTS: Del Ts cmd
178  * @WLAN_SER_CMD_TDLS_SEND_MGMT: TDLS mgmt send cmd
179  * @WLAN_SER_CMD_TDLS_ADD_PEER: TDLS cmd to add peer
180  * @WLAN_SER_CMD_TDLS_DEL_PEER: TDLS cmd to del peer
181  * @WLAN_SER_CMD_SET_HW_MODE: Cmd to set hardware mode change
182  * @WLAN_SER_CMD_NSS_UPDATE: Cmd to update NSS config
183  * @WLAN_SER_CMD_SET_DUAL_MAC_CONFIG: Cmd to set dual mac
184  * @WLAN_SER_CMD_SET_ANTENNA_MODE: Set antenna mode
185  * @WLAN_SER_CMD_VDEV_DELETE: Cmd to del vdev
186  * @WLAN_SER_CMD_VDEV_START_BSS: Cmd to start a AP VDEV
187  * @WLAN_SER_CMD_VDEV_STOP_BSS: Cmd to stop a AP VDEV
188  * @WLAN_SER_CMD_VDEV_CONNECT: Cmd to start a STA VDEV
189  * @WLAN_SER_CMD_VDEV_DISCONNECT: Cmd to stop a STA VDEV
190  * @WLAN_SER_CMD_VDEV_RESTART: Cmd to restart a VDEV
191  * @WLAN_SER_CMD_PDEV_RESTART: Cmd to restart all VDEVs of a PDEV
192  * @WLAN_SER_CMD_PDEV_CSA_RESTART: Cmd to CSA restart all AP VDEVs of a PDEV
193  * @WLAN_SER_CMD_GET_DISCONNECT_STATS: Cmd to get peer stats on disconnection
194  * @WLAN_SER_CMD_VDEV_ROAM: Cmd to roam a STA VDEV
195  */
196 enum wlan_serialization_cmd_type {
197 	/* all scan command before non-scan */
198 	WLAN_SER_CMD_SCAN,
199 	/* all non-scan command below */
200 	WLAN_SER_CMD_NONSCAN,
201 	WLAN_SER_CMD_FORCE_DISASSOC_STA,
202 	WLAN_SER_CMD_FORCE_DEAUTH_STA,
203 	WLAN_SER_CMD_PERFORM_PRE_AUTH,
204 	WLAN_SER_CMD_WM_STATUS_CHANGE,
205 	WLAN_SER_CMD_NDP_INIT_REQ,
206 	WLAN_SER_CMD_NDP_RESP_REQ,
207 	WLAN_SER_CMD_NDP_DATA_END_INIT_REQ,
208 	WLAN_SER_CMD_NDP_END_ALL_REQ,
209 	WLAN_SER_CMD_ADDTS,
210 	WLAN_SER_CMD_DELTS,
211 	WLAN_SER_CMD_TDLS_SEND_MGMT,
212 	WLAN_SER_CMD_TDLS_ADD_PEER,
213 	WLAN_SER_CMD_TDLS_DEL_PEER,
214 	WLAN_SER_CMD_SET_HW_MODE,
215 	WLAN_SER_CMD_NSS_UPDATE,
216 	WLAN_SER_CMD_SET_DUAL_MAC_CONFIG,
217 	WLAN_SER_CMD_SET_ANTENNA_MODE,
218 	WLAN_SER_CMD_VDEV_DELETE,
219 	WLAN_SER_CMD_VDEV_START_BSS,
220 	WLAN_SER_CMD_VDEV_STOP_BSS,
221 	WLAN_SER_CMD_VDEV_CONNECT,
222 	WLAN_SER_CMD_VDEV_DISCONNECT,
223 	WLAN_SER_CMD_VDEV_RESTART,
224 	WLAN_SER_CMD_PDEV_RESTART,
225 	WLAN_SER_CMD_PDEV_CSA_RESTART,
226 	WLAN_SER_CMD_GET_DISCONNECT_STATS,
227 	WLAN_SER_CMD_VDEV_ROAM,
228 	WLAN_SER_CMD_MAX
229 };
230 
231 /**
232  * enum wlan_serialization_cancel_type - Type of commands to be cancelled
233  * @WLAN_SER_CANCEL_SINGLE_SCAN: Cancel a single scan with a given ID
234  * @WLAN_SER_CANCEL_PDEV_SCANS: Cancel all the scans on a given pdev
235  * @WLAN_SER_CANCEL_VDEV_SCANS: Cancel all the scans on given vdev
236  * @WLAN_SER_CANCEL_VDEV_HOST_SCANS: Cancel all host scans on given vdev
237  * @WLAN_SER_CANCEL_PDEV_NON_SCAN_CMD: Cancel all non scans on a given pdev
238  * @WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD: Cancel all non scans on a given vdev
239  * @WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD_TYPE: Cancel all non scans on a given vdev
240  * and matching cmd type
241  * @WLAN_SER_CANCEL_VDEV_NON_SCAN_NB_CMD: Cancel all non-blocking,
242  * non-scan commands of a given vdev
243  * @WLAN_SER_CANCEL_NON_SCAN_CMD: Cancel the given non scan command
244  */
245 enum wlan_serialization_cancel_type {
246 	WLAN_SER_CANCEL_SINGLE_SCAN,
247 	WLAN_SER_CANCEL_PDEV_SCANS,
248 	WLAN_SER_CANCEL_VDEV_SCANS,
249 	WLAN_SER_CANCEL_VDEV_HOST_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_update_timer() -Update timer for an active command
390  * @cmd: Command information
391  *
392  * Return: Status of the timer update
393  */
394 QDF_STATUS
395 wlan_serialization_update_timer(struct wlan_serialization_command *cmd);
396 
397 /**
398  * wlan_serialization_request() - Request to serialize a command
399  * @cmd: Command information
400  *
401  * Return: Status of the serialization request
402  */
403 enum wlan_serialization_status
404 wlan_serialization_request(struct wlan_serialization_command *cmd);
405 
406 /**
407  * wlan_serialization_register_comp_info_cb() - Register component's info cb
408  * @psoc: PSOC object information
409  * @comp_id: Component ID
410  * @cmd_type: Command Type
411  * @cb: Callback
412  *
413  * This is called from component during its initialization.It initializes
414  * callback handler for given comp_id/cmd_id in a 2-D array.
415  *
416  * Return: QDF Status
417  */
418 QDF_STATUS
419 wlan_serialization_register_comp_info_cb(
420 		struct wlan_objmgr_psoc *psoc,
421 		enum wlan_umac_comp_id comp_id,
422 		enum wlan_serialization_cmd_type cmd_type,
423 		wlan_serialization_comp_info_cb cb);
424 
425 /**
426  * wlan_serialization_deregister_comp_info_cb() - Deregister component's info
427  *						callback
428  * @psoc: PSOC object information
429  * @comp_id: Component ID
430  * @cmd_type: Command Type
431  *
432  * This routine is called from other component during its de-initialization.
433  *
434  * Return: QDF Status
435  */
436 QDF_STATUS
437 wlan_serialization_deregister_comp_info_cb(
438 		struct wlan_objmgr_psoc *psoc,
439 		enum wlan_umac_comp_id comp_id,
440 		enum wlan_serialization_cmd_type cmd_type);
441 
442 /**
443  * wlan_serialization_register_apply_rules_cb() - Register component's rules
444  *						callback
445  * @psoc: PSOC object information
446  * @cmd_type: Command Type
447  * @cb: Callback
448  *
449  * This is called from component during its initialization.It initializes
450  * callback handler for given cmd_type in a 1-D array.
451  *
452  * Return: QDF Status
453  */
454 QDF_STATUS
455 wlan_serialization_register_apply_rules_cb(
456 		struct wlan_objmgr_psoc *psoc,
457 		enum wlan_serialization_cmd_type cmd_type,
458 		wlan_serialization_apply_rules_cb apply_rules_cb);
459 
460 /**
461  * wlan_serialization_deregister_apply_rules_cb() - Deregister component's rules
462  *						callback
463  * @psoc: PSOC object information
464  * @cmd_type: Command Type
465  *
466  * This routine is called from other component during its de-initialization.
467  *
468  * Return: QDF Status
469  */
470 QDF_STATUS
471 wlan_serialization_deregister_apply_rules_cb(
472 		struct wlan_objmgr_psoc *psoc,
473 		enum wlan_serialization_cmd_type cmd_type);
474 
475 /**
476  * @wlan_serialization_init() - Serialization component initialization routine
477  *
478  * Return - QDF Status
479  */
480 QDF_STATUS wlan_serialization_init(void);
481 
482 /**
483  * @wlan_serialization_deinit() - Serialization component de-init routine
484  *
485  * Return - QDF Status
486  */
487 QDF_STATUS wlan_serialization_deinit(void);
488 
489 /**
490  * @wlan_serialization_psoc_enable() - Serialization component enable routine
491  *
492  * Return - QDF Status
493  */
494 QDF_STATUS wlan_serialization_psoc_enable(struct wlan_objmgr_psoc *psoc);
495 
496 /**
497  * @wlan_serialization_psoc_disable() - Serialization component disable routine
498  *
499  * Return - QDF Status
500  */
501 QDF_STATUS wlan_serialization_psoc_disable(struct wlan_objmgr_psoc *psoc);
502 
503 /**
504  * wlan_serialization_vdev_scan_status() - Return the status of the vdev scan
505  * @vdev: VDEV Object
506  *
507  * Return: Status of the scans for the corresponding vdev
508  */
509 enum wlan_serialization_cmd_status
510 wlan_serialization_vdev_scan_status(struct wlan_objmgr_vdev *vdev);
511 
512 /**
513  * wlan_serialization_pdev_scan_status() - Return the status of the pdev scan
514  * @pdev: PDEV Object
515  *
516  * Return: Status of the scans for the corresponding pdev
517  */
518 enum wlan_serialization_cmd_status
519 wlan_serialization_pdev_scan_status(struct wlan_objmgr_pdev *pdev);
520 
521 /**
522  * wlan_serialization_non_scan_cmd_status() - Return status of pdev non-scan cmd
523  * @pdev: PDEV Object
524  * @cmd_id: ID of the command for which the status has to be checked
525  *
526  * Return: Status of the command for the corresponding pdev
527  */
528 enum wlan_serialization_cmd_status
529 wlan_serialization_non_scan_cmd_status(struct wlan_objmgr_pdev *pdev,
530 				       enum wlan_serialization_cmd_type cmd_id);
531 
532 /**
533  * wlan_serialization_is_cmd_present_in_pending_queue() - Return if the command
534  *				is already present in pending queue
535  * @cmd: pointer to serialization command to check
536  *
537  * This API will check if command is present in pending queue. If present
538  * then return true, so use know that it is duplicated command
539  *
540  * Return: true or false
541  */
542 bool wlan_serialization_is_cmd_present_in_pending_queue(
543 		struct wlan_objmgr_psoc *psoc,
544 		struct wlan_serialization_command *cmd);
545 /**
546  * wlan_serialization_is_cmd_present_in_active_queue() - Return if the command
547  *			is already present in active queue
548  * @cmd: pointer to serialization command to check
549  *
550  * This API will check if command is present in active queue. If present
551  * then return true, so use know that it is duplicated command
552  *
553  * Return: true or false
554  */
555 bool wlan_serialization_is_cmd_present_in_active_queue(
556 		struct wlan_objmgr_psoc *psoc,
557 		struct wlan_serialization_command *cmd);
558 
559 /**
560  * wlan_serialization_get_scan_cmd_using_scan_id() - Return command which
561  *					matches vdev_id and scan_id
562  * @psoc: pointer to soc
563  * @vdev_id: vdev id to pull vdev object
564  * @scan_id: scan id to match
565  * @is_scan_cmd_from_active_queue: to indicate active or pending queue
566  *
567  * This API fetches vdev/pdev object based on vdev_id, loops through scan
568  * command queue and find the command which matches scan id as well as vdev
569  * object.
570  *
571  * Return: pointer to serialization command
572  */
573 struct wlan_serialization_command*
574 wlan_serialization_get_scan_cmd_using_scan_id(
575 		struct wlan_objmgr_psoc *psoc,
576 		uint8_t vdev_id, uint16_t scan_id,
577 		uint8_t is_scan_cmd_from_active_queue);
578 /**
579  * wlan_serialization_get_active_cmd() - Return active umac command which
580  *  matches vdev and cmd type
581  * @psoc: pointer to soc
582  * @vdev_id: vdev id to pull vdev object
583  * @cmd_type: cmd type to match
584  *
585  * This API fetches vdev/pdev object based on vdev_id, loops through active
586  * command queue and find the active command which matches cmd_type as well
587  * as vdev object.
588  *
589  * Return: Pointer to umac command. NULL is returned if active command of given
590  *  type is not found.
591  */
592 void *wlan_serialization_get_active_cmd(
593 		struct wlan_objmgr_psoc *psoc,
594 		uint8_t vdev_id,
595 		enum wlan_serialization_cmd_type cmd_type);
596 
597 /**
598  * wlan_serialization_get_vdev_active_cmd_type() - Return cmd type of the
599  *  active command for the given vdev
600  * @vdev: vdev object
601  *
602  * This API fetches command type of the command in the vdev active queue
603  *
604  * Return: command type of the command in the vdev active queue
605  */
606 
607 enum wlan_serialization_cmd_type
608 wlan_serialization_get_vdev_active_cmd_type(struct wlan_objmgr_vdev *vdev);
609 
610 /**
611  * wlan_ser_get_cmd_activation_status() - Return active command status
612  * @vdev: vdev object
613  *
614  * This API fetches active command state in the vdev active queue
615  *
616  * Return: success if CMD_MARKED_FOR_ACTIVATION bit is set, else fail
617  */
618 
619 QDF_STATUS
620 wlan_ser_get_cmd_activation_status(struct wlan_objmgr_vdev *vdev);
621 
622 /**
623  * wlan_ser_is_vdev_queue_enabled() - Return vdev queue status
624  * @vdev: vdev object
625  *
626  * This API return vdev queue enable status
627  *
628  * Return: true if vdev queue is enabled
629  */
630 bool wlan_ser_is_vdev_queue_enabled(struct wlan_objmgr_vdev *vdev);
631 
632 /**
633  * wlan_ser_validate_umac_cmd() - validate umac cmd data
634  * @vdev: objmgr vdev pointer
635  * @cmd_type: cmd type to match
636  * @umac_cmd_cb: Callback to be called to validate the data
637  *
638  * This API returns the validation status of the umac cmd cb.
639  * The umac_cmd_cb callback is called with serialization lock held, and hence
640  * only atomic operations are allowed in the callback.
641  *
642  * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
643  */
644 QDF_STATUS
645 wlan_ser_validate_umac_cmd(struct wlan_objmgr_vdev *vdev,
646 			   enum wlan_serialization_cmd_type cmd_type,
647 			   wlan_ser_umac_cmd_cb umac_cmd_cb);
648 
649 /**
650  * wlan_serialization_purge_all_pdev_cmd() - purge all command for given pdev
651  * @pdev: objmgr pdev pointer
652  *
653  * Return: void
654  */
655 void wlan_serialization_purge_all_pdev_cmd(struct wlan_objmgr_pdev *pdev);
656 
657 /**
658  * wlan_serialization_purge_all_cmd() - purge all command for psoc
659  * @psoc: objmgr psoc pointer
660  *
661  * Return: void
662  */
663 void wlan_serialization_purge_all_cmd(struct wlan_objmgr_psoc *psoc);
664 
665 /**
666  * wlan_serialization_purge_all_pending_cmd_by_vdev_id() - Purge all pending
667  * scan and non scan commands for vdev id
668  * @pdev: pointer to pdev
669  * @vdev_id: vdev_id variable
670  *
671  * Return: none
672  */
673 void wlan_serialization_purge_all_pending_cmd_by_vdev_id(
674 					struct wlan_objmgr_pdev *pdev,
675 					uint8_t vdev_id);
676 
677 /**
678  * wlan_serialization_purge_all_cmd_by_vdev_id() - Purge all scan and non scan
679  * commands for vdev id
680  * @pdev: pointer to pdev
681  * @vdev_id: vdev_id variable
682  *
683  * Return: none
684  */
685 void wlan_serialization_purge_all_cmd_by_vdev_id(struct wlan_objmgr_pdev *pdev,
686 						 uint8_t vdev_id);
687 
688 /**
689  * wlan_serialization_purge_all_scan_cmd_by_vdev_id() - Purge all pending/active
690  * scan commands for vdev id
691  * @pdev: pointer to pdev
692  * @vdev_id: vdev_id variable
693  *
694  * Return: none
695  */
696 void wlan_serialization_purge_all_scan_cmd_by_vdev_id(
697 					struct wlan_objmgr_pdev *pdev,
698 					uint8_t vdev_id);
699 
700 /**
701  * wlan_ser_vdev_queue_disable -Disable vdev specific serialization queue
702  * @vdev: Vdev Object
703  *
704  * This function disables the serialization for the vdev queue
705  *
706  * Return: QDF_STATUS
707  */
708 QDF_STATUS wlan_ser_vdev_queue_disable(struct wlan_objmgr_vdev *vdev);
709 
710 /**
711  * wlan_get_vdev_status() - API to check vdev scan status
712  * @vdev: vdev object
713  *
714  * Return: enum scm_scan_status
715  */
716 enum scm_scan_status
717 wlan_get_vdev_status(struct wlan_objmgr_vdev *vdev);
718 
719 /**
720  * wlan_get_pdev_status() - API to check pdev scan status
721  * @pdev: pdev object
722  *
723  * Return: enum scm_scan_status
724  */
725 enum scm_scan_status
726 wlan_get_pdev_status(struct wlan_objmgr_pdev *pdev);
727 #endif
728