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 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 #include <rte_ring.h> 18 #include <rte_ring_elem.h> 19 20 #include "rte_rcu_qsbr.h" 21 22 /* Defer queue structure. 23 * This structure holds the defer queue. The defer queue is used to 24 * hold the deleted entries from the data structure that are not 25 * yet freed. 26 */ 27 struct rte_rcu_qsbr_dq { 28 struct rte_rcu_qsbr *v; /**< RCU QSBR variable used by this queue.*/ 29 struct rte_ring *r; /**< RCU QSBR defer queue. */ 30 uint32_t size; 31 /**< Number of elements in the defer queue */ 32 uint32_t esize; 33 /**< Size (in bytes) of data, including the token, stored on the 34 * defer queue. 35 */ 36 uint32_t trigger_reclaim_limit; 37 /**< Trigger automatic reclamation after the defer queue 38 * has at least these many resources waiting. 39 */ 40 uint32_t max_reclaim_size; 41 /**< Reclaim at the max these many resources during auto 42 * reclamation. 43 */ 44 rte_rcu_qsbr_free_resource_t free_fn; 45 /**< Function to call to free the resource. */ 46 void *p; 47 /**< Pointer passed to the free function. Typically, this is the 48 * pointer to the data structure to which the resource to free 49 * belongs. 50 */ 51 }; 52 53 /* Internal structure to represent the element on the defer queue. 54 * Use alias as a character array is type casted to a variable 55 * of this structure type. 56 */ 57 typedef struct { 58 uint64_t token; /**< Token */ 59 uint8_t elem[0]; /**< Pointer to user element */ 60 } __attribute__((__may_alias__)) __rte_rcu_qsbr_dq_elem_t; 61 62 #ifdef __cplusplus 63 } 64 #endif 65 66 #endif /* _RTE_RCU_QSBR_PVT_H_ */ 67