]> git.droids-corp.org - dpdk.git/commitdiff
eal/freebsd: fix use of newer cpuset macros
authorDavid Marchand <david.marchand@redhat.com>
Fri, 20 May 2022 18:10:50 +0000 (19:10 +0100)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 24 May 2022 10:48:11 +0000 (12:48 +0200)
FreeBSD has updated its CPU macros to align more with the definitions
used on Linux[1]. Unfortunately, while this makes compatibility better
in future, it means we need to have both legacy and newer definition
support. Use a meson check to determine which set of macros are used.

[1] https://cgit.freebsd.org/src/commit/?id=e2650af157bc

Bugzilla ID: 1014
Fixes: c3568ea37670 ("eal: restrict control threads to startup CPU affinity")
Fixes: b6be16acfeb1 ("eal: fix control thread affinity with --lcores")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Daxue Gao <daxuex.gao@intel.com>
lib/eal/freebsd/include/rte_os.h
lib/eal/freebsd/meson.build

index b4afd45adc75803357d1d7fc82e15f7174e32320..003468caff9c7cdacf121968aa4896546a3b01d1 100644 (file)
@@ -28,6 +28,8 @@ extern "C" {
 
 typedef cpuset_t rte_cpuset_t;
 #define RTE_HAS_CPUSET
+
+#ifdef RTE_EAL_FREEBSD_CPUSET_LEGACY
 #define RTE_CPU_AND(dst, src1, src2) do \
 { \
        cpuset_t tmp; \
@@ -61,7 +63,20 @@ typedef cpuset_t rte_cpuset_t;
        CPU_ANDNOT(&tmp, src); \
        CPU_COPY(&tmp, dst); \
 } while (0)
-#endif
+#endif /* CPU_NAND */
+
+#else /* RTE_EAL_FREEBSD_CPUSET_LEGACY */
+
+#define RTE_CPU_AND CPU_AND
+#define RTE_CPU_OR CPU_OR
+#define RTE_CPU_FILL CPU_FILL
+#define RTE_CPU_NOT(dst, src) do { \
+       cpu_set_t tmp; \
+       CPU_FILL(&tmp); \
+       CPU_XOR(dst, src, &tmp); \
+} while (0)
+
+#endif /* RTE_EAL_FREEBSD_CPUSET_LEGACY */
 
 #ifdef __cplusplus
 }
index 398ceab71d0357acb560e8afeab29b62b1c220a5..fe9097303ac5888eb61c3cdba4504819363efe0a 100644 (file)
@@ -19,3 +19,14 @@ sources += files(
 )
 
 deps += ['kvargs', 'telemetry']
+
+# test for version of cpuset macros
+cpuset_test_code = '''
+        #include <sys/types.h>
+        #include <sys/cpuset.h>
+        void cpu_test_or(cpuset_t *s) { CPU_OR(s, s, s); }
+'''
+
+if not cc.compiles(cpuset_test_code, name: 'Detect argument count for CPU_OR')
+    dpdk_conf.set('RTE_EAL_FREEBSD_CPUSET_LEGACY', 1)
+endif