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 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /** 13 * This header should contain any definition 14 * which is not supported natively or named differently in Linux. 15 */ 16 17 #include <sched.h> 18 #include <sys/queue.h> 19 20 /* These macros are compatible with system's sys/queue.h. */ 21 #define RTE_TAILQ_HEAD(name, type) TAILQ_HEAD(name, type) 22 #define RTE_TAILQ_ENTRY(type) TAILQ_ENTRY(type) 23 #define RTE_TAILQ_FOREACH(var, head, field) TAILQ_FOREACH(var, head, field) 24 #define RTE_TAILQ_FIRST(head) TAILQ_FIRST(head) 25 #define RTE_TAILQ_NEXT(elem, field) TAILQ_NEXT(elem, field) 26 #define RTE_STAILQ_HEAD(name, type) STAILQ_HEAD(name, type) 27 #define RTE_STAILQ_ENTRY(type) STAILQ_ENTRY(type) 28 29 #ifdef CPU_SETSIZE /* may require _GNU_SOURCE */ 30 typedef cpu_set_t rte_cpuset_t; 31 #define RTE_HAS_CPUSET 32 #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2) 33 #define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2) 34 #define RTE_CPU_FILL(set) do \ 35 { \ 36 unsigned int i; \ 37 CPU_ZERO(set); \ 38 for (i = 0; i < CPU_SETSIZE; i++) \ 39 CPU_SET(i, set); \ 40 } while (0) 41 #define RTE_CPU_NOT(dst, src) do \ 42 { \ 43 cpu_set_t tmp; \ 44 RTE_CPU_FILL(&tmp); \ 45 CPU_XOR(dst, &tmp, src); \ 46 } while (0) 47 #endif 48 49 #ifdef __cplusplus 50 } 51 #endif 52 53 #endif /* _RTE_OS_H_ */ 54