From patchwork Tue Oct 4 12:55:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Power, Ciara" X-Patchwork-Id: 117314 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F64DA0543; Tue, 4 Oct 2022 14:55:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1244342B6C; Tue, 4 Oct 2022 14:55:28 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 6B64942B6C for ; Tue, 4 Oct 2022 14:55:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664888125; x=1696424125; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QduVm9gh1P1gQ46BT+AcTJwzDaM+Sgcr/Hj6BnYHYRk=; b=c+7gn7BKkOzhhPICjFg77ybxJPI2rebfCs9ZeHvP+D5ze7+Fcxwdb+he hllZpE4P4GrB/OnCE5Z1oEFxJCwv4aaHCfj0hPw/dgI+y6kAfJVs5gYVC 0r1+Wy0P1T55OnCNQ7SRxKldVBRUXN0T1ql8zzd2R9JrmyHYOabOjN5Ns MbnOrIj4N0OI+ZWkDDYKqSgaaqqooAeA9y1YCt2d9yZG0FlFzhjwnTdKZ EXstWOHCEhiwqH6eQPb5VlvS5Gg0Jl3GhhSg7ifp/a41fzwYFq22wGCsI jMActJI0Yqf5R+wgGV2nBjaiEPvy9jBZ4B95uhep0mHxAw3n8dW+rM1FO g==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="366996737" X-IronPort-AV: E=Sophos;i="5.93,157,1654585200"; d="scan'208";a="366996737" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2022 05:55:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="799106377" X-IronPort-AV: E=Sophos;i="5.93,157,1654585200"; d="scan'208";a="799106377" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.163]) by orsmga005.jf.intel.com with ESMTP; 04 Oct 2022 05:55:22 -0700 From: Ciara Power To: Akhil Goyal , Fan Zhang , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin Cc: dev@dpdk.org, kai.ji@intel.com, pablo.de.lara.guarch@intel.com, Ciara Power , Fan Zhang Subject: [PATCH v4 5/5] test/crypto: add remaining blockcipher SGL tests Date: Tue, 4 Oct 2022 12:55:05 +0000 Message-Id: <20221004125505.677795-6-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221004125505.677795-1-ciara.power@intel.com> References: <20220812132334.75707-1-ciara.power@intel.com> <20221004125505.677795-1-ciara.power@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The current blockcipher test function only has support for two types of SGL test, INPLACE or OOP_SGL_IN_LB_OUT. These types are hardcoded into the function, with the number of segments always set to 3. To ensure all SGL types are tested, blockcipher test vectors now have fields to specify SGL type, and the number of segments. If these fields are missing, the previous defaults are used, either INPLACE or OOP_SGL_IN_LB_OUT, with 3 segments. Some AES and Hash vectors are modified to use these new fields, and new AES tests are added to test the SGL types that were not previously being tested. Signed-off-by: Ciara Power Acked-by: Fan Zhang Acked-by: Pablo de Lara --- app/test/test_cryptodev_aes_test_vectors.h | 345 +++++++++++++++++--- app/test/test_cryptodev_blockcipher.c | 50 +-- app/test/test_cryptodev_blockcipher.h | 2 + app/test/test_cryptodev_hash_test_vectors.h | 8 +- 4 files changed, 335 insertions(+), 70 deletions(-) diff --git a/app/test/test_cryptodev_aes_test_vectors.h b/app/test/test_cryptodev_aes_test_vectors.h index a797af1b00..2c1875d3d9 100644 --- a/app/test/test_cryptodev_aes_test_vectors.h +++ b/app/test/test_cryptodev_aes_test_vectors.h @@ -4163,12 +4163,44 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { }, { .test_descr = "AES-192-CTR XCBC Decryption Digest Verify " - "Scatter Gather", + "Scatter Gather (Inplace)", + .test_data = &aes_test_data_2, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 + }, + { + .test_descr = "AES-192-CTR XCBC Decryption Digest Verify " + "Scatter Gather OOP (SGL in SGL out)", + .test_data = &aes_test_data_2, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-192-CTR XCBC Decryption Digest Verify " + "Scatter Gather OOP (LB in SGL out)", .test_data = &aes_test_data_2, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT, + .sgl_segs = 3 }, + { + .test_descr = "AES-192-CTR XCBC Decryption Digest Verify " + "Scatter Gather OOP (SGL in LB out)", + .test_data = &aes_test_data_2, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 + }, + { .test_descr = "AES-256-CTR HMAC-SHA1 Encryption Digest", .test_data = &aes_test_data_3, @@ -4193,11 +4225,52 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { }, { .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest " - "Scatter Gather", + "Scatter Gather (Inplace)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest " + "Scatter Gather OOP (SGL in SGL out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest " + "Scatter Gather OOP 16 segs (SGL in SGL out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 16 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest " + "Scatter Gather OOP (LB in SGL out)", .test_data = &aes_test_data_4, .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest " + "Scatter Gather OOP (SGL in LB out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " @@ -4207,10 +4280,52 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " - "Verify Scatter Gather", + "Verify Scatter Gather (Inplace)", .test_data = &aes_test_data_4, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " + "Verify Scatter Gather OOP (SGL in SGL out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " + "Verify Scatter Gather OOP 16 segs (SGL in SGL out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 16 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " + "Verify Scatter Gather OOP (LB in SGL out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " + "Verify Scatter Gather OOP (SGL in LB out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " @@ -4255,12 +4370,46 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { }, { .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest " - "Scatter Gather Sessionless", + "Scatter Gather Sessionless (Inplace)", + .test_data = &aes_test_data_6, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SESSIONLESS | + BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest " + "Scatter Gather Sessionless OOP (SGL in SGL out)", + .test_data = &aes_test_data_6, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SESSIONLESS | + BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest " + "Scatter Gather Sessionless OOP (LB in SGL out)", + .test_data = &aes_test_data_6, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SESSIONLESS | + BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest " + "Scatter Gather Sessionless OOP (SGL in LB out)", .test_data = &aes_test_data_6, .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SESSIONLESS | BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest " @@ -4270,11 +4419,42 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { }, { .test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest " - "Verify Scatter Gather", + "Verify Scatter Gather (Inplace)", + .test_data = &aes_test_data_6, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 2 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest " + "Verify Scatter Gather OOP (SGL in SGL out)", .test_data = &aes_test_data_6, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest " + "Verify Scatter Gather OOP (LB in SGL out)", + .test_data = &aes_test_data_6, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest " + "Verify Scatter Gather OOP (SGL in LB out)", + .test_data = &aes_test_data_6, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "AES-128-CBC XCBC Encryption Digest", @@ -4358,6 +4538,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN_ENC, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_DIGEST_ENCRYPTED, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 }, { .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest " @@ -4382,6 +4564,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_SESSIONLESS | BLOCKCIPHER_TEST_FEATURE_DIGEST_ENCRYPTED, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " @@ -4397,6 +4581,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_DEC_AUTH_VERIFY, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_DIGEST_ENCRYPTED, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " @@ -4421,6 +4607,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { .feature_mask = BLOCKCIPHER_TEST_FEATURE_SESSIONLESS | BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_DIGEST_ENCRYPTED, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 }, { .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest " @@ -4504,6 +4692,41 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { .test_data = &aes_test_data_4, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, }, + { + .test_descr = "AES-128-CBC Encryption Scatter gather (Inplace)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC Encryption Scatter gather OOP (SGL in SGL out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC Encryption Scatter gather OOP (LB in SGL out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-128-CBC Encryption Scatter gather OOP (SGL in LB out)", + .test_data = &aes_test_data_4, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 + }, { .test_descr = "AES-128-CBC Decryption", .test_data = &aes_test_data_4, @@ -4515,11 +4738,39 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, }, { - .test_descr = "AES-192-CBC Encryption Scatter gather", + .test_descr = "AES-192-CBC Encryption Scatter gather (Inplace)", + .test_data = &aes_test_data_10, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 + }, + { + .test_descr = "AES-192-CBC Encryption Scatter gather OOP (SGL in SGL out)", .test_data = &aes_test_data_10, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-192-CBC Encryption Scatter gather OOP (LB in SGL out)", + .test_data = &aes_test_data_10, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-192-CBC Encryption Scatter gather OOP (SGL in LB out)", + .test_data = &aes_test_data_10, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "AES-192-CBC Decryption", @@ -4527,10 +4778,39 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, }, { - .test_descr = "AES-192-CBC Decryption Scatter Gather", + .test_descr = "AES-192-CBC Decryption Scatter Gather (Inplace)", .test_data = &aes_test_data_10, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 + }, + { + .test_descr = "AES-192-CBC Decryption Scatter Gather OOP (SGL in SGL out)", + .test_data = &aes_test_data_10, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-192-CBC Decryption Scatter Gather OOP (LB in SGL out)", + .test_data = &aes_test_data_10, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT, + .sgl_segs = 3 + }, + { + .test_descr = "AES-192-CBC Decryption Scatter Gather OOP (SGL in LB out)", + .test_data = &aes_test_data_10, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG | + BLOCKCIPHER_TEST_FEATURE_OOP, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "AES-256-CBC Encryption", @@ -4689,67 +4969,42 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { }, { .test_descr = "AES-256-XTS Encryption (512-byte plaintext" - " Dataunit 512) Scater gather OOP", + " Dataunit 512) Scatter gather OOP (SGL in LB out)", .test_data = &aes_test_data_xts_wrapped_key_48_pt_512_du_512, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, - .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP | - BLOCKCIPHER_TEST_FEATURE_SG, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "AES-256-XTS Decryption (512-byte plaintext" - " Dataunit 512) Scater gather OOP", + " Dataunit 512) Scatter gather OOP (SGL in LB out)", .test_data = &aes_test_data_xts_wrapped_key_48_pt_512_du_512, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP | BLOCKCIPHER_TEST_FEATURE_SG, - }, - { - .test_descr = "AES-256-XTS Encryption (512-byte plaintext" - " Dataunit 0) Scater gather OOP", - .test_data = &aes_test_data_xts_wrapped_key_48_pt_512_du_0, - .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, - .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP | - BLOCKCIPHER_TEST_FEATURE_SG, - }, - { - .test_descr = "AES-256-XTS Decryption (512-byte plaintext" - " Dataunit 0) Scater gather OOP", - .test_data = &aes_test_data_xts_wrapped_key_48_pt_512_du_0, - .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, - .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP | - BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "AES-256-XTS Encryption (4096-byte plaintext" - " Dataunit 4096) Scater gather OOP", + " Dataunit 4096) Scatter gather OOP (SGL in LB out)", .test_data = &aes_test_data_xts_wrapped_key_48_pt_4096_du_4096, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP | BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "AES-256-XTS Decryption (4096-byte plaintext" - " Dataunit 4096) Scater gather OOP", + " Dataunit 4096) Scatter gather OOP (SGL in LB out)", .test_data = &aes_test_data_xts_wrapped_key_48_pt_4096_du_4096, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP | BLOCKCIPHER_TEST_FEATURE_SG, - }, - { - .test_descr = "AES-256-XTS Encryption (4096-byte plaintext" - " Dataunit 0) Scater gather OOP", - .test_data = &aes_test_data_xts_wrapped_key_48_pt_4096_du_0, - .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, - .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP | - BLOCKCIPHER_TEST_FEATURE_SG, - }, - { - .test_descr = "AES-256-XTS Decryption (4096-byte plaintext" - " Dataunit 0) Scater gather OOP", - .test_data = &aes_test_data_xts_wrapped_key_48_pt_4096_du_0, - .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, - .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP | - BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT, + .sgl_segs = 3 }, { .test_descr = "cipher-only - NULL algo - x8 - encryption", diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c index b5813b956f..f1ef0b606f 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -96,7 +96,9 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, uint8_t tmp_dst_buf[MBUF_SIZE]; uint32_t pad_len; - int nb_segs = 1; + int nb_segs_in = 1; + int nb_segs_out = 1; + uint64_t sgl_type = t->sgl_flag; uint32_t nb_iterates = 0; rte_cryptodev_info_get(dev_id, &dev_info); @@ -121,30 +123,31 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, } } if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) { - uint64_t oop_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT; + if (sgl_type == 0) { + if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) + sgl_type = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT; + else + sgl_type = RTE_CRYPTODEV_FF_IN_PLACE_SGL; + } - if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) { - if (!(feat_flags & oop_flag)) { - printf("Device doesn't support out-of-place " - "scatter-gather in input mbuf. " - "Test Skipped.\n"); - snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, - "SKIPPED"); - return TEST_SKIPPED; - } - } else { - if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) { - printf("Device doesn't support in-place " - "scatter-gather mbufs. " - "Test Skipped.\n"); - snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, - "SKIPPED"); - return TEST_SKIPPED; - } + if (!(feat_flags & sgl_type)) { + printf("Device doesn't support scatter-gather type." + " Test Skipped.\n"); + snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, + "SKIPPED"); + return TEST_SKIPPED; } - nb_segs = 3; + if (sgl_type == RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT || + sgl_type == RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT || + sgl_type == RTE_CRYPTODEV_FF_IN_PLACE_SGL) + nb_segs_in = t->sgl_segs == 0 ? 3 : t->sgl_segs; + + if (sgl_type == RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT || + sgl_type == RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT) + nb_segs_out = t->sgl_segs == 0 ? 3 : t->sgl_segs; } + if (!!(feat_flags & RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY) ^ tdata->wrapped_key) { snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, @@ -207,7 +210,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, /* for contiguous mbuf, nb_segs is 1 */ ibuf = create_segmented_mbuf(mbuf_pool, - tdata->ciphertext.len, nb_segs, src_pattern); + tdata->ciphertext.len, nb_segs_in, src_pattern); if (ibuf == NULL) { snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u FAILED: %s", @@ -256,7 +259,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, } if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) { - obuf = rte_pktmbuf_alloc(mbuf_pool); + obuf = create_segmented_mbuf(mbuf_pool, + tdata->ciphertext.len, nb_segs_out, dst_pattern); if (!obuf) { snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u " "FAILED: %s", __LINE__, diff --git a/app/test/test_cryptodev_blockcipher.h b/app/test/test_cryptodev_blockcipher.h index 84f5d57787..bad93a5ec1 100644 --- a/app/test/test_cryptodev_blockcipher.h +++ b/app/test/test_cryptodev_blockcipher.h @@ -57,6 +57,8 @@ struct blockcipher_test_case { const struct blockcipher_test_data *test_data; uint8_t op_mask; /* operation mask */ uint8_t feature_mask; + uint64_t sgl_flag; + uint8_t sgl_segs; }; struct blockcipher_test_data { diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index 5bd7858de4..62602310b2 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -467,10 +467,12 @@ static const struct blockcipher_test_case hash_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, }, { - .test_descr = "HMAC-SHA1 Digest Scatter Gather", + .test_descr = "HMAC-SHA1 Digest Scatter Gather (Inplace)", .test_data = &hmac_sha1_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 }, { .test_descr = "HMAC-SHA1 Digest Verify", @@ -478,10 +480,12 @@ static const struct blockcipher_test_case hash_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, }, { - .test_descr = "HMAC-SHA1 Digest Verify Scatter Gather", + .test_descr = "HMAC-SHA1 Digest Verify Scatter Gather (Inplace)", .test_data = &hmac_sha1_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, .feature_mask = BLOCKCIPHER_TEST_FEATURE_SG, + .sgl_flag = RTE_CRYPTODEV_FF_IN_PLACE_SGL, + .sgl_segs = 3 }, { .test_descr = "SHA224 Digest",