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 007A1A0501; Fri, 8 Apr 2022 12:18:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F373F40E64; Fri, 8 Apr 2022 12:18:45 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E863B40E5A for ; Fri, 8 Apr 2022 12:18:44 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 2383XDkT024266; Fri, 8 Apr 2022 03:18:44 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=lexo5XhAJuX5g6tqggi+rRtNc8fxVaNtzzYAMfNFJiE=; b=YMEqfY+oqR0ygbaWDtEmI4aXvdzN2qAHf7yCTh2zoEUh+9aA2gx7vsT305NPrywt9YCF 1xvQG7tLlgPrQTiezmpvYZ/S54Gx6Fch0ow8BaQIIlEMJMWoruNfqzfZGF18Y0+PwqQL AHsbPF3woVRchskLOXHhzzF1cV0xH8OBfCxbekJBDAeTszwkcEpMxtCwHz+Y8zfGtFQb O1buA36okaJiRgpUSeti3Cg1evEeJpCB6k62P28AwpeH1qYbFMdNzQW/l3UN5aE737ey 2IS9ArBT8OORP51tsmxUKEZMHn6q0c5WpOUl4c+GyNcIsqJexB4WQjyaifT8BAB2sZt7 3Q== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3f9r5wfva6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 08 Apr 2022 03:18:43 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 8 Apr 2022 03:18:42 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 8 Apr 2022 03:18:42 -0700 Received: from hyd1409.caveonetworks.com.com (unknown [10.29.45.15]) by maili.marvell.com (Postfix) with ESMTP id 8455A3F704C; Fri, 8 Apr 2022 03:18:40 -0700 (PDT) From: Archana Muniganti To: , , CC: Archana Muniganti , , Subject: [PATCH 1/2] app/crypto-perf: populate mbuf in latency test Date: Fri, 8 Apr 2022 15:48:34 +0530 Message-ID: <20220408101835.12941-2-marchana@marvell.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220408101835.12941-1-marchana@marvell.com> References: <20220408101835.12941-1-marchana@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: CFzPmxUlHueMSi7HtcfESeBfOkE7sz5f X-Proofpoint-ORIG-GUID: CFzPmxUlHueMSi7HtcfESeBfOkE7sz5f X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-04-08_03,2022-04-08_01,2022-02-23_01 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 For decrypt, ICV mismatch can come as data is dummy and latency will be calculated for error path. Hence populate mbuf with test vector data. Signed-off-by: Archana Muniganti --- app/test-crypto-perf/cperf_ops.c | 3 +- app/test-crypto-perf/cperf_test_common.c | 36 +++++++++++++++++++++++ app/test-crypto-perf/cperf_test_common.h | 5 ++++ app/test-crypto-perf/cperf_test_latency.c | 6 ++++ app/test-crypto-perf/cperf_test_verify.c | 36 ----------------------- 5 files changed, 49 insertions(+), 37 deletions(-) diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c index 8baee12e45..97b719e13b 100644 --- a/app/test-crypto-perf/cperf_ops.c +++ b/app/test-crypto-perf/cperf_ops.c @@ -620,7 +620,8 @@ cperf_set_ops_aead(struct rte_crypto_op **ops, } } - if (options->test == CPERF_TEST_TYPE_VERIFY) { + if ((options->test == CPERF_TEST_TYPE_VERIFY) || + (options->test == CPERF_TEST_TYPE_LATENCY)) { for (i = 0; i < nb_ops; i++) { uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ops[i], uint8_t *, iv_offset); diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c index 97a1ea47ad..00aadc9a47 100644 --- a/app/test-crypto-perf/cperf_test_common.c +++ b/app/test-crypto-perf/cperf_test_common.c @@ -262,3 +262,39 @@ cperf_alloc_common_memory(const struct cperf_options *options, return 0; } + +void +cperf_mbuf_set(struct rte_mbuf *mbuf, + const struct cperf_options *options, + const struct cperf_test_vector *test_vector) +{ + uint32_t segment_sz = options->segment_sz; + uint8_t *mbuf_data; + uint8_t *test_data; + uint32_t remaining_bytes = options->max_buffer_size; + + if (options->op_type == CPERF_AEAD) { + test_data = (options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ? + test_vector->plaintext.data : + test_vector->ciphertext.data; + } else { + test_data = + (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ? + test_vector->plaintext.data : + test_vector->ciphertext.data; + } + + while (remaining_bytes) { + mbuf_data = rte_pktmbuf_mtod(mbuf, uint8_t *); + + if (remaining_bytes <= segment_sz) { + memcpy(mbuf_data, test_data, remaining_bytes); + return; + } + + memcpy(mbuf_data, test_data, segment_sz); + remaining_bytes -= segment_sz; + test_data += segment_sz; + mbuf = mbuf->next; + } +} diff --git a/app/test-crypto-perf/cperf_test_common.h b/app/test-crypto-perf/cperf_test_common.h index 3ace0d2e58..a603a607d5 100644 --- a/app/test-crypto-perf/cperf_test_common.h +++ b/app/test-crypto-perf/cperf_test_common.h @@ -21,4 +21,9 @@ cperf_alloc_common_memory(const struct cperf_options *options, uint32_t *dst_buf_offset, struct rte_mempool **pool); +void +cperf_mbuf_set(struct rte_mbuf *mbuf, + const struct cperf_options *options, + const struct cperf_test_vector *test_vector); + #endif /* _CPERF_TEST_COMMON_H_ */ diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index 9ada431660..6f972cea49 100644 --- a/app/test-crypto-perf/cperf_test_latency.c +++ b/app/test-crypto-perf/cperf_test_latency.c @@ -201,6 +201,12 @@ cperf_latency_test_runner(void *arg) ctx->test_vector, iv_offset, &imix_idx, &tsc_start); + /* Populate the mbuf with the test vector */ + for (i = 0; i < burst_size; i++) + cperf_mbuf_set(ops[i]->sym->m_src, + ctx->options, + ctx->test_vector); + tsc_start = rte_rdtsc_precise(); #ifdef CPERF_LINEARIZATION_ENABLE diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index c031330afc..5c0dc82290 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -195,42 +195,6 @@ cperf_verify_op(struct rte_crypto_op *op, return !!res; } -static void -cperf_mbuf_set(struct rte_mbuf *mbuf, - const struct cperf_options *options, - const struct cperf_test_vector *test_vector) -{ - uint32_t segment_sz = options->segment_sz; - uint8_t *mbuf_data; - uint8_t *test_data; - uint32_t remaining_bytes = options->max_buffer_size; - - if (options->op_type == CPERF_AEAD) { - test_data = (options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ? - test_vector->plaintext.data : - test_vector->ciphertext.data; - } else { - test_data = - (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ? - test_vector->plaintext.data : - test_vector->ciphertext.data; - } - - while (remaining_bytes) { - mbuf_data = rte_pktmbuf_mtod(mbuf, uint8_t *); - - if (remaining_bytes <= segment_sz) { - memcpy(mbuf_data, test_data, remaining_bytes); - return; - } - - memcpy(mbuf_data, test_data, segment_sz); - remaining_bytes -= segment_sz; - test_data += segment_sz; - mbuf = mbuf->next; - } -} - int cperf_verify_test_runner(void *test_ctx) { -- 2.22.0