Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2019 Intel Corporation 3 : : */ 4 : : 5 : : #include "rte_stack.h" 6 : : 7 : : void 8 : 3 : rte_stack_lf_init(struct rte_stack *s, unsigned int count) 9 : : { 10 : 3 : struct rte_stack_lf_elem *elems = s->stack_lf.elems; 11 : : unsigned int i; 12 : : 13 [ + + ]: 8259 : for (i = 0; i < count; i++) 14 : 8256 : __rte_stack_lf_push_elems(&s->stack_lf.free, 15 : 8256 : &elems[i], &elems[i], 1); 16 : 3 : } 17 : : 18 : : ssize_t 19 : 5 : rte_stack_lf_get_memsize(unsigned int count) 20 : : { 21 : : ssize_t sz = sizeof(struct rte_stack); 22 : : 23 : 5 : sz += RTE_CACHE_LINE_ROUNDUP(count * sizeof(struct rte_stack_lf_elem)); 24 : : 25 : : /* Add padding to avoid false sharing conflicts caused by 26 : : * next-line hardware prefetchers. 27 : : */ 28 : 5 : sz += 2 * RTE_CACHE_LINE_SIZE; 29 : : 30 : 5 : return sz; 31 : : }