summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Monjalon <thomas.monjalon@6wind.com>2014-12-03 21:12:00 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-12-05 16:55:00 +0100
commit44eb94569634c63d789b8a8125e16ed1b92c365c (patch)
tree426e1ab161d9d6e1ef5b3492f5cc7b6f75aa78f5
parent72c605807ae855ac64b64a388fe81005336db7c1 (diff)
downloaddpdk-44eb94569634c63d789b8a8125e16ed1b92c365c.zip
dpdk-44eb94569634c63d789b8a8125e16ed1b92c365c.tar.gz
dpdk-44eb94569634c63d789b8a8125e16ed1b92c365c.tar.xz
app/testpmd: fix endianness detection
Use endianness detection factorized in EAL. The comment about arpa/inet.h is not valid anymore since commit d07180f211c08 ("net: fix conflict with libc"). The macro _htons could also be moved in rte_byteorder.h by providing some constant byte swapping. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
-rw-r--r--app/test-pmd/config.c2
-rw-r--r--app/test-pmd/csumonly.c5
-rw-r--r--app/test-pmd/testpmd.h2
3 files changed, 4 insertions, 5 deletions
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index f0b770e..69a83c2 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -628,7 +628,7 @@ ring_dma_zone_lookup(const char *ring_name, uint8_t port_id, uint16_t q_id)
union igb_ring_dword {
uint64_t dword;
struct {
-#ifdef RTE_ARCH_BIG_ENDIAN
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
uint32_t lo;
uint32_t hi;
#else
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 6f43761..da4bca4 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -79,9 +79,8 @@
#define IP_HDRLEN 0x05 /* default IP header length == five 32-bits words. */
#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
-/* we cannot use htons() from arpa/inet.h due to name conflicts, and we
- * cannot use rte_cpu_to_be_16() on a constant in a switch/case */
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+/* We cannot use rte_cpu_to_be_16() on a constant in a switch/case */
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
#define _htons(x) ((uint16_t)((((x) & 0x00ffU) << 8) | (((x) & 0xff00U) >> 8)))
#else
#define _htons(x) (x)
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index c925910..f8b0740 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -567,7 +567,7 @@ int tx_queue_id_is_invalid(queueid_t txq_id);
#define RTE_BE_TO_CPU_16(be_16_v) rte_be_to_cpu_16((be_16_v))
#define RTE_CPU_TO_BE_16(cpu_16_v) rte_cpu_to_be_16((cpu_16_v))
#else
-#ifdef __big_endian__
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
#define RTE_BE_TO_CPU_16(be_16_v) (be_16_v)
#define RTE_CPU_TO_BE_16(cpu_16_v) (cpu_16_v)
#else