1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2014 Intel Corporation 3 */ 4 5 #ifndef _TB_MEM_H_ 6 #define _TB_MEM_H_ 7 8 /** 9 * @file 10 * 11 * RTE ACL temporary (build phase) memory management. 12 * Contains structures and functions to manage temporary (used by build only) 13 * memory. Memory allocated in large blocks to speed 'free' when trie is 14 * destructed (finish of build phase). 15 */ 16 17 #include <rte_acl_osdep.h> 18 #include <setjmp.h> 19 20 struct tb_mem_block { 21 struct tb_mem_block *next; 22 struct tb_mem_pool *pool; 23 size_t size; 24 uint8_t *mem; 25 }; 26 27 struct tb_mem_pool { 28 struct tb_mem_block *block; 29 size_t alignment; 30 size_t min_alloc; 31 size_t alloc; 32 /* jump target in case of memory allocation failure. */ 33 sigjmp_buf fail; 34 }; 35 36 void *tb_alloc(struct tb_mem_pool *pool, size_t size); 37 void tb_free_pool(struct tb_mem_pool *pool); 38 39 #endif /* _TB_MEM_H_ */ 40