1 /* 2 * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-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 * DOC: wlan_serialization_scan.h 21 * This file defines the prototypes for functions which deals with 22 * serialization non scan commands. 23 */ 24 25 #ifndef __WLAN_SERIALIZATION_SCAN_I_H 26 #define __WLAN_SERIALIZATION_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_queue_i.h" 36 #include "wlan_serialization_internal_i.h" 37 38 /** 39 * wlan_serialization_active_scan_cmd_count_handler() - count active scan cmds 40 * @psoc: pointer to soc structure 41 * @obj : pointer to pdev object 42 * @arg: pointer to argument 43 * 44 * This API will be called while iterating each pdev object and it will count 45 * number of scan commands present in that pdev object's active queue. count 46 * will be updated in *arg 47 * 48 * Return: none 49 */ 50 void 51 wlan_serialization_active_scan_cmd_count_handler(struct wlan_objmgr_psoc *psoc, 52 void *obj, void *arg); 53 54 /** 55 * wlan_serialization_is_scan_pending_queue_empty() 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 * @cmd: Serialization command information 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 * @nnode: Command list node 85 * @cmd: Serialization command information 86 * @scan_id: Scan id to be compared 87 * @vdev: Pointer to object manager vdev that needs to compared 88 * 89 * Return: true if match found, else false 90 */ 91 bool 92 wlan_ser_match_cmd_scan_id(qdf_list_node_t *nnode, 93 struct wlan_serialization_command **cmd, 94 uint16_t scan_id, 95 struct wlan_objmgr_vdev *vdev); 96 97 /** 98 * wlan_ser_add_scan_cmd() - Add a scan cmd to serialization queue 99 * @ser_pdev_obj: Serialization private pdev object 100 * @cmd_list: Command list with command info that is to be queued 101 * @is_cmd_for_active_queue: If the cmd to be enqueued in active queue or 102 * pending queue 103 * 104 * Return: Status of the cmd's serialization request 105 */ 106 enum wlan_serialization_status 107 wlan_ser_add_scan_cmd(struct wlan_ser_pdev_obj *ser_pdev_obj, 108 struct wlan_serialization_command_list *cmd_list, 109 uint8_t is_cmd_for_active_queue); 110 111 /** 112 * wlan_ser_remove_scan_cmd() - Remove a scan cmd from the given queue 113 * @ser_pdev_obj: Serialization private pdev object 114 * @pcmd_list: Pointer to command list containing the command 115 * @cmd: Serialization command information 116 * @is_active_cmd: If the cmd has to be removed from active queue or pending 117 * queue 118 * 119 * Return: QDF_STATUS_SUCCESS on successfully removing the cmd else 120 * QDF_STATUS_E_FAILURE 121 */ 122 QDF_STATUS 123 wlan_ser_remove_scan_cmd(struct wlan_ser_pdev_obj *ser_pdev_obj, 124 struct wlan_serialization_command_list **pcmd_list, 125 struct wlan_serialization_command *cmd, 126 uint8_t is_active_cmd); 127 128 /** 129 * wlan_ser_cancel_scan_cmd() - Cancel a scan cmd from the given queue 130 * @ser_obj: Serialization private pdev object 131 * @pdev: Pointer to object manager pdev 132 * @vdev: Pointer to object manager vdev 133 * @cmd: Serialization command information 134 * @cmd_type: Serialization command type to be cancelled 135 * @is_active_queue: If the cmd has to be removed from active queue or pending 136 * queue 137 * 138 * Return: Status specifying the cancel of a command from the given queue 139 */ 140 enum wlan_serialization_cmd_status 141 wlan_ser_cancel_scan_cmd(struct wlan_ser_pdev_obj *ser_obj, 142 struct wlan_objmgr_pdev *pdev, 143 struct wlan_objmgr_vdev *vdev, 144 struct wlan_serialization_command *cmd, 145 enum wlan_serialization_cmd_type cmd_type, 146 uint8_t is_active_queue); 147 148 /** 149 * wlan_ser_move_scan_pending_to_active() - Move a scan cmd from pending 150 * queue to active queue 151 * @ser_pdev_obj: Serialization private pdev object 152 * 153 * Return: Status of the cmd's serialization request 154 */ 155 enum wlan_serialization_status 156 wlan_ser_move_scan_pending_to_active( 157 struct wlan_ser_pdev_obj *ser_pdev_obj); 158 #endif 159 160