From patchwork Sat Apr 10 17:02:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 418865 Delivered-To: patch@linaro.org Received: by 2002:a02:c4d2:0:0:0:0:0 with SMTP id h18csp440618jaj; Sat, 10 Apr 2021 10:05:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLSaBB0nGETocZEf+uipIBbuU1xTkdXVbHkeBOZ1VNyObI5zr6CBbLKBCbIGD5iW6GMf5q X-Received: by 2002:a17:907:3e93:: with SMTP id hs19mr21209964ejc.272.1618074320311; Sat, 10 Apr 2021 10:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618074320; cv=none; d=google.com; s=arc-20160816; b=Ew0b+z3Vn0G9Teh9WbJu4AlPTJHPF3spDtKZC7psNTzoEZl6wANyl58bu87H7fCJi0 ZpGW9CV5FNL79dI4wnO9VQMaMsT3QDC9SWHbjwiuo8R+HdU48/sVkWoL2HgC5CA4okx3 87hQWjiIj9vcOkYPi1ilXYOGgcaxTEwRbNrHt25FaDqfyIs+6cJ0+ZqP3NQ8moc6zo+T 663g0QXbSZoY0pAmxTLhMl3i96yoFIlvdQPX5W++cKFh4fAr4XbJcuOPtm+6O3wKddOW NaVYvdtUvaxggZCZLG5oGw9bNag2e7HII1yfu9+a6mbpOvMV7J98Z69Ig7NcLET7ibbt o0jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=8PsOm6qyX0mhQDqlWsJtLQw4CJf9wv0P85wIqkJyXwo=; b=PpEthAVyBsuArOcf03NgupXKvavTh7WzWQ29TAdF8lXvnjBLk50GJ5Kh8rx8goXCUH 2noBH0P4gQhT98ihpmzDvKaFnW6N+NaDMncy4B1PRGCya9FVaQvYuUISJuq5P5lY4ZBD lfctDK2251hKrXNwP/YQPDQmx5qObwJfjVnkligXyI2Sv9rSMcK/1JkV7dFAjr6RTpX1 mwBtqUF+eOkPTtjvyLpwRV80Ow22DbSFJCZZdHAmh2/1Qp5h8kxQWv+5ozY1bOJd7W5n YksG4vLF/tYQJbXEV8YjnCp3vQN19Z6xpD85LN9kk8eqkxvODDlB8ZmQxYaNh/vsbFas VkhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id b7si4088349edd.490.2021.04.10.10.05.20; Sat, 10 Apr 2021 10:05:20 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com 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(-) -- 2.17.1 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;