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_legacy_api.h
20  * This file provides prototypes of the routines needed for the
21  * legacy mcl serialization to utilize the services provided by the
22  * serialization component.
23  */
24 #ifndef __WLAN_SERIALIZATION_LEGACY_API_H
25 #define __WLAN_SERIALIZATION_LEGACY_API_H
26 
27 #include "wlan_serialization_api.h"
28 
29 /**
30  * wlan_serialization_peek_head_pending_cmd_using_psoc() - Return command from
31  *				scan or non-scan pending queue based on flag
32  * @psoc: pointer to psoc
33  * @is_cmd_from_pending_scan_queue: flag to determine whether command needed
34  *				from scan or non-scan pending queue
35  *
36  * This API finds the first active pdev, and loops through scan or non-scan
37  * pending queue (based on is_cmd_from_pending_scan_queue flag) and fetches
38  * first pending command from queue
39  *
40  * Return: pointer to serialization command
41  */
42 struct wlan_serialization_command*
43 wlan_serialization_peek_head_pending_cmd_using_psoc(
44 		struct wlan_objmgr_psoc *psoc,
45 		uint8_t is_cmd_from_pending_scan_queue);
46 /**
47  * wlan_serialization_peek_head_active_cmd_using_psoc() - Return command from
48  *				scan or non-scan active queue based on flag
49  * @psoc: pointer to psoc
50  * @is_cmd_from_active_scan_queue: flag to determine whether command needed
51  *				from scan or non-scan active queue
52  *
53  * This API finds the first active pdev, and loops through scan or non-scan
54  * active queue (based on is_cmd_from_active_scan_queue flag) and fetches
55  * first active command from queue
56  *
57  * Return: pointer to serialization command
58  */
59 struct wlan_serialization_command*
60 wlan_serialization_peek_head_active_cmd_using_psoc(
61 		struct wlan_objmgr_psoc *psoc,
62 		uint8_t is_cmd_from_active_scan_queue);
63 
64 /**
65  * wlan_serialization_get_pending_list_next_node_using_psoc() - Return next
66  *				scan or non-scan pending command from queue
67  * @psoc: pointer to psoc
68  * @prev_cmd: previous command given by caller, find next command after this
69  * @is_cmd_for_pending_scan_queue: to find from scan or non-scan pending queue
70  *
71  * This API finds the first active pdev, and loops through scan or non-scan
72  * pending queue (based on is_cmd_from_pending_scan_queue flag) and fetches
73  * next pending command after prev_cmd
74  *
75  * Return: pointer to serialization command
76  */
77 struct wlan_serialization_command*
78 wlan_serialization_get_pending_list_next_node_using_psoc(
79 		struct wlan_objmgr_psoc *psoc,
80 		struct wlan_serialization_command *prev_cmd,
81 		uint8_t is_cmd_for_pending_scan_queue);
82 /**
83  * wlan_serialization_get_active_list_next_node_using_psoc() - Return next
84  *				scan or non-scan pending command from queue
85  * @psoc: pointer to psoc
86  * @prev_cmd: previous command given by caller, find next command after this
87  * @is_cmd_for_active_scan_queue: to find from active scan or non-scan queue
88  *
89  * This API finds the first active pdev, and loops through scan or non-scan
90  * pending queue (based on is_cmd_from_pending_scan_queue flag) and fetches
91  * next pending command after prev_cmd
92  *
93  * Return: pointer to serialization command
94  */
95 struct wlan_serialization_command*
96 wlan_serialization_get_active_list_next_node_using_psoc(
97 		struct wlan_objmgr_psoc *psoc,
98 		struct wlan_serialization_command *prev_cmd,
99 		uint8_t is_cmd_for_active_scan_queue);
100 /**
101  * wlan_serialization_get_active_list_count() - Return Active list count
102  * @psoc: pointer to soc
103  * @is_cmd_from_active_scan_queue: flag to determine whether command needed
104  *				from scan or non-scan active queue
105  *
106  * Get the number of nodes present in active list
107  *
108  * Return: count number of active commands in queue
109  */
110 
111 uint32_t wlan_serialization_get_active_list_count(struct wlan_objmgr_psoc *psoc,
112 		uint8_t is_cmd_from_active_scan_queue);
113 /**
114  * wlan_serialization_get_pending_list_count() - Return pending list count
115  * @psoc: pointer to soc
116  * @is_cmd_from_pending_scan_queue: flag to determine whether command needed
117  *				from scan or non-scan pending queue
118  *
119  * Get the number of nodes present in pending list
120  *
121  * Return: count number of pending commands in queue
122  */
123 uint32_t wlan_serialization_get_pending_list_count(
124 		struct wlan_objmgr_psoc *psoc,
125 		uint8_t is_cmd_from_pending_scan_queue);
126 
127 /**
128  * wlan_serialization_legacy_init_callback() - Initialize the legacy callbacks
129  *
130  * This API will be called only from legacy modules to initialize the
131  * purge command callbacks
132  *
133  * Return: none
134  */
135 void wlan_serialization_legacy_init_callback(void);
136 
137 /**
138  * wlan_serialization_purge_cmd_list_by_vdev_id() - Purge given list
139  * @psoc: pointer to soc
140  * @vdev_id: vdev_id variable
141  * @purge_scan_active_queue: whether to purge active scan queue
142  * @purge_scan_pending_queue: whether to purge pending scan queue
143  * @purge_nonscan_active_queue: whether to purge active nonscan queue
144  * @purge_nonscan_pending_queue: whether to purge pending nonscan queue
145  * @purge_all_queues: whether to purge all queues.
146  *
147  * This API will purge queue based given flags and vdev_id. If vdev
148  * is invalid then it will return immediately. If correct vdev_id is given then
149  * it will purge the queues per vdev.
150  *
151  * Example:
152  * 1) If you want to purge scan active queue for particular vdev then
153  *    provide correct vdev_id value and purge_scan_active_queue flag set to
154  *    TRUE and rest of the flags set to false.
155  * 2) If you want to purge all queues for particular vdev then provide
156  *    correct vdev_id value and set purge_all_queues flag set to TRUE and rest
157  *    of the flags set to false.
158  * 3) If you want to purge active scan and active non-scan queues to be flushed
159  *    then set purge_scan_active_queue and purge_nonscan_active_queue flags to
160  *    be set TRUE and rest of the flags to be FALSE
161  *
162  * Return: none
163  */
164 void wlan_serialization_purge_cmd_list_by_vdev_id(struct wlan_objmgr_psoc *psoc,
165 		uint8_t vdev_id,
166 		bool purge_scan_active_queue,
167 		bool purge_scan_pending_queue,
168 		bool purge_nonscan_active_queue,
169 		bool purge_nonscan_pending_queue,
170 		bool purge_all_queues);
171 /**
172  * wlan_serialization_purge_cmd_list() - Purge given list
173  * @psoc: pointer to soc
174  * @vdev: pointer to vdev object
175  * @purge_scan_active_queue: whether to purge active scan queue
176  * @purge_scan_pending_queue: whether to purge pending scan queue
177  * @purge_nonscan_active_queue: whether to purge active nonscan queue
178  * @purge_nonscan_pending_queue: whether to purge pending nonscan queue
179  * @purge_all_queues: whether to purge all queues.
180  *
181  * This API will purge queue based given flags and vdev object. If vdev
182  * is null then it will purge the queues per pdev by default.
183  * If vdev is given then it will purge the queues per vdev.
184  *
185  * Example:
186  * 1) If you want to purge scan active queue for particular vdev then
187  *    provide correct vdev object and purge_scan_active_queue flag set to
188  *    TRUE and rest of the flags set to false.
189  * 2) If you want to purge all queues for particular vdev then provide
190  *    correct vdev object value & set purge_all_queues flag set to TRUE and rest
191  *    of the flags set to false.
192  * 3) If you want to purge active scan and active non-scan queues to be flushed
193  *    for pdev then set purge_scan_active_queue and purge_nonscan_active_queue
194  *    flags to be set TRUE and rest of the flags to be FALSE with vdev object
195  *    passed as NULL.
196  *
197  * Return: none
198  */
199 void wlan_serialization_purge_cmd_list(struct wlan_objmgr_psoc *psoc,
200 		struct wlan_objmgr_vdev *vdev,
201 		bool purge_scan_active_queue,
202 		bool purge_scan_pending_queue,
203 		bool purge_nonscan_active_queue,
204 		bool purge_nonscan_pending_queue,
205 		bool purge_all_queues);
206 #endif
207