1*99a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 2*99a2dd95SBruce Richardson * Copyright(c) 2019 Intel Corporation 3*99a2dd95SBruce Richardson */ 4*99a2dd95SBruce Richardson 5*99a2dd95SBruce Richardson #include "rte_stack.h" 6*99a2dd95SBruce Richardson 7*99a2dd95SBruce Richardson void rte_stack_std_init(struct rte_stack * s)8*99a2dd95SBruce Richardsonrte_stack_std_init(struct rte_stack *s) 9*99a2dd95SBruce Richardson { 10*99a2dd95SBruce Richardson rte_spinlock_init(&s->stack_std.lock); 11*99a2dd95SBruce Richardson } 12*99a2dd95SBruce Richardson 13*99a2dd95SBruce Richardson ssize_t rte_stack_std_get_memsize(unsigned int count)14*99a2dd95SBruce Richardsonrte_stack_std_get_memsize(unsigned int count) 15*99a2dd95SBruce Richardson { 16*99a2dd95SBruce Richardson ssize_t sz = sizeof(struct rte_stack); 17*99a2dd95SBruce Richardson 18*99a2dd95SBruce Richardson sz += RTE_CACHE_LINE_ROUNDUP(count * sizeof(void *)); 19*99a2dd95SBruce Richardson 20*99a2dd95SBruce Richardson /* Add padding to avoid false sharing conflicts caused by 21*99a2dd95SBruce Richardson * next-line hardware prefetchers. 22*99a2dd95SBruce Richardson */ 23*99a2dd95SBruce Richardson sz += 2 * RTE_CACHE_LINE_SIZE; 24*99a2dd95SBruce Richardson 25*99a2dd95SBruce Richardson return sz; 26*99a2dd95SBruce Richardson } 27