From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by dpdk.org (Postfix) with ESMTP id 1CA59559C for ; Wed, 3 Dec 2014 21:49:12 +0100 (CET) Received: by mail-wi0-f180.google.com with SMTP id n3so25759042wiv.7 for ; Wed, 03 Dec 2014 12:49:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=66Cf55NcqyRzle9c1rdBgopf3y5JYR+elY0NwoI9rAY=; b=Oj4+9XgYe2XQZM6VLcDrxA6u4zuguUYb6dGr2oAXt+RnvFu1ARrLXhcxtxaF1vyXJE vL0UQhuOi8pO5yoqshjMFQsscDkKW8e77EkkeQwvnjM3BfgOyxvlfcQR5WB7zkJxEhjo CSvbsH9Hai41Ri0p8J8d2KuGci4ocpvCXXnMhD/GFr+d45nqv4HJfpNNQrzUEJt3FjFv PMgOyIWFoRc9Sv14sW4WUPX2qhmTpUin6tcz155+Etx5BrSuqs6xaKtksiNkkY4nJKGn MFcGITylhOr8gpIMffB42SONuzMkPCXEwAWIIoBwBycGYArNXKogy5iCi9ynE1Wc81bD vGXw== X-Gm-Message-State: ALoCoQl92MAH6a71XFbEZJ/2nNKLDmFziayBB0ZOLYZP3/vnczIU42VqEAwi5RKRQN2LsnmEcOQL X-Received: by 10.180.75.199 with SMTP id e7mr105255625wiw.21.1417639752021; Wed, 03 Dec 2014 12:49:12 -0800 (PST) Received: from XPS13.localdomain (188.20.90.92.rev.sfr.net. [92.90.20.188]) by mx.google.com with ESMTPSA id hz9sm37761878wjb.17.2014.12.03.12.49.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Dec 2014 12:49:11 -0800 (PST) From: Thomas Monjalon To: dev@dpdk.org Date: Wed, 3 Dec 2014 21:47:48 +0100 Message-Id: <1417639668-23500-3-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1417639668-23500-1-git-send-email-thomas.monjalon@6wind.com> References: <283531301.lWbIahXLyM@xps13> <1417639668-23500-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-dev] [PATCH 2/2] app/testpmd: fix endianness detection X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2014 20:49:12 -0000 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 --- app/test-pmd/config.c | 2 +- app/test-pmd/csumonly.c | 5 ++--- app/test-pmd/testpmd.h | 2 +- 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 -- 2.1.3