1 /*
2  * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: wlan_serialization_non_scan_i.h
22  * This file defines the prototypes for functions which deals with
23  * serialization non scan commands.
24  */
25 
26 #ifndef __WLAN_SERIALIZATION_NON_SCAN_I_H
27 #define __WLAN_SERIALIZATION_NON_SCAN_I_H
28 
29 #include <wlan_objmgr_vdev_obj.h>
30 #include <wlan_objmgr_pdev_obj.h>
31 #include <qdf_mc_timer.h>
32 #include <wlan_utility.h>
33 #include "wlan_serialization_utils_i.h"
34 #include "wlan_serialization_main_i.h"
35 #include "wlan_serialization_api.h"
36 #include "wlan_serialization_internal_i.h"
37 #include "wlan_serialization_queue_i.h"
38 
39 /**
40  * wlan_serialization_is_non_scan_pending_queue_empty()
41  *
42  * @cmd: Serialization command information
43  *
44  * This API will be find out if non scan cmd pending queue is empty.
45  *
46  * Return: true or false
47  */
48 bool
49 wlan_serialization_is_non_scan_pending_queue_empty(
50 		struct wlan_serialization_command *cmd);
51 
52 /**
53  * wlan_serialization_is_active_non_scan_cmd_allowed() - find if cmd allowed
54  *			to be enqueued in active queue
55  * @cmd: Serialization command information
56  *
57  * This API will be called to find out if non scan cmd is allowed.
58  *
59  * Return: true or false
60  */
61 bool
62 wlan_serialization_is_active_non_scan_cmd_allowed(
63 		struct wlan_serialization_command *cmd);
64 
65 /**
66  * wlan_ser_add_non_scan_cmd() - Add a non-scan cmd to serialization queue
67  * @ser_pdev_obj: Serialization private pdev object
68  * @cmd_list: Command list with command info that is to be queued
69  * @is_cmd_for_active_queue: If the cmd to be enqueued in active queue or
70  *			pending queue
71  *
72  * Return: Status of the cmd's serialization request
73  */
74 enum wlan_serialization_status
75 wlan_ser_add_non_scan_cmd(
76 		struct wlan_ser_pdev_obj *ser_pdev_obj,
77 		struct wlan_serialization_command_list *cmd_list,
78 		uint8_t is_cmd_for_active_queue);
79 /**
80  * wlan_ser_move_non_scan_pending_to_active() - Move a non-scan cmd from pending
81  *			queue to active queue
82  * @ser_pdev_obj: Serialization private pdev object
83  * @vdev: Pointer to object manager vdev
84  * @blocking_cmd_removed: If a blocking cmd is removed from active queue
85  *
86  * Return: Status of the cmd's serialization request
87  */
88 enum wlan_serialization_status
89 wlan_ser_move_non_scan_pending_to_active(
90 		struct wlan_ser_pdev_obj *ser_pdev_obj,
91 		struct wlan_objmgr_vdev *vdev,
92 		bool blocking_cmd_removed);
93 
94 /**
95  * wlan_ser_remove_non_scan_cmd() - Remove a non-scan cmd from the given queue
96  * @ser_pdev_obj: Serialization private pdev object
97  * @pcmd_list: Pointer to command list containing the command
98  * @cmd: Serialization command information
99  * @is_active_cmd: If the cmd has to be removed from active queue or pending
100  *			queue
101  *
102  * Return: QDF_STATUS_SUCCESS on successfully removing the cmd else
103  *			QDF_STATUS_E_FAILURE
104  */
105 QDF_STATUS
106 wlan_ser_remove_non_scan_cmd(struct wlan_ser_pdev_obj *ser_pdev_obj,
107 			     struct wlan_serialization_command_list **pcmd_list,
108 			     struct wlan_serialization_command *cmd,
109 			     uint8_t is_active_cmd);
110 /**
111  * wlan_ser_cancel_non_scan_cmd() - Cancel a non-scan cmd from the given queue
112  * @ser_obj: Serialization private pdev object
113  * @pdev: Pointer to object manager pdev
114  * @vdev: Pointer to object manager vdev
115  * @cmd: Serialization command information
116  * @cmd_type: Serialization command type to be cancelled
117  * @is_active_queue: If the cmd has to be removed from active queue or pending
118  *			queue
119  * @cmd_attr: Indicate the attribute of the cmd to be cancelled
120  *      i.e blocking/non-blocking
121  *
122  * Return: Status specifying the cancel of a command from the given queue
123  */
124 enum wlan_serialization_cmd_status
125 wlan_ser_cancel_non_scan_cmd(struct wlan_ser_pdev_obj *ser_obj,
126 			     struct wlan_objmgr_pdev *pdev,
127 			     struct wlan_objmgr_vdev *vdev,
128 			     struct wlan_serialization_command *cmd,
129 			     enum wlan_serialization_cmd_type cmd_type,
130 			     uint8_t is_active_queue,
131 			     enum wlan_ser_cmd_attr cmd_attr);
132 #endif
133