1 /*
2  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-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  * DOC: wlan_serialization_utils_i.h
21  * This file defines the prototypes for the utility helper functions
22  * for the serialization component.
23  */
24 #ifndef __WLAN_SERIALIZATION_UTILS_I_H
25 #define __WLAN_SERIALIZATION_UTILS_I_H
26 
27 #include <qdf_status.h>
28 #include <qdf_list.h>
29 #include <qdf_mc_timer.h>
30 #include <wlan_objmgr_cmn.h>
31 #include <wlan_objmgr_global_obj.h>
32 #include <wlan_objmgr_psoc_obj.h>
33 #include <wlan_scan_ucfg_api.h>
34 #include "wlan_serialization_rules_i.h"
35 #ifdef WLAN_SER_DEBUG
36 #include "wlan_serialization_debug_i.h"
37 #endif
38 
39 /*
40  * Below bit positions are used to identify if a
41  * serialization command is in use or marked for
42  * deletion.
43  * CMD_MARKED_FOR_ACTIVATION - The command is about to be activated
44  * CMD_IS_ACTIVE - The command is active and currently in use
45  */
46 #define CMD_MARKED_FOR_ACTIVATION     1
47 #define CMD_IS_ACTIVE                 2
48 #define CMD_ACTIVE_MARKED_FOR_CANCEL  3
49 #define CMD_ACTIVE_MARKED_FOR_REMOVAL 4
50 #define CMD_MARKED_FOR_MOVEMENT       5
51 /**
52  * struct wlan_serialization_timer - Timer used for serialization
53  * @cmd:      Cmd to which the timer is linked
54  * @timer:    Timer associated with the command
55  *
56  * Timers are allocated statically during init, one each for the
57  * maximum active commands permitted in the system. Once a cmd is
58  * moved from pending list to active list, the timer is activated
59  * and once the cmd is completed, the timer is cancelled. Timer is
60  * also cancelled if the command is aborted
61  *
62  * The timers are maintained per psoc. A timer is associated to
63  * unique combination of pdev, cmd_type and cmd_id.
64  */
65 struct wlan_serialization_timer {
66 	struct wlan_serialization_command *cmd;
67 	qdf_timer_t timer;
68 };
69 
70 /**
71  * enum wlan_serialization_node - Types of available nodes in serialization list
72  * @WLAN_SER_PDEV_NODE: pdev node from the pdev queue
73  * @WLAN_SER_VDEV_NODE: vdev node from the vdev queue
74  */
75 enum wlan_serialization_node {
76 	WLAN_SER_PDEV_NODE,
77 	WLAN_SER_VDEV_NODE,
78 };
79 
80 /**
81  * struct wlan_serialization_command_list - List of commands to be serialized
82  * @pdev_node: PDEV node identifier in the list
83  * @vdev_node: VDEV node identifier in the list
84  * @cmd: Command to be serialized
85  * @cmd_in_use: flag to check if the node/entry is logically active
86  */
87 struct wlan_serialization_command_list {
88 	qdf_list_node_t pdev_node;
89 	qdf_list_node_t vdev_node;
90 	struct wlan_serialization_command cmd;
91 	unsigned long cmd_in_use;
92 };
93 
94 /**
95  * struct wlan_serialization_pdev_queue - queue data related to pdev
96  * @active_list: list to hold the commands currently being executed
97  * @pending_list: list to hold the commands currently pending
98  * @cmd_pool_list: list to hold the global command pool
99  * @vdev_active_cmd_bitmap: Active cmd bitmap of vdev for the given pdev
100  * @blocking_cmd_active: Indicate if a blocking cmd is in active execution
101  * @blocking_cmd_waiting: Indicate if a blocking cmd is in pending queue
102  * @pdev_queue_lock: pdev lock to protect concurrent operations on the queues
103  * @history: serialization history
104  */
105 struct wlan_serialization_pdev_queue {
106 	qdf_list_t active_list;
107 	qdf_list_t pending_list;
108 	qdf_list_t cmd_pool_list;
109 	qdf_bitmap(vdev_active_cmd_bitmap, WLAN_UMAC_PSOC_MAX_VDEVS);
110 	bool blocking_cmd_active;
111 	uint16_t blocking_cmd_waiting;
112 	qdf_spinlock_t pdev_queue_lock;
113 #ifdef WLAN_SER_DEBUG
114 	struct ser_history history;
115 #endif
116 };
117 
118 /**
119  * struct wlan_serialization_vdev_queue - queue data related to vdev
120  * @active_list: list to hold the commands currently being executed
121  * @pending_list: list: to hold the commands currently pending
122  * @queue_disable: is the queue disabled
123  */
124 struct wlan_serialization_vdev_queue {
125 	qdf_list_t active_list;
126 	qdf_list_t pending_list;
127 	bool queue_disable;
128 };
129 
130 /**
131  * enum serialization_pdev_queue_type - Types of available pdev queues
132  * @SER_PDEV_QUEUE_COMP_SCAN: Scan queue
133  * @SER_PDEV_QUEUE_COMP_NON_SCAN: Non Scan queue
134  * @SER_PDEV_QUEUE_COMP_MAX: Max enumeration
135  */
136 enum serialization_pdev_queue_type {
137 	SER_PDEV_QUEUE_COMP_SCAN,
138 	SER_PDEV_QUEUE_COMP_NON_SCAN,
139 	SER_PDEV_QUEUE_COMP_MAX,
140 };
141 
142 /**
143  * enum serialization_vdev_queue_type - Types of available vdev queues
144  * @SER_VDEV_QUEUE_COMP_NON_SCAN: Non Scan queue
145  * @SER_VDEV_QUEUE_COMP_MAX: Max enumeration
146  */
147 enum serialization_vdev_queue_type {
148 	SER_VDEV_QUEUE_COMP_NON_SCAN,
149 	SER_VDEV_QUEUE_COMP_MAX,
150 };
151 
152 /**
153  * enum wlan_serialization_match_type - Comparison options for a command
154  * @WLAN_SER_MATCH_VDEV: Compare vdev
155  * @WLAN_SER_MATCH_PDEV: Compare pdev
156  * @WLAN_SER_MATCH_CMD_TYPE_VDEV: Compare command type and vdev
157  * @WLAN_SER_MATCH_CMD_ID_VDEV: Compare command id and vdev
158  * @WLAN_SER_MATCH_MAX: Max enumeration
159  */
160 enum wlan_serialization_match_type {
161 	WLAN_SER_MATCH_VDEV,
162 	WLAN_SER_MATCH_PDEV,
163 	WLAN_SER_MATCH_CMD_TYPE_VDEV,
164 	WLAN_SER_MATCH_CMD_ID_VDEV,
165 	WLAN_SER_MATCH_MAX,
166 };
167 
168 /**
169  * struct wlan_ser_pdev_obj - pdev obj data for serialization
170  * @pdev_q: Array of pdev queues
171  */
172 struct wlan_ser_pdev_obj {
173 	struct wlan_serialization_pdev_queue pdev_q[SER_PDEV_QUEUE_COMP_MAX];
174 };
175 
176 /**
177  * struct wlan_ser_vdev_obj - Serialization private object of vdev
178  * @vdev_q: Array of vdev queues
179  */
180 struct wlan_ser_vdev_obj {
181 	struct wlan_serialization_vdev_queue vdev_q[SER_VDEV_QUEUE_COMP_MAX];
182 };
183 
184 /**
185  * struct wlan_ser_psoc_obj - psoc obj data for serialization
186  * @comp_info_cb: module level callback
187  * @apply_rules_cb: pointer to apply rules on the cmd
188  * @timers: Timers associated with the active commands
189  * @max_active_cmds: Maximum active commands allowed
190  * @timer_lock: lock for @timers
191  *
192  * Serialization component takes a command as input and checks whether to
193  * allow/deny the command. It will use the module level callback registered
194  * by each component to fetch the information needed to apply the rules.
195  * Once the information is available, the rules callback registered for each
196  * command internally by serialization will be applied to determine the
197  * checkpoint for the command. If allowed, command will be put into active/
198  * pending list and each active command is associated with a timer.
199  */
200 struct wlan_ser_psoc_obj {
201 	wlan_serialization_comp_info_cb comp_info_cb[WLAN_SER_CMD_MAX][WLAN_UMAC_COMP_ID_MAX];
202 	wlan_serialization_apply_rules_cb apply_rules_cb[WLAN_SER_CMD_MAX];
203 	struct wlan_serialization_timer *timers;
204 	uint8_t max_active_cmds;
205 	qdf_spinlock_t timer_lock;
206 };
207 
208 /**
209  * wlan_serialization_remove_cmd_from_queue() - to remove command from
210  *							given queue
211  * @queue: queue from which command needs to be removed
212  * @cmd: command to match in the queue
213  * @pcmd_list: Pointer to command list containing the command
214  * @ser_pdev_obj: pointer to private pdev serialization object
215  * @node_type: Pdev node or vdev node
216  *
217  * This API takes the queue, it matches the provided command from this queue
218  * and removes it. Before removing the command, it will notify the caller
219  * that if it needs to remove any memory allocated by caller.
220  *
221  * Return: QDF_STATUS_SUCCESS on success, error code on failure
222  */
223 QDF_STATUS
224 wlan_serialization_remove_cmd_from_queue(
225 		qdf_list_t *queue,
226 		struct wlan_serialization_command *cmd,
227 		struct wlan_serialization_command_list **pcmd_list,
228 		struct wlan_ser_pdev_obj *ser_pdev_obj,
229 		enum wlan_serialization_node node_type);
230 
231 /**
232  * wlan_serialization_add_cmd_to_queue() - Add a cmd to given queue
233  * @queue: queue to which command needs to be added
234  * @cmd_list: Pointer to command list containing the command
235  * @ser_pdev_obj: pointer to private pdev serialization object
236  * @is_cmd_for_active_queue: Add cmd to active or pending queue
237  * @node_type: Pdev node or vdev node
238  *
239  * Return: Status of the serialization request
240  */
241 enum wlan_serialization_status
242 wlan_serialization_add_cmd_to_queue(
243 		qdf_list_t *queue,
244 		struct wlan_serialization_command_list *cmd_list,
245 		struct wlan_ser_pdev_obj *ser_pdev_obj,
246 		uint8_t is_cmd_for_active_queue,
247 		enum wlan_serialization_node node_type);
248 
249 /**
250  * wlan_serialization_get_psoc_from_cmd() - get psoc from provided cmd
251  * @cmd: pointer to actual command
252  *
253  * This API will get the pointer to psoc through checking type of cmd
254  *
255  * Return: pointer to psoc
256  */
257 struct wlan_objmgr_psoc*
258 wlan_serialization_get_psoc_from_cmd(struct wlan_serialization_command *cmd);
259 
260 /**
261  * wlan_serialization_get_pdev_from_cmd() - get pdev from provided cmd
262  * @cmd: pointer to actual command
263  *
264  * This API will get the pointer to pdev through checking type of cmd
265  *
266  * Return: pointer to pdev
267  */
268 struct wlan_objmgr_pdev*
269 wlan_serialization_get_pdev_from_cmd(struct wlan_serialization_command *cmd);
270 
271 /**
272  * wlan_serialization_get_vdev_from_cmd() - get vdev from provided cmd
273  * @cmd: pointer to actual command
274  *
275  * This API will get the pointer to vdev through checking type of cmd
276  *
277  * Return: pointer to vdev
278  */
279 struct wlan_objmgr_vdev*
280 wlan_serialization_get_vdev_from_cmd(struct wlan_serialization_command *cmd);
281 
282 /**
283  * wlan_serialization_get_cmd_from_queue() - to extract command from given queue
284  * @queue: pointer to queue
285  * @nnode: next node to extract
286  *
287  * This API will try to extract node from queue which is next to prev node. If
288  * no previous node is given then take out the front node of the queue.
289  *
290  * Return: QDF_STATUS
291  */
292 QDF_STATUS wlan_serialization_get_cmd_from_queue(
293 		qdf_list_t *queue, qdf_list_node_t **nnode);
294 
295 /**
296  * wlan_serialization_stop_timer() - to stop particular timer
297  * @ser_timer: pointer to serialization timer
298  *
299  * This API stops the particular timer
300  *
301  * Return: QDF_STATUS
302  */
303 QDF_STATUS
304 wlan_serialization_stop_timer(struct wlan_serialization_timer *ser_timer);
305 
306 /**
307  * wlan_serialization_cleanup_vdev_timers() - clean-up all timers for a vdev
308  *
309  * @vdev: pointer to vdev object
310  *
311  * This API is to cleanup all the timers for a vdev.
312  * It can be used when serialization vdev destroy is called.
313  * It will make sure that if timer is running then it will
314  * stop and destroys the timer
315  *
316  * Return: QDF_STATUS
317  */
318 
319 QDF_STATUS wlan_serialization_cleanup_vdev_timers(
320 			struct wlan_objmgr_vdev *vdev);
321 
322 /**
323  * wlan_serialization_cleanup_all_timers() - to clean-up all timers
324  *
325  * @psoc_ser_ob: pointer to serialization psoc private object
326  *
327  * This API is to cleanup all the timers. it can be used when serialization
328  * module is exiting. it will make sure that if timer is running then it will
329  * stop and destroys the timer
330  *
331  * Return: QDF_STATUS
332  */
333 QDF_STATUS wlan_serialization_cleanup_all_timers(
334 	struct wlan_ser_psoc_obj *psoc_ser_ob);
335 
336 /**
337  * wlan_serialization_validate_cmd() - Validate the command
338  * @comp_id: Component ID
339  * @cmd_type: Command Type
340  *
341  * Return: QDF_STATUS
342  */
343 QDF_STATUS wlan_serialization_validate_cmd(
344 		 enum wlan_umac_comp_id comp_id,
345 		 enum wlan_serialization_cmd_type cmd_type);
346 
347 /**
348  * wlan_serialization_validate_cmd_list() - Validate the command list
349  * @cmd_list: Serialization command list
350  *
351  * Return: QDF_STATUS
352  */
353 QDF_STATUS wlan_serialization_validate_cmd_list(
354 		struct wlan_serialization_command_list *cmd_list);
355 
356 /**
357  * wlan_serialization_validate_cmdtype() - Validate the command type
358  * @cmd_type: Command Type
359  *
360  * Return: QDF_STATUS
361  */
362 QDF_STATUS wlan_serialization_validate_cmdtype(
363 		 enum wlan_serialization_cmd_type cmd_type);
364 
365 /**
366  * wlan_serialization_destroy_pdev_list() - Release the pdev cmds and
367  * destroy list
368  * @pdev_queue: Pointer to the pdev queue
369  *
370  * Return: None
371  */
372 void wlan_serialization_destroy_pdev_list(
373 		struct wlan_serialization_pdev_queue *pdev_queue);
374 
375 /**
376  * wlan_serialization_destroy_vdev_list() - Release the vdev cmds and
377  * destroy list
378  * @list: List to be destroyed
379  *
380  * Return: None
381  */
382 void wlan_serialization_destroy_vdev_list(qdf_list_t *list);
383 
384 /**
385  * wlan_serialization_get_psoc_obj() - Return the component private obj
386  * @psoc: Pointer to the PSOC object
387  *
388  * Return: Serialization component's PSOC level private data object
389  */
390 struct wlan_ser_psoc_obj *wlan_serialization_get_psoc_obj(
391 		struct wlan_objmgr_psoc *psoc);
392 
393 /**
394  * wlan_serialization_get_pdev_obj() - Return the component private obj
395  * @pdev: Pointer to the PDEV object
396  *
397  * Return: Serialization component's PDEV level private data object
398  */
399 struct wlan_ser_pdev_obj *wlan_serialization_get_pdev_obj(
400 		struct wlan_objmgr_pdev *pdev);
401 
402 /**
403  * wlan_serialization_get_vdev_obj() - Return the component private obj
404  * @vdev: Pointer to the VDEV object
405  *
406  * Return: Serialization component's VDEV level private data object
407  */
408 struct wlan_ser_vdev_obj *wlan_serialization_get_vdev_obj(
409 		struct wlan_objmgr_vdev *vdev);
410 
411 /**
412  * wlan_serialization_is_cmd_in_vdev_list() - Check Node present in VDEV list
413  * @vdev: Pointer to the VDEV object
414  * @queue: Pointer to the qdf_list_t
415  * @node_type: Pdev node or vdev node
416  *
417  * Return: Boolean true or false
418  */
419 bool
420 wlan_serialization_is_cmd_in_vdev_list(
421 		struct wlan_objmgr_vdev *vdev, qdf_list_t *queue,
422 		enum wlan_serialization_node node_type);
423 
424 /**
425  * wlan_serialization_is_cmd_in_pdev_list() - Check Node present in PDEV list
426  * @pdev: Pointer to the PDEV object
427  * @queue: Pointer to the qdf_list_t
428  *
429  * Return: Boolean true or false
430  */
431 bool
432 wlan_serialization_is_cmd_in_pdev_list(
433 		struct wlan_objmgr_pdev *pdev, qdf_list_t *queue);
434 
435 /**
436  * wlan_serialization_is_cmd_in_active_pending() - return cmd status
437  *						active/pending queue
438  * @cmd_in_active: CMD in active list
439  * @cmd_in_pending: CMD in pending list
440  *
441  * Return: enum wlan_serialization_cmd_status
442  */
443 enum wlan_serialization_cmd_status
444 wlan_serialization_is_cmd_in_active_pending(
445 		bool cmd_in_active, bool cmd_in_pending);
446 
447 /**
448  * wlan_serialization_is_cmd_present_in_given_queue() - Check if the cmd is
449  * present in the given queue
450  * @queue: List of commands which has to be searched
451  * @cmd: Serialization command information
452  * @node_type: Pdev node or vdev node
453  *
454  * Return: Boolean true or false
455  */
456 bool wlan_serialization_is_cmd_present_in_given_queue(
457 		qdf_list_t *queue,
458 		struct wlan_serialization_command *cmd,
459 		enum wlan_serialization_node node_type);
460 
461 /**
462  * wlan_serialization_timer_destroy() - destroys the timer
463  * @ser_timer: pointer to particular timer
464  *
465  * This API destroys the memory allocated by timer and assigns cmd member of
466  * that timer structure to NULL
467  *
468  * Return: QDF_STATUS
469  */
470 QDF_STATUS wlan_serialization_timer_destroy(
471 		struct wlan_serialization_timer *ser_timer);
472 
473 /**
474  * wlan_serialization_list_empty() - check if the list is empty
475  * @queue: Queue/List that needs to be checked for emptiness
476  *
477  * Return: true if list is empty and false otherwise
478  */
479 bool wlan_serialization_list_empty(qdf_list_t *queue);
480 
481 /**
482  * wlan_serialization_list_size() - Find the size of the provided queue
483  * @queue: Queue/List for which the size/length is to be returned
484  *
485  * Return: size/length of the queue/list
486  */
487 uint32_t wlan_serialization_list_size(qdf_list_t *queue);
488 
489 /**
490  * wlan_serialization_match_cmd_type() - Check for a match on given nnode
491  * @nnode: The node on which the matching has to be done
492  * @cmd_type: Command type that needs to be matched
493  * @node_type: Pdev node or vdev node
494  *
495  * This API will check if the cmd ID and cmd type of the given nnode are
496  * matching with the one's that are being passed to this function.
497  *
498  * Return: True if matched,false otherwise.
499  */
500 bool wlan_serialization_match_cmd_type(
501 			qdf_list_node_t *nnode,
502 			enum wlan_serialization_cmd_type cmd_type,
503 			enum wlan_serialization_node node_type);
504 
505 /**
506  * wlan_serialization_match_cmd_id_type() - Check for a match on given nnode
507  * @nnode: The node on which the matching has to be done
508  * @cmd: Command that needs to be matched
509  * @node_type: Pdev node or vdev node
510  *
511  * This API will check if the cmd ID and cmd type of the given nnode are
512  * matching with the one's that are being passed to this function.
513  *
514  * Return: True if matched,false otherwise.
515  */
516 bool wlan_serialization_match_cmd_id_type(
517 			qdf_list_node_t *nnode,
518 			struct wlan_serialization_command *cmd,
519 			enum wlan_serialization_node node_type);
520 
521 /**
522  * wlan_serialization_match_cmd_vdev() - Check for a match on given nnode
523  * @nnode: The node on which the matching has to be done
524  * @vdev: VDEV object that needs to be matched
525  * @node_type: Pdev node or vdev node
526  *
527  * This API will check if the VDEV object of the given nnode are
528  * matching with the one's that are being passed to this function.
529  *
530  * Return: True if matched,false otherwise.
531  */
532 bool wlan_serialization_match_cmd_vdev(qdf_list_node_t *nnode,
533 				       struct wlan_objmgr_vdev *vdev,
534 				       enum wlan_serialization_node node_type);
535 
536 /**
537  * wlan_serialization_match_cmd_pdev() - Check for a match on given nnode
538  * @nnode: The node on which the matching has to be done
539  * @pdev: pdev object that needs to be matched
540  * @node_type: Node type. Pdev node or vdev node
541  *
542  * This API will check if the PDEV object of the given nnode are
543  * matching with the one's that are being passed to this function.
544  *
545  * Return: True if matched,false otherwise.
546  */
547 bool wlan_serialization_match_cmd_pdev(qdf_list_node_t *nnode,
548 				       struct wlan_objmgr_pdev *pdev,
549 				       enum wlan_serialization_node node_type);
550 
551 /**
552  * wlan_serialization_match_cmd_blocking() - Check for a blocking cmd
553  * @nnode: The node on which the matching has to be done
554  * @node_type: Pdev node or vdev node
555  *
556  * This API will check if the give command of nnode is a blocking command.
557  *
558  * Return: True if blocking command, false otherwise.
559  */
560 bool wlan_serialization_match_cmd_blocking(
561 		qdf_list_node_t *nnode,
562 		enum wlan_serialization_node node_type);
563 
564 /**
565  * wlan_serialization_find_cmd() - Find the cmd matching the given criteria
566  * @queue: Queue to search
567  * @match_type: Match criteria
568  * @cmd: Serialization command information
569  * @cmd_type: Command type to be matched
570  * @pdev: pdev object that needs to be matched
571  * @vdev: vdev object that needs to be matched
572  * @node_type: Node type. Pdev node or vdev node
573  *
574  * Return: Pointer to the node member in the list
575  */
576 qdf_list_node_t *
577 wlan_serialization_find_cmd(qdf_list_t *queue, uint32_t match_type,
578 			    struct wlan_serialization_command *cmd,
579 			    enum wlan_serialization_cmd_type cmd_type,
580 			    struct wlan_objmgr_pdev *pdev,
581 			    struct wlan_objmgr_vdev *vdev,
582 			    enum wlan_serialization_node node_type);
583 
584 /**
585  * wlan_serialization_remove_front() - Remove the front node of the list
586  * @list: List from which the node is to be removed
587  * @node: Pointer to store the node that is removed
588  *
589  * Return: QDF_STATUS Success or Failure
590  */
591 QDF_STATUS wlan_serialization_remove_front(
592 			qdf_list_t *list,
593 			qdf_list_node_t **node);
594 
595 /**
596  * wlan_serialization_remove_node() - Remove the given node from the list
597  * @list: List from which the node is to be removed
598  * @node: Pointer to the node that is to be removed
599  *
600  * Return: QDF_STATUS Success or Failure
601  */
602 QDF_STATUS wlan_serialization_remove_node(
603 			qdf_list_t *list,
604 			qdf_list_node_t *node);
605 
606 /**
607  * wlan_serialization_insert_front() - Insert a node into the front of the list
608  * @list: List to which the node is to be inserted
609  * @node: Pointer to the node that is to be inserted
610  *
611  * Return: QDF_STATUS Success or Failure
612  */
613 QDF_STATUS wlan_serialization_insert_front(
614 			qdf_list_t *list,
615 			qdf_list_node_t *node);
616 
617 /**
618  * wlan_serialization_insert_back() - Insert a node into the back of the list
619  * @list: List to which the node is to be inserted
620  * @node: Pointer to the node that is to be inserted
621  *
622  * Return: QDF_STATUS Success or Failure
623  */
624 QDF_STATUS wlan_serialization_insert_back(
625 			qdf_list_t *list,
626 			qdf_list_node_t *node);
627 
628 /**
629  * wlan_serialization_peek_front() - Peek the front node of the list
630  * @list: List on which the node is to be peeked
631  * @node: Pointer to the store the node that is being peeked
632  *
633  * Return: QDF_STATUS Success or Failure
634  */
635 QDF_STATUS wlan_serialization_peek_front(
636 			qdf_list_t *list,
637 			qdf_list_node_t **node);
638 
639 /**
640  * wlan_serialization_peek_next() - Peek the next node of the list
641  * @list: List on which the node is to be peeked
642  * @node1: Pointer to the node1 from where the next node has to be peeked
643  * @node2: Pointer to the store the node that is being peeked
644  *
645  * Return: QDF_STATUS Success or Failure
646  */
647 QDF_STATUS wlan_serialization_peek_next(
648 			qdf_list_t *list,
649 			qdf_list_node_t *node1,
650 			qdf_list_node_t **node2);
651 
652 /**
653  * wlan_serialization_acquire_lock() - Acquire lock to the given queue
654  * @lock: Pointer to the lock
655  *
656  * Return: QDF_STATUS success or failure
657  */
658 QDF_STATUS
659 wlan_serialization_acquire_lock(qdf_spinlock_t *lock);
660 
661 /**
662  * wlan_serialization_release_lock() - Release lock to the given queue
663  * @lock: Pointer to the lock
664  *
665  * Return: QDF_STATUS success or failure
666  */
667 QDF_STATUS
668 wlan_serialization_release_lock(qdf_spinlock_t *lock);
669 
670 /**
671  * wlan_serialization_create_lock() - Init the lock to the given queue
672  * @lock: Pointer to the lock
673  *
674  * Return: QDF_STATUS success or failure
675  */
676 QDF_STATUS
677 wlan_serialization_create_lock(qdf_spinlock_t *lock);
678 
679 /**
680  * wlan_serialization_destroy_lock() - Deinit the lock to the given queue
681  * @lock: Pointer to the lock
682  *
683  * Return: QDF_STATUS success or failure
684  */
685 QDF_STATUS
686 wlan_serialization_destroy_lock(qdf_spinlock_t *lock);
687 
688 /**
689  * wlan_serialization_any_vdev_cmd_active() - Check any vdev cmd active for pdev
690  * @pdev_queue: serialization pdev queue object
691  *
692  * Return: true or false
693  */
694 bool wlan_serialization_any_vdev_cmd_active(
695 		struct wlan_serialization_pdev_queue *pdev_queue);
696 
697 /**
698  * wlan_ser_update_cmd_history() - Update serialization queue history
699  * @pdev_queue:serialization pdev queue
700  * @cmd: cmd to be added/remeoved
701  * @ser_reason: serialization action that resulted in addition/removal
702  * @add_remove: added or removed from queue
703  * @active_queue:for active queue
704  *
705  * Return: QDF_STATUS success or failure
706  */
707 
708 void wlan_ser_update_cmd_history(
709 		struct wlan_serialization_pdev_queue *pdev_queue,
710 		struct wlan_serialization_command *cmd,
711 		enum ser_queue_reason ser_reason,
712 		bool add_remove,
713 		bool active_queue);
714 
715 #endif
716