DPDK patches and discussions
 help / color / mirror / Atom feed
From: Radu Nicolau <radu.nicolau@intel.com>
To: Radu Nicolau <radu.nicolau@intel.com>, Akhil Goyal <gakhil@marvell.com>
Cc: dev@dpdk.org, roy.fan.zhang@intel.com,
	vladimir.medvedkin@intel.com, vfialko@marvell.com
Subject: [PATCH v2] examples/ipsec-secgw: fix fallback session create
Date: Thu, 30 Jun 2022 12:45:27 +0100	[thread overview]
Message-ID: <20220630114527.2392332-1-radu.nicolau@intel.com> (raw)
In-Reply-To: <20220630100010.2364032-1-radu.nicolau@intel.com>

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


  reply	other threads:[~2022-06-30 11:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 10:00 [PATCH] " Radu Nicolau
2022-06-30 11:45 ` Radu Nicolau [this message]
2022-06-30 16:22   ` [PATCH v2] " Medvedkin, Vladimir
2022-07-01 19:12     ` [EXT] " 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=20220630114527.2392332-1-radu.nicolau@intel.com \
    --to=radu.nicolau@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=vfialko@marvell.com \
    --cc=vladimir.medvedkin@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 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).