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 /**
20  * DOC: wlan_serialization_non_scan_i.h
21  * This file defines the prototypes for functions which deals with
22  * serialization non scan commands.
23  */
24 
25 #ifndef __WLAN_SERIALIZATION_NON_SCAN_I_H
26 #define __WLAN_SERIALIZATION_NON_SCAN_I_H
27 
28 #include <wlan_objmgr_vdev_obj.h>
29 #include <wlan_objmgr_pdev_obj.h>
30 #include <qdf_mc_timer.h>
31 #include <wlan_utility.h>
32 #include "wlan_serialization_utils_i.h"
33 #include "wlan_serialization_main_i.h"
34 #include "wlan_serialization_api.h"
35 #include "wlan_serialization_internal_i.h"
36 #include "wlan_serialization_queue_i.h"
37 
38 /**
39  * wlan_serialization_is_non_scan_pending_queue_empty()
40  *
41  * @cmd: Serialization command information
42  *
43  * This API will be find out if non scan cmd pending queue is empty.
44  *
45  * Return: true or false
46  */
47 bool
48 wlan_serialization_is_non_scan_pending_queue_empty(
49 		struct wlan_serialization_command *cmd);
50 
51 /**
52  * wlan_serialization_is_active_nonscan_cmd_allowed() - find if cmd allowed
53  *			to be enqueued in active queue
54  * @cmd: Serialization command information
55  *
56  * This API will be called to find out if non scan cmd is allowed.
57  *
58  * Return: true or false
59  */
60 bool
61 wlan_serialization_is_active_non_scan_cmd_allowed(
62 		struct wlan_serialization_command *cmd);
63 
64 /**
65  * wlan_ser_add_non_scan_cmd() - Add a non-scan cmd to serialization queue
66  * @ser_pdev_obj: Serialization private pdev object
67  * @cmd_list: Command list with command info that is to be queued
68  * @is_cmd_for_active_queue: If the cmd to be enqueued in active queue or
69  *			pending queue
70  *
71  * Return: Status of the cmd's serialization request
72  */
73 enum wlan_serialization_status
74 wlan_ser_add_non_scan_cmd(
75 		struct wlan_ser_pdev_obj *ser_pdev_obj,
76 		struct wlan_serialization_command_list *cmd_list,
77 		uint8_t is_cmd_for_active_queue);
78 /**
79  * wlan_ser_move_non_scan_pending_to_active() - Move a non-scan cmd from pending
80  *			queue to active queue
81  * @pcmd_list: Pointer to command list containing the command
82  * @ser_pdev_obj: Serialization private pdev object
83  * @vdev: Pointer to object manager vdev
84  *
85  * Return: Status of the cmd's serialization request
86  */
87 enum wlan_serialization_status
88 wlan_ser_move_non_scan_pending_to_active(
89 		struct wlan_ser_pdev_obj *ser_pdev_obj,
90 		struct wlan_objmgr_vdev *vdev,
91 		bool blocking_cmd_removed);
92 
93 /**
94  * wlan_ser_remove_non_scan_cmd() - Remove a non-scan cmd from the given queue
95  * @ser_pdev_obj: Serialization private pdev object
96  * @pcmd_list: Pointer to command list containing the command
97  * @cmd: Serialization command information
98  * @is_active_cmd: If the cmd has to be removed from active queue or pending
99  *			queue
100  *
101  * Return: QDF_STATUS_SUCCESS on successfully removing the cmd else
102  *			QDF_STATUS_E_FAILURE
103  */
104 QDF_STATUS
105 wlan_ser_remove_non_scan_cmd(struct wlan_ser_pdev_obj *ser_pdev_obj,
106 			     struct wlan_serialization_command_list **pcmd_list,
107 			     struct wlan_serialization_command *cmd,
108 			     uint8_t is_active_cmd);
109 /**
110  * wlan_ser_cancel_non_scan_cmd() - Cancel a non-scan cmd from the given queue
111  * @ser_obj: Serialization private pdev object
112  * @pdev: Pointer to object manager pdev
113  * @vdev: Pointer to object manager vdev
114  * @cmd: Serialization command information
115  * @cmd_type: Serialization command type to be cancelled
116  * @is_active_queue: If the cmd has to be removed from active queue or pending
117  *			queue
118  *
119  * Return: Status specifying the cancel of a command from the given queue
120  */
121 enum wlan_serialization_cmd_status
122 wlan_ser_cancel_non_scan_cmd(struct wlan_ser_pdev_obj *ser_obj,
123 			     struct wlan_objmgr_pdev *pdev,
124 			     struct wlan_objmgr_vdev *vdev,
125 			     struct wlan_serialization_command *cmd,
126 			     enum wlan_serialization_cmd_type cmd_type,
127 			     uint8_t is_active_queue);
128 #endif
129