1*5113495bSYour Name /* 2*5113495bSYour Name * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. 3*5113495bSYour Name * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4*5113495bSYour Name * 5*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for 6*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the 7*5113495bSYour Name * above copyright notice and this permission notice appear in all 8*5113495bSYour Name * copies. 9*5113495bSYour Name * 10*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE. 18*5113495bSYour Name */ 19*5113495bSYour Name /** 20*5113495bSYour Name * DOC: wlan_serialization_utils_i.h 21*5113495bSYour Name * This file defines the prototypes for the utility helper functions 22*5113495bSYour Name * for the serialization component. 23*5113495bSYour Name */ 24*5113495bSYour Name #ifndef __WLAN_SERIALIZATION_UTILS_I_H 25*5113495bSYour Name #define __WLAN_SERIALIZATION_UTILS_I_H 26*5113495bSYour Name 27*5113495bSYour Name #include <qdf_status.h> 28*5113495bSYour Name #include <qdf_list.h> 29*5113495bSYour Name #include <qdf_mc_timer.h> 30*5113495bSYour Name #include <wlan_objmgr_cmn.h> 31*5113495bSYour Name #include <wlan_objmgr_global_obj.h> 32*5113495bSYour Name #include <wlan_objmgr_psoc_obj.h> 33*5113495bSYour Name #include <wlan_scan_ucfg_api.h> 34*5113495bSYour Name #include "wlan_serialization_rules_i.h" 35*5113495bSYour Name #ifdef WLAN_SER_DEBUG 36*5113495bSYour Name #include "wlan_serialization_debug_i.h" 37*5113495bSYour Name #endif 38*5113495bSYour Name 39*5113495bSYour Name /* 40*5113495bSYour Name * Below bit positions are used to identify if a 41*5113495bSYour Name * serialization command is in use or marked for 42*5113495bSYour Name * deletion. 43*5113495bSYour Name * CMD_MARKED_FOR_ACTIVATION - The command is about to be activated 44*5113495bSYour Name * CMD_IS_ACTIVE - The command is active and currently in use 45*5113495bSYour Name */ 46*5113495bSYour Name #define CMD_MARKED_FOR_ACTIVATION 1 47*5113495bSYour Name #define CMD_IS_ACTIVE 2 48*5113495bSYour Name #define CMD_ACTIVE_MARKED_FOR_CANCEL 3 49*5113495bSYour Name #define CMD_ACTIVE_MARKED_FOR_REMOVAL 4 50*5113495bSYour Name #define CMD_MARKED_FOR_MOVEMENT 5 51*5113495bSYour Name /** 52*5113495bSYour Name * struct wlan_serialization_timer - Timer used for serialization 53*5113495bSYour Name * @cmd: Cmd to which the timer is linked 54*5113495bSYour Name * @timer: Timer associated with the command 55*5113495bSYour Name * 56*5113495bSYour Name * Timers are allocated statically during init, one each for the 57*5113495bSYour Name * maximum active commands permitted in the system. Once a cmd is 58*5113495bSYour Name * moved from pending list to active list, the timer is activated 59*5113495bSYour Name * and once the cmd is completed, the timer is cancelled. Timer is 60*5113495bSYour Name * also cancelled if the command is aborted 61*5113495bSYour Name * 62*5113495bSYour Name * The timers are maintained per psoc. A timer is associated to 63*5113495bSYour Name * unique combination of pdev, cmd_type and cmd_id. 64*5113495bSYour Name */ 65*5113495bSYour Name struct wlan_serialization_timer { 66*5113495bSYour Name struct wlan_serialization_command *cmd; 67*5113495bSYour Name qdf_timer_t timer; 68*5113495bSYour Name }; 69*5113495bSYour Name 70*5113495bSYour Name /** 71*5113495bSYour Name * enum wlan_serialization_node - Types of available nodes in serialization list 72*5113495bSYour Name * @WLAN_SER_PDEV_NODE: pdev node from the pdev queue 73*5113495bSYour Name * @WLAN_SER_VDEV_NODE: vdev node from the vdev queue 74*5113495bSYour Name */ 75*5113495bSYour Name enum wlan_serialization_node { 76*5113495bSYour Name WLAN_SER_PDEV_NODE, 77*5113495bSYour Name WLAN_SER_VDEV_NODE, 78*5113495bSYour Name }; 79*5113495bSYour Name 80*5113495bSYour Name /** 81*5113495bSYour Name * struct wlan_serialization_command_list - List of commands to be serialized 82*5113495bSYour Name * @pdev_node: PDEV node identifier in the list 83*5113495bSYour Name * @vdev_node: VDEV node identifier in the list 84*5113495bSYour Name * @cmd: Command to be serialized 85*5113495bSYour Name * @cmd_in_use: flag to check if the node/entry is logically active 86*5113495bSYour Name */ 87*5113495bSYour Name struct wlan_serialization_command_list { 88*5113495bSYour Name qdf_list_node_t pdev_node; 89*5113495bSYour Name qdf_list_node_t vdev_node; 90*5113495bSYour Name struct wlan_serialization_command cmd; 91*5113495bSYour Name unsigned long cmd_in_use; 92*5113495bSYour Name }; 93*5113495bSYour Name 94*5113495bSYour Name /** 95*5113495bSYour Name * struct wlan_serialization_pdev_queue - queue data related to pdev 96*5113495bSYour Name * @active_list: list to hold the commands currently being executed 97*5113495bSYour Name * @pending_list: list to hold the commands currently pending 98*5113495bSYour Name * @cmd_pool_list: list to hold the global command pool 99*5113495bSYour Name * @vdev_active_cmd_bitmap: Active cmd bitmap of vdev for the given pdev 100*5113495bSYour Name * @blocking_cmd_active: Indicate if a blocking cmd is in active execution 101*5113495bSYour Name * @blocking_cmd_waiting: Indicate if a blocking cmd is in pending queue 102*5113495bSYour Name * @pdev_queue_lock: pdev lock to protect concurrent operations on the queues 103*5113495bSYour Name * @history: serialization history 104*5113495bSYour Name */ 105*5113495bSYour Name struct wlan_serialization_pdev_queue { 106*5113495bSYour Name qdf_list_t active_list; 107*5113495bSYour Name qdf_list_t pending_list; 108*5113495bSYour Name qdf_list_t cmd_pool_list; 109*5113495bSYour Name qdf_bitmap(vdev_active_cmd_bitmap, WLAN_UMAC_PSOC_MAX_VDEVS); 110*5113495bSYour Name bool blocking_cmd_active; 111*5113495bSYour Name uint16_t blocking_cmd_waiting; 112*5113495bSYour Name qdf_spinlock_t pdev_queue_lock; 113*5113495bSYour Name #ifdef WLAN_SER_DEBUG 114*5113495bSYour Name struct ser_history history; 115*5113495bSYour Name #endif 116*5113495bSYour Name }; 117*5113495bSYour Name 118*5113495bSYour Name /** 119*5113495bSYour Name * struct wlan_serialization_vdev_queue - queue data related to vdev 120*5113495bSYour Name * @active_list: list to hold the commands currently being executed 121*5113495bSYour Name * @pending_list: list: to hold the commands currently pending 122*5113495bSYour Name * @queue_disable: is the queue disabled 123*5113495bSYour Name */ 124*5113495bSYour Name struct wlan_serialization_vdev_queue { 125*5113495bSYour Name qdf_list_t active_list; 126*5113495bSYour Name qdf_list_t pending_list; 127*5113495bSYour Name bool queue_disable; 128*5113495bSYour Name }; 129*5113495bSYour Name 130*5113495bSYour Name /** 131*5113495bSYour Name * enum serialization_pdev_queue_type - Types of available pdev queues 132*5113495bSYour Name * @SER_PDEV_QUEUE_COMP_SCAN: Scan queue 133*5113495bSYour Name * @SER_PDEV_QUEUE_COMP_NON_SCAN: Non Scan queue 134*5113495bSYour Name * @SER_PDEV_QUEUE_COMP_MAX: Max enumeration 135*5113495bSYour Name */ 136*5113495bSYour Name enum serialization_pdev_queue_type { 137*5113495bSYour Name SER_PDEV_QUEUE_COMP_SCAN, 138*5113495bSYour Name SER_PDEV_QUEUE_COMP_NON_SCAN, 139*5113495bSYour Name SER_PDEV_QUEUE_COMP_MAX, 140*5113495bSYour Name }; 141*5113495bSYour Name 142*5113495bSYour Name /** 143*5113495bSYour Name * enum serialization_vdev_queue_type - Types of available vdev queues 144*5113495bSYour Name * @SER_VDEV_QUEUE_COMP_NON_SCAN: Non Scan queue 145*5113495bSYour Name * @SER_VDEV_QUEUE_COMP_MAX: Max enumeration 146*5113495bSYour Name */ 147*5113495bSYour Name enum serialization_vdev_queue_type { 148*5113495bSYour Name SER_VDEV_QUEUE_COMP_NON_SCAN, 149*5113495bSYour Name SER_VDEV_QUEUE_COMP_MAX, 150*5113495bSYour Name }; 151*5113495bSYour Name 152*5113495bSYour Name /** 153*5113495bSYour Name * enum wlan_serialization_match_type - Comparison options for a command 154*5113495bSYour Name * @WLAN_SER_MATCH_VDEV: Compare vdev 155*5113495bSYour Name * @WLAN_SER_MATCH_PDEV: Compare pdev 156*5113495bSYour Name * @WLAN_SER_MATCH_CMD_TYPE_VDEV: Compare command type and vdev 157*5113495bSYour Name * @WLAN_SER_MATCH_CMD_ID_VDEV: Compare command id and vdev 158*5113495bSYour Name * @WLAN_SER_MATCH_MAX: Max enumeration 159*5113495bSYour Name */ 160*5113495bSYour Name enum wlan_serialization_match_type { 161*5113495bSYour Name WLAN_SER_MATCH_VDEV, 162*5113495bSYour Name WLAN_SER_MATCH_PDEV, 163*5113495bSYour Name WLAN_SER_MATCH_CMD_TYPE_VDEV, 164*5113495bSYour Name WLAN_SER_MATCH_CMD_ID_VDEV, 165*5113495bSYour Name WLAN_SER_MATCH_MAX, 166*5113495bSYour Name }; 167*5113495bSYour Name 168*5113495bSYour Name /** 169*5113495bSYour Name * struct wlan_ser_pdev_obj - pdev obj data for serialization 170*5113495bSYour Name * @pdev_q: Array of pdev queues 171*5113495bSYour Name */ 172*5113495bSYour Name struct wlan_ser_pdev_obj { 173*5113495bSYour Name struct wlan_serialization_pdev_queue pdev_q[SER_PDEV_QUEUE_COMP_MAX]; 174*5113495bSYour Name }; 175*5113495bSYour Name 176*5113495bSYour Name /** 177*5113495bSYour Name * struct wlan_ser_vdev_obj - Serialization private object of vdev 178*5113495bSYour Name * @vdev_q: Array of vdev queues 179*5113495bSYour Name */ 180*5113495bSYour Name struct wlan_ser_vdev_obj { 181*5113495bSYour Name struct wlan_serialization_vdev_queue vdev_q[SER_VDEV_QUEUE_COMP_MAX]; 182*5113495bSYour Name }; 183*5113495bSYour Name 184*5113495bSYour Name /** 185*5113495bSYour Name * struct wlan_ser_psoc_obj - psoc obj data for serialization 186*5113495bSYour Name * @comp_info_cb: module level callback 187*5113495bSYour Name * @apply_rules_cb: pointer to apply rules on the cmd 188*5113495bSYour Name * @timers: Timers associated with the active commands 189*5113495bSYour Name * @max_active_cmds: Maximum active commands allowed 190*5113495bSYour Name * @timer_lock: lock for @timers 191*5113495bSYour Name * 192*5113495bSYour Name * Serialization component takes a command as input and checks whether to 193*5113495bSYour Name * allow/deny the command. It will use the module level callback registered 194*5113495bSYour Name * by each component to fetch the information needed to apply the rules. 195*5113495bSYour Name * Once the information is available, the rules callback registered for each 196*5113495bSYour Name * command internally by serialization will be applied to determine the 197*5113495bSYour Name * checkpoint for the command. If allowed, command will be put into active/ 198*5113495bSYour Name * pending list and each active command is associated with a timer. 199*5113495bSYour Name */ 200*5113495bSYour Name struct wlan_ser_psoc_obj { 201*5113495bSYour Name wlan_serialization_comp_info_cb comp_info_cb[WLAN_SER_CMD_MAX][WLAN_UMAC_COMP_ID_MAX]; 202*5113495bSYour Name wlan_serialization_apply_rules_cb apply_rules_cb[WLAN_SER_CMD_MAX]; 203*5113495bSYour Name struct wlan_serialization_timer *timers; 204*5113495bSYour Name uint8_t max_active_cmds; 205*5113495bSYour Name qdf_spinlock_t timer_lock; 206*5113495bSYour Name }; 207*5113495bSYour Name 208*5113495bSYour Name /** 209*5113495bSYour Name * wlan_serialization_remove_cmd_from_queue() - to remove command from 210*5113495bSYour Name * given queue 211*5113495bSYour Name * @queue: queue from which command needs to be removed 212*5113495bSYour Name * @cmd: command to match in the queue 213*5113495bSYour Name * @pcmd_list: Pointer to command list containing the command 214*5113495bSYour Name * @ser_pdev_obj: pointer to private pdev serialization object 215*5113495bSYour Name * @node_type: Pdev node or vdev node 216*5113495bSYour Name * 217*5113495bSYour Name * This API takes the queue, it matches the provided command from this queue 218*5113495bSYour Name * and removes it. Before removing the command, it will notify the caller 219*5113495bSYour Name * that if it needs to remove any memory allocated by caller. 220*5113495bSYour Name * 221*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success, error code on failure 222*5113495bSYour Name */ 223*5113495bSYour Name QDF_STATUS 224*5113495bSYour Name wlan_serialization_remove_cmd_from_queue( 225*5113495bSYour Name qdf_list_t *queue, 226*5113495bSYour Name struct wlan_serialization_command *cmd, 227*5113495bSYour Name struct wlan_serialization_command_list **pcmd_list, 228*5113495bSYour Name struct wlan_ser_pdev_obj *ser_pdev_obj, 229*5113495bSYour Name enum wlan_serialization_node node_type); 230*5113495bSYour Name 231*5113495bSYour Name /** 232*5113495bSYour Name * wlan_serialization_add_cmd_to_queue() - Add a cmd to given queue 233*5113495bSYour Name * @queue: queue to which command needs to be added 234*5113495bSYour Name * @cmd_list: Pointer to command list containing the command 235*5113495bSYour Name * @ser_pdev_obj: pointer to private pdev serialization object 236*5113495bSYour Name * @is_cmd_for_active_queue: Add cmd to active or pending queue 237*5113495bSYour Name * @node_type: Pdev node or vdev node 238*5113495bSYour Name * 239*5113495bSYour Name * Return: Status of the serialization request 240*5113495bSYour Name */ 241*5113495bSYour Name enum wlan_serialization_status 242*5113495bSYour Name wlan_serialization_add_cmd_to_queue( 243*5113495bSYour Name qdf_list_t *queue, 244*5113495bSYour Name struct wlan_serialization_command_list *cmd_list, 245*5113495bSYour Name struct wlan_ser_pdev_obj *ser_pdev_obj, 246*5113495bSYour Name uint8_t is_cmd_for_active_queue, 247*5113495bSYour Name enum wlan_serialization_node node_type); 248*5113495bSYour Name 249*5113495bSYour Name /** 250*5113495bSYour Name * wlan_serialization_get_psoc_from_cmd() - get psoc from provided cmd 251*5113495bSYour Name * @cmd: pointer to actual command 252*5113495bSYour Name * 253*5113495bSYour Name * This API will get the pointer to psoc through checking type of cmd 254*5113495bSYour Name * 255*5113495bSYour Name * Return: pointer to psoc 256*5113495bSYour Name */ 257*5113495bSYour Name struct wlan_objmgr_psoc* 258*5113495bSYour Name wlan_serialization_get_psoc_from_cmd(struct wlan_serialization_command *cmd); 259*5113495bSYour Name 260*5113495bSYour Name /** 261*5113495bSYour Name * wlan_serialization_get_pdev_from_cmd() - get pdev from provided cmd 262*5113495bSYour Name * @cmd: pointer to actual command 263*5113495bSYour Name * 264*5113495bSYour Name * This API will get the pointer to pdev through checking type of cmd 265*5113495bSYour Name * 266*5113495bSYour Name * Return: pointer to pdev 267*5113495bSYour Name */ 268*5113495bSYour Name struct wlan_objmgr_pdev* 269*5113495bSYour Name wlan_serialization_get_pdev_from_cmd(struct wlan_serialization_command *cmd); 270*5113495bSYour Name 271*5113495bSYour Name /** 272*5113495bSYour Name * wlan_serialization_get_vdev_from_cmd() - get vdev from provided cmd 273*5113495bSYour Name * @cmd: pointer to actual command 274*5113495bSYour Name * 275*5113495bSYour Name * This API will get the pointer to vdev through checking type of cmd 276*5113495bSYour Name * 277*5113495bSYour Name * Return: pointer to vdev 278*5113495bSYour Name */ 279*5113495bSYour Name struct wlan_objmgr_vdev* 280*5113495bSYour Name wlan_serialization_get_vdev_from_cmd(struct wlan_serialization_command *cmd); 281*5113495bSYour Name 282*5113495bSYour Name /** 283*5113495bSYour Name * wlan_serialization_get_cmd_from_queue() - to extract command from given queue 284*5113495bSYour Name * @queue: pointer to queue 285*5113495bSYour Name * @nnode: next node to extract 286*5113495bSYour Name * 287*5113495bSYour Name * This API will try to extract node from queue which is next to prev node. If 288*5113495bSYour Name * no previous node is given then take out the front node of the queue. 289*5113495bSYour Name * 290*5113495bSYour Name * Return: QDF_STATUS 291*5113495bSYour Name */ 292*5113495bSYour Name QDF_STATUS wlan_serialization_get_cmd_from_queue( 293*5113495bSYour Name qdf_list_t *queue, qdf_list_node_t **nnode); 294*5113495bSYour Name 295*5113495bSYour Name /** 296*5113495bSYour Name * wlan_serialization_stop_timer() - to stop particular timer 297*5113495bSYour Name * @ser_timer: pointer to serialization timer 298*5113495bSYour Name * 299*5113495bSYour Name * This API stops the particular timer 300*5113495bSYour Name * 301*5113495bSYour Name * Return: QDF_STATUS 302*5113495bSYour Name */ 303*5113495bSYour Name QDF_STATUS 304*5113495bSYour Name wlan_serialization_stop_timer(struct wlan_serialization_timer *ser_timer); 305*5113495bSYour Name 306*5113495bSYour Name /** 307*5113495bSYour Name * wlan_serialization_cleanup_vdev_timers() - clean-up all timers for a vdev 308*5113495bSYour Name * 309*5113495bSYour Name * @vdev: pointer to vdev object 310*5113495bSYour Name * 311*5113495bSYour Name * This API is to cleanup all the timers for a vdev. 312*5113495bSYour Name * It can be used when serialization vdev destroy is called. 313*5113495bSYour Name * It will make sure that if timer is running then it will 314*5113495bSYour Name * stop and destroys the timer 315*5113495bSYour Name * 316*5113495bSYour Name * Return: QDF_STATUS 317*5113495bSYour Name */ 318*5113495bSYour Name 319*5113495bSYour Name QDF_STATUS wlan_serialization_cleanup_vdev_timers( 320*5113495bSYour Name struct wlan_objmgr_vdev *vdev); 321*5113495bSYour Name 322*5113495bSYour Name /** 323*5113495bSYour Name * wlan_serialization_cleanup_all_timers() - to clean-up all timers 324*5113495bSYour Name * 325*5113495bSYour Name * @psoc_ser_ob: pointer to serialization psoc private object 326*5113495bSYour Name * 327*5113495bSYour Name * This API is to cleanup all the timers. it can be used when serialization 328*5113495bSYour Name * module is exiting. it will make sure that if timer is running then it will 329*5113495bSYour Name * stop and destroys the timer 330*5113495bSYour Name * 331*5113495bSYour Name * Return: QDF_STATUS 332*5113495bSYour Name */ 333*5113495bSYour Name QDF_STATUS wlan_serialization_cleanup_all_timers( 334*5113495bSYour Name struct wlan_ser_psoc_obj *psoc_ser_ob); 335*5113495bSYour Name 336*5113495bSYour Name /** 337*5113495bSYour Name * wlan_serialization_validate_cmd() - Validate the command 338*5113495bSYour Name * @comp_id: Component ID 339*5113495bSYour Name * @cmd_type: Command Type 340*5113495bSYour Name * 341*5113495bSYour Name * Return: QDF_STATUS 342*5113495bSYour Name */ 343*5113495bSYour Name QDF_STATUS wlan_serialization_validate_cmd( 344*5113495bSYour Name enum wlan_umac_comp_id comp_id, 345*5113495bSYour Name enum wlan_serialization_cmd_type cmd_type); 346*5113495bSYour Name 347*5113495bSYour Name /** 348*5113495bSYour Name * wlan_serialization_validate_cmd_list() - Validate the command list 349*5113495bSYour Name * @cmd_list: Serialization command list 350*5113495bSYour Name * 351*5113495bSYour Name * Return: QDF_STATUS 352*5113495bSYour Name */ 353*5113495bSYour Name QDF_STATUS wlan_serialization_validate_cmd_list( 354*5113495bSYour Name struct wlan_serialization_command_list *cmd_list); 355*5113495bSYour Name 356*5113495bSYour Name /** 357*5113495bSYour Name * wlan_serialization_validate_cmdtype() - Validate the command type 358*5113495bSYour Name * @cmd_type: Command Type 359*5113495bSYour Name * 360*5113495bSYour Name * Return: QDF_STATUS 361*5113495bSYour Name */ 362*5113495bSYour Name QDF_STATUS wlan_serialization_validate_cmdtype( 363*5113495bSYour Name enum wlan_serialization_cmd_type cmd_type); 364*5113495bSYour Name 365*5113495bSYour Name /** 366*5113495bSYour Name * wlan_serialization_destroy_pdev_list() - Release the pdev cmds and 367*5113495bSYour Name * destroy list 368*5113495bSYour Name * @pdev_queue: Pointer to the pdev queue 369*5113495bSYour Name * 370*5113495bSYour Name * Return: None 371*5113495bSYour Name */ 372*5113495bSYour Name void wlan_serialization_destroy_pdev_list( 373*5113495bSYour Name struct wlan_serialization_pdev_queue *pdev_queue); 374*5113495bSYour Name 375*5113495bSYour Name /** 376*5113495bSYour Name * wlan_serialization_destroy_vdev_list() - Release the vdev cmds and 377*5113495bSYour Name * destroy list 378*5113495bSYour Name * @list: List to be destroyed 379*5113495bSYour Name * 380*5113495bSYour Name * Return: None 381*5113495bSYour Name */ 382*5113495bSYour Name void wlan_serialization_destroy_vdev_list(qdf_list_t *list); 383*5113495bSYour Name 384*5113495bSYour Name /** 385*5113495bSYour Name * wlan_serialization_get_psoc_obj() - Return the component private obj 386*5113495bSYour Name * @psoc: Pointer to the PSOC object 387*5113495bSYour Name * 388*5113495bSYour Name * Return: Serialization component's PSOC level private data object 389*5113495bSYour Name */ 390*5113495bSYour Name struct wlan_ser_psoc_obj *wlan_serialization_get_psoc_obj( 391*5113495bSYour Name struct wlan_objmgr_psoc *psoc); 392*5113495bSYour Name 393*5113495bSYour Name /** 394*5113495bSYour Name * wlan_serialization_get_pdev_obj() - Return the component private obj 395*5113495bSYour Name * @pdev: Pointer to the PDEV object 396*5113495bSYour Name * 397*5113495bSYour Name * Return: Serialization component's PDEV level private data object 398*5113495bSYour Name */ 399*5113495bSYour Name struct wlan_ser_pdev_obj *wlan_serialization_get_pdev_obj( 400*5113495bSYour Name struct wlan_objmgr_pdev *pdev); 401*5113495bSYour Name 402*5113495bSYour Name /** 403*5113495bSYour Name * wlan_serialization_get_vdev_obj() - Return the component private obj 404*5113495bSYour Name * @vdev: Pointer to the VDEV object 405*5113495bSYour Name * 406*5113495bSYour Name * Return: Serialization component's VDEV level private data object 407*5113495bSYour Name */ 408*5113495bSYour Name struct wlan_ser_vdev_obj *wlan_serialization_get_vdev_obj( 409*5113495bSYour Name struct wlan_objmgr_vdev *vdev); 410*5113495bSYour Name 411*5113495bSYour Name /** 412*5113495bSYour Name * wlan_serialization_is_cmd_in_vdev_list() - Check Node present in VDEV list 413*5113495bSYour Name * @vdev: Pointer to the VDEV object 414*5113495bSYour Name * @queue: Pointer to the qdf_list_t 415*5113495bSYour Name * @node_type: Pdev node or vdev node 416*5113495bSYour Name * 417*5113495bSYour Name * Return: Boolean true or false 418*5113495bSYour Name */ 419*5113495bSYour Name bool 420*5113495bSYour Name wlan_serialization_is_cmd_in_vdev_list( 421*5113495bSYour Name struct wlan_objmgr_vdev *vdev, qdf_list_t *queue, 422*5113495bSYour Name enum wlan_serialization_node node_type); 423*5113495bSYour Name 424*5113495bSYour Name /** 425*5113495bSYour Name * wlan_serialization_is_cmd_in_pdev_list() - Check Node present in PDEV list 426*5113495bSYour Name * @pdev: Pointer to the PDEV object 427*5113495bSYour Name * @queue: Pointer to the qdf_list_t 428*5113495bSYour Name * 429*5113495bSYour Name * Return: Boolean true or false 430*5113495bSYour Name */ 431*5113495bSYour Name bool 432*5113495bSYour Name wlan_serialization_is_cmd_in_pdev_list( 433*5113495bSYour Name struct wlan_objmgr_pdev *pdev, qdf_list_t *queue); 434*5113495bSYour Name 435*5113495bSYour Name /** 436*5113495bSYour Name * wlan_serialization_is_cmd_in_active_pending() - return cmd status 437*5113495bSYour Name * active/pending queue 438*5113495bSYour Name * @cmd_in_active: CMD in active list 439*5113495bSYour Name * @cmd_in_pending: CMD in pending list 440*5113495bSYour Name * 441*5113495bSYour Name * Return: enum wlan_serialization_cmd_status 442*5113495bSYour Name */ 443*5113495bSYour Name enum wlan_serialization_cmd_status 444*5113495bSYour Name wlan_serialization_is_cmd_in_active_pending( 445*5113495bSYour Name bool cmd_in_active, bool cmd_in_pending); 446*5113495bSYour Name 447*5113495bSYour Name /** 448*5113495bSYour Name * wlan_serialization_is_cmd_present_in_given_queue() - Check if the cmd is 449*5113495bSYour Name * present in the given queue 450*5113495bSYour Name * @queue: List of commands which has to be searched 451*5113495bSYour Name * @cmd: Serialization command information 452*5113495bSYour Name * @node_type: Pdev node or vdev node 453*5113495bSYour Name * 454*5113495bSYour Name * Return: Boolean true or false 455*5113495bSYour Name */ 456*5113495bSYour Name bool wlan_serialization_is_cmd_present_in_given_queue( 457*5113495bSYour Name qdf_list_t *queue, 458*5113495bSYour Name struct wlan_serialization_command *cmd, 459*5113495bSYour Name enum wlan_serialization_node node_type); 460*5113495bSYour Name 461*5113495bSYour Name /** 462*5113495bSYour Name * wlan_serialization_timer_destroy() - destroys the timer 463*5113495bSYour Name * @ser_timer: pointer to particular timer 464*5113495bSYour Name * 465*5113495bSYour Name * This API destroys the memory allocated by timer and assigns cmd member of 466*5113495bSYour Name * that timer structure to NULL 467*5113495bSYour Name * 468*5113495bSYour Name * Return: QDF_STATUS 469*5113495bSYour Name */ 470*5113495bSYour Name QDF_STATUS wlan_serialization_timer_destroy( 471*5113495bSYour Name struct wlan_serialization_timer *ser_timer); 472*5113495bSYour Name 473*5113495bSYour Name /** 474*5113495bSYour Name * wlan_serialization_list_empty() - check if the list is empty 475*5113495bSYour Name * @queue: Queue/List that needs to be checked for emptiness 476*5113495bSYour Name * 477*5113495bSYour Name * Return: true if list is empty and false otherwise 478*5113495bSYour Name */ 479*5113495bSYour Name bool wlan_serialization_list_empty(qdf_list_t *queue); 480*5113495bSYour Name 481*5113495bSYour Name /** 482*5113495bSYour Name * wlan_serialization_list_size() - Find the size of the provided queue 483*5113495bSYour Name * @queue: Queue/List for which the size/length is to be returned 484*5113495bSYour Name * 485*5113495bSYour Name * Return: size/length of the queue/list 486*5113495bSYour Name */ 487*5113495bSYour Name uint32_t wlan_serialization_list_size(qdf_list_t *queue); 488*5113495bSYour Name 489*5113495bSYour Name /** 490*5113495bSYour Name * wlan_serialization_match_cmd_type() - Check for a match on given nnode 491*5113495bSYour Name * @nnode: The node on which the matching has to be done 492*5113495bSYour Name * @cmd_type: Command type that needs to be matched 493*5113495bSYour Name * @node_type: Pdev node or vdev node 494*5113495bSYour Name * 495*5113495bSYour Name * This API will check if the cmd ID and cmd type of the given nnode are 496*5113495bSYour Name * matching with the one's that are being passed to this function. 497*5113495bSYour Name * 498*5113495bSYour Name * Return: True if matched,false otherwise. 499*5113495bSYour Name */ 500*5113495bSYour Name bool wlan_serialization_match_cmd_type( 501*5113495bSYour Name qdf_list_node_t *nnode, 502*5113495bSYour Name enum wlan_serialization_cmd_type cmd_type, 503*5113495bSYour Name enum wlan_serialization_node node_type); 504*5113495bSYour Name 505*5113495bSYour Name /** 506*5113495bSYour Name * wlan_serialization_match_cmd_id_type() - Check for a match on given nnode 507*5113495bSYour Name * @nnode: The node on which the matching has to be done 508*5113495bSYour Name * @cmd: Command that needs to be matched 509*5113495bSYour Name * @node_type: Pdev node or vdev node 510*5113495bSYour Name * 511*5113495bSYour Name * This API will check if the cmd ID and cmd type of the given nnode are 512*5113495bSYour Name * matching with the one's that are being passed to this function. 513*5113495bSYour Name * 514*5113495bSYour Name * Return: True if matched,false otherwise. 515*5113495bSYour Name */ 516*5113495bSYour Name bool wlan_serialization_match_cmd_id_type( 517*5113495bSYour Name qdf_list_node_t *nnode, 518*5113495bSYour Name struct wlan_serialization_command *cmd, 519*5113495bSYour Name enum wlan_serialization_node node_type); 520*5113495bSYour Name 521*5113495bSYour Name /** 522*5113495bSYour Name * wlan_serialization_match_cmd_vdev() - Check for a match on given nnode 523*5113495bSYour Name * @nnode: The node on which the matching has to be done 524*5113495bSYour Name * @vdev: VDEV object that needs to be matched 525*5113495bSYour Name * @node_type: Pdev node or vdev node 526*5113495bSYour Name * 527*5113495bSYour Name * This API will check if the VDEV object of the given nnode are 528*5113495bSYour Name * matching with the one's that are being passed to this function. 529*5113495bSYour Name * 530*5113495bSYour Name * Return: True if matched,false otherwise. 531*5113495bSYour Name */ 532*5113495bSYour Name bool wlan_serialization_match_cmd_vdev(qdf_list_node_t *nnode, 533*5113495bSYour Name struct wlan_objmgr_vdev *vdev, 534*5113495bSYour Name enum wlan_serialization_node node_type); 535*5113495bSYour Name 536*5113495bSYour Name /** 537*5113495bSYour Name * wlan_serialization_match_cmd_pdev() - Check for a match on given nnode 538*5113495bSYour Name * @nnode: The node on which the matching has to be done 539*5113495bSYour Name * @pdev: pdev object that needs to be matched 540*5113495bSYour Name * @node_type: Node type. Pdev node or vdev node 541*5113495bSYour Name * 542*5113495bSYour Name * This API will check if the PDEV object of the given nnode are 543*5113495bSYour Name * matching with the one's that are being passed to this function. 544*5113495bSYour Name * 545*5113495bSYour Name * Return: True if matched,false otherwise. 546*5113495bSYour Name */ 547*5113495bSYour Name bool wlan_serialization_match_cmd_pdev(qdf_list_node_t *nnode, 548*5113495bSYour Name struct wlan_objmgr_pdev *pdev, 549*5113495bSYour Name enum wlan_serialization_node node_type); 550*5113495bSYour Name 551*5113495bSYour Name /** 552*5113495bSYour Name * wlan_serialization_match_cmd_blocking() - Check for a blocking cmd 553*5113495bSYour Name * @nnode: The node on which the matching has to be done 554*5113495bSYour Name * @node_type: Pdev node or vdev node 555*5113495bSYour Name * 556*5113495bSYour Name * This API will check if the give command of nnode is a blocking command. 557*5113495bSYour Name * 558*5113495bSYour Name * Return: True if blocking command, false otherwise. 559*5113495bSYour Name */ 560*5113495bSYour Name bool wlan_serialization_match_cmd_blocking( 561*5113495bSYour Name qdf_list_node_t *nnode, 562*5113495bSYour Name enum wlan_serialization_node node_type); 563*5113495bSYour Name 564*5113495bSYour Name /** 565*5113495bSYour Name * wlan_serialization_find_cmd() - Find the cmd matching the given criteria 566*5113495bSYour Name * @queue: Queue to search 567*5113495bSYour Name * @match_type: Match criteria 568*5113495bSYour Name * @cmd: Serialization command information 569*5113495bSYour Name * @cmd_type: Command type to be matched 570*5113495bSYour Name * @pdev: pdev object that needs to be matched 571*5113495bSYour Name * @vdev: vdev object that needs to be matched 572*5113495bSYour Name * @node_type: Node type. Pdev node or vdev node 573*5113495bSYour Name * 574*5113495bSYour Name * Return: Pointer to the node member in the list 575*5113495bSYour Name */ 576*5113495bSYour Name qdf_list_node_t * 577*5113495bSYour Name wlan_serialization_find_cmd(qdf_list_t *queue, uint32_t match_type, 578*5113495bSYour Name struct wlan_serialization_command *cmd, 579*5113495bSYour Name enum wlan_serialization_cmd_type cmd_type, 580*5113495bSYour Name struct wlan_objmgr_pdev *pdev, 581*5113495bSYour Name struct wlan_objmgr_vdev *vdev, 582*5113495bSYour Name enum wlan_serialization_node node_type); 583*5113495bSYour Name 584*5113495bSYour Name /** 585*5113495bSYour Name * wlan_serialization_remove_front() - Remove the front node of the list 586*5113495bSYour Name * @list: List from which the node is to be removed 587*5113495bSYour Name * @node: Pointer to store the node that is removed 588*5113495bSYour Name * 589*5113495bSYour Name * Return: QDF_STATUS Success or Failure 590*5113495bSYour Name */ 591*5113495bSYour Name QDF_STATUS wlan_serialization_remove_front( 592*5113495bSYour Name qdf_list_t *list, 593*5113495bSYour Name qdf_list_node_t **node); 594*5113495bSYour Name 595*5113495bSYour Name /** 596*5113495bSYour Name * wlan_serialization_remove_node() - Remove the given node from the list 597*5113495bSYour Name * @list: List from which the node is to be removed 598*5113495bSYour Name * @node: Pointer to the node that is to be removed 599*5113495bSYour Name * 600*5113495bSYour Name * Return: QDF_STATUS Success or Failure 601*5113495bSYour Name */ 602*5113495bSYour Name QDF_STATUS wlan_serialization_remove_node( 603*5113495bSYour Name qdf_list_t *list, 604*5113495bSYour Name qdf_list_node_t *node); 605*5113495bSYour Name 606*5113495bSYour Name /** 607*5113495bSYour Name * wlan_serialization_insert_front() - Insert a node into the front of the list 608*5113495bSYour Name * @list: List to which the node is to be inserted 609*5113495bSYour Name * @node: Pointer to the node that is to be inserted 610*5113495bSYour Name * 611*5113495bSYour Name * Return: QDF_STATUS Success or Failure 612*5113495bSYour Name */ 613*5113495bSYour Name QDF_STATUS wlan_serialization_insert_front( 614*5113495bSYour Name qdf_list_t *list, 615*5113495bSYour Name qdf_list_node_t *node); 616*5113495bSYour Name 617*5113495bSYour Name /** 618*5113495bSYour Name * wlan_serialization_insert_back() - Insert a node into the back of the list 619*5113495bSYour Name * @list: List to which the node is to be inserted 620*5113495bSYour Name * @node: Pointer to the node that is to be inserted 621*5113495bSYour Name * 622*5113495bSYour Name * Return: QDF_STATUS Success or Failure 623*5113495bSYour Name */ 624*5113495bSYour Name QDF_STATUS wlan_serialization_insert_back( 625*5113495bSYour Name qdf_list_t *list, 626*5113495bSYour Name qdf_list_node_t *node); 627*5113495bSYour Name 628*5113495bSYour Name /** 629*5113495bSYour Name * wlan_serialization_peek_front() - Peek the front node of the list 630*5113495bSYour Name * @list: List on which the node is to be peeked 631*5113495bSYour Name * @node: Pointer to the store the node that is being peeked 632*5113495bSYour Name * 633*5113495bSYour Name * Return: QDF_STATUS Success or Failure 634*5113495bSYour Name */ 635*5113495bSYour Name QDF_STATUS wlan_serialization_peek_front( 636*5113495bSYour Name qdf_list_t *list, 637*5113495bSYour Name qdf_list_node_t **node); 638*5113495bSYour Name 639*5113495bSYour Name /** 640*5113495bSYour Name * wlan_serialization_peek_next() - Peek the next node of the list 641*5113495bSYour Name * @list: List on which the node is to be peeked 642*5113495bSYour Name * @node1: Pointer to the node1 from where the next node has to be peeked 643*5113495bSYour Name * @node2: Pointer to the store the node that is being peeked 644*5113495bSYour Name * 645*5113495bSYour Name * Return: QDF_STATUS Success or Failure 646*5113495bSYour Name */ 647*5113495bSYour Name QDF_STATUS wlan_serialization_peek_next( 648*5113495bSYour Name qdf_list_t *list, 649*5113495bSYour Name qdf_list_node_t *node1, 650*5113495bSYour Name qdf_list_node_t **node2); 651*5113495bSYour Name 652*5113495bSYour Name /** 653*5113495bSYour Name * wlan_serialization_acquire_lock() - Acquire lock to the given queue 654*5113495bSYour Name * @lock: Pointer to the lock 655*5113495bSYour Name * 656*5113495bSYour Name * Return: QDF_STATUS success or failure 657*5113495bSYour Name */ 658*5113495bSYour Name QDF_STATUS 659*5113495bSYour Name wlan_serialization_acquire_lock(qdf_spinlock_t *lock); 660*5113495bSYour Name 661*5113495bSYour Name /** 662*5113495bSYour Name * wlan_serialization_release_lock() - Release lock to the given queue 663*5113495bSYour Name * @lock: Pointer to the lock 664*5113495bSYour Name * 665*5113495bSYour Name * Return: QDF_STATUS success or failure 666*5113495bSYour Name */ 667*5113495bSYour Name QDF_STATUS 668*5113495bSYour Name wlan_serialization_release_lock(qdf_spinlock_t *lock); 669*5113495bSYour Name 670*5113495bSYour Name /** 671*5113495bSYour Name * wlan_serialization_create_lock() - Init the lock to the given queue 672*5113495bSYour Name * @lock: Pointer to the lock 673*5113495bSYour Name * 674*5113495bSYour Name * Return: QDF_STATUS success or failure 675*5113495bSYour Name */ 676*5113495bSYour Name QDF_STATUS 677*5113495bSYour Name wlan_serialization_create_lock(qdf_spinlock_t *lock); 678*5113495bSYour Name 679*5113495bSYour Name /** 680*5113495bSYour Name * wlan_serialization_destroy_lock() - Deinit the lock to the given queue 681*5113495bSYour Name * @lock: Pointer to the lock 682*5113495bSYour Name * 683*5113495bSYour Name * Return: QDF_STATUS success or failure 684*5113495bSYour Name */ 685*5113495bSYour Name QDF_STATUS 686*5113495bSYour Name wlan_serialization_destroy_lock(qdf_spinlock_t *lock); 687*5113495bSYour Name 688*5113495bSYour Name /** 689*5113495bSYour Name * wlan_serialization_any_vdev_cmd_active() - Check any vdev cmd active for pdev 690*5113495bSYour Name * @pdev_queue: serialization pdev queue object 691*5113495bSYour Name * 692*5113495bSYour Name * Return: true or false 693*5113495bSYour Name */ 694*5113495bSYour Name bool wlan_serialization_any_vdev_cmd_active( 695*5113495bSYour Name struct wlan_serialization_pdev_queue *pdev_queue); 696*5113495bSYour Name 697*5113495bSYour Name /** 698*5113495bSYour Name * wlan_ser_update_cmd_history() - Update serialization queue history 699*5113495bSYour Name * @pdev_queue:serialization pdev queue 700*5113495bSYour Name * @cmd: cmd to be added/remeoved 701*5113495bSYour Name * @ser_reason: serialization action that resulted in addition/removal 702*5113495bSYour Name * @add_remove: added or removed from queue 703*5113495bSYour Name * @active_queue:for active queue 704*5113495bSYour Name * 705*5113495bSYour Name * Return: QDF_STATUS success or failure 706*5113495bSYour Name */ 707*5113495bSYour Name 708*5113495bSYour Name void wlan_ser_update_cmd_history( 709*5113495bSYour Name struct wlan_serialization_pdev_queue *pdev_queue, 710*5113495bSYour Name struct wlan_serialization_command *cmd, 711*5113495bSYour Name enum ser_queue_reason ser_reason, 712*5113495bSYour Name bool add_remove, 713*5113495bSYour Name bool active_queue); 714*5113495bSYour Name 715*5113495bSYour Name #endif 716