eeb750cd81b70387138a65905fe574cf2b8e0689
[dpdk.git] / lib / librte_eal / freebsd / eal / include / rte_os.h
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 is header should contain any function/macro definition
10  * which are not supported natively or named differently in the
11  * freebsd OS. Functions will be added in future releases.
12  */
13
14 #include <pthread_np.h>
15
16 typedef cpuset_t rte_cpuset_t;
17 #define RTE_CPU_AND(dst, src1, src2) do \
18 { \
19         cpuset_t tmp; \
20         CPU_COPY(src1, &tmp); \
21         CPU_AND(&tmp, src2); \
22         CPU_COPY(&tmp, dst); \
23 } while (0)
24 #define RTE_CPU_OR(dst, src1, src2) do \
25 { \
26         cpuset_t tmp; \
27         CPU_COPY(src1, &tmp); \
28         CPU_OR(&tmp, src2); \
29         CPU_COPY(&tmp, dst); \
30 } while (0)
31 #define RTE_CPU_FILL(set) CPU_FILL(set)
32
33 /* In FreeBSD 13 CPU_NAND macro is CPU_ANDNOT */
34 #ifdef CPU_NAND
35 #define RTE_CPU_NOT(dst, src) do \
36 { \
37         cpuset_t tmp; \
38         CPU_FILL(&tmp); \
39         CPU_NAND(&tmp, src); \
40         CPU_COPY(&tmp, dst); \
41 } while (0)
42 #else
43 #define RTE_CPU_NOT(dst, src) do \
44 { \
45         cpuset_t tmp; \
46         CPU_FILL(&tmp); \
47         CPU_ANDNOT(&tmp, src); \
48         CPU_COPY(&tmp, dst); \
49 } while (0)
50 #endif
51
52 #endif /* _RTE_OS_H_ */