DPDK patches and discussions
 help / color / mirror / Atom feed
From: Mariusz Drost <mariuszx.drost@intel.com>
To: radu.nicolau@intel.com, akhil.goyal@nxp.com
Cc: dev@dpdk.org, Mariusz Drost <mariuszx.drost@intel.com>
Subject: [dpdk-dev] [PATCH] examples/ipsec-secgw: enable cpu-crypto fallback
Date: Wed, 18 Mar 2020 14:26:59 +0100	[thread overview]
Message-ID: <20200318132659.1031-1-mariuszx.drost@intel.com> (raw)

Added cpu-crypto fallback option parsing as well as tests for it

Signed-off-by: Mariusz Drost <mariuszx.drost@intel.com>
---
 examples/ipsec-secgw/sa.c                            |  6 ++++--
 examples/ipsec-secgw/test/common_defs.sh             | 12 ++++++++++++
 .../test/trs_aesgcm_inline_crypto_fallback_defs.sh   |  7 ++++++-
 .../test/tun_aesgcm_inline_crypto_fallback_defs.sh   |  7 ++++++-
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 4822d6bda..7c65f893a 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -669,9 +669,11 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens,
 			if (status->status < 0)
 				return;
 			fb = ipsec_get_fallback_session(rule);
-			if (strcmp(tokens[ti], "lookaside-none") == 0) {
+			if (strcmp(tokens[ti], "lookaside-none") == 0)
 				fb->type = RTE_SECURITY_ACTION_TYPE_NONE;
-			} else {
+			else if (strcmp(tokens[ti], "cpu-crypto") == 0)
+				fb->type = RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO;
+			else {
 				APP_CHECK(0, status, "unrecognized fallback "
 					"type %s.", tokens[ti]);
 				return;
diff --git a/examples/ipsec-secgw/test/common_defs.sh b/examples/ipsec-secgw/test/common_defs.sh
index 6b6ae06f3..35cdd1c55 100644
--- a/examples/ipsec-secgw/test/common_defs.sh
+++ b/examples/ipsec-secgw/test/common_defs.sh
@@ -51,6 +51,13 @@ select_mode()
 		SGW_CFG_XPRM="${SGW_CFG_XPRM} ${CRYPTO_PRIM_TYPE}"
 	fi
 
+	# check if fallback type is needed
+	if [[ "${MODE}" == *fallback* ]]; then
+		if [[ -n "${CRYPTO_FLBK_TYPE}" ]]; then
+			echo "${CRYPTO_FLBK_TYPE} is enabled"
+		fi
+	fi
+
 	#make linux to generate fragmented packets
 	if [[ -n "${MULTI_SEG_TEST}" && -n "${SGW_CMD_XPRM}" ]]; then
 		echo "multi-segment test is enabled"
@@ -58,6 +65,11 @@ select_mode()
 		PING_LEN=5000
 		MTU_LEN=1500
 	else
+		if [[ -z "${MULTI_SEG_TEST}" && "${MODE}" == *fallback* ]]; then
+			echo "MULTI_SEG_TEST environment variable needs to be \
+set for ${MODE} test"
+			exit 127
+		fi
 		PING_LEN=${DEF_PING_LEN}
 		MTU_LEN=${DEF_MTU_LEN}
 	fi
diff --git a/examples/ipsec-secgw/test/trs_aesgcm_inline_crypto_fallback_defs.sh b/examples/ipsec-secgw/test/trs_aesgcm_inline_crypto_fallback_defs.sh
index f21b01d63..4e2ac0ead 100644
--- a/examples/ipsec-secgw/test/trs_aesgcm_inline_crypto_fallback_defs.sh
+++ b/examples/ipsec-secgw/test/trs_aesgcm_inline_crypto_fallback_defs.sh
@@ -3,4 +3,9 @@
 
 . ${DIR}/trs_aesgcm_defs.sh
 
-SGW_CFG_XPRM_IN='port_id 0 type inline-crypto-offload fallback lookaside-none'
+if [[ -z "${CRYPTO_FLBK_TYPE}" ]]; then
+	CRYPTO_FLBK_TYPE="fallback lookaside-none"
+fi
+
+SGW_CFG_XPRM_IN="port_id 0 type inline-crypto-offload ${CRYPTO_FLBK_TYPE}"
+
diff --git a/examples/ipsec-secgw/test/tun_aesgcm_inline_crypto_fallback_defs.sh b/examples/ipsec-secgw/test/tun_aesgcm_inline_crypto_fallback_defs.sh
index 97b9431f4..d6bf40d83 100644
--- a/examples/ipsec-secgw/test/tun_aesgcm_inline_crypto_fallback_defs.sh
+++ b/examples/ipsec-secgw/test/tun_aesgcm_inline_crypto_fallback_defs.sh
@@ -3,4 +3,9 @@
 
 . ${DIR}/tun_aesgcm_defs.sh
 
-SGW_CFG_XPRM_IN='port_id 0 type inline-crypto-offload fallback lookaside-none'
+if [[ -z "${CRYPTO_FLBK_TYPE}" ]]; then
+	CRYPTO_FLBK_TYPE="fallback lookaside-none"
+fi
+
+SGW_CFG_XPRM_IN="port_id 0 type inline-crypto-offload ${CRYPTO_FLBK_TYPE}"
+
-- 
2.17.1


             reply	other threads:[~2020-03-18 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 13:26 Mariusz Drost [this message]
2020-03-23 12:47 ` Ananyev, Konstantin
2020-04-05 16:59   ` 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=20200318132659.1031-1-mariuszx.drost@intel.com \
    --to=mariuszx.drost@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --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 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).