From patchwork Thu Aug 12 07:12:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495955 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83112jap; Thu, 12 Aug 2021 00:16:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8Tjt7qJB1qphu2CAwsbx1GdQSZdEfPSKtfO4Hhf5/Iza87oXkmwiP01Upon3yh1Xf98Hr X-Received: by 2002:a05:6402:94b:: with SMTP id h11mr3806913edz.76.1628752575591; Thu, 12 Aug 2021 00:16:15 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id ar26si1717099ejc.725.2021.08.12.00.16.15; Thu, 12 Aug 2021 00:16:15 -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=Zfycsb7j; 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 C5053411FA; Thu, 12 Aug 2021 09:16:08 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2085.outbound.protection.outlook.com [40.107.21.85]) by mails.dpdk.org (Postfix) with ESMTP id 5675740042 for ; Thu, 12 Aug 2021 09:16:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nEJNwHOStSV7vKjEbPtci8J2o9HAXck9NsYgU5oFDQ8YcKM98lVCzyQeGBQ7iaGoKMjn+Lf9uP/aZNEfMENyPzFgna/kSkz+VY1Hq0fvQW69753hYnXCxI3DukBXLx9beG4nqzpdTKtxfjAbdPiP0dAQpNcFDkAz081DHRU5QKzhDIeA9ygoSqU/Du2/Di360f8nE42k81wHqmokeufZSwC/NsLMwGiLakOCQ4nUTijzVADD9GzybDorqOb40i1fMDhj4NwVDt+MM75fvu4V72T2lluwcOihWDRRAQBQL559kCzTE/u+XOLAadPmmBPG9Ap7JCVJEcz5xjSY37P02g== 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=mf2gSP1Yp+yuvDItU1E7AOMM1arbJICSFEG33hTJ15k=; b=TM4yYZZfrVoAAnapzzEv6f55Rl0tUSAnkfn8T/pktwKBUL6SfwgZgUZL065484OBJCXL1uBU6QgK3VHNg4CzvGDQrDxMgCBA9vDdPvwcvzDMwBnb/hGyqx66DfCX0PGSrDmmOiNa0NS0kY/vTEv1gz385JAU8Hz8ED8Gz8yvsljeLFVG/+a6O+xiclQb3JeOLei5CmrmdQbEwO5a9EolIDV9ULnC1Nfi5Uw0N5c49dSU8OuOLsZovLmj6mpnJmVeOpdASV6DkAlvZL11VbY3m02HBQcytQD1y31jhdqtIzCZs9HpCxO31b5YlvbG4CoLCvUcMcgnYyzfkS3CTXngNg== 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=mf2gSP1Yp+yuvDItU1E7AOMM1arbJICSFEG33hTJ15k=; b=Zfycsb7jBz+gLGf/dHtkE5rb49Vi+V3o/a+g3yWRp2aFA5TrxeGxqx3hc8JzEcHSLXXbdN/csohAWJQzQAQ3fL27FBje/FFqMdu2+8hbOEw0xUJ2riWCNLzf+AqmGCnO7epY9y7ip1LGxcHb76tmBf2M7tT2Uki6NHB/BIZprss= 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 DB9PR04MB8493.eurprd04.prod.outlook.com (2603:10a6:10:2c5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Thu, 12 Aug 2021 07:16:05 +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:05 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Date: Thu, 12 Aug 2021 12:42:29 +0530 Message-Id: <20210812071244.28799-2-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:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f729ccfc-4a45-45fe-4606-08d95d610c95 X-MS-TrafficTypeDiagnostic: DB9PR04MB8493: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EMaxMRBoQljWNga4ELVOYJjbAv/EDaPTWdzNQZyWATSo+lykoeWVsrl6feRzqF7NZa0TGvl/SPsA8v9Ql2++A6hlK+8MkoGTw7R+Pk9CbYTrU7sLObpPL8h5+qclytu/Y14HZAqCqyK7iW6VFPlk0683TpbHao0huZ64jIQTHekSTy9EU8a67IhXNBJT7aXhPkZ5BMtUkSkIlc0WPo+HYXjOKwCK7TfsMhBlAzuj+Rlrd7O6ozFPPYNkvoJo6AbFxQEB/dt5ZP45BLEHQH3X9pZb/YSOqQyBNNAoH/kgbMVfoDTH6Zi3w9HEv3C0EQzS/OzoiAMc//DocM1TrxLYK142RoEUXVZphTsrr6U22rvolne0Mh9OUilQqdcz36348qBhWyXDv6r60LqVwiyTFLR5IWfaaU1XB9UkbO60vKbQ2UmFKuMGQzdsqriPRyPsS/YqV3VyKga6q+7UDchXEhB2ox7RI5sGLhoMhDEIur8HFSJxL9VuTrAAhgJEDQaRahN8C/ig3eyNyC5QCnEXoDcjQE7yXJucq3ajpYllKFOp1zY0xLUdiQTUiL075sa6pH//SP4UXsYeX3FEijadDE1yy2JQqz4DGM0fWXLXreUuY4Rmpxu8Bvb5EONAALp6bqT6wQMAR1fz6bUEweZabgUmau1wZCvBDZIgQZqhIGkeG+hBsugNUqb5276azQX1rteAeytYOFkYPtv9WmnBBQ== 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)(366004)(346002)(136003)(376002)(39860400002)(6506007)(52116002)(86362001)(316002)(6666004)(8676002)(26005)(8936002)(36756003)(66476007)(38350700002)(66556008)(66946007)(38100700002)(478600001)(186003)(2616005)(6512007)(1076003)(44832011)(956004)(2906002)(5660300002)(6486002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZSV8stFmgBZxYjeZooh1Iwdtt++mPz4HuaPMTM/jvleprrRo3zYktZGqx2C+J/ebtjVXoQMaYfviDBHYigdaCR+JZumpJtPPV2usQpdaPZAgxLCykfJQM+ZiwWrVqxaIyKRf+H1nb5pZDoHk+Kep9Ji13f8xaTHZIMhqODZ3kEor2n4cywOeSCEbjoljceczwAMKsTajsAcw7Vr9TNL4zV2TwFfF/xczHKA1HeSlOHOnlD/ty/T+E28vdifbiu2WjNI8L6DTG1GGLuJC/ik2P5SyAjhj57M1oVbPIBqPNUirpCNOv0xeJwFaP2A1TjroX7TR8lr0hRhZddcVoagTpuVks+DksfN011t+zshXmEODQAgEvu9lN26Obs5th69bNymbJej63wMAq5WNTMjDSWZdBUxJwLUvc8a8DNLVIjNiCQSgWqvsD53FguSkhFly3O6U8SBeSX3T8TgrTIAcAiELtKNYkQoADUEDDI9u/DGbBFOJeQ88C0tupCVypnjlvrGasyWn75F0vDmjipJ9QuJsX6JvBmekIYbFVAbjc6i8q+HLGLtetYa1KNVY1YjbSBlH4k8/xL0k+Uqq/L7zhESsFkMkqvg7LpIRKFOjmnEXlslCErDXI8/rFcfenrV/+/lcl2be1l4UAVWS+2EFWGfDX/BkXiCZ/32wvK0kjtqagqfzpchKNjho3pvVEpqywnqu4uTUbg3sPho0NWkf2C141eI4L7rAb2287hm3R3JuyyjOkbolRqqjN4gVhas2CaJMAg0NWGbK1BFjRERnpa7NmlJGaRsWOPZO6uN7NfHmso9rAHlGYQXYNSPAxG8onU8gc/KDXOuJ015rhQnqhFNVb+TBdF9Dwf8LeL8sCGdBz1Gw33X/A3Ua01qGHzznmDV1UuuaXPWmidNYxd4P8GvuWtTx6iKdhS61ihwO8SC5rSNjZ50snW/S+9VpYuuZiY5Vesfw3ArD3ZJMzUtBjBCGrgxmeJlB/H6yKRe40AhZeNW3V89CcGR5dyAFB5M/kKf5Qrez0o5uK5L7c4rYXnpN3pznVFHzJTpi0BTb5ODlq8GciiIqrrjTHtCdmj+7Z8Y8gSLey2L3TdSXYSUWg390f2i4gvPytbY6wvVHBaJoyF8tyHyCB+d3W0FRMKTBquvBbvExz+a4CjDXZDPA6EWYQZoq6gA6l1kkLxG7LlqAdrLlM1kSK0sKVGlRny+oUd7wx8d+nhnsasxCBIMAPweF3/HeoG9m2ZcZ+OiaKdUjQAqJN/2Dr/+8sb0bt1ALP+vb4Y86Ykl0Jw+7EPQl/hzZtEAyiCsJee7JwehheqROB2qsRz/OQrrlXBK6RkGo X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f729ccfc-4a45-45fe-4606-08d95d610c95 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:05.6017 (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: Dg+Y+gmiFMFkRG1jFPx2dmMqxrNsFO+q9jPtXS0lxZJ78jx4q/nlkH0x7pf0/sWoJaUjF2PziGtx8igcdQnGSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8493 Subject: [dpdk-dev] [RFC 01/16] crypto: change sgl to src_sgl in vector 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 renames the sgl to src_sgl to help differentiating between source and destination sgl. Signed-off-by: Hemant Agrawal --- app/test/test_cryptodev.c | 6 +++--- drivers/crypto/qat/qat_sym_hw_dp.c | 27 ++++++++++++++++----------- lib/cryptodev/rte_crypto_sym.h | 2 +- lib/ipsec/misc.h | 4 ++-- 4 files changed, 22 insertions(+), 17 deletions(-) -- 2.17.1 diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9ad0b37473..aecd507fa1 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -221,7 +221,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id, digest.va = NULL; sgl.vec = data_vec; vec.num = 1; - vec.sgl = &sgl; + vec.src_sgl = &sgl; vec.iv = &cipher_iv; vec.digest = &digest; vec.aad = &aad_auth_iv; @@ -385,7 +385,7 @@ process_cpu_aead_op(uint8_t dev_id, struct rte_crypto_op *op) sgl.vec = vec; sgl.num = n; - symvec.sgl = &sgl; + symvec.src_sgl = &sgl; symvec.iv = &iv_ptr; symvec.digest = &digest_ptr; symvec.aad = &aad_ptr; @@ -431,7 +431,7 @@ process_cpu_crypt_auth_op(uint8_t dev_id, struct rte_crypto_op *op) sgl.vec = vec; sgl.num = n; - symvec.sgl = &sgl; + symvec.src_sgl = &sgl; symvec.iv = &iv_ptr; symvec.digest = &digest_ptr; symvec.status = &st; diff --git a/drivers/crypto/qat/qat_sym_hw_dp.c b/drivers/crypto/qat/qat_sym_hw_dp.c index ac9ac05363..4870ebf66a 100644 --- a/drivers/crypto/qat/qat_sym_hw_dp.c +++ b/drivers/crypto/qat/qat_sym_hw_dp.c @@ -181,8 +181,9 @@ qat_sym_dp_enqueue_cipher_jobs(void *qp_data, uint8_t *drv_ctx, (uint8_t *)tx_queue->base_addr + tail); rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req)); - data_len = qat_sym_dp_parse_data_vec(qp, req, vec->sgl[i].vec, - vec->sgl[i].num); + data_len = qat_sym_dp_parse_data_vec(qp, req, + vec->src_sgl[i].vec, + vec->src_sgl[i].num); if (unlikely(data_len < 0)) break; req->comn_mid.opaque_data = (uint64_t)(uintptr_t)user_data[i]; @@ -302,8 +303,9 @@ qat_sym_dp_enqueue_auth_jobs(void *qp_data, uint8_t *drv_ctx, (uint8_t *)tx_queue->base_addr + tail); rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req)); - data_len = qat_sym_dp_parse_data_vec(qp, req, vec->sgl[i].vec, - vec->sgl[i].num); + data_len = qat_sym_dp_parse_data_vec(qp, req, + vec->src_sgl[i].vec, + vec->src_sgl[i].num); if (unlikely(data_len < 0)) break; req->comn_mid.opaque_data = (uint64_t)(uintptr_t)user_data[i]; @@ -484,14 +486,16 @@ qat_sym_dp_enqueue_chain_jobs(void *qp_data, uint8_t *drv_ctx, (uint8_t *)tx_queue->base_addr + tail); rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req)); - data_len = qat_sym_dp_parse_data_vec(qp, req, vec->sgl[i].vec, - vec->sgl[i].num); + data_len = qat_sym_dp_parse_data_vec(qp, req, + vec->src_sgl[i].vec, + vec->src_sgl[i].num); if (unlikely(data_len < 0)) break; req->comn_mid.opaque_data = (uint64_t)(uintptr_t)user_data[i]; - if (unlikely(enqueue_one_chain_job(ctx, req, vec->sgl[i].vec, - vec->sgl[i].num, &vec->iv[i], &vec->digest[i], - &vec->auth_iv[i], ofs, (uint32_t)data_len))) + if (unlikely(enqueue_one_chain_job(ctx, req, + vec->src_sgl[i].vec, vec->src_sgl[i].num, + &vec->iv[i], &vec->digest[i], + &vec->auth_iv[i], ofs, (uint32_t)data_len))) break; tail = (tail + tx_queue->msg_size) & tx_queue->modulo_mask; @@ -688,8 +692,9 @@ qat_sym_dp_enqueue_aead_jobs(void *qp_data, uint8_t *drv_ctx, (uint8_t *)tx_queue->base_addr + tail); rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req)); - data_len = qat_sym_dp_parse_data_vec(qp, req, vec->sgl[i].vec, - vec->sgl[i].num); + data_len = qat_sym_dp_parse_data_vec(qp, req, + vec->src_sgl[i].vec, + vec->src_sgl[i].num); if (unlikely(data_len < 0)) break; req->comn_mid.opaque_data = (uint64_t)(uintptr_t)user_data[i]; diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index 58c0724743..dcc0bd5933 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -69,7 +69,7 @@ struct rte_crypto_sym_vec { /** number of operations to perform */ uint32_t num; /** array of SGL vectors */ - struct rte_crypto_sgl *sgl; + struct rte_crypto_sgl *src_sgl; /** array of pointers to cipher IV */ struct rte_crypto_va_iova_ptr *iv; /** array of pointers to digest */ diff --git a/lib/ipsec/misc.h b/lib/ipsec/misc.h index 79b9a20762..58ff538141 100644 --- a/lib/ipsec/misc.h +++ b/lib/ipsec/misc.h @@ -136,7 +136,7 @@ cpu_crypto_bulk(const struct rte_ipsec_session *ss, /* not enough space in vec[] to hold all segments */ if (vcnt < 0) { /* fill the request structure */ - symvec.sgl = &vecpkt[j]; + symvec.src_sgl = &vecpkt[j]; symvec.iv = &iv[j]; symvec.digest = &dgst[j]; symvec.aad = &aad[j]; @@ -160,7 +160,7 @@ cpu_crypto_bulk(const struct rte_ipsec_session *ss, } /* fill the request structure */ - symvec.sgl = &vecpkt[j]; + symvec.src_sgl = &vecpkt[j]; symvec.iv = &iv[j]; symvec.aad = &aad[j]; symvec.digest = &dgst[j]; From patchwork Thu Aug 12 07:12:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495956 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83200jap; Thu, 12 Aug 2021 00:16:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1yDg5i/wOu+78GiGguRn+skECmstbqsuHZY+vdzsew5hbkkOueTGC3rSvuPo2xni/kUz2 X-Received: by 2002:a17:906:a14b:: with SMTP id bu11mr2315138ejb.260.1628752582095; Thu, 12 Aug 2021 00:16:22 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id g19si1857058edb.507.2021.08.12.00.16.21; Thu, 12 Aug 2021 00:16:22 -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=YYgyhoPh; 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 04B1B41202; Thu, 12 Aug 2021 09:16:11 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80084.outbound.protection.outlook.com [40.107.8.84]) by mails.dpdk.org (Postfix) with ESMTP id 76A7541200 for ; Thu, 12 Aug 2021 09:16:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ew1PU4bQ3ECcht084rq3i2Yor+LkyJXJs2Nj+H5n74dzQbjv8TmdHZpWpdzLl5IiyuZtg0/PurF1LDAt8OCYalv94WMErQHf7+R4S5Fg+A5LB2IKKlpAagu8lZjsZI/f3mkjICNi4veTAye9BkQHUUJYq6F93YThUIUCXjqzTO9JyA7q0p+hd63vq2w5m+RMmuoCM+FPez0yF+ituAcymwk8X+D0uztx7TOdp/qPR3eoW0kHxuaTAY1+jsc0vuKwTo1JiB+TiTqJ3uJhXWtvgIYOLD3W7vhnERyX1bmybqn9sALleFvNzI5ctF4f2az/sopkekNhXDQe0VOl+J164A== 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=DJH8xh7Zu9m7tWjgSU5tGNWKgbIzKqpsoiVAso/5kQU=; b=m2eNvVAe5+cyYe75avwGcCnv1YC+D7RHKnwYTpq+P6iZ16Qk6NdFibQda8SdOHX6XhWz2BGV41a4DbPXSlgygVxqyAgCADCxX6n9KUGg1pkjQvfEFKqUrTfich4LG2F3rVbs8GAEJfTfMj8U9XapK63VqSidTt3rzvYknyXlE9cU28rAC+4Tor2e8nL8EIQ59fPZuwviKcmTaa793nxTuMo1yReDCJJ/ObJBiyRYmm1gANrIwi2A81bLvKbHNHKHlrbVWBZFEDEsyy94VPxctv2Nid/CPHn0lJnkprq/0LPC3f/DsIphS+CCQs9wQB0rwYHv1Nm4B/QEmQLfxhy28g== 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=DJH8xh7Zu9m7tWjgSU5tGNWKgbIzKqpsoiVAso/5kQU=; b=YYgyhoPh+Rq6lOSIZqJBZXSqUk046CaGr4vU68/CpBMyRUKiqVNpl8nGPKJxKvsAxF8Hda8OxrAbTkCDQ631kbUTm0UTOstJHMm4wKbl9MmnGuM8Jg2FxsP+n9G0OQltX9GeZLGIksbZglQgGuCDydF72g/5mTIDdnjQaH/qQ6A= 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 DU2PR04MB8518.eurprd04.prod.outlook.com (2603:10a6:10:2d1::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.15; Thu, 12 Aug 2021 07:16:07 +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:07 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:30 +0530 Message-Id: <20210812071244.28799-3-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:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 93149790-e551-4da3-1522-08d95d610da3 X-MS-TrafficTypeDiagnostic: DU2PR04MB8518: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KHaljBlIGxY85r1iXfQHGSHNtIrE3d34zpPVnLZCxM1EnnaoOozAd4smlyDRJplyVzIypxcuGw/e2BeSHrLA+PbsogxQWFH+0fO4UU41d3maeaHqqsZTpINGCPKBsGd6T/9qgxzGgQgddUnlpAYevAWD2j+CdFymM+gFss9D2ICn+ZFyHgw0uj3+rzrZbZ9r92RXaSd/x5RRfXu4C9LxIIC6V4dhA/dhJLiOmeP9VKeWnL77keFTtSdOTX9gYD3EPWQT2JxDiufeZmr6vhnJDqCQmzNKUdLldRhutlmwuko2UVxC412wMMq3DMZR7ORxAmiIpxfCTUfs/BReaqq4VqtlwnFWzA7+Y3LRjEvTolbM5exz9SfYC3ZufLuUn1asXwPw2ofO9K0zHkBHaTpmYxxh+/KHE3Ki2I3jM9db7rTCyxP6FdLwyF1jKbWUGy6IZdpYMCATcT3dBHJeZkna9UhiQ/Gw5Tw+ztddHEB0cR5deoQ6mKoXuPmBw5Y+GAOZdgZqAkJWnse2xngc3vsCCyCeL15su99fskWuTvRrc+8vH6Vacg6eFfb9T5FkEA/KJDrlPwf58P0xcb/wQBkNfUCTPqlR5tzKvSyGdLlIrii7JOnnMLlA+ski/pVTnfXfr6HzU+9TKBOBE8dIxTntjJBYW4eLX2FNaY7IVQAvkvthMLlsnxO6sMoZItFnwiAf+B1GFA9WUaYsol6v/gKcqA== 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)(136003)(396003)(39860400002)(366004)(5660300002)(6512007)(1076003)(52116002)(38350700002)(38100700002)(36756003)(956004)(2616005)(478600001)(44832011)(6666004)(83380400001)(4326008)(6486002)(316002)(66476007)(66946007)(6506007)(2906002)(186003)(66556008)(8676002)(26005)(8936002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gIWPQiS2ZjLbGBbHGJdZX5So8Ov4ZGzg8bSJkRdvmMaec97BBbvoPpSiZuQXqg1VOK39NkEUZdZDgKvjYJa8m9erzQEufduBkbfCWzkr1h5pBcBLHcWZnc2dD8iOYSvC+jUsnbz6f7wJJTAYdJ5QVTZefVwkaPvTDLyKwFKsbhQmO5upaLtxOZLKd268DT0fcqb0bmax+WhOFOv4gQPIsaoaMPnzGq4gEvjfmtrQqijlqsusUtl3U+9eUJAi3Uc3mMvzge9DPpsJNyHZI9LIi+m7T093Dnu9rJD1WliwPIYff2Oi74s7WBcAZQKWOgmD9Pl7Ud+WNTuxuGrBx48mlrToP8502pT1DPwfXRDO14I/vVRVI7hiZImmHF5cl/hqOjUhiMLpx3RWDtceoyW1/Ius6Qv88CDLYcAFCAsMpBSQH6U8GIMEUByeVrknvAjdXUyhcuvZqlfPcU6xdxt3zz1HAYqPOpVuRsrLQfZcSdo3MjBMfE1cpNKe9PoBKT8LBU1URRXAU3kXFtI29BClPkyX0nKod41uxHwXGv2xulwKk+0S+9ZflZPTRHxXATkG9obznfGpg1ZAPCpXRwf/9jIiXDlrzSe8D1pBwfjRES/kxHCpPbQJAHWpHSam5LIXcCQ3UwFjizIFc8H5S2yRmgf7yNwhYHV291xrQcOf4+EHjW2il1LNZRQx1XuZcUtCWGZH12NG4GCXM33+krne0dV488B5ZyzcasMeP/Dk8X4WGkc5poweVsGW6jbwywO8j8CFgdsCUt4+fUMBWN93CovK+6W+LOzKKaG2AlxCakbZSDSJmPhNIQCdEIvrvLI/XoEJ2boeimyCFzYGqGmUltUJF5ISfb3tOdgMwyucH8ZOeh4pFH4SyKs4j+xTycCQsah5O/54TInRL/h1zVO1Otvo9FRv7Vi56ZyM0cveqGwn3ILCtyYKqaXAFC+kHQFWvv8D1wi08CepE4btR84Eo08+SPylpo/GVf0IK37pN1OPi1WLzdGDyA33dxAwDHnB8zy6kEWDpmONmV1xbGHPP3K/fAK9cja8B7q051g7rtYDK6dQmSBjrrtI93GYnEeqOXrwzU6e+jVdVpKDW9c8uArWYqtjGVx1+hoef3y8SjftJQfEcZYuUqjkPy5fMRi2JpATAkP9YEGQrJEQY8GovvZxP8grM6NlceDsKaNjcWciCHcnQuNff4VZp7K9u7hWNzRRgaHe72wIW3tUtVOBN+HtBL4Yp6J1QJVsC++KDDsIbcUs4b39W1SGy9ROcs+mcjcIryI7m7UG6TuWpWN20iRGiG0K5KDuXoaThF6jKex5U6NvtBkfFXf4lnbK7P5W X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93149790-e551-4da3-1522-08d95d610da3 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:07.3609 (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: X9EUtMTS5IIXRKTY926lgVF51IkK9j7s+24Sr6vLS7CCdXyzbsb14AN0hUwni3iTpzNnOLKlhb142M+6zSa9tA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8518 Subject: [dpdk-dev] [RFC 02/16] crypto: add total raw buffer length 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" From: Gagandeep Singh The current crypto raw data vectors is extended to support rte_security usecases, where we need total data length to know how much additional memory space is available in buffer other than data length so that driver/HW can write expanded size data after encryption. Signed-off-by: Gagandeep Singh --- lib/cryptodev/rte_crypto_sym.h | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.17.1 diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index dcc0bd5933..e5cef1fb72 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -37,6 +37,8 @@ struct rte_crypto_vec { rte_iova_t iova; /** length of the data buffer */ uint32_t len; + /** total buffer length*/ + uint32_t tot_len; }; /** @@ -980,12 +982,14 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len, seglen = mb->data_len - ofs; if (len <= seglen) { vec[0].len = len; + vec[0].tot_len = mb->buf_len; return 1; } /* data spread across segments */ vec[0].len = seglen; left = len - seglen; + vec[0].tot_len = mb->buf_len; for (i = 1, nseg = mb->next; nseg != NULL; nseg = nseg->next, i++) { vec[i].base = rte_pktmbuf_mtod(nseg, void *); @@ -995,6 +999,7 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len, if (left <= seglen) { /* whole requested data is completed */ vec[i].len = left; + vec[i].tot_len = mb->buf_len; left = 0; break; } @@ -1002,6 +1007,7 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len, /* use whole segment */ vec[i].len = seglen; left -= seglen; + vec[i].tot_len = mb->buf_len; } RTE_ASSERT(left == 0); From patchwork Thu Aug 12 07:12:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495957 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83267jap; Thu, 12 Aug 2021 00:16:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFrcbflVCxerVE4JC/FpZjCcdJJWoJZn6KVtLSTXB6oX5Q786/NI43eZTIBZx2xVKPefki X-Received: by 2002:a17:906:1b54:: with SMTP id p20mr2293140ejg.395.1628752589229; Thu, 12 Aug 2021 00:16:29 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id dr8si2096523ejc.307.2021.08.12.00.16.29; Thu, 12 Aug 2021 00:16:29 -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=hK4d2ycn; 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 427A34120C; Thu, 12 Aug 2021 09:16:12 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80084.outbound.protection.outlook.com [40.107.8.84]) by mails.dpdk.org (Postfix) with ESMTP id 99DF441201 for ; Thu, 12 Aug 2021 09:16:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eZvD5XGVkrFZVLpV+in5nzEcqrc4Pt+ugHIDGcC4SHvefOBzXbJ+C++JMxs4yZbHJ4nCgnVPDqbVOB+IyW6fz2Z4TLEZwocmsidn1eT4EQ7UxfDYvFD/8PyRXMnzziaUcEaeFBOL8dMeLxJ//1s6iXIOwvekIpjzCLwQB+NmNc+nfyvX9vsCIInVV9tz6GEVVLsx7K4Ojazsk9tDtHqol2DqNQBeVv9RPpKL05bbtpSGttu5zjoG2JUaMpB4qlY5rrdPZkkL7oU6MLdYtafCuIfjnIW040SN0OFb6nh0tlipwairtxRmHRq8TGlzXCvPqN/SLYDFmIx5c03JQ7d9bQ== 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=KVk3PBUZFgcWHzsOyM+etroFQTVENaEQwvAh2w6O+zA=; b=i406Xl+odVOHk8L7Q0XJdGkM6Xq37R9VwB3//mS3ieZPcTnzM2L+T7aUBOoK9noXWXHe6lYUzW7YfncEGxDkvriLTs8WgD9oOpcIs2WDhQ5JD4e7feG7MxbrDEUdtNeVX5ALHb1uuw2LIgdI5K5wLRXaTa3ZJMF/dtqM1WHwmGjF5dlsUmq+Lv0Se06j8/jt4noMx4RHcI1yFDBzpNs9z/1eJYGp1jSaF/d77NSwDcJxsoJVBaNEQhTxIBtxJT5R5C9GOLpBss34kXGitClgbF8+e9ZTmhIQrjbF4CuWAhaajj5uYyeeJVzYV2ZEOyhtGVV0CbRVofQXM3/UdSufaA== 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=KVk3PBUZFgcWHzsOyM+etroFQTVENaEQwvAh2w6O+zA=; b=hK4d2ycnt7gAsgBVq9JYZ/lB+d8BlaU8/nDGslU/xNrqJTzTaEk5k5x7uneuy4juok2PTU9LEn3iJcmlTTgClr+0uUqFA7yN/4vGS9WelYudU4zT08/B7ppQjM4GANNB1zHMy6ULJWhzVqSAcl1+F8/skWVYHslO5TfJJmmJwB4= 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 DU2PR04MB8518.eurprd04.prod.outlook.com (2603:10a6:10:2d1::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.15; Thu, 12 Aug 2021 07:16:09 +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:09 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Date: Thu, 12 Aug 2021 12:42:31 +0530 Message-Id: <20210812071244.28799-4-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:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 29ced972-efb3-44c9-104d-08d95d610e8b X-MS-TrafficTypeDiagnostic: DU2PR04MB8518: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: plMyvRrnnsBi32JxBVgAUAsUgcluJU7T4+YdeflTZ44lFEckzdfpwNto+MIa1qPFXwnnHfLFYIDQpMXtU6YufPE57l5zLb0hPB6CIUSOgp5sfZcsPL4wZCd+BFTNxk0BERMWyrZ4o0fhrriLuJr42yJjppMQdf/aYfec8dvN6saDJ1LG1lOlvoygVkWPZsZssjwUvAfvKPnuc3Z1s5QIPpBxFo25KFUQ3/DGZ0uljzGKaPyJ1SzNetOsjKcA4CiBa19pdlwfH8WDPvnOJ4zX5ytGmCQJNuCGuKhpXHj5VFHxmOgdcME5qNFD6QGnFVkiDScDZ7OxsCOPqMNHi0He6iR2yXl6F8dnGECNNvWqfjst6j8FEtS6YqU1v5tHO1RCMXY3QCEilLAaieRhpVthhOHLgWQal0CgVlpyVO+fJFOvKyWl9jeGHHzVa98B42UNTDRmyLEO5ZHAkEsLNzViEl1bGtqUWbkz42MG0AFJRTYDZ9OiP1tKqbmWaUxkm3w/9h5zZwbubfBWjmC9zFbVoIEDQBnNe4AydtoBOwoXo1InW5FaMpJwlyof9vk4VDy69nwtucHN9JcJK1iSQtf8cXe/mGlnM3BBlcmbY8cF5xdPAfy0oMb7qF63l/PtP2he0rwWIAfUwpGM5pU3YJJC781G2vt7OwB28tAEiWcypBEJ49hiz4m+Frv1EIOGyxucZpAcg8QNvV1b0KyXF5ACow== 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)(136003)(396003)(39860400002)(366004)(5660300002)(6512007)(1076003)(52116002)(38350700002)(38100700002)(36756003)(956004)(2616005)(478600001)(44832011)(6666004)(83380400001)(6486002)(316002)(66476007)(66946007)(4744005)(6506007)(2906002)(186003)(66556008)(8676002)(26005)(8936002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8pqZNiSg5NVLhbipIRzmBMfz5f3SpVOgxKK+7r78F+d0bDIe8zFIpImZD3Sp8M1ISExMUwCDQT5/QIElY+MUBuWfmG3fZigcFTXSLxNqla0Nl5LDAZcyQRoerJROul59dRSVdtk8mTohmjhd1IW2wUqNbbU9Jw8RqoXK6KdUsvWaU3O/o8mhJhgs4gmDYW/JmHZdcFxL2SuTgKLwL65KeocQLmqTpyD0D3+M9kd0kz9ZZQtuJgzEN0Ssh2ymMrUQERpRWJSs2AOKL9f7lMMcDmVHGbNpHOnCQhK0mJFTXDB2NFHkhbN0YXLYGMa/qxEtX1splSl+zW2Dl6R0tGUM8pXBCJoq1KeGBvmliKK7gdeXMa23H5oNKsHnc/L80URx3+NR8CJ3B9cksnTdHvUAAVuefoYfncIIAim1bz3DKTbBZFLxKdoaiyWSkKHb/1Z0qAN33s/3aYu6r2P2wx4KnEli+wknUm1oztkDafFb19aAueo53x39fjiD39Ia031I7t/X7n1Y89d4m5TVsLXcsRf2feiC21fTaiPStBdJrIhWU+clXpm7Y0UM1Oe+A9wOHloO4MT33CadNUkt5LDiWcCyd3ehWFS+1upl2VWQ12zmRkcexIBOAGfl0sDCi0IRI5qlcbc0Q0lm3dUCi6IE+DIxCsUx02BQ1J224GicrAvIXMzZf5X1TuERXuXaXNPsrKOgzv3La5aidavEMjbLSN/xaq/7nKEs80NHX1dOV9cJvGMYHH0dAwgRoacjV7sB6+TFWI0mdF9wjX+lZOQynABcb20SFjRTcPJsbmGGlY6uCIVFpMtZ2xjf3VJ1PDGYV+s5pH1qlhzEeGsdrZ5FpeX5Qrjn6ucVLy0HitNksgKIrJwLS6cu60B5qB9FwqIUYviNB/5oBdvKfJZXHrH9ixBRrDq+cd2Nn74VG/ZuZKZnIb1foNkIHbajaQOhO0kH3KMYobfqlL0o+ElRT/N0QvIny3fMmsCfFb7snettwmbN+09UibYQ2mSJSs5jHe/vyWPpXhY0G1D7QGjp8rf5RiLenwWuFk13ryMZodLcd9u+0TlUTp53IJstC0fObqWKH61JFn9xtTfoB400H+2XHNOJpcWDCtdDlw4yNiCKW5pSqUAdULxhfQLmQkrfZv17ZabdDpUy1nS8Ah6B1w9+RwmEDAXaMgrMOutEnwBcw0IMxGS9YpxH4XE3XbHEvyhfaM1LmlGnMTQWOKCs34fnxEoFoeK+q1WraRV72DxN5yfGLMh8a2ekLVYCYShm8If/eLyuonNIv+jSgptQq0oPEssVHcEvj/9I1XuCVhsngr0hBuLncrsZob6yupzV3HNe X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29ced972-efb3-44c9-104d-08d95d610e8b 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:08.9977 (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: UTJOFUszVaH+WJoc8ZyUoMq49UcmmKLtr4ezWUZLeBm800+IefKF6fBqqXvYZFgpYc/o58V0DbDFb/Mtz5934w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8518 Subject: [dpdk-dev] [RFC 03/16] crypto: add dest_sgl in raw vector APIs 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" The structure rte_crypto_sym_vec is updated to add dest_sgl to support out of place processing. Signed-off-by: Hemant Agrawal --- lib/cryptodev/rte_crypto_sym.h | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index e5cef1fb72..978708845f 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -72,6 +72,8 @@ struct rte_crypto_sym_vec { uint32_t num; /** array of SGL vectors */ struct rte_crypto_sgl *src_sgl; + /** array of SGL vectors for OOP, keep it NULL for inplace*/ + struct rte_crypto_sgl *dest_sgl; /** array of pointers to cipher IV */ struct rte_crypto_va_iova_ptr *iv; /** array of pointers to digest */ From patchwork Thu Aug 12 07:12:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495958 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83368jap; Thu, 12 Aug 2021 00:16:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiyfPofPyCAsEzAbk0okEGztt9G6/5qcT+3oXjzhMDPjPq/7Y08fyuAktxQyffjoKHJy9l X-Received: by 2002:a17:907:a06c:: with SMTP id ia12mr2269959ejc.377.1628752597888; Thu, 12 Aug 2021 00:16:37 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id hr13si1753721ejc.116.2021.08.12.00.16.37; Thu, 12 Aug 2021 00:16:37 -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=kEwOXAhF; 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 CB44C41215; Thu, 12 Aug 2021 09:16:15 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20062.outbound.protection.outlook.com [40.107.2.62]) by mails.dpdk.org (Postfix) with ESMTP id CA6B04121A for ; Thu, 12 Aug 2021 09:16:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WJkXLPIHjPFUpRYPYmVRel6NajJ11/w3VCgyNg66sJwb0RwJP6nloRx44sNSpg+t4JaSJwCoHGTUEc+iHraAVFIcKLkLyau+z8hHJE7XzSINNzPn6AKYySXvPfqDSADNy/8odfxI8Cs1bkYfoaH/k/O6YbonaW8dbS46dGjaf2yK2Lm5clysx1BhSD4ERpGFOzWpwid5UC7WK7VvPX7HlSfFQQi1ihk5cRGCy/FoSdOkfdZsubGYJ3IBVI89Ekw1y4nLTT0FuCnkO6Gz90WxrpRvyRYbity/rZY1Tqj1fgIeCHiVFxtFUDmBg+2pvKQ4AGv/1w5d8ZlLDwtuMqiLPA== 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=AE/6ClZ/MZnwsc/PXvs7GuT0Iilmq8Q9UoI3DTF5OO4=; b=EyCLqzDNSwv9fI7qFP1xvku8hvXPg1+qqBjME1BpJDrmH58XC15gX3mAIVr+uX/qjpIwuUblwr+MGBLzTl9nWHto/4D/5rP5X4LcC1PcGNjthmfPV1QvltTn41wxSwaGYZnMOSnxoJ818mOyj8JRjD+c3etw1zJ8ICIww+XhHW5GCH20ObioacQACYLpytdRzglYqS/ZShtRhI1gtKKjmZf3w2CQXhKkWppOHVHazvRY1jMjaIbPxpgzOWi6P+Ssojh0pp7vCBEhK4nfq+Fka2HauOnJ9tLTOUUmzfjGu6ynwwBFZbW3lAQOjps+BgBDUDDNSxyE68mQc942pUafLA== 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=AE/6ClZ/MZnwsc/PXvs7GuT0Iilmq8Q9UoI3DTF5OO4=; b=kEwOXAhFhyabZBQeYg5VvPydopu8GONcywWFbz/tlXw5C5rL/usfzUPVDWBXhplY0xAhxxxqpcLv1/hZMJBdq7oZoSIzyrytNE8UKZAaHr3VYsCqB3qsWFYrGOIb9WzCJkr6FVrONT3tO7BJTbjj+CfB/0ABTvtNuYt0qArhLvo= 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:11 +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:10 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:32 +0530 Message-Id: <20210812071244.28799-5-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:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28c47f83-161d-42f7-5e4f-08d95d610fa8 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vluHEjHgqNVjFSJqUJDcsgHfeF/05WIiDXLnV9v5AOlH4OZzSCGor9yPwDpppJXYkHZY2DAj+Pfy1XQ4Jud0kDEsGog/18JZZUZkgNcUIBHcLVD8UNppXzAo/XKNQmzUapA/OWrQDhETU27Z7L7b0z7UQPw9+F84a2sITZC586f/SAsNKnTf0KvM503DXhO6FXU3ioEjl6CDWyeG4cteD8ZVBK7XHa0ya8I2TlLrVQzVXdtZm8g5aL2NscdPJwWRF1+8BQFtFfrOrbJG+9Sxvkb+jUqcP2WwS6lGRGbG6X1kuDqDH6wTFhvLt0Ex2rOgrV3bVoQ31EZWp54FgpcG75AgLpoTDuL/6gvPzNpdEmktfDWIMPzkiWq8Jn1a02lopCtWUBzKZtxplPxyvgi9bfFqAROpYUkmT/f9RhalG7F5pL4BduTGCnjEYfd2jxXbI7UYlEHMQ+LjrB5nSOD6EeBDjGL9sbMfmiyA8jb8VDWj5/Xp2fz4Dd/i7jhX+PXK2nwgmitHXcBEbuTUHOKXntUWiN16oc5sJPHVngXltwtwjUBEQL08wVII/ZeeNhQeimSUG3d0XF6/hXSf2+HoFVFKz0AxD455joOx2UzwmpoM/M88ItdzsKRaerhWubE7gydKdyva6JzCxij6w9hFrsH8180KiDg46tVM9rWBoJAeLS8v3ChMKQYyhqJ2dlmJ+0ilmMszoTNN7ce8fYkq8w== 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)(4744005)(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: BFV1eF0fA6RZ6osRIgMpX8KD0zp/8ZFEt69x0BFe4nglkNqKG29Wi0kKYAJaFkVvIzoWmbX2XHY6jqYZR+bK3Fie0DL5TYuNAteYmoZSLWMZNYDVzumMpjVHAWMH97U8YtO0KgigrO5al51eZPJQY5+yHkDkoloNmiQjeL3Tj75iXcLH3ViBod1Tj2GmkPv7HUqpoc4omSzC16Ivgt0NOqiiUR0ZCV+MB4tuKbfCLy/jE1oV5U46TjVfF4xPMbdjCrJWItMUSRjUWFDy2pK68g2CVobspv5alqqfVcXNxbFFEmP9REE3ZED1FkM/mGwzv/77wL8Pl+vUU5ti6SRh6R2DEL+7dzcZ//F61u6s+5yoktqz0URE1XA/ntmaEXYSnxJuR+41Rk6omHMrGr3XyEg3XhxXOS2Ot/X0oF9kg7t9zQITca2rbUJe7fyYS6NDhSdh7g9cVkvvfazD7noNJieoy8pAk7mdCORugngCc/Nb5O4clH96RHdIkzqv4XOz4Saz3nenbP2dho7MjEfa8DpXGK9xKg0H2IRZ86c+4Mgm2LuEyAZSzhU5uNIpLYf2XY0DqUKMDvlV8jdBr0ALrqoHYibRyrCFCIYmf++XaxhoNpEKNDdvE83oYKuXik1BVTyum6+e9C247+h8diORLhSIbupIrbxN/YvTm0CYHda9mICZ+VkZgbBZj8Y1EayEkqJssJDcqINHRH68i6d8QKMHMcPCa5eXTVZdfTndoPzgkPkEZA1o0P6JBEBEQ1aHQZc4oNlog/XNRCIcFlzW0uvw1hiMNlZa/xiAy08Fmb/sTS8iiS0yZLNhuoiNbBFmCjPwgIHMpN+UVnmci5WWJBEcg9im2S45iP1WnJ2BdPsDZ9wbIb9N19aqQlzzVJ1EnTIJl09yYWlcY5Nmrf4of/vQAnI62PnQykxliagRnRZSUmPNg24EViZQZR59RQbnOQrlEOozyc11fTT1DufbIiGKVM84yTbL+5Kn+51KegveDSZ/yfkXu/I9Lc/6N/TL20iPsVIJX1qJu/xaBYBY+vx4c5XRJtHhw5duORJz5qEklk1a7GBFcAYaHxLKlGbZrwJ82+/gAZk0TtHjieRSVfEtEn+V/86bfebVNMVrkLq4wBZhlLmv2K4c24c28a4gRHgi+GKac7PiDcp3A80pkqAk6sltYwRwzZxFVBy7viYGTCj7Y4nw+JAGdI5Rr2bzVnqr9x4BakgeFaoNJpFbIXuvA4N0P0IjNniZSruvD+P8u5oYrJH2aM62RGcZr59hE3Wp+qnovV+ZScSEPKk70/nHJvkpQc2sO7NQ9MUE/+yvjgKTV0DPnfckkee3oQFT X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28c47f83-161d-42f7-5e4f-08d95d610fa8 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:10.8715 (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: 7BjmYi9OA+L6zp9DT3xWnn+p8RDQPjyyUKInLGqeHIeGeHgjXXJJDTXwW3gU9qN6btWhWc0S5YrmSdgH7AGcPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 04/16] crypto: enhance raw process for protocol offload 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" From: Gagandeep Singh This patch improves the raw vector processing for security protocol with OOP processing. Signed-off-by: Gagandeep Singh --- lib/cryptodev/rte_crypto_sym.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index 978708845f..a48228a646 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -1003,6 +1003,7 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len, vec[i].len = left; vec[i].tot_len = mb->buf_len; left = 0; + i++; break; } @@ -1013,7 +1014,7 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len, } RTE_ASSERT(left == 0); - return i + 1; + return i; } From patchwork Thu Aug 12 07:12:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495959 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83449jap; Thu, 12 Aug 2021 00:16:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+8btke3PdMzcDbxZcSPKBPbuVaZm4b/c2JyJtOtxRNwfRAEQt89jiuVXZe/WjJNtP2MPE X-Received: by 2002:aa7:db47:: with SMTP id n7mr3826883edt.15.1628752604820; Thu, 12 Aug 2021 00:16:44 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id x42si1831887edy.566.2021.08.12.00.16.44; Thu, 12 Aug 2021 00:16:44 -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=dUxSYUvk; 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 22FB44121C; Thu, 12 Aug 2021 09:16:17 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20062.outbound.protection.outlook.com [40.107.2.62]) by mails.dpdk.org (Postfix) with ESMTP id 64FBD4121B for ; Thu, 12 Aug 2021 09:16:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QU34dua90PsOwIyyEkJl+tm5g7omzz3dRJqTK5bqECRJz9aRUlbuI6w0Jug3INU0a18TUa/+k9WV3K2Nf5Jk5VStmYTLsUsz0UPCfYtemLglK78CJVkIC7rwrdmxxAXyElCQzAtAlW+cJQL6FgMFl7hUh7nIA9rd3+NTv67ub/vpXlxTzOgp5PlGwUbBAvtTRjeOXoBCgReiEXBcyQcwnI3K1KhpFaTJ0iTpp3t0JivrnlWpwWXEoUiSsG5cAXaUPag161kivAoFKGC6AgmKBLYXDKv93jP5tEYNnrQGfmic5jllrYL4R9aa/B3ZasuJWEIwr+v3Jsymjq5/ILarzg== 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=c7Up2SY2H/NTgGiTSWGqlhXAI89ELAWr4jP+np6sgRI=; b=e2DpMeQM3NZe3mQe9eVaxsZuMUUrgFRhe26gzVs80R4nvGD/Qs+GI9XWi3p/V01q8ZBVEU0+OLp6oMNK+XGyYuFxFXBsFvzEKaFj8FhR1ZQ0J8/2/XtKfiwQp1K6eYQyw6FsmkXI0Espkn4KjnRT2ctJCGOtQtZbYviBfSGcGJ2U53cJUrVlejkyUjmA9P7w4qZxeKKiUQ40JibVBP4NHoj07AaBIXDm87gU/kDg2pbVOnFL8vahxavmshwijTcdfwxPMqZMSAf1WxpbzzRufeLOcOXoYaku9UNVav5hRHll2DO7R7h+yhYR/XihnHi8gQTSToTpxAPMunFTKMMJSA== 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=c7Up2SY2H/NTgGiTSWGqlhXAI89ELAWr4jP+np6sgRI=; b=dUxSYUvkRzBD28lhxycjGrNnGXDs2rjKwB9MjC8gEy7wLxy066OEswVi+3c8WeNWVFkM4MMLd1YTU61lKN8r59zofMm7Q8+6QLdvJ7/0Nss/xyrBQPCPV/A0it1q1u4Kj606omuIr3T0SX+swDs6NgDSH0v/EkEBCHAG5igfu5k= 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:13 +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:12 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:33 +0530 Message-Id: <20210812071244.28799-6-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:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d641d215-c4f3-44f5-ccde-08d95d6110c7 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n3z19iowR9IVE9cOgB6l81IJd2u3CINOSsvPTxxKPwWiNC1DwZPyip4Fou77DnvmfJZoWt969uM4cBhOmh3ImXr7iebjBAzA3lmptj01ZMsX77YYL0suA7FSOuMCtyR3xwez7+kB70H+SUc9s7UzsMQ9FJOLf5Eye8aForEgska75Xie2kEo3/lIbAnhaHNn3peWoka5FuVkn/j1Iuc0RM2ddOyRzqjen5YA3J5wxqjsTtKcnorwjBS1crWh97uGL9art8lrPWcPZvPmmQ7U9gu+82jbJx7QY5efb6Ql9/XYtb2Z4FBMBSSXuHTjOgEI0Wmsc8fOWvhEDY9p4+jPZ5fkcCPArA4QHAjP0qvxkY/qC2AurV1YqiGFse6PB4dicRqkALQA9BureJ/wif6p5wNMtAr4jVGLg79UgwzDC9xDlrCz2GjRlKfcY3qA3Ise9PGaoyax/X74GPSebcfsihjbshTEqKm1UaBZKAK/tTaxVrTFf43ZTmTCwuon6ybka5QK/O+vGCyS2BGK7lrJeBPmnkrXHWnU2wrKKWRi/eiyK4fgd/eo+9Ae/vJiwaa7w51LAQAV+Ps9L37YIY77rxKlr6Ya91s9B9sK+OT7H0Q0eu7dTnAhs8juMvrsEqgiuZke1O2mb0QEe35HtgaNwcxwJHp9xSCGGzM6SsJi0Dv30+2xSBNg4Q1gQFByfPIUMrywaSowKekd3UGyuzuORA== 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)(30864003)(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: Q98UK/WcZm5TKJq5EuEPDzflPcjIxp36LXGmK+iz/3Je95ZOjyg4fL5UvjVSoAUQjyGUay+sKLEG1M+bhBNKLQs1rlK/Z0t71Md0OdPX6P83ZFgoO6r0QBAiQgsusbEAwXYBp4ant5yKzCJJTEFmZx1RA7WVmBts/jnVyDgtgc3gN0KvtX8TawmWe5YwtkITfVu9z4/sn5NZJet8Nu4hs74wczHJrjf+C3j1YUa6O19oSW+9OJgLMIpoBpiw1hRuUjg1nIJbOSxw9MfO7NoFDtxz8zSATk4vB7mHl0B15mBvIAcUhmQrYZjKOg/UXvXfEpoCajzB2y8TC59RIuLhXEdDGqVjDqtdoSfZTTmXyT5p6Re+Vove2DVlYXdqFIXvFxCPr0aqgjcgeAblRvo3aHsRve5FSLTHL/lX0n3ohxzzaPTS0iOwLnMWu0VwZK7SDR0R6JeOZ5WPa3nCtOrFAfpc+rj4SsEpwh2n6BEB4+lSyn/BMZ4FqTNvvp4IZPWonNOslGqHS5OF1MDijRiKFHV7BTvRZKYlTB4qwvoKQYhVUIYkNKtLlA8Qw1taKjQe/KbBExG1+qqddR+29sSPCkqv6Es1XYHLV2CNruemSzMG63vgRYurLUq0Meei+w9MRK4ePLiTzg3S/3oME7cSJYPSdEUfwAWiDTwB5ahbbrMNyfz5drMT1s6LO9m15ISf2eenzDjLZ17y13HSVb5IOaS7fRQsts2gtry319THXzSiLs0D6OXsXuu5eK2kIRapN3uRuKOaDTZawj+uPI0KF/8dOO7UT0Rmm861dHJZjqFsfCQgZbNkp4993jFrcCBQFsMTzrErJQHTWcOTnkzyps/i9trDzwF5vlIX5dvks+XJ5SG3Kh41E+C8WnAfoY5DoYwaWFSn+/8vXPNMjQAbXc12Y4+3H4oXZDfygjqXfzVcFATkKMd1axPkvrjpDf8ETc4wE2XKF+cGKvvnWHO9zBdCPZ1X7d2i7bYfJPz9L+Rio7aiZL+e+T1uiI5/E5F/hjV2e1jXf29HSaVpOyMIenMQxDtnbWL4W75kZAnX9c9xpaJYrhXU/l8TSfzknxdFbz+ocr6kE9jlMwnVJLlCzjkaDnEYNuXEAo5KjgTpw3w24QLui4BExotxajst0Q43UJ8Fbt8n9H5MB58hpSuW6VBz2pUWk0MNhPqjQdbN6GhEFWGiPQYXz1BajC9aOLF8FWpMHoqQ0uiOctck11l+b52pH2+c8DObCKU0AOCPG1HoHCH3sr8aOBOkyXyazYUBppnrLOi07eXl6fnwCkeJnaZLiIieOHiVDN5ePXwmxN2uFWShSRcftCT8my8U/aLK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d641d215-c4f3-44f5-ccde-08d95d6110c7 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:12.8398 (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: 19gMIcNNdi4VosE473M5l9PU+WevITeuzFkj416aZCCbivkT/fBbMBx4wS+xVIGdchcfb6vt7YLZSA/iAnMV3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 05/16] crypto/dpaa2_sec: support raw datapath APIs 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" From: Gagandeep Singh This path add framework for raw API support. The initial patch only test cipher only part. Signed-off-by: Hemant Agrawal Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 13 +- drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 60 +- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 596 ++++++++++++++++++++ drivers/crypto/dpaa2_sec/meson.build | 3 +- 4 files changed, 643 insertions(+), 29 deletions(-) create mode 100644 drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c -- 2.17.1 diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 1ccead3641..fe90d9d2d8 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -49,15 +49,8 @@ #define FSL_MC_DPSECI_DEVID 3 #define NO_PREFETCH 0 -/* FLE_POOL_NUM_BUFS is set as per the ipsec-secgw application */ -#define FLE_POOL_NUM_BUFS 32000 -#define FLE_POOL_BUF_SIZE 256 -#define FLE_POOL_CACHE_SIZE 512 -#define FLE_SG_MEM_SIZE(num) (FLE_POOL_BUF_SIZE + ((num) * 32)) -#define SEC_FLC_DHR_OUTBOUND -114 -#define SEC_FLC_DHR_INBOUND 0 -static uint8_t cryptodev_driver_id; +uint8_t cryptodev_driver_id; #ifdef RTE_LIB_SECURITY static inline int @@ -3805,6 +3798,9 @@ static struct rte_cryptodev_ops crypto_ops = { .sym_session_get_size = dpaa2_sec_sym_session_get_size, .sym_session_configure = dpaa2_sec_sym_session_configure, .sym_session_clear = dpaa2_sec_sym_session_clear, + /* Raw data-path API related operations */ + .sym_get_raw_dp_ctx_size = dpaa2_sec_get_dp_ctx_size, + .sym_configure_raw_dp_ctx = dpaa2_sec_configure_raw_dp_ctx, }; #ifdef RTE_LIB_SECURITY @@ -3887,6 +3883,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev) RTE_CRYPTODEV_FF_HW_ACCELERATED | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | RTE_CRYPTODEV_FF_SECURITY | + RTE_CRYPTODEV_FF_SYM_RAW_DP | RTE_CRYPTODEV_FF_IN_PLACE_SGL | RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT | RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h index 7dbc69f6cb..860c9b6520 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h @@ -15,6 +15,16 @@ #define CRYPTODEV_NAME_DPAA2_SEC_PMD crypto_dpaa2_sec /**< NXP DPAA2 - SEC PMD device name */ +extern uint8_t cryptodev_driver_id; + +/* FLE_POOL_NUM_BUFS is set as per the ipsec-secgw application */ +#define FLE_POOL_NUM_BUFS 32000 +#define FLE_POOL_BUF_SIZE 256 +#define FLE_POOL_CACHE_SIZE 512 +#define FLE_SG_MEM_SIZE(num) (FLE_POOL_BUF_SIZE + ((num) * 32)) +#define SEC_FLC_DHR_OUTBOUND -114 +#define SEC_FLC_DHR_INBOUND 0 + #define MAX_QUEUES 64 #define MAX_DESC_SIZE 64 /** private data structure for each DPAA2_SEC device */ @@ -158,6 +168,24 @@ struct dpaa2_pdcp_ctxt { uint32_t hfn_threshold; /*!< HFN Threashold for key renegotiation */ }; #endif + +typedef int (*dpaa2_sec_build_fd_t)( + void *qp, uint8_t *drv_ctx, struct rte_crypto_vec *data_vec, + uint16_t n_data_vecs, union rte_crypto_sym_ofs ofs, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *aad_or_auth_iv, + void *user_data); + +typedef int (*dpaa2_sec_build_raw_dp_fd_t)(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qbman_fd *fd); + typedef struct dpaa2_sec_session_entry { void *ctxt; uint8_t ctxt_type; @@ -165,6 +193,8 @@ typedef struct dpaa2_sec_session_entry { enum rte_crypto_cipher_algorithm cipher_alg; /*!< Cipher Algorithm*/ enum rte_crypto_auth_algorithm auth_alg; /*!< Authentication Algorithm*/ enum rte_crypto_aead_algorithm aead_alg; /*!< AEAD Algorithm*/ + dpaa2_sec_build_fd_t build_fd; + dpaa2_sec_build_raw_dp_fd_t build_raw_dp_fd; union { struct { uint8_t *data; /**< pointer to key data */ @@ -547,26 +577,6 @@ static const struct rte_cryptodev_capabilities dpaa2_sec_capabilities[] = { }, } }, } }, - { /* NULL (CIPHER) */ - .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, - {.sym = { - .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, - {.cipher = { - .algo = RTE_CRYPTO_CIPHER_NULL, - .block_size = 1, - .key_size = { - .min = 0, - .max = 0, - .increment = 0 - }, - .iv_size = { - .min = 0, - .max = 0, - .increment = 0 - } - }, }, - }, } - }, { /* AES CBC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, {.sym = { @@ -974,4 +984,14 @@ calc_chksum(void *buffer, int len) return result; } +int +dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id, + struct rte_crypto_raw_dp_ctx *raw_dp_ctx, + enum rte_crypto_op_sess_type sess_type, + union rte_cryptodev_session_ctx session_ctx, uint8_t is_update); + +int +dpaa2_sec_get_dp_ctx_size(struct rte_cryptodev *dev); + + #endif /* _DPAA2_SEC_PMD_PRIVATE_H_ */ diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c new file mode 100644 index 0000000000..10cb4247b0 --- /dev/null +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -0,0 +1,596 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2021 NXP + */ + +#include +#include +#include +#include +#include + +#include "dpaa2_sec_priv.h" +#include "dpaa2_sec_logs.h" + +struct dpaa2_sec_raw_dp_ctx { + dpaa2_sec_session *session; + uint32_t tail; + uint32_t head; + uint16_t cached_enqueue; + uint16_t cached_dequeue; +}; + +static int +build_raw_dp_chain_fd(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qbman_fd *fd) +{ + RTE_SET_USED(drv_ctx); + RTE_SET_USED(sgl); + RTE_SET_USED(iv); + RTE_SET_USED(digest); + RTE_SET_USED(auth_iv); + RTE_SET_USED(ofs); + RTE_SET_USED(userdata); + RTE_SET_USED(fd); + + return 0; +} + +static int +build_raw_dp_aead_fd(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qbman_fd *fd) +{ + RTE_SET_USED(drv_ctx); + RTE_SET_USED(sgl); + RTE_SET_USED(iv); + RTE_SET_USED(digest); + RTE_SET_USED(auth_iv); + RTE_SET_USED(ofs); + RTE_SET_USED(userdata); + RTE_SET_USED(fd); + + return 0; +} + +static int +build_raw_dp_auth_fd(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qbman_fd *fd) +{ + RTE_SET_USED(drv_ctx); + RTE_SET_USED(sgl); + RTE_SET_USED(iv); + RTE_SET_USED(digest); + RTE_SET_USED(auth_iv); + RTE_SET_USED(ofs); + RTE_SET_USED(userdata); + RTE_SET_USED(fd); + + return 0; +} + +static int +build_raw_dp_proto_fd(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qbman_fd *fd) +{ + RTE_SET_USED(drv_ctx); + RTE_SET_USED(sgl); + RTE_SET_USED(iv); + RTE_SET_USED(digest); + RTE_SET_USED(auth_iv); + RTE_SET_USED(ofs); + RTE_SET_USED(userdata); + RTE_SET_USED(fd); + + return 0; +} + +static int +build_raw_dp_proto_compound_fd(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qbman_fd *fd) +{ + RTE_SET_USED(drv_ctx); + RTE_SET_USED(sgl); + RTE_SET_USED(iv); + RTE_SET_USED(digest); + RTE_SET_USED(auth_iv); + RTE_SET_USED(ofs); + RTE_SET_USED(userdata); + RTE_SET_USED(fd); + + return 0; +} + +static int +build_raw_dp_cipher_fd(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qbman_fd *fd) +{ + RTE_SET_USED(digest); + RTE_SET_USED(auth_iv); + + dpaa2_sec_session *sess = + ((struct dpaa2_sec_raw_dp_ctx *)drv_ctx)->session; + struct qbman_fle *ip_fle, *op_fle, *sge, *fle; + int total_len = 0, data_len = 0, data_offset; + struct sec_flow_context *flc; + struct ctxt_priv *priv = sess->ctxt; + unsigned int i; + + for (i = 0; i < sgl->num; i++) + total_len += sgl->vec[i].len; + + data_len = total_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; + data_offset = ofs.ofs.cipher.head; + + if (sess->cipher_alg == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 || + sess->cipher_alg == RTE_CRYPTO_CIPHER_ZUC_EEA3) { + if ((data_len & 7) || (data_offset & 7)) { + DPAA2_SEC_ERR("CIPHER: len/offset must be full bytes"); + return -ENOTSUP; + } + + data_len = data_len >> 3; + data_offset = data_offset >> 3; + } + + /* first FLE entry used to store mbuf and session ctxt */ + fle = (struct qbman_fle *)rte_malloc(NULL, + FLE_SG_MEM_SIZE(2*sgl->num), + RTE_CACHE_LINE_SIZE); + if (!fle) { + DPAA2_SEC_ERR("RAW CIPHER SG: Memory alloc failed for SGE"); + return -ENOMEM; + } + memset(fle, 0, FLE_SG_MEM_SIZE(2*sgl->num)); + /* first FLE entry used to store userdata and session ctxt */ + DPAA2_SET_FLE_ADDR(fle, (size_t)userdata); + DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv); + + op_fle = fle + 1; + ip_fle = fle + 2; + sge = fle + 3; + + flc = &priv->flc_desc[0].flc; + + DPAA2_SEC_DP_DEBUG( + "RAW CIPHER SG: cipher_off: 0x%x/length %d, ivlen=%d\n", + data_offset, + data_len, + sess->iv.length); + + /* o/p fle */ + DPAA2_SET_FLE_ADDR(op_fle, DPAA2_VADDR_TO_IOVA(sge)); + op_fle->length = data_len; + DPAA2_SET_FLE_SG_EXT(op_fle); + + /* o/p 1st seg */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, data_offset); + sge->length = sgl->vec[0].len - data_offset; + + /* o/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } + DPAA2_SET_FLE_FIN(sge); + + DPAA2_SEC_DP_DEBUG( + "RAW CIPHER SG: 1 - flc = %p, fle = %p FLEaddr = %x-%x, len %d\n", + flc, fle, fle->addr_hi, fle->addr_lo, + fle->length); + + /* i/p fle */ + sge++; + DPAA2_SET_FLE_ADDR(ip_fle, DPAA2_VADDR_TO_IOVA(sge)); + ip_fle->length = sess->iv.length + data_len; + DPAA2_SET_FLE_SG_EXT(ip_fle); + + /* i/p IV */ + DPAA2_SET_FLE_ADDR(sge, iv->iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sess->iv.length; + + sge++; + + /* i/p 1st seg */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, data_offset); + sge->length = sgl->vec[0].len - data_offset; + + /* i/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } + DPAA2_SET_FLE_FIN(sge); + DPAA2_SET_FLE_FIN(ip_fle); + + /* sg fd */ + DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(op_fle)); + DPAA2_SET_FD_LEN(fd, ip_fle->length); + DPAA2_SET_FD_COMPOUND_FMT(fd); + DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc)); + + DPAA2_SEC_DP_DEBUG( + "RAW CIPHER SG: fdaddr =%" PRIx64 " off =%d, len =%d\n", + DPAA2_GET_FD_ADDR(fd), + DPAA2_GET_FD_OFFSET(fd), + DPAA2_GET_FD_LEN(fd)); + + return 0; +} + +static __rte_always_inline uint32_t +dpaa2_sec_raw_enqueue_burst(void *qp_data, uint8_t *drv_ctx, + struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs, + void *user_data[], int *status) +{ + RTE_SET_USED(user_data); + uint32_t loop; + int32_t ret; + struct qbman_fd fd_arr[MAX_TX_RING_SLOTS]; + uint32_t frames_to_send, retry_count; + struct qbman_eq_desc eqdesc; + struct dpaa2_sec_qp *dpaa2_qp = (struct dpaa2_sec_qp *)qp_data; + dpaa2_sec_session *sess = + ((struct dpaa2_sec_raw_dp_ctx *)drv_ctx)->session; + struct qbman_swp *swp; + uint16_t num_tx = 0; + uint32_t flags[MAX_TX_RING_SLOTS] = {0}; + + if (unlikely(vec->num == 0)) + return 0; + + if (sess == NULL) { + DPAA2_SEC_ERR("sessionless raw crypto not supported"); + return 0; + } + /*Prepare enqueue descriptor*/ + qbman_eq_desc_clear(&eqdesc); + qbman_eq_desc_set_no_orp(&eqdesc, DPAA2_EQ_RESP_ERR_FQ); + qbman_eq_desc_set_response(&eqdesc, 0, 0); + qbman_eq_desc_set_fq(&eqdesc, dpaa2_qp->tx_vq.fqid); + + if (!DPAA2_PER_LCORE_DPIO) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_SEC_ERR( + "Failed to allocate IO portal, tid: %d\n", + rte_gettid()); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + while (vec->num) { + frames_to_send = (vec->num > dpaa2_eqcr_size) ? + dpaa2_eqcr_size : vec->num; + + for (loop = 0; loop < frames_to_send; loop++) { + /*Clear the unused FD fields before sending*/ + memset(&fd_arr[loop], 0, sizeof(struct qbman_fd)); + ret = sess->build_raw_dp_fd(drv_ctx, + &vec->src_sgl[loop], + &vec->iv[loop], + &vec->digest[loop], + &vec->auth_iv[loop], + ofs, + user_data[loop], + &fd_arr[loop]); + if (ret) { + DPAA2_SEC_ERR("error: Improper packet contents" + " for crypto operation"); + goto skip_tx; + } + status[loop] = 1; + } + + loop = 0; + retry_count = 0; + while (loop < frames_to_send) { + ret = qbman_swp_enqueue_multiple(swp, &eqdesc, + &fd_arr[loop], + &flags[loop], + frames_to_send - loop); + if (unlikely(ret < 0)) { + retry_count++; + if (retry_count > DPAA2_MAX_TX_RETRY_COUNT) { + num_tx += loop; + vec->num -= loop; + goto skip_tx; + } + } else { + loop += ret; + retry_count = 0; + } + } + + num_tx += loop; + vec->num -= loop; + } +skip_tx: + dpaa2_qp->tx_vq.tx_pkts += num_tx; + dpaa2_qp->tx_vq.err_pkts += vec->num; + + return num_tx; +} + +static __rte_always_inline int +dpaa2_sec_raw_enqueue(void *qp_data, uint8_t *drv_ctx, + struct rte_crypto_vec *data_vec, + uint16_t n_data_vecs, union rte_crypto_sym_ofs ofs, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *aad_or_auth_iv, + void *user_data) +{ + RTE_SET_USED(qp_data); + RTE_SET_USED(drv_ctx); + RTE_SET_USED(data_vec); + RTE_SET_USED(n_data_vecs); + RTE_SET_USED(ofs); + RTE_SET_USED(iv); + RTE_SET_USED(digest); + RTE_SET_USED(aad_or_auth_iv); + RTE_SET_USED(user_data); + + return 0; +} + +static inline void * +sec_fd_to_userdata(const struct qbman_fd *fd) +{ + struct qbman_fle *fle; + void *userdata; + fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); + + DPAA2_SEC_DP_DEBUG("FLE addr = %x - %x, offset = %x\n", + fle->addr_hi, fle->addr_lo, fle->fin_bpid_offset); + userdata = (struct rte_crypto_op *)DPAA2_GET_FLE_ADDR((fle - 1)); + /* free the fle memory */ + rte_free((void *)(fle-1)); + + return userdata; +} + +static __rte_always_inline uint32_t +dpaa2_sec_raw_dequeue_burst(void *qp_data, uint8_t *drv_ctx, + rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count, + uint32_t max_nb_to_dequeue, + rte_cryptodev_raw_post_dequeue_t post_dequeue, + void **out_user_data, uint8_t is_user_data_array, + uint32_t *n_success, int *dequeue_status) +{ + RTE_SET_USED(drv_ctx); + RTE_SET_USED(get_dequeue_count); + + /* Function is responsible to receive frames for a given device and VQ*/ + struct dpaa2_sec_qp *dpaa2_qp = (struct dpaa2_sec_qp *)qp_data; + struct qbman_result *dq_storage; + uint32_t fqid = dpaa2_qp->rx_vq.fqid; + int ret, num_rx = 0; + uint8_t is_last = 0, status; + struct qbman_swp *swp; + const struct qbman_fd *fd; + struct qbman_pull_desc pulldesc; + void *user_data; + uint32_t nb_ops = max_nb_to_dequeue; + + if (!DPAA2_PER_LCORE_DPIO) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_SEC_ERR( + "Failed to allocate IO portal, tid: %d\n", + rte_gettid()); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + dq_storage = dpaa2_qp->rx_vq.q_storage->dq_storage[0]; + + qbman_pull_desc_clear(&pulldesc); + qbman_pull_desc_set_numframes(&pulldesc, + (nb_ops > dpaa2_dqrr_size) ? + dpaa2_dqrr_size : nb_ops); + qbman_pull_desc_set_fq(&pulldesc, fqid); + qbman_pull_desc_set_storage(&pulldesc, dq_storage, + (uint64_t)DPAA2_VADDR_TO_IOVA(dq_storage), + 1); + + /*Issue a volatile dequeue command. */ + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + DPAA2_SEC_WARN( + "SEC VDQ command is not issued : QBMAN busy"); + /* Portal was busy, try again */ + continue; + } + break; + }; + + /* Receive the packets till Last Dequeue entry is found with + * respect to the above issues PULL command. + */ + while (!is_last) { + /* Check if the previous issued command is completed. + * Also seems like the SWP is shared between the Ethernet Driver + * and the SEC driver. + */ + while (!qbman_check_command_complete(dq_storage)) + ; + + /* Loop until the dq_storage is updated with + * new token by QBMAN + */ + while (!qbman_check_new_result(dq_storage)) + ; + /* Check whether Last Pull command is Expired and + * setting Condition for Loop termination + */ + if (qbman_result_DQ_is_pull_complete(dq_storage)) { + is_last = 1; + /* Check for valid frame. */ + status = (uint8_t)qbman_result_DQ_flags(dq_storage); + if (unlikely( + (status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) { + DPAA2_SEC_DP_DEBUG("No frame is delivered\n"); + continue; + } + } + + fd = qbman_result_DQ_fd(dq_storage); + user_data = sec_fd_to_userdata(fd); + if (is_user_data_array) + out_user_data[num_rx] = user_data; + else + out_user_data[0] = user_data; + if (unlikely(fd->simple.frc)) { + /* TODO Parse SEC errors */ + DPAA2_SEC_ERR("SEC returned Error - %x", + fd->simple.frc); + status = RTE_CRYPTO_OP_STATUS_ERROR; + } else { + status = RTE_CRYPTO_OP_STATUS_SUCCESS; + } + post_dequeue(user_data, num_rx, status); + + num_rx++; + dq_storage++; + } /* End of Packet Rx loop */ + + dpaa2_qp->rx_vq.rx_pkts += num_rx; + *dequeue_status = 1; + *n_success = num_rx; + + DPAA2_SEC_DP_DEBUG("SEC Received %d Packets\n", num_rx); + /*Return the total number of packets received to DPAA2 app*/ + return num_rx; +} + +static __rte_always_inline void * +dpaa2_sec_raw_dequeue(void *qp_data, uint8_t *drv_ctx, int *dequeue_status, + enum rte_crypto_op_status *op_status) +{ + RTE_SET_USED(qp_data); + RTE_SET_USED(drv_ctx); + RTE_SET_USED(dequeue_status); + RTE_SET_USED(op_status); + + return NULL; +} + +static __rte_always_inline int +dpaa2_sec_raw_enqueue_done(void *qp_data, uint8_t *drv_ctx, uint32_t n) +{ + RTE_SET_USED(qp_data); + RTE_SET_USED(drv_ctx); + RTE_SET_USED(n); + + return 0; +} + +static __rte_always_inline int +dpaa2_sec_raw_dequeue_done(void *qp_data, uint8_t *drv_ctx, uint32_t n) +{ + RTE_SET_USED(qp_data); + RTE_SET_USED(drv_ctx); + RTE_SET_USED(n); + + return 0; +} + +int +dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id, + struct rte_crypto_raw_dp_ctx *raw_dp_ctx, + enum rte_crypto_op_sess_type sess_type, + union rte_cryptodev_session_ctx session_ctx, uint8_t is_update) +{ + dpaa2_sec_session *sess; + struct dpaa2_sec_raw_dp_ctx *dp_ctx; + RTE_SET_USED(qp_id); + + if (!is_update) { + memset(raw_dp_ctx, 0, sizeof(*raw_dp_ctx) + + sizeof(dpaa2_sec_session)); + raw_dp_ctx->qp_data = dev->data->queue_pairs[qp_id]; + } + + if (sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) + sess = (dpaa2_sec_session *)get_sec_session_private_data( + session_ctx.sec_sess); + else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) + sess = (dpaa2_sec_session *)get_sym_session_private_data( + session_ctx.crypto_sess, cryptodev_driver_id); + else + return -ENOTSUP; + raw_dp_ctx->dequeue_burst = dpaa2_sec_raw_dequeue_burst; + raw_dp_ctx->dequeue = dpaa2_sec_raw_dequeue; + raw_dp_ctx->dequeue_done = dpaa2_sec_raw_dequeue_done; + raw_dp_ctx->enqueue_burst = dpaa2_sec_raw_enqueue_burst; + raw_dp_ctx->enqueue = dpaa2_sec_raw_enqueue; + raw_dp_ctx->enqueue_done = dpaa2_sec_raw_enqueue_done; + + if (sess->ctxt_type == DPAA2_SEC_CIPHER_HASH) + sess->build_raw_dp_fd = build_raw_dp_chain_fd; + else if (sess->ctxt_type == DPAA2_SEC_AEAD) + sess->build_raw_dp_fd = build_raw_dp_aead_fd; + else if (sess->ctxt_type == DPAA2_SEC_AUTH) + sess->build_raw_dp_fd = build_raw_dp_auth_fd; + else if (sess->ctxt_type == DPAA2_SEC_CIPHER) + sess->build_raw_dp_fd = build_raw_dp_cipher_fd; + else if (sess->ctxt_type == DPAA2_SEC_IPSEC) + sess->build_raw_dp_fd = build_raw_dp_proto_fd; + else if (sess->ctxt_type == DPAA2_SEC_PDCP) + sess->build_raw_dp_fd = build_raw_dp_proto_compound_fd; + else + return -ENOTSUP; + dp_ctx = (struct dpaa2_sec_raw_dp_ctx *)raw_dp_ctx->drv_ctx_data; + dp_ctx->session = sess; + + return 0; +} + +int +dpaa2_sec_get_dp_ctx_size(__rte_unused struct rte_cryptodev *dev) +{ + return sizeof(struct dpaa2_sec_raw_dp_ctx); +} diff --git a/drivers/crypto/dpaa2_sec/meson.build b/drivers/crypto/dpaa2_sec/meson.build index ea1d73a13d..e6e5abb3c1 100644 --- a/drivers/crypto/dpaa2_sec/meson.build +++ b/drivers/crypto/dpaa2_sec/meson.build @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright 2018 NXP +# Copyright 2018,2021 NXP if not is_linux build = false @@ -9,6 +9,7 @@ endif deps += ['security', 'mempool_dpaa2'] sources = files( 'dpaa2_sec_dpseci.c', + 'dpaa2_sec_raw_dp.c', 'mc/dpseci.c', ) From patchwork Thu Aug 12 07:12:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495960 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83525jap; Thu, 12 Aug 2021 00:16:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyngJQ/n4vbAthGJ02ylHDfLbDcCajLKsJ3ooPyrA0toqZtErS/wI2URgb/UW/Y7JHWPf8l X-Received: by 2002:a05:6402:288b:: with SMTP id eg11mr3781140edb.241.1628752612904; Thu, 12 Aug 2021 00:16:52 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id di25si1803681edb.456.2021.08.12.00.16.52; Thu, 12 Aug 2021 00:16:52 -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=QAkVnlt7; 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 CEC1B41227; Thu, 12 Aug 2021 09:16:18 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20088.outbound.protection.outlook.com [40.107.2.88]) by mails.dpdk.org (Postfix) with ESMTP id 73AFD4121A for ; Thu, 12 Aug 2021 09:16:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GZocGW3sUzrUCg2mpd8nW4t2+d3CO94MNIAiSMN5JAPAyf/VfidizOhosR+2Bsjn+IjfXQJsURIYlMFGeSXX1c8i5ujBu3OgtR0cuG/dSIzwnYaeA7RdV1Xhs9IIg6qCIg+QIXETs1HbIfdm7WsQelA/dfHvY4bhAUsnTvmDZ9S4ILwColn/iyrMDQafMk6ZkzakEVxL10JrvuIkDiWfs688c2cZ78y9XbxhG39jkyXGxmm8SRjSbUI6je2kWAKYcL5183Q2A53XoYc3ivw+o1kIW7PvRPeRFpD94RtzFRiI1+cew1JzFnxHtwDJfsoPog8bszPcSKQe1VT9PhOs0A== 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=kKhL+HnRHN3YbKDfgRKgLgDb2iirBd8l+ojgqk93ou4=; b=ENcUbSZ5ho42H/BdLjMB5jcD7cwVXyOTLoGfarm9Sv4OhV9zSruGA1tgo4/VgL6T6TltpLGQdxvb3nNAmDXn/hXRp50n1Ef6MWkFW9NJTHGNKpdG/3iBg+SfhTUBfpEuOmOOvitHsa2vqxTYr7SUFzDtDPf1X4GQ2SegB46mtdcGJiWu/PpsR6BLd1c/MgcfpPInqeMTlNqryN4LFmxe9qwFg7I+DtqUedw0F5Ydvklx1fQnlBVYABuKB9+x7Xp1v2YjgtlmHBtoLDGlcyY/FyAJ839Rszn736B+sP3XDUQext3Zop8QtmOLujZ+NqCKKZ+LqWZQ+WNnehMnIbH/iA== 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=kKhL+HnRHN3YbKDfgRKgLgDb2iirBd8l+ojgqk93ou4=; b=QAkVnlt75ONo1oDen/0XvWnmjX1mhaSGqytIrzrTendFpz+vlK2wx9HU3CVf3MTKz2xnLwE+e74FQdJ96LVIOPXNXEWlsSXfqQ1YmiUSRzWA5LlDm1VH7ZYz+iOqA8UOccGW4xDOO0Z/28unSjkg1eh5TQNCAGnyOUBR4jk8O0c= 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:14 +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:14 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:34 +0530 Message-Id: <20210812071244.28799-7-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:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 34fc260e-e9ad-4475-691e-08d95d6111f1 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1775; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p1NiJXEnJSWWebDvBsjM9OPjmzkw4FWeU4SFOeRjHPGO5OlH2VszhYuMw3XhpCpPYYQEZyX2T2nFK9GFDU+C5Dj8K8T3ot2SQPIbe4gi8sOm/qW5w6M+iJw3W5alUnEdnMAM+MGTdjG2I8LtJ8E9AFVGvLINubdnYJrCTgzT6UYOfbsqbRY0Jt3Nunybbk9NZ0mBfOGJNdICy/rvXbrvpmAsJMiy3xV/UDokLGUe5Iu01IzNTwnjgxLZ7QyC6f4av/qvxznHkto4qhh4CHZ/YA+QG5HUgonALA8xtky2vwfCVhs2bLS46ex7kH1LReAxXzBPYJJKLrnRxEq8khdEr8Fda7UsCOY76pIdBbPoycTn9BaIplk7qAXvzXMUrJuxuZ3wTw/HxjISWz2iYV3xl5Y5zlZNwLuXGyMGW0sGMoiiQcbmxX6Iz7C48oleIUZ7l98dvLb5nmHDUVU4tgJ+OEJGDyvqEwERmOIBvKSbjF4efYAkofEpkCXmnXLK/5rUY3TjYDeTgQucxVJ8lMYwynnnRXnwBV3AzOXn8L9tbkO0+zoBxhmzJ/pjL++3YzZQZeKFhfskaqDPMn2hkpRXAdLIncjSjxZbQzGnqs95pVg+refkAs3md/X3sLqc+xqf9m3rWCr+E6xCaVfZ13ptNxgS9pX3u9vAhh8d/M3g8YOTW1S/4t9YjUpDW8YNMq6vBB0Q6fjWtxJiX+wGDkdS4A== 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: K9cGaUxAXRcZFFgHD7kSXuKzKgjfDU1WP4JbPceam/pyNEqpzdAetyInclugfC5MMedXONzrrBUqUF7bVG2rNCcvR2M4SfxT/wTiNMPb2wPtNPWhJBg8AeUZ2HydBExg/Ep7lQ1zCr871GVlfzkmCkhLCMSdG3b8ToTE9MW0MlR7lSdnYrS2hcno+2kghEW6XcGUp+/RsgarnvEqmHOIhyJ4wCqijMrwd8Nf+OSYlJkOJatDoYeTbdd2YN5JiZiWVgOYnLSa5WBR4ubWirryYkJLqgUykzwhWXZHpVyNIHoMEKYXtP3lxvCzcFt+2cGpexE0XqxTCl0Pl6QBxdHmB5OrmuFo9WrF7S6l48N+hHCz8149kWBCLH+iQ/Wcc0FUAFctMW/a8dleTpG636d3t0KiVc0XZAMahpqr6YEtU4IW4MiH5vNAYr0uoYNhn2zS07g9p84C/BpLPwnMT2zbtzLesvAwwnQZRQ3qiVzZfa6mSJXCk1hCCesiOooZUzE9WlXMIHa0MGreXW7efo1Oe9GBDFLrb80++QQkTNsMGcaD4wmb304avfU4lOAXS/5reIlXH+wHjh+btZPQ5jL3LJmx2OhODNlqeYg7hVoFR30emtvLKfHX65rff4GrbvK0vPNsTWpbobyfhzAyrxosCf6ocHxzFzohK86nnkaoc1q7RgkYvxZ0pEYsT5b/zsGhRzGnYS61epAkAeW8r88ESvtO944W8VQ6TpS2Bxp8kRi93TfcgL1oeZseUHuM8ae/8xoEGMGOaBi+8QUK2CGBeJmnGSsJHwJJMHmkVr8kaSkHA9S5kb8Q4nXFDPfsaEumBRVTnrCgThPyICRGQOMDK/lMcGRGeVs1arq9mdll866ZIN9zkH9YMbHfLXjIx2XVBUYAEsbY7yScHI7Yw17m3oaHkds/cVoj0lUDH79q1F2iffNZGfls/HaonysiRLOpM17YkTI9CM0nq6KsuvbLWbokevi3NYclQK0Uobr1Epq/kaogbeEpr4aXoI9ooYGZ6e2fZSNKfdhi5jLGtccxyWPsu4pwNiDn1dh9LeqW/1F7whdgkIVGfIqtR9R2HL31KcJCQPD7lJ3JA1ARK5WUMmktL/js7RRGIkwWmH68KX9KreNm2xSiv08Azb9c0IgHdpfAJiHbREZDWyE8mru/1dd3R4Dq05feiIZbGbEd7TvgEHQjBWl1v3ZxS4xXhCNdl5jXN4VJiGXz7JLfMPeB72Ns3tXT6NRImpeDoUjP8wox41SGVpMi1BYp86SbjSjWjOw/k7iRGD2rTW+qJNcBS1lHm8uzuYT6rzvUuKIM/Pl3bH9tql1Ao2TC8Hv4heOz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34fc260e-e9ad-4475-691e-08d95d6111f1 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:14.6170 (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: hh0qAwV1xLZmcNZ2QKmxR5p4W1L9xLGp66beKBuqx6OUREHmn+euJ1yullJoNjjRklsdEAjxE46tP+9kI20SFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 06/16] crypto/dpaa2_sec: support AUTH only with raw buffer APIs 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" From: Gagandeep Singh Auth only with raw buffer APIs has been supported in this patch. Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 21 ---- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 114 ++++++++++++++++++-- 2 files changed, 108 insertions(+), 27 deletions(-) -- 2.17.1 diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h index 860c9b6520..f6507855e3 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h @@ -231,27 +231,6 @@ typedef struct dpaa2_sec_session_entry { static const struct rte_cryptodev_capabilities dpaa2_sec_capabilities[] = { /* Symmetric capabilities */ - { /* NULL (AUTH) */ - .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, - {.sym = { - .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, - {.auth = { - .algo = RTE_CRYPTO_AUTH_NULL, - .block_size = 1, - .key_size = { - .min = 0, - .max = 0, - .increment = 0 - }, - .digest_size = { - .min = 0, - .max = 0, - .increment = 0 - }, - .iv_size = { 0 } - }, }, - }, }, - }, { /* MD5 */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, {.sym = { diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 10cb4247b0..4c11a79d90 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -11,6 +11,8 @@ #include "dpaa2_sec_priv.h" #include "dpaa2_sec_logs.h" +#include + struct dpaa2_sec_raw_dp_ctx { dpaa2_sec_session *session; uint32_t tail; @@ -73,14 +75,114 @@ build_raw_dp_auth_fd(uint8_t *drv_ctx, void *userdata, struct qbman_fd *fd) { - RTE_SET_USED(drv_ctx); - RTE_SET_USED(sgl); RTE_SET_USED(iv); - RTE_SET_USED(digest); RTE_SET_USED(auth_iv); - RTE_SET_USED(ofs); - RTE_SET_USED(userdata); - RTE_SET_USED(fd); + + dpaa2_sec_session *sess = + ((struct dpaa2_sec_raw_dp_ctx *)drv_ctx)->session; + struct qbman_fle *fle, *sge, *ip_fle, *op_fle; + struct sec_flow_context *flc; + int total_len = 0, data_len = 0, data_offset; + uint8_t *old_digest; + struct ctxt_priv *priv = sess->ctxt; + unsigned int i; + + for (i = 0; i < sgl->num; i++) + total_len += sgl->vec[i].len; + + data_len = total_len - ofs.ofs.auth.head - ofs.ofs.auth.tail; + data_offset = ofs.ofs.auth.head; + + if (sess->auth_alg == RTE_CRYPTO_AUTH_SNOW3G_UIA2 || + sess->auth_alg == RTE_CRYPTO_AUTH_ZUC_EIA3) { + if ((data_len & 7) || (data_offset & 7)) { + DPAA2_SEC_ERR("AUTH: len/offset must be full bytes"); + return -ENOTSUP; + } + + data_len = data_len >> 3; + data_offset = data_offset >> 3; + } + fle = (struct qbman_fle *)rte_malloc(NULL, + FLE_SG_MEM_SIZE(2 * sgl->num), + RTE_CACHE_LINE_SIZE); + if (unlikely(!fle)) { + DPAA2_SEC_ERR("AUTH SG: Memory alloc failed for SGE"); + return -ENOMEM; + } + memset(fle, 0, FLE_SG_MEM_SIZE(2*sgl->num)); + /* first FLE entry used to store mbuf and session ctxt */ + DPAA2_SET_FLE_ADDR(fle, (size_t)userdata); + DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv); + op_fle = fle + 1; + ip_fle = fle + 2; + sge = fle + 3; + + flc = &priv->flc_desc[DESC_INITFINAL].flc; + + /* sg FD */ + DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc)); + DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(op_fle)); + DPAA2_SET_FD_COMPOUND_FMT(fd); + + /* o/p fle */ + DPAA2_SET_FLE_ADDR(op_fle, + DPAA2_VADDR_TO_IOVA(digest->va)); + op_fle->length = sess->digest_length; + + /* i/p fle */ + DPAA2_SET_FLE_SG_EXT(ip_fle); + DPAA2_SET_FLE_ADDR(ip_fle, DPAA2_VADDR_TO_IOVA(sge)); + ip_fle->length = data_len; + + if (sess->iv.length) { + uint8_t *iv_ptr; + + iv_ptr = rte_crypto_op_ctod_offset(userdata, uint8_t *, + sess->iv.offset); + + if (sess->auth_alg == RTE_CRYPTO_AUTH_SNOW3G_UIA2) { + iv_ptr = conv_to_snow_f9_iv(iv_ptr); + sge->length = 12; + } else if (sess->auth_alg == RTE_CRYPTO_AUTH_ZUC_EIA3) { + iv_ptr = conv_to_zuc_eia_iv(iv_ptr); + sge->length = 8; + } else { + sge->length = sess->iv.length; + } + DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(iv_ptr)); + ip_fle->length += sge->length; + sge++; + } + /* i/p 1st seg */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, data_offset); + + if (data_len <= (int)(sgl->vec[0].len - data_offset)) { + sge->length = data_len; + data_len = 0; + } else { + sge->length = sgl->vec[0].len - data_offset; + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } + } + if (sess->dir == DIR_DEC) { + /* Digest verification case */ + sge++; + old_digest = (uint8_t *)(sge + 1); + rte_memcpy(old_digest, digest->va, + sess->digest_length); + DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(old_digest)); + sge->length = sess->digest_length; + ip_fle->length += sess->digest_length; + } + DPAA2_SET_FLE_FIN(sge); + DPAA2_SET_FLE_FIN(ip_fle); + DPAA2_SET_FD_LEN(fd, ip_fle->length); return 0; } From patchwork Thu Aug 12 07:12:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495961 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83611jap; Thu, 12 Aug 2021 00:16:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmY0hrqjMF3mj5XDH/fwBFBN/5vPzF+L2ZD2m+EftW3BMFPrIrTAEdbfHoDDZYfPxhGVWQ X-Received: by 2002:a17:906:a3c3:: with SMTP id ca3mr2274075ejb.337.1628752619571; Thu, 12 Aug 2021 00:16:59 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id aq6si1671486ejc.589.2021.08.12.00.16.59; Thu, 12 Aug 2021 00:16:59 -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=l1W2ECh9; 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 1E5EA4122E; Thu, 12 Aug 2021 09:16:20 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20079.outbound.protection.outlook.com [40.107.2.79]) by mails.dpdk.org (Postfix) with ESMTP id 13FE1411FC for ; Thu, 12 Aug 2021 09:16:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O6alW/u1x2OIn08InBh+Q5EUF7qZ6GsPBZ6PbMy2CF6u+zDlscsoVv2U4x0CuDmNclZeQp8MaQjuiv9Px+fhADXtjCCqz+FDgAP3bXRNqS2hnSOqbHUIgk2LqviDsuZMTUIHRoxvSmrlnCDHp4fPDcSioGghrX/GaB90nBYkHz4UUx5MtU8ZwNj/gD9S7ubgqvyH/duX+5blXmgn9zMCq4ueJAdvEpa90Outd7cNJQ7JIxskks7OM21gvuCH594Fr/7UcHkA1PcrPZD1seIk5NT8QDnuSg1SI+f5ksr7J4qCrCH6QKjSyLXFRPW9PPDAjD/lWBI6yXNSC1BkFE8+vA== 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=t3fRuk+5Dcqm2aJbSFmczw46lG8D/hISJnycA1Ov3OY=; b=NX94ruuonx0J5CvRqjKZVR9+uuK0yWn60pFI8qFsaZw8pUty23ew6c49JzEBmZ18MqZphWIbGSRhw3ly9kzde1nwbuUHl89gkZ5PXlVr/jRFhCEFXS7E4n6UQp6zQqUZJyddZZrdcW4jA9LG7qm7T7u2NGN9Co/b6XSmsy42U8I8ahBuRUJygB/pPIso84exX4ze0gT9K1pFBaqPuzlLoQIMfuD1NR+68WEIP3NlBaf0zJBrJTd/HO+kwyDDNZDiYx9ueD1onu3tJS83T3SGfj9/nWDIbOq/cnTS8oFYrCIPD/pVyW7497QJhtWRLhGxsANHgt+g282ZFdMJgHIjcQ== 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=t3fRuk+5Dcqm2aJbSFmczw46lG8D/hISJnycA1Ov3OY=; b=l1W2ECh973zkpGh1rwC8tYIoweJ7nuCG4icskCw8kH6TFSjwQyEZs0rChaFsu8wzz8edXzJ49RBbFUmK7M8bqL+Wg/Z58dCz+zQwp7HddMQgf4/ZriHluhtBT9gexewQ56kb28NdbkSqLRB5mS7bgSbxRtRCZxOjGQfl3kJmavQ= 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:16 +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:16 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:35 +0530 Message-Id: <20210812071244.28799-8-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:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d64500e-c6d4-4a94-7c9d-08d95d611308 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lute50u99kUYx/hOC+VnJ5wZ+rJEg2f7QpdRlPFRcQkMT7fYJyVwIHsyYeUco3lM3KfsdPrnCgf2kQqLgiKgbf7EB9kUUXdmR4kkK8tOfIMyshZfEIy/DN40FLE++2GaEFiUQE4EMKwsnkCL2fhICe5/Twq7WHX3EmGiN25LKj+knvnxLoV3g717Q0fVjKBP6ejbYrlXhCbfhLGQncev5zybscmf+Ot3s/oQs2q3x+2UA7gkXcvbrii9fwWVSN7ASv+V2AlRczY+axMUQXaQ6vRymMe+r1NvAszxFhnRSPpqOb+LEr91Pu3fGSmWdqikfWhm7dG632LzhjnPoE81kF+ThRfnJNg3Z4QnKcfsCs/vebCeXJHND8+0PoEUBVPziXCp6j6wL1m8ungxd9tMy77mJahQrVU5kNTrxg93okXLX7kcaS106FddqtQjAsUdWXaN2yPuxi0fc2pXzbx4kXkzk8pWVonsLUeTdmQySLS0gXUIRWHXzYEJE0KwZski+AWt3ZRA6nXahWfm4rs6jljt3fOrbngZH4YVHTF2tEsbBC9xld76MZBqAkBofyCfU0t4lVii+U8aeX+JrdSnHAmu5rAJKMSzNYzgewrtKyg9YrrLVzufJwaZl4+S+BWNIujmE1LiteeI12r8H9MeEIZrbbvy098JQ4XmBa+9K6TVRHyDi//hJWfG1/aOwgoYyiDYmQP52NOlgPQneOb6Vg== 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: V0Y7NwUuIx8KXZL3UfY3y0G01lBIplL5//TqfLbzDX3NK2ODUUXh3XUaEN5T3bZwtXOqCIGMNUmfPztUSfsfMI2W83Jvpl16EvBfNHbXrs8n884p3lGZw+1gpujgvEjHK4/5oMelv/2bpNvaikDMbwtwWJmYp+uKkpoMO/+FJHX6jHs+IoCiX1KekV8OpIV9waAtTCRgqqtziOcgQv7mQP6E3KmsD70cQcFqKebeviGxtRWlO15BSTyRS00aRe2JIAhrw4z4u9uYxrSy/WcYLQ5p3MTared9zxrxjUnvKLDg8DktTRs21JCV8mIlCwbG4u3xP22lSk33RtbytsxCnusaZz1Rv/eBR8wCI2ScqMQRG9Aju+xSjhC9Y/i2qoGB3pI6hu9eOP/mjRlO0yc84d+Y7EnC/91xa0Y0+AWUaRbfdADPvGAgsQD0ApiQ+F9IRAhguXQkuaA29G9pUrfPA+HlXlzNjzgfuDmNnEfypPIA1OQfEpTlINquvyLCtMD1WjRgo7hPf3JSL9NtdlidJHHxdxaCtf6hp2gvgYhGbGV82ldKOVAtDcrplctl1YH6vtCl9riLfdQtQugMUgchuyHLs5jEgCKSPf6Z/NsC3kJIpIWcyojbSfi2XKcOa2570i5b0FKcol/LVDXXcbyeVL7StXb+hN+t5oDO/e9t3Al+5i8LpLKdY0OnJ6U17pZwA+cn03YuPz3mNf5+4PVSkC6X0DRUxlR07OYkrnaisJ4Vk5p4cN7LtszMERbNIuLdMVUKrUBrAyGtpXU+TrXakYU/kLE7SDIeobrL/UUNt2oo6FO3NnWxWSkpkj4gFQ9wm5ArAGtzfIBrEQ72NZvDl6eoaqjQeJakZlJkgDFFrOxBnaKvcnJHJsX3gLXfp0A/jVkOpg8O+Q29iJEZi6OrpxE/zhHOYb9KsrspZLs3kQZmwMxOPLStmNRh+Ox4/LY54dVz8VkaNjYbl1fLd1UrH47ubaOJEMpBS9OiPKr+8CVtFjrgr+uZJ2/sdvcEgnXX2PzQowWxctAMgzZ5lPnyNnL96WmP8q+VAyix8AUM4zvN5ywT3Tizd2+wX2BsIOA37wVlzWPtH76q8JK+nEi7MQkqwAmaTLiBq3ADy2aGPDcX94Q/clMQQ95Dv305dbIaztyrtY1ZllF/c0yYWXQ5yVmMzr26F+TThxsMsOvOuZY9OpzqsqXgGamZJwNQVQfI9KH4E1aDr/VC//vD+euMSLi/G6ojZcjK74eOc9eWugKT96p+abvD8tYK297CxMb92YIHi4lxM2ME2+CMPY4pv0DvrE1Qqul3urFO/mlpwEsuKIymKK/LEy0eFCs3SHCO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d64500e-c6d4-4a94-7c9d-08d95d611308 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:16.4031 (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: QvXxsCUKmSAdNxRydOmUU/6M/E7/GtEqDMUHtMle63ucYhRuKKhw0AdNzHu5sPyXyKJlryE7osPv8Kvo8PAZEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 07/16] crypto/dpaa2_sec: support AUTHENC with raw buffer APIs 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" From: Gagandeep Singh This patch supports AUTHENC with raw buufer APIs Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 128 ++++++++++++++++++-- 1 file changed, 121 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 4c11a79d90..79ba0ecb81 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -31,14 +31,128 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, void *userdata, struct qbman_fd *fd) { - RTE_SET_USED(drv_ctx); - RTE_SET_USED(sgl); - RTE_SET_USED(iv); - RTE_SET_USED(digest); RTE_SET_USED(auth_iv); - RTE_SET_USED(ofs); - RTE_SET_USED(userdata); - RTE_SET_USED(fd); + + dpaa2_sec_session *sess = + ((struct dpaa2_sec_raw_dp_ctx *)drv_ctx)->session; + struct ctxt_priv *priv = sess->ctxt; + struct qbman_fle *fle, *sge, *ip_fle, *op_fle; + struct sec_flow_context *flc; + int data_len = 0, auth_len = 0, cipher_len = 0; + unsigned int i = 0; + uint16_t auth_hdr_len = ofs.ofs.cipher.head - + ofs.ofs.auth.head; + + uint16_t auth_tail_len = ofs.ofs.auth.tail; + uint32_t auth_only_len = (auth_tail_len << 16) | auth_hdr_len; + int icv_len = sess->digest_length; + uint8_t *old_icv; + uint8_t *iv_ptr = iv->va; + + for (i = 0; i < sgl->num; i++) + data_len += sgl->vec[i].len; + + cipher_len = data_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; + auth_len = data_len - ofs.ofs.auth.head - ofs.ofs.auth.tail; + /* first FLE entry used to store session ctxt */ + fle = (struct qbman_fle *)rte_malloc(NULL, + FLE_SG_MEM_SIZE(2 * sgl->num), + RTE_CACHE_LINE_SIZE); + if (unlikely(!fle)) { + DPAA2_SEC_ERR("AUTHENC SG: Memory alloc failed for SGE"); + return -ENOMEM; + } + memset(fle, 0, FLE_SG_MEM_SIZE(2 * sgl->num)); + DPAA2_SET_FLE_ADDR(fle, (size_t)userdata); + DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv); + + op_fle = fle + 1; + ip_fle = fle + 2; + sge = fle + 3; + + /* Save the shared descriptor */ + flc = &priv->flc_desc[0].flc; + + /* Configure FD as a FRAME LIST */ + DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(op_fle)); + DPAA2_SET_FD_COMPOUND_FMT(fd); + DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc)); + + /* Configure Output FLE with Scatter/Gather Entry */ + DPAA2_SET_FLE_SG_EXT(op_fle); + DPAA2_SET_FLE_ADDR(op_fle, DPAA2_VADDR_TO_IOVA(sge)); + + if (auth_only_len) + DPAA2_SET_FLE_INTERNAL_JD(op_fle, auth_only_len); + + op_fle->length = (sess->dir == DIR_ENC) ? + (cipher_len + icv_len) : + cipher_len; + + /* Configure Output SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.auth.head); + sge->length = sgl->vec[0].len - ofs.ofs.auth.head; + + /* o/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } + + if (sess->dir == DIR_ENC) { + sge++; + DPAA2_SET_FLE_ADDR(sge, + digest->iova); + sge->length = icv_len; + } + DPAA2_SET_FLE_FIN(sge); + + sge++; + + /* Configure Input FLE with Scatter/Gather Entry */ + DPAA2_SET_FLE_ADDR(ip_fle, DPAA2_VADDR_TO_IOVA(sge)); + DPAA2_SET_FLE_SG_EXT(ip_fle); + DPAA2_SET_FLE_FIN(ip_fle); + + ip_fle->length = (sess->dir == DIR_ENC) ? + (auth_len + sess->iv.length) : + (auth_len + sess->iv.length + + icv_len); + + /* Configure Input SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(iv_ptr)); + sge->length = sess->iv.length; + + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.auth.head); + sge->length = sgl->vec[0].len - ofs.ofs.auth.head; + + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } + + if (sess->dir == DIR_DEC) { + sge++; + old_icv = (uint8_t *)(sge + 1); + memcpy(old_icv, digest->va, + icv_len); + DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(old_icv)); + sge->length = icv_len; + } + + DPAA2_SET_FLE_FIN(sge); + if (auth_only_len) { + DPAA2_SET_FLE_INTERNAL_JD(ip_fle, auth_only_len); + DPAA2_SET_FD_INTERNAL_JD(fd, auth_only_len); + } + DPAA2_SET_FD_LEN(fd, ip_fle->length); return 0; } From patchwork Thu Aug 12 07:12:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495962 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83666jap; Thu, 12 Aug 2021 00:17:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhK21gU+GaQZuLHWAbniXgUv1bBzp3hbxNVQOTiujs5j+bnf+d3tsSnj7C8clnW0njcnXg X-Received: by 2002:a50:fa89:: with SMTP id w9mr3790313edr.142.1628752626532; Thu, 12 Aug 2021 00:17:06 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id e9si1600022eja.746.2021.08.12.00.17.06; Thu, 12 Aug 2021 00:17:06 -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=ATJAgpeY; 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 44A7441234; Thu, 12 Aug 2021 09:16:21 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20058.outbound.protection.outlook.com [40.107.2.58]) by mails.dpdk.org (Postfix) with ESMTP id D4F9D41228 for ; Thu, 12 Aug 2021 09:16:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i/wr80nCW10+x2fwCNvRI5GnCzxiS5nmXaWnPkYQFUDBTRZI2yfEO+G+46Cb1K3buXTGLBhCmqgLZbDOGrsKtCeEHSE+9F0YleS6/YJFm/meuSr+7KLqaV4OfW98p+tYwNfmze8qo2hXvc3HLxnqt/BodlizAqdksnBsVS0PHUCm4Zg+HX49tpIUkqkGJnpiwtgtdo2eZBU7/diKl5FiJBBKCy2yiCTyuv1vKK6/iZ60P6tYGealrrY6QwWgM/190QlOFQ6Re23GGLFeDbIo032V05Y1H86U9FnLy71KS7k3tk/W4aS/wnpc+rmhao5jisqqNuYths1umXHunJ+h4A== 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=nWqXNWEr4a6i8egkR07rxpTsafyVbCvpEDpE7I3CS3g=; b=jjOf601IKFh5S+8nq2pGjZYxvjkDNXnkrDj4+vvN/ZIkSxvst9H5/hzUrMZSjaUd2yH2jRmvtmcFkNyAkPh5yfUq0ZpVUQDRqYj+Dm/cA8CzV4QmyQ1Tww0FBJkjRbBLKJN4EzjBgXher1QfcFMEdh3mmsKrOa2kRrRbsSoySJ/msThjgHeNYu4buwbEk7WTm236urZQfl7bA80+J5hlzzcUWsctn2PbS9Xoj/048lSBO2HJdqN1iTqwr/YRslKbzmI4eSz6RUqw3kTaom7wxLz/v2cksRoXSb8gSO2Mow7F+4WBF+H4wwj5wqhNuENmKwjbAZ6E5lvIN62VBDhejA== 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=nWqXNWEr4a6i8egkR07rxpTsafyVbCvpEDpE7I3CS3g=; b=ATJAgpeYOtN3pZl8VgNNFoLw7A/hYTT0QNSOtFiinzA4Y5EJbqkFO0I+G6uo+g4k644yNE5gJRTrHwcinEgIDR3Xx/RTNWP+bMXkfMOCfzKzppFpHbt4roNc2RjuFZ/O2KkbgyDqDybiIivNPlGDbAwtOaats/ET2eY8Im/6ns8= 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:18 +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:18 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:36 +0530 Message-Id: <20210812071244.28799-9-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:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d83a74e9-d94b-4b2c-f41e-08d95d611412 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4aK4dFRBf0/mUBLlDRbAD1r6k6glhOEHUvfE41z2+Wk40I6MOKrtFJqfYXMZ7aNgAgbaPZ1cWHt+Ltg7vwxDhseITxnAJx6e8GN9NYkMZ7JW5UKPBIQ7jVv2i197sCXDosI3LWNThR4ltkOXHsUz4UOl7M/iHWKQQ443uzHQjeFhBkglPIYz1d+jPiRy90BaYQzEaeJ7p+JCLWKhur117S8CvkAej3LhadYTAXX/XyEsXXDE3Y2osmS7whSVsYqQCakf332Siw3w/LtVWWXz91NmybGDMNiBe304r6TT4i6tv+fgjsYRF8PTbFaQYNOpRYkaIJAAZXzo5YW7Ia+w2nY973GbBijdaxs+ehSDAYTm6SrcojYMJglUU8GUDv7dVznivOYSpyqaD04l2F1PG0/H9on6A3gzfDbhvGDFzNe26c81na75InQF1FVEAtsTV++ylDyIL4GMnEr0yCJgJsbpySkJXlWGomJu9830acGBY4jQn9Mh92vjieCt6hrn3OaAdbLQ7bciffThqKubIYCLky7x0vJpCy/YAY24/RjvIJq3JqjP0ZDuwZSFnGvYUmIgCtSkon8Yy5cEDqvfcmv2ch+BQBchE1hN+nC5GnlgFFWEXpwGlQXvIKhLOA55doBA1sl2ioq0YX9VknhLzDf7yR5DZso/24eiq6EL9Ln7Pm9B64ARidk2F4RVnwhjj+nC8QjhxVBK0yAl0w+KDg== 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: D9a32eyFXbg664df/sKvWpFB9OXL0iRFtlW1yRhB5yafaqaN3vpmel/9slNg9DQjs5iX48sIYVe3DfkgvPy3pbDnA5OseRnMGS1KJPsTbaHQ+ECJ0SqIFXKg1TjMKsUzeyOmKhGbP1uIQseXTEdW6HB53Om4562HDR4ORzUClbBRig3YsJrumOGS6M0hDd6qwCGZhR5kwkZ2hVPyNfkgBzN9Iatojo9rq7SumkjAMsB5xbExslGiuCnPHg65IkkeyfK8T4GFM4yD6pM6AOKMLg7xwwdOa4XfTjN0vzdT+qerfKhcsQE8wLWoRCwh0EJB6G2/ONrtHrz0Ef7AqLNvf260TadFZkFcsnx6FEXOyjSctwmKtNHhU+GqpdMD2qU0x9tdLvNv6mZa6ZJhK6yuRz/kaH7qDuhTTOvOJ5wRfYMjVbp3tRw0VQu4VnOos+b5xnVQGKYVSFXUPq0xoq3vdTyH+hkH8uYlGDmqHaXqW5DnBdMjPYvRoUClN/yNUET3vQlbyWflTOd7gkQ5LkVd76rbSXsLEsBNvDQR/nWtjMdDoCLrOAEWB9sx4sCKMgKP3KPnrQ/Sz1SXiJqpceR9AAehqHxwWGgMtB+mSkakm4A4n3gNID9y5zKLanrBSU7tTGn+V8OjwoRDxgPTZ0Koa9jYd2neoiS4fBu1Uy2eFw+INa7p+yJvolBjHS3UyFipDI/f4+QtuNnl0suN54pz1cFbA3d3fQ2IobZR1AA/DQ8eG0br6Bi3sU1vJM4i27d+Ui0JbXGYtDlg0L1Lv75VpXYGWzGB5Z+380gZThIgZlVawATlftJ4WmBla8zQTmdOcPdzWz+p0G9IBvFjRXpdvu13arEC6NEAAdX0QAr9wnd+Sx9zQnxqvCkIdjnxc6xxU2HdHjZ2Md3/247nqkTTULYAUWCaXe+JUfu8yiBanZDWVcYAA9ib+le6vd40cthvVxNCX+kCFj1c9XcM/IoLa3ic0qR6e5efztkVSBYoL75m9tjcP5uxOq3YZT6SyqiLV3hk/VekROGN7LE4YZvmm8KgMheoc+yDmO67jRzvM24hK1/I/JxwwXUhwSlVrFJd1iaLrBRIRF9FB0TlLeE8g04KXQyV6B2Xv+yZM87xSQ5dZ7IXEOxCxg/DmzlCJ1/CUSAbn+G1dIAzUbr2o6X9RUQooLhId/yeSRae9QYNbyZvuAOJB4aSbUfCbBKXoFoHtpFyw2w/Iw23G/9XGN/tb7YkebL6L4l4oW4jMKIFR1dKPU+kJ7eyzqkOsVzmsKFZP7WJYBi2YkvDHY36czq9/Gyg2rPb+cVUDDZLySt/WUhJMgiR0SxWK5SUKfe9Qrte X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d83a74e9-d94b-4b2c-f41e-08d95d611412 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:18.1694 (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: j/+E7eL30OvqaermxJuwnfQEvE6JKzfh6UKiUwnT33wj5Itf8PaufW1M+NAUNJET9rDh3HI0smLZDEOTHmjMpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 08/16] crypto/dpaa2_sec: support AEAD with raw buffer APIs 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" From: Gagandeep Singh add raw vector API support for AEAD algos. Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 249 +++++++++++++++++--- 1 file changed, 214 insertions(+), 35 deletions(-) -- 2.17.1 diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 79ba0ecb81..41f24c93b6 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -167,14 +167,126 @@ build_raw_dp_aead_fd(uint8_t *drv_ctx, void *userdata, struct qbman_fd *fd) { - RTE_SET_USED(drv_ctx); - RTE_SET_USED(sgl); - RTE_SET_USED(iv); - RTE_SET_USED(digest); - RTE_SET_USED(auth_iv); - RTE_SET_USED(ofs); - RTE_SET_USED(userdata); - RTE_SET_USED(fd); + dpaa2_sec_session *sess = + ((struct dpaa2_sec_raw_dp_ctx *)drv_ctx)->session; + struct ctxt_priv *priv = sess->ctxt; + struct qbman_fle *fle, *sge, *ip_fle, *op_fle; + struct sec_flow_context *flc; + uint32_t auth_only_len = sess->ext_params.aead_ctxt.auth_only_len; + int icv_len = sess->digest_length; + uint8_t *old_icv; + uint8_t *IV_ptr = iv->va; + unsigned int i = 0; + int data_len = 0, aead_len = 0; + + for (i = 0; i < sgl->num; i++) + data_len += sgl->vec[i].len; + + aead_len = data_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; + + /* first FLE entry used to store mbuf and session ctxt */ + fle = (struct qbman_fle *)rte_malloc(NULL, + FLE_SG_MEM_SIZE(2 * sgl->num), + RTE_CACHE_LINE_SIZE); + if (unlikely(!fle)) { + DPAA2_SEC_ERR("GCM SG: Memory alloc failed for SGE"); + return -ENOMEM; + } + memset(fle, 0, FLE_SG_MEM_SIZE(2 * sgl->num)); + DPAA2_SET_FLE_ADDR(fle, (size_t)userdata); + DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv); + + op_fle = fle + 1; + ip_fle = fle + 2; + sge = fle + 3; + + /* Save the shared descriptor */ + flc = &priv->flc_desc[0].flc; + + /* Configure FD as a FRAME LIST */ + DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(op_fle)); + DPAA2_SET_FD_COMPOUND_FMT(fd); + DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc)); + + /* Configure Output FLE with Scatter/Gather Entry */ + DPAA2_SET_FLE_SG_EXT(op_fle); + DPAA2_SET_FLE_ADDR(op_fle, DPAA2_VADDR_TO_IOVA(sge)); + + if (auth_only_len) + DPAA2_SET_FLE_INTERNAL_JD(op_fle, auth_only_len); + + op_fle->length = (sess->dir == DIR_ENC) ? + (aead_len + icv_len) : + aead_len; + + /* Configure Output SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.cipher.head); + sge->length = sgl->vec[0].len - ofs.ofs.cipher.head; + + /* o/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } + + if (sess->dir == DIR_ENC) { + sge++; + DPAA2_SET_FLE_ADDR(sge, digest->iova); + sge->length = icv_len; + } + DPAA2_SET_FLE_FIN(sge); + + sge++; + + /* Configure Input FLE with Scatter/Gather Entry */ + DPAA2_SET_FLE_ADDR(ip_fle, DPAA2_VADDR_TO_IOVA(sge)); + DPAA2_SET_FLE_SG_EXT(ip_fle); + DPAA2_SET_FLE_FIN(ip_fle); + ip_fle->length = (sess->dir == DIR_ENC) ? + (aead_len + sess->iv.length + auth_only_len) : + (aead_len + sess->iv.length + auth_only_len + + icv_len); + + /* Configure Input SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(IV_ptr)); + sge->length = sess->iv.length; + + sge++; + if (auth_only_len) { + DPAA2_SET_FLE_ADDR(sge, auth_iv->iova); + sge->length = auth_only_len; + sge++; + } + + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.cipher.head); + sge->length = sgl->vec[0].len - ofs.ofs.cipher.head; + + /* i/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } + + if (sess->dir == DIR_DEC) { + sge++; + old_icv = (uint8_t *)(sge + 1); + memcpy(old_icv, digest->va, icv_len); + DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(old_icv)); + sge->length = icv_len; + } + + DPAA2_SET_FLE_FIN(sge); + if (auth_only_len) { + DPAA2_SET_FLE_INTERNAL_JD(ip_fle, auth_only_len); + DPAA2_SET_FD_INTERNAL_JD(fd, auth_only_len); + } + DPAA2_SET_FD_LEN(fd, ip_fle->length); return 0; } @@ -311,36 +423,104 @@ build_raw_dp_proto_fd(uint8_t *drv_ctx, void *userdata, struct qbman_fd *fd) { - RTE_SET_USED(drv_ctx); - RTE_SET_USED(sgl); RTE_SET_USED(iv); RTE_SET_USED(digest); RTE_SET_USED(auth_iv); RTE_SET_USED(ofs); - RTE_SET_USED(userdata); - RTE_SET_USED(fd); - return 0; -} + dpaa2_sec_session *sess = + ((struct dpaa2_sec_raw_dp_ctx *)drv_ctx)->session; + struct ctxt_priv *priv = sess->ctxt; + struct qbman_fle *fle, *sge, *ip_fle, *op_fle; + struct sec_flow_context *flc; + uint32_t in_len = 0, out_len = 0, i; -static int -build_raw_dp_proto_compound_fd(uint8_t *drv_ctx, - struct rte_crypto_sgl *sgl, - struct rte_crypto_va_iova_ptr *iv, - struct rte_crypto_va_iova_ptr *digest, - struct rte_crypto_va_iova_ptr *auth_iv, - union rte_crypto_sym_ofs ofs, - void *userdata, - struct qbman_fd *fd) -{ - RTE_SET_USED(drv_ctx); - RTE_SET_USED(sgl); - RTE_SET_USED(iv); - RTE_SET_USED(digest); - RTE_SET_USED(auth_iv); - RTE_SET_USED(ofs); - RTE_SET_USED(userdata); - RTE_SET_USED(fd); + /* first FLE entry used to store mbuf and session ctxt */ + fle = (struct qbman_fle *)rte_malloc(NULL, + FLE_SG_MEM_SIZE(2 * sgl->num), + RTE_CACHE_LINE_SIZE); + if (unlikely(!fle)) { + DPAA2_SEC_DP_ERR("Proto:SG: Memory alloc failed for SGE"); + return -ENOMEM; + } + memset(fle, 0, FLE_SG_MEM_SIZE(2 * sgl->num)); + DPAA2_SET_FLE_ADDR(fle, (size_t)userdata); + DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv); + + /* Save the shared descriptor */ + flc = &priv->flc_desc[0].flc; + op_fle = fle + 1; + ip_fle = fle + 2; + sge = fle + 3; + + DPAA2_SET_FD_IVP(fd); + DPAA2_SET_FLE_IVP(op_fle); + DPAA2_SET_FLE_IVP(ip_fle); + + /* Configure FD as a FRAME LIST */ + DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(op_fle)); + DPAA2_SET_FD_COMPOUND_FMT(fd); + DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc)); + + /* Configure Output FLE with Scatter/Gather Entry */ + DPAA2_SET_FLE_SG_EXT(op_fle); + DPAA2_SET_FLE_ADDR(op_fle, DPAA2_VADDR_TO_IOVA(sge)); + + /* Configure Output SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[0].len; + out_len += sge->length; + /* o/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + out_len += sge->length; + } + sge->length = sgl->vec[i - 1].tot_len; + out_len += sge->length; + + DPAA2_SET_FLE_FIN(sge); + op_fle->length = out_len; + + sge++; + + /* Configure Input FLE with Scatter/Gather Entry */ + DPAA2_SET_FLE_ADDR(ip_fle, DPAA2_VADDR_TO_IOVA(sge)); + DPAA2_SET_FLE_SG_EXT(ip_fle); + DPAA2_SET_FLE_FIN(ip_fle); + + /* Configure input SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[0].len; + in_len += sge->length; + /* i/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + in_len += sge->length; + } + + ip_fle->length = in_len; + DPAA2_SET_FLE_FIN(sge); + + /* In case of PDCP, per packet HFN is stored in + * mbuf priv after sym_op. + */ + if (sess->ctxt_type == DPAA2_SEC_PDCP && sess->pdcp.hfn_ovd) { + uint32_t hfn_ovd = *(uint32_t *)((uint8_t *)userdata + + sess->pdcp.hfn_ovd_offset); + /*enable HFN override override */ + DPAA2_SET_FLE_INTERNAL_JD(ip_fle, hfn_ovd); + DPAA2_SET_FLE_INTERNAL_JD(op_fle, hfn_ovd); + DPAA2_SET_FD_INTERNAL_JD(fd, hfn_ovd); + } + DPAA2_SET_FD_LEN(fd, ip_fle->length); return 0; } @@ -793,10 +973,9 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id, sess->build_raw_dp_fd = build_raw_dp_auth_fd; else if (sess->ctxt_type == DPAA2_SEC_CIPHER) sess->build_raw_dp_fd = build_raw_dp_cipher_fd; - else if (sess->ctxt_type == DPAA2_SEC_IPSEC) + else if (sess->ctxt_type == DPAA2_SEC_IPSEC || + sess->ctxt_type == DPAA2_SEC_PDCP) sess->build_raw_dp_fd = build_raw_dp_proto_fd; - else if (sess->ctxt_type == DPAA2_SEC_PDCP) - sess->build_raw_dp_fd = build_raw_dp_proto_compound_fd; else return -ENOTSUP; dp_ctx = (struct dpaa2_sec_raw_dp_ctx *)raw_dp_ctx->drv_ctx_data; From patchwork Thu Aug 12 07:12:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495963 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83752jap; Thu, 12 Aug 2021 00:17:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNWGeASYHVqhWfDTwK6j6DmfeSar+CSGc6lTPq7e5v5ksfRBdoh4/NWjLtLED7XpZfwk11 X-Received: by 2002:a17:906:24c3:: with SMTP id f3mr2285505ejb.145.1628752634937; Thu, 12 Aug 2021 00:17:14 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id e15si1560484ejx.19.2021.08.12.00.17.14; Thu, 12 Aug 2021 00:17:14 -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=ocYNrqno; 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 EDD684123C; Thu, 12 Aug 2021 09:16:22 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20061.outbound.protection.outlook.com [40.107.2.61]) by mails.dpdk.org (Postfix) with ESMTP id 14D2B4120B for ; Thu, 12 Aug 2021 09:16:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mQiiVQnflbu5WpCUbKywTZ0rmHGenoLmIk3MvbaU5bQRxVudbjEv2lxoEgLs1vzTQSBnnhjUvs/ctdTJewTuNDj6kxahHAEA2STCE6qP26H+chvN1z0frlwe5tpARdS0zFjqE79IpUUYA0xqJpl+p1+Z5+wv5qytOm53/LR+UNqrA3YjRdKYllUpHDwuurfH5GILPyN/wA0IZuKBAG6iPfLdr+1AQlZDGkI9ddsf/Lxd3hEcXEYtL1AEckcFIjMB8QAxiHetRlJEWWIihQQ1g/er3LhExmKtCym7VJ2293UXIrQZmYdkjGzAML13I4gBfjAJisHEwg8y4K/9x1Fsww== 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=/dEBTa+boTVmdm4zTPe2GQpl9FAmYpn77+sC+q5iJNI=; b=Pd/s4/c6Vf0y4CkVfE190htlq4zWuwPXxqguX9r/J1YEAxYJAmoDGDAFLw3zwosA7mX80OyzpXozEFNM+QCrFky7OSJUM8jetPTUFT/bXBgnmUeZt9BphFfmADVPugel97b8mBr/eVeMXtTj4wpWt2u0L4qrupAxN/Ji3a1WIEJKqUMKuZal3OWK0AbJN+pIx3bmi61w6hpnx2ph2vtjvABzhFvv6FVNpZjsGXDdudzEuFWCFg1ZINEZ3gRhkEJOob/qPdm9M4SVxoAZilz+zShSCbUrL0CeUowNptcqeskOz1zndtYCsayjfVHO0Nahveq7xBc6AJ3pPExVdoEXMQ== 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=/dEBTa+boTVmdm4zTPe2GQpl9FAmYpn77+sC+q5iJNI=; b=ocYNrqnoULxqZ4937D+XfLkOuocsjfUulQt3QLGsu5eJbPMPXIQyYbO9jyG61e42nYHC2T0xL4nkF61pJdlHodzr7HQ3zjv8GJiZGJEW6m3yAoe+tIU7oqZS2a4GOsWICnQAOkMzSDAx0UZOCmpA+7jynfssexrB+muEENZlvYk= 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:20 +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:20 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:37 +0530 Message-Id: <20210812071244.28799-10-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:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a1ecf4a-bdc9-4674-8f80-08d95d611524 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:534; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kqvceSAiX2tdkhD6mYOaY2pHqi3llBpJexhBG+HvUFJUTAi23kHCToZczf3s9JSi8SwbaPEDfQNmeD0HMxtorY5Xh97If8iAfxRhThXQ0vtemRxy8YBdlGaeqlCDAsMHccQR1gmv60vMi1dbp7VSAITctg8JXoj6XmCzMztg3JXsdoxZQqKxrf6WKbjNxPAilcRdesxdBucz+EW8WdwerZ7R6400bXxXJ7YB+aAUaWDAYNpEgzWtG6GGBL9ZEMfNyomZGmDGxDja+B+GfqqSbntpRA2SEnDcECWKSZax8BKe6Bgp6J5WvS54/D+JoTWzopZjil9+dYXMlUjo4bhZ9fFvr2ER2h6Zv7ICeERvYKwRDkgClVgD2EdvpNEYRWBAMrT9jl+uyV0etJtT+EY2kL8WTDMaLj9Np8jBoHYvTfKWRCxNWOHruvUs+s+zZifhq58a1W51z6ae6ufaWkFYnBAJLuwEW9uYrLmqfXuVkjwAz3G9H0pLgThEZo0b/O27BOGFXh3x8sr5aZn0Es87wZsd5SlrWY9U/fBFsQ6UBwthGNTVa1P/QLw1heNulrsn2aWUfX6cYcGMTUMbZ2P3K03UZRFvfnelSXAter4PcjyN1Y8hNi1peORHelYHKX09mmoGXvL6COLGjnbTXaAKU7kLelH8EiaU2FYpkd1W2cDfwbkdSuE9TtlvnrZeylMftTwYKscmUFFqgxNMV7DOJw== 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: RIdEGzu5hjKl72G65lZEOxfx9araPTFti32KLQXvUDPqslIFEC6/uItidp9nwEP2dIP60BEMJnW3z463LHWuYo/HRqtqiMHMUgWFhH9Gejxl1asRy0SvCjVEdRF5588Up7+3T/E0ia3A+gAtfDKT6qXgIieXLisAW9LEKbNczuRCUMzrzpmMD/GkSaXrOV+/rotsK94fLPub2mTBziovSlcfHrrX4FsUUoyM5OmcV8jfzWLMacXRlbwN7JEi7H5tBYLGK+V1lMIUQu3xOYVxyk+LK0jRYGD44NVmj4EcAi2rVekWcIlAcWQYEzByI5pw8N+IwUcPt7AFFNNwnXhSZCVWW9nVpQFR3LWNSEj7xlJdj+5qBGE0ax1Gq4+Iou/LCJTXALpY1VCTuplwrwPkoaHGRR2gkf7c+4pflm+3C2ZtB/inpGUmiTla2S3FH6+NAvyOz3ZNrCbukxD6pU6MrtFVhWtn/3LsI4Ex8DeEBGF7trCWj8OG1U/a3kPGonemI0KSsIYr2BrekzZgd3rlSJacQw5B14b26Vn5hj0E6e+0nBmb/uA2lfq5yS/0dSOVG1vIGiT1JD6FzPfK7rS42Cg8f1RQNz44wEELSzJFLvhw7j58WRrP09bKa/sc3doe1aOoFtBE8VkB88VxSzws4atrIWfNUVC1+C+9TahfRRAPWUne8zBc2c4jLbn7dTgXTvPVYTX3k9mHLKu4y8QpVr1PzafrbNrKsyq/Lg92wsfkNj4+9a36ue+A/+h/z4+2Rr/Jk6TEdZQLEBH+3qUrJl7AeLlH4etlvCfgJvfwnsERI6dgTXEQ+hL7cORcGMUSvRPhIowBhz3km+Ip+BWNHwAPCkGcnmw4aqF4fgq3SSSHJd3w+2ZvAGiJs1mVLnl1lLat0ZIoGe8g6IZdJbZJc9+gQqwgTu9q8lago69dv21VRRMQYFSQI4RvjyvzcwJ/tLIQBfXaC+GvHf7gbW1AP0AtstNYg3AOp5m9lwBgV8iBVgJmxAvuZQc9/uc0MZq7JsllHmS5GAXji+q0CW/WB1Sij8X9QvbB8Rgj37W2an44ay7LGaSfO5nq79tRS9fcduhqJuKwVfbo2ZYD+5w7Uo0I53hTlMF90Eea0+819qIQhU8biKtDeTgmNGdodkJ9cRO4PZud6BMLC0SOrjV6w5ORW9aBojB7oY6Vk1wdKkuQhfpCAcmaVfJ3x1Wrw0+WwRJfwep+HzvytLEFCjphNlV21J0aL/iNpLj2G89EO5SxxgG8zoPisuQJ1yIfVGXpxbAzRt0pDsrV41MpA/A2d7MOW65mvddBI/ApJWcJMIjepLudS9a0SKjYKi7e3khm X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a1ecf4a-bdc9-4674-8f80-08d95d611524 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:19.9525 (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: 4WgON3vpZITnhHHbpBKOqHbe3w+BByJ79VDBvkRqjXm4jqbCnnyw8EKsZZCuxunJ3/1E1j4wGFNv2b937zbAdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 09/16] crypto/dpaa2_sec: support OOP with raw buffer API 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" From: Gagandeep Singh add support for out of order processing with raw vector APIs. Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 1 + drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 156 +++++++++++++++----- 2 files changed, 116 insertions(+), 41 deletions(-) -- 2.17.1 diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h index f6507855e3..db72c11a5f 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h @@ -179,6 +179,7 @@ typedef int (*dpaa2_sec_build_fd_t)( typedef int (*dpaa2_sec_build_raw_dp_fd_t)(uint8_t *drv_ctx, struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, struct rte_crypto_va_iova_ptr *iv, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *auth_iv, diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 41f24c93b6..87a1a10268 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -24,6 +24,7 @@ struct dpaa2_sec_raw_dp_ctx { static int build_raw_dp_chain_fd(uint8_t *drv_ctx, struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, struct rte_crypto_va_iova_ptr *iv, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *auth_iv, @@ -89,17 +90,33 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, (cipher_len + icv_len) : cipher_len; - /* Configure Output SGE for Encap/Decap */ - DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); - DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.auth.head); - sge->length = sgl->vec[0].len - ofs.ofs.auth.head; + /* OOP */ + if (dest_sgl) { + /* Configure Output SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, dest_sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.cipher.head); + sge->length = dest_sgl->vec[0].len - ofs.ofs.cipher.head; - /* o/p segs */ - for (i = 1; i < sgl->num; i++) { - sge++; - DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); - DPAA2_SET_FLE_OFFSET(sge, 0); - sge->length = sgl->vec[i].len; + /* o/p segs */ + for (i = 1; i < dest_sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, dest_sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = dest_sgl->vec[i].len; + } + } else { + /* Configure Output SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.cipher.head); + sge->length = sgl->vec[0].len - ofs.ofs.cipher.head; + + /* o/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } } if (sess->dir == DIR_ENC) { @@ -160,6 +177,7 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, static int build_raw_dp_aead_fd(uint8_t *drv_ctx, struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, struct rte_crypto_va_iova_ptr *iv, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *auth_iv, @@ -219,17 +237,33 @@ build_raw_dp_aead_fd(uint8_t *drv_ctx, (aead_len + icv_len) : aead_len; - /* Configure Output SGE for Encap/Decap */ - DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); - DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.cipher.head); - sge->length = sgl->vec[0].len - ofs.ofs.cipher.head; + /* OOP */ + if (dest_sgl) { + /* Configure Output SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, dest_sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.cipher.head); + sge->length = dest_sgl->vec[0].len - ofs.ofs.cipher.head; - /* o/p segs */ - for (i = 1; i < sgl->num; i++) { - sge++; - DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); - DPAA2_SET_FLE_OFFSET(sge, 0); - sge->length = sgl->vec[i].len; + /* o/p segs */ + for (i = 1; i < dest_sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, dest_sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = dest_sgl->vec[i].len; + } + } else { + /* Configure Output SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, ofs.ofs.cipher.head); + sge->length = sgl->vec[0].len - ofs.ofs.cipher.head; + + /* o/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } } if (sess->dir == DIR_ENC) { @@ -294,6 +328,7 @@ build_raw_dp_aead_fd(uint8_t *drv_ctx, static int build_raw_dp_auth_fd(uint8_t *drv_ctx, struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, struct rte_crypto_va_iova_ptr *iv, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *auth_iv, @@ -303,6 +338,7 @@ build_raw_dp_auth_fd(uint8_t *drv_ctx, { RTE_SET_USED(iv); RTE_SET_USED(auth_iv); + RTE_SET_USED(dest_sgl); dpaa2_sec_session *sess = ((struct dpaa2_sec_raw_dp_ctx *)drv_ctx)->session; @@ -416,6 +452,7 @@ build_raw_dp_auth_fd(uint8_t *drv_ctx, static int build_raw_dp_proto_fd(uint8_t *drv_ctx, struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, struct rte_crypto_va_iova_ptr *iv, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *auth_iv, @@ -466,20 +503,39 @@ build_raw_dp_proto_fd(uint8_t *drv_ctx, DPAA2_SET_FLE_SG_EXT(op_fle); DPAA2_SET_FLE_ADDR(op_fle, DPAA2_VADDR_TO_IOVA(sge)); - /* Configure Output SGE for Encap/Decap */ - DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); - DPAA2_SET_FLE_OFFSET(sge, 0); - sge->length = sgl->vec[0].len; - out_len += sge->length; - /* o/p segs */ - for (i = 1; i < sgl->num; i++) { - sge++; - DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + /* OOP */ + if (dest_sgl) { + /* Configure Output SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, dest_sgl->vec[0].iova); DPAA2_SET_FLE_OFFSET(sge, 0); - sge->length = sgl->vec[i].len; + sge->length = dest_sgl->vec[0].len; + out_len += sge->length; + /* o/p segs */ + for (i = 1; i < dest_sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, dest_sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = dest_sgl->vec[i].len; + out_len += sge->length; + } + sge->length = dest_sgl->vec[i - 1].tot_len; + + } else { + /* Configure Output SGE for Encap/Decap */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[0].len; out_len += sge->length; + /* o/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + out_len += sge->length; + } + sge->length = sgl->vec[i - 1].tot_len; } - sge->length = sgl->vec[i - 1].tot_len; out_len += sge->length; DPAA2_SET_FLE_FIN(sge); @@ -528,6 +584,7 @@ build_raw_dp_proto_fd(uint8_t *drv_ctx, static int build_raw_dp_cipher_fd(uint8_t *drv_ctx, struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, struct rte_crypto_va_iova_ptr *iv, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *auth_iv, @@ -593,17 +650,33 @@ build_raw_dp_cipher_fd(uint8_t *drv_ctx, op_fle->length = data_len; DPAA2_SET_FLE_SG_EXT(op_fle); - /* o/p 1st seg */ - DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); - DPAA2_SET_FLE_OFFSET(sge, data_offset); - sge->length = sgl->vec[0].len - data_offset; + /* OOP */ + if (dest_sgl) { + /* o/p 1st seg */ + DPAA2_SET_FLE_ADDR(sge, dest_sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, data_offset); + sge->length = dest_sgl->vec[0].len - data_offset; - /* o/p segs */ - for (i = 1; i < sgl->num; i++) { - sge++; - DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); - DPAA2_SET_FLE_OFFSET(sge, 0); - sge->length = sgl->vec[i].len; + /* o/p segs */ + for (i = 1; i < dest_sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, dest_sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = dest_sgl->vec[i].len; + } + } else { + /* o/p 1st seg */ + DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); + DPAA2_SET_FLE_OFFSET(sge, data_offset); + sge->length = sgl->vec[0].len - data_offset; + + /* o/p segs */ + for (i = 1; i < sgl->num; i++) { + sge++; + DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova); + DPAA2_SET_FLE_OFFSET(sge, 0); + sge->length = sgl->vec[i].len; + } } DPAA2_SET_FLE_FIN(sge); @@ -706,6 +779,7 @@ dpaa2_sec_raw_enqueue_burst(void *qp_data, uint8_t *drv_ctx, memset(&fd_arr[loop], 0, sizeof(struct qbman_fd)); ret = sess->build_raw_dp_fd(drv_ctx, &vec->src_sgl[loop], + &vec->dest_sgl[loop], &vec->iv[loop], &vec->digest[loop], &vec->auth_iv[loop], From patchwork Thu Aug 12 07:12:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495964 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83826jap; Thu, 12 Aug 2021 00:17:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtNrVx0St44c5TN7ndnsBaJ/esd3Wk5rB+P0env+c5LZiqFH6SgPHOsq7SbYuuMnGm2tjw X-Received: by 2002:a17:907:170a:: with SMTP id le10mr2314907ejc.347.1628752641409; Thu, 12 Aug 2021 00:17:21 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id c4si854275edd.463.2021.08.12.00.17.21; Thu, 12 Aug 2021 00:17:21 -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=gn1RPDvT; 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 3095441242; Thu, 12 Aug 2021 09:16:24 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20075.outbound.protection.outlook.com [40.107.2.75]) by mails.dpdk.org (Postfix) with ESMTP id 2B88841240 for ; Thu, 12 Aug 2021 09:16:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nmoc+TZQ6bc9tEr6+1m0a9v5wYo8c2Qpr9EbSruahhSKpvNGRkZpVlk4qM5WLnbg4Fc8i5JmCtkoMpLoixE+sLUEtFnFGl2mU9sFZQgjBepK4AE4A/OgI2l9Hv8P4CZuu1GSSoy0AdPCT8rUTAlauN2EKTfSWzCK7IPgh7BPW3p4Ys1cd0gE9YWXlzbijNXnF+5rpxGI6Ptx63shENZsWegSTSABGklEvCzRk0vVxr6H13pHSsWUM6cR/V8m4FG8QnpQ7FuWlmRyJwuXRT+7e9MSMikBfGe4gt6uVRDNnleJEdxIrkJPToDirBTFriuXypDDVG6hs+nFD2qoNc6ZqA== 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=c7F7rP/nBXWCRmH1C+K5uK4NZdQiT0cKOLrMQTalBtQ=; b=eH2gdfzz9q7CxeXOtZMCTgTA7tr866H+/5ZGIo8UiI4/dYSJdpPoUG5SrUf/Tm3AXdneOBrJlnjcaIQ9Tgy0eARfsz3I4tQCuF7Bu0kA0r7zeaqkvFHDrN8vs5sAFIs/xRqQWjvDwrxg7YiAo7YXgRUuX1NSRh6xh0J10I94kmVGfByjRM7TOIGB2ltziIN1UMjvcntd8oxYgDrePUJAdqeY38Nt/Uaf6ATRb1YesmzlolOR6cC23TRWjysVusXC00dqGDWfIDEuv+bYE87ONiWQ+mUFUhuYvdIQsdyEcNXYdl9UPsR4X7JXoaS5mt3SRHy294A+I7MU0VW2uGICjA== 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=c7F7rP/nBXWCRmH1C+K5uK4NZdQiT0cKOLrMQTalBtQ=; b=gn1RPDvTG1zzQ1WYgApxNK3red3Ra46nBePDCVyLWwD7/F422oLBItYVRPaXDmRwSP/vRoVoMawWZW7EO1poQNCRm5Klv8v4TB6dB8ARGKZlQColNcNk3yzu4gAe5Uuqh2Jt1TYyd+bVArZq9uYm2N9LP/IY4Jv9YOnE+BhAs2E= 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:22 +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:21 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:38 +0530 Message-Id: <20210812071244.28799-11-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:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 106846e4-b031-4220-1743-08d95d611630 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1002; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kqVpu6GkrEVySu+WneQx9zNsweTC12OPleuGHx5Bcjrsry9I7KG/HP+GuKuKnga/sTqibvDakFdp5mhQsU3xEcXQ2nAaV5DCECrzdFbAgMfEgAR8uCE88qQcVdEmQGc86EIwBA7YHj1MCqVKNsM4Uj5xri4NMPNSvp6MGsQFzwIxmgTvKXtzPNpM2tu37jfmMD4EWdSJc05wfiBhYU1wGZSvZCJpyYLzhwL/c96fVCH+QGkIjG6rBAYcrDvAy9A0M97J9E3YAs8rCKn/gpHrnEIdNckF/Qnr9Mk7MT5jFNHkrbkNOlYZtlu6QHVEbaSLLXZZgSfafoRhB4Vu1NDdQtSFgH+8A/8z+mEWl/qF52yw2QNQZsjHZZxIh9+8mW/wOm0qTkvotvrIIpLWHkDWIpxZBOjXj3Y55AdMWrVk6jn0VUFWRxIiAjU72OKljdhopT3ZeGvAIPzVVrCLjAzVgMrxJ5HgMCYIApkmB+/oI6gGkE1GMXaudSw3on76kEsK8UlnSxz+dgGNBf5qGEYOLk8WySvjypDwuvpEjfzEs3PL7sLqaB4PU54NCSAP16wFYjyGMq25BUlIY5Xx67YtEC5Br4IMDR15F45oaYZEqTEwRbT0JicuDaL4wEWLzdXPgBT9D2eo+a9ZQ38+hmg5nXTKsrgWGbNyZJj26dvkKD+hgOg9l0I8/x0/W7zxi1n6wau9K8kpPXVrTZajpAorwA== 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)(4744005)(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: Rt6SJk+z6voXNGJ4uia/KxlFNJ9Znv09hDaPhcjFnSkB9KkSpnLcpmKii1EZ0OVfhFFG/1DKxxNHisGaYuNVpHPnMqtR2W2w1zJUzrZJR2ot6UJGUthOYn5k2OnjsefADZ0dxQqomZyHJypALLBEqIsW9rarRJ5FFEaVPssVDclTDKlRDP7nUd9ht28KPMCdxN49fSDSVDasK0ZtuHcuC/fAKEIYNRfelPH248BjjCWfF66WevKlyMXf+eq3MHXO1a52kWo3pYQl20X8Y/ffE+OLYMYmy1yfT5IL2+yi0tRrOFxTFrT33vX/BNZrd9irTjQYmPP5KnxJcuKOfhr4xvTCSr/IIphvsx3tgWnYKxyxgzg124rbr3t++GjRtRDwAccBcz1VBQKrWB9yiCWFCXPZQnlbmcSFBPI7EgXheW/EtERdwowDkPQkAe4P7Ldq01LIVtda3hdVB6qg/Z09bilki5BT2Om6Lx8CglTXBIkqOalynXR/2gupw+GLmUrOwpwFZcQPjxi7s7qj+Tf8OUwYVR2PRBoNRlqIf7IPgWOl9PftqaBWtzbXdsmKrJQKa7mEN80qvao0n1Cl1rD5OZUvM2S75fQooAhfHVTZ6FqOMh45imuTiTgf3U3yrymAuED1M5vhX7LcshR8fzbxKA7QpK/E8cR5pL3qe/H0XKBLNZ6hoA1OVVv8I0TQJrM3FCXoPPtSzfHW9tpTY47mcdMN9Cuf96QGl7db1sTdMkPWdanq/adpK7U8dM1MkfDZ3r8Y2kU+NAaQU/ynV3VvQqNBGNlou/RjFoudiXmuCvShy/Esvu2fq1LVVz3jtHHkAxKeLqui6sqtJiXROBH5D3Rzb0uYk0kUaaiD4kaUgP/0dtpx4etoDVuo148FtAKXV/CzTFCIjFTjy6h1RuPlJWZdGgjEcaAYGoJt43nP4Yz5JshHHdPqRFuxaG7KI7lqO8T3kkEJ4q+JDFdMI+1lmTGI3f9ILZ3siNNzpRGKu9ISUW3LQp0K9ignkYJb+wttzEkSPmHZeemv67yq9XvXwqQ+GTGvGrimJWpJS3YyekA/VrGd2jkIxJRcZPDwNvxBd/cOpCCYxgHmHQF4Dl4QwxXQPsrgmHV/MboKPYWhaDLNuiw3Jm6pJAIbjFIUNyDDo3c/BeHTYmXRresDYQYbSLpKqX5SPd7Yg5KeurGU6FcY8ZQ/07pCN+DtZVRUQsOammrJKtF8agdysYN/IwI6d4TzpkGnEZhrLlkV7fNHBT4gFOEOeW9UH4+zU+bcco5bpiJWM2D13N6a2gK0RRSE5W3LEzciGQgN+Kx6amIEEnKlgAgAHnTBFXo5n3NGxT6K X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 106846e4-b031-4220-1743-08d95d611630 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:21.8183 (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: euBysyNDjeY5Za7EFM+Mc6dBoSY8xLHx3/Igud2x/lKXCUdyl6ihRpu2mr91fgX6rlQn3HmGzVL5vevtGTlCCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 10/16] crypto/dpaa2_sec: fix ctx memset size 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" From: Gagandeep Singh Driver is doing memset on memory more than its allocation. This patch fixes the size of memset. Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 87a1a10268..51e316cc00 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -1019,8 +1019,7 @@ dpaa2_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id, RTE_SET_USED(qp_id); if (!is_update) { - memset(raw_dp_ctx, 0, sizeof(*raw_dp_ctx) + - sizeof(dpaa2_sec_session)); + memset(raw_dp_ctx, 0, sizeof(*raw_dp_ctx)); raw_dp_ctx->qp_data = dev->data->queue_pairs[qp_id]; } From patchwork Thu Aug 12 07:12:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495965 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83905jap; Thu, 12 Aug 2021 00:17:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUvvtsbobWMVwqtAGPG3vB198KhypfGafhWHqp6dVpO9h9vvUxGdKDaD2D1Eku/WGnX/z3 X-Received: by 2002:a05:6402:408:: with SMTP id q8mr3824812edv.13.1628752648075; Thu, 12 Aug 2021 00:17:28 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id dc10si1698568ejb.308.2021.08.12.00.17.27; Thu, 12 Aug 2021 00:17:28 -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=oo59GbY2; 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 74E2D4124A; Thu, 12 Aug 2021 09:16:26 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20049.outbound.protection.outlook.com [40.107.2.49]) by mails.dpdk.org (Postfix) with ESMTP id C495841247 for ; Thu, 12 Aug 2021 09:16:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AqL9Q4XvBeNv3//O5X24de8XeBwv8XiSVQWaItJkRe/pmY0UcA4BeHd4XeuDBqCaeW4sYRkFbG3Rv9LPHtfdN2Ehp+WJY0lQbjgbGYvXnuLY7xzvPq6XuOD+SyuvRHaU0LMkhOjZKsolBh5QrlT+o7lLUzOiF94yugsyLMVXWYYPAk/LR2Xo7KNX3wG1XqN5CxT2SQgETEABfNl5XDG/yvtaKYNJfcsQNjCD/wXFK+JHLJQ7uSLn6arHoVKs7FbTs9cjOsz4A+vARS5jyah2YThfuvc/Y6rC8yohwWarDmsQ1EIPzMaSRqf3+Q/3WtA5U+8Gf/i6t27RuwQqhODl3g== 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=rr4BsOl+t6rzEldC/C0CdUGRGXMsFNIn885YREjSPAA=; b=MDctFDGtpqRQGRYNTxnb9uJE0dD0zDkNcjfVCv5uKfP4PBXUxJnDYU9Z4z4lVS/laDuKxyiSOK1bSHhtG57kxoML1me/SFTkFbrE2tmXCcPpxdP4ghIRKj4Y6XwgSZ+FZuPomazGVznVO3dT+lnulokcJdrKNEFbuslxdPOBgWFtguQTiVgFbaaxDihMwWR1ZJRJ3fppJ4GBjFgvgiMn+cPZHW4aVIgu4gcsqU4X0f1nuJbX0iBTc2l7onY1JIsKcINqNdqCOBhkj2JyumOiA+SSrczSjjvpnwzVFsz11rWhKidWuAHuXABfoowBGKqF2gHYx2T6r9VSLNujDxG0Jw== 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=rr4BsOl+t6rzEldC/C0CdUGRGXMsFNIn885YREjSPAA=; b=oo59GbY2pq1kpwm44vT8e9PHITDfAdzYS1mSoc4EqDf4Qa/7bufGrkLXE7u2Piw7Q9GOz+nDIgmstra7Pn+kMHhNUHooBMQ6Dd42d9Li3Q9Ia9dPu4T4iEVqTAuxpf3aQcWcIqX9/cnl1zjBbVj8v09FsYipwBYguhrCWq7E4Q0= 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:24 +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:24 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:39 +0530 Message-Id: <20210812071244.28799-12-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:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f10f797-a87a-4f95-169a-08d95d611790 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M3oHFNIljFLnLuZvgCLKQjtbdv+bqCokutkIJFKX1TuhjMd1vrV0EEcmMvge0aT4GZJFtdGl3HWjzhWmkcNsp6wcGu1EC3l3lRKtA6Wh5wv81JqAS/5GO0B+5VL+g4T8FCHV6/ZDqL5UXkRyIhpgtEPeSFZvOW4Uj13SOtBZAYmG0LA529nK8pQnAfDnLR7YuDOtO8UeoZEDjb+ycdgsR6GGJol6YebxIpNktr+2JEgxNq5FRDBlwPDRiyDY6Vux3MJHmX6DipRm29iiXCWyQwR244VxaS1mcetFNs/cSNb8lMkjOM0jUqECrvzfPmK5ya8VNTjm5YL5buXqfYgWzj/kQaZD5phW1C/3MA/EucuwUQThLAlZEpbjLi9zNzfb6Ln8qNR38EdWCs7p2qUz/Fi8lSGCX00QMUgcoWTBhQsx56VsKoSih0RE/45S4gt5jNQUKf3abKlIeLTG9nBRVabIjqiTOwLVW6sM2yZNyMLmZTa6cR36/xX6l6CbP6BFeJHKVUrTo12gA93CoSCFNqDNEcPqvBuOSafNixY+HDiFd64gJ7cJ2ukTHFg3vB/ttmOXFiiwq1Lz3zGwT2t6+RUaf4vT2NMsvqZgoL0eHY70oQwR03+uGoOl1ipT3q0jXCc1tX+fiV1W4Cj++g0b/RI702q4PK9Vku55IFaYhVUQvSlS050GBQxUSk0Pp46TVJZRiQzmVhtDl+aRPx+OgQ== 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: QiEl4AcENZhLz8kxaSzg03rM/kfQwsVyszVnfEkKppo801oFc+0wCbxmLBoY5FzyA9rETppTjex7I0TjGd7YSSTh+JZk43InLscXl3mIuOV4euoV3PIMmldo33i3Zht9x50u+Yq1E1Jr7bslUgL0BfBzNAodm6IQnvocX0kMboBkzPZTVGIC/EPzRztZkERPBWbaNOL2bgHAt7Ftz+8AjKaWwoaG3fudwe8Vwq60IZ5RnZ4RLiaO+a/QA/LczztSjg6cIKBmqNoxHTXpzZYY5c6Ou8biyDNxWyhObGPQLvOQLJnYiudPPXqxbVmKFZlmE2XiFNK9F6xkoDypK3m74Qf0tXlbxch284PUUBh1HxLLuk0Kho//ZRkAqwrH8QHRBeHjBV6qLHCnkqhm5wIjU2QEUDD2ahFhSBOxR1i1NUFE4nGuVPBbx62tTiByVKYpHBQIA5gwIbKp66iZxNwFt3LTeLvLlW13CCxkL8VCRVlvP8e41IlpcmbTh0Yy07uxxC3S8FVfvPJ0sM1jvRzMhWjSv4DTwoHqVGFhAn2Ja5RT1o62OmogVEDdY6ekHLflJdrfqcQhKxryeyMZhfgPxuHjcclNAP2lUSRyDVwYj7/L9F1j6esrSsUJAw0C6UQuQolL6Q5xlgqeMva1fBVBpoPBgUkOM5forghnBNe9L2jORA5GUavqjagHfr/CW+mtROGfoGtnXNSEOZs9eRFzpfsdN3WL+0IogeWiwBXaCb6gNBXYTHR/23fEX415BKe9i0FaF59IyIi3LHVa8SLUxZFpzi8oX1VhMa4jepksMG3YVmHNhXv18uZMs5G3wh50qNh+IuI6hPCMrnackInKDrzQfVJID8pqZnlteFYavJ2qCZF4e9SVi+pYumyubrHQ4kC6yaKu6VmfhI+peYr0e+iA1/NV7Y9ppyNYZsoLTi0ldy4g+JskemcaUF4BRHXveW3oPmvryYHBPOoqC8rXRc7HRVXt8hpTKkMQ8/D2u3xKSU7R17VEGDywxlOXTEa9ObFAYBk3S3wZ0GSNkCTRTIKLj/UmlMhkRaeINXt2EfzHD267BCFKHG4QemnDieDiFq8YHu47s4R0Gn1nj3je9Ilan1c6QRSIeBaiH6GXS/cF/g2k/CFhfM9+CPA8cHNNNCO0NMcBrSepGGjKFv9Zhn6AvmaSQlZmRqf4T9PkpLuTirdySM2y+jBX/PX9TxfLvND/FLodYAqc+R8ZH6//atXpyIUt3+EdSaand59/0/jMJ8Y9TRP3uqYDUYRIas7OhxMgLtMueviyyvATVsPPV8HWRqXZv/RLvhohG+WzevrynzXP44QPga+C2+J7LIkE X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f10f797-a87a-4f95-169a-08d95d611790 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:24.0445 (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: mshGXVYDELiSx9MlX9f+8GPXhu36HLLnSdmK4OIIEElU5i4Y2meXmUFHR6h0AdiEb7M484tQJZHaHUDOEpX3qA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 11/16] crypto/dpaa2_sec: enhance error checks with raw buffer APIs 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" From: Gagandeep Singh This patch improves error conditions and support of Wireless algos with raw buffers. Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 31 ++++----------------- 1 file changed, 6 insertions(+), 25 deletions(-) -- 2.17.1 diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 51e316cc00..25364454c9 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -355,16 +355,7 @@ build_raw_dp_auth_fd(uint8_t *drv_ctx, data_len = total_len - ofs.ofs.auth.head - ofs.ofs.auth.tail; data_offset = ofs.ofs.auth.head; - if (sess->auth_alg == RTE_CRYPTO_AUTH_SNOW3G_UIA2 || - sess->auth_alg == RTE_CRYPTO_AUTH_ZUC_EIA3) { - if ((data_len & 7) || (data_offset & 7)) { - DPAA2_SEC_ERR("AUTH: len/offset must be full bytes"); - return -ENOTSUP; - } - - data_len = data_len >> 3; - data_offset = data_offset >> 3; - } + /* For SNOW3G and ZUC, lengths in bits only supported */ fle = (struct qbman_fle *)rte_malloc(NULL, FLE_SG_MEM_SIZE(2 * sgl->num), RTE_CACHE_LINE_SIZE); @@ -609,17 +600,7 @@ build_raw_dp_cipher_fd(uint8_t *drv_ctx, data_len = total_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; data_offset = ofs.ofs.cipher.head; - if (sess->cipher_alg == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 || - sess->cipher_alg == RTE_CRYPTO_CIPHER_ZUC_EEA3) { - if ((data_len & 7) || (data_offset & 7)) { - DPAA2_SEC_ERR("CIPHER: len/offset must be full bytes"); - return -ENOTSUP; - } - - data_len = data_len >> 3; - data_offset = data_offset >> 3; - } - + /* For SNOW3G and ZUC, lengths in bits only supported */ /* first FLE entry used to store mbuf and session ctxt */ fle = (struct qbman_fle *)rte_malloc(NULL, FLE_SG_MEM_SIZE(2*sgl->num), @@ -878,7 +859,7 @@ dpaa2_sec_raw_dequeue_burst(void *qp_data, uint8_t *drv_ctx, struct qbman_result *dq_storage; uint32_t fqid = dpaa2_qp->rx_vq.fqid; int ret, num_rx = 0; - uint8_t is_last = 0, status; + uint8_t is_last = 0, status, is_success = 0; struct qbman_swp *swp; const struct qbman_fd *fd; struct qbman_pull_desc pulldesc; @@ -957,11 +938,11 @@ dpaa2_sec_raw_dequeue_burst(void *qp_data, uint8_t *drv_ctx, /* TODO Parse SEC errors */ DPAA2_SEC_ERR("SEC returned Error - %x", fd->simple.frc); - status = RTE_CRYPTO_OP_STATUS_ERROR; + is_success = false; } else { - status = RTE_CRYPTO_OP_STATUS_SUCCESS; + is_success = true; } - post_dequeue(user_data, num_rx, status); + post_dequeue(user_data, num_rx, is_success); num_rx++; dq_storage++; From patchwork Thu Aug 12 07:12:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495966 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp83996jap; Thu, 12 Aug 2021 00:17:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzUf7k8gXLFE+zjz/WVcb4elyTnMPnd4sRgsZGri6henO2JoW3DqB4g6CZs+ExIEXpnVEw X-Received: by 2002:a05:6402:1648:: with SMTP id s8mr3728342edx.214.1628752656120; Thu, 12 Aug 2021 00:17:36 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id f4si1844152ejl.218.2021.08.12.00.17.35; Thu, 12 Aug 2021 00:17:36 -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=hbdGcbqA; 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 09D1C41256; Thu, 12 Aug 2021 09:16:28 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20054.outbound.protection.outlook.com [40.107.2.54]) by mails.dpdk.org (Postfix) with ESMTP id E18434124E for ; Thu, 12 Aug 2021 09:16:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BkwOqsRTjCs7wwhK+BS/R/wFlYunInXaqx1b2cnlAijKIY5vbK6cB3kxF2N4t5ytBB0CCJwfeDSBWujwLiEpzdGnAmDvhLvo21YGHh1XEcd08bzrwWa4CAKLf2RmT/9yi8xYZGZXKOqANZ7ItH4qM+RsHFRpc5LodM6thF83sn9k453XsuaaJ9EgdxqeToBEmYyaOrODPTpeT4lzdo9OWf83lV88MkK6VbYwGEhj9qINlbFu1+8iSXE/TZTgBSHXiTVd97wSeiuLC5csJUdPOdCbt6jvgLvRXxtF0RVNxc0ads3CLuL5ueb/tHN27JwEMxwzMUZrlrTCjCLDzAoFqQ== 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=YGmrYm6JLfyDoN5NMvf40kDmDwYB/q3XaawwAGhd1ZA=; b=HO6vas7uSSoOYhKWaR48tbPDuJaOqOQbmCH1xbjvZqKuz7gnEj/hCXUuTPzu5ECOnrtx0bti8BrI60n8VkTXhO7GAwYw+G7c5gY/1jkUtG7ZtZ3IeEaVvoAQzPVhfWph5ddu1K46+KORf3Ytf5PiH1GNOVg2ZJ7Rr3Bi7LLK7aw9pNw87sCy2iZGPSzJJEqcECs9yYNEhi2V8KHylFG9BX6h4baw8DhIzTvPQIEzOmnZWF7NlDZ/VnM9Kb6Rs6a8AgheFiQGg0x55UYsVuJdGBxCbfB95dw9/w7rTi3B1rzjTdvYuZKzZRO1BMU4ts7k5/NosLfrE6v+uIXMmP2u+w== 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=YGmrYm6JLfyDoN5NMvf40kDmDwYB/q3XaawwAGhd1ZA=; b=hbdGcbqAhNTcToNoNrI8zaCq69p//HutMbWWel4By7ckABPySZao+Hp92NA9LSx5qMpgILI/VuvrQs1pVxs0z1dwYw5N6r28c773Hmbi4L38gbQKpR3v8wPtfxf5AhnPYRIxb9atHgAez+FNHhWhTpGvJj//wiTu9dauNObMlgg= 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:25 +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:25 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:40 +0530 Message-Id: <20210812071244.28799-13-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:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 541de44d-3b3e-4683-94ea-08d95d6118a4 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RQInBGB9BhTgbnEiFJqjhGV/dcH8UoNmzRGxI94fBe2Fiml7swYwJ2Z8yKC4MewtTWOEQlvu2SL/z+693ovzp49/4sm2gFkb+RmIZvwA3Hvu34xVRbxAoxNynWRfbZpvMEUe7IgKE5PPWHRSLDxXXT/gMrHlQZ4lwvARp7iDhvG8o1o59rLxmxcCkdBaGz25L0Tvku1+duDmZWeLYfFpOFCHiP72gfagEyTd8m6WuXGjQW0wqPoBegKL5bTKuzE1ZyYVEfS7x8oqaa8BldLRafLXUsv+o5ZXBx196fsHYLgcPk7yLK3WQXhlWylIuhB/MSMgsXz4G7vSADrINCjlcyKyjRWGBnJXirNN5wTluGR2X02LQ0Wdfo/bwAEJpR5zgqGVor2eXRwSPo3J7KIEOhcDlqmzyEzgnHCXjWKHUBFJ+ViqXreVf75oe+mc7s770/4M0ORYmK7UMNjkrc+AQ5IhcXhWFhqtQs5WJS5En+tMpH2Xv86Zr0HPealj5G2YrUcSjlgXDYM/eQAOjLULLDwuXtfV7rjyvaG7XCmwInDD1xgfbU/wiY9hBormK5AAsfCqlAaIEhiuGBi/HP51kx8v/ef4vad/aCy9AV78LoIwmiEET5kw+/C0FiWaN3mt8tZDq7rorEbbY7PFRMCQJwmYC2JzAPj3L9fAnI/Alynh78q1WyQwZ2z1BvS0d69iNNDOmp4JJH2Pr+HpubDQsw== 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)(30864003)(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: 07xcimUOUJaQBIfmrK/lU3I15FJldLkY2i1rxNDrFR1MF/twC9fvtlojsJCPd8inQRUmWEVZJgiktC6OO5JMLumpQVbWPgNytBwrCKbTSBFwoU0LwRF1cMU33bzZ9dB3+LWY7CuhfASxkGfOYb6sb0Y38qX7WEYQKCc1IBOfDPS5Alsrvk4wUy1LB2cNpy3FXzp+vc68NPxe189zlgsbLyBsNvjuFIzpxHOzGAFZ+0ZqfZIwCyLyUswoBM95+VsrCQOag5wm6prxJ8JylC33LjhS1x71fNU4lhwuyFKJ5iBrg5p7IMZ9U0EBjTOlFaSeZ2PFgrzFrnmEEfRlx0CptZcKZrkmDqlvzxo4MkQQMkaNk3fUyuqXuKF10pPt3AupVD+tmRGre2Njl2WOb07iBsXC9b9d3K/Eznxk0WBPHFCcwdc+UproItW41pmaGdmiEX9hTwPXZe5f/H2ILRU7pBYZpzhxo0cPYSMUxsXMDlCVZgPOsWT3/8FEzOkOSSo2WXs7+B8sjWgWRn/YnJeOgaWDPKbPqlx9JIszrEW/Mv3JDM5as9Rfdpxs71wp2WuB21G4qxnXC/XMTI1YZtCszL8L58PuBDFLuhhWqmEYjnLHccMSLwNa0VmwQ5C1ylsu6MM5RCRSLJtOOq1OfpJpHX1g37pRLeKFf4VNwE2SedUUAih6gp5BOuHu+0OXxSmTvggn7+ZUhSsoRRj/oj2MeU1eFy9ZZLwSv/VRSpVFgmtDyNwZs2jnmDzlVJEeirK7odKUOfaOgeEorWIaOKvClUKXmKMKamX8wDUGC2sGnV44dmyX2Jhd73gnzChchO8fxBQ49DYqs/Ec4GJsBUlgG7qPrNGBi6qg/+29iFz+QsoRgCNctK2XwcHQdGaS6D2qRfM8AIgFal0kwzIZ/yGA5SDiqGNqcU8WdJQb+0yCDs4LQFF7JwWpZhzKJ1/YPyj+IjpZfTLeK8dfy5NufR8nXe75xWo8Xjs53Eke2d/RTDABUECHwdjR2PNKq7te8uh2AcRk4ODfPTR3IQj0+JkNwAy8FUsFQ5fSNgPizZfvHiYAsB9XLxyhzf34iFkAbKVrejQCCKsI749W2rlRvkAdReNfZ/MEsaHiWKuRYTz0ZFP3uRmoOtJKTMUh9GU+EeWQeDTeC0MX4ryB2fs5ESOT7J5E5yaHQ4zELPp7v2itGRXfnYFxaCV0yZooYNFeG5uKC/zMvNMYy8fNohDroudczatCZb0ooJfN40dOMHRhQmrsKzw/wFKy01KSPPvVVpSLlzmVbVW7qWEeaYYW19iDMz7t3J1q/X7yQ6jbdz2KP+FZxB4uOCmwGr/ddUhcVWEc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 541de44d-3b3e-4683-94ea-08d95d6118a4 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:25.8287 (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: m5zlN+zx0k/gOnkvdvpnSO4szWDo0jQ6K40iOzDi4JFgmAgCgdgad5uh3ZKh/QfmoSDJlK0D4H7wMRaj0H8VsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 12/16] crypto/dpaa_sec: support raw datapath APIs 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" From: Gagandeep Singh This patch add raw vector API framework for dpaa_sec driver. Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa_sec/dpaa_sec.c | 23 +- drivers/crypto/dpaa_sec/dpaa_sec.h | 39 +- drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 485 ++++++++++++++++++++++ drivers/crypto/dpaa_sec/meson.build | 4 +- 4 files changed, 537 insertions(+), 14 deletions(-) create mode 100644 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c -- 2.17.1 diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 19d4684e24..7534f80195 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -45,10 +45,7 @@ #include #include -static uint8_t cryptodev_driver_id; - -static int -dpaa_sec_attach_sess_q(struct dpaa_sec_qp *qp, dpaa_sec_session *sess); +uint8_t dpaa_cryptodev_driver_id; static inline void dpaa_sec_op_ending(struct dpaa_sec_op_ctx *ctx) @@ -1745,8 +1742,8 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, case RTE_CRYPTO_OP_WITH_SESSION: ses = (dpaa_sec_session *) get_sym_session_private_data( - op->sym->session, - cryptodev_driver_id); + op->sym->session, + dpaa_cryptodev_driver_id); break; #ifdef RTE_LIB_SECURITY case RTE_CRYPTO_OP_SECURITY_SESSION: @@ -2307,7 +2304,7 @@ dpaa_sec_detach_rxq(struct dpaa_sec_dev_private *qi, struct qman_fq *fq) return -1; } -static int +int dpaa_sec_attach_sess_q(struct dpaa_sec_qp *qp, dpaa_sec_session *sess) { int ret; @@ -3115,7 +3112,7 @@ dpaa_sec_dev_infos_get(struct rte_cryptodev *dev, info->feature_flags = dev->feature_flags; info->capabilities = dpaa_sec_capabilities; info->sym.max_nb_sessions = internals->max_nb_sessions; - info->driver_id = cryptodev_driver_id; + info->driver_id = dpaa_cryptodev_driver_id; } } @@ -3311,7 +3308,10 @@ static struct rte_cryptodev_ops crypto_ops = { .queue_pair_release = dpaa_sec_queue_pair_release, .sym_session_get_size = dpaa_sec_sym_session_get_size, .sym_session_configure = dpaa_sec_sym_session_configure, - .sym_session_clear = dpaa_sec_sym_session_clear + .sym_session_clear = dpaa_sec_sym_session_clear, + /* Raw data-path API related operations */ + .sym_get_raw_dp_ctx_size = dpaa_sec_get_dp_ctx_size, + .sym_configure_raw_dp_ctx = dpaa_sec_configure_raw_dp_ctx, }; #ifdef RTE_LIB_SECURITY @@ -3362,7 +3362,7 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) PMD_INIT_FUNC_TRACE(); - cryptodev->driver_id = cryptodev_driver_id; + cryptodev->driver_id = dpaa_cryptodev_driver_id; cryptodev->dev_ops = &crypto_ops; cryptodev->enqueue_burst = dpaa_sec_enqueue_burst; @@ -3371,6 +3371,7 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) RTE_CRYPTODEV_FF_HW_ACCELERATED | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | RTE_CRYPTODEV_FF_SECURITY | + RTE_CRYPTODEV_FF_SYM_RAW_DP | RTE_CRYPTODEV_FF_IN_PLACE_SGL | RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT | RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | @@ -3536,5 +3537,5 @@ static struct cryptodev_driver dpaa_sec_crypto_drv; RTE_PMD_REGISTER_DPAA(CRYPTODEV_NAME_DPAA_SEC_PMD, rte_dpaa_sec_driver); RTE_PMD_REGISTER_CRYPTO_DRIVER(dpaa_sec_crypto_drv, rte_dpaa_sec_driver.driver, - cryptodev_driver_id); + dpaa_cryptodev_driver_id); RTE_LOG_REGISTER(dpaa_logtype_sec, pmd.crypto.dpaa, NOTICE); diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h index 368699678b..f6e83d46e7 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.h +++ b/drivers/crypto/dpaa_sec/dpaa_sec.h @@ -19,6 +19,8 @@ #define AES_CTR_IV_LEN 16 #define AES_GCM_IV_LEN 12 +extern uint8_t dpaa_cryptodev_driver_id; + #define DPAA_IPv6_DEFAULT_VTC_FLOW 0x60000000 /* Minimum job descriptor consists of a oneword job descriptor HEADER and @@ -117,6 +119,24 @@ struct sec_pdcp_ctxt { uint32_t hfn_threshold; /*!< HFN Threashold for key renegotiation */ }; #endif + +typedef int (*dpaa_sec_build_fd_t)( + void *qp, uint8_t *drv_ctx, struct rte_crypto_vec *data_vec, + uint16_t n_data_vecs, union rte_crypto_sym_ofs ofs, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *aad_or_auth_iv, + void *user_data); + +typedef struct dpaa_sec_job* (*dpaa_sec_build_raw_dp_fd_t)(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata); + typedef struct dpaa_sec_session_entry { struct sec_cdb cdb; /**< cmd block associated with qp */ struct dpaa_sec_qp *qp[MAX_DPAA_CORES]; @@ -129,6 +149,8 @@ typedef struct dpaa_sec_session_entry { #ifdef RTE_LIB_SECURITY enum rte_security_session_protocol proto_alg; /*!< Security Algorithm*/ #endif + dpaa_sec_build_fd_t build_fd; + dpaa_sec_build_raw_dp_fd_t build_raw_dp_fd; union { struct { uint8_t *data; /**< pointer to key data */ @@ -211,7 +233,10 @@ struct dpaa_sec_job { #define DPAA_MAX_NB_MAX_DIGEST 32 struct dpaa_sec_op_ctx { struct dpaa_sec_job job; - struct rte_crypto_op *op; + union { + struct rte_crypto_op *op; + void *userdata; + }; struct rte_mempool *ctx_pool; /* mempool pointer for dpaa_sec_op_ctx */ uint32_t fd_status; int64_t vtop_offset; @@ -803,4 +828,16 @@ calc_chksum(void *buffer, int len) return result; } +int +dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id, + struct rte_crypto_raw_dp_ctx *raw_dp_ctx, + enum rte_crypto_op_sess_type sess_type, + union rte_cryptodev_session_ctx session_ctx, uint8_t is_update); + +int +dpaa_sec_get_dp_ctx_size(struct rte_cryptodev *dev); + +int +dpaa_sec_attach_sess_q(struct dpaa_sec_qp *qp, dpaa_sec_session *sess); + #endif /* _DPAA_SEC_H_ */ diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c new file mode 100644 index 0000000000..ee0ca2e0d5 --- /dev/null +++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c @@ -0,0 +1,485 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2021 NXP + */ + +#include +#include +#include +#include +#include +#ifdef RTE_LIB_SECURITY +#include +#endif + +/* RTA header files */ +#include + +#include +#include +#include + +struct dpaa_sec_raw_dp_ctx { + dpaa_sec_session *session; + uint32_t tail; + uint32_t head; + uint16_t cached_enqueue; + uint16_t cached_dequeue; +}; + +static __rte_always_inline int +dpaa_sec_raw_enqueue_done(void *qp_data, uint8_t *drv_ctx, uint32_t n) +{ + RTE_SET_USED(qp_data); + RTE_SET_USED(drv_ctx); + RTE_SET_USED(n); + + return 0; +} + +static __rte_always_inline int +dpaa_sec_raw_dequeue_done(void *qp_data, uint8_t *drv_ctx, uint32_t n) +{ + RTE_SET_USED(qp_data); + RTE_SET_USED(drv_ctx); + RTE_SET_USED(n); + + return 0; +} + +static inline struct dpaa_sec_op_ctx * +dpaa_sec_alloc_raw_ctx(dpaa_sec_session *ses, int sg_count) +{ + struct dpaa_sec_op_ctx *ctx; + int i, retval; + + retval = rte_mempool_get( + ses->qp[rte_lcore_id() % MAX_DPAA_CORES]->ctx_pool, + (void **)(&ctx)); + if (!ctx || retval) { + DPAA_SEC_DP_WARN("Alloc sec descriptor failed!"); + return NULL; + } + /* + * Clear SG memory. There are 16 SG entries of 16 Bytes each. + * one call to dcbz_64() clear 64 bytes, hence calling it 4 times + * to clear all the SG entries. dpaa_sec_alloc_ctx() is called for + * each packet, memset is costlier than dcbz_64(). + */ + for (i = 0; i < sg_count && i < MAX_JOB_SG_ENTRIES; i += 4) + dcbz_64(&ctx->job.sg[i]); + + ctx->ctx_pool = ses->qp[rte_lcore_id() % MAX_DPAA_CORES]->ctx_pool; + ctx->vtop_offset = (size_t) ctx - rte_mempool_virt2iova(ctx); + + return ctx; +} + +static struct dpaa_sec_job * +build_dpaa_raw_dp_auth_fd(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata) +{ + RTE_SET_USED(drv_ctx); + RTE_SET_USED(sgl); + RTE_SET_USED(dest_sgl); + RTE_SET_USED(iv); + RTE_SET_USED(digest); + RTE_SET_USED(auth_iv); + RTE_SET_USED(ofs); + RTE_SET_USED(userdata); + + return NULL; +} + +static struct dpaa_sec_job * +build_dpaa_raw_dp_cipher_fd(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata) +{ + RTE_SET_USED(digest); + RTE_SET_USED(auth_iv); + dpaa_sec_session *ses = + ((struct dpaa_sec_raw_dp_ctx *)drv_ctx)->session; + struct dpaa_sec_job *cf; + struct dpaa_sec_op_ctx *ctx; + struct qm_sg_entry *sg, *out_sg, *in_sg; + unsigned int i; + uint8_t *IV_ptr = iv->va; + int data_len, total_len = 0, data_offset; + + for (i = 0; i < sgl->num; i++) + total_len += sgl->vec[i].len; + + data_len = total_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; + data_offset = ofs.ofs.cipher.head; + + /* Support lengths in bits only for SNOW3G and ZUC */ + if (sgl->num > MAX_SG_ENTRIES) { + DPAA_SEC_DP_ERR("Cipher: Max sec segs supported is %d", + MAX_SG_ENTRIES); + return NULL; + } + + ctx = dpaa_sec_alloc_raw_ctx(ses, sgl->num * 2 + 3); + if (!ctx) + return NULL; + + cf = &ctx->job; + ctx->userdata = (void *)userdata; + + /* output */ + out_sg = &cf->sg[0]; + out_sg->extension = 1; + out_sg->length = data_len; + qm_sg_entry_set64(out_sg, rte_dpaa_mem_vtop(&cf->sg[2])); + cpu_to_hw_sg(out_sg); + + if (dest_sgl) { + /* 1st seg */ + sg = &cf->sg[2]; + qm_sg_entry_set64(sg, dest_sgl->vec[0].iova); + sg->length = dest_sgl->vec[0].len - data_offset; + sg->offset = data_offset; + + /* Successive segs */ + for (i = 1; i < dest_sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, dest_sgl->vec[i].iova); + sg->length = dest_sgl->vec[i].len; + } + } else { + /* 1st seg */ + sg = &cf->sg[2]; + qm_sg_entry_set64(sg, sgl->vec[0].iova); + sg->length = sgl->vec[0].len - data_offset; + sg->offset = data_offset; + + /* Successive segs */ + for (i = 1; i < sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, sgl->vec[i].iova); + sg->length = sgl->vec[i].len; + } + + } + sg->final = 1; + cpu_to_hw_sg(sg); + + /* input */ + in_sg = &cf->sg[1]; + in_sg->extension = 1; + in_sg->final = 1; + in_sg->length = data_len + ses->iv.length; + + sg++; + qm_sg_entry_set64(in_sg, rte_dpaa_mem_vtop(sg)); + cpu_to_hw_sg(in_sg); + + /* IV */ + qm_sg_entry_set64(sg, rte_dpaa_mem_vtop(IV_ptr)); + sg->length = ses->iv.length; + cpu_to_hw_sg(sg); + + /* 1st seg */ + sg++; + qm_sg_entry_set64(sg, sgl->vec[0].iova); + sg->length = sgl->vec[0].len - data_offset; + sg->offset = data_offset; + + /* Successive segs */ + for (i = 1; i < sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, sgl->vec[i].iova); + sg->length = sgl->vec[i].len; + } + sg->final = 1; + cpu_to_hw_sg(sg); + + return cf; +} + +static uint32_t +dpaa_sec_raw_enqueue_burst(void *qp_data, uint8_t *drv_ctx, + struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs, + void *user_data[], int *status) +{ + /* Function to transmit the frames to given device and queuepair */ + uint32_t loop; + struct dpaa_sec_qp *dpaa_qp = (struct dpaa_sec_qp *)qp_data; + uint16_t num_tx = 0; + struct qm_fd fds[DPAA_SEC_BURST], *fd; + uint32_t frames_to_send; + struct dpaa_sec_job *cf; + dpaa_sec_session *ses = + ((struct dpaa_sec_raw_dp_ctx *)drv_ctx)->session; + uint32_t flags[DPAA_SEC_BURST] = {0}; + struct qman_fq *inq[DPAA_SEC_BURST]; + + if (unlikely(!DPAA_PER_LCORE_PORTAL)) { + if (rte_dpaa_portal_init((void *)0)) { + DPAA_SEC_ERR("Failure in affining portal"); + return 0; + } + } + + while (vec->num) { + frames_to_send = (vec->num > DPAA_SEC_BURST) ? + DPAA_SEC_BURST : vec->num; + for (loop = 0; loop < frames_to_send; loop++) { + if (unlikely(!ses->qp[rte_lcore_id() % MAX_DPAA_CORES])) { + if (dpaa_sec_attach_sess_q(dpaa_qp, ses)) { + frames_to_send = loop; + goto send_pkts; + } + } else if (unlikely(ses->qp[rte_lcore_id() % + MAX_DPAA_CORES] != dpaa_qp)) { + DPAA_SEC_DP_ERR("Old:sess->qp = %p" + " New qp = %p\n", + ses->qp[rte_lcore_id() % + MAX_DPAA_CORES], dpaa_qp); + frames_to_send = loop; + goto send_pkts; + } + + /*Clear the unused FD fields before sending*/ + fd = &fds[loop]; + memset(fd, 0, sizeof(struct qm_fd)); + cf = ses->build_raw_dp_fd(drv_ctx, + &vec->src_sgl[loop], + &vec->dest_sgl[loop], + &vec->iv[loop], + &vec->digest[loop], + &vec->auth_iv[loop], + ofs, + user_data[loop]); + if (!cf) { + DPAA_SEC_ERR("error: Improper packet contents" + " for crypto operation"); + goto skip_tx; + } + inq[loop] = ses->inq[rte_lcore_id() % MAX_DPAA_CORES]; + fd->opaque_addr = 0; + fd->cmd = 0; + qm_fd_addr_set64(fd, rte_dpaa_mem_vtop(cf->sg)); + fd->_format1 = qm_fd_compound; + fd->length29 = 2 * sizeof(struct qm_sg_entry); + + status[loop] = 1; + } +send_pkts: + loop = 0; + while (loop < frames_to_send) { + loop += qman_enqueue_multi_fq(&inq[loop], &fds[loop], + &flags[loop], frames_to_send - loop); + } + vec->num -= frames_to_send; + num_tx += frames_to_send; + } + +skip_tx: + dpaa_qp->tx_pkts += num_tx; + dpaa_qp->tx_errs += vec->num - num_tx; + + return num_tx; +} + +static int +dpaa_sec_deq_raw(struct dpaa_sec_qp *qp, void **out_user_data, + uint8_t is_user_data_array, + rte_cryptodev_raw_post_dequeue_t post_dequeue, + int nb_ops) +{ + struct qman_fq *fq; + unsigned int pkts = 0; + int num_rx_bufs, ret; + struct qm_dqrr_entry *dq; + uint32_t vdqcr_flags = 0; + uint8_t is_success = 0; + + fq = &qp->outq; + /* + * Until request for four buffers, we provide exact number of buffers. + * Otherwise we do not set the QM_VDQCR_EXACT flag. + * Not setting QM_VDQCR_EXACT flag can provide two more buffers than + * requested, so we request two less in this case. + */ + if (nb_ops < 4) { + vdqcr_flags = QM_VDQCR_EXACT; + num_rx_bufs = nb_ops; + } else { + num_rx_bufs = nb_ops > DPAA_MAX_DEQUEUE_NUM_FRAMES ? + (DPAA_MAX_DEQUEUE_NUM_FRAMES - 2) : (nb_ops - 2); + } + ret = qman_set_vdq(fq, num_rx_bufs, vdqcr_flags); + if (ret) + return 0; + + do { + const struct qm_fd *fd; + struct dpaa_sec_job *job; + struct dpaa_sec_op_ctx *ctx; + + dq = qman_dequeue(fq); + if (!dq) + continue; + + fd = &dq->fd; + /* sg is embedded in an op ctx, + * sg[0] is for output + * sg[1] for input + */ + job = rte_dpaa_mem_ptov(qm_fd_addr_get64(fd)); + + ctx = container_of(job, struct dpaa_sec_op_ctx, job); + ctx->fd_status = fd->status; + if (is_user_data_array) + out_user_data[pkts] = ctx->userdata; + else + out_user_data[0] = ctx->userdata; + + if (!ctx->fd_status) { + is_success = true; + } else { + is_success = false; + DPAA_SEC_DP_WARN("SEC return err:0x%x", ctx->fd_status); + } + post_dequeue(ctx->op, pkts, is_success); + pkts++; + + /* report op status to sym->op and then free the ctx memory */ + rte_mempool_put(ctx->ctx_pool, (void *)ctx); + + qman_dqrr_consume(fq, dq); + } while (fq->flags & QMAN_FQ_STATE_VDQCR); + + return pkts; +} + + +static __rte_always_inline uint32_t +dpaa_sec_raw_dequeue_burst(void *qp_data, uint8_t *drv_ctx, + rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count, + uint32_t max_nb_to_dequeue, + rte_cryptodev_raw_post_dequeue_t post_dequeue, + void **out_user_data, uint8_t is_user_data_array, + uint32_t *n_success, int *dequeue_status) +{ + RTE_SET_USED(drv_ctx); + RTE_SET_USED(get_dequeue_count); + uint16_t num_rx; + struct dpaa_sec_qp *dpaa_qp = (struct dpaa_sec_qp *)qp_data; + uint32_t nb_ops = max_nb_to_dequeue; + + if (unlikely(!DPAA_PER_LCORE_PORTAL)) { + if (rte_dpaa_portal_init((void *)0)) { + DPAA_SEC_ERR("Failure in affining portal"); + return 0; + } + } + + num_rx = dpaa_sec_deq_raw(dpaa_qp, out_user_data, + is_user_data_array, post_dequeue, nb_ops); + + dpaa_qp->rx_pkts += num_rx; + *dequeue_status = 1; + *n_success = num_rx; + + DPAA_SEC_DP_DEBUG("SEC Received %d Packets\n", num_rx); + + return num_rx; +} + +static __rte_always_inline int +dpaa_sec_raw_enqueue(void *qp_data, uint8_t *drv_ctx, + struct rte_crypto_vec *data_vec, + uint16_t n_data_vecs, union rte_crypto_sym_ofs ofs, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *aad_or_auth_iv, + void *user_data) +{ + RTE_SET_USED(qp_data); + RTE_SET_USED(drv_ctx); + RTE_SET_USED(data_vec); + RTE_SET_USED(n_data_vecs); + RTE_SET_USED(ofs); + RTE_SET_USED(iv); + RTE_SET_USED(digest); + RTE_SET_USED(aad_or_auth_iv); + RTE_SET_USED(user_data); + + return 0; +} + +static __rte_always_inline void * +dpaa_sec_raw_dequeue(void *qp_data, uint8_t *drv_ctx, int *dequeue_status, + enum rte_crypto_op_status *op_status) +{ + RTE_SET_USED(qp_data); + RTE_SET_USED(drv_ctx); + RTE_SET_USED(dequeue_status); + RTE_SET_USED(op_status); + + return NULL; +} + +int +dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id, + struct rte_crypto_raw_dp_ctx *raw_dp_ctx, + enum rte_crypto_op_sess_type sess_type, + union rte_cryptodev_session_ctx session_ctx, uint8_t is_update) +{ + dpaa_sec_session *sess; + struct dpaa_sec_raw_dp_ctx *dp_ctx; + RTE_SET_USED(qp_id); + + if (!is_update) { + memset(raw_dp_ctx, 0, sizeof(*raw_dp_ctx)); + raw_dp_ctx->qp_data = dev->data->queue_pairs[qp_id]; + } + + if (sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) + sess = (dpaa_sec_session *)get_sec_session_private_data( + session_ctx.sec_sess); + else if (sess_type == RTE_CRYPTO_OP_WITH_SESSION) + sess = (dpaa_sec_session *)get_sym_session_private_data( + session_ctx.crypto_sess, dpaa_cryptodev_driver_id); + else + return -ENOTSUP; + raw_dp_ctx->dequeue_burst = dpaa_sec_raw_dequeue_burst; + raw_dp_ctx->dequeue = dpaa_sec_raw_dequeue; + raw_dp_ctx->dequeue_done = dpaa_sec_raw_dequeue_done; + raw_dp_ctx->enqueue_burst = dpaa_sec_raw_enqueue_burst; + raw_dp_ctx->enqueue = dpaa_sec_raw_enqueue; + raw_dp_ctx->enqueue_done = dpaa_sec_raw_enqueue_done; + + if (sess->ctxt == DPAA_SEC_CIPHER) + sess->build_raw_dp_fd = build_dpaa_raw_dp_cipher_fd; + else if (sess->ctxt == DPAA_SEC_AUTH) + sess->build_raw_dp_fd = build_dpaa_raw_dp_auth_fd; + else + return -ENOTSUP; + dp_ctx = (struct dpaa_sec_raw_dp_ctx *)raw_dp_ctx->drv_ctx_data; + dp_ctx->session = sess; + + return 0; +} + +int +dpaa_sec_get_dp_ctx_size(__rte_unused struct rte_cryptodev *dev) +{ + return sizeof(struct dpaa_sec_raw_dp_ctx); +} diff --git a/drivers/crypto/dpaa_sec/meson.build b/drivers/crypto/dpaa_sec/meson.build index 44fd60e5ae..f87ad6c7e7 100644 --- a/drivers/crypto/dpaa_sec/meson.build +++ b/drivers/crypto/dpaa_sec/meson.build @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright 2018 NXP +# Copyright 2018-2021 NXP if not is_linux build = false @@ -7,7 +7,7 @@ if not is_linux endif deps += ['bus_dpaa', 'mempool_dpaa', 'security'] -sources = files('dpaa_sec.c') +sources = files('dpaa_sec.c', 'dpaa_sec_raw_dp.c') includes += include_directories('../../bus/dpaa/include') includes += include_directories('../../common/dpaax') From patchwork Thu Aug 12 07:12:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495967 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp84083jap; Thu, 12 Aug 2021 00:17:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzRa1+xAqWo5rtaRVA1sqz/gLPPGc9BZRDevs2cBZSKJXt2BJov6It7Nx9rr9SqtYrQAte X-Received: by 2002:a05:6402:394:: with SMTP id o20mr3791737edv.232.1628752663122; Thu, 12 Aug 2021 00:17:43 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id e3si1731560eds.128.2021.08.12.00.17.42; Thu, 12 Aug 2021 00:17:43 -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=F4MGTuZd; 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 3A1F64125D; Thu, 12 Aug 2021 09:16:29 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20049.outbound.protection.outlook.com [40.107.2.49]) by mails.dpdk.org (Postfix) with ESMTP id 5443B4125A for ; Thu, 12 Aug 2021 09:16:28 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R52PDsfQNIqez2AYS4mtIibOiVgx2ISZOfhSssm1T7iNQ34zpsYIj/TFit0ruy4vTZRI2AHPPshfGDkETr+3h8h1K77wvMs96ZF0RDt9NPsMpngJk86SWRZfJqafnw9DsANYGy7Tfr6yNqkJ4xAlF72sU9a/DBhyUvYBJVcMTp1FVFEsOS76F22BMCYrBlwS+vDE+tES3HmsgFt66ntp5n79/Vyu+iwk4t1ooJ+E7s1IkhZjB4AOrqnBNZ/46mXv5qHF9NFHTmX4UKV68nSBg8FmsdME0UHEhQcbaaZwcy/fR09SehJY7wH3HQ/7+iwLuj2dsQinLcZ5bh5pB15b5g== 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=YqaXcWZmzes9i4Dns5vYrmIBnikEsdWyaDkbLdillH4=; b=Nh24K49Oi1QqHkGkOajs7XhOiHHnhnhPvibHeJmw4WxyBpHNU/UNBTNUqddFlbPvOKcKRx8HPW/fbMWD53j+ksgGOJpkcDnMAHlRJ9gAMvBhlzP9dJP1UzhxbwSRR0GSK4Y82zMdxEM9LwJTFeyHInU99DuABHkO9/Z6E+7yqfzsg/sgRcd8moEOf67S37Sh5P1pA4vop49AMLsHuSqNSYmznfMi8yWf2P8usK8wpU/k70lJpsCz2lYo0TH73AxwHnYODFIwlJov95XDdG/f3TLbOOpqxGvgVJTClUZxbznIMIcBKM5rSDtNNVu78szVvvr4BjmdVfCnWmWdpA6awQ== 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=YqaXcWZmzes9i4Dns5vYrmIBnikEsdWyaDkbLdillH4=; b=F4MGTuZdGTB0P1YG/OD54qsp2MKbVfXgE1SguDP24FFTPeLyBSbzBGDWglQFkbTfWqRlO6l0dfR3msW72BJnSZChXiO69KbcBQkRnvXiYg8J+8dvx/CYl24fF9lzuf4I7JHsSeUFtlvIal1xmbMMD0A9p2ycoJJNqn3bjIIEP9M= 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:27 +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:27 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:41 +0530 Message-Id: <20210812071244.28799-14-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:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4ac7483c-6c0c-4efc-c87f-08d95d6119b1 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1443; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eALC/H0P2JfJ57dzuTemRjq9o5bFaE6CKAykc/RpZ3W3ONOVemw+wfyav/xKqDVEAlgV4qMiYCDzDPz+BRZuZFmmGcak0cSi6ilH4sKesjOffV2sTF6xWHyEU9XZWVC3peLk1thlYNIlj3Naz3VxMWN7mvKw2pevKXH6Rb4h/lqGswZVwskJV+5Y7PYkWbPYCy7RJa5aDaGzhdlUGaPCOMOdqehaDZWu8ll4CgepggzILKU667U/WBCt+8Z4SlZTT2TTWNUP44bCd3c8MZHWdEHsjiRm/geOGhKcVHPQAqWIV7VVT91Bd7S9wfSyw79jXX775jJPtDXZiK14ubomBIvh0SyMSlijpo1rsHrKDoYd/79diXiFmER6HiVQgCqZzRVQ2NoZJqua2czz0mO1wd1uTdmT6rAmYSRz7yS9OKj8ekHvLTZhBauClyrxvviu3C5vxHD2ur3CszBaGc7WvBpvSxxDihecUbMaCA5TC/tFoCfqi7SL+8ldWlcXTiSfACXhkkj+6jlQitdsgNEMOlX3EOZERb9y6rJ3g3qG5F46BCEVHnsuZtuv6OwK2tGNpwIxFY88qxs8V5Knt8WABcKOwgJRQ7II9xE9+pBynateOd0SSv4IHexmF1dHpYCGwJZ7ZfUzWWQ+z+lQ1sOkw7Si/d0uD/l9hGIxS1HBu8zKZL691oXI2QgGVKzir8drCELkaubhxytdUenJsF1K4w== 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: SBgpplDxCfMe/8OqoscHp7tVwgRHrRLYHhhu/rntj5Hfcu6yihozJ9SesJtt1mrI2XTGL4Kn/D3M5Tqzzs48TZSdD/7krNzeS3PesNaLlN/B7so5m1ZSCU5se2OXcxISVymLmODtj6M307Wvh70wmbom8YxKp8sHDU424yLAW9F2Fz2j3ol+2tqEXcgpLmK1TzTPt2saVux5FyWuY7jumvCx8cFjTCIF1KjCS1bRWNBW3ae40I1pzR4QbA3H+7BQv2ROQBAsuFWhVMICnKFBqhY8fB9UTwuoJEMU4EHVA+C84S/jIKl5ITejsEphPJTmuCXJvaSxJQpQYN2O84/K+vKSKN8jJ4lYSCmjRgjcHGj5MBl8A5SDwrPvCrF0dlekKv0MctttvTooi2L3d+5sbTTTlmbquSGxLvR7pA11BtcONXMWKePHY+JeUKsxxqy0TBC6AmyBiPARD1q9kR5OTN5teE37ApUrUzZLKjHMRH0dX9bLs/6gEkCMsFPZLQYC+J7EEmRKfXhEQEtmp5Ke5QmS3+A6nzvcCTBEFvyCgldz7faiH1Udhy90Msn6wNy3i93foaw45mk73X5Mfvx3oRjorA1LlyvlIAA0S3fJxkAaJLIvNzCyv9IuCLtHh07ALeWzhRTIhVPwciqZNz7lLNjGfPBBZ0yLGvQphEYn5IYNnHmRjMR0dF+BmjX2Xbw3KOToQ0afDYXelxxabhrZ81UWwsexSF2wcjMMnVb0pwtcvnyj0S9XOsWB6/d7QZqTnU6VAYnRbpiu/EOiPCqAsQIJVtMEUbHG0ypIUhlWV3Nw99BbpN5W9shm9sJyJHYStQ1HjS2+YBdVWiApqfKtiRY3lZxTCcec43/UG0mN8vYNIZQ+QyDxhV5CeEUNUCbsnk92IY+DzHm+YDi1mjA+EZyNhWKFOp80CZCG2SmQ7FaEH2REzFUFMmkrKLWtpAQp6P4vPYb2ntWbSbDAylhRTp+2TYV7Ew0x+n+ERN/B0xyru7RYNJjztrulEKjqFAP8OEmggZYilT/2lK8G8rbSdN8iP/Prc2Ig1/HgUdtYF8TaLAU+YIY0de2YaZnYzBnXPCZRFloQC01HTb/tNaFsY8ft1fmFm1K59pXA12dnhcR7sBkqckmsTOvXOwGgicm2tSNfoNPqX1zbw3oYWrpRxCIshf3JLcpCvoy2PT38GgZzWMCWhmguKOYX2FoIzpMERv2nK/b601QrvKgvLk5v1OA0A7fiS99TjMP2zRRWsmBG+M6HOrHcS9Z6BFSamlNghdA4BeQeUz/uNiGg9NXB72Jx6vRrkbGi4UQTftUghg0STRfoBGDO25SvZJkAqFs/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ac7483c-6c0c-4efc-c87f-08d95d6119b1 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:27.5720 (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: zeTdRF8bqFHCWkliHCV+X4+Xx67zQVtIyAoC/qZNYtDBZsH2eByYDedZtCSNpd6KVHw5Uat0heOCyHkCe9K9hQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 13/16] crypto/dpaa_sec: support authonly and chain with raw APIs 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" From: Gagandeep Singh This patch improves the raw vector support in dpaa_sec driver for authonly and chain usecase. Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa_sec/dpaa_sec.h | 3 +- drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 296 +++++++++++++++++++++- 2 files changed, 287 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h index f6e83d46e7..2e0ab93ff0 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.h +++ b/drivers/crypto/dpaa_sec/dpaa_sec.h @@ -135,7 +135,8 @@ typedef struct dpaa_sec_job* (*dpaa_sec_build_raw_dp_fd_t)(uint8_t *drv_ctx, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *auth_iv, union rte_crypto_sym_ofs ofs, - void *userdata); + void *userdata, + struct qm_fd *fd); typedef struct dpaa_sec_session_entry { struct sec_cdb cdb; /**< cmd block associated with qp */ diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c index ee0ca2e0d5..4e34629f18 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c @@ -12,6 +12,7 @@ #endif /* RTA header files */ +#include #include #include @@ -26,6 +27,17 @@ struct dpaa_sec_raw_dp_ctx { uint16_t cached_dequeue; }; +static inline int +is_encode(dpaa_sec_session *ses) +{ + return ses->dir == DIR_ENC; +} + +static inline int is_decode(dpaa_sec_session *ses) +{ + return ses->dir == DIR_DEC; +} + static __rte_always_inline int dpaa_sec_raw_enqueue_done(void *qp_data, uint8_t *drv_ctx, uint32_t n) { @@ -82,18 +94,276 @@ build_dpaa_raw_dp_auth_fd(uint8_t *drv_ctx, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *auth_iv, union rte_crypto_sym_ofs ofs, - void *userdata) + void *userdata, + struct qm_fd *fd) { - RTE_SET_USED(drv_ctx); - RTE_SET_USED(sgl); RTE_SET_USED(dest_sgl); RTE_SET_USED(iv); - RTE_SET_USED(digest); RTE_SET_USED(auth_iv); - RTE_SET_USED(ofs); - RTE_SET_USED(userdata); + RTE_SET_USED(fd); - return NULL; + dpaa_sec_session *ses = + ((struct dpaa_sec_raw_dp_ctx *)drv_ctx)->session; + struct dpaa_sec_job *cf; + struct dpaa_sec_op_ctx *ctx; + struct qm_sg_entry *sg, *out_sg, *in_sg; + phys_addr_t start_addr; + uint8_t *old_digest, extra_segs; + int data_len, data_offset, total_len = 0; + unsigned int i; + + for (i = 0; i < sgl->num; i++) + total_len += sgl->vec[i].len; + + data_len = total_len - ofs.ofs.auth.head - ofs.ofs.auth.tail; + data_offset = ofs.ofs.auth.head; + + /* Support only length in bits for SNOW3G and ZUC */ + + if (is_decode(ses)) + extra_segs = 3; + else + extra_segs = 2; + + if (sgl->num > MAX_SG_ENTRIES) { + DPAA_SEC_DP_ERR("Auth: Max sec segs supported is %d", + MAX_SG_ENTRIES); + return NULL; + } + ctx = dpaa_sec_alloc_raw_ctx(ses, sgl->num * 2 + extra_segs); + if (!ctx) + return NULL; + + cf = &ctx->job; + ctx->userdata = (void *)userdata; + old_digest = ctx->digest; + + /* output */ + out_sg = &cf->sg[0]; + qm_sg_entry_set64(out_sg, digest->iova); + out_sg->length = ses->digest_length; + cpu_to_hw_sg(out_sg); + + /* input */ + in_sg = &cf->sg[1]; + /* need to extend the input to a compound frame */ + in_sg->extension = 1; + in_sg->final = 1; + in_sg->length = data_len; + qm_sg_entry_set64(in_sg, rte_dpaa_mem_vtop(&cf->sg[2])); + + /* 1st seg */ + sg = in_sg + 1; + + if (ses->iv.length) { + uint8_t *iv_ptr; + + iv_ptr = rte_crypto_op_ctod_offset(userdata, uint8_t *, + ses->iv.offset); + + if (ses->auth_alg == RTE_CRYPTO_AUTH_SNOW3G_UIA2) { + iv_ptr = conv_to_snow_f9_iv(iv_ptr); + sg->length = 12; + } else if (ses->auth_alg == RTE_CRYPTO_AUTH_ZUC_EIA3) { + iv_ptr = conv_to_zuc_eia_iv(iv_ptr); + sg->length = 8; + } else { + sg->length = ses->iv.length; + } + qm_sg_entry_set64(sg, rte_dpaa_mem_vtop(iv_ptr)); + in_sg->length += sg->length; + cpu_to_hw_sg(sg); + sg++; + } + + qm_sg_entry_set64(sg, sgl->vec[0].iova); + sg->offset = data_offset; + + if (data_len <= (int)(sgl->vec[0].len - data_offset)) { + sg->length = data_len; + } else { + sg->length = sgl->vec[0].len - data_offset; + + /* remaining i/p segs */ + for (i = 1; i < sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, sgl->vec[i].iova); + if (data_len > (int)sgl->vec[i].len) + sg->length = sgl->vec[0].len; + else + sg->length = data_len; + + data_len = data_len - sg->length; + if (data_len < 1) + break; + } + } + + if (is_decode(ses)) { + /* Digest verification case */ + cpu_to_hw_sg(sg); + sg++; + rte_memcpy(old_digest, digest->va, + ses->digest_length); + start_addr = rte_dpaa_mem_vtop(old_digest); + qm_sg_entry_set64(sg, start_addr); + sg->length = ses->digest_length; + in_sg->length += ses->digest_length; + } + sg->final = 1; + cpu_to_hw_sg(sg); + cpu_to_hw_sg(in_sg); + + return cf; +} + +static inline struct dpaa_sec_job * +build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qm_fd *fd) +{ + RTE_SET_USED(auth_iv); + + dpaa_sec_session *ses = + ((struct dpaa_sec_raw_dp_ctx *)drv_ctx)->session; + struct dpaa_sec_job *cf; + struct dpaa_sec_op_ctx *ctx; + struct qm_sg_entry *sg, *out_sg, *in_sg; + uint8_t *IV_ptr = iv->va; + unsigned int i; + uint16_t auth_hdr_len = ofs.ofs.cipher.head - + ofs.ofs.auth.head; + uint16_t auth_tail_len = ofs.ofs.auth.tail; + uint32_t auth_only_len = (auth_tail_len << 16) | auth_hdr_len; + int data_len = 0, auth_len = 0, cipher_len = 0; + + for (i = 0; i < sgl->num; i++) + data_len += sgl->vec[i].len; + + cipher_len = data_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; + auth_len = data_len - ofs.ofs.auth.head - ofs.ofs.auth.tail; + + if (sgl->num > MAX_SG_ENTRIES) { + DPAA_SEC_DP_ERR("Cipher-Auth: Max sec segs supported is %d", + MAX_SG_ENTRIES); + return NULL; + } + + ctx = dpaa_sec_alloc_raw_ctx(ses, sgl->num * 2 + 4); + if (!ctx) + return NULL; + + cf = &ctx->job; + ctx->userdata = (void *)userdata; + + rte_prefetch0(cf->sg); + + /* output */ + out_sg = &cf->sg[0]; + out_sg->extension = 1; + if (is_encode(ses)) + out_sg->length = cipher_len + ses->digest_length; + else + out_sg->length = cipher_len; + + /* output sg entries */ + sg = &cf->sg[2]; + qm_sg_entry_set64(out_sg, rte_dpaa_mem_vtop(sg)); + cpu_to_hw_sg(out_sg); + + /* 1st seg */ + if (dest_sgl) { + qm_sg_entry_set64(sg, dest_sgl->vec[0].iova); + sg->length = dest_sgl->vec[0].len - ofs.ofs.cipher.head; + sg->offset = ofs.ofs.cipher.head; + + /* Successive segs */ + for (i = 1; i < dest_sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, dest_sgl->vec[i].iova); + sg->length = dest_sgl->vec[i].len; + } + } else { + qm_sg_entry_set64(sg, sgl->vec[0].iova); + sg->length = sgl->vec[0].len - ofs.ofs.cipher.head; + sg->offset = ofs.ofs.cipher.head; + + /* Successive segs */ + for (i = 1; i < sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, sgl->vec[i].iova); + sg->length = sgl->vec[i].len; + } + } + + if (is_encode(ses)) { + cpu_to_hw_sg(sg); + /* set auth output */ + sg++; + qm_sg_entry_set64(sg, digest->iova); + sg->length = ses->digest_length; + } + sg->final = 1; + cpu_to_hw_sg(sg); + + /* input */ + in_sg = &cf->sg[1]; + in_sg->extension = 1; + in_sg->final = 1; + if (is_encode(ses)) + in_sg->length = ses->iv.length + auth_len; + else + in_sg->length = ses->iv.length + auth_len + + ses->digest_length; + + /* input sg entries */ + sg++; + qm_sg_entry_set64(in_sg, rte_dpaa_mem_vtop(sg)); + cpu_to_hw_sg(in_sg); + + /* 1st seg IV */ + qm_sg_entry_set64(sg, rte_dpaa_mem_vtop(IV_ptr)); + sg->length = ses->iv.length; + cpu_to_hw_sg(sg); + + /* 2 seg */ + sg++; + qm_sg_entry_set64(sg, sgl->vec[0].iova); + sg->length = sgl->vec[0].len - ofs.ofs.auth.head; + sg->offset = ofs.ofs.auth.head; + + /* Successive segs */ + for (i = 1; i < sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, sgl->vec[i].iova); + sg->length = sgl->vec[i].len; + } + + if (is_decode(ses)) { + cpu_to_hw_sg(sg); + sg++; + memcpy(ctx->digest, digest->va, + ses->digest_length); + qm_sg_entry_set64(sg, rte_dpaa_mem_vtop(ctx->digest)); + sg->length = ses->digest_length; + } + sg->final = 1; + cpu_to_hw_sg(sg); + + if (auth_only_len) + fd->cmd = 0x80000000 | auth_only_len; + + return cf; } static struct dpaa_sec_job * @@ -104,10 +374,13 @@ build_dpaa_raw_dp_cipher_fd(uint8_t *drv_ctx, struct rte_crypto_va_iova_ptr *digest, struct rte_crypto_va_iova_ptr *auth_iv, union rte_crypto_sym_ofs ofs, - void *userdata) + void *userdata, + struct qm_fd *fd) { RTE_SET_USED(digest); RTE_SET_USED(auth_iv); + RTE_SET_USED(fd); + dpaa_sec_session *ses = ((struct dpaa_sec_raw_dp_ctx *)drv_ctx)->session; struct dpaa_sec_job *cf; @@ -264,15 +537,14 @@ dpaa_sec_raw_enqueue_burst(void *qp_data, uint8_t *drv_ctx, &vec->digest[loop], &vec->auth_iv[loop], ofs, - user_data[loop]); + user_data[loop], + fd); if (!cf) { DPAA_SEC_ERR("error: Improper packet contents" " for crypto operation"); goto skip_tx; } inq[loop] = ses->inq[rte_lcore_id() % MAX_DPAA_CORES]; - fd->opaque_addr = 0; - fd->cmd = 0; qm_fd_addr_set64(fd, rte_dpaa_mem_vtop(cf->sg)); fd->_format1 = qm_fd_compound; fd->length29 = 2 * sizeof(struct qm_sg_entry); @@ -470,6 +742,8 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id, sess->build_raw_dp_fd = build_dpaa_raw_dp_cipher_fd; else if (sess->ctxt == DPAA_SEC_AUTH) sess->build_raw_dp_fd = build_dpaa_raw_dp_auth_fd; + else if (sess->ctxt == DPAA_SEC_CIPHER_HASH) + sess->build_raw_dp_fd = build_dpaa_raw_dp_chain_fd; else return -ENOTSUP; dp_ctx = (struct dpaa_sec_raw_dp_ctx *)raw_dp_ctx->drv_ctx_data; From patchwork Thu Aug 12 07:12:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495968 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp84190jap; Thu, 12 Aug 2021 00:17:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4aQ2MN0PCYQKqILBmeF/NrtDnek5xjYke1eRR/IuSp6zfwK0hKyhPLXZrZ+NXYx04nkmw X-Received: by 2002:a17:906:2acc:: with SMTP id m12mr2384713eje.231.1628752671281; Thu, 12 Aug 2021 00:17:51 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id f3si1508410ejj.302.2021.08.12.00.17.51; Thu, 12 Aug 2021 00:17:51 -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=qqVobeLU; 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 C4AA641263; Thu, 12 Aug 2021 09:16:31 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20050.outbound.protection.outlook.com [40.107.2.50]) by mails.dpdk.org (Postfix) with ESMTP id 1A29E41219 for ; Thu, 12 Aug 2021 09:16:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SouKAH6iM5QvZpfYsl0TKjgzbrCgFG4vc2417IE/COaQ0e9ZFjk5kSDb9j4lIfY7ee4UatjOywEWZUaNBdp1gn/5Hbpls01tzbNQqNtWgUK/6VqwgCl9LHvseKgWt6GOZSbkmU8HIKWaBH57tEM1kGp4iUxmzmH4q26Y0AkTyVQDvfpcJbBb/Pln7Eq0OvlsxDsir6blCMkcph1H6/Oxd/W0twJTiUrAn8SMglZeVN89cksYrPuxk7T158/Z8rwTjiIWOVVR2q04o/dTxKqZiUNs8BYBZW8UEyJl6dMeZSe5IRfSzhGSeb0jcJdYXgkQONtshTSq9ZXT19gi54kYWA== 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=A8iJ+j/S+ByMy8rnX+hRPOi36XD4kCFUOgoetceQrj8=; b=NpGb3k1yDl16pxSpF1dutJ926u3ZrhJXwi9JkODJNfx0YBEhclERtSRPttsD5WtVOqsND202Ms56JF60SBbgr0vPgy1cTFBho9Phmz+QiMSL941fRnECx5IgfmXcSqaKJwVr5n4ocSsXZj27ODgDviWhOwF2UAWL/DS6m6ETRqfxzhzhOq9SXVo+uXAC8aHzAwptw7cfgyheGPGprAL7lgMxceFdYHRZIrkb4XYLn7+lDFevsYc1DSLwRfifofQC8+3JXrLZqtoY8RZSmxTQ7SP4Ii5X9dJksUpihyA2lpmWWBjxwLLIxHYTKxBTUlxhgsaLQCKbtWWl70c6tfbfBA== 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=A8iJ+j/S+ByMy8rnX+hRPOi36XD4kCFUOgoetceQrj8=; b=qqVobeLUMUJ9Vb5GFgh/6D0JZi6xyVwjRGbTcq579Iuubd5dgq9ecj0q3jqzEl9o8iysH8o3t6lGwa4SC2M5OpspC5NAzGC7hBXSL+uZUMu1OzPYKcSRklmxTWgPyfBuAla2W5LcomBTmWQqs3Xq+kkR1PN/2e8p/pse9ufHMhk= 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:29 +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:29 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:42 +0530 Message-Id: <20210812071244.28799-15-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:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69b52c37-2635-48f5-3622-08d95d611ab9 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:169; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Oxd4JzSkyzky+eqAnZlf0nOJZINBy+P+1SPM9Vo4EkfKHeK8RnWeyVZ3QX3+zYN9sBgPwh8O0Nf7QgXmBSQaxp84O26MHzmktY1RKioC5Liv4wOasim70R1q9FvO2vf07FhvNSiE2MYJjowgnwe6t6HFfk4xeZvzUdASnQqIGBhnI1pNqYfJWV7WzU8LonkZ6eSdpOh8j9nN/4URDz7yIuEzX0oSw9BEaYyEGnZdR239ZzW1b6agiPurpNllrDLCy+5zoSMGS6kYx2GKkoBkLTWPDe78eF7kDrjYygRQ0doUQvZ/srvLxL1rFAstpVehTgDkLg5Efr8j1EhzxHVsc+qho5m8EPImmzyMOnMIFtByXmzrRMkvTnza35coP+wvL6eocIf3sVVNuKQ/tSc0uULlkfTyk75sRqucBr7OPYzRQUuleayp5MX8iI8pbKiD9FoKJOniolPrwRerdmNiQeX184HbZHeTaqfDKAaK5ryi+FGZ4Ro6oMQ5l47BzRsdYrX+mnybPb3GcaHOm9tghJc4ROKTiXFpwjO/eIjYOXeErv5raXTtlm5XlDi3FTzJEmr90YGG5SeuS9KTepBNr5OwdVIUuh+zU++ab26IsD0J9qypaxt9AR2GAKd0MDUj/WVkCU1vURjqwwridtCI7I27h3z5BRppnENr7IBnfcz75etUII0YZD9rvbNsyXSeDVT5WxQLChUx9n6fKWKbHA== 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: fUT+CIWB3vQS1xTsDpZOs4QR8AEMxVEuO9fO9eRULWuDAKGo7V23X3yIfC/S3G+I1BL3GwtjUKjA7sAQH3kDP94WtYB/69+uJaneldKVtydnFcVnM2Ez1wRGOnVlUOBwHLVxINuPB5a07uMXdVIJ8I6SS8bEHlMItbtqT1KAxibTrNWqA+sfYhoNLDhT0vN1yq9uQtmx5lQmdJyJxSFu/PeTkzD3QJ1wEHh411idBTUFSxi0SldjSsjvPOXL87StfsPnN3UW5WtMnbKB6227wIy26BBEeXlwh5N4uYwKgSntXsb9bNBTurJ9uSEZ8bnBM6yXHsboNVQ0QmRM5CAG7h9DVoGRMZMYxs5r8ab81iwU7C3MxM3iiW1GaR0A4hCgK8MDIgiXleGK3d7KIPCmPAqnRzhbIr03s6XhLwCT5fboqc7DKhGjFkre9X0Vr/sXDtjsXu3ORFLPOO1bHD9EA/f+cZskMglOk/GNypp55FrKIlB6K88bl3/2Twd4j257TISMxtnjcB2acHNyeApg8vJryBhbKZAvt/qKVaQuGeTdzd6HLl1CvDoJQpjpza2d6wP3fNHtNPupZ5GrdyX2Bog/MdiJv40N845uj+klMqAZfAz0Zgwnhpn+q/YxMN7C7FhChPeedJoQjQB+GS/6EwTRV96YenGBed5smIDdCyAXjdZCsA96dK/pkvn7gh14OkoN/i+vGUH2x31H3xxhSVPEgUXe/2YB9ofg17XT0qXNSXQ7WevjMwmhYnjfDbF0sWsI7dnnq4nZBjOnL4b8yxlXxrNwHqMz0jzTUMBA59n3ShdKB0c/B327Aac7IawAIgPIdz0xRxHGHxwec0T7y2XbqofAxNOFIzGW+Wt+OfQVbyGQI/cw33XFGYjJPh8nwVXSGqeL6v0M7F4D3Gd01qNFdO7swpyOgPfZWh8u3Mu9QG3PuJOBDhn7QteWn9Y8+gSWhERNNnusiv1Oxh9JyJzEisUmzh7LWSexLjZOAfDTsifeuBqorwh3B4QZo6mVBdpT20uiDYEuDwtsQTKPTcQEVyIR1GA4LcWVPBGvU5tKKBxaI1IFaVLaLR3SXrHuD4FGpuHwwxSMEAIFrKaT0GnghkMlft4pnz09MTcq+DvezzkJJB/Qc0zQzpJjA0IY6p1/jcSr4Fv+V4oagohlDP8d3L40grHH+TpnPcn0eRm4QW1gr9qBBvz5XZ7+TDXFnr+OXm9yjoTc0IPydbYbvYmkSYtNTqcy7pJ6T5hb1Hr2DbGuE+BOLHyn39OUc08uoTw9q5fkDGu+VxSGkF9khDNMyhvfvSiIUPnxKOipNlLFJ4MojhgdcnY+DWjN8Z/u X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69b52c37-2635-48f5-3622-08d95d611ab9 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:29.3004 (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: uamBZaEPhYaC7018lTLHzN2oorop4PzZucG2uppfnoDYLJQNIMaorNuJk/6QeTTzea863NydBBKPtMp4vRhCuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 14/16] crypto/dpaa_sec: support AEAD and proto with raw APIs 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" From: Gagandeep Singh This add support for AEAD and proto offload with raw APIs for dpaa_sec driver. Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 293 ++++++++++++++++++++++ 1 file changed, 293 insertions(+) -- 2.17.1 diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c index 4e34629f18..b0c22a7c26 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c @@ -218,6 +218,163 @@ build_dpaa_raw_dp_auth_fd(uint8_t *drv_ctx, return cf; } +static inline struct dpaa_sec_job * +build_raw_cipher_auth_gcm_sg(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qm_fd *fd) +{ + dpaa_sec_session *ses = + ((struct dpaa_sec_raw_dp_ctx *)drv_ctx)->session; + struct dpaa_sec_job *cf; + struct dpaa_sec_op_ctx *ctx; + struct qm_sg_entry *sg, *out_sg, *in_sg; + uint8_t extra_req_segs; + uint8_t *IV_ptr = iv->va; + int data_len = 0, aead_len = 0; + unsigned int i; + + for (i = 0; i < sgl->num; i++) + data_len += sgl->vec[i].len; + + extra_req_segs = 4; + aead_len = data_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; + + if (ses->auth_only_len) + extra_req_segs++; + + if (sgl->num > MAX_SG_ENTRIES) { + DPAA_SEC_DP_ERR("AEAD: Max sec segs supported is %d", + MAX_SG_ENTRIES); + return NULL; + } + + ctx = dpaa_sec_alloc_raw_ctx(ses, sgl->num * 2 + extra_req_segs); + if (!ctx) + return NULL; + + cf = &ctx->job; + ctx->userdata = (void *)userdata; + + rte_prefetch0(cf->sg); + + /* output */ + out_sg = &cf->sg[0]; + out_sg->extension = 1; + if (is_encode(ses)) + out_sg->length = aead_len + ses->digest_length; + else + out_sg->length = aead_len; + + /* output sg entries */ + sg = &cf->sg[2]; + qm_sg_entry_set64(out_sg, rte_dpaa_mem_vtop(sg)); + cpu_to_hw_sg(out_sg); + + if (dest_sgl) { + /* 1st seg */ + qm_sg_entry_set64(sg, dest_sgl->vec[0].iova); + sg->length = dest_sgl->vec[0].len - ofs.ofs.cipher.head; + sg->offset = ofs.ofs.cipher.head; + + /* Successive segs */ + for (i = 1; i < dest_sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, dest_sgl->vec[i].iova); + sg->length = dest_sgl->vec[i].len; + } + } else { + /* 1st seg */ + qm_sg_entry_set64(sg, sgl->vec[0].iova); + sg->length = sgl->vec[0].len - ofs.ofs.cipher.head; + sg->offset = ofs.ofs.cipher.head; + + /* Successive segs */ + for (i = 1; i < sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, sgl->vec[i].iova); + sg->length = sgl->vec[i].len; + } + + } + + if (is_encode(ses)) { + cpu_to_hw_sg(sg); + /* set auth output */ + sg++; + qm_sg_entry_set64(sg, digest->iova); + sg->length = ses->digest_length; + } + sg->final = 1; + cpu_to_hw_sg(sg); + + /* input */ + in_sg = &cf->sg[1]; + in_sg->extension = 1; + in_sg->final = 1; + if (is_encode(ses)) + in_sg->length = ses->iv.length + aead_len + + ses->auth_only_len; + else + in_sg->length = ses->iv.length + aead_len + + ses->auth_only_len + ses->digest_length; + + /* input sg entries */ + sg++; + qm_sg_entry_set64(in_sg, rte_dpaa_mem_vtop(sg)); + cpu_to_hw_sg(in_sg); + + /* 1st seg IV */ + qm_sg_entry_set64(sg, rte_dpaa_mem_vtop(IV_ptr)); + sg->length = ses->iv.length; + cpu_to_hw_sg(sg); + + /* 2 seg auth only */ + if (ses->auth_only_len) { + sg++; + qm_sg_entry_set64(sg, auth_iv->iova); + sg->length = ses->auth_only_len; + cpu_to_hw_sg(sg); + } + + /* 3rd seg */ + sg++; + qm_sg_entry_set64(sg, sgl->vec[0].iova); + sg->length = sgl->vec[0].len - ofs.ofs.cipher.head; + sg->offset = ofs.ofs.cipher.head; + + /* Successive segs */ + for (i = 1; i < sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, sgl->vec[i].iova); + sg->length = sgl->vec[i].len; + } + + if (is_decode(ses)) { + cpu_to_hw_sg(sg); + sg++; + memcpy(ctx->digest, digest->va, + ses->digest_length); + qm_sg_entry_set64(sg, rte_dpaa_mem_vtop(ctx->digest)); + sg->length = ses->digest_length; + } + sg->final = 1; + cpu_to_hw_sg(sg); + + if (ses->auth_only_len) + fd->cmd = 0x80000000 | ses->auth_only_len; + + return cf; +} + static inline struct dpaa_sec_job * build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, struct rte_crypto_sgl *sgl, @@ -484,6 +641,135 @@ build_dpaa_raw_dp_cipher_fd(uint8_t *drv_ctx, return cf; } +#ifdef RTE_LIBRTE_SECURITY +static inline struct dpaa_sec_job * +build_dpaa_raw_proto_sg(uint8_t *drv_ctx, + struct rte_crypto_sgl *sgl, + struct rte_crypto_sgl *dest_sgl, + struct rte_crypto_va_iova_ptr *iv, + struct rte_crypto_va_iova_ptr *digest, + struct rte_crypto_va_iova_ptr *auth_iv, + union rte_crypto_sym_ofs ofs, + void *userdata, + struct qm_fd *fd) +{ + RTE_SET_USED(iv); + RTE_SET_USED(digest); + RTE_SET_USED(auth_iv); + RTE_SET_USED(ofs); + + dpaa_sec_session *ses = + ((struct dpaa_sec_raw_dp_ctx *)drv_ctx)->session; + struct dpaa_sec_job *cf; + struct dpaa_sec_op_ctx *ctx; + struct qm_sg_entry *sg, *out_sg, *in_sg; + uint32_t in_len = 0, out_len = 0; + unsigned int i; + + if (sgl->num > MAX_SG_ENTRIES) { + DPAA_SEC_DP_ERR("Proto: Max sec segs supported is %d", + MAX_SG_ENTRIES); + return NULL; + } + + ctx = dpaa_sec_alloc_raw_ctx(ses, sgl->num * 2 + 4); + if (!ctx) + return NULL; + cf = &ctx->job; + ctx->userdata = (void *)userdata; + /* output */ + out_sg = &cf->sg[0]; + out_sg->extension = 1; + qm_sg_entry_set64(out_sg, rte_dpaa_mem_vtop(&cf->sg[2])); + + if (dest_sgl) { + /* 1st seg */ + sg = &cf->sg[2]; + qm_sg_entry_set64(sg, dest_sgl->vec[0].iova); + sg->offset = 0; + sg->length = dest_sgl->vec[0].len; + out_len += sg->length; + + for (i = 1; i < dest_sgl->num; i++) { + /* Successive segs */ + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, dest_sgl->vec[i].iova); + sg->offset = 0; + sg->length = dest_sgl->vec[i].len; + out_len += sg->length; + } + sg->length = dest_sgl->vec[i - 1].tot_len; + } else { + /* 1st seg */ + sg = &cf->sg[2]; + qm_sg_entry_set64(sg, sgl->vec[0].iova); + sg->offset = 0; + sg->length = sgl->vec[0].len; + out_len += sg->length; + + for (i = 1; i < sgl->num; i++) { + /* Successive segs */ + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, sgl->vec[i].iova); + sg->offset = 0; + sg->length = sgl->vec[i].len; + out_len += sg->length; + } + sg->length = sgl->vec[i - 1].tot_len; + + } + out_len += sg->length; + sg->final = 1; + cpu_to_hw_sg(sg); + + out_sg->length = out_len; + cpu_to_hw_sg(out_sg); + + /* input */ + in_sg = &cf->sg[1]; + in_sg->extension = 1; + in_sg->final = 1; + in_len = sgl->vec[0].len; + + sg++; + qm_sg_entry_set64(in_sg, rte_dpaa_mem_vtop(sg)); + + /* 1st seg */ + qm_sg_entry_set64(sg, sgl->vec[0].iova); + sg->length = sgl->vec[0].len; + sg->offset = 0; + + /* Successive segs */ + for (i = 1; i < sgl->num; i++) { + cpu_to_hw_sg(sg); + sg++; + qm_sg_entry_set64(sg, sgl->vec[i].iova); + sg->length = sgl->vec[i].len; + sg->offset = 0; + in_len += sg->length; + } + sg->final = 1; + cpu_to_hw_sg(sg); + + in_sg->length = in_len; + cpu_to_hw_sg(in_sg); + + if ((ses->ctxt == DPAA_SEC_PDCP) && ses->pdcp.hfn_ovd) { + fd->cmd = 0x80000000 | + *((uint32_t *)((uint8_t *)userdata + + ses->pdcp.hfn_ovd_offset)); + DPAA_SEC_DP_DEBUG("Per packet HFN: %x, ovd:%u\n", + *((uint32_t *)((uint8_t *)userdata + + ses->pdcp.hfn_ovd_offset)), + ses->pdcp.hfn_ovd); + } + + return cf; +} +#endif + static uint32_t dpaa_sec_raw_enqueue_burst(void *qp_data, uint8_t *drv_ctx, struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs, @@ -744,6 +1030,13 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id, sess->build_raw_dp_fd = build_dpaa_raw_dp_auth_fd; else if (sess->ctxt == DPAA_SEC_CIPHER_HASH) sess->build_raw_dp_fd = build_dpaa_raw_dp_chain_fd; + else if (sess->ctxt == DPAA_SEC_AEAD) + sess->build_raw_dp_fd = build_raw_cipher_auth_gcm_sg; +#ifdef RTE_LIBRTE_SECURITY + else if (sess->ctxt == DPAA_SEC_IPSEC || + sess->ctxt == DPAA_SEC_PDCP) + sess->build_raw_dp_fd = build_dpaa_raw_proto_sg; +#endif else return -ENOTSUP; dp_ctx = (struct dpaa_sec_raw_dp_ctx *)raw_dp_ctx->drv_ctx_data; 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); From patchwork Thu Aug 12 07:12:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495970 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp84385jap; Thu, 12 Aug 2021 00:18:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ96nrxfdPtHNRjYfEG4s8jy0asCwwkU8hC0GkkdFOe3kxENpjTWBjxIPytJRG0RJGev0Z X-Received: by 2002:a50:ec0a:: with SMTP id g10mr3783250edr.125.1628752685948; Thu, 12 Aug 2021 00:18:05 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id 8si1817661ejx.341.2021.08.12.00.18.05; Thu, 12 Aug 2021 00:18:05 -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=pEQJccR4; 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 B762941272; Thu, 12 Aug 2021 09:16:34 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20070.outbound.protection.outlook.com [40.107.2.70]) by mails.dpdk.org (Postfix) with ESMTP id 721444126A for ; Thu, 12 Aug 2021 09:16:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jAprVlF/DZyfSbj6T4vOleqePNpgGXYXnFNevqxgU1AkLssj2vg6uK0ql/tHJq1HXFmrHi7S5TIY/VSi9YV/vcylVlpKe4YLs4ByKdGLdWQwExu/WyHUuinOREHBoVBK4A0j8cD2In1y5RLGuodfOnzWkV7J0/lOFTEJR3M7Dy29avJ/Dz0pS9tBJHylp/oh6RwuF9K9dinyEWywaNa+pSxcIkuzm8ju5kDOTs+e4mkfe+86RMopWgEd+QXCq+Ol8S/+b41ihMIX5ruVNMcNZyEztA+/Rj9flny2T0gDQPsY4lpIsW/PANK4dWjez04NgmCIV8JmfXjM3tc+bYXQrQ== 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=Ja32qw5ZGijgE/hddaC442uYcjv1gYi0TKk1x3fzxEA=; b=DCVVgi6Qe2Fp4Pcr6tyEiOs/VwbpfxhOubi6+TBYEJSdhq0jirtwEABW+EYQ3uQLMl9chNmj9BopsNs1y/LvpKJFdmPL6hRqWpgQcpfS6SHkMGG5Zz8xkild0Yq76oHbeJi60ik7cZhnJxi/0WyGb6E+i92JWzUJ8V/MtRIWlBC61lz8Na5TwfzCbLJmxNI7gVMGC77khV3P6Fy0+LPcK8rQ9L5kxe3vXTPImcmYxELyQj9ymHF2L371yuYGfOfodhsrJGS6mQVLQ+e7w7eMNzFslusyK+UcCfUQBmFLfkFQpEWsrcV8heb3vhBFigVEdDPu8XX8G0O2wjuque7+1w== 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=Ja32qw5ZGijgE/hddaC442uYcjv1gYi0TKk1x3fzxEA=; b=pEQJccR46Swv2qnSyOuiRBPP6QkQx4JS6VTOAiNHz3eAABMcQCvnoAMn/r7T14XRUng/oty1Qr8m7DTDJ4EDQ8+IUQ594+J+FQRs5fdrxujZYsLO7bP6nUziQs7FF6kPf7eV5CwrklxCse+3WndcIjfqDhZ3PvvBrBbwaDE8v2A= 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:32 +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:32 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:44 +0530 Message-Id: <20210812071244.28799-17-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:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f0f1ec0a-a633-4106-ddcd-08d95d611ccb X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GIAYCxQ5XLInrA6Uc3Zr6cIaBpFsVX50E6nv1U/hSEEqf0wR9hkyszGppNlTVq+ZO7Heg8jx5wiPaE3ALBwShbPjpEzM4g5jhNZZw/xzV64z3iJukx/CpY6yncIbqPfykNvLwH/VdEyI/mcjM2Q9jkcZ9ClGb+eu+KlILItJWOLggk02FEuH/6xnjWUxD3PcwnnXIMiR0X7+HXJYtBKEVVRzPrPdDO1IZhGRfLWoe2NvUrTmT2+lfnKLWH1QI0M1tk8FxfHua9OcHbgykG9Odfmep2O2Tygfir3xvZtujtwF4ua67kxACY3tFcDPY+n/qz7/hOz1e5qAKKlC2hVfULDjLKDghtJfYPujxHe43lcEGk5e7/G3sDymzKKdTDmadZZUd6x2ctAReyEkS+zP3iQ4JfO37GEIXZ/TGcYSFDtZfRvu0iwVDljcr/kZxBHZDevzLjWi6d6wiSPyQlQ2TFvQG0zoP9Oq4wCh6sPku7NomHxa59+OG2sq6pjj7mfyOyu0mm08MZqrfGsqVvxOjKbhXW5Xt4gP7yh5qJyjchWmcmlyT2MNSrhiKADMxZJiiLqjCrosfANdn2RLSwsiJzdaeYRo9JmjIcQTt9q0vutf5eFLwf8VJatfByqPDJk6T/DSR3OABhRj3+LoBErGQGVc901MW5l+rzRzmfysgtk+ForPCV+GpgdRMc5to2xWJO3TsYuXRoNx0oM3qnFZTw== 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: F6edhGcNhagRyXHKTy1M2dzflr8AAqgotoy5YmYI0hPeSyqdxgPVcoQQWGWSRAhLngHPmuaqE0xfZVXB3lpJOOiTVEeG4HOtY7zFJ+Q+xhslkR9YsFZ/4bL2oLbHdgoaGDKhDAJzJctrRcjvZU844ZNs5ZIrdWfEaQXBy8hrJfXNo9KdTPGEeXVKJgDnzhrkZQnWXsWy9TbqLdSuIUbxLPlaCUQdKmS5uXJEegvUhyqR+jvDbJtaLkApbBmFj6OzBG2mx1KErhbnBw07pxcSq7Q4ku29pJnHU7QDeBCr2FCuvT5MM9HbJKXGfAvkzNeMc4g87o2GLjR3JMmWgluh+Y0UEF4o6xUSHCppk29c5PNqJ+wIhRH4nmlueFKyNQ/Tu7tOqFJyQhI1yQZZGwnfplOxpJthaXGZlc3aGAOkeAwYPB4+w+JV2kUHnXLwC1PBM/o79TbD+2jA+sxqtAhgWVmq4yHgX5EgBnHv//SJU4PJxw7OJSyzDgFyN/giz2ELnutSI/js3cC1Ky9jnYlMD83yLcR/pFMVJSBHaoZ6UPzCjZ1Vdz1jRNIeB3Vq8+MjFNpWD8aTBYoe15i6pM6ugw/U97fUiLHqayYAmK47UBhe5bX3mnD35gYT5KNpCr5t3uQ41pd4vQsHyXSt5bBnGqB4T4aYP1IU6b+5aHhnkLzHz3GmzwpyokGrMpqJSAZrqRSP4AwpjT53fVXDWf/7/9NiSqKvEuSY9OSjLTPXfypDm+fhPzBkLRLmrMGC94oKD6R5MgywlcmvnQhirHvMuW9P/UzdAIAMqK6WPFjyiZOpanQDi5nmBXfe5/2FE4nfri6LlsUVOZuF8F7P5G9arww1UWBbDLFTf4b2Yz0rkBBCf6BOv6SwjNJo778wKXFp/kF2GEV5bnYBJ08UI6JUMJWyyqn7nWUrCEheJy8hzxd4/y9j60DyqI+N7qGvnPYRnWqWKlN0CJAZWTei9xEeHZmlFNfYGgBVHrGFdDVT8bk44cjuSxC2LWTskLDWBEvqMkVgsXbfDY4ubwIviXZOo4qYsjW50dLkOd6UTAk01wIUgRRUNmx7UNg2h9LDGWIaUyjo6Gns2VXJ01PyKEcQRp3bXPEbccVqRMHP/tmTlGkIQJqaBYRSPQH2+0tvPRo2sxBtLCOMWYTssnkb3OJINo1SSxU8cQXJHUb7nLCvhxA/1ad1p3zieg0zkUrykrpKeSrvYDkJ0yRDz9eLtUC17rNl3jm/a5E3MA9UJp4ITLbowhSd2+cMi17VLS7ody2ybrBlBc+Vur0Ki0bMkLPcrDVxeV3nRV9cxqQIVg/TvT4iMqGn+P09oPblcF64NKfP X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0f1ec0a-a633-4106-ddcd-08d95d611ccb 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:32.7771 (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: TfWdM2pD+HsvfoofvwneH/KflxhknODJG75idP0lR9fUx7HWd92bKN8a/X4Fr6Cl8X8f7h2Mg5shhLD+aC3+Aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 16/16] test/crypto: enabling raw API support in 5G algos 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 testing with ZUC and SNOW test cases. Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal --- app/test/test_cryptodev.c | 57 ++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 59bed6e6d2..ab3394bb09 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -368,6 +368,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id, } op->status = (count == MAX_RAW_DEQUEUE_COUNT + 1 || ret_op != op || + ret_op->status == RTE_CRYPTO_OP_STATUS_ERROR || n_success < 1) ? RTE_CRYPTO_OP_STATUS_ERROR : RTE_CRYPTO_OP_STATUS_SUCCESS; @@ -4152,6 +4153,16 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata) int retval; unsigned plaintext_pad_len; unsigned plaintext_len; + 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; + + 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_cryptodev_sym_capability_idx cap_idx; @@ -4207,7 +4218,11 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata) if (retval < 0) return retval; - ut_params->op = 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, 1, 0, 1, tdata->cipher_iv.len); + else + ut_params->op = process_crypto_request(ts_params->valid_devs[0], ut_params->op); TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf"); @@ -4267,6 +4282,12 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata) 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 -ENOTSUP; + } + /* Create SNOW 3G session */ retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0], RTE_CRYPTO_CIPHER_OP_ENCRYPT, @@ -4301,7 +4322,11 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata) if (retval < 0) return retval; - ut_params->op = 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, 1, 0, 1, tdata->cipher_iv.len); + else + ut_params->op = process_crypto_request(ts_params->valid_devs[0], ut_params->op); TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf"); @@ -4428,7 +4453,11 @@ test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata) if (retval < 0) return retval; - ut_params->op = 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, 1, 0, 1, tdata->cipher_iv.len); + else + ut_params->op = process_crypto_request(ts_params->valid_devs[0], ut_params->op); TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf"); @@ -4559,7 +4588,16 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata) uint8_t *plaintext, *ciphertext; unsigned ciphertext_pad_len; unsigned ciphertext_len; + 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; + 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_cryptodev_sym_capability_idx cap_idx; cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; @@ -4617,7 +4655,11 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata) if (retval < 0) return retval; - ut_params->op = 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, 1, 0, 1, tdata->cipher_iv.len); + else + ut_params->op = process_crypto_request(ts_params->valid_devs[0], ut_params->op); TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf"); ut_params->obuf = ut_params->op->sym->m_dst; @@ -12653,10 +12695,13 @@ test_authenticated_decryption_fail_when_corruption( else { ut_params->op = process_crypto_request(ts_params->valid_devs[0], ut_params->op); - TEST_ASSERT_NULL(ut_params->op, "authentication not failed"); } + if (ut_params->op == NULL) + return 0; + else if (ut_params->op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) + return 0; - return 0; + return -1; } static int