199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2010-2019 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _RTE_OS_H_ 699a2dd95SBruce Richardson #define _RTE_OS_H_ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson /** 999a2dd95SBruce Richardson * This header should contain any definition 1099a2dd95SBruce Richardson * which is not supported natively or named differently in Linux. 1199a2dd95SBruce Richardson */ 1299a2dd95SBruce Richardson 1399a2dd95SBruce Richardson #include <sched.h> 14*f1f6ebc0SWilliam Tu #include <sys/queue.h> 15*f1f6ebc0SWilliam Tu 16*f1f6ebc0SWilliam Tu /* These macros are compatible with system's sys/queue.h. */ 17*f1f6ebc0SWilliam Tu #define RTE_TAILQ_HEAD(name, type) TAILQ_HEAD(name, type) 18*f1f6ebc0SWilliam Tu #define RTE_TAILQ_ENTRY(type) TAILQ_ENTRY(type) 19*f1f6ebc0SWilliam Tu #define RTE_TAILQ_FOREACH(var, head, field) TAILQ_FOREACH(var, head, field) 20*f1f6ebc0SWilliam Tu #define RTE_TAILQ_FIRST(head) TAILQ_FIRST(head) 21*f1f6ebc0SWilliam Tu #define RTE_TAILQ_NEXT(elem, field) TAILQ_NEXT(elem, field) 22*f1f6ebc0SWilliam Tu #define RTE_STAILQ_HEAD(name, type) STAILQ_HEAD(name, type) 23*f1f6ebc0SWilliam Tu #define RTE_STAILQ_ENTRY(type) STAILQ_ENTRY(type) 2499a2dd95SBruce Richardson 2599a2dd95SBruce Richardson #ifdef CPU_SETSIZE /* may require _GNU_SOURCE */ 2699a2dd95SBruce Richardson typedef cpu_set_t rte_cpuset_t; 2799a2dd95SBruce Richardson #define RTE_HAS_CPUSET 2899a2dd95SBruce Richardson #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2) 2999a2dd95SBruce Richardson #define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2) 3099a2dd95SBruce Richardson #define RTE_CPU_FILL(set) do \ 3199a2dd95SBruce Richardson { \ 3299a2dd95SBruce Richardson unsigned int i; \ 3399a2dd95SBruce Richardson CPU_ZERO(set); \ 3499a2dd95SBruce Richardson for (i = 0; i < CPU_SETSIZE; i++) \ 3599a2dd95SBruce Richardson CPU_SET(i, set); \ 3699a2dd95SBruce Richardson } while (0) 3799a2dd95SBruce Richardson #define RTE_CPU_NOT(dst, src) do \ 3899a2dd95SBruce Richardson { \ 3999a2dd95SBruce Richardson cpu_set_t tmp; \ 4099a2dd95SBruce Richardson RTE_CPU_FILL(&tmp); \ 4199a2dd95SBruce Richardson CPU_XOR(dst, &tmp, src); \ 4299a2dd95SBruce Richardson } while (0) 4399a2dd95SBruce Richardson #endif 4499a2dd95SBruce Richardson 4599a2dd95SBruce Richardson #endif /* _RTE_OS_H_ */ 46