DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] examples/ipsec-secgw: fix fallback session create
@ 2022-06-30 10:00 Radu Nicolau
  2022-06-30 11:45 ` [PATCH v2] " Radu Nicolau
  0 siblings, 1 reply; 4+ messages in thread
From: Radu Nicolau @ 2022-06-30 10:00 UTC (permalink / raw)
  To: Radu Nicolau, Akhil Goyal; +Cc: dev, roy.fan.zhang, vladimir.medvedkin, vfialko

Fix fallback session create for inline sessions.

Fixes: a8ade12123c3 ("examples/ipsec-secgw: create lookaside sessions at init")
Cc: vfialko@marvell.com

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 examples/ipsec-secgw/sa.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 5d9cec97db..f62b88ca23 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -1522,9 +1522,11 @@ fill_ipsec_session(struct rte_ipsec_session *ss, struct rte_ipsec_sa *sa)
 
 	ss->sa = sa;
 
-	rc = rte_ipsec_session_prepare(ss);
-	if (rc != 0)
-		memset(ss, 0, sizeof(*ss));
+	if (ss->security.ses != NULL) {
+		rc = rte_ipsec_session_prepare(ss);
+		if (rc != 0)
+			memset(ss, 0, sizeof(*ss));
+	}
 
 	return rc;
 }
-- 
2.25.1


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

* [PATCH v2] examples/ipsec-secgw: fix fallback session create
  2022-06-30 10:00 [PATCH] examples/ipsec-secgw: fix fallback session create Radu Nicolau
@ 2022-06-30 11:45 ` Radu Nicolau
  2022-06-30 16:22   ` Medvedkin, Vladimir
  0 siblings, 1 reply; 4+ messages in thread
From: Radu Nicolau @ 2022-06-30 11:45 UTC (permalink / raw)
  To: Radu Nicolau, Akhil Goyal; +Cc: dev, roy.fan.zhang, vladimir.medvedkin, vfialko

Fix fallback session create for inline sessions.

Fixes: a8ade12123c3 ("examples/ipsec-secgw: create lookaside sessions at init")
Cc: vfialko@marvell.com

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
v2: create the session rather than just check if it's NULLL

 examples/ipsec-secgw/sa.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 5d9cec97db..d081cd0e2c 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -1533,7 +1533,8 @@ fill_ipsec_session(struct rte_ipsec_session *ss, struct rte_ipsec_sa *sa)
  * Initialise related rte_ipsec_sa object.
  */
 static int
-ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size)
+ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size,
+		struct socket_ctx *skt_ctx, struct ipsec_ctx *ips_ctx[])
 {
 	int rc;
 	struct rte_ipsec_sa_prm prm;
@@ -1572,8 +1573,15 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size)
 		return rc;
 
 	/* init inline fallback processing session */
-	if (lsa->fallback_sessions == 1)
-		rc = fill_ipsec_session(ipsec_get_fallback_session(lsa), sa);
+	if (lsa->fallback_sessions == 1) {
+		struct rte_ipsec_session *ipfs = ipsec_get_fallback_session(lsa);
+		if (ipfs->security.ses == NULL) {
+			rc = create_lookaside_session(ips_ctx, skt_ctx, lsa, ipfs);
+			if (rc != 0)
+				return rc;
+		}
+		rc = fill_ipsec_session(ipfs, sa);
+	}
 
 	return rc;
 }
@@ -1583,7 +1591,8 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size)
  * one per session.
  */
 static int
-ipsec_satbl_init(struct sa_ctx *ctx, uint32_t nb_ent, int32_t socket)
+ipsec_satbl_init(struct sa_ctx *ctx, uint32_t nb_ent, int32_t socket,
+		struct socket_ctx *skt_ctx, struct ipsec_ctx *ips_ctx[])
 {
 	int32_t rc, sz;
 	uint32_t i, idx;
@@ -1621,7 +1630,7 @@ ipsec_satbl_init(struct sa_ctx *ctx, uint32_t nb_ent, int32_t socket)
 		sa = (struct rte_ipsec_sa *)((uintptr_t)ctx->satbl + sz * i);
 		lsa = ctx->sa + idx;
 
-		rc = ipsec_sa_init(lsa, sa, sz);
+		rc = ipsec_sa_init(lsa, sa, sz, skt_ctx, ips_ctx);
 	}
 
 	return rc;
@@ -1700,7 +1709,7 @@ sa_init(struct socket_ctx *ctx, int32_t socket_id,
 
 		if (app_sa_prm.enable != 0) {
 			rc = ipsec_satbl_init(ctx->sa_in, nb_sa_in,
-				socket_id);
+				socket_id, ctx, ipsec_ctx);
 			if (rc != 0)
 				rte_exit(EXIT_FAILURE,
 					"failed to init inbound SAs\n");
@@ -1722,7 +1731,7 @@ sa_init(struct socket_ctx *ctx, int32_t socket_id,
 
 		if (app_sa_prm.enable != 0) {
 			rc = ipsec_satbl_init(ctx->sa_out, nb_sa_out,
-				socket_id);
+				socket_id, ctx, ipsec_ctx);
 			if (rc != 0)
 				rte_exit(EXIT_FAILURE,
 					"failed to init outbound SAs\n");
-- 
2.25.1


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

* Re: [PATCH v2] examples/ipsec-secgw: fix fallback session create
  2022-06-30 11:45 ` [PATCH v2] " Radu Nicolau
@ 2022-06-30 16:22   ` Medvedkin, Vladimir
  2022-07-01 19:12     ` [EXT] " Akhil Goyal
  0 siblings, 1 reply; 4+ messages in thread
From: Medvedkin, Vladimir @ 2022-06-30 16:22 UTC (permalink / raw)
  To: Radu Nicolau, Akhil Goyal; +Cc: dev, roy.fan.zhang, vfialko

Tested-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

On 30/06/2022 12:45, Radu Nicolau wrote:
> Fix fallback session create for inline sessions.
>
> Fixes: a8ade12123c3 ("examples/ipsec-secgw: create lookaside sessions at init")
> Cc: vfialko@marvell.com
>
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
> v2: create the session rather than just check if it's NULLL
>
>   examples/ipsec-secgw/sa.c | 23 ++++++++++++++++-------
>   1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
> index 5d9cec97db..d081cd0e2c 100644
> --- a/examples/ipsec-secgw/sa.c
> +++ b/examples/ipsec-secgw/sa.c
> @@ -1533,7 +1533,8 @@ fill_ipsec_session(struct rte_ipsec_session *ss, struct rte_ipsec_sa *sa)
>    * Initialise related rte_ipsec_sa object.
>    */
>   static int
> -ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size)
> +ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size,
> +		struct socket_ctx *skt_ctx, struct ipsec_ctx *ips_ctx[])
>   {
>   	int rc;
>   	struct rte_ipsec_sa_prm prm;
> @@ -1572,8 +1573,15 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size)
>   		return rc;
>   
>   	/* init inline fallback processing session */
> -	if (lsa->fallback_sessions == 1)
> -		rc = fill_ipsec_session(ipsec_get_fallback_session(lsa), sa);
> +	if (lsa->fallback_sessions == 1) {
> +		struct rte_ipsec_session *ipfs = ipsec_get_fallback_session(lsa);
> +		if (ipfs->security.ses == NULL) {
> +			rc = create_lookaside_session(ips_ctx, skt_ctx, lsa, ipfs);
> +			if (rc != 0)
> +				return rc;
> +		}
> +		rc = fill_ipsec_session(ipfs, sa);
> +	}
>   
>   	return rc;
>   }
> @@ -1583,7 +1591,8 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size)
>    * one per session.
>    */
>   static int
> -ipsec_satbl_init(struct sa_ctx *ctx, uint32_t nb_ent, int32_t socket)
> +ipsec_satbl_init(struct sa_ctx *ctx, uint32_t nb_ent, int32_t socket,
> +		struct socket_ctx *skt_ctx, struct ipsec_ctx *ips_ctx[])
>   {
>   	int32_t rc, sz;
>   	uint32_t i, idx;
> @@ -1621,7 +1630,7 @@ ipsec_satbl_init(struct sa_ctx *ctx, uint32_t nb_ent, int32_t socket)
>   		sa = (struct rte_ipsec_sa *)((uintptr_t)ctx->satbl + sz * i);
>   		lsa = ctx->sa + idx;
>   
> -		rc = ipsec_sa_init(lsa, sa, sz);
> +		rc = ipsec_sa_init(lsa, sa, sz, skt_ctx, ips_ctx);
>   	}
>   
>   	return rc;
> @@ -1700,7 +1709,7 @@ sa_init(struct socket_ctx *ctx, int32_t socket_id,
>   
>   		if (app_sa_prm.enable != 0) {
>   			rc = ipsec_satbl_init(ctx->sa_in, nb_sa_in,
> -				socket_id);
> +				socket_id, ctx, ipsec_ctx);
>   			if (rc != 0)
>   				rte_exit(EXIT_FAILURE,
>   					"failed to init inbound SAs\n");
> @@ -1722,7 +1731,7 @@ sa_init(struct socket_ctx *ctx, int32_t socket_id,
>   
>   		if (app_sa_prm.enable != 0) {
>   			rc = ipsec_satbl_init(ctx->sa_out, nb_sa_out,
> -				socket_id);
> +				socket_id, ctx, ipsec_ctx);
>   			if (rc != 0)
>   				rte_exit(EXIT_FAILURE,
>   					"failed to init outbound SAs\n");

-- 
Regards,
Vladimir


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

* RE: [EXT] Re: [PATCH v2] examples/ipsec-secgw: fix fallback session create
  2022-06-30 16:22   ` Medvedkin, Vladimir
@ 2022-07-01 19:12     ` Akhil Goyal
  0 siblings, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2022-07-01 19:12 UTC (permalink / raw)
  To: Medvedkin, Vladimir, Radu Nicolau; +Cc: dev, roy.fan.zhang, Volodymyr Fialko

> Tested-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> 
> On 30/06/2022 12:45, Radu Nicolau wrote:
> > Fix fallback session create for inline sessions.
> >
> > Fixes: a8ade12123c3 ("examples/ipsec-secgw: create lookaside sessions at
> init")
> > Cc: vfialko@marvell.com
> >
> > Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>

Applied to dpdk-next-crypto

Thanks.

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

end of thread, other threads:[~2022-07-01 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 10:00 [PATCH] examples/ipsec-secgw: fix fallback session create Radu Nicolau
2022-06-30 11:45 ` [PATCH v2] " Radu Nicolau
2022-06-30 16:22   ` Medvedkin, Vladimir
2022-07-01 19:12     ` [EXT] " 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).