[dpdk-dev] [PATCH] use config flags for target OS checks

Thomas Monjalon thomas.monjalon at 6wind.com
Mon Dec 5 18:50:43 CET 2016


Clean up the code to always use the flags RTE_EXEC_ENV_*APP
set up in the DPDK configuration instead of the native ones.

Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 app/test-pmd/cmdline.c                       | 4 ++--
 app/test/commands.c                          | 4 ++--
 app/test/test_cmdline_ipaddr.c               | 4 ++--
 drivers/net/bnx2x/bnx2x.c                    | 4 ++--
 drivers/net/bnx2x/bnx2x.h                    | 4 ++--
 examples/cmdline/commands.c                  | 4 ++--
 lib/librte_cmdline/cmdline_parse_etheraddr.c | 2 +-
 lib/librte_cmdline/cmdline_parse_ipaddr.c    | 4 ++--
 lib/librte_eal/common/include/rte_lcore.h    | 4 ++--
 9 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 63b55dc..7f3667d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -41,8 +41,8 @@
 #include <termios.h>
 #include <unistd.h>
 #include <inttypes.h>
-#ifndef __linux__
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_LINUXAPP
+#ifndef RTE_EXEC_ENV_BSDAPP
 #include <net/socket.h>
 #else
 #include <sys/socket.h>
diff --git a/app/test/commands.c b/app/test/commands.c
index 2df46b0..da0c035 100644
--- a/app/test/commands.c
+++ b/app/test/commands.c
@@ -39,8 +39,8 @@
 #include <stdlib.h>
 #include <netinet/in.h>
 #include <termios.h>
-#ifndef __linux__
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_LINUXAPP
+#ifndef RTE_EXEC_ENV_BSDAPP
 #include <net/socket.h>
 #endif
 #endif
diff --git a/app/test/test_cmdline_ipaddr.c b/app/test/test_cmdline_ipaddr.c
index 471d2ff..16570fb 100644
--- a/app/test/test_cmdline_ipaddr.c
+++ b/app/test/test_cmdline_ipaddr.c
@@ -36,8 +36,8 @@
 #include <inttypes.h>
 #include <netinet/in.h>
 
-#ifndef __linux__
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_LINUXAPP
+#ifndef RTE_EXEC_ENV_BSDAPP
 #include <net/socket.h>
 #else
 #include <sys/socket.h>
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 2856630..47cf5d3 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -9484,7 +9484,7 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc)
 		return -ENOMEM;
 	}
 
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_BSDAPP
 	pci_read(sc, PCI_STATUS, &status, 2);
 	if (!(status & PCI_STATUS_CAP_LIST)) {
 #else
@@ -9495,7 +9495,7 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc)
 		return -1;
 	}
 
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_BSDAPP
 	pci_read(sc, PCI_CAPABILITY_LIST, &pci_cap.next, 1);
 #else
 	pci_read(sc, PCIR_CAP_PTR, &pci_cap.next, 1);
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 5cefea4..006ad28 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -41,7 +41,7 @@
 
 #include "elink.h"
 
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_BSDAPP
 #include <linux/pci_regs.h>
 
 #define PCIY_PMG                       PCI_CAP_ID_PM
@@ -71,7 +71,7 @@
 #define IFM_10G_TWINAX                 22 /* 10GBase Twinax copper */
 #define IFM_10G_T                      26 /* 10GBase-T - RJ45 */
 
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_BSDAPP
 #define PCIR_EXPRESS_DEVICE_STA        PCI_EXP_TYPE_RC_EC
 #define PCIM_EXP_STA_TRANSACTION_PND   PCI_EXP_DEVSTA_TRPND
 #define PCIR_EXPRESS_LINK_STA          PCI_EXP_LNKSTA
diff --git a/examples/cmdline/commands.c b/examples/cmdline/commands.c
index f3ba247..205a205 100644
--- a/examples/cmdline/commands.c
+++ b/examples/cmdline/commands.c
@@ -66,8 +66,8 @@
 #include <errno.h>
 #include <netinet/in.h>
 #include <termios.h>
-#ifndef __linux__
-	#ifdef __FreeBSD__
+#ifndef RTE_EXEC_ENV_LINUXAPP
+	#ifdef RTE_EXEC_ENV_BSDAPP
 		#include <sys/socket.h>
 	#else
 		#include <net/socket.h>
diff --git a/lib/librte_cmdline/cmdline_parse_etheraddr.c b/lib/librte_cmdline/cmdline_parse_etheraddr.c
index dbfe4a6..1f26426 100644
--- a/lib/librte_cmdline/cmdline_parse_etheraddr.c
+++ b/lib/librte_cmdline/cmdline_parse_etheraddr.c
@@ -85,7 +85,7 @@ struct cmdline_token_ops cmdline_token_etheraddr_ops = {
 #define ETHER_ADDRSTRLENLONG 18
 #define ETHER_ADDRSTRLENSHORT 15
 
-#ifdef __linux__
+#ifdef RTE_EXEC_ENV_LINUXAPP
 #define ea_oct ether_addr_octet
 #else
 #define ea_oct octet
diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.c b/lib/librte_cmdline/cmdline_parse_ipaddr.c
index d3d3e04..4ef1c57 100644
--- a/lib/librte_cmdline/cmdline_parse_ipaddr.c
+++ b/lib/librte_cmdline/cmdline_parse_ipaddr.c
@@ -86,8 +86,8 @@
 #include <string.h>
 #include <errno.h>
 #include <netinet/in.h>
-#ifndef __linux__
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_LINUXAPP
+#ifndef RTE_EXEC_ENV_BSDAPP
 #include <net/socket.h>
 #else
 #include <sys/socket.h>
diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index fe7b586..f74bc0c 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -50,9 +50,9 @@ extern "C" {
 
 #define LCORE_ID_ANY     UINT32_MAX       /**< Any lcore. */
 
-#if defined(__linux__)
+#if defined(RTE_EXEC_ENV_LINUXAPP)
 	typedef	cpu_set_t rte_cpuset_t;
-#elif defined(__FreeBSD__)
+#elif defined(RTE_EXEC_ENV_BSDAPP)
 #include <pthread_np.h>
 	typedef cpuset_t rte_cpuset_t;
 #endif
-- 
2.7.0



More information about the dev mailing list