All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srujana Challa <schalla@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>, Radu Nicolau <radu.nicolau@intel.com>
Cc: Srujana Challa <schalla@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>,
	Tejasree Kondoj <ktejasree@marvell.com>, <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/2] common/cnxk: add support for UDP encapsulation
Date: Tue, 13 Jul 2021 13:12:17 +0530	[thread overview]
Message-ID: <20210713074219.6804-1-schalla@marvell.com> (raw)

Adds support for UDP encapsulation in crypto_cn10k
PMD.

Signed-off-by: Srujana Challa <schalla@marvell.com>
---
 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 <rte_udp.h>
+
 #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')
-- 
2.29.0


             reply	other threads:[~2021-07-13  7:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13  7:42 Srujana Challa [this message]
2021-07-13  7:42 ` [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: add UDP encapsulation for inline protocol Srujana Challa
2021-07-18 10:33   ` Akhil Goyal
2021-07-19  9:32     ` Ananyev, Konstantin
2021-07-19 19:30       ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210713074219.6804-1-schalla@marvell.com \
    --to=schalla@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=ktejasree@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=radu.nicolau@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.