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 4D619A0351; Fri, 4 Mar 2022 11:40:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EFC23427A9; Fri, 4 Mar 2022 11:40:57 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 4595B4013F for ; Fri, 4 Mar 2022 11:40:56 +0100 (CET) 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 224758uR002724; Fri, 4 Mar 2022 02:40:55 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=+npTd4W+jABj2cCgDWUyTcoRi9JbWfyTMyL7U/MUnic=; b=apUB42mYrZqzn+zOZw0Bsj4uuKAjiWgh0/XcLaxUZNGFViOp9crcoFvrDrwLPpVf+Ep+ N+nK7gWBvlnhIz4TL0CJtLdoNAPn14CQR1dfX0eQcGwSeXwhpk740bVGwCw+3Jscj6nf vUSBj50+PhNzuCD5LDT92+3Bk1d2LtbGmx8ET2KQnQlNU1doJnocWNQ8h65+I0gcLIoD a5idGN6SSVwIHAo4t5pmUOu5N3IUyteAPNNUvjIwvoU0UIEBcTxCi+l+mmJnzDSHGzNU KxQuId0AnArI5okXScBV5Eu9uvKt8xjtpHCKfkboFO2Dmls85RkQ44+DOdbE3XQwzxAo jw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ek4j732fp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 04 Mar 2022 02:40:55 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 4 Mar 2022 02:40:53 -0800 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, 4 Mar 2022 02:40:53 -0800 Received: from HY-LT1002.marvell.com (unknown [10.193.74.2]) by maili.marvell.com (Postfix) with ESMTP id 08C423F7043; Fri, 4 Mar 2022 02:40:50 -0800 (PST) From: Anoob Joseph To: Ciara Power , Akhil Goyal , Jerin Jacob CC: Anoob Joseph , Archana Muniganti , Tejasree Kondoj , Subject: [PATCH] app/crypto-perf: add IPsec ops population routine Date: Fri, 4 Mar 2022 16:10:38 +0530 Message-ID: <1646390438-227-1-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: gibaUKYPNCYHsZHtcbq5HKZQfojRK5HT X-Proofpoint-ORIG-GUID: gibaUKYPNCYHsZHtcbq5HKZQfojRK5HT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-04_02,2022-03-04_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 Ops population functions are called in datapath. Keeping it common for PDCP & DOCSIS would mean ops population would have additional conditional checks causing the throughput reported to be lower than what the PMD is capable of. Separate out routine for IPsec cases and split vector population and op preparation into two loops to allow 2 rte_rdtsc_precise() calls to capture cycles consumed for memcpying the vector. Checking the cycle count from the loop would mean more calls to the same API. Signed-off-by: Anoob Joseph --- app/test-crypto-perf/cperf_ops.c | 90 +++++++++++++++++++++++-------- app/test-crypto-perf/cperf_test_latency.c | 2 +- 2 files changed, 70 insertions(+), 22 deletions(-) diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c index 479c40e..8baee12 100644 --- a/app/test-crypto-perf/cperf_ops.c +++ b/app/test-crypto-perf/cperf_ops.c @@ -45,7 +45,8 @@ test_ipsec_vec_populate(struct rte_mbuf *m, const struct cperf_options *options, if ((options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) || (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT)) { - memcpy(ip, test_vector->plaintext.data, m->data_len); + memcpy(ip, test_vector->plaintext.data, + sizeof(struct rte_ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->data_len); } @@ -61,7 +62,6 @@ cperf_set_ops_security(struct rte_crypto_op **ops, uint16_t iv_offset __rte_unused, uint32_t *imix_idx, uint64_t *tsc_start) { - uint64_t tsc_start_temp, tsc_end_temp; uint16_t i; for (i = 0; i < nb_ops; i++) { @@ -79,27 +79,10 @@ cperf_set_ops_security(struct rte_crypto_op **ops, sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] + src_buf_offset); - if (options->op_type == CPERF_PDCP || - options->op_type == CPERF_IPSEC) { - /* In case of IPsec, headroom is consumed by PMD, - * hence resetting it. - */ - sym_op->m_src->data_off = options->headroom_sz; - + if (options->op_type == CPERF_PDCP) { sym_op->m_src->buf_len = options->segment_sz; sym_op->m_src->data_len = options->test_buffer_size; sym_op->m_src->pkt_len = sym_op->m_src->data_len; - - if ((options->op_type == CPERF_IPSEC) && - (options->test_file == NULL) && - (options->test == CPERF_TEST_TYPE_THROUGHPUT)) { - tsc_start_temp = rte_rdtsc_precise(); - test_ipsec_vec_populate(sym_op->m_src, options, - test_vector); - tsc_end_temp = rte_rdtsc_precise(); - - *tsc_start += (tsc_end_temp - tsc_start_temp); - } } if (options->op_type == CPERF_DOCSIS) { @@ -135,8 +118,71 @@ cperf_set_ops_security(struct rte_crypto_op **ops, dst_buf_offset); } + RTE_SET_USED(tsc_start); + RTE_SET_USED(test_vector); + + return 0; +} + +static int +cperf_set_ops_security_ipsec(struct rte_crypto_op **ops, + uint32_t src_buf_offset __rte_unused, + uint32_t dst_buf_offset __rte_unused, + uint16_t nb_ops, struct rte_cryptodev_sym_session *sess, + const struct cperf_options *options, + const struct cperf_test_vector *test_vector, + uint16_t iv_offset __rte_unused, uint32_t *imix_idx, + uint64_t *tsc_start) +{ + struct rte_security_session *sec_sess = + (struct rte_security_session *)sess; + const uint32_t test_buffer_size = options->test_buffer_size; + const uint32_t headroom_sz = options->headroom_sz; + const uint32_t segment_sz = options->segment_sz; + uint64_t tsc_start_temp, tsc_end_temp; + uint16_t i = 0; + + RTE_SET_USED(imix_idx); + + for (i = 0; i < nb_ops; i++) { + struct rte_crypto_sym_op *sym_op = ops[i]->sym; + struct rte_mbuf *m = sym_op->m_src; + + ops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; + rte_security_attach_session(ops[i], sec_sess); + sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] + + src_buf_offset); + + /* In case of IPsec, headroom is consumed by PMD, + * hence resetting it. + */ + m->data_off = headroom_sz; + + m->buf_len = segment_sz; + m->data_len = test_buffer_size; + m->pkt_len = test_buffer_size; + + sym_op->m_dst = NULL; + } + + if (options->test_file != NULL) + return 0; + + tsc_start_temp = rte_rdtsc_precise(); + + for (i = 0; i < nb_ops; i++) { + struct rte_crypto_sym_op *sym_op = ops[i]->sym; + struct rte_mbuf *m = sym_op->m_src; + + test_ipsec_vec_populate(m, options, test_vector); + } + + tsc_end_temp = rte_rdtsc_precise(); + *tsc_start += tsc_end_temp - tsc_start_temp; + return 0; } + #endif static int @@ -1055,10 +1101,12 @@ cperf_get_op_functions(const struct cperf_options *options, break; #ifdef RTE_LIB_SECURITY case CPERF_PDCP: - case CPERF_IPSEC: case CPERF_DOCSIS: op_fns->populate_ops = cperf_set_ops_security; break; + case CPERF_IPSEC: + op_fns->populate_ops = cperf_set_ops_security_ipsec; + break; #endif default: return -1; diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index 4c7bc72..9ada431 100644 --- a/app/test-crypto-perf/cperf_test_latency.c +++ b/app/test-crypto-perf/cperf_test_latency.c @@ -199,7 +199,7 @@ cperf_latency_test_runner(void *arg) ctx->dst_buf_offset, burst_size, ctx->sess, ctx->options, ctx->test_vector, iv_offset, - &imix_idx, NULL); + &imix_idx, &tsc_start); tsc_start = rte_rdtsc_precise(); -- 2.7.4