From patchwork Fri Dec 17 09:20:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 105227 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B9C9BA0352; Fri, 17 Dec 2021 10:23:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12DF54117E; Fri, 17 Dec 2021 10:21:58 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id E179641C25 for ; Fri, 17 Dec 2021 10:21:56 +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 1BH3fMFw015144 for ; Fri, 17 Dec 2021 01:21:56 -0800 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=gGl4h4+TRia3WuL0PYLt+r6hn3MjzN0BH+sEy7s8NC8=; b=PgixONwjnoP5FKBL8WRHWmxERfjKmUpaTkrX3mRdBNakIJ2ADIWQy/hsEk+TOk6UOXAr p+kBYfCeRK4wYPQHohomSSQPLnuAUnGu82tEGyU1kjqCHekQoFpl1vxQRkHNc0GzAS+P L2dpQ+Dm7dTpSvqsRidpxqR7fzTmpfGGnX+RGEJkzrCi/z7plfzfwsgEGpOHuGrgpEkr XOjs30yLqkMHcpBjArB1wvwwWP31/UKwJEhIH0hSHe9OUr+0qCrmQd7ZBn09zUzt196X pxGjUdADVPYyuhldKAlkVa903dC6isgxgRWhGOcpSoe1mHgdRNQ3UWQyIoL/ccfINE4P YQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3d0b372tgg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 17 Dec 2021 01:21:56 -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, 17 Dec 2021 01:21:54 -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, 17 Dec 2021 01:21:54 -0800 Received: from HY-LT1002.marvell.com (HY-LT1002.marvell.com [10.28.176.218]) by maili.marvell.com (Postfix) with ESMTP id 445663F70A3; Fri, 17 Dec 2021 01:21:52 -0800 (PST) From: Anoob Joseph To: Akhil Goyal , Jerin Jacob CC: Anoob Joseph , Archana Muniganti , Tejasree Kondoj , Subject: [PATCH v3 25/29] crypto/cnxk: add copy and set DF Date: Fri, 17 Dec 2021 14:50:07 +0530 Message-ID: <1639732811-1440-26-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639732811-1440-1-git-send-email-anoobj@marvell.com> References: <1639676975-1316-1-git-send-email-anoobj@marvell.com> <1639732811-1440-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: IEy-3xwFR_oUBzUNLdH1Ykjb5NXLv2ef X-Proofpoint-GUID: IEy-3xwFR_oUBzUNLdH1Ykjb5NXLv2ef X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-17_03,2021-12-16_01,2021-12-02_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 Add support for copy and set DF bit. Signed-off-by: Anoob Joseph --- drivers/crypto/cnxk/cn9k_ipsec.c | 7 ++++++- drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/cnxk/cn9k_ipsec.c b/drivers/crypto/cnxk/cn9k_ipsec.c index c9f5825..62b9c26 100644 --- a/drivers/crypto/cnxk/cn9k_ipsec.c +++ b/drivers/crypto/cnxk/cn9k_ipsec.c @@ -246,6 +246,8 @@ ipsec_sa_ctl_set(struct rte_security_ipsec_xform *ipsec, if (ipsec->options.udp_encap == 1) ctl->encap_type = ROC_IE_ON_SA_ENCAP_UDP; + ctl->copy_df = ipsec->options.copy_df; + ctl->spi = rte_cpu_to_be_32(ipsec->spi); rte_io_wmb(); @@ -376,13 +378,16 @@ cn9k_ipsec_outb_sa_create(struct cnxk_cpt_qp *qp, if (ipsec->mode == RTE_SECURITY_IPSEC_SA_MODE_TUNNEL) { if (ipsec->tunnel.type == RTE_SECURITY_IPSEC_TUNNEL_IPV4) { + uint16_t frag_off = 0; ctx_len += sizeof(template->ip4); ip4->version_ihl = RTE_IPV4_VHL_DEF; ip4->time_to_live = ipsec->tunnel.ipv4.ttl; ip4->type_of_service |= (ipsec->tunnel.ipv4.dscp << 2); if (ipsec->tunnel.ipv4.df) - ip4->fragment_offset = BIT(14); + frag_off |= RTE_IPV4_HDR_DF_FLAG; + ip4->fragment_offset = rte_cpu_to_be_16(frag_off); + memcpy(&ip4->src_addr, &ipsec->tunnel.ipv4.src_ip, sizeof(struct in_addr)); memcpy(&ip4->dst_addr, &ipsec->tunnel.ipv4.dst_ip, diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c index a0b2a1f..69ee0d9 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c @@ -1121,6 +1121,7 @@ static void cnxk_sec_caps_update(struct rte_security_capability *sec_cap) { sec_cap->ipsec.options.udp_encap = 1; + sec_cap->ipsec.options.copy_df = 1; } static void