From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0165AA0547; Sun, 17 Oct 2021 18:23:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8437C4114D; Sun, 17 Oct 2021 18:21:58 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80081.outbound.protection.outlook.com [40.107.8.81]) by mails.dpdk.org (Postfix) with ESMTP id 6FA4641162 for ; Sun, 17 Oct 2021 18:21:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ap3TO6jZ+Po1uSf3r+yWp8KUFQpiF9kbA7SJ0Gz9FRyngd/nhp0x8I+8+I/JxwHxgfcKrEcurFW6KBKQ2SoM4XtWAgEGeSd/Fv5GhofLU2dPaFzfn5rMhPTDDW0qJuzaqAUL2OhGPQ05i1QgsJzCgcGOKYDo4Kr/wgV9G/4DqPTPw2dU+dt1rMQH8HxXWibBg9uG8tR2abi6amkwDrp9us764MPu335KMQc/z0a+MMRxUMdNsNbQCxWJKkqRsCqT6s//7JWgbXipk4oma1HijLe55c3KuEToYGuT+RafrDed6jTKZh7PVMr+SInRd58VVQpO2Y00OqQ8A0zNLQyMZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W2YLv0uyxyAbQiTeTxMq6ywrj909iVkIJSNzqNanqK8=; b=l+f4A70RaGsK2+oTyqKop/BucRIdh+yzjcD6NlX539GmWfXnC+/4YAg3vBtsmhK3ghdz1L2ulfia+vgDv//2kuuaUO5RcsdsaoA8u/ST6TxSMvhIGSlTpffTNZH1m6KF+LYk3/7xLmTsrIUC2SqJ/5H+BjKT46eeODybePcEEwa8oCxbC23wy3gBzYeUzElTTxi9TAo15Llkotnp6IkpFPnTYC/XndsdYqM4bMgIMa3j7BjE9UmwsYiNjVEBRGZ+E++YwgKbehNlnV1jXlmzKw8bZePHuSN2m1LPYFbmyVW1SocbpwNp33pHJUOdZCSEksIuCmZJYsCFSY+8SUNLmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W2YLv0uyxyAbQiTeTxMq6ywrj909iVkIJSNzqNanqK8=; b=i90VsEqpFMClqYepeUeiOoqqci8WfgGy0d1HWAvUj1DTe/UpIDQyePzOSoLx62v+59zeZXipXA5jg+YTXbQkm5W4MOrFpxQ4huWB/k7vDWkyX3SuhcMZZqr0vCCiMVPuRlfscscdvC30TS2VAerfyKxiGl+jWKxvevoG927ySSs= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8615.eurprd04.prod.outlook.com (2603:10a6:10:2da::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Sun, 17 Oct 2021 16:21:54 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80%3]) with mapi id 15.20.4608.018; Sun, 17 Oct 2021 16:21:54 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Sun, 17 Oct 2021 21:46:50 +0530 Message-Id: <20211017161651.9220-15-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211017161651.9220-1-hemant.agrawal@nxp.com> References: <20211013190032.2308-1-hemant.agrawal@nxp.com> <20211017161651.9220-1-hemant.agrawal@nxp.com> Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0053.apcprd01.prod.exchangelabs.com (2603:1096:4:193::7) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SI2PR01CA0053.apcprd01.prod.exchangelabs.com (2603:1096:4:193::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Sun, 17 Oct 2021 16:21:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0edc318f-4d99-49bc-0092-08d9918a3bc9 X-MS-TrafficTypeDiagnostic: DU2PR04MB8615: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:469; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rwvpA23AqGiDRT53mW99fpQiy6EblyVdMwdsJ3rYas0dshaIQAYNYnGYutcKqthCj2h43KlxVuFzWcN95LU9mTcJScuR3Q64O01qOAcUykSfn4X/18KcXAZP5jhI2z356BY93m9XYPF9h+eHJ9If63t8LvCfILPTnG3sndqiQ4Sldwwv+XfIl9br48RupJN0TLoRCtjhUX1eNYD18P2QbuxyMOvlk1diC1upFMwo/dK30bHUgHMZyEvfdBri0OeVUkpPjkhIFYu3Y9XD9l/hAeNxaHtzXd3xcIPO4McJ3QWOuzCcq8/GUhHU4TrhtdJ7OlxjCe4eGK5vD8K73Rb+Yej1jmQihLdvqS54D7DTgxBzcCTlBeu8MRNrXZSsuvQzdnrxx/AWwPl2F1URKcawGxuIF8W01mHJEjVoBl/xoiozgU7wUL775pg6Onb0+a7/Xjx+2956g5MmlTgRw2gx5uK985Cz14RknSNHObIGbLwT5xP9B5AAuoPSkZojKScjsfmfL1Vwd+LudkvIiM3u2D7FyirxA2DayNi8xrPam4AvVhcKAQI0Tt1ncd1j+Yf/qw80tUXvzSWVLcqJh1apmeQKywu3x7HXxQx2lP+9phToX27eFe2Vk1o8zGE+t71GIERoY1ahBTE+8rTFTFR+kxxAPWJEHjUl1jAG7n7bQjRiFFC1VvT8Sy3k4CPRbxYMUVDG0jIRLW4J3c62GnVeYA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6486002)(66476007)(8936002)(66556008)(66946007)(86362001)(52116002)(36756003)(5660300002)(38350700002)(8676002)(38100700002)(508600001)(6506007)(26005)(44832011)(4326008)(6512007)(2616005)(83380400001)(1076003)(2906002)(316002)(186003)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0BtTq2MVU5gVsEqbNnYDp9MSFtCLwxG7Vekn+lO8cHhv05UMIId4esi6A/mW?= =?us-ascii?Q?fljF7G8q9GFSBH5vk4QAcPPFFq9elpcxaZCfu7wXr7G4Uc3M19zKwz63Bxok?= =?us-ascii?Q?E4ZnhyWA8iKCyswc7UeEGxk2SQALnCgtobGWLvjN6AUTa/Om7TpoYoBz3dW+?= =?us-ascii?Q?R0VJgghI8w8ET1AlyXffV/l8D4nxVKfbUAotz6P3z90kNrDbN8JrXmYAcOAC?= =?us-ascii?Q?5eQULgCiuWDh8Lglvj1MYpwWm+3/+AbLTC+/L0vfwe6lgqopE2sphGRa3gFn?= =?us-ascii?Q?KiGIHdBK7RBbV7NywYb/el6nErPYcCexpMtJNOVcUvVPIXeCQhROz4CvKgUB?= =?us-ascii?Q?WXu36JA6H13qo+ZvzmXkyXB3O0CgFdWEvqbk3596LuWmJ5wXelxbuB10BLdl?= =?us-ascii?Q?syxI6fmFrJCQ1iIABUPywwi1CAii5gUvrSD8mko2CWH8gnwi/S8QvQn+b6Ml?= =?us-ascii?Q?fSYSNZJyekE1BhPXHrbbbfj4D68DdTBFkj08Et3EdnjCbCn9DlpRPA1BJ08V?= =?us-ascii?Q?kuN08bUzrpa4sKPau3TSK/e2+LbTOLYk6WEaYQlFtbo3HIMInQRCrXjbufj6?= =?us-ascii?Q?re/mdzkoWmNrb+NDwe9UgCmn/cf3TyHXDpfElrle0LmNN6rPwlDJpI84hghr?= =?us-ascii?Q?hoZd2UZBOCWSvLEseOFALTsGiG2BwspiKCI760CO2kG61nOKceaFQFQLIK/v?= =?us-ascii?Q?97etqm6eIwVdyP461xEaFHAvFYY8N3+dR177vVwhOT74o7sey/qXR6Y5DGUB?= =?us-ascii?Q?3v9Y7DOeIPng24GSMwlsnMYOIT+ld/kMqyNLB/OmJGJik6boRI2fFectYPix?= =?us-ascii?Q?BtTKJot/b/H02h8UV49ErIbn1rxPoYYj1gvNItwRJKMwKTKmO+BAtqH0YAk4?= =?us-ascii?Q?99Oy+1vUQsXuYuJgBj8F6ev/oSGTZJsxcGPzj+yDBoVJz09Rlbqp/++4ON8g?= =?us-ascii?Q?+geWKbRy07SMQl1ege6ivHLF93Tvgk8+yiWUwKdUA874N4S57IebZcEAdUxO?= =?us-ascii?Q?Aoir8wth2GmMuiwIJ7LKu6y2Dk0gq/MaTg7C/w6v3mjs00wX2csseHGSyHRJ?= =?us-ascii?Q?yWx+JqCyrkVKwP9pSLbbhWESctPXHLrHqSEbd2ygis0QDmBf/ECvAwzmWWTv?= =?us-ascii?Q?eoob2PgK45yi20tLYvx83NTLdN9A6/JSp1UyeLmHapiqBUdiYGkmg2LIcRLH?= =?us-ascii?Q?PBT/fH+/EkeGNwlnljSph88S+U4laq82gcHyGgvQvHgNVg3vxNTZeK2g+U8J?= =?us-ascii?Q?pALTwuxO9aR1e8FdnIiUZO1guUhk3a/Qifi+hoTeLk2tdbvufJSZNPEmoTM2?= =?us-ascii?Q?kU+BMIUmtX5D7ILFc2NWMsC+?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0edc318f-4d99-49bc-0092-08d9918a3bc9 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2021 16:21:54.5931 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IVpXxVzwcc9XiwjB4rPDRXUS4sSkT8dCCwZv5f3qrQBlz2Z8d5df2r8UpADLI0FLRa6DxO48pgFQk1BjEIR7CA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8615 Subject: [dpdk-dev] [PATCH v5 14/15] test/crypto: add raw API test for dpaax 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 Sender: "dev" This patch add support for raw API tests for dpaa_sec and dpaa2_sec platforms. Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal --- app/test/test_cryptodev.c | 116 +++++++++++++++++++++++++++++++++++--- 1 file changed, 109 insertions(+), 7 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 4778dafbe5..73c64301f7 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -186,11 +186,11 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id, { struct rte_crypto_sym_op *sop = op->sym; struct rte_crypto_op *ret_op = NULL; - struct rte_crypto_vec data_vec[UINT8_MAX]; + struct rte_crypto_vec data_vec[UINT8_MAX], dest_data_vec[UINT8_MAX]; struct rte_crypto_va_iova_ptr cipher_iv, digest, aad_auth_iv; union rte_crypto_sym_ofs ofs; struct rte_crypto_sym_vec vec; - struct rte_crypto_sgl sgl; + struct rte_crypto_sgl sgl, dest_sgl; uint32_t max_len; union rte_cryptodev_session_ctx sess; uint32_t count = 0; @@ -326,6 +326,19 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id, } sgl.num = n; + /* Out of place */ + if (sop->m_dst != NULL) { + dest_sgl.vec = dest_data_vec; + vec.dest_sgl = &dest_sgl; + n = rte_crypto_mbuf_to_vec(sop->m_dst, 0, max_len, + dest_data_vec, RTE_DIM(dest_data_vec)); + if (n < 0 || n > sop->m_dst->nb_segs) { + op->status = RTE_CRYPTO_OP_STATUS_ERROR; + goto exit; + } + dest_sgl.num = n; + } else + vec.dest_sgl = NULL; if (rte_cryptodev_raw_enqueue_burst(ctx, &vec, ofs, (void **)&op, &enqueue_status) < 1) { @@ -8381,10 +8394,21 @@ test_pdcp_proto_SGL(int i, int oop, int to_trn_tbl[16]; int segs = 1; unsigned int trn_data = 0; + struct rte_cryptodev_info dev_info; + uint64_t feat_flags; struct rte_security_ctx *ctx = (struct rte_security_ctx *) rte_cryptodev_get_sec_ctx( ts_params->valid_devs[0]); + struct rte_mbuf *temp_mbuf; + + rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); + feat_flags = dev_info.feature_flags; + if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) && + (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) { + printf("Device does not support RAW data-path APIs.\n"); + return -ENOTSUP; + } /* Verify the capabilities */ struct rte_security_capability_idx sec_cap_idx; @@ -8568,8 +8592,23 @@ test_pdcp_proto_SGL(int i, int oop, ut_params->op->sym->m_dst = ut_params->obuf; /* Process crypto operation */ - if (process_crypto_request(ts_params->valid_devs[0], ut_params->op) - == NULL) { + temp_mbuf = ut_params->op->sym->m_src; + if (global_api_test_type == CRYPTODEV_RAW_API_TEST) { + /* filling lengths */ + while (temp_mbuf) { + ut_params->op->sym->cipher.data.length + += temp_mbuf->pkt_len; + ut_params->op->sym->auth.data.length + += temp_mbuf->pkt_len; + temp_mbuf = temp_mbuf->next; + } + process_sym_raw_dp_op(ts_params->valid_devs[0], 0, + ut_params->op, 1, 1, 0, 0); + } else { + ut_params->op = process_crypto_request(ts_params->valid_devs[0], + ut_params->op); + } + if (ut_params->op == NULL) { printf("TestCase %s()-%d line %d failed %s: ", __func__, i, __LINE__, "failed to process sym crypto op"); @@ -10450,6 +10489,7 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata) int retval; uint8_t *ciphertext, *auth_tag; uint16_t plaintext_pad_len; + struct rte_cryptodev_info dev_info; /* Verify the capabilities */ struct rte_cryptodev_sym_capability_idx cap_idx; @@ -10459,7 +10499,11 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata) &cap_idx) == NULL) return TEST_SKIPPED; - if (global_api_test_type == CRYPTODEV_RAW_API_TEST) + rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); + uint64_t feat_flags = dev_info.feature_flags; + + if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) && + (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) return TEST_SKIPPED; /* not supported with CPU crypto */ @@ -10496,7 +10540,11 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata) ut_params->op->sym->m_dst = ut_params->obuf; /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], + if (global_api_test_type == CRYPTODEV_RAW_API_TEST) + process_sym_raw_dp_op(ts_params->valid_devs[0], 0, + ut_params->op, 0, 0, 0, 0); + else + TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], ut_params->op), "failed to process sym crypto op"); TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, @@ -10542,6 +10590,10 @@ test_authenticated_decryption_oop(const struct aead_test_data *tdata) int retval; uint8_t *plaintext; + struct rte_cryptodev_info dev_info; + + rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); + uint64_t feat_flags = dev_info.feature_flags; /* Verify the capabilities */ struct rte_cryptodev_sym_capability_idx cap_idx; @@ -10556,6 +10608,12 @@ test_authenticated_decryption_oop(const struct aead_test_data *tdata) global_api_test_type == CRYPTODEV_RAW_API_TEST) return TEST_SKIPPED; + if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) && + (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) { + printf("Device does not support RAW data-path APIs.\n"); + return TEST_SKIPPED; + } + /* Create AEAD session */ retval = create_aead_session(ts_params->valid_devs[0], tdata->algo, @@ -10586,7 +10644,11 @@ test_authenticated_decryption_oop(const struct aead_test_data *tdata) ut_params->op->sym->m_dst = ut_params->obuf; /* Process crypto operation */ - TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], + if (global_api_test_type == CRYPTODEV_RAW_API_TEST) + process_sym_raw_dp_op(ts_params->valid_devs[0], 0, + ut_params->op, 0, 0, 0, 0); + else + TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0], ut_params->op), "failed to process sym crypto op"); TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, @@ -15434,6 +15496,46 @@ test_cryptodev_cn10k(void) return run_cryptodev_testsuite(RTE_STR(CRYPTODEV_NAME_CN10K_PMD)); } +static int +test_cryptodev_dpaa2_sec_raw_api(void) +{ + static const char *pmd_name = RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD); + int ret; + + ret = require_feature_flag(pmd_name, RTE_CRYPTODEV_FF_SYM_RAW_DP, + "RAW API"); + if (ret) + return ret; + + global_api_test_type = CRYPTODEV_RAW_API_TEST; + ret = run_cryptodev_testsuite(pmd_name); + global_api_test_type = CRYPTODEV_API_TEST; + + return ret; +} + +static int +test_cryptodev_dpaa_sec_raw_api(void) +{ + static const char *pmd_name = RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD); + int ret; + + ret = require_feature_flag(pmd_name, RTE_CRYPTODEV_FF_SYM_RAW_DP, + "RAW API"); + if (ret) + return ret; + + global_api_test_type = CRYPTODEV_RAW_API_TEST; + ret = run_cryptodev_testsuite(pmd_name); + global_api_test_type = CRYPTODEV_API_TEST; + + return ret; +} + +REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_raw_api_autotest, + test_cryptodev_dpaa2_sec_raw_api); +REGISTER_TEST_COMMAND(cryptodev_dpaa_sec_raw_api_autotest, + test_cryptodev_dpaa_sec_raw_api); REGISTER_TEST_COMMAND(cryptodev_qat_raw_api_autotest, test_cryptodev_qat_raw_api); REGISTER_TEST_COMMAND(cryptodev_qat_autotest, test_cryptodev_qat); -- 2.17.1