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 B18A7A0C55; Wed, 13 Oct 2021 21:06:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 558B3412AA; Wed, 13 Oct 2021 21:05:34 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80089.outbound.protection.outlook.com [40.107.8.89]) by mails.dpdk.org (Postfix) with ESMTP id 66913412A6 for ; Wed, 13 Oct 2021 21:05:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cGYS5oCU27BS1ZcGZsjJiCfeEuI1hzKh/GnGJOT4mpL/hQ9w1nIVz0sQ31XP4WD+9MJ4FNu0xYgOQnL5M3SyCHGi5MMp7XKSf7x7hdmEExpb79rZOHAdK4Ds0rPd1Aqlh18XVzgK7aDO44QVjWeJqeZiMKAhP+ZEfMTDZb5OjI7+wb4O/8nE4VONgAfO+fzsEdEKmaP8uMDZjAYXJpJJfMd4wlyVp6MHOpNDYet3cmj7+jV+km4LX6LiUlmyprAWuW7gLdrbPRXcaqbczJNno3TmfoWr1+CBhRNWRCystCgC3Q4mWlwggTqeXLYVstQavpfaSuUqNLS7+OmN8/nuUQ== 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=Za2whFKqtA34WNKlZFSX3uPhhRaOSZONkRPOp5mD5hA4A8y+WnKz71i+DuAfZlas2ZAgBY6Ci0DAaC+Sw6XdNUvSzFnBkP0pGjoQbD3AhvaBtH2aRPom3Y+TVroBAjGfTB45d7koGg7S8cqRJQvR0/Z7f9hoQL6atJWwuvLV+miJZa8aJqDWJZq4qP4ztDlPC4u6JDNIYp1ldiaYMjvNaPHSM0N0FHcBVrzy4TIbLNsFnXFsnJ262YUpL1mdggzmdnhkcYEBCea3yPsPUVIvrnj9LkT4y+3elvHA3EF/hUB1IhzVMt6Wr/dbLBlEzmZgXpma4lKTBL+DItwNIrGhxQ== 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=qbEjaXXxDYhvCtkW+yzwyNKVxo+V0vKJW5RYtYfWhSc1vA/JjSNznnQBy9xuw3WW2J0tl5JX4QoUG8gb+Ur8oPbLFw/K5+iQB9An3qR2AYhyPm0MfYOp5cDv/VU2MGjMdxjv11aF5W3BlXrUHQ3MdAtt3UTg/pF3b9GtfByK0kU= 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 DU2PR04MB8949.eurprd04.prod.outlook.com (2603:10a6:10:2e0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Wed, 13 Oct 2021 19:05:31 +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.4587.026; Wed, 13 Oct 2021 19:05:31 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Thu, 14 Oct 2021 00:30:31 +0530 Message-Id: <20211013190032.2308-15-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211013190032.2308-1-hemant.agrawal@nxp.com> References: <20210907075957.28848-1-hemant.agrawal@nxp.com> <20211013190032.2308-1-hemant.agrawal@nxp.com> Content-Type: text/plain X-ClientProxiedBy: SG2PR0302CA0011.apcprd03.prod.outlook.com (2603:1096:3:2::21) 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 SG2PR0302CA0011.apcprd03.prod.outlook.com (2603:1096:3:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.4 via Frontend Transport; Wed, 13 Oct 2021 19:05:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 957fc79d-3c2e-42f6-39bc-08d98e7c6d5f X-MS-TrafficTypeDiagnostic: DU2PR04MB8949: 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: 5/7S8l587UL0Wyfes/CyImijRK4Sf7LRxpORBYZai+c0gqihH/TRFOdVb87ktRG7QBcnrACTusBv6wE66beoX3TbK2wdnPjCpU037gEDcr0+MKV4oTD8NPZnPNMLFWVWf4da/C/SyYLGbrxZsIMskv0QVVACxMRKNPf4vLrfuvaZahrYiifAInDoizmE7r2iw0V4ySWb1ctMme+QGXr+VkX7JI8gTLenTHpBOp2dpXIeex9sgSKoFdz0plrCD+SFF8TEfTlels9yxW2TBKwIDGmLE6mpBoN5we3miC3507fWWMwx67wU1jEZ7sEfnCqbjBTO0HE3++FO1umMkJY+MxRtIZ8bPsv4PEk5gFhznuzRg+d7Rlq2uJ9XiRzMRUa+25wTPaH5uCShkZiX2Yu+DuUg/7dxi8kbPqCsS2+L1C5hPHjTmdDoV+f3CINPKtPllAD2CvCF/QupF0jWkH3yDSvBHG1pczEFYtqau3FGbUCpRhCJhZXgVnu2ZMWMONvjIDIfCQjrLLZJXgiIoSGOqa8f8Je2ApfGK3Aner+ZgNUWh969ZpXkFWLsHB6CutDOJLinHNXStKqlnHyqNrS+BvT7Cwguv6RQzCO/HGMpv0CF44dH6FD9PiyFw6Ojx0RzlqR1lzYE/KnrAMSuRfae/orpBNYzsUe3hfg0a2zHrM/MT3W4v8oDqP5NEjGGiYrasPdMmMfsTu9LemYHDKi8Bg== 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)(38350700002)(38100700002)(86362001)(316002)(186003)(8676002)(1076003)(26005)(6486002)(508600001)(36756003)(2616005)(956004)(83380400001)(5660300002)(6506007)(66946007)(6666004)(4326008)(66476007)(6512007)(44832011)(8936002)(52116002)(66556008)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3Nh9bjNkQOXKWuRYhax3ekrYsHPyLyunIOv8rnzWo2G80uIYvzJHzN6yvLE/?= =?us-ascii?Q?+F60b/cx+VmiVGKuUHQ0CCk8IO97x/5hdhJObEyxs5/VLdkS/tQPFCWDKEUN?= =?us-ascii?Q?3+ssA09yldVaMJABuKui58AaMmEgkDbztr5kk5nqr3KXOZ2mM23nf/cVdxMV?= =?us-ascii?Q?KpWUj/B5jrKBAhCoHZ8C5g6C/t2aLLy7+uLtp2dBMaPOB6naV1v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Rkf8lDRqCJ3rQWnr5W6cNlhxN0nOuDnwsDAWqLNEHlrGbKdMZQ?= =?us-ascii?Q?NuHK0G8Ob+DC3vbecAXgiqLtu9/J9oYidrJXHRc7Uf3mTuo49RMUVuSaoMvR?= =?us-ascii?Q?Ug96fNXdmdPwPTlY38SVMsztNNLLMLBGEbpV1kX1t3yRFF2xehFHLn+E2taz?= =?us-ascii?Q?ARxHwOeJzfya/beRaZdZ+UFA9fXFgpZS7SNDM4YCpRL78tzR4s9KQvcQQL2C?= =?us-ascii?Q?28+bUAL0zf/uueSKX6VnPE79?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 957fc79d-3c2e-42f6-39bc-08d98e7c6d5f X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 19:05:31.4479 (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: 8LCga/W8xyYoVmDnO74x53DlD/CMxL8+CxeHoS8gD3KwzjOz1NywV9n5t4rFpxLMhtw42+Eez0d9PbOZnKZh4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8949 Subject: [dpdk-dev] [PATCH v4 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