From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0337AA0547; Sat, 10 Apr 2021 19:05:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A83B0141302; Sat, 10 Apr 2021 19:04:41 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id D267B1412E3 for ; Sat, 10 Apr 2021 19:04:36 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B5A6120348D; Sat, 10 Apr 2021 19:04:36 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6D27620348F; Sat, 10 Apr 2021 19:04:34 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B75034032B; Sat, 10 Apr 2021 19:04:30 +0200 (CEST) From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com, nicolas.chautru@intel.com Cc: david.marchand@redhat.com, Nipun Gupta Date: Sat, 10 Apr 2021 22:32:51 +0530 Message-Id: <20210410170252.4587-8-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210410170252.4587-1-hemant.agrawal@nxp.com> References: <20210318063421.14895-1-hemant.agrawal@nxp.com> <20210410170252.4587-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 7/8] app/bbdev: add parameter to take input in network order X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Nipun Gupta Test bbdev application is reading the input and output from the test vector files in the same endianness which is of the system. This patch adds an option to provide data in the network order i.e. big endian format Signed-off-by: Nipun Gupta --- app/test-bbdev/test_bbdev_vector.c | 18 ++++++++++++++++-- app/test-bbdev/test_bbdev_vector.h | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c index 50d1da00f7..fe04bd6b95 100644 --- a/app/test-bbdev/test_bbdev_vector.c +++ b/app/test-bbdev/test_bbdev_vector.c @@ -53,7 +53,8 @@ starts_with(const char *str, const char *pre) /* tokenization test values separated by a comma */ static int -parse_values(char *tokens, uint32_t **data, uint32_t *data_length) +parse_values(char *tokens, uint32_t **data, uint32_t *data_length, + int network_order) { uint32_t n_tokens = 0; uint32_t data_size = 32; @@ -94,6 +95,14 @@ parse_values(char *tokens, uint32_t **data, uint32_t *data_length) } *data_length = *data_length + (strlen(tok) - strlen("0x"))/2; + if (network_order) { + if ((strlen(tok) - strlen("0x"))/2 == 4) + values[n_tokens] = + rte_cpu_to_be_32(values[n_tokens]); + else if ((strlen(tok) - strlen("0x"))/2 == 2) + values[n_tokens] = + rte_cpu_to_be_16(values[n_tokens]); + } tok = strtok(NULL, VALUE_DELIMITER); if (tok == NULL) @@ -416,7 +425,8 @@ parse_data_entry(const char *key_token, char *token, /* Clear new op data struct */ memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf)); - ret = parse_values(token, &data, &data_length); + ret = parse_values(token, &data, &data_length, + vector->network_order); if (!ret) { op_data[*nb_ops].addr = data; op_data[*nb_ops].length = data_length; @@ -728,6 +738,10 @@ parse_ldpc_encoder_params(const char *key_token, char *token, ret = parse_expected_status(token, &status, vector->op_type); if (!ret) vector->expected_status = status; + } else if (!strcmp(key_token, "network_order")) { + vector->mask |= TEST_BBDEV_VF_NETWORK_ORDER; + vector->network_order = (uint8_t) strtoul(token, &err, 0); + ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else { printf("Not valid ldpc enc key: '%s'\n", key_token); return -1; diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-bbdev/test_bbdev_vector.h index 4e5dbf5d50..aa53f0bb0d 100644 --- a/app/test-bbdev/test_bbdev_vector.h +++ b/app/test-bbdev/test_bbdev_vector.h @@ -35,6 +35,7 @@ enum { TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23), TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24), TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25), + TEST_BBDEV_VF_NETWORK_ORDER = (1ULL << 26), }; enum op_data_type { @@ -60,6 +61,7 @@ struct test_bbdev_vector { enum rte_bbdev_op_type op_type; int expected_status; int mask; + int network_order; union { struct rte_bbdev_op_turbo_dec turbo_dec; struct rte_bbdev_op_turbo_enc turbo_enc; -- 2.17.1