DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] common/cnxk: add support for UDP encapsulation
@ 2021-07-13  7:42 Srujana Challa
  2021-07-13  7:42 ` [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: add UDP encapsulation for inline protocol Srujana Challa
  0 siblings, 1 reply; 5+ messages in thread
From: Srujana Challa @ 2021-07-13  7:42 UTC (permalink / raw)
  To: Akhil Goyal, Radu Nicolau
  Cc: Srujana Challa, Anoob Joseph, Nithin Kumar Dabilpuram,
	Tejasree Kondoj, dev

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: add UDP encapsulation for inline protocol
  2021-07-13  7:42 [dpdk-dev] [PATCH 1/2] common/cnxk: add support for UDP encapsulation Srujana Challa
@ 2021-07-13  7:42 ` Srujana Challa
  2021-07-18 10:33   ` Akhil Goyal
  0 siblings, 1 reply; 5+ messages in thread
From: Srujana Challa @ 2021-07-13  7:42 UTC (permalink / raw)
  To: Akhil Goyal, Radu Nicolau, Konstantin Ananyev
  Cc: Srujana Challa, Anoob Joseph, Nithin Kumar Dabilpuram,
	Tejasree Kondoj, dev

Adds support to allow udp-encap option for
RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL mode also.

Signed-off-by: Srujana Challa <schalla@marvell.com>
---
 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;
 		}
 
-- 
2.29.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: add UDP encapsulation for inline protocol
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Akhil Goyal @ 2021-07-18 10:33 UTC (permalink / raw)
  To: Srujana Challa, Radu Nicolau, Konstantin Ananyev
  Cc: Srujana Challa, Anoob Joseph, Nithin Kumar Dabilpuram,
	Tejasree Kondoj, dev

> Subject: [PATCH 2/2] examples/ipsec-secgw: add UDP encapsulation for
> inline protocol
> 
> Adds support to allow udp-encap option for
> RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL mode also.
> 
> Signed-off-by: Srujana Challa <schalla@marvell.com>
> ---
Acked-by: Akhil Goyal <gakhil@marvell.com>

@Konstantin Ananyev: Any comments on this patch?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: add UDP encapsulation for inline protocol
  2021-07-18 10:33   ` Akhil Goyal
@ 2021-07-19  9:32     ` Ananyev, Konstantin
  2021-07-19 19:30       ` Akhil Goyal
  0 siblings, 1 reply; 5+ messages in thread
From: Ananyev, Konstantin @ 2021-07-19  9:32 UTC (permalink / raw)
  To: Akhil Goyal, Srujana Challa, Nicolau, Radu
  Cc: Srujana Challa, Anoob Joseph, Nithin Kumar Dabilpuram,
	Tejasree Kondoj, dev


> 
> > Subject: [PATCH 2/2] examples/ipsec-secgw: add UDP encapsulation for
> > inline protocol
> >
> > Adds support to allow udp-encap option for
> > RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL mode also.
> >
> > Signed-off-by: Srujana Challa <schalla@marvell.com>
> > ---
> Acked-by: Akhil Goyal <gakhil@marvell.com>
> 
> @Konstantin Ananyev: Any comments on this patch?

No I don't have any, looks ok to me.
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: add UDP encapsulation for inline protocol
  2021-07-19  9:32     ` Ananyev, Konstantin
@ 2021-07-19 19:30       ` Akhil Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2021-07-19 19:30 UTC (permalink / raw)
  To: Ananyev, Konstantin, Srujana Challa, Nicolau, Radu
  Cc: Srujana Challa, Anoob Joseph, Nithin Kumar Dabilpuram,
	Tejasree Kondoj, dev

> >
> > > Subject: [PATCH 2/2] examples/ipsec-secgw: add UDP encapsulation for
> > > inline protocol
> > >
> > > Adds support to allow udp-encap option for
> > > RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL mode also.
> > >
> > > Signed-off-by: Srujana Challa <schalla@marvell.com>
> > > ---
> > Acked-by: Akhil Goyal <gakhil@marvell.com>
> >
> > @Konstantin Ananyev: Any comments on this patch?
> 
> No I don't have any, looks ok to me.
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Series Applied to dpdk-next-crypto

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-19 19:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13  7:42 [dpdk-dev] [PATCH 1/2] common/cnxk: add support for UDP encapsulation Srujana Challa
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).