xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/serialization/src/wlan_serialization_scan_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_scan.h
20  * This file defines the prototypes for functions which deals with
21  * serialization non scan commands.
22  */
23 
24 #ifndef __WLAN_SERIALIZATION_SCAN_I_H
25 #define __WLAN_SERIALIZATION_SCAN_I_H
26 
27 #include <wlan_objmgr_vdev_obj.h>
28 #include <wlan_objmgr_pdev_obj.h>
29 #include <qdf_mc_timer.h>
30 #include <wlan_utility.h>
31 #include "wlan_serialization_utils_i.h"
32 #include "wlan_serialization_main_i.h"
33 #include "wlan_serialization_api.h"
34 #include "wlan_serialization_queue_i.h"
35 #include "wlan_serialization_internal_i.h"
36 
37 /**
38  * wlan_serialization_active_scan_cmd_count_handler() - count active scan cmds
39  * @psoc: pointer to soc strucutre
40  * @obj : pointer to pdev object
41  * @arg: pointer to argument
42  *
43  * This API will be called while iterating each pdev object and it will count
44  * number of scan commands present in that pdev object's active queue. count
45  * will be updated in *arg
46  *
47  * Return: none
48  */
49 void
50 wlan_serialization_active_scan_cmd_count_handler(struct wlan_objmgr_psoc *psoc,
51 						 void *obj, void *arg);
52 
53 /**
54  * wlan_serialization_is_scan_pending_queue_empty()
55  *
56  * @cmd: Serialization command information
57  *
58  * This API will be find out if scan cmd pending queue is empty.
59  *
60  * Return: true or false
61  */
62 bool
63 wlan_serialization_is_scan_pending_queue_empty(
64 		struct wlan_serialization_command *cmd);
65 
66 /**
67  * wlan_serialization_is_active_scan_cmd_allowed() - find if scan cmd allowed
68  * @pdev: pointer to pdev object
69  *
70  * This API will be called to find out if active scan cmd is allowed. It has
71  * to iterate through all pdev to find out total number of active scan cmds.
72  * If total number of active scan cmds reach to allowed threshold then don't
73  * allow more scan cmd.
74  *
75  * Return: true or false
76  */
77 bool
78 wlan_serialization_is_active_scan_cmd_allowed(
79 		struct wlan_serialization_command *cmd);
80 
81 /**
82  * wlan_ser_match_cmd_scan_id() - Compare the scan id and the vdev to the given
83  *			command
84  * @cmd: Serialization command information
85  * @scan_id: Scan id to be compared
86  * @vdev: Pointer to object manager vdev that needs to compared
87  *
88  * Return: true if match found, else false
89  */
90 bool
91 wlan_ser_match_cmd_scan_id(qdf_list_node_t *nnode,
92 			   struct wlan_serialization_command **cmd,
93 			   uint16_t scan_id,
94 			   struct wlan_objmgr_vdev *vdev);
95 
96 /**
97  * wlan_ser_add_scan_cmd() - Add a scan cmd to serialization queue
98  * @ser_pdev_obj: Serialization private pdev object
99  * @cmd_list: Command list with command info that is to be queued
100  * @is_cmd_for_active_queue: If the cmd to be enqueued in active queue or
101  *			pending queue
102  *
103  * Return: Status of the cmd's serialization request
104  */
105 enum wlan_serialization_status
106 wlan_ser_add_scan_cmd(struct wlan_ser_pdev_obj *ser_pdev_obj,
107 		      struct wlan_serialization_command_list *cmd_list,
108 		      uint8_t is_cmd_for_active_queue);
109 
110 /**
111  * wlan_ser_remove_scan_cmd() - Remove a scan cmd from the given queue
112  * @ser_pdev_obj: Serialization private pdev object
113  * @pcmd_list: Pointer to command list containing the command
114  * @cmd: Serialization command information
115  * @is_active_cmd: If the cmd has to be removed from active queue or pending
116  *			queue
117  *
118  * Return: QDF_STATUS_SUCCESS on successfully removing the cmd else
119  *			QDF_STATUS_E_FAILURE
120  */
121 QDF_STATUS
122 wlan_ser_remove_scan_cmd(struct wlan_ser_pdev_obj *ser_pdev_obj,
123 			 struct wlan_serialization_command_list **pcmd_list,
124 			 struct wlan_serialization_command *cmd,
125 			 uint8_t is_active_cmd);
126 
127 /**
128  * wlan_ser_cancel_scan_cmd() - Cancel a scan cmd from the given queue
129  * @ser_obj: Serialization private pdev object
130  * @pdev: Pointer to object manager pdev
131  * @vdev: Pointer to object manager vdev
132  * @cmd: Serialization command information
133  * @cmd_type: Serialization command type to be cancelled
134  * @is_active_queue: If the cmd has to be removed from active queue or pending
135  *			queue
136  *
137  * Return: Status specifying the cancel of a command from the given queue
138  */
139 enum wlan_serialization_cmd_status
140 wlan_ser_cancel_scan_cmd(struct wlan_ser_pdev_obj *ser_obj,
141 			 struct wlan_objmgr_pdev *pdev,
142 			 struct wlan_objmgr_vdev *vdev,
143 			 struct wlan_serialization_command *cmd,
144 			 enum wlan_serialization_cmd_type cmd_type,
145 			 uint8_t is_active_queue);
146 
147 /**
148  * wlan_ser_move_scan_pending_to_active() - Move a scan cmd from pending
149  *			queue to active queue
150  * @ser_pdev_obj: Serialization private pdev object
151  *
152  * Return: Status of the cmd's serialization request
153  */
154 enum wlan_serialization_status
155 wlan_ser_move_scan_pending_to_active(
156 		struct wlan_ser_pdev_obj *ser_pdev_obj);
157 #endif
158 
159