xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/serialization/src/wlan_serialization_scan_i.h (revision 302a1d9701784af5f4797b1a9fe07ae820b51907)
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_active_scan_cmd_allowed() - find if scan cmd allowed
55  * @pdev: pointer to pdev object
56  *
57  * This API will be called to find out if active scan cmd is allowed. It has
58  * to iterate through all pdev to find out total number of active scan cmds.
59  * If total number of active scan cmds reach to allowed threshold then don't
60  * allow more scan cmd.
61  *
62  * Return: true or false
63  */
64 bool
65 wlan_serialization_is_active_scan_cmd_allowed(
66 		struct wlan_serialization_command *cmd);
67 
68 /**
69  * wlan_ser_match_cmd_scan_id() - Compare the scan id and the vdev to the given
70  *			command
71  * @cmd: Serialization command information
72  * @scan_id: Scan id to be compared
73  * @vdev: Pointer to object manager vdev that needs to compared
74  *
75  * Return: true if match found, else false
76  */
77 bool
78 wlan_ser_match_cmd_scan_id(qdf_list_node_t *nnode,
79 			   struct wlan_serialization_command **cmd,
80 			   uint16_t scan_id,
81 			   struct wlan_objmgr_vdev *vdev);
82 
83 /**
84  * wlan_ser_add_scan_cmd() - Add a scan cmd to serialization queue
85  * @ser_pdev_obj: Serialization private pdev object
86  * @cmd_list: Command list with command info that is to be queued
87  * @is_cmd_for_active_queue: If the cmd to be enqueued in active queue or
88  *			pending queue
89  *
90  * Return: Status of the cmd's serialization request
91  */
92 enum wlan_serialization_status
93 wlan_ser_add_scan_cmd(struct wlan_ser_pdev_obj *ser_pdev_obj,
94 		      struct wlan_serialization_command_list *cmd_list,
95 		      uint8_t is_cmd_for_active_queue);
96 
97 /**
98  * wlan_ser_remove_scan_cmd() - Remove a scan cmd from the given queue
99  * @ser_pdev_obj: Serialization private pdev object
100  * @pcmd_list: Pointer to command list containing the command
101  * @cmd: Serialization command information
102  * @is_active_cmd: If the cmd has to be removed from active queue or pending
103  *			queue
104  *
105  * Return: QDF_STATUS_SUCCESS on successfully removing the cmd else
106  *			QDF_STATUS_E_FAILURE
107  */
108 QDF_STATUS
109 wlan_ser_remove_scan_cmd(struct wlan_ser_pdev_obj *ser_pdev_obj,
110 			 struct wlan_serialization_command_list **pcmd_list,
111 			 struct wlan_serialization_command *cmd,
112 			 uint8_t is_active_cmd);
113 
114 /**
115  * wlan_ser_cancel_scan_cmd() - Cancel a scan cmd from the given queue
116  * @ser_obj: Serialization private pdev object
117  * @pdev: Pointer to object manager pdev
118  * @vdev: Pointer to object manager vdev
119  * @cmd: Serialization command information
120  * @cmd_type: Serialization command type to be cancelled
121  * @is_active_queue: If the cmd has to be removed from active queue or pending
122  *			queue
123  *
124  * Return: Status specifying the cancel of a command from the given queue
125  */
126 enum wlan_serialization_cmd_status
127 wlan_ser_cancel_scan_cmd(struct wlan_ser_pdev_obj *ser_obj,
128 			 struct wlan_objmgr_pdev *pdev,
129 			 struct wlan_objmgr_vdev *vdev,
130 			 struct wlan_serialization_command *cmd,
131 			 enum wlan_serialization_cmd_type cmd_type,
132 			 uint8_t is_active_queue);
133 
134 /**
135  * wlan_ser_move_scan_pending_to_active() - Move a scan cmd from pending
136  *			queue to active queue
137  * @pcmd_list: Pointer to command list containing the command
138  * @ser_pdev_obj: Serialization private pdev object
139  *
140  * Return: Status of the cmd's serialization request
141  */
142 enum wlan_serialization_status
143 wlan_ser_move_scan_pending_to_active(
144 		struct wlan_serialization_command_list **pcmd_list,
145 		struct wlan_ser_pdev_obj *ser_pdev_obj);
146 #endif
147 
148