From patchwork Tue Jul 13 07:42:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srujana Challa X-Patchwork-Id: 95728 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 27E2DA0C48; Tue, 13 Jul 2021 09:42:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A99D9411BD; Tue, 13 Jul 2021 09:42:34 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 4B7E74069E for ; Tue, 13 Jul 2021 09:42:33 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16D7ed4w026608; Tue, 13 Jul 2021 00:42:32 -0700 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=+a/DmB9dX5IDBQAZpEq0hFKeeg4NX5DKFfGk+BW8USU=; b=CmlHbHHOB5xPLN2uegNtcKPWDtX/G6dg4mJZDXQSsoZWdD2v6X3zRPdZzjJTl2yT7Ol2 InwJrYosxQcxJiu41Ngkhs6KpXwDIsjHy+oR9457UwCvopsx62tVeyF5eLOnAyIi9W1l 09Sy2NXeJzl/CGwtrcua2YfIOzjllLLqdSF6Rk3hez+Ide2WYoXXjXo/L7ndtOL2ntIM RAtNubAfCgflns7ay6W4Q2nvS6qSux5KxN7T0BQL2oPraik/q3410zsb0NwyTB4y3wnL 5A1e2JJ0CKt8lKpjQl6vPw5hAjpz7BX6DAfqPKbSctK72vrJi3/LHUa0yEZqOYXQPEgk rw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 39rvu5hvcm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 13 Jul 2021 00:42:32 -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, 13 Jul 2021 00:42:30 -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, 13 Jul 2021 00:42:30 -0700 Received: from hyd1schalla-dt.caveonetworks.com.com (unknown [10.29.8.39]) by maili.marvell.com (Postfix) with ESMTP id AB3783F70AB; Tue, 13 Jul 2021 00:42:28 -0700 (PDT) From: Srujana Challa To: Akhil Goyal , Radu Nicolau CC: Srujana Challa , Anoob Joseph , Nithin Kumar Dabilpuram , Tejasree Kondoj , Date: Tue, 13 Jul 2021 13:12:17 +0530 Message-ID: <20210713074219.6804-1-schalla@marvell.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 X-Proofpoint-GUID: xG8rdOtis178HUGZe1mt7eWvtivMbrjF X-Proofpoint-ORIG-GUID: xG8rdOtis178HUGZe1mt7eWvtivMbrjF X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-13_03:2021-07-13, 2021-07-13 signatures=0 Subject: [dpdk-dev] [PATCH 1/2] common/cnxk: add support for UDP encapsulation 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" Adds support for UDP encapsulation in crypto_cn10k PMD. Signed-off-by: Srujana Challa --- drivers/common/cnxk/cnxk_security.c | 18 ++++++++++++++++++ drivers/common/cnxk/meson.build | 1 + 2 files changed, 19 insertions(+) diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c index 2f5003e654..6c6728f570 100644 --- a/drivers/common/cnxk/cnxk_security.c +++ b/drivers/common/cnxk/cnxk_security.c @@ -2,6 +2,8 @@ * Copyright(C) 2021 Marvell. */ +#include + #include "cnxk_security.h" static int @@ -71,6 +73,10 @@ ot_ipsec_sa_common_param_fill(union roc_ot_ipsec_sa_word2 *w2, return -ENOTSUP; } + /* Set encapsulation type */ + if (ipsec_xfrm->options.udp_encap) + w2->s.encap_type = ROC_IE_OT_SA_ENCAP_UDP; + w2->s.spi = ipsec_xfrm->spi; /* Copy encryption key */ @@ -149,6 +155,10 @@ cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa, /* ESN */ sa->w2.s.esn_en = !!ipsec_xfrm->options.esn; + if (ipsec_xfrm->options.udp_encap) { + sa->w10.s.udp_src_port = 4500; + sa->w10.s.udp_dst_port = 4500; + } offset = offsetof(struct roc_ot_ipsec_inb_sa, ctx); /* Word offset for HW managed SA field */ @@ -267,6 +277,11 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa, /* ESN */ sa->w0.s.esn_en = !!ipsec_xfrm->options.esn; + if (ipsec_xfrm->options.udp_encap) { + sa->w10.s.udp_src_port = 4500; + sa->w10.s.udp_dst_port = 4500; + } + offset = offsetof(struct roc_ot_ipsec_outb_sa, ctx); /* Word offset for HW managed SA field */ sa->w0.s.hw_ctx_off = offset / 8; @@ -460,6 +475,9 @@ cnxk_ipsec_outb_rlens_get(struct cnxk_ipsec_outb_rlens *rlens, partial_len += cnxk_ipsec_icvlen_get(c_algo, a_algo, aead_algo); roundup_byte = cnxk_ipsec_outb_roundup_byte(c_algo, aead_algo); + if (ipsec_xfrm->options.udp_encap) + partial_len += sizeof(struct rte_udp_hdr); + rlens->partial_len = partial_len; rlens->roundup_len = roundup_len; rlens->roundup_byte = roundup_byte; diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build index 37ef2b04cc..6a7849f31c 100644 --- a/drivers/common/cnxk/meson.build +++ b/drivers/common/cnxk/meson.build @@ -61,3 +61,4 @@ sources = files( sources += files('cnxk_security.c') includes += include_directories('../../bus/pci') +includes += include_directories('../../../lib/net')