| 99 | struct rte_acl_node *node, int index); |
| 100 | |
| 101 | static void * |
| 102 | acl_build_alloc(struct acl_build_context *context, size_t n, size_t s) |
| 103 | { |
| 104 | uint32_t m; |
| 105 | void *p; |
| 106 | size_t alloc_size = n * s; |
| 107 | |
| 108 | /* |
| 109 | * look for memory in free lists |
| 110 | */ |
| 111 | for (m = 0; m < RTE_DIM(context->blocks); m++) { |
| 112 | if (context->blocks[m].block_size == |
| 113 | alloc_size && context->blocks[m].mem_ptr != NULL) { |
| 114 | p = context->blocks[m].mem_ptr; |
| 115 | context->blocks[m].mem_ptr = *((void **)p); |
| 116 | memset(p, 0, alloc_size); |
| 117 | return p; |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | /* |
| 122 | * return allocation from memory pool |
| 123 | */ |
| 124 | p = tb_alloc(&context->pool, alloc_size); |
| 125 | return p; |
| 126 | } |
| 127 | |
| 128 | /* |
| 129 | * Free memory blocks (kept in context for reuse). |
no test coverage detected