From patchwork Tue Jul 13 07:42:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srujana Challa X-Patchwork-Id: 95729 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 D60BEA0C48; Tue, 13 Jul 2021 09:42:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A7194069E; Tue, 13 Jul 2021 09:42:40 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 76F1C411D8 for ; Tue, 13 Jul 2021 09:42:38 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16D7epdY021587; Tue, 13 Jul 2021 00:42:37 -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=X8HzYbheZCNuaPwJJnPbTLRFKgpUxFJHRQF+/6pGKNw=; b=SD/dvXHfrGm8oHzJDDvfvsy/L6wdgwch/IzA9ci1z+zkuJ5odvcfsMWh0NDx67fxEi4n JxSfsbM4tbTuxEqoBShSjFHZbP/lJBIdfjC4DqOo8kf5R3ln8i8dJMfkp6ptqqoNLAOK nCjurR9kfQBWWI/gjTD+6RQ56z3dBEBLmtnOesEL0f9xexl6vbsvQX9hVMzBIfPbf00w meiX68Xu3LM7vfebjW7clY3gCuY1n6j8aZ0IVzeSWsaKpDu0EukeXxAWMtYWiycSopwu D25KPJdSprWtldDF9E2D71K0nCxil29vkcHcB2UTTQxw5auluGZ7eWK6P7jIVYX00gSE +A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 39re6vndse-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 13 Jul 2021 00:42:37 -0700 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; Tue, 13 Jul 2021 00:42:35 -0700 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.18 via Frontend Transport; Tue, 13 Jul 2021 00:42:35 -0700 Received: from hyd1schalla-dt.caveonetworks.com.com (unknown [10.29.8.39]) by maili.marvell.com (Postfix) with ESMTP id 4F52A3F70AB; Tue, 13 Jul 2021 00:42:33 -0700 (PDT) From: Srujana Challa To: Akhil Goyal , Radu Nicolau , Konstantin Ananyev CC: Srujana Challa , Anoob Joseph , Nithin Kumar Dabilpuram , Tejasree Kondoj , Date: Tue, 13 Jul 2021 13:12:18 +0530 Message-ID: <20210713074219.6804-2-schalla@marvell.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210713074219.6804-1-schalla@marvell.com> References: <20210713074219.6804-1-schalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 82XJyLgHIzzaLhLZew0z6iLMlcu2odbZ X-Proofpoint-ORIG-GUID: 82XJyLgHIzzaLhLZew0z6iLMlcu2odbZ 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 2/2] examples/ipsec-secgw: add UDP encapsulation for inline protocol 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 to allow udp-encap option for RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL mode also. Signed-off-by: Srujana Challa Acked-by: Akhil Goyal Acked-by: Konstantin Ananyev --- examples/ipsec-secgw/sa.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index 7bb9ef36c2..17a28556c9 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -759,20 +759,25 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, continue; } if (strcmp(tokens[ti], "udp-encap") == 0) { - APP_CHECK(ips->type == - RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, - status, "UDP encapsulation is allowed if the " - "session is of type lookaside-protocol-offload " - "only."); - if (status->status < 0) - return; - APP_CHECK_PRESENCE(udp_encap_p, tokens[ti], status); - if (status->status < 0) - return; + switch (ips->type) { + case RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL: + case RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL: + APP_CHECK_PRESENCE(udp_encap_p, tokens[ti], + status); + if (status->status < 0) + return; - rule->udp_encap = 1; - app_sa_prm.udp_encap = 1; - udp_encap_p = 1; + rule->udp_encap = 1; + app_sa_prm.udp_encap = 1; + udp_encap_p = 1; + break; + default: + APP_CHECK(0, status, + "UDP encapsulation not supported for " + "security session type %d", + ips->type); + return; + } continue; }