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 333B0A0C46; Tue, 31 Aug 2021 15:08:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 223B540E78; Tue, 31 Aug 2021 15:08:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 12B0340E78 for ; Tue, 31 Aug 2021 15:08:20 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 17VCMRwx029338 for ; Tue, 31 Aug 2021 06:08:20 -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=BvVBskFpXqL3N3xVEd19mNQv3g19pam59TQnzbhbIQ4=; b=PI5we9G1VB9ViRMz+/zK5cIJWfi3d2d0Df8egpFloc7V12GDi5F2cfzWIgCtBpHXa6do LmBqrB3RxpfXSLqY11YPNBMx2ZzIDtp40gsjMs1ZOddhBrvVw6zTKIuRKhbro4WmKMO7 65GBfqhs6bc30JVZGiqr7UTKnu8x4vz5528UGGagllXqs/BKrPAhw2Od7fCTi06BO4LX Z2zHGZYTrZny4dYsNoFF/6n5a2A/lSuaQpNKWVjkfkqtCKvCyKgU+TQ+tEk28R0pPcb2 cPyqp4yEz4feXCM65gXwXBQR7QqWa3Hgx4ve+gxtCE6JPwxjCMqvqNmEs7aE/Y7yFidA BA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com with ESMTP id 3asf15hhmm-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 31 Aug 2021 06:08:20 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 31 Aug 2021 06:08:18 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 31 Aug 2021 06:08:18 -0700 Received: from hyd1554T5810.caveonetworks.com.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 6BAF75B6926; Tue, 31 Aug 2021 06:08:15 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal CC: Tejasree Kondoj , Anoob Joseph , Ankur Dwivedi , Archana Muniganti , Srujana Challa , "Nithin Dabilpuram" , Jerin Jacob , Date: Tue, 31 Aug 2021 19:31:23 +0530 Message-ID: <20210831140127.31775-5-ktejasree@marvell.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210831140127.31775-1-ktejasree@marvell.com> References: <20210831140127.31775-1-ktejasree@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: Rx4_6ZLNG2D7BqH_TYiNVnnIu1ao4o9B X-Proofpoint-GUID: Rx4_6ZLNG2D7BqH_TYiNVnnIu1ao4o9B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-08-31_05,2021-08-31_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH 4/8] crypto/cnxk: use rlen from CPT result with lookaside 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" Use rlen from CPT result with lookaside operations Signed-off-by: Tejasree Kondoj --- drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 40 ++++++----------------- drivers/crypto/cnxk/cn10k_ipsec.c | 4 +-- drivers/crypto/cnxk/cn10k_ipsec.h | 4 +-- drivers/crypto/cnxk/cn10k_ipsec_la_ops.h | 28 ++-------------- 4 files changed, 15 insertions(+), 61 deletions(-) diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c index 15f66c2515..780a321cf7 100644 --- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c @@ -48,7 +48,7 @@ cn10k_cpt_sym_temp_sess_create(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op) static __rte_always_inline int __rte_hot cpt_sec_inst_fill(struct rte_crypto_op *op, struct cn10k_sec_session *sess, - struct cpt_inflight_req *infl_req, struct cpt_inst_s *inst) + struct cpt_inst_s *inst) { struct rte_crypto_sym_op *sym_op = op->sym; union roc_ot_ipsec_sa_word2 *w2; @@ -70,10 +70,8 @@ cpt_sec_inst_fill(struct rte_crypto_op *op, struct cn10k_sec_session *sess, if (w2->s.dir == ROC_IE_OT_SA_DIR_OUTBOUND) ret = process_outb_sa(op, sa, inst); - else { - infl_req->op_flags |= CPT_OP_FLAGS_IPSEC_DIR_INBOUND; + else ret = process_inb_sa(op, sa, inst); - } return ret; } @@ -122,8 +120,7 @@ cn10k_cpt_fill_inst(struct cnxk_cpt_qp *qp, struct rte_crypto_op *ops[], if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) { sec_sess = get_sec_session_private_data( sym_op->sec_session); - ret = cpt_sec_inst_fill(op, sec_sess, infl_req, - &inst[0]); + ret = cpt_sec_inst_fill(op, sec_sess, &inst[0]); if (unlikely(ret)) return 0; w7 = sec_sess->sa.inst.w7; @@ -334,30 +331,13 @@ cn10k_cpt_crypto_adapter_enqueue(uintptr_t tag_op, struct rte_crypto_op *op) static inline void cn10k_cpt_sec_post_process(struct rte_crypto_op *cop, - struct cpt_inflight_req *infl_req) + struct cpt_cn10k_res_s *res) { - struct rte_crypto_sym_op *sym_op = cop->sym; - struct rte_mbuf *m = sym_op->m_src; - struct rte_ipv6_hdr *ip6; - struct rte_ipv4_hdr *ip; - uint16_t m_len; - - if (infl_req->op_flags & CPT_OP_FLAGS_IPSEC_DIR_INBOUND) { - ip = (struct rte_ipv4_hdr *)rte_pktmbuf_mtod(m, char *); - - if (((ip->version_ihl & 0xf0) >> RTE_IPV4_IHL_MULTIPLIER) == - IPVERSION) { - m_len = rte_be_to_cpu_16(ip->total_length); - } else { - PLT_ASSERT(((ip->version_ihl & 0xf0) >> - RTE_IPV4_IHL_MULTIPLIER) == 6); - ip6 = (struct rte_ipv6_hdr *)ip; - m_len = rte_be_to_cpu_16(ip6->payload_len) + - sizeof(struct rte_ipv6_hdr); - } - m->data_len = m_len; - m->pkt_len = m_len; - } + struct rte_mbuf *m = cop->sym->m_src; + const uint16_t m_len = res->rlen; + + m->data_len = m_len; + m->pkt_len = m_len; } static inline void @@ -385,7 +365,7 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS; if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) { if (cop->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) { - cn10k_cpt_sec_post_process(cop, infl_req); + cn10k_cpt_sec_post_process(cop, res); return; } diff --git a/drivers/crypto/cnxk/cn10k_ipsec.c b/drivers/crypto/cnxk/cn10k_ipsec.c index 944e0a7e3b..98110872a3 100644 --- a/drivers/crypto/cnxk/cn10k_ipsec.c +++ b/drivers/crypto/cnxk/cn10k_ipsec.c @@ -176,9 +176,7 @@ cn10k_ipsec_outb_sa_create(struct roc_cpt *roc_cpt, if (ret) return ret; - sa->partial_len = rlens.partial_len; - sa->roundup_byte = rlens.roundup_byte; - sa->roundup_len = rlens.roundup_len; + sa->max_extended_len = rlens.max_extended_len; /* pre-populate CPT INST word 4 */ inst_w4.u64 = 0; diff --git a/drivers/crypto/cnxk/cn10k_ipsec.h b/drivers/crypto/cnxk/cn10k_ipsec.h index c30492e149..bc52c60179 100644 --- a/drivers/crypto/cnxk/cn10k_ipsec.h +++ b/drivers/crypto/cnxk/cn10k_ipsec.h @@ -20,9 +20,7 @@ struct cn10k_ipsec_sa { }; /** Pre-populated CPT inst words */ struct cnxk_cpt_inst_tmpl inst; - uint8_t partial_len; - uint8_t roundup_len; - uint8_t roundup_byte; + uint16_t max_extended_len; }; struct cn10k_sec_session { diff --git a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h index 1e9ebb594a..fe91638c99 100644 --- a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h +++ b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h @@ -12,40 +12,21 @@ #include "cn10k_ipsec.h" #include "cnxk_cryptodev.h" -static __rte_always_inline int32_t -ipsec_po_out_rlen_get(struct cn10k_ipsec_sa *sess, uint32_t plen) -{ - uint32_t enc_payload_len; - - enc_payload_len = - RTE_ALIGN_CEIL(plen + sess->roundup_len, sess->roundup_byte); - - return sess->partial_len + enc_payload_len; -} - static __rte_always_inline int process_outb_sa(struct rte_crypto_op *cop, struct cn10k_ipsec_sa *sess, struct cpt_inst_s *inst) { struct rte_crypto_sym_op *sym_op = cop->sym; struct rte_mbuf *m_src = sym_op->m_src; - uint32_t dlen, rlen, extend_tail; - char *mdata; - - dlen = rte_pktmbuf_pkt_len(m_src); - rlen = ipsec_po_out_rlen_get(sess, dlen); - extend_tail = rlen - dlen; - - mdata = rte_pktmbuf_append(m_src, extend_tail); - if (unlikely(mdata == NULL)) { + if (unlikely(rte_pktmbuf_tailroom(m_src) < sess->max_extended_len)) { plt_dp_err("Not enough tail room"); return -ENOMEM; } /* Prepare CPT instruction */ inst->w4.u64 = sess->inst.w4; - inst->w4.s.dlen = dlen; + inst->w4.s.dlen = rte_pktmbuf_pkt_len(m_src); inst->dptr = rte_pktmbuf_iova(m_src); inst->rptr = inst->dptr; @@ -58,13 +39,10 @@ process_inb_sa(struct rte_crypto_op *cop, struct cn10k_ipsec_sa *sa, { struct rte_crypto_sym_op *sym_op = cop->sym; struct rte_mbuf *m_src = sym_op->m_src; - uint32_t dlen; - - dlen = rte_pktmbuf_pkt_len(m_src); /* Prepare CPT instruction */ inst->w4.u64 = sa->inst.w4; - inst->w4.s.dlen = dlen; + inst->w4.s.dlen = rte_pktmbuf_pkt_len(m_src); inst->dptr = rte_pktmbuf_iova(m_src); inst->rptr = inst->dptr; -- 2.27.0