xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/serialization/src/wlan_serialization_utils_i.h (revision 1397a33f48ea6455be40871470b286e535820eb8)
1 /*
2  * Copyright (c) 2017-2018 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  * DOC: wlan_serialization_utils_i.h
20  * This file defines the prototypes for the utility helper functions
21  * for the serialization component.
22  */
23 #ifndef __WLAN_SERIALIZATION_UTILS_I_H
24 #define __WLAN_SERIALIZATION_UTILS_I_H
25 
26 #ifdef CONFIG_SERIALIZATION_V1
27 /* Include files */
28 #include "qdf_status.h"
29 #include "qdf_list.h"
30 #include "qdf_mc_timer.h"
31 #include "wlan_objmgr_cmn.h"
32 #include "wlan_objmgr_global_obj.h"
33 #include "wlan_objmgr_psoc_obj.h"
34 #include "wlan_serialization_rules_i.h"
35 #include "wlan_scan_ucfg_api.h"
36 
37 /*
38  * Below bit positions are used to identify if a
39  * serialization command is in use or marked for
40  * deletion.
41  * CMD_MARKED_FOR_DELETE - The command is about to be deleted
42  * CMD_IS_ACTIVE - The command is active and currently in use
43  */
44 #define CMD_MARKED_FOR_DELETE   1
45 #define CMD_IS_ACTIVE           2
46 /**
47  * struct wlan_serialization_timer - Timer used for serialization
48  * @cmd:      Cmd to which the timer is linked
49  * @timer:    Timer associated with the command
50  *
51  * Timers are allocated statically during init, one each for the
52  * maximum active commands permitted in the system. Once a cmd is
53  * moved from pending list to active list, the timer is activated
54  * and once the cmd is completed, the timer is cancelled. Timer is
55  * also cancelled if the command is aborted
56  *
57  * The timers are maintained per psoc. A timer is associated to
58  * unique combination of pdev, cmd_type and cmd_id.
59  */
60 struct wlan_serialization_timer {
61 	struct wlan_serialization_command *cmd;
62 	qdf_mc_timer_t timer;
63 };
64 
65 /**
66  * struct wlan_serialization_command_list - List of commands to be serialized
67  * @node: Node identifier in the list
68  * @cmd: Command to be serialized
69  * @active: flag to check if the node/entry is logically active
70  */
71 struct wlan_serialization_command_list {
72 	qdf_list_node_t node;
73 	struct wlan_serialization_command cmd;
74 	unsigned long cmd_in_use;
75 };
76 
77 /**
78  * struct wlan_serialization_pdev_priv_obj - pdev obj data for serialization
79  * @active_list: list to hold the non-scan commands currently being executed
80  * @pending_list list: to hold the non-scan commands currently pending
81  * @active_scan_list: list to hold the scan commands currently active
82  * @pending_scan_list: list to hold the scan commands currently pending
83  * @global_cmd_pool_list: list to hold the global buffers
84  * @pdev_ser_list_lock: A per pdev lock to protect the concurrent operations
85  *                      on the queues.
86  *
87  * Serialization component maintains linked lists to store the commands
88  * sent by other components to get serialized. All the lists are per
89  * pdev. The maximum number of active scans is determined by the firmware.
90  * There is only one non-scan active command per pdev at a time as per the
91  * current software architecture. cmd_ptr holds the memory allocated for
92  * each of the global cmd pool nodes and it is useful in freeing up these
93  * nodes when needed.
94  */
95 struct wlan_serialization_pdev_priv_obj {
96 	qdf_list_t active_list;
97 	qdf_list_t pending_list;
98 	qdf_list_t active_scan_list;
99 	qdf_list_t pending_scan_list;
100 	qdf_list_t global_cmd_pool_list;
101 	qdf_spinlock_t pdev_ser_list_lock;
102 };
103 
104 /**
105  * struct wlan_serialization_psoc_priv_obj - psoc obj data for serialization
106  * @wlan_serialization_module_state_cb - module level callback
107  * @wlan_serialization_apply_rules_cb - pointer to apply rules on the cmd
108  * @timers - Timers associated with the active commands
109  * @max_axtive_cmds - Maximum active commands allowed
110  *
111  * Serialization component takes a command as input and checks whether to
112  * allow/deny the command. It will use the module level callback registered
113  * by each component to fetch the information needed to apply the rules.
114  * Once the information is available, the rules callback registered for each
115  * command internally by serialization will be applied to determine the
116  * checkpoint for the command. If allowed, command will be put into active/
117  * pending list and each active command is associated with a timer.
118  */
119 struct wlan_serialization_psoc_priv_obj {
120 	wlan_serialization_comp_info_cb comp_info_cb[
121 		WLAN_SER_CMD_MAX][WLAN_UMAC_COMP_ID_MAX];
122 	wlan_serialization_apply_rules_cb apply_rules_cb[WLAN_SER_CMD_MAX];
123 	struct wlan_serialization_timer *timers;
124 	uint8_t max_active_cmds;
125 };
126 
127 /**
128  * wlan_serialization_put_back_to_global_list() - put back cmd in global pool
129  * @queue: queue from which cmd needs to be taken out
130  * @ser_pdev_obj: pdev private object
131  * @cmd_list: cmd which needs to be matched
132  *
133  * command will be taken off from the queue and will be put back to global
134  * pool of free command buffers.
135  *
136  * Return: QDF_STATUS
137  */
138 QDF_STATUS
139 wlan_serialization_put_back_to_global_list(qdf_list_t *queue,
140 		struct wlan_serialization_pdev_priv_obj *ser_pdev_obj,
141 		struct wlan_serialization_command_list *cmd_list);
142 /**
143  * wlan_serialization_move_pending_to_active() - to move pending command to
144  *						 active queue
145  * @cmd_type: cmd type to device to which queue the command needs to go
146  * @ser_pdev_obj: pointer to ser_pdev_obj
147  *
148  * Return: none
149  */
150 void wlan_serialization_move_pending_to_active(
151 		enum wlan_serialization_cmd_type cmd_type,
152 		struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
153 /**
154  * wlan_serialization_get_pdev_from_cmd() - get pdev from provided cmd
155  * @cmd: pointer to actual command
156  *
157  * This API will get the pointer to pdev through checking type of cmd
158  *
159  * Return: pointer to pdev
160  */
161 struct wlan_objmgr_pdev*
162 wlan_serialization_get_pdev_from_cmd(struct wlan_serialization_command *cmd);
163 
164 /**
165  * wlan_serialization_get_cmd_from_queue() - to extract command from given queue
166  * @queue: pointer to queue
167  * @nnode: next node to extract
168  * @ser_pdev_obj: Serialization PDEV object pointer
169  *
170  * This API will try to extract node from queue which is next to prev node. If
171  * no previous node is given then take out the front node of the queue.
172  *
173  * Return: QDF_STATUS
174  */
175 QDF_STATUS wlan_serialization_get_cmd_from_queue(qdf_list_t *queue,
176 			qdf_list_node_t **nnode,
177 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
178 
179 /**
180  * wlan_serialization_is_active_cmd_allowed() - check to see if command
181  *						is allowed in active queue
182  * @pdev: pointer to pdev structure
183  * @cmd_type: type of command to check against
184  *
185  * Takes the command type and based on the type, it checks scan command queue
186  * or nonscan command queue to see if active command is allowed or no
187  *
188  * Return: true if allowed else false
189  */
190 bool wlan_serialization_is_active_cmd_allowed(
191 			struct wlan_serialization_command *cmd);
192 
193 /**
194  * wlan_serialization_cleanup_all_timers() - to clean-up all timers
195  *
196  * @psoc_ser_ob: pointer to serialization psoc private object
197  *
198  * This API is to cleanup all the timers. it can be used when serialization
199  * module is exiting. it will make sure that if timer is running then it will
200  * stop and destroys the timer
201  *
202  * Return: QDF_STATUS
203  */
204 QDF_STATUS wlan_serialization_cleanup_all_timers(
205 	struct wlan_serialization_psoc_priv_obj *psoc_ser_ob);
206 
207 /**
208  * wlan_serialization_find_and_remove_cmd() - to find cmd from queue and remove
209  * @cmd_info: pointer to command related information
210  *
211  * This api will find command from active queue and removes the command
212  *
213  * Return: QDF_STATUS
214  */
215 QDF_STATUS wlan_serialization_find_and_remove_cmd(
216 		struct wlan_serialization_queued_cmd_info *cmd_info);
217 
218 /**
219  * wlan_serialization_find_and_cancel_cmd() - to find cmd from queue and cancel
220  * @cmd_info: pointer to command related information
221  *
222  * This api will find command from active queue and pending queue and
223  * removes the command. If it is in active queue then it will notifies the
224  * requester that it is in active queue and from there it expects requester
225  * to send remove command
226  *
227  * Return: wlan_serialization_cmd_status
228  */
229 enum wlan_serialization_cmd_status
230 wlan_serialization_find_and_cancel_cmd(
231 		struct wlan_serialization_queued_cmd_info *cmd_info);
232 /**
233  * wlan_serialization_enqueue_cmd() - Enqueue the cmd to pending/active Queue
234  * @cmd: Command information
235  * @is_cmd_for_active_queue: whether command is for active queue
236  * @cmd_list: command which needs to be inserted in active queue
237  * Return: Status of the serialization request
238  */
239 enum wlan_serialization_status
240 wlan_serialization_enqueue_cmd(
241 		struct wlan_serialization_command *cmd,
242 		uint8_t is_cmd_for_active_queue,
243 		struct wlan_serialization_command_list **pcmd_list);
244 
245 /**
246  * wlan_serialization_dequeue_cmd() - dequeue the cmd to pending/active Queue
247  * @cmd: Command information
248  * @is_cmd_for_active_queue: whether command is for active queue
249  *
250  * Return: Status of the serialization request
251  */
252 enum wlan_serialization_cmd_status
253 wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd,
254 			       uint8_t is_cmd_for_active_queue);
255 /**
256  * wlan_serialization_find_and_stop_timer() - to find and stop the timer
257  * @psoc: pointer to psoc
258  * @cmd: pointer to actual command
259  *
260  * find the timer associated with command, stop it and destroy it
261  *
262  * Return: QDF_STATUS
263  */
264 QDF_STATUS
265 wlan_serialization_find_and_stop_timer(struct wlan_objmgr_psoc *psoc,
266 		struct wlan_serialization_command *cmd);
267 /**
268  * wlan_serialization_find_and_stop_timer() - to find and start the timer
269  * @psoc: pointer to psoc
270  * @cmd: pointer to actual command
271  *
272  * find the free timer, initialize it, and start it
273  *
274  * Return: QDF_STATUS
275  */
276 QDF_STATUS
277 wlan_serialization_find_and_start_timer(struct wlan_objmgr_psoc *psoc,
278 		struct wlan_serialization_command *cmd);
279 
280 /**
281  * wlan_serialization_validate_cmd() - Validate the command
282  * @comp_id: Component ID
283  * @cmd_type: Command Type
284  *
285  * Return: QDF Status
286  */
287 QDF_STATUS wlan_serialization_validate_cmd(
288 		 enum wlan_umac_comp_id comp_id,
289 		 enum wlan_serialization_cmd_type cmd_type);
290 
291 /**
292  * wlan_serialization_validate_cmdtype() - Validate the command type
293  * @cmd_type: Command Type
294  *
295  * Return: QDF Status
296  */
297 QDF_STATUS wlan_serialization_validate_cmdtype(
298 		 enum wlan_serialization_cmd_type cmd_type);
299 
300 
301 /**
302  * wlan_serialization_destroy_list() - Release the cmds and destroy list
303  * @ser_pdev_obj: Serialization private pdev object
304  * @list: List to be destroyed
305  *
306  * Return: None
307  */
308 void wlan_serialization_destroy_list(
309 		struct wlan_serialization_pdev_priv_obj *ser_pdev_obj,
310 		qdf_list_t *list);
311 
312 /**
313  * wlan_serialization_get_psoc_priv_obj() - Return the component private obj
314  * @psoc: Pointer to the PSOC object
315  *
316  * Return: Serialization component's PSOC level private data object
317  */
318 struct wlan_serialization_psoc_priv_obj *wlan_serialization_get_psoc_priv_obj(
319 		struct wlan_objmgr_psoc *psoc);
320 
321 /**
322  * wlan_serialization_get_pdev_priv_obj() - Return the component private obj
323  * @psoc: Pointer to the PDEV object
324  *
325  * Return: Serialization component's PDEV level private data object
326  */
327 struct wlan_serialization_pdev_priv_obj *wlan_serialization_get_pdev_priv_obj(
328 		struct wlan_objmgr_pdev *pdev);
329 
330 /**
331  * wlan_serialization_get_psoc_obj() - Return the component private obj
332  * @psoc: Pointer to the SERIALIZATION object
333  *
334  * Return: Serialization component's level private data object
335  */
336 struct wlan_serialization_psoc_priv_obj *
337 wlan_serialization_get_psoc_obj(struct wlan_serialization_command *cmd);
338 
339 /**
340  * wlan_serialization_is_cmd_in_vdev_list() - Check Node present in VDEV list
341  * @vdev: Pointer to the VDEV object
342  * @queue: Pointer to the qdf_list_t
343  *
344  * Return: Boolean true or false
345  */
346 bool
347 wlan_serialization_is_cmd_in_vdev_list(
348 		struct wlan_objmgr_vdev *vdev, qdf_list_t *queue);
349 
350 /**
351  * wlan_serialization_is_cmd_in_pdev_list() - Check Node present in PDEV list
352  * @pdev: Pointer to the PDEV object
353  * @queue: Pointer to the qdf_list_t
354  *
355  * Return: Boolean true or false
356  */
357 bool
358 wlan_serialization_is_cmd_in_pdev_list(
359 		struct wlan_objmgr_pdev *pdev, qdf_list_t *queue);
360 
361 /**
362  * wlan_serialization_is_cmd_in_active_pending() - return cmd status
363  *						active/pending queue
364  * @cmd_in_active: CMD in active list
365  * @cmd_in_pending: CMD in pending list
366  *
367  * Return: enum wlan_serialization_cmd_status
368  */
369 enum wlan_serialization_cmd_status
370 wlan_serialization_is_cmd_in_active_pending(bool cmd_in_active,
371 		bool cmd_in_pending);
372 
373 /**
374  * wlan_serialization_remove_all_cmd_from_queue() - Remove cmd which matches
375  * @queue: queue from where command needs to be removed
376  * @ser_pdev_obj: pointer to serialization object
377  * @pdev: pointer to pdev
378  * @vdev: pointer to vdev
379  * @cmd: pointer to cmd
380  * @is_active_queue: to check if command matching is for active queue
381  *
382  * This API will remove one or more commands which match the given parameters
383  * interms of argument. For example, if user request all commands to removed
384  * which matches "vdev" then iterate through all commands, find out and remove
385  * command which matches vdev object.
386  *
387  * Return: enum wlan_serialization_cmd_status
388  */
389 enum wlan_serialization_cmd_status
390 wlan_serialization_remove_all_cmd_from_queue(qdf_list_t *queue,
391 		struct wlan_serialization_pdev_priv_obj *ser_pdev_obj,
392 		struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_vdev *vdev,
393 		struct wlan_serialization_command *cmd,
394 		uint8_t is_active_queue);
395 /**
396  * wlan_serialization_is_cmd_present_queue() - Check if same command
397  *				is already present active or pending queue
398  * @cmd: pointer to command which we need to find
399  * @is_active_queue: flag to find the command in active or pending queue
400  *
401  * This API will check the given command is already present in active or
402  * pending queue based on flag
403  * If present then return true otherwise false
404  *
405  * Return: true or false
406  */
407 bool wlan_serialization_is_cmd_present_queue(
408 			struct wlan_serialization_command *cmd,
409 			uint8_t is_active_queue);
410 
411 /**
412  * wlan_serialization_activate_cmd() - activate cmd in active queue
413  * @cmd_list: Command needs to be activated
414  * @ser_pdev_obj: Serialization private pdev object
415  *
416  * Return: None
417  */
418 void wlan_serialization_activate_cmd(
419 			struct wlan_serialization_command_list *cmd_list,
420 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
421 
422 /**
423  * wlan_serialization_list_empty() - check if the list is empty
424  * @queue: Queue/List that needs to be checked for emptiness
425  * @ser_pdev_obj: Serialization private pdev object
426  *
427  * Return: true if list is empty and false otherwise
428  */
429 bool wlan_serialization_list_empty(
430 			qdf_list_t *queue,
431 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
432 
433 /**
434  * wlan_serialization_list_size() - Find the size of the provided queue
435  * @queue: Queue/List for which the size/length is to be returned
436  * @ser_pdev_obj: Serialization private pdev object
437  *
438  * Return: size/length of the queue/list
439  */
440 uint32_t wlan_serialization_list_size(
441 			qdf_list_t *queue,
442 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
443 /**
444  * wlan_serialization_acquire_lock() - to acquire lock for serialization module
445  * @obj: pdev private object
446  *
447  * This API will acquire lock for serialization module. Mutex or spinlock will
448  * be decided based on the context of the operation.
449  *
450  * Return: QDF_STATUS based on outcome of the operation
451  */
452 QDF_STATUS
453 wlan_serialization_acquire_lock(struct wlan_serialization_pdev_priv_obj *obj);
454 
455 /**
456  * wlan_serialization_release_lock() - to release lock for serialization module
457  * @obj: pdev private object
458  *
459  * This API will release lock for serialization module. Mutex or spinlock will
460  * be decided based on the context of the operation.
461  *
462  * Return: QDF_STATUS based on outcome of the operation
463  */
464 QDF_STATUS
465 wlan_serialization_release_lock(struct wlan_serialization_pdev_priv_obj *obj);
466 
467 /**
468  * wlan_serialization_create_lock() - to create lock for serialization module
469  * @obj: pdev private object
470  *
471  * This API will create a lock for serialization module.
472  *
473  * Return: QDF_STATUS based on outcome of the operation
474  */
475 QDF_STATUS
476 wlan_serialization_create_lock(struct wlan_serialization_pdev_priv_obj  *obj);
477 
478 /**
479  * wlan_serialization_destroy_lock() - to destroy lock for serialization module
480  *
481  * This API will destroy a lock for serialization module.
482  *
483  * Return: QDF_STATUS based on outcome of the operation
484  */
485 QDF_STATUS
486 wlan_serialization_destroy_lock(struct wlan_serialization_pdev_priv_obj *obj);
487 /**
488  * wlan_serialization_match_cmd_scan_id() - Check for a match on given nnode
489  * @nnode: The node on which the matching has to be done
490  * @cmd: Command that needs to be filled if there is a match
491  * @scan_id: Scan ID to be matched
492  * @vdev: VDEV object to be matched
493  * @ser_pdev_obj: Serialization PDEV Object pointer.
494  *
495  * This API will check if the scan ID and VDEV 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_scan_id(
501 			qdf_list_node_t *nnode,
502 			struct wlan_serialization_command **cmd,
503 			uint16_t scan_id, struct wlan_objmgr_vdev *vdev,
504 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
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  * @ser_pdev_obj: Serialization PDEV Object pointer.
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 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
520 /**
521  * wlan_serialization_match_cmd_vdev() - Check for a match on given nnode
522  * @nnode: The node on which the matching has to be done
523  * @vdev: VDEV object that needs to be matched
524  *
525  * This API will check if the VDEV object of the given nnode are
526  * matching with the one's that are being passed to this function.
527  *
528  * Return: True if matched,false otherwise.
529  */
530 bool wlan_serialization_match_cmd_vdev(qdf_list_node_t *nnode,
531 				       struct wlan_objmgr_vdev *vdev);
532 /**
533  * wlan_serialization_match_cmd_pdev() - Check for a match on given nnode
534  * @nnode: The node on which the matching has to be done
535  * @pdev: VDEV object that needs to be matched
536  *
537  * This API will check if the PDEV object of the given nnode are
538  * matching with the one's that are being passed to this function.
539  *
540  * Return: True if matched,false otherwise.
541  */
542 bool wlan_serialization_match_cmd_pdev(qdf_list_node_t *nnode,
543 				       struct wlan_objmgr_pdev *pdev);
544 /**
545  * wlan_serialization_remove_front() - Remove the front node of the list
546  * @list: List from which the node is to be removed
547  * @node: Pointer to store the node that is removed
548  * @ser_pdev_obj: Serialization PDEV Object pointer
549  *
550  * Return: QDF_STATUS Success or Failure
551  */
552 QDF_STATUS wlan_serialization_remove_front(
553 			qdf_list_t *list,
554 			qdf_list_node_t **node,
555 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
556 /**
557  * wlan_serialization_remove_node() - Remove the given node from the list
558  * @list: List from which the node is to be removed
559  * @node: Pointer to the node that is to be removed
560  * @ser_pdev_obj: Serialization PDEV Object pointer
561  *
562  * Return: QDF_STATUS Success or Failure
563  */
564 QDF_STATUS wlan_serialization_remove_node(
565 			qdf_list_t *list,
566 			qdf_list_node_t *node,
567 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
568 /**
569  * wlan_serialization_insert_front() - Insert a node into the front of the list
570  * @list: List to which the node is to be inserted
571  * @node: Pointer to the node that is to be inserted
572  * @ser_pdev_obj: Serialization PDEV Object pointer
573  *
574  * Return: QDF_STATUS Success or Failure
575  */
576 QDF_STATUS wlan_serialization_insert_front(
577 			qdf_list_t *list,
578 			qdf_list_node_t *node,
579 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
580 /**
581  * wlan_serialization_insert_back() - Insert a node into the back of the list
582  * @list: List to which the node is to be inserted
583  * @node: Pointer to the node that is to be inserted
584  * @ser_pdev_obj: Serialization PDEV Object pointer
585  *
586  * Return: QDF_STATUS Success or Failure
587  */
588 QDF_STATUS wlan_serialization_insert_back(
589 			qdf_list_t *list,
590 			qdf_list_node_t *node,
591 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
592 /**
593  * wlan_serialization_peek_front() - Peek the front node of the list
594  * @list: List on which the node is to be peeked
595  * @node: Pointer to the store the node that is being peeked
596  * @ser_pdev_obj: Serialization PDEV Object pointer
597  *
598  * Return: QDF_STATUS Success or Failure
599  */
600 QDF_STATUS wlan_serialization_peek_front(
601 			qdf_list_t *list,
602 			qdf_list_node_t **node,
603 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
604 /**
605  * wlan_serialization_peek_next() - Peek the next node of the list
606  * @list: List on which the node is to be peeked
607  * @node1: Input node which is previous to the node to be peeked
608  * @node2: Pointer to the store the node that is being peeked
609  * @ser_pdev_obj: Serialization PDEV Object pointer
610  *
611  * Return: QDF_STATUS Success or Failure
612  */
613 QDF_STATUS wlan_serialization_peek_next(
614 			qdf_list_t *list,
615 			qdf_list_node_t *node1,
616 			qdf_list_node_t **node2,
617 			struct wlan_serialization_pdev_priv_obj *ser_pdev_obj);
618 #else /*New serialization code*/
619 /* Include files */
620 #include <qdf_status.h>
621 #include <qdf_list.h>
622 #include <qdf_mc_timer.h>
623 #include <wlan_objmgr_cmn.h>
624 #include <wlan_objmgr_global_obj.h>
625 #include <wlan_objmgr_psoc_obj.h>
626 #include <wlan_scan_ucfg_api.h>
627 #include "wlan_serialization_rules_i.h"
628 #ifdef WLAN_SER_DEBUG
629 #include "wlan_serialization_debug_i.h"
630 #endif
631 
632 /*
633  * Below bit positions are used to identify if a
634  * serialization command is in use or marked for
635  * deletion.
636  * CMD_MARKED_FOR_ACTIVATION - The command is about to be activated
637  * CMD_IS_ACTIVE - The command is active and currently in use
638  */
639 #define CMD_MARKED_FOR_ACTIVATION     1
640 #define CMD_IS_ACTIVE                 2
641 #define CMD_ACTIVE_MARKED_FOR_CANCEL  3
642 #define CMD_ACTIVE_MARKED_FOR_REMOVAL 4
643 /**
644  * struct wlan_serialization_timer - Timer used for serialization
645  * @cmd:      Cmd to which the timer is linked
646  * @timer:    Timer associated with the command
647  *
648  * Timers are allocated statically during init, one each for the
649  * maximum active commands permitted in the system. Once a cmd is
650  * moved from pending list to active list, the timer is activated
651  * and once the cmd is completed, the timer is cancelled. Timer is
652  * also cancelled if the command is aborted
653  *
654  * The timers are maintained per psoc. A timer is associated to
655  * unique combination of pdev, cmd_type and cmd_id.
656  */
657 struct wlan_serialization_timer {
658 	struct wlan_serialization_command *cmd;
659 	qdf_timer_t timer;
660 };
661 
662 /**
663  * enum wlan_serialization_node - Types of available nodes in serialization list
664  * @WLAN_SER_PDEV_NODE: pdev node from the pdev queue
665  * @WLAN_SER_VDEV_NODE: vdev node from the vdev queue
666  */
667 enum wlan_serialization_node {
668 	WLAN_SER_PDEV_NODE,
669 	WLAN_SER_VDEV_NODE,
670 };
671 
672 /**
673  * struct wlan_serialization_command_list - List of commands to be serialized
674  * @pdev_node: PDEV node identifier in the list
675  * @vdev_node: VDEV node identifier in the list
676  * @cmd: Command to be serialized
677  * @cmd_in_use: flag to check if the node/entry is logically active
678  */
679 struct wlan_serialization_command_list {
680 	qdf_list_node_t pdev_node;
681 	qdf_list_node_t vdev_node;
682 	struct wlan_serialization_command cmd;
683 	unsigned long cmd_in_use;
684 };
685 
686 /**
687  * struct wlan_serialization_pdev_queue - queue data related to pdev
688  * @active_list: list to hold the commands currently being executed
689  * @pending_list: list to hold the commands currently pending
690  * @cmd_pool_list: list to hold the global command pool
691  * @vdev_active_cmd_bitmap: Active cmd bitmap of vdev for the given pdev
692  * @blocking_cmd_active: Indicate if a blocking cmd is in active execution
693  * @blocking_cmd_waiting: Indicate if a blocking cmd is in pending queue
694  * @pdev_queue_lock: pdev lock to protect concurrent operations on the queues
695  */
696 struct wlan_serialization_pdev_queue {
697 	qdf_list_t active_list;
698 	qdf_list_t pending_list;
699 	qdf_list_t cmd_pool_list;
700 	uint32_t vdev_active_cmd_bitmap;
701 	bool blocking_cmd_active;
702 	uint16_t blocking_cmd_waiting;
703 	qdf_spinlock_t pdev_queue_lock;
704 #ifdef WLAN_SER_DEBUG
705 	struct ser_history history;
706 #endif
707 };
708 
709 /**
710  * struct wlan_serialization_vdev_queue - queue data related to vdev
711  * @active_list: list to hold the commands currently being executed
712  * @pending_list list: to hold the commands currently pending
713  * @queue_disable: is the queue disabled
714  */
715 struct wlan_serialization_vdev_queue {
716 	qdf_list_t active_list;
717 	qdf_list_t pending_list;
718 	bool queue_disable;
719 };
720 
721 /**
722  * enum wlan_serialization_pdev_queue_type - Types of available pdev queues
723  * @QUEUE_COMP_SCAN: Scan queue
724  * @QUEUE_COMP_NON_SCAN: Non Scan queue
725  */
726 enum serialization_pdev_queue_type {
727 	SER_PDEV_QUEUE_COMP_SCAN,
728 	SER_PDEV_QUEUE_COMP_NON_SCAN,
729 	SER_PDEV_QUEUE_COMP_MAX,
730 };
731 
732 /**
733  * enum wlan_serialization_vdev_queue_type - Types of available vdev queues
734  * @QUEUE_COMP_NON_SCAN: Non Scan queue
735  */
736 enum serialization_vdev_queue_type {
737 	SER_VDEV_QUEUE_COMP_NON_SCAN,
738 	SER_VDEV_QUEUE_COMP_MAX,
739 };
740 
741 /**
742  * enum wlan_serialization_match_type - Comparison options for a command
743  * @WLAN_SER_MATCH_VDEV: Compare vdev
744  * @WLAN_SER_MATCH_PDEV: Compare pdev
745  * @WLAN_SER_MATCH_CMD_TYPE: Compare command type
746  * @WLAN_SER_MATCH_CMD_TYPE_VDEV: Compare command type and vdev
747  * @WLAN_SER_MATCH_CMD_ID: Compare command id
748  * @WLAN_SER_MATCH_CMD_ID_VDEV: Compare command id and vdev
749  */
750 enum wlan_serialization_match_type {
751 	WLAN_SER_MATCH_VDEV,
752 	WLAN_SER_MATCH_PDEV,
753 	WLAN_SER_MATCH_CMD_TYPE,
754 	WLAN_SER_MATCH_CMD_TYPE_VDEV,
755 	WLAN_SER_MATCH_CMD_ID,
756 	WLAN_SER_MATCH_CMD_ID_VDEV,
757 	WLAN_SER_MATCH_MAX,
758 };
759 
760 /**
761  * struct wlan_ser_pdev_obj - pdev obj data for serialization
762  * @pdev_q: Array of pdev queues
763  */
764 struct wlan_ser_pdev_obj {
765 	struct wlan_serialization_pdev_queue pdev_q[SER_PDEV_QUEUE_COMP_MAX];
766 };
767 
768 /**
769  * struct wlan_ser_vdev_priv_obj - Serialization private object of vdev
770  * @vdev_q: Array of vdev queues
771  */
772 struct wlan_ser_vdev_obj {
773 	struct wlan_serialization_vdev_queue vdev_q[SER_VDEV_QUEUE_COMP_MAX];
774 };
775 
776 /**
777  * struct wlan_ser_psoc_obj - psoc obj data for serialization
778  * @comp_info_cb - module level callback
779  * @apply_rules_cb - pointer to apply rules on the cmd
780  * @timers - Timers associated with the active commands
781  * @max_axtive_cmds - Maximum active commands allowed
782  *
783  * Serialization component takes a command as input and checks whether to
784  * allow/deny the command. It will use the module level callback registered
785  * by each component to fetch the information needed to apply the rules.
786  * Once the information is available, the rules callback registered for each
787  * command internally by serialization will be applied to determine the
788  * checkpoint for the command. If allowed, command will be put into active/
789  * pending list and each active command is associated with a timer.
790  */
791 struct wlan_ser_psoc_obj {
792 	wlan_serialization_comp_info_cb comp_info_cb[
793 		WLAN_SER_CMD_MAX][WLAN_UMAC_COMP_ID_MAX];
794 	wlan_serialization_apply_rules_cb apply_rules_cb[WLAN_SER_CMD_MAX];
795 	struct wlan_serialization_timer *timers;
796 	uint8_t max_active_cmds;
797 	qdf_spinlock_t timer_lock;
798 };
799 
800 /**
801  * wlan_serialization_remove_cmd_from_queue() - to remove command from
802  *							given queue
803  * @queue: queue from which command needs to be removed
804  * @cmd: command to match in the queue
805  * @pcmd_list: Pointer to command list containing the command
806  * @ser_pdev_obj: pointer to private pdev serialization object
807  * @node_type: Pdev node or vdev node
808  *
809  * This API takes the queue, it matches the provided command from this queue
810  * and removes it. Before removing the command, it will notify the caller
811  * that if it needs to remove any memory allocated by caller.
812  *
813  * Return: QDF_STATUS_SUCCESS on success, error code on failure
814  */
815 QDF_STATUS
816 wlan_serialization_remove_cmd_from_queue(
817 		qdf_list_t *queue,
818 		struct wlan_serialization_command *cmd,
819 		struct wlan_serialization_command_list **pcmd_list,
820 		struct wlan_ser_pdev_obj *ser_pdev_obj,
821 		enum wlan_serialization_node node_type);
822 
823 /**
824  * wlan_serialization_add_cmd_from_queue() - Add a cmd to
825  *							given queue
826  * @queue: queue from which command needs to be removed
827  * @cmd_list: Pointer to command list containing the command
828  * @ser_pdev_obj: pointer to private pdev serialization object
829  * @is_cmd_for_active_queue: Add cmd to active or pending queue
830  * @node_type: Pdev node or vdev node
831  *
832  * Return: Status of the serialization request
833  */
834 enum wlan_serialization_status
835 wlan_serialization_add_cmd_to_queue(
836 		qdf_list_t *queue,
837 		struct wlan_serialization_command_list *cmd_list,
838 		struct wlan_ser_pdev_obj *ser_pdev_obj,
839 		uint8_t is_cmd_for_active_queue,
840 		enum wlan_serialization_node node_type);
841 
842 /**
843  * wlan_serialization_get_psoc_from_cmd() - get psoc from provided cmd
844  * @cmd: pointer to actual command
845  *
846  * This API will get the pointer to psoc through checking type of cmd
847  *
848  * Return: pointer to psoc
849  */
850 struct wlan_objmgr_psoc*
851 wlan_serialization_get_psoc_from_cmd(struct wlan_serialization_command *cmd);
852 
853 /**
854  * wlan_serialization_get_pdev_from_cmd() - get pdev from provided cmd
855  * @cmd: pointer to actual command
856  *
857  * This API will get the pointer to pdev through checking type of cmd
858  *
859  * Return: pointer to pdev
860  */
861 struct wlan_objmgr_pdev*
862 wlan_serialization_get_pdev_from_cmd(struct wlan_serialization_command *cmd);
863 
864 /**
865  * wlan_serialization_get_vdev_from_cmd() - get vdev from provided cmd
866  * @cmd: pointer to actual command
867  *
868  * This API will get the pointer to vdev through checking type of cmd
869  *
870  * Return: pointer to vdev
871  */
872 struct wlan_objmgr_vdev*
873 wlan_serialization_get_vdev_from_cmd(struct wlan_serialization_command *cmd);
874 
875 /**
876  * wlan_serialization_get_cmd_from_queue() - to extract command from given queue
877  * @queue: pointer to queue
878  * @nnode: next node to extract
879  *
880  * This API will try to extract node from queue which is next to prev node. If
881  * no previous node is given then take out the front node of the queue.
882  *
883  * Return: QDF_STATUS
884  */
885 QDF_STATUS wlan_serialization_get_cmd_from_queue(
886 		qdf_list_t *queue, qdf_list_node_t **nnode);
887 
888 /**
889  * wlan_serialization_stop_timer() - to stop particular timer
890  * @ser_timer: pointer to serialization timer
891  *
892  * This API stops the particular timer
893  *
894  * Return: QDF_STATUS
895  */
896 QDF_STATUS
897 wlan_serialization_stop_timer(struct wlan_serialization_timer *ser_timer);
898 /**
899  * wlan_serialization_cleanup_vdev_timers() - clean-up all timers for a vdev
900  *
901  * @vdev: pointer to vdev object
902  *
903  * This API is to cleanup all the timers for a vdev.
904  * It can be used when serialization vdev destroy is called.
905  * It will make sure that if timer is running then it will
906  * stop and destroys the timer
907  *
908  * Return: QDF_STATUS
909  */
910 
911 QDF_STATUS wlan_serialization_cleanup_vdev_timers(
912 			struct wlan_objmgr_vdev *vdev);
913 
914 /**
915  * wlan_serialization_cleanup_all_timers() - to clean-up all timers
916  *
917  * @psoc_ser_ob: pointer to serialization psoc private object
918  *
919  * This API is to cleanup all the timers. it can be used when serialization
920  * module is exiting. it will make sure that if timer is running then it will
921  * stop and destroys the timer
922  *
923  * Return: QDF_STATUS
924  */
925 QDF_STATUS wlan_serialization_cleanup_all_timers(
926 	struct wlan_ser_psoc_obj *psoc_ser_ob);
927 
928 /**
929  * wlan_serialization_validate_cmd() - Validate the command
930  * @comp_id: Component ID
931  * @cmd_type: Command Type
932  *
933  * Return: QDF_STATUS
934  */
935 QDF_STATUS wlan_serialization_validate_cmd(
936 		 enum wlan_umac_comp_id comp_id,
937 		 enum wlan_serialization_cmd_type cmd_type);
938 
939 /**
940  * wlan_serialization_validate_cmd_list() - Validate the command list
941  * @cmd_list: Serialization command list
942  *
943  * Return: QDF_STATUS
944  */
945 QDF_STATUS wlan_serialization_validate_cmd_list(
946 		struct wlan_serialization_command_list *cmd_list);
947 
948 /**
949  * wlan_serialization_validate_cmdtype() - Validate the command type
950  * @cmd_type: Command Type
951  *
952  * Return: QDF_STATUS
953  */
954 QDF_STATUS wlan_serialization_validate_cmdtype(
955 		 enum wlan_serialization_cmd_type cmd_type);
956 
957 /**
958  * wlan_serialization_destroy_pdev_list() - Release the pdev cmds and
959  * destroy list
960  * @pdev_queue: Pointer to the pdev queue
961  *
962  * Return: None
963  */
964 void wlan_serialization_destroy_pdev_list(
965 		struct wlan_serialization_pdev_queue *pdev_queue);
966 
967 /**
968  * wlan_serialization_destroy_vdev_list() - Release the vdev cmds and
969  * destroy list
970  * @list: List to be destroyed
971  *
972  * Return: None
973  */
974 void wlan_serialization_destroy_vdev_list(qdf_list_t *list);
975 
976 /**
977  * wlan_serialization_get_psoc_obj() - Return the component private obj
978  * @psoc: Pointer to the PSOC object
979  *
980  * Return: Serialization component's PSOC level private data object
981  */
982 struct wlan_ser_psoc_obj *wlan_serialization_get_psoc_obj(
983 		struct wlan_objmgr_psoc *psoc);
984 
985 /**
986  * wlan_serialization_get_pdev_obj() - Return the component private obj
987  * @psoc: Pointer to the PDEV object
988  *
989  * Return: Serialization component's PDEV level private data object
990  */
991 struct wlan_ser_pdev_obj *wlan_serialization_get_pdev_obj(
992 		struct wlan_objmgr_pdev *pdev);
993 
994 /**
995  * wlan_serialization_get_vdev_obj() - Return the component private obj
996  * @vdev: Pointer to the VDEV object
997  *
998  * Return: Serialization component's VDEV level private data object
999  */
1000 struct wlan_ser_vdev_obj *wlan_serialization_get_vdev_obj(
1001 		struct wlan_objmgr_vdev *vdev);
1002 
1003 /**
1004  * wlan_serialization_is_cmd_in_vdev_list() - Check Node present in VDEV list
1005  * @vdev: Pointer to the VDEV object
1006  * @queue: Pointer to the qdf_list_t
1007  * @node_type: Pdev node or vdev node
1008  *
1009  * Return: Boolean true or false
1010  */
1011 bool
1012 wlan_serialization_is_cmd_in_vdev_list(
1013 		struct wlan_objmgr_vdev *vdev, qdf_list_t *queue,
1014 		enum wlan_serialization_node node_type);
1015 
1016 /**
1017  * wlan_serialization_is_cmd_in_pdev_list() - Check Node present in PDEV list
1018  * @pdev: Pointer to the PDEV object
1019  * @queue: Pointer to the qdf_list_t
1020  *
1021  * Return: Boolean true or false
1022  */
1023 bool
1024 wlan_serialization_is_cmd_in_pdev_list(
1025 		struct wlan_objmgr_pdev *pdev, qdf_list_t *queue);
1026 
1027 /**
1028  * wlan_serialization_is_cmd_in_active_pending() - return cmd status
1029  *						active/pending queue
1030  * @cmd_in_active: CMD in active list
1031  * @cmd_in_pending: CMD in pending list
1032  *
1033  * Return: enum wlan_serialization_cmd_status
1034  */
1035 enum wlan_serialization_cmd_status
1036 wlan_serialization_is_cmd_in_active_pending(
1037 		bool cmd_in_active, bool cmd_in_pending);
1038 
1039 /**
1040  * wlan_serialization_is_cmd_present_in_given_queue() - Check if the cmd is
1041  * present in the given queue
1042  * @queue: List of commands which has to be searched
1043  * @cmd: Serialization command information
1044  * @node_type: Pdev node or vdev node
1045  *
1046  * Return: Boolean true or false
1047  */
1048 bool wlan_serialization_is_cmd_present_in_given_queue(
1049 		qdf_list_t *queue,
1050 		struct wlan_serialization_command *cmd,
1051 		enum wlan_serialization_node node_type);
1052 
1053 /**
1054  * wlan_serialization_timer_destroy() - destroys the timer
1055  * @ser_timer: pointer to particular timer
1056  *
1057  * This API destroys the memory allocated by timer and assigns cmd member of
1058  * that timer structure to NULL
1059  *
1060  * Return: QDF_STATUS
1061  */
1062 QDF_STATUS wlan_serialization_timer_destroy(
1063 		struct wlan_serialization_timer *ser_timer);
1064 
1065 /**
1066  * wlan_serialization_list_empty() - check if the list is empty
1067  * @queue: Queue/List that needs to be checked for emptiness
1068  *
1069  * Return: true if list is empty and false otherwise
1070  */
1071 bool wlan_serialization_list_empty(qdf_list_t *queue);
1072 
1073 /**
1074  * wlan_serialization_list_size() - Find the size of the provided queue
1075  * @queue: Queue/List for which the size/length is to be returned
1076  *
1077  * Return: size/length of the queue/list
1078  */
1079 uint32_t wlan_serialization_list_size(qdf_list_t *queue);
1080 
1081 /**
1082  * wlan_serialization_match_cmd_type() - Check for a match on given nnode
1083  * @nnode: The node on which the matching has to be done
1084  * @cmd_type: Command type that needs to be matched
1085  * @node_type: Pdev node or vdev node
1086  *
1087  * This API will check if the cmd ID and cmd type of the given nnode are
1088  * matching with the one's that are being passed to this function.
1089  *
1090  * Return: True if matched,false otherwise.
1091  */
1092 bool wlan_serialization_match_cmd_type(
1093 			qdf_list_node_t *nnode,
1094 			enum wlan_serialization_cmd_type,
1095 			enum wlan_serialization_node node_type);
1096 
1097 /**
1098  * wlan_serialization_match_cmd_id_type() - Check for a match on given nnode
1099  * @nnode: The node on which the matching has to be done
1100  * @cmd: Command that needs to be matched
1101  * @node_type: Pdev node or vdev node
1102  *
1103  * This API will check if the cmd ID and cmd type of the given nnode are
1104  * matching with the one's that are being passed to this function.
1105  *
1106  * Return: True if matched,false otherwise.
1107  */
1108 bool wlan_serialization_match_cmd_id_type(
1109 			qdf_list_node_t *nnode,
1110 			struct wlan_serialization_command *cmd,
1111 			enum wlan_serialization_node node_type);
1112 
1113 /**
1114  * wlan_serialization_match_cmd_vdev() - Check for a match on given nnode
1115  * @nnode: The node on which the matching has to be done
1116  * @vdev: VDEV object that needs to be matched
1117  * @node_type: Pdev node or vdev node
1118  *
1119  * This API will check if the VDEV object of the given nnode are
1120  * matching with the one's that are being passed to this function.
1121  *
1122  * Return: True if matched,false otherwise.
1123  */
1124 bool wlan_serialization_match_cmd_vdev(qdf_list_node_t *nnode,
1125 				       struct wlan_objmgr_vdev *vdev,
1126 				       enum wlan_serialization_node node_type);
1127 
1128 /**
1129  * wlan_serialization_match_cmd_pdev() - Check for a match on given nnode
1130  * @nnode: The node on which the matching has to be done
1131  * @pdev: pdev object that needs to be matched
1132  * @node_type: Node type. Pdev node or vdev node
1133  *
1134  * This API will check if the PDEV object of the given nnode are
1135  * matching with the one's that are being passed to this function.
1136  *
1137  * Return: True if matched,false otherwise.
1138  */
1139 bool wlan_serialization_match_cmd_pdev(qdf_list_node_t *nnode,
1140 				       struct wlan_objmgr_pdev *pdev,
1141 				       enum wlan_serialization_node node_type);
1142 
1143 /**
1144  * wlan_serialization_find_cmd() - Find the cmd matching the given criterias
1145  * @cmd: Serialization command information
1146  * @cmd_type: Command type to be matched
1147  * @pdev: pdev object that needs to be matched
1148  * @vdev: vdev object that needs to be matched
1149  * @node_type: Node type. Pdev node or vdev node
1150  *
1151  * Return: Pointer to the node member in the list
1152  */
1153 qdf_list_node_t *
1154 wlan_serialization_find_cmd(qdf_list_t *queue, uint32_t match_type,
1155 			    struct wlan_serialization_command *cmd,
1156 			    enum wlan_serialization_cmd_type cmd_type,
1157 			    struct wlan_objmgr_pdev *pdev,
1158 			    struct wlan_objmgr_vdev *vdev,
1159 			    enum wlan_serialization_node node_type);
1160 
1161 /**
1162  * wlan_serialization_remove_front() - Remove the front node of the list
1163  * @list: List from which the node is to be removed
1164  * @node: Pointer to store the node that is removed
1165  *
1166  * Return: QDF_STATUS Success or Failure
1167  */
1168 QDF_STATUS wlan_serialization_remove_front(
1169 			qdf_list_t *list,
1170 			qdf_list_node_t **node);
1171 
1172 /**
1173  * wlan_serialization_remove_node() - Remove the given node from the list
1174  * @list: List from which the node is to be removed
1175  * @node: Pointer to the node that is to be removed
1176  *
1177  * Return: QDF_STATUS Success or Failure
1178  */
1179 QDF_STATUS wlan_serialization_remove_node(
1180 			qdf_list_t *list,
1181 			qdf_list_node_t *node);
1182 
1183 /**
1184  * wlan_serialization_insert_front() - Insert a node into the front of the list
1185  * @list: List to which the node is to be inserted
1186  * @node: Pointer to the node that is to be inserted
1187  *
1188  * Return: QDF_STATUS Success or Failure
1189  */
1190 QDF_STATUS wlan_serialization_insert_front(
1191 			qdf_list_t *list,
1192 			qdf_list_node_t *node);
1193 
1194 /**
1195  * wlan_serialization_insert_back() - Insert a node into the back of the list
1196  * @list: List to which the node is to be inserted
1197  * @node: Pointer to the node that is to be inserted
1198  *
1199  * Return: QDF_STATUS Success or Failure
1200  */
1201 QDF_STATUS wlan_serialization_insert_back(
1202 			qdf_list_t *list,
1203 			qdf_list_node_t *node);
1204 
1205 /**
1206  * wlan_serialization_peek_front() - Peek the front node of the list
1207  * @list: List on which the node is to be peeked
1208  * @node: Pointer to the store the node that is being peeked
1209  *
1210  * Return: QDF_STATUS Success or Failure
1211  */
1212 QDF_STATUS wlan_serialization_peek_front(
1213 			qdf_list_t *list,
1214 			qdf_list_node_t **node);
1215 
1216 /**
1217  * wlan_serialization_peek_next() - Peek the next node of the list
1218  * @list: List on which the node is to be peeked
1219  * @node1: Pointer to the node1 from where the next node has to be peeked
1220  * @node2: Pointer to the store the node that is being peeked
1221  *
1222  * Return: QDF_STATUS Success or Failure
1223  */
1224 QDF_STATUS wlan_serialization_peek_next(
1225 			qdf_list_t *list,
1226 			qdf_list_node_t *node1,
1227 			qdf_list_node_t **node2);
1228 
1229 /**
1230  * wlan_serialization_acquire_lock() - Acquire lock to the given queue
1231  * @lock: Pointer to the lock
1232  *
1233  * Return: QDF_STATUS success or failure
1234  */
1235 QDF_STATUS
1236 wlan_serialization_acquire_lock(qdf_spinlock_t *lock);
1237 
1238 /**
1239  * wlan_serialization_release_lock() - Release lock to the given queue
1240  * @lock: Pointer to the lock
1241  *
1242  * Return: QDF_STATUS success or failure
1243  */
1244 QDF_STATUS
1245 wlan_serialization_release_lock(qdf_spinlock_t *lock);
1246 
1247 /**
1248  * wlan_serialization_create_lock() - Init the lock to the given queue
1249  * @lock: Pointer to the lock
1250  *
1251  * Return: QDF_STATUS success or failure
1252  */
1253 QDF_STATUS
1254 wlan_serialization_create_lock(qdf_spinlock_t *lock);
1255 
1256 /**
1257  * wlan_serialization_destroy_lock() - Deinit the lock to the given queue
1258  * @lock: Pointer to the lock
1259  *
1260  * Return: QDF_STATUS success or failure
1261  */
1262 QDF_STATUS
1263 wlan_serialization_destroy_lock(qdf_spinlock_t *lock);
1264 
1265 /**
1266  * wlan_ser_update_cmd_history() - Update serialization queue history
1267  * @pdev_queue:serialization pdev queue
1268  * @cmd: cmd to be added/remeoved
1269  * @ser_reason: serialization action that resulted in addition/removal
1270  * @add_remove: added or removed from queue
1271  * @active_queue:for active queue
1272  *
1273  * Return: QDF_STATUS success or failure
1274  */
1275 
1276 void wlan_ser_update_cmd_history(
1277 		struct wlan_serialization_pdev_queue *pdev_queue,
1278 		struct wlan_serialization_command *cmd,
1279 		enum ser_queue_reason ser_reason,
1280 		bool add_remove,
1281 		bool active_queue);
1282 
1283 #endif
1284 #endif
1285