1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (c) 2020 Arm Limited 3 */ 4 5 #ifndef _RTE_RCU_QSBR_PVT_H_ 6 #define _RTE_RCU_QSBR_PVT_H_ 7 8 /** 9 * This file is private to the RCU library. It should not be included 10 * by the user of this library. 11 */ 12 13 #include <rte_ring.h> 14 #include <rte_ring_elem.h> 15 16 #include "rte_rcu_qsbr.h" 17 18 /* Defer queue structure. 19 * This structure holds the defer queue. The defer queue is used to 20 * hold the deleted entries from the data structure that are not 21 * yet freed. 22 */ 23 struct rte_rcu_qsbr_dq { 24 struct rte_rcu_qsbr *v; /**< RCU QSBR variable used by this queue.*/ 25 struct rte_ring *r; /**< RCU QSBR defer queue. */ 26 uint32_t size; 27 /**< Number of elements in the defer queue */ 28 uint32_t esize; 29 /**< Size (in bytes) of data, including the token, stored on the 30 * defer queue. 31 */ 32 uint32_t trigger_reclaim_limit; 33 /**< Trigger automatic reclamation after the defer queue 34 * has at least these many resources waiting. 35 */ 36 uint32_t max_reclaim_size; 37 /**< Reclaim at the max these many resources during auto 38 * reclamation. 39 */ 40 rte_rcu_qsbr_free_resource_t free_fn; 41 /**< Function to call to free the resource. */ 42 void *p; 43 /**< Pointer passed to the free function. Typically, this is the 44 * pointer to the data structure to which the resource to free 45 * belongs. 46 */ 47 }; 48 49 /* Internal structure to represent the element on the defer queue. 50 * Use alias as a character array is type casted to a variable 51 * of this structure type. 52 */ 53 typedef struct { 54 uint64_t token; /**< Token */ 55 uint8_t elem[0]; /**< Pointer to user element */ 56 } __attribute__((__may_alias__)) __rte_rcu_qsbr_dq_elem_t; 57 58 #endif /* _RTE_RCU_QSBR_PVT_H_ */ 59