1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2019 Intel Corporation 3 */ 4 5 #ifndef _RTE_OS_H_ 6 #define _RTE_OS_H_ 7 8 /** 9 * This header should contain any definition 10 * which is not supported natively or named differently in Linux. 11 */ 12 13 #include <sched.h> 14 #include <sys/queue.h> 15 16 /* These macros are compatible with system's sys/queue.h. */ 17 #define RTE_TAILQ_HEAD(name, type) TAILQ_HEAD(name, type) 18 #define RTE_TAILQ_ENTRY(type) TAILQ_ENTRY(type) 19 #define RTE_TAILQ_FOREACH(var, head, field) TAILQ_FOREACH(var, head, field) 20 #define RTE_TAILQ_FIRST(head) TAILQ_FIRST(head) 21 #define RTE_TAILQ_NEXT(elem, field) TAILQ_NEXT(elem, field) 22 #define RTE_STAILQ_HEAD(name, type) STAILQ_HEAD(name, type) 23 #define RTE_STAILQ_ENTRY(type) STAILQ_ENTRY(type) 24 25 #ifdef CPU_SETSIZE /* may require _GNU_SOURCE */ 26 typedef cpu_set_t rte_cpuset_t; 27 #define RTE_HAS_CPUSET 28 #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2) 29 #define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2) 30 #define RTE_CPU_FILL(set) do \ 31 { \ 32 unsigned int i; \ 33 CPU_ZERO(set); \ 34 for (i = 0; i < CPU_SETSIZE; i++) \ 35 CPU_SET(i, set); \ 36 } while (0) 37 #define RTE_CPU_NOT(dst, src) do \ 38 { \ 39 cpu_set_t tmp; \ 40 RTE_CPU_FILL(&tmp); \ 41 CPU_XOR(dst, &tmp, src); \ 42 } while (0) 43 #endif 44 45 #endif /* _RTE_OS_H_ */ 46