DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] use config flags for target OS checks
Date: Mon,  5 Dec 2016 18:50:43 +0100	[thread overview]
Message-ID: <1480960243-29173-1-git-send-email-thomas.monjalon@6wind.com> (raw)

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@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

             reply	other threads:[~2016-12-05 17:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 17:50 Thomas Monjalon [this message]
2019-01-15 18:25 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480960243-29173-1-git-send-email-thomas.monjalon@6wind.com \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).