git: c3e195845242 - main - net/dpdk: fix build on -CURRENT

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Mon, 03 Jan 2022 10:27:16 UTC
The branch main has been updated by se:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c3e19584524281d37fe92868e5c3582fcd7d7d28

commit c3e19584524281d37fe92868e5c3582fcd7d7d28
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2022-01-03 10:26:15 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2022-01-03 10:26:15 +0000

    net/dpdk: fix build on -CURRENT
    
    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
---
 ...h-lib_librte__eal_freebsd_eal_include_rte__os.h | 42 +++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/net/dpdk/files/patch-lib_librte__eal_freebsd_eal_include_rte__os.h b/net/dpdk/files/patch-lib_librte__eal_freebsd_eal_include_rte__os.h
index ede8d170de6e..6e63d49836ac 100644
--- a/net/dpdk/files/patch-lib_librte__eal_freebsd_eal_include_rte__os.h
+++ b/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)
@@ -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)
@@ -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_ */