From patchwork Wed Mar 18 13:26:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mariusz Drost X-Patchwork-Id: 66845 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C73D3A057B; Wed, 18 Mar 2020 14:29:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C1D1E1AFF; Wed, 18 Mar 2020 14:29:38 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 260B5FEB for ; Wed, 18 Mar 2020 14:29:36 +0100 (CET) IronPort-SDR: vuQlpL2ssaSw9EpQqfvrzsWW5vM1fU/pygAdL+uorZHxlNa1gTZ4NrHDA7ceIRiZ1uciRclQYM wGub0OsDZuYw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2020 06:29:35 -0700 IronPort-SDR: 91MP/BAsWAT4HMlzpEtbWM39PrrOOHujt/C5URTyR6fTwO8ikWLu/6lyRvITUxh5cKRu/wCWDH NtC6FP/y/JIw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,567,1574150400"; d="scan'208";a="263381982" Received: from mdrostx-mobl.ger.corp.intel.com ([10.104.125.79]) by orsmga002.jf.intel.com with ESMTP; 18 Mar 2020 06:29:33 -0700 From: Mariusz Drost To: radu.nicolau@intel.com, akhil.goyal@nxp.com Cc: dev@dpdk.org, Mariusz Drost Date: Wed, 18 Mar 2020 14:26:59 +0100 Message-Id: <20200318132659.1031-1-mariuszx.drost@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] examples/ipsec-secgw: enable cpu-crypto fallback X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Added cpu-crypto fallback option parsing as well as tests for it Signed-off-by: Mariusz Drost Tested-by: Konstantin Ananyev Acked-by: Konstantin Ananyev --- 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}" +