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_purge_cmd_list_by_vdev_id() - Purge given list 129 * @psoc: pointer to soc 130 * @vdev_id: vdev_id variable 131 * @purge_scan_active_queue: whether to purge active scan queue 132 * @purge_scan_pending_queue: whether to purge pending scan queue 133 * @purge_nonscan_active_queue: whether to purge active nonscan queue 134 * @purge_nonscan_pending_queue: whether to purge pending nonscan queue 135 * @purge_all_queues: whether to purge all queues. 136 * 137 * This API will purge queue based given flags and vdev_id. If vdev 138 * is invalid then it will return immediately. If correct vdev_id is given then 139 * it will purge the queues per vdev. 140 * 141 * Example: 142 * 1) If you want to purge scan active queue for particular vdev then 143 * provide correct vdev_id value and purge_scan_active_queue flag set to 144 * TRUE and rest of the flags set to false. 145 * 2) If you want to purge all queues for particular vdev then provide 146 * correct vdev_id value and set purge_all_queues flag set to TRUE and rest 147 * of the flags set to false. 148 * 3) If you want to purge active scan and active non-scan queues to be flushed 149 * then set purge_scan_active_queue and purge_nonscan_active_queue flags to 150 * be set TRUE and rest of the flags to be FALSE 151 * 152 * Return: none 153 */ 154 void wlan_serialization_purge_cmd_list_by_vdev_id(struct wlan_objmgr_psoc *psoc, 155 uint8_t vdev_id, 156 bool purge_scan_active_queue, 157 bool purge_scan_pending_queue, 158 bool purge_nonscan_active_queue, 159 bool purge_nonscan_pending_queue, 160 bool purge_all_queues); 161 /** 162 * wlan_serialization_purge_cmd_list() - Purge given list 163 * @psoc: pointer to soc 164 * @vdev: pointer to vdev object 165 * @purge_scan_active_queue: whether to purge active scan queue 166 * @purge_scan_pending_queue: whether to purge pending scan queue 167 * @purge_nonscan_active_queue: whether to purge active nonscan queue 168 * @purge_nonscan_pending_queue: whether to purge pending nonscan queue 169 * @purge_all_queues: whether to purge all queues. 170 * 171 * This API will purge queue based given flags and vdev object. If vdev 172 * is null then it will purge the queues per pdev by default. 173 * If vdev is given then it will purge the queues per vdev. 174 * 175 * Example: 176 * 1) If you want to purge scan active queue for particular vdev then 177 * provide correct vdev object and purge_scan_active_queue flag set to 178 * TRUE and rest of the flags set to false. 179 * 2) If you want to purge all queues for particular vdev then provide 180 * correct vdev object value & set purge_all_queues flag set to TRUE and rest 181 * of the flags set to false. 182 * 3) If you want to purge active scan and active non-scan queues to be flushed 183 * for pdev then set purge_scan_active_queue and purge_nonscan_active_queue 184 * flags to be set TRUE and rest of the flags to be FALSE with vdev object 185 * passed as NULL. 186 * 187 * Return: none 188 */ 189 void wlan_serialization_purge_cmd_list(struct wlan_objmgr_psoc *psoc, 190 struct wlan_objmgr_vdev *vdev, 191 bool purge_scan_active_queue, 192 bool purge_scan_pending_queue, 193 bool purge_nonscan_active_queue, 194 bool purge_nonscan_pending_queue, 195 bool purge_all_queues); 196 #endif 197