From: Pallavi Kadam Date: Mon, 30 Sep 2019 17:09:34 +0000 (-0700) Subject: eal: move CPU operations to OS specific headers X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7e708cd8c687aa99098833e50c6b23023b987a31;p=dpdk.git eal: move CPU operations to OS specific headers Moving RTE_CPU* definitions from the common code to the Linux and FreeBSD rte_os.h file to avoid #ifdef clutter. Signed-off-by: Pallavi Kadam Signed-off-by: Antara Ganesh Kolar Reviewed-by: Ranjit Menon Reviewed-by: Jerin Jacob Signed-off-by: David Marchand --- diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index c86f72eb12..63ad4af139 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -22,50 +22,6 @@ extern "C" { #define LCORE_ID_ANY UINT32_MAX /**< Any lcore. */ -#if defined(__linux__) -typedef cpu_set_t rte_cpuset_t; -#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) -#elif defined(__FreeBSD__) -#include -typedef cpuset_t rte_cpuset_t; -#define RTE_CPU_AND(dst, src1, src2) do \ -{ \ - cpuset_t tmp; \ - CPU_COPY(src1, &tmp); \ - CPU_AND(&tmp, src2); \ - CPU_COPY(&tmp, dst); \ -} while (0) -#define RTE_CPU_OR(dst, src1, src2) do \ -{ \ - cpuset_t tmp; \ - CPU_COPY(src1, &tmp); \ - CPU_OR(&tmp, src2); \ - CPU_COPY(&tmp, dst); \ -} while (0) -#define RTE_CPU_FILL(set) CPU_FILL(set) -#define RTE_CPU_NOT(dst, src) do \ -{ \ - cpuset_t tmp; \ - CPU_FILL(&tmp); \ - CPU_NAND(&tmp, src); \ - CPU_COPY(&tmp, dst); \ -} while (0) -#endif - /** * Structure storing internal configuration (per-lcore) */ diff --git a/lib/librte_eal/freebsd/eal/include/rte_os.h b/lib/librte_eal/freebsd/eal/include/rte_os.h index 49cd4d4d98..a5efe618f5 100644 --- a/lib/librte_eal/freebsd/eal/include/rte_os.h +++ b/lib/librte_eal/freebsd/eal/include/rte_os.h @@ -11,4 +11,30 @@ * freebsd OS. Functions will be added in future releases. */ +#include + +typedef cpuset_t rte_cpuset_t; +#define RTE_CPU_AND(dst, src1, src2) do \ +{ \ + cpuset_t tmp; \ + CPU_COPY(src1, &tmp); \ + CPU_AND(&tmp, src2); \ + CPU_COPY(&tmp, dst); \ +} while (0) +#define RTE_CPU_OR(dst, src1, src2) do \ +{ \ + cpuset_t tmp; \ + CPU_COPY(src1, &tmp); \ + CPU_OR(&tmp, src2); \ + CPU_COPY(&tmp, dst); \ +} while (0) +#define RTE_CPU_FILL(set) CPU_FILL(set) +#define RTE_CPU_NOT(dst, src) do \ +{ \ + cpuset_t tmp; \ + CPU_FILL(&tmp); \ + CPU_NAND(&tmp, src); \ + CPU_COPY(&tmp, dst); \ +} while (0) + #endif /* _RTE_OS_H_ */ diff --git a/lib/librte_eal/linux/eal/include/rte_os.h b/lib/librte_eal/linux/eal/include/rte_os.h index bc6ad14d25..218d4fa86e 100644 --- a/lib/librte_eal/linux/eal/include/rte_os.h +++ b/lib/librte_eal/linux/eal/include/rte_os.h @@ -11,4 +11,23 @@ * linux OS. Functions will be added in future releases. */ +#include + +typedef cpu_set_t rte_cpuset_t; +#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) + #endif /* _RTE_OS_H_ */