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 14B6EA0C53; Wed, 25 Aug 2021 09:20:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B00424121B; Wed, 25 Aug 2021 09:19:21 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (unknown [40.107.5.70]) by mails.dpdk.org (Postfix) with ESMTP id 52EDC411D0 for ; Wed, 25 Aug 2021 09:19:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=msyaCyBdNMWUXxmo5uWDftom8F1tyU6Y3WtGh6WzAbiMGJV7x5lHvGUymm9KHGWrpfb1/naF5bzVz6S8IxJsw6o4S9KFHi6vESMZfoFCTHTLvGXLSYXflnOKrH8dDY0ybu7WB+2w+unFsQ4EnKQD5tqKPEVlb81Ai00XVxr92o6eC6nZGNzEEtykzRLgxtAT26vLT2pr4viFaKiGlq/0AdqsNjA/G2hB8lUXcVddpewKt8lDZg9PM+MaGxiBuv/xGrXbfsf1GPFGuv3fcKHMHyoJ1Cm9Dhg7syCLA8CEmV7W4hPWXQBE0ble3/vTPJ+ujW2BXCQt7/F8O5rd2QtdhA== 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=joZy8qfz/gxZut1DvXTizaeaiB64k8XxmaQryzUCRBzD30NQL1pFETbI7QNp6tWxfZCW7ISd5Ef8mYjfS5U37FZ4HhY306RuRLQ7h1+ygOzVUjaoSPDp29YcH1S7uTjfoknR0l0uQv2YOC4BEkI4w3+EBSJ65ablMBd7ji8073YCD4HVvB8DfOz1bU+KSuinRD12bWcPrLWmDvFr99V14wI18bdnQgtYa1BdQm2ttxPfpOBp7J033+MZlsqWAmqxpGzC0Lz1iDMJ0DeEsTxyXccXK2yfdaRVqaO5/ep9UcHX3YG51mr2NtcttYFpeZB4+f1Vww+IH7ykYDjr/iQ9BA== 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=ZBZL/IbBYzovRpUCOqFTY72wAeLCWudyTXK3APJrf8YOwNU6S09ZBVbE5+d1OXKA+/+nCJkvQO0mInXemHQvZkCg9SgG7DvGzdbdNVtLDMSGqP1CRAJaAORMpHQg0QSGnIT9Yg41QvXoFCJQy7+ugPpc5akKd9VMfg4UnZuahig= 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 DU2PR04MB8872.eurprd04.prod.outlook.com (2603:10a6:10:2e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19:17 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:17 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:09 +0530 Message-Id: <20210825071510.7913-15-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) 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 SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:19:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e205c1fd-e318-4585-8bb9-08d96798a62f X-MS-TrafficTypeDiagnostic: DU2PR04MB8872: 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: l6fZBehFxhNIqfMPQS4+/lWWmSP/zbpRWXy4EGdn4MaTjdpYs2kYBw1uCzJz4HKj7lnYTiYyIR1XYuR7NJhjZrhWmPY1sDsBxl99ZW5f+7yIB32BwHJRvnI1bpFJsf4kqhEn/4Jzi/x/iwEl/mv2l6mmYp4tIEte0aaAG45y8l7lZp3vWHwZZ5t0HHJbOm8gd+fSj8gSlSVO8J+VG927o1zOu6N0jOcwHzsRD6YfcJYnVWN07FOA8r0qQgIeJT3kUdYeuAFsUy/WnetbyYB9XiN3JHB5jFruDh+XLzjlaL6ObuaZVdA/jFSaxg4qjD3caB5DDn75uvB6bU+jEH+TLAu4o5TPo4hFocSkMGylDBiKmGPQ9C3Q55e/SaW30uA0sCM80KBBTYkJC4aCCAutE/E0B1l7zHkZfl0VxTUUv+sxwUdcb3n1GV1m6B2JETQyOJuig+FxojFzH4FkmAz+E1/ufLAzlsSvXvmcnGnUPX5yXpfNCOQlYWzoQpiGhGTXGDIt5Hcdi0LFWpQXxNk8Rz2TxB0OrvELaxeibvf6cMVptY49AAyuZglKsMbGcVCbA5e71uu5S0+THatRm6LoIteyTcKQfrEUqUodV+t7B41Gtq12rlQhDFvAKL48xQPIqDIhpG8gORpTPWD8mcSg6Q7jRYcANhRh6ste7xa2YtJO6MUHMqo9/h6DwrLnTL/CjTKZW2KB2GGnM3zU5Yim5g== 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)(346002)(136003)(366004)(39860400002)(376002)(396003)(26005)(1076003)(478600001)(8936002)(38350700002)(38100700002)(5660300002)(316002)(8676002)(6666004)(2906002)(6486002)(956004)(83380400001)(186003)(52116002)(2616005)(86362001)(6512007)(4326008)(36756003)(6506007)(66946007)(44832011)(66476007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Ya2+5/zQCpR+e7iqmprZKqMROkPxQrJXmWbBbFSt1Zvx3Mepk3XKVASk7w4d?= =?us-ascii?Q?EKcie3qk47aILGktTnWcHZOR6oyT2CteTPFsheKRJWSeaeSqgwvxKptc1uXc?= =?us-ascii?Q?sDNZEW7KR76lOfT942SU6JpdnWAnlF6AbE+Xg4zLH4NtPZ947Z8KKRnDCAJz?= =?us-ascii?Q?HlXladh7eK7daj+jbUWvMUVzwxBhXC90pmUB6iUKU7kuT8hEb92EjPpVLUOH?= =?us-ascii?Q?4Grl1tKJZhM326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= =?us-ascii?Q?2hYoyxjABM9+T9ksyr1Eqj2/nHmZG3Slhrq7pEZUmXqe8pjzdkLYGDFljSh2?= =?us-ascii?Q?13EH8oAtRUwAAcirDxK0po237vHGLJ2ae+En4UJ+H9O1wMGmw9HczsNe2Yxw?= =?us-ascii?Q?f3j+tyFic0FLmOjS/7xECo98+90XBwcY2NIA/kmfcnMB03XYjdjaFGe9cg2V?= =?us-ascii?Q?evsPEchYTo34CMHmeG79V9lL?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e205c1fd-e318-4585-8bb9-08d96798a62f X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:17.2226 (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: Pu6F038GrmNDwqO5WI47lZe+GLi1ZnatYTpvOHfi/NTedhn0Y1muSxE0L7LZnAe39dN2osHA4dtyR9DcAjL5vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8872 Subject: [dpdk-dev] [PATCH 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 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); -- 2.17.1