From patchwork Tue Sep 7 07:59:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 507516 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp4013069jai; Tue, 7 Sep 2021 01:05:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWqhAJHagi3Is2ZHmas6nEZGX2mk8SM/djJtDpF0kHQCS+PB01SqWnRiWZWFlynl/pCPCS X-Received: by 2002:a17:906:4c8c:: with SMTP id q12mr17469755eju.254.1631001948631; Tue, 07 Sep 2021 01:05:48 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id d7si9648704edq.7.2021.09.07.01.05.48; Tue, 07 Sep 2021 01:05:48 -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=lzrzgmHK; 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 DA8DE41193; Tue, 7 Sep 2021 10:04:23 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2067.outbound.protection.outlook.com [40.107.21.67]) by mails.dpdk.org (Postfix) with ESMTP id 732A44118D for ; Tue, 7 Sep 2021 10:04:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QDk6GokaXgn1Wkt6HpKQfqxVeXhL5fuJEDsGJpWMKss5nZjFaFtsBSslVT8/yTb5NW56K5fX64ViDmK51FpnrsOB/xF01GQtJHnlxQfgqnmSKrBX3RkA8OBV4XelzdOfi4o6m2Cx4KJJU2kaaM8Ex4TFkpSUb6UCUEYwzoC21nA3UcgJ6mGsrAu2y6mSW9I+QLTHDLKNqrrl1rQzVQFbGNVT+Lmo9JxLgdp9NW4aAC6s+B/1QZskyrjSdBa2ee295w0qVqzNSnexhftt5Q6rV0VBRjJ/JppwG1TDvgWJBdVGyDMNceCq+zLavRPxP/DKyoMGLg7N80cuCDNCYK/5gQ== 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; bh=UhM+ASv+OO7vwbI/wgetgQblf2Ks639IJ1hL23i/c+g=; b=jgEWugVMbnM1z5gzbE7axjuusDyaRo3/bUya0ynqnRsPGemWfn8O0XAILpX1gCv/5tkX+DlloemPTvqdqDnoEQjtGkxAv1jrlxpdIc10c6VC6GV4KpMRx3HQxnew/kOl755ql+Yw/luELUvAl1lavkMQKJkMSRu8uMoPZO22wpsCDqXhyMv2/rnCBPSTb1FrnCAizg5hAh3YFmn4pr5zYj/pK6OHOEXHDvOY0aq/azIt0I0fheMVPB2jxSRKS3uoS1E22qwEVpr+xsXIvBgnuTpIO/3s0jIRfjAEwNJ4UchNyBZE+db9h2BQthLrC7cOHgx667N1+3O5qsOCXi/FUQ== 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=UhM+ASv+OO7vwbI/wgetgQblf2Ks639IJ1hL23i/c+g=; b=lzrzgmHKfPZOtQlGjRVq6xWodW4BeFCb2asEBBQzfB6K8kWMcfYbNNDJso1UwcvcZql0/5IbJHWpKNaRt4Rj/ipBw4DEFAcZ3R2PsbsLvo0oXJVJjS4I8gYzj0nH1ucoMwnS3UJwzDyesw4kDnzDIFMoF3P40Md2KF5gpGuM6dc= 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 DU2PR04MB8709.eurprd04.prod.outlook.com (2603:10a6:10:2dc::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Tue, 7 Sep 2021 08:04:21 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80%4]) with mapi id 15.20.4478.025; Tue, 7 Sep 2021 08:04:20 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Tue, 7 Sep 2021 13:29:56 +0530 Message-Id: <20210907075957.28848-15-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210907075957.28848-1-hemant.agrawal@nxp.com> References: <20210825071510.7913-1-hemant.agrawal@nxp.com> <20210907075957.28848-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR02CA0068.apcprd02.prod.outlook.com (2603:1096:4:54::32) 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 SG2PR02CA0068.apcprd02.prod.outlook.com (2603:1096:4:54::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Tue, 7 Sep 2021 08:04:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0859d31-22ef-4956-8400-08d971d618cb X-MS-TrafficTypeDiagnostic: DU2PR04MB8709: 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: 7164LGg5K+j6ypH7r92zPt2mtUHqbrGqwinjgwDK+9wElDrP5be4JXGYTS61MxVpSmPu4u4t0O7y26rYRho/ahIO+JHSaw4EKtHY2cfY6g/bPs/JucvalHBVFjApx4hvcg3JpCHzx9/ojA53/g4fSX41Gfi537aQh1wWz215xv3R0CpLyniLfnbo9R8tFDcw/uj/3jhSuvx+pLvK584a6yFzeaAQaMt3TASWHUk3/KIf6GaBggh5ZwtUE3w6ihu6rZ0tWwPScfqa1HpQ1AiMx+cpbL5Vx+Da/aDce+qCqd17ehdBPowvIjx5eUWD1sXSrb2HfYRSx9Ld4n2a/IdQZBRi+0q315NlB8x9A4eCY8aXvaRLVGrT4gOwK5f0rm/QHHybSxSln7L32resZ3BmaDteNjtxrU3YdhcROTfZQSynSDhdO2DiQNZnxbsc+38xDdF2n4pIenNnJ7H9TXMt5Tzz8kQ64mug+dNU2vPqb3XlcrkO/S/tXvM65A4/s3naxgc60c49eAqihY6jrS28GDLmIoOi2TqzUd4NXZT2oaQADjpqO7+Lmqv3JoqtGtlDQrtMpwQcgUkLWwKiOdrv9P02Znu7VK/tW/cn89ZzQuaJHkRu9Coam70iWzD52m7l2mW/eUwv/ISKTWvtY3/D+FYFlCdtxxyJmXbk1dPrqo6RRF7AocH6N5YGb1CkVOGU6gPQYzkLoNWAf+anLO/0Dg== 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)(396003)(376002)(346002)(39860400002)(136003)(366004)(36756003)(38350700002)(186003)(52116002)(1076003)(6666004)(38100700002)(5660300002)(66476007)(66556008)(6486002)(6506007)(8936002)(8676002)(44832011)(26005)(66946007)(4326008)(86362001)(2616005)(2906002)(956004)(316002)(478600001)(6512007)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NAUC3RItIGUvFO+m8nPPRHGCX5VBDdDCCrAkG1A2cK9I6cqgqGII4ivqnqnc4OxV+n86KU4rsswfDSJe6GwxJQ/6aUKs9ftu+/L/1U/A0UD7gkeKlu3f7eoLk2eSPibNMobliVWA3XlYq8SwPxOTpXUsvosNwTTDFsdz96Mt/Ldar4F90Uy2Gi1fUu2KOMwKR5KqfXX2egtrJUQYS7ixV89fBYUNhHUXsJn2AM9k0VolfUEehX+FYSWEItuT8k9SYXxkFjvRo4IEwxpHXbsycDa/bEJY/ygc7VUmT9XAmhjZ492Xx26OALTQ6NGY1Bu+zNZWhafpPjekfyzPNZ3P1ABcswmMloP5t78y+ZGwTs3aSzvnRCxRLUIuFTahv40rdpo9CVYaxvV9n1ou2Iv8l/8oJkJ0kQXU+C6k1froXCtHuX2vhLChY7HAaoZOrXiD2fPzqPzxw/oqqzSJKWizTHTLgGJEMkb+oJBQ45xT9WloyNaG0wzVCSE26+X/6PRkMRA2Ayotxi2BthjSvysTu+2GwzuPmAceG6rll12klDe4Ax0XT5IkbYSnoaS+ysbLhYA+WzzCh0Wb5Fs9O9e0wH5+o//5BzuKDsEnLgT7ilZUJJ5M8rPmMD9LJSAB9roNU7GGtEabX0w5mgVz21TtIKcPFNn8Fk3PJgI0/pxq5xymiAN1ySDMe3psCZZTBM9cPdSn5xTawEEsm05JwaPHwenkViI4ho/x8DmbVipRQskFX56WIGiTPUUak2m7YECgCZ3oCBnzaLz032D8s36N7RZBDBB8F5/2lHOEU+u1LRUYJnLbm7gFjV6AE9wz/7MtTuAqYtqH/RRnxZzwRHbrOenM14BUIUuMXZ/YfikVLflQiTlNYFSwRB3ijeHD7uZ/zt/G37+aUJ6ZKfWmkVgywEDM6pbnnY5MOS6RWPZnyMgNPZVrEc7LJpT+hFl0M8vbK28wkNCLM3LwRHHcWo386rz95YXhxLL+RPMDxylO8XxnDylaZeVWGoqXXex1UuJaOidaJncJasNhcufgVoYUzie7hU6x84uyU7eeQB3H9xB9X3OQJSA2IwKgsu5SqjxBD+7kvJn9D71B/lyXWBXLb8HKCtzjvCDiqGlgGhj1UToM7y5tRa2fbJGxMyqMNUXlBUvNmUaxZnUY9Mhr3iNkYBDLKnAQYRbu97v3MUxQJL6gE4Q4pAg0TXyFa0VB1ICeDJp2KgXiclt2W2n72iArDXL9t6K8bmNJbtVzkZH8ddwEKCuXs/qjlIOZoH0Fv0D+Lc9awV9x9A1yRYAvQgdDQI5h+Gyt+oIvqZDLMcLb6IfkCoEbrOc3PDgtNOHYOLdj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0859d31-22ef-4956-8400-08d971d618cb X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 08:04:20.4567 (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: F7F7qyxuZVcEOTqAJAUYDhOgwJUhKT/F5uIJk6hpMi1b+7gdsTQZKLMPbK2QNXrpt2DjaOulOHLDjKEap0+eYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8709 Subject: [dpdk-dev] [PATCH v2 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(-) -- 2.17.1 diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index ed63524edc..de4fb0f3d1 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, @@ -14835,6 +14897,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);