Skip to content

Commit

Permalink
net/dpdk: fix build on -CURRENT
Browse files Browse the repository at this point in the history
The CPU_SET macros in -CURRENT have been made compatible with GLIBC.
A simple test for the new signature of CPU_AND, CPU_OR,	... is the
existence of a CPU_ALLOC macro.

Approved by:	portmgr	(implicit)
MFH:            2022Q1
  • Loading branch information
stesser committed Jan 3, 2022
1 parent 1b13427 commit c3e1958
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions net/dpdk/files/patch-lib_librte__eal_freebsd_eal_include_rte__os.h
@@ -1,6 +1,38 @@
--- lib/librte_eal/freebsd/eal/include/rte_os.h.orig 2020-01-03 12:22:03 UTC
--- lib/librte_eal/freebsd/eal/include/rte_os.h.orig 2021-03-17 16:43:15 UTC
+++ lib/librte_eal/freebsd/eal/include/rte_os.h
@@ -29,6 +29,9 @@ typedef cpuset_t rte_cpuset_t;
@@ -14,8 +14,30 @@
#include <pthread_np.h>

typedef cpuset_t rte_cpuset_t;
-#define RTE_CPU_AND(dst, src1, src2) do \
+
+/* FreeBSD 14 uses GLIBC compatible CPU_AND, CPU_OR, ... */
+#ifdef CPU_ALLOC
+
+#define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
+#define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
+#define RTE_CPU_FILL(set) do \
{ \
+ unsigned int i; \
+ CPU_ZERO(set); \
+ for (i = 0; i < CPU_SETSIZE; i++) \
+ CPU_SET(i, set); \
+} while (0)
+#define RTE_CPU_NOT(dst, src) do \
+{ \
+ cpu_set_t tmp; \
+ RTE_CPU_FILL(&tmp); \
+ CPU_XOR(dst, &tmp, src); \
+} while (0)
+
+#else
+
+#define RTE_CPU_AND(dst, src1, src2) do \
+{ \
cpuset_t tmp; \
CPU_COPY(src1, &tmp); \
CPU_AND(&tmp, src2); \
@@ -29,6 +51,9 @@ typedef cpuset_t rte_cpuset_t;
CPU_COPY(&tmp, dst); \
} while (0)
#define RTE_CPU_FILL(set) CPU_FILL(set)
Expand All @@ -10,7 +42,7 @@
#define RTE_CPU_NOT(dst, src) do \
{ \
cpuset_t tmp; \
@@ -36,5 +39,14 @@ typedef cpuset_t rte_cpuset_t;
@@ -36,5 +61,16 @@ typedef cpuset_t rte_cpuset_t;
CPU_NAND(&tmp, src); \
CPU_COPY(&tmp, dst); \
} while (0)
Expand All @@ -22,6 +54,8 @@
+ CPU_ANDNOT(&tmp, src); \
+ CPU_COPY(&tmp, dst); \
+} while (0)
+#endif
+#endif /* CPU_NAND */
+
+#endif /* CPU_ALLOC */

#endif /* _RTE_OS_H_ */

0 comments on commit c3e1958

Please sign in to comment.