examples/ipsec-secgw: enable CPU crypto fallback
authorMariusz Drost <mariuszx.drost@intel.com>
Wed, 18 Mar 2020 13:26:59 +0000 (14:26 +0100)
committerAkhil Goyal <akhil.goyal@oss.nxp.com>
Sun, 5 Apr 2020 16:38:51 +0000 (18:38 +0200)
Added cpu-crypto fallback option parsing as well as tests for it

Signed-off-by: Mariusz Drost <mariuszx.drost@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
examples/ipsec-secgw/sa.c
examples/ipsec-secgw/test/common_defs.sh
examples/ipsec-secgw/test/trs_aesgcm_inline_crypto_fallback_defs.sh
examples/ipsec-secgw/test/tun_aesgcm_inline_crypto_fallback_defs.sh

index 0eb52d1..a6bf5e8 100644 (file)
@@ -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;
index 6b6ae06..35cdd1c 100644 (file)
@@ -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
index f21b01d..c00a5ba 100644 (file)
@@ -3,4 +3,8 @@
 
 . ${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}"
index 97b9431..e098bd3 100644 (file)
@@ -3,4 +3,8 @@
 
 . ${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}"