From patchwork Thu Aug 12 07:12:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495969 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp84280jap; Thu, 12 Aug 2021 00:17:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNgM0F8QPYbAb/4ishQ3w7XyHvUQCxZcXOmGIyZbZ+6Yj53VhSL1f6vw+qJqewNUROkA4a X-Received: by 2002:a17:906:b1d3:: with SMTP id bv19mr2311720ejb.361.1628752678199; Thu, 12 Aug 2021 00:17:58 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id p14si1752188eju.82.2021.08.12.00.17.57; Thu, 12 Aug 2021 00:17:58 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector2 header.b=sNf4aLr0; arc=fail (signature failed); spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DDFB41267; Thu, 12 Aug 2021 09:16:33 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20071.outbound.protection.outlook.com [40.107.2.71]) by mails.dpdk.org (Postfix) with ESMTP id C738741264 for ; Thu, 12 Aug 2021 09:16:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CjjKRMwrBILf9Fqh49Ch4DenCIZszYxuJh3DeJpKd4H6y6pcwBCewMHHFxyGX22moXdMo6FDBEARTOxZPeXtjITGl2lzdo4tjTyXrt5pDAhpGgmi3eQJ6loGJ5swlSuQ9kQ8fYDTBg3LTM1kAElHMXWOS9XCnEVwgmh45x39vZ4i2YukXY04Ra2yURVDlUQCDf5yJe3CP2zZSVnScVLgYJqaPzve3P56heMjpCjokFu4lP/kT4k16IIsftTDZFJKCp+Vt2SJQrYTAbDdjaDFTDPzCRh0h6PlNVhjQLrbfe7CIZYdi1R49AIZ37tiY/pBNqzFgzsTHUG/TZsKWt9hGA== 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-SenderADCheck; bh=pMJNO1dkwlWbM+LAvtz/F3D+6Yzd3CJPsuGCZQpwoI8=; b=U67/9ET/mVKwcMiqWLnd4JWQqoHlXrq7kyWCDPYpnoit6botEIvaDEV9AXtG96lqqrBIOksHKUdX9cBD2JS0MA3LTLQhBllYW6xB1/8FfZ4YyI8Bf94/+Kz3ET0cEpHjdOwaBpiL/dhFU3Dy5ErV+aYy9OwWPuBhqjiWpvfZH1p6ZGPDBmXSgUZSAoXllfDVLvyfPVYRX8sryokMzlPPChwuU9NECE874ImCus5t6xFg1LeshsTyaM1ETQ5Q3gPKuRdwJ9FdLgqTKDOfPJk8I3d05UrPdbbtddye6Z7zFfL1jRB1WnyLzpbMEL4e1IdQohjYiVbjFed1wn9UlX9sdA== 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=pMJNO1dkwlWbM+LAvtz/F3D+6Yzd3CJPsuGCZQpwoI8=; b=sNf4aLr01bdS9hDYMxFci/wHssPa2JmRII0bzY0ynNhdZreNeINcM15UKb6m2Qk68z52JA0nd+uYWh8yp1VzOoKqPEvysIeT78gbrH1TQARl5xM9f1KlJFmH1sx6WPq9IXhkduhniMKHHvf42jFpsTwb6EAx404uhsPJd+/oHbs= 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 DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2bc::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13; Thu, 12 Aug 2021 07:16:31 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%9]) with mapi id 15.20.4415.016; Thu, 12 Aug 2021 07:16:31 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:43 +0530 Message-Id: <20210812071244.28799-16-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210812071244.28799-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR02CA0105.apcprd02.prod.outlook.com (2603:1096:4:92::21) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR02CA0105.apcprd02.prod.outlook.com (2603:1096:4:92::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14 via Frontend Transport; Thu, 12 Aug 2021 07:16:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b2f5e791-7a88-42fc-86c9-08d95d611bc3 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: 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: t37/2/rkEgwRXlDIVVra25D8YuIX7Db+A8xvi3iHuoL+vYVwdf5jBkzsYNUc8VCKaKSNWUFT4IK5duSIdk5ByVLKc7g0qSCI23Frtz0KP6Jgxd6XQqF2ib3girSpPLOKQ6o+5PVJNvDXI4cKtRtVJkcqiOuaNagSNu5zOLphf+ZeWbHl5pIMCiJiDcg60KmoPSLpb2FBlLOk7P5sKKFeMT1cKJpMraLVPaYMv0K/E/kv/yyGcrgMWR929s3sB9YaWbolfvSGP1M7Gln20BeltA2DiQWwfAER9Qbq0mRRGHj+lU4V3FPOffR5w1EqF3PD/p2hRhjsoMJd5PmUaDCMsXqMnmiYTCAohqcXWIKi6E45fVOcHObNURiiSVTjxjop7ZH/ltQixV68SIUVTBLZI46olvpCIv95w6GwhqEzpuC9hZv2ur0Rl6ijDSW/sWJxTLMmxBSTgvcx2ydHwwDEZttYi/5uIU1eclt9oEK3KlfXXDzJg3Kxr26NZK0dkaFqwAWVwwZmAyLlMravUaz9lOcsdDEffyuFeXZc6OtujMg6U7XeSGxcJbNagboHSLoDAE9SBYJxml+xVnB6aIzRrwY61vtfJ/LMhDn68pNB+O6aOG9oz0HtjSlYS0YY+2xqEMMp4dUikHHGV6Atdpz/m5cC7u1N5CPttGZFkzsA2TmnGJb/1l41/IkFMtFJRgJao1ptnf2+ro5H/VAi3PkSRw== 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)(376002)(346002)(39860400002)(396003)(136003)(366004)(8936002)(956004)(6512007)(2616005)(2906002)(6666004)(36756003)(86362001)(4326008)(83380400001)(38350700002)(44832011)(478600001)(26005)(6506007)(66476007)(186003)(52116002)(5660300002)(1076003)(66556008)(6486002)(38100700002)(8676002)(66946007)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AU8P0l2BJT3zDZdg1/UDUmkF7ZlKqJa+7Ww70UXRfBu0skZZUKcgNRPnlqHB6ewQZ/Vjs4juopt5QLZ7/3dh1QPMzVOUbw2vhVcjIgArY4Rzs/kC6Exhrdty6dNLG/BSJ7fWMp59PpWYGxQ8x5tnKzUqlPdH70McWJl0/0PhWlxbJe8TAjyeA9PKrjJLE/UGllS5ItKAcC+b9diOCV/s3xlIDPreIZxY1rAMaA3hZyNuQlB/wrs55GFYJJI9LcJiBTbe/qPWmeqyOk7wY+Dy7iewRXIJZZ4bw9/ow4nSXHKwXQwbcFW2aztW54mCpqEWryO6BkfemgrDkbv38lISEiqFbnkRbKSq+TNul1ASBhJblxUZrlD1Sq+UvAm6Ml5CJ8Cihsr6DO/3yOQyuM+1WO465YW1nWoGQ+CFszi3qR9Eeiy2Nih065MHJSNF+vsq0EgPD3A95r70tKFIobIIYE9n629mjFNAcTB8zgBztg7ZovAJJFjHaJn8BznKGzlqZ9IQekXh7PZ0Z0pNgzTz72dqYbEaat2J0ztgDeD4uF4IuEcadFmIOitixRgSaGOP/+cyvjMymn4KUClYJe+55NTgWtmCzT0zfmV+UgclKdDi9sXZA0LZEBdQ6DnzoQEj1S3l6W5XC4DuwwBBnx/3HECQdNWx71bDTiEP2lMTU2uR6R0hVf46mgo0/NnMmgqbAvEl4FaQQnxvGLd8cflDHqsDWqyg8lvGekx5z6iX/YS8xD1OvzOvpoDF+IG1oo4wZacv3xxdkCUjMlgdBWrBQSaNG1tZc8yfhqm8E+LlZYfNhWbwOsW1nFDSAteBKqiDLHiwiaFHRbrFePJzioZf+gw9DSedqFfr65ZfA/y3dHedccsmInRBWZd7zz7VKACcxfaQU20tgw7K41fIg3GBxQ2BZn6ZBb554g+GXqLDE0+C+N9hmq3BdMoFbB+3/iFwZRyqBaFQbe04l2ldPQPzuz017aMofoivQeSPiX1nKYeqsnPnXs9788b5P2VHTQ7jcjq8ochF+UulPcmUuraKAfVTyFCD3QYCju/poi0gRQsp2aufksz/HXgqLq8vi+c1WfGycWt+3/4oGZvNZDLaSM22elxuIM4kKsYQKH7ZTvzGnmyB/oPPUXKS9A6xq7JOQxqABrq6ZBmZSCo2DtRc3XnHHr/7qWbSa4hF/8Ufufs4FU4Ga+LXkZy0SCMZayWe9dK94ON+CqFVo5w0t06C0JTmqRGAk/541Ezrt6fzvJlwAKhDlWNRlIq57pgeToTiqqNnDYVVn2qzKQatEriedr8bKqtdgaWi+AQwGW8xihj8MzBe09CiDp6LQbQo79sW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2f5e791-7a88-42fc-86c9-08d95d611bc3 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2021 07:16:31.0447 (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: Dlef9FWICMurnJWxL6hMDzs5ZJF9MCbV0Nn3CpELTgnR9Mtft7iX/a1AT6mBAQxG5MPgtZjMgjTuGGlU6UBVuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 15/16] 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(-) -- 2.17.1 diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index aecd507fa1..59bed6e6d2 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -175,11 +175,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; @@ -315,6 +315,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) { @@ -8305,10 +8318,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; @@ -8492,8 +8516,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"); @@ -9934,6 +9973,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; @@ -9943,7 +9983,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 */ @@ -9980,7 +10024,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, @@ -10026,6 +10074,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; @@ -10040,6 +10092,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, @@ -10070,7 +10128,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, @@ -14834,6 +14896,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);