From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6E963A0096 for ; Tue, 9 Apr 2019 21:08:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 488055F14; Tue, 9 Apr 2019 21:07:00 +0200 (CEST) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by dpdk.org (Postfix) with ESMTP id 13BE25689 for ; Tue, 9 Apr 2019 21:06:43 +0200 (CEST) Received: by mail-qt1-f193.google.com with SMTP id w30so21163759qta.8 for ; Tue, 09 Apr 2019 12:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:reply-to; bh=kKo99JY69sqsDAQW6vWtxBehSgnXVqEE9ossRf7HUvk=; b=EsUgEhDSvOtkcdm+jyA044zK3DIGKbYcO5ktf7uz08+6xhZek8lTP6sPIKTJ7Ur5Vj 5d2J+PkXsTPG7sUrywJqv1tX8ciITMF+DbGQPAayfhlhfJ0qu3xWAwz1bpjCfjMgX2vk SVFK4sCLVwbNHwkQWC31L7YhON7lUDx3pLk/wXfdgh9bSuZmaqzOCxn+DEzv7Dc31WPZ 6qPHTQB6m78o606a6Gym+ScUaq9PO2feHz/mVJ0EHY7xwxmlUu1VAPaleyDbODAvPT1M YX3G1+0C9L9B6+e64KM58Q/TsA8TDmmYNTVcDVSoawWFOrCB8gNzXeNwlM0Ucf3cr7/u LLPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:reply-to; bh=kKo99JY69sqsDAQW6vWtxBehSgnXVqEE9ossRf7HUvk=; b=LGl/EGBx2U4DGlB1zq4H16zekKi3dl38+LjnKd0er9w/T/Hr2oxpd+01x3IqK+Z0Pv Fn2pVQngDfAIXGtplPekr+CfTKV2TFn1IhLdxvQSEoTsIQZp9exzMiS38qw+UX0PLi5V u5VSobCX4kIuYn8bPvz2gl0bK2bWU23kLGvcCdm/qkjrK88z0vAE7EdgQF3zkbWhkBA4 RSE+MYXh9tepOC1HU8JyYwcXgOzeiEIny3X4AFLsK/rWfBArRpwzNfy1rpWtuwSIZvI6 wTYUoKevEcu4UCbsAXOn5IRoJv7cRbKy+O/OvalqdXTpZt4ZHjOHeKpfqeQ8v4+d8+ma Uf4Q== X-Gm-Message-State: APjAAAVBDy/dcur/CSu07d5ozFmnBMQBDHOUEQE+UwzFdEea+/Zb5QN+ u7gKYLnBk3L8N5mL3c/NNaws3gvvj+k= X-Google-Smtp-Source: APXvYqwl5ovg7zax+elDYGc6t++ve3f5Tt+S/RFrQz8cji+WwpH20EtfXijEvUwyCEpl74WR7y8LYQ== X-Received: by 2002:aed:3e94:: with SMTP id n20mr32502036qtf.268.1554836802013; Tue, 09 Apr 2019 12:06:42 -0700 (PDT) Received: from csz25116.canlab.ibm.com ([199.246.40.57]) by smtp.gmail.com with ESMTPSA id q23sm17934789qkc.16.2019.04.09.12.06.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:06:41 -0700 (PDT) From: Vivian Kong X-Google-Original-From: Vivian Kong To: dev@dpdk.org Date: Tue, 9 Apr 2019 15:06:25 -0400 Message-Id: <20190409190630.31975-8-vivkong@ca.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190409190630.31975-1-vivkong@ca.ibm.com> References: <20190409190630.31975-1-vivkong@ca.ibm.com> Subject: [dpdk-dev] [RFC 07/12] test: add support for s390x architecture X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: vivkong@ca.ibm.com List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190409190625._rD_G4K20G3jS-3oqGrBxQKkWz_DTUzlj2ckiMQqLbc@z> Add big endian support for s390x architecture. Signed-off-by: Vivian Kong --- app/test/test_cmdline_ipaddr.c | 13 +++- app/test/test_cmdline_num.c | 111 +++++++++++++++++++++++++++++++++ app/test/test_xmmt_ops.h | 14 +++++ 3 files changed, 137 insertions(+), 1 deletion(-) diff --git a/app/test/test_cmdline_ipaddr.c b/app/test/test_cmdline_ipaddr.c index 8ee7f6288..5e7629bba 100644 --- a/app/test/test_cmdline_ipaddr.c +++ b/app/test/test_cmdline_ipaddr.c @@ -6,6 +6,7 @@ #include #include #include +#include #ifndef __linux__ #ifndef __FreeBSD__ @@ -22,7 +23,8 @@ #include "test_cmdline.h" -#define IP4(a,b,c,d) {((uint32_t)(((a) & 0xff)) | \ +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN +#define IP4(a, b, c, d) {((uint32_t)(((a) & 0xff)) | \ (((b) & 0xff) << 8) | \ (((c) & 0xff) << 16) | \ ((d) & 0xff) << 24)} @@ -30,6 +32,15 @@ #define U16_SWAP(x) \ (((x & 0xFF) << 8) | ((x & 0xFF00) >> 8)) +#else +#define IP4(a, b, c, d) {((uint32_t)(((a) & 0xff) << 24) | \ + (((b) & 0xff) << 16) | \ + (((c) & 0xff) << 8) | \ + ((d) & 0xff))} + +#define U16_SWAP(x) x +#endif + /* create IPv6 address, swapping bytes where needed */ #ifndef s6_addr16 # define s6_addr16 __u6_addr.__u6_addr16 diff --git a/app/test/test_cmdline_num.c b/app/test/test_cmdline_num.c index 4c97caf3d..9e80397ac 100644 --- a/app/test/test_cmdline_num.c +++ b/app/test/test_cmdline_num.c @@ -11,6 +11,8 @@ #include #include + +#include #include "test_cmdline.h" struct num_unsigned_str { @@ -451,6 +453,48 @@ test_parse_num_valid(void) /* check if result matches what it should have matched * since unsigned numbers don't care about number of bits, we can just convert * everything to uint64_t without any worries. */ + #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN + switch (type) { + case UINT8: + { + uint8_t *temp = (uint8_t *)&result; + result = *temp; + break; + } + case UINT16: + { + uint16_t *temp = (uint16_t *)&result; + result = *temp; + break; + } + case UINT32: + { + uint32_t *temp = (uint32_t *)&result; + result = *temp; + break; + } + case INT8: + { + int8_t *temp = (int8_t *)&result; + result = *temp; + break; + } + case INT16: + { + int16_t *temp = (int16_t *)&result; + result = *temp; + break; + } + case INT32: + { + int32_t *temp = (int32_t *)&result; + result = *temp; + break; + } + default: + break; + } + #endif if (ret > 0 && num_valid_positive_strs[i].result != result) { printf("Error: parsing %s as %s failed: result mismatch!\n", num_valid_positive_strs[i].str, buf); @@ -480,6 +524,7 @@ test_parse_num_valid(void) * the result is signed in this case, so we have to account for that */ if (ret > 0) { /* detect negative */ + #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN switch (type) { case INT8: result = (int8_t) result; @@ -493,6 +538,30 @@ test_parse_num_valid(void) default: break; } + #else + switch (type) { + case INT8: + { + int8_t *temp = (int8_t *)&result; + result = *temp; + break; + } + case INT16: + { + int16_t *temp = (int16_t *)&result; + result = *temp; + break; + } + case INT32: + { + int32_t *temp = (int32_t *)&result; + result = *temp; + break; + } + default: + break; + } + #endif if (num_valid_negative_strs[i].result == (int64_t) result) continue; printf("Error: parsing %s as %s failed: result mismatch!\n", @@ -529,6 +598,48 @@ test_parse_num_valid(void) /* check if result matches what it should have matched * since unsigned numbers don't care about number of bits, we can just convert * everything to uint64_t without any worries. */ + #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN + switch (type) { + case UINT8: + { + uint8_t *temp = (uint8_t *)&result; + result = *temp; + break; + } + case UINT16: + { + uint16_t *temp = (uint16_t *)&result; + result = *temp; + break; + } + case UINT32: + { + uint32_t *temp = (uint32_t *)&result; + result = *temp; + break; + } + case INT8: + { + int8_t *temp = (int8_t *)&result; + result = *temp; + break; + } + case INT16: + { + int16_t *temp = (int16_t *)&result; + result = *temp; + break; + } + case INT32: + { + int32_t *temp = (int32_t *)&result; + result = *temp; + break; + } + default: + break; + } + #endif if (ret > 0 && num_garbage_positive_strs[i].result != result) { printf("Error: parsing %s as %s failed: result mismatch!\n", num_garbage_positive_strs[i].str, buf); diff --git a/app/test/test_xmmt_ops.h b/app/test/test_xmmt_ops.h index 8bcf0b261..6d8cd1998 100644 --- a/app/test/test_xmmt_ops.h +++ b/app/test/test_xmmt_ops.h @@ -49,6 +49,20 @@ vect_set_epi32(int i3, int i2, int i1, int i0) return data; } +#elif defined(RTE_ARCH_S390X) + +/* loads the xmm_t value from address p(does not need to be 16-byte aligned)*/ +#define vect_loadu_sil128(p) vec_xld2(0, (signed int *)p) + +/* sets the 4 signed 32-bit integer values and returns the xmm_t variable */ +static __rte_always_inline xmm_t +vect_set_epi32(int i3, int i2, int i1, int i0) +{ + xmm_t data = (xmm_t){i0, i1, i2, i3}; + + return data; +} + #endif #endif /* _TEST_XMMT_OPS_H_ */ -- 2.17.1