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 59629A0548 for ; Thu, 2 Dec 2021 12:26:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 206B14067B; Thu, 2 Dec 2021 12:26:40 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id C88764067B for ; Thu, 2 Dec 2021 12:26:38 +0100 (CET) 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 ESMTP id 1B28Nr7b014982; Thu, 2 Dec 2021 03:26:38 -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=6Qfz0mLTfqdxrkKFdUm8PLbGBnnG6jcJKZ5y4x7d6Ec=; b=JNuDy+qG15IIzoc2PRI1t/M3kSK8gyJMukgJXotWK4/aXk12bznhZpKMSf81kXyPmAGT 6Hg/oqahCi4NtzTZeAS1pQST7RcZ4iJVxC/2DagDSH5YgS2YaiopIyCmUAjWxm2PF7fv PzGHWP59HaPxTDxdHo3xKsfMuV9jwmsDQEXZaohembxRwqOrlPjsJC5WpSmr0agabGb1 +UJrXX5cwknaD6CPBe8B1UjtDvTRL16ZcuIiVG/Mj2zPyb0u+PFwLwIDg1H/Gv9UIBZz 4Wi7UbjGaHOBRefq8flOEViDZoX8dYi/VVOzKhQq0FXzCIfKGlIbwi3PfflYxGpFfkmj sQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3cpr5218ae-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 02 Dec 2021 03:26:37 -0800 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; Thu, 2 Dec 2021 03:25:46 -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; Thu, 2 Dec 2021 03:25:46 -0800 Received: from hyd1554T5810.caveonetworks.com.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id D829A3F7091; Thu, 2 Dec 2021 03:25:44 -0800 (PST) From: Tejasree Kondoj To: Akhil Goyal , Xueming Li CC: Tejasree Kondoj , Anoob Joseph , Subject: [PATCH 20.11] crypto/octeontx2: fix lookaside IPsec IPv6 Date: Thu, 2 Dec 2021 17:48:41 +0530 Message-ID: <20211202121841.3297-1-ktejasree@marvell.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: RyjWZOL6Wx20P6-ulgFqYMb30RdeGL1k X-Proofpoint-ORIG-GUID: RyjWZOL6Wx20P6-ulgFqYMb30RdeGL1k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-12-02_07,2021-12-02_01,2020-04-07_01 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit f063054f8a54ca2218bae327a252a352614671b0 ] Fixing IPv6 mixed tunnel mode support by updating inputs to firmware. Fixes: 4edede7bc6ee ("crypto/octeontx2: support lookaside IPsec IPv6") Cc: stable@dpdk.org Signed-off-by: Tejasree Kondoj --- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 6 +++--- drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 13 ++++++++----- drivers/crypto/octeontx2/otx2_cryptodev_sec.h | 2 -- drivers/crypto/octeontx2/otx2_ipsec_po.h | 2 -- drivers/crypto/octeontx2/otx2_ipsec_po_ops.h | 10 +++------- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c index 5f2ccc0872..662c8bc001 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c +++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c @@ -893,10 +893,10 @@ otx2_cpt_sec_post_process(struct rte_crypto_op *cop, uintptr_t *rsp) if (word0->s.opcode.major == OTX2_IPSEC_PO_PROCESS_IPSEC_INB) { data = rte_pktmbuf_mtod(m, char *); + ip = (struct rte_ipv4_hdr *)(data + + OTX2_IPSEC_PO_INB_RPTR_HDR); - if (rsp[4] == RTE_SECURITY_IPSEC_TUNNEL_IPV4) { - ip = (struct rte_ipv4_hdr *)(data + - OTX2_IPSEC_PO_INB_RPTR_HDR); + if ((ip->version_ihl >> 4) == 4) { m_len = rte_be_to_cpu_16(ip->total_length); } else { ip6 = (struct rte_ipv6_hdr *)(data + diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c index bad9c5ca9f..c6a707c646 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c +++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c @@ -189,9 +189,6 @@ set_session_misc_attributes(struct otx2_sec_session_ipsec_lp *sess, sess->auth_iv_length = auth_xform->auth.iv.length; sess->mac_len = auth_xform->auth.digest_length; } - - sess->ucmd_param1 = OTX2_IPSEC_PO_PER_PKT_IV; - sess->ucmd_param2 = 0; } static int @@ -228,7 +225,6 @@ crypto_sec_ipsec_outb_session_create(struct rte_cryptodev *crypto_dev, lp->ip_id = 0; lp->seq_lo = 1; lp->seq_hi = 0; - lp->tunnel_type = ipsec->tunnel.type; ret = ipsec_po_sa_ctl_set(ipsec, crypto_xform, ctl); if (ret) @@ -327,6 +323,10 @@ crypto_sec_ipsec_outb_session_create(struct rte_cryptodev *crypto_dev, lp->ucmd_opcode = (lp->ctx_len << 8) | (OTX2_IPSEC_PO_PROCESS_IPSEC_OUTB); + /* Set per packet IV and IKEv2 bits */ + lp->ucmd_param1 = BIT(11) | BIT(9); + lp->ucmd_param2 = 0; + set_session_misc_attributes(lp, crypto_xform, auth_xform, cipher_xform); @@ -367,7 +367,6 @@ crypto_sec_ipsec_inb_session_create(struct rte_cryptodev *crypto_dev, if (ret) return ret; - lp->tunnel_type = ipsec->tunnel.type; auth_xform = crypto_xform; cipher_xform = crypto_xform->next; @@ -410,6 +409,10 @@ crypto_sec_ipsec_inb_session_create(struct rte_cryptodev *crypto_dev, lp->cpt_inst_w7 = inst.u64[7]; lp->ucmd_opcode = (lp->ctx_len << 8) | (OTX2_IPSEC_PO_PROCESS_IPSEC_INB); + lp->ucmd_param1 = 0; + + /* Set IKEv2 bit */ + lp->ucmd_param2 = BIT(12); set_session_misc_attributes(lp, crypto_xform, auth_xform, cipher_xform); diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.h b/drivers/crypto/octeontx2/otx2_cryptodev_sec.h index 2849c1ab75..ff3329c9c1 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.h +++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.h @@ -55,8 +55,6 @@ struct otx2_sec_session_ipsec_lp { uint8_t iv_length; /** Auth IV length in bytes */ uint8_t auth_iv_length; - /** IPsec tunnel type */ - enum rte_security_ipsec_tunnel_type tunnel_type; }; int otx2_crypto_sec_ctx_create(struct rte_cryptodev *crypto_dev); diff --git a/drivers/crypto/octeontx2/otx2_ipsec_po.h b/drivers/crypto/octeontx2/otx2_ipsec_po.h index da24f6a5d4..520daa5ff2 100644 --- a/drivers/crypto/octeontx2/otx2_ipsec_po.h +++ b/drivers/crypto/octeontx2/otx2_ipsec_po.h @@ -15,8 +15,6 @@ #define OTX2_IPSEC_PO_MAX_INB_CTX_LEN 0x22 #define OTX2_IPSEC_PO_MAX_OUTB_CTX_LEN 0x38 -#define OTX2_IPSEC_PO_PER_PKT_IV BIT(11) - #define OTX2_IPSEC_PO_WRITE_IPSEC_OUTB 0x20 #define OTX2_IPSEC_PO_WRITE_IPSEC_INB 0x21 #define OTX2_IPSEC_PO_PROCESS_IPSEC_OUTB 0x23 diff --git a/drivers/crypto/octeontx2/otx2_ipsec_po_ops.h b/drivers/crypto/octeontx2/otx2_ipsec_po_ops.h index ee30131f17..887d13eb51 100644 --- a/drivers/crypto/octeontx2/otx2_ipsec_po_ops.h +++ b/drivers/crypto/octeontx2/otx2_ipsec_po_ops.h @@ -25,8 +25,7 @@ otx2_ipsec_po_out_rlen_get(struct otx2_sec_session_ipsec_lp *sess, } static __rte_always_inline struct cpt_request_info * -alloc_request_struct(char *maddr, void *cop, int mdata_len, - enum rte_security_ipsec_tunnel_type tunnel_type) +alloc_request_struct(char *maddr, void *cop, int mdata_len) { struct cpt_request_info *req; struct cpt_meta_info *meta; @@ -48,7 +47,6 @@ alloc_request_struct(char *maddr, void *cop, int mdata_len, op[1] = (uintptr_t)cop; op[2] = (uintptr_t)req; op[3] = mdata_len; - op[4] = tunnel_type; return req; } @@ -84,8 +82,7 @@ process_outb_sa(struct rte_crypto_op *cop, } mdata += extend_tail; /* mdata follows encrypted data */ - req = alloc_request_struct(mdata, (void *)cop, mdata_len, - sess->tunnel_type); + req = alloc_request_struct(mdata, (void *)cop, mdata_len); data = rte_pktmbuf_prepend(m_src, extend_head); if (unlikely(data == NULL)) { @@ -149,8 +146,7 @@ process_inb_sa(struct rte_crypto_op *cop, goto exit; } - req = alloc_request_struct(mdata, (void *)cop, mdata_len, - sess->tunnel_type); + req = alloc_request_struct(mdata, (void *)cop, mdata_len); /* Prepare CPT instruction */ word0.u64 = sess->ucmd_w0; -- 2.27.0