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_internal_i.h 20 * This file defines the prototypes of functions which are called 21 * from serialization public API's and are internal 22 * to serialization. 23 */ 24 #ifndef __WLAN_SERIALIZATION_PVT_I_H 25 #define __WLAN_SERIALIZATION_PVT_I_H 26 27 #include <wlan_objmgr_vdev_obj.h> 28 #include <wlan_objmgr_pdev_obj.h> 29 #include <wlan_objmgr_psoc_obj.h> 30 #include <qdf_list.h> 31 #include <qdf_status.h> 32 #include "wlan_serialization_api.h" 33 #include "wlan_serialization_main_i.h" 34 #include "wlan_serialization_utils_i.h" 35 #include "wlan_serialization_non_scan_i.h" 36 37 /** 38 * wlan_serialization_is_cmd_present_queue() - Check if same command 39 * is already present active or pending queue 40 * @cmd: pointer to command which we need to find 41 * @is_active_queue: flag to find the command in active or pending queue 42 * 43 * This API will check the given command is already present in active or 44 * pending queue based on flag 45 * If present then return true otherwise false 46 * 47 * Return: true or false 48 */ 49 bool 50 wlan_serialization_is_cmd_present_queue( 51 struct wlan_serialization_command *cmd, 52 uint8_t is_active_queue); 53 54 /** 55 * wlan_serialization_is_active_cmd_allowed() - Check if the given command 56 * can be moved to active queue 57 * @cmd: Serialization command information 58 * 59 * Return: true or false 60 */ 61 bool 62 wlan_serialization_is_active_cmd_allowed( 63 struct wlan_serialization_command *cmd); 64 65 /** 66 * wlan_serialization_enqueue_cmd() - Enqueue the cmd to pending/active Queue 67 * @cmd: Command information 68 * 69 * Return: Status of the serialization request 70 */ 71 enum wlan_serialization_status 72 wlan_serialization_enqueue_cmd(struct wlan_serialization_command *cmd); 73 74 /** 75 * wlan_serialization_activate_cmd() - activate cmd in active queue 76 * @cmd_list: Command needs to be activated 77 * @ser_pdev_obj: Serialization private pdev object 78 * 79 * Return: Status of activation of the command 80 */ 81 QDF_STATUS 82 wlan_serialization_activate_cmd( 83 struct wlan_serialization_command_list *cmd_list, 84 struct wlan_ser_pdev_obj *ser_pdev_obj); 85 86 /** 87 * wlan_serialization_move_pending_to_active() - Move a cmd from pending 88 * queue to active queue 89 * @cmd_type: Type of command to be moved i.e scan or non scan 90 * @pcmd_list: Pointer to command list containing the command 91 * @ser_pdev_obj: Serialization private pdev object 92 * @vdev: Pointer to vdev object manager 93 * @blocking_cmd_removed: If a blocking cmd is removed from active queue 94 * @blocking_cmd_waiting: If a blocking cmd is waiting in pending queue 95 * 96 * Return: Status of command request 97 */ 98 enum wlan_serialization_status 99 wlan_serialization_move_pending_to_active( 100 enum wlan_serialization_cmd_type cmd_type, 101 struct wlan_ser_pdev_obj *ser_pdev_obj, 102 struct wlan_objmgr_vdev *vdev, 103 bool blocking_cmd_removed); 104 105 /** 106 * wlan_serialization_dequeue_cmd() - dequeue the cmd to pending/active Queue 107 * @cmd: Command information 108 * @active_cmd: whether command is for active queue 109 * 110 * Return: Status of the serialization request 111 */ 112 enum wlan_serialization_cmd_status 113 wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd, 114 uint8_t active_cmd); 115 116 /** 117 * wlan_serialization_generic_timer_cb() - timer callback when timer fire 118 * @arg: argument that timer passes to this callback 119 * 120 * All the timers in serialization module calls this callback when they fire, 121 * and this API in turn calls command specific timeout callback and remove 122 * timed-out command from active queue and move any pending command to active 123 * queue of same cmd_type. 124 * 125 * Return: none 126 */ 127 void wlan_serialization_generic_timer_cb(void *arg); 128 129 /** 130 * wlan_serialization_find_and_start_timer() - to find and start the timer 131 * @psoc: pointer to psoc 132 * @cmd: pointer to actual command 133 * 134 * find the free timer, initialize it, and start it 135 * 136 * Return: QDF_STATUS 137 */ 138 QDF_STATUS 139 wlan_serialization_find_and_start_timer(struct wlan_objmgr_psoc *psoc, 140 struct wlan_serialization_command *cmd); 141 142 /** 143 * wlan_serialization_find_and_stop_timer() - to find and stop the timer 144 * @psoc: pointer to psoc 145 * @cmd: pointer to actual command 146 * 147 * find the timer associated with command, stop it and destroy it 148 * 149 * Return: QDF_STATUS 150 */ 151 QDF_STATUS 152 wlan_serialization_find_and_stop_timer(struct wlan_objmgr_psoc *psoc, 153 struct wlan_serialization_command *cmd); 154 155 /** 156 * wlan_serialization_find_and_cancel_cmd() - to find cmd from queue and cancel 157 * @cmd: pointer to serialization command 158 * @req_type: Command cancel request type 159 * @queue_type: Bitmask for member queue type i.e active or pending or both 160 * 161 * This api will find command from active queue and pending queue and 162 * removes the command. If it is in active queue then it will notifies the 163 * requester that it is in active queue and from there it expects requester 164 * to send remove command 165 * 166 * Return: wlan_serialization_cmd_status 167 */ 168 169 enum wlan_serialization_cmd_status 170 wlan_serialization_find_and_cancel_cmd( 171 struct wlan_serialization_command *cmd, 172 enum wlan_serialization_cancel_type req_type, 173 uint8_t queue_type); 174 175 /** 176 * wlan_serialization_cmd_cancel_handler() - helper func to cancel cmd 177 * @ser_obj: private pdev ser obj 178 * @cmd: pointer to command 179 * @pdev: pointer to pdev 180 * @vdev: pointer to vdev 181 * @cmd_type: pointer to cmd_type 182 * @queue_type: If active queue or pending queue 183 * 184 * This API will decide from which queue, command needs to be cancelled 185 * and pass that queue and other parameter required to cancel the command 186 * to helper function. 187 * 188 * Return: wlan_serialization_cmd_status 189 */ 190 enum wlan_serialization_cmd_status 191 wlan_serialization_cmd_cancel_handler( 192 struct wlan_ser_pdev_obj *ser_obj, 193 struct wlan_serialization_command *cmd, 194 struct wlan_objmgr_pdev *pdev, 195 struct wlan_objmgr_vdev *vdev, 196 enum wlan_serialization_cmd_type cmd_type, 197 uint8_t queue_type); 198 #endif 199